@lunora/studio 1.0.0-alpha.24 → 1.0.0-alpha.26

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.
@@ -248,7 +248,7 @@ Use (?: \u2026 ) instead`);if(!z.lineBreaks&&te.test(`
248
248
  `))throw new Error("Rule should declare lineBreaks: "+te);_.push(c(X))}}var se=U&&U.fallback,J=o&&!se?"ym":"gm",ne=o||se?"":"|";j===!0&&(J+="u");var pe=new RegExp(d(_)+ne,J);return{regexp:pe,groups:N,fast:W,error:U||b}}n(S,"compileRules");function w(M){var L=S(y(M));return new E({start:L},"start")}n(w,"compile");function C(M,L,U){var W=M&&(M.push||M.next);if(W&&!U[W])throw new Error("Missing state '"+W+"' (in token '"+M.defaultType+"' of state '"+L+"')");if(M&&M.pop&&+M.pop!=1)throw new Error("pop must be 1 (in token '"+M.defaultType+"' of state '"+L+"')")}n(C,"checkStateGroup");function F(M,L){var U=M.$all?y(M.$all):[];delete M.$all;var W=Object.getOwnPropertyNames(M);L||(L=W[0]);for(var V=Object.create(null),j=0;j<W.length;j++){var N=W[j];V[N]=y(M[N]).concat(U)}for(var j=0;j<W.length;j++)for(var N=W[j],_=V[N],B=Object.create(null),z=0;z<_.length;z++){var q=_[z];if(q.include){var $=[z,1];if(q.include!==N&&!B[q.include]){B[q.include]=!0;var Y=V[q.include];if(!Y)throw new Error("Cannot include nonexistent state '"+q.include+"' (in state '"+N+"')");for(var Q=0;Q<Y.length;Q++){var X=Y[Q];_.indexOf(X)===-1&&$.push(X)}}_.splice.apply(_,$),z--}}for(var te=Object.create(null),j=0;j<W.length;j++){var N=W[j];te[N]=S(V[N],!0)}for(var j=0;j<W.length;j++){for(var ae=W[j],se=te[ae],J=se.groups,z=0;z<J.length;z++)C(J[z],ae,te);for(var ne=Object.getOwnPropertyNames(se.fast),z=0;z<ne.length;z++)C(se.fast[ne[z]],ae,te)}return new E(te,L)}n(F,"compileStates");function T(M){for(var L=typeof Map<"u",U=L?new Map:Object.create(null),W=Object.getOwnPropertyNames(M),V=0;V<W.length;V++){var j=W[V],N=M[j],_=Array.isArray(N)?N:[N];_.forEach(function(B){if(typeof B!="string")throw new Error("keyword must be string (in keyword '"+j+"')");L?U.set(B,j):U[B]=j})}return function(B){return L?U.get(B):U[B]}}n(T,"keywordTransform");var E=n(function(M,L){this.startState=L,this.states=M,this.buffer="",this.stack=[],this.reset()},"Lexer");E.prototype.reset=function(M,L){return this.buffer=M||"",this.index=0,this.line=L?L.line:1,this.col=L?L.col:1,this.queuedToken=L?L.queuedToken:null,this.queuedText=L?L.queuedText:"",this.queuedThrow=L?L.queuedThrow:null,this.setState(L?L.state:this.startState),this.stack=L&&L.stack?L.stack.slice():[],this},E.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedText:this.queuedText,queuedThrow:this.queuedThrow}},E.prototype.setState=function(M){if(!(!M||this.state===M)){this.state=M;var L=this.states[M];this.groups=L.groups,this.error=L.error,this.re=L.regexp,this.fast=L.fast}},E.prototype.popState=function(){this.setState(this.stack.pop())},E.prototype.pushState=function(M){this.stack.push(this.state),this.setState(M)};var k=o?function(M,L){return M.exec(L)}:function(M,L){var U=M.exec(L);return U[0].length===0?null:U};E.prototype._getGroup=function(M){for(var L=this.groups.length,U=0;U<L;U++)if(M[U+1]!==void 0)return this.groups[U];throw new Error("Cannot find token type for matched text")};function O(){return this.value}if(n(O,"tokenToString"),E.prototype.next=function(){var M=this.index;if(this.queuedGroup){var L=this._token(this.queuedGroup,this.queuedText,M);return this.queuedGroup=null,this.queuedText="",L}var U=this.buffer;if(M!==U.length){var N=this.fast[U.charCodeAt(M)];if(N)return this._token(N,U.charAt(M),M);var W=this.re;W.lastIndex=M;var V=k(W,U),j=this.error;if(V==null)return this._token(j,U.slice(M,U.length),M);var N=this._getGroup(V),_=V[0];return j.fallback&&V.index!==M?(this.queuedGroup=N,this.queuedText=_,this._token(j,U.slice(M,V.index),M)):this._token(N,_,M)}},E.prototype._token=function(M,L,U){var W=0;if(M.lineBreaks){var V=/\n/g,j=1;if(L===`
249
249
  `)W=1;else for(;V.exec(L);)W++,j=V.lastIndex}var N={type:typeof M.type=="function"&&M.type(L)||M.defaultType,value:typeof M.value=="function"?M.value(L):L,text:L,toString:O,offset:U,lineBreaks:W,line:this.line,col:this.col},_=L.length;if(this.index+=_,this.line+=W,W!==0?this.col=_-j+1:this.col+=_,M.shouldThrow){var B=new Error(this.formatError(N,"invalid syntax"));throw B}return M.pop?this.popState():M.push?this.pushState(M.push):M.next&&this.setState(M.next),N},typeof Symbol<"u"&&Symbol.iterator){var D=n(function(M){this.lexer=M},"LexerIterator");D.prototype.next=function(){var M=this.lexer.next();return{value:M,done:!M}},D.prototype[Symbol.iterator]=function(){return this},E.prototype[Symbol.iterator]=function(){return new D(this)}}return E.prototype.formatError=function(M,L){if(M==null)var U=this.buffer.slice(this.index),M={text:U,offset:this.index,lineBreaks:U.indexOf(`
250
250
  `)===-1?0:1,line:this.line,col:this.col};var W=2,V=Math.max(M.line-W,1),j=M.line+W,N=String(j).length,_=m(this.buffer,this.line-M.line+W+1).slice(0,5),B=[];B.push(L+" at line "+M.line+" col "+M.col+":"),B.push("");for(var z=0;z<_.length;z++){var q=_[z],$=V+z;B.push(p(String($),N)+" "+q),$===M.line&&B.push(p("",N+M.col+1)+"^")}return B.join(`
251
- `)},E.prototype.clone=function(){return new E(this.states,this.state)},E.prototype.has=function(M){return!0},{compile:w,states:F,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:T}})});var Nle=Ft(kp=>{"use strict";var i5e=kp&&kp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kp,"__esModule",{value:!0});kp.lexer=kp.states=void 0;var l5e=i5e(Ole());kp.states={body:{doubleapos:{match:"''",value:n(()=>"'","value")},quoted:{lineBreaks:!0,match:/'[{}#](?:[^']|'')*'(?!')/u,value:n(t=>t.slice(1,-1).replace(/''/g,"'"),"value")},argument:{lineBreaks:!0,match:/\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,push:"arg",value:n(t=>t.substring(1).trim(),"value")},octothorpe:"#",end:{match:"}",pop:1},content:{lineBreaks:!0,match:/[^][^{}#']*/u}},arg:{select:{lineBreaks:!0,match:/,\s*(?:plural|select|selectordinal)\s*,\s*/u,next:"select",value:n(t=>t.split(",")[1].trim(),"value")},"func-args":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,next:"body",value:n(t=>t.split(",")[1].trim(),"value")},"func-simple":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,value:n(t=>t.substring(1).trim(),"value")},end:{match:"}",pop:1}},select:{offset:{lineBreaks:!0,match:/\s*offset\s*:\s*\d+\s*/u,value:n(t=>t.split(":")[1].trim(),"value")},case:{lineBreaks:!0,match:/\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,push:"body",value:n(t=>t.substring(0,t.indexOf("{")).trim(),"value")},end:{match:/\s*\}/u,pop:1}}};kp.lexer=l5e.default.states(kp.states)});var Lle=Ft(_F=>{"use strict";Object.defineProperty(_F,"__esModule",{value:!0});_F.ParseError=void 0;_F.parse=d5e;var _le=Nle(),aP=n(t=>({offset:t.offset,line:t.line,col:t.col,text:t.text,lineBreaks:t.lineBreaks}),"getContext"),nH=n(t=>t==="plural"||t==="select"||t==="selectordinal","isSelectType");function c5e(t,e){let o="",r="";for(let s of e){let i=s.ctx.text;switch(r+=i,s.type){case"content":o+=s.value;break;case"argument":case"function":case"octothorpe":o+=i;break;default:throw new Ha(t,`Unsupported part in strict mode function arg style: ${i}`)}}return[{type:"content",value:o.trim(),ctx:Object.assign({},e[0].ctx,{text:r})}]}n(c5e,"strictArgStyleParam");var u5e=["number","date","time","spellout","ordinal","duration"],Dle=["zero","one","two","few","many","other"],Ha=class extends Error{static{n(this,"ParseError")}constructor(e,o){super(_le.lexer.formatError(e,o))}};_F.ParseError=Ha;var aH=class{static{n(this,"Parser")}constructor(e,o){var r,a,s,i;this.lexer=_le.lexer.reset(e),this.cardinalKeys=(r=o?.cardinal)!==null&&r!==void 0?r:Dle,this.ordinalKeys=(a=o?.ordinal)!==null&&a!==void 0?a:Dle,this.strict=(s=o?.strict)!==null&&s!==void 0?s:!1,this.strictPluralKeys=(i=o?.strictPluralKeys)!==null&&i!==void 0?i:!0}parse(){return this.parseBody(!1,!0)}checkSelectKey(e,o,r){if(r[0]==="="){if(o==="select")throw new Ha(e,`The case ${r} is not valid with select`)}else if(o!=="select"){let a=o==="plural"?this.cardinalKeys:this.ordinalKeys;if(this.strictPluralKeys&&a.length>0&&!a.includes(r)){let s=`The ${o} case ${r} is not valid in this locale`;throw new Ha(e,s)}}}parseSelect({value:e},o,r,a){let s={type:a,arg:e,cases:[],ctx:r};a==="plural"||a==="selectordinal"?o=!0:this.strict&&(o=!1);for(let i of this.lexer)switch(i.type){case"offset":if(a==="select")throw new Ha(i,"Unexpected plural offset for select");if(s.cases.length>0)throw new Ha(i,"Plural offset must be set before cases");s.pluralOffset=Number(i.value),r.text+=i.text,r.lineBreaks+=i.lineBreaks;break;case"case":{this.checkSelectKey(i,a,i.value),s.cases.push({key:i.value,tokens:this.parseBody(o),ctx:aP(i)});break}case"end":return s;default:throw new Ha(i,`Unexpected lexer token: ${i.type}`)}throw new Ha(null,"Unexpected message end")}parseArgToken(e,o){let r=aP(e),a=this.lexer.next();if(!a)throw new Ha(null,"Unexpected message end");if(r.text+=a.text,r.lineBreaks+=a.lineBreaks,this.strict&&(a.type==="func-simple"||a.type==="func-args")&&!u5e.includes(a.value)){let s=`Invalid strict mode function arg type: ${a.value}`;throw new Ha(e,s)}switch(a.type){case"end":return{type:"argument",arg:e.value,ctx:r};case"func-simple":{let s=this.lexer.next();if(!s)throw new Ha(null,"Unexpected message end");if(s.type!=="end")throw new Ha(s,`Unexpected lexer token: ${s.type}`);if(r.text+=s.text,nH(a.value.toLowerCase()))throw new Ha(a,`Invalid type identifier: ${a.value}`);return{type:"function",arg:e.value,key:a.value,ctx:r}}case"func-args":{if(nH(a.value.toLowerCase())){let i=`Invalid type identifier: ${a.value}`;throw new Ha(a,i)}let s=this.parseBody(this.strict?!1:o);return this.strict&&s.length>0&&(s=c5e(e,s)),{type:"function",arg:e.value,key:a.value,param:s,ctx:r}}case"select":if(nH(a.value))return this.parseSelect(e,o,r,a.value);throw new Ha(a,`Unexpected select type ${a.value}`);default:throw new Ha(a,`Unexpected lexer token: ${a.type}`)}}parseBody(e,o){let r=[],a=null;for(let s of this.lexer)if(s.type==="argument")a&&(a=null),r.push(this.parseArgToken(s,e));else if(s.type==="octothorpe"&&e)a&&(a=null),r.push({type:"octothorpe",ctx:aP(s)});else{if(s.type==="end"&&!o)return r;{let i=s.value;if(!e&&s.type==="quoted"&&i[0]==="#"){if(i.includes("{")){let c=`Unsupported escape pattern: ${i}`;throw new Ha(s,c)}i=s.text}a?(a.value+=i,a.ctx.text+=s.text,a.ctx.lineBreaks+=s.lineBreaks):(a={type:"content",value:i,ctx:aP(s)},r.push(a))}}if(o)return r;throw new Ha(null,"Unexpected message end")}};function d5e(t,e={}){return new aH(t,e).parse()}n(d5e,"parse")});var vxe=Ft(gxe=>{function DWe(t){return t==="__proto__"}n(DWe,"isUnsafeProperty");gxe.isUnsafeProperty=DWe});var Yq=Ft(xxe=>{function _We(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return t.includes(".")||t.includes("[")||t.includes("]")}}n(_We,"isDeepKey");xxe.isDeepKey=_We});var lL=Ft(yxe=>{function LWe(t){return typeof t=="string"||typeof t=="symbol"?t:Object.is(t?.valueOf?.(),-0)?"-0":String(t)}n(LWe,"toKey");yxe.toKey=LWe});var Sxe=Ft(bxe=>{function Ixe(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(Ixe).join(",");let e=String(t);return e==="0"&&Object.is(Number(t),-0)?"-0":e}n(Ixe,"toString");bxe.toString=Ixe});var cL=Ft(wxe=>{var BWe=lL(),VWe=Sxe();function UWe(t){if(Array.isArray(t))return t.map(BWe.toKey);if(typeof t=="symbol")return[t];t=VWe.toString(t);let e=[],o=t.length;if(o===0)return e;let r=0,a="",s="",i=!1;for(t.charCodeAt(0)===46&&(e.push(""),r++);r<o;){let c=t[r];s?c==="\\"&&r+1<o?(r++,a+=t[r]):c===s?s="":a+=c:i?c==='"'||c==="'"?s=c:c==="]"?(i=!1,e.push(a),a=""):a+=c:c==="["?(i=!0,a&&(e.push(a),a="")):c==="."?a&&(e.push(a),a=""):a+=c,r++}return a&&e.push(a),e}n(UWe,"toPath");wxe.toPath=UWe});var uL=Ft(Fxe=>{var Xq=vxe(),zWe=Yq(),$We=lL(),HWe=cL();function Cxe(t,e,o){if(t==null)return o;switch(typeof e){case"string":{if(Xq.isUnsafeProperty(e))return o;let r=t[e];return r===void 0?zWe.isDeepKey(e)?Cxe(t,HWe.toPath(e),o):o:r}case"number":case"symbol":{typeof e=="number"&&(e=$We.toKey(e));let r=t[e];return r===void 0?o:r}default:{if(Array.isArray(e))return jWe(t,e,o);if(Object.is(e?.valueOf(),-0)?e="-0":e=String(e),Xq.isUnsafeProperty(e))return o;let r=t[e];return r===void 0?o:r}}}n(Cxe,"get");function jWe(t,e,o){if(e.length===0)return o;let r=t;for(let a=0;a<e.length;a++){if(r==null||Xq.isUnsafeProperty(e[a]))return o;r=r[e[a]]}return r===void 0?o:r}n(jWe,"getWithPath");Fxe.get=Cxe});var HE=Ft((cRo,Rxe)=>{Rxe.exports=uL().get});var Mxe=Ft(kxe=>{function ZWe(t,e){let o=new Map;for(let r=0;r<t.length;r++){let a=t[r],s=e(a,r,t);o.has(s)||o.set(s,a)}return Array.from(o.values())}n(ZWe,"uniqBy");kxe.uniqBy=ZWe});var Oxe=Ft(Pxe=>{function JWe(t,e){return function(...o){return t.apply(this,o.slice(0,e))}}n(JWe,"ary");Pxe.ary=JWe});var Zq=Ft(Nxe=>{function eGe(t){return t}n(eGe,"identity");Nxe.identity=eGe});var _xe=Ft(Dxe=>{var tGe=uL();function oGe(t){return function(e){return tGe.get(e,t)}}n(oGe,"property");Dxe.property=oGe});var Jq=Ft(Lxe=>{function rGe(t){return t==null||typeof t!="object"&&typeof t!="function"}n(rGe,"isPrimitive");Lxe.isPrimitive=rGe});var Vxe=Ft(Bxe=>{function nGe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}n(nGe,"isTypedArray");Bxe.isTypedArray=nGe});var zxe=Ft(Uxe=>{function aGe(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}n(aGe,"getSymbols");Uxe.getSymbols=aGe});var pL=Ft($xe=>{function sGe(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}n(sGe,"getTag");$xe.getTag=sGe});var eW=Ft(In=>{var iGe="[object RegExp]",lGe="[object String]",cGe="[object Number]",uGe="[object Boolean]",dGe="[object Arguments]",fGe="[object Symbol]",pGe="[object Date]",mGe="[object Map]",hGe="[object Set]",gGe="[object Array]",vGe="[object Function]",xGe="[object ArrayBuffer]",yGe="[object Object]",IGe="[object Error]",bGe="[object DataView]",SGe="[object Uint8Array]",wGe="[object Uint8ClampedArray]",CGe="[object Uint16Array]",FGe="[object Uint32Array]",RGe="[object BigUint64Array]",EGe="[object Int8Array]",AGe="[object Int16Array]",TGe="[object Int32Array]",kGe="[object BigInt64Array]",MGe="[object Float32Array]",PGe="[object Float64Array]";In.argumentsTag=dGe;In.arrayBufferTag=xGe;In.arrayTag=gGe;In.bigInt64ArrayTag=kGe;In.bigUint64ArrayTag=RGe;In.booleanTag=uGe;In.dataViewTag=bGe;In.dateTag=pGe;In.errorTag=IGe;In.float32ArrayTag=MGe;In.float64ArrayTag=PGe;In.functionTag=vGe;In.int16ArrayTag=AGe;In.int32ArrayTag=TGe;In.int8ArrayTag=EGe;In.mapTag=mGe;In.numberTag=cGe;In.objectTag=yGe;In.regexpTag=iGe;In.setTag=hGe;In.stringTag=lGe;In.symbolTag=fGe;In.uint16ArrayTag=CGe;In.uint32ArrayTag=FGe;In.uint8ArrayTag=SGe;In.uint8ClampedArrayTag=wGe});var jxe=Ft(Hxe=>{var OGe=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();Hxe.globalThis_=OGe});var Gxe=Ft(Wxe=>{var qxe=jxe();function NGe(t){return typeof qxe.globalThis_.Buffer<"u"&&qxe.globalThis_.Buffer.isBuffer(t)}n(NGe,"isBuffer");Wxe.isBuffer=NGe});var tW=Ft(mL=>{var DGe=Jq(),_Ge=Vxe(),LGe=zxe(),BGe=pL(),ha=eW(),VGe=Gxe();function UGe(t,e){return $x(t,void 0,t,new Map,e)}n(UGe,"cloneDeepWith");function $x(t,e,o,r=new Map,a=void 0){let s=a?.(t,e,o,r);if(s!==void 0)return s;if(DGe.isPrimitive(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){let i=new Array(t.length);r.set(t,i);for(let c=0;c<t.length;c++)i[c]=$x(t[c],c,o,r,a);return Object.hasOwn(t,"index")&&(i.index=t.index),Object.hasOwn(t,"input")&&(i.input=t.input),i}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let i=new RegExp(t.source,t.flags);return i.lastIndex=t.lastIndex,i}if(t instanceof Map){let i=new Map;r.set(t,i);for(let[c,d]of t)i.set(c,$x(d,c,o,r,a));return i}if(t instanceof Set){let i=new Set;r.set(t,i);for(let c of t)i.add($x(c,void 0,o,r,a));return i}if(VGe.isBuffer(t))return t.subarray();if(_Ge.isTypedArray(t)){let i=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,i);for(let c=0;c<t.length;c++)i[c]=$x(t[c],c,o,r,a);return i}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){let i=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,i),um(i,t,o,r,a),i}if(typeof File<"u"&&t instanceof File){let i=new File([t],t.name,{type:t.type});return r.set(t,i),um(i,t,o,r,a),i}if(typeof Blob<"u"&&t instanceof Blob){let i=new Blob([t],{type:t.type});return r.set(t,i),um(i,t,o,r,a),i}if(t instanceof Error){let i=structuredClone(t);return r.set(t,i),i.message=t.message,i.name=t.name,i.stack=t.stack,i.cause=t.cause,i.constructor=t.constructor,um(i,t,o,r,a),i}if(t instanceof Boolean){let i=new Boolean(t.valueOf());return r.set(t,i),um(i,t,o,r,a),i}if(t instanceof Number){let i=new Number(t.valueOf());return r.set(t,i),um(i,t,o,r,a),i}if(t instanceof String){let i=new String(t.valueOf());return r.set(t,i),um(i,t,o,r,a),i}if(typeof t=="object"&&zGe(t)){let i=Object.create(Object.getPrototypeOf(t));return r.set(t,i),um(i,t,o,r,a),i}return t}n($x,"cloneDeepWithImpl");function um(t,e,o=t,r,a){let s=[...Object.keys(e),...LGe.getSymbols(e)];for(let i=0;i<s.length;i++){let c=s[i],d=Object.getOwnPropertyDescriptor(t,c);(d==null||d.writable)&&(t[c]=$x(e[c],c,o,r,a))}}n(um,"copyProperties");function zGe(t){switch(BGe.getTag(t)){case ha.argumentsTag:case ha.arrayTag:case ha.arrayBufferTag:case ha.dataViewTag:case ha.booleanTag:case ha.dateTag:case ha.float32ArrayTag:case ha.float64ArrayTag:case ha.int8ArrayTag:case ha.int16ArrayTag:case ha.int32ArrayTag:case ha.mapTag:case ha.numberTag:case ha.objectTag:case ha.regexpTag:case ha.setTag:case ha.stringTag:case ha.symbolTag:case ha.uint8ArrayTag:case ha.uint8ClampedArrayTag:case ha.uint16ArrayTag:case ha.uint32ArrayTag:return!0;default:return!1}}n(zGe,"isCloneableObject");mL.cloneDeepWith=UGe;mL.cloneDeepWithImpl=$x;mL.copyProperties=um});var Yxe=Ft(Kxe=>{var $Ge=tW();function HGe(t){return $Ge.cloneDeepWithImpl(t,void 0,t,new Map,void 0)}n(HGe,"cloneDeep");Kxe.cloneDeep=HGe});var hL=Ft(Xxe=>{function jGe(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}n(jGe,"isEqualsSameValueZero");Xxe.isEqualsSameValueZero=jGe});var oW=Ft(()=>{hL()});var rW=Ft(Qxe=>{function qGe(t){return t!==null&&(typeof t=="object"||typeof t=="function")}n(qGe,"isObject");Qxe.isObject=qGe});var rye=Ft(oye=>{var Zxe=Jq(),Jxe=hL();oW();var WGe=rW();function eye(t,e,o){return typeof o!="function"?eye(t,e,()=>{}):nW(t,e,n(function r(a,s,i,c,d,f){let p=o(a,s,i,c,d,f);return p!==void 0?!!p:nW(a,s,r,f)},"doesMatch"),new Map)}n(eye,"isMatchWith");function nW(t,e,o,r){if(e===t)return!0;switch(typeof e){case"object":return GGe(t,e,o,r);case"function":return Object.keys(e).length>0?nW(t,{...e},o,r):Jxe.isEqualsSameValueZero(t,e);default:return WGe.isObject(t)?typeof e=="string"?e==="":!0:Jxe.isEqualsSameValueZero(t,e)}}n(nW,"isMatchWithInternal");function GGe(t,e,o,r){if(e==null)return!0;if(Array.isArray(e))return tye(t,e,o,r);if(e instanceof Map)return KGe(t,e,o,r);if(e instanceof Set)return YGe(t,e,o,r);let a=Object.keys(e);if(t==null||Zxe.isPrimitive(t))return a.length===0;if(a.length===0)return!0;if(r?.has(e))return r.get(e)===t;r?.set(e,t);try{for(let s=0;s<a.length;s++){let i=a[s];if(!Zxe.isPrimitive(t)&&!(i in t)||e[i]===void 0&&t[i]!==void 0||e[i]===null&&t[i]!==null||!o(t[i],e[i],i,t,e,r))return!1}return!0}finally{r?.delete(e)}}n(GGe,"isObjectMatch");function KGe(t,e,o,r){if(e.size===0)return!0;if(!(t instanceof Map))return!1;for(let[a,s]of e.entries())if(o(t.get(a),s,a,t,e,r)===!1)return!1;return!0}n(KGe,"isMapMatch");function tye(t,e,o,r){if(e.length===0)return!0;if(!Array.isArray(t))return!1;let a=new Set;for(let s=0;s<e.length;s++){let i=e[s],c=!1;for(let d=0;d<t.length;d++){if(a.has(d))continue;let f=t[d],p=!1;if(o(f,i,s,t,e,r)&&(p=!0),p){a.add(d),c=!0;break}}if(!c)return!1}return!0}n(tye,"isArrayMatch");function YGe(t,e,o,r){return e.size===0?!0:t instanceof Set?tye([...t],[...e],o,r):!1}n(YGe,"isSetMatch");oye.isMatchWith=eye});var aW=Ft(nye=>{var XGe=rye();function QGe(t,e){return XGe.isMatchWith(t,e,()=>{})}n(QGe,"isMatch");nye.isMatch=QGe});var sye=Ft(aye=>{var ZGe=Yxe(),JGe=aW();function eKe(t){return t=ZGe.cloneDeep(t),e=>JGe.isMatch(e,t)}n(eKe,"matches");aye.matches=eKe});var lye=Ft(iye=>{var tKe=pL(),gL=eW(),vL=tW();function oKe(t,e){return vL.cloneDeepWith(t,(o,r,a,s)=>{let i=e?.(o,r,a,s);if(i!==void 0)return i;if(typeof t=="object"){if(tKe.getTag(t)==="[object Object]"&&typeof t.constructor!="function"){let c={};return s.set(t,c),vL.copyProperties(c,t,a,s),c}switch(Object.prototype.toString.call(t)){case gL.numberTag:case gL.stringTag:case gL.booleanTag:{let c=new t.constructor(t?.valueOf());return vL.copyProperties(c,t),c}case gL.argumentsTag:{let c={};return vL.copyProperties(c,t),c.length=t.length,c[Symbol.iterator]=t[Symbol.iterator],c}default:return}}})}n(oKe,"cloneDeepWith");iye.cloneDeepWith=oKe});var uye=Ft(cye=>{var rKe=lye();function nKe(t){return rKe.cloneDeepWith(t)}n(nKe,"cloneDeep");cye.cloneDeep=nKe});var sW=Ft(dye=>{var aKe=/^(?:0|[1-9]\d*)$/;function sKe(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<e;case"symbol":return!1;case"string":return aKe.test(t)}}n(sKe,"isIndex");dye.isIndex=sKe});var pye=Ft(fye=>{var iKe=pL();function lKe(t){return t!==null&&typeof t=="object"&&iKe.getTag(t)==="[object Arguments]"}n(lKe,"isArguments");fye.isArguments=lKe});var hye=Ft(mye=>{var cKe=Yq(),uKe=cL(),dKe=sW(),fKe=pye();function pKe(t,e){let o;if(Array.isArray(e)?o=e:typeof e=="string"&&cKe.isDeepKey(e)&&t?.[e]==null?o=uKe.toPath(e):o=[e],o.length===0)return!1;let r=t;for(let a=0;a<o.length;a++){let s=o[a];if((r==null||!Object.hasOwn(r,s))&&!((Array.isArray(r)||fKe.isArguments(r))&&dKe.isIndex(s)&&s<r.length))return!1;r=r[s]}return!0}n(pKe,"has");mye.has=pKe});var vye=Ft(gye=>{var mKe=lL(),hKe=uL(),gKe=aW(),vKe=uye(),xKe=hye();function yKe(t,e){switch(typeof t){case"object":Object.is(t?.valueOf(),-0)&&(t="-0");break;case"number":t=mKe.toKey(t);break}return e=vKe.cloneDeep(e),function(o){let r=hKe.get(o,t);return r===void 0?xKe.has(o,t):e===void 0?r===void 0:gKe.isMatch(r,e)}}n(yKe,"matchesProperty");gye.matchesProperty=yKe});var yye=Ft(xye=>{var IKe=Zq(),bKe=_xe(),SKe=sye(),wKe=vye();function CKe(t){if(t==null)return IKe.identity;switch(typeof t){case"function":return t;case"object":return Array.isArray(t)&&t.length===2?wKe.matchesProperty(t[0],t[1]):SKe.matches(t);case"string":case"symbol":case"number":return bKe.property(t)}}n(CKe,"iteratee");xye.iteratee=CKe});var bye=Ft(Iye=>{function FKe(t){return Number.isSafeInteger(t)&&t>=0}n(FKe,"isLength");Iye.isLength=FKe});var iW=Ft(Sye=>{var RKe=bye();function EKe(t){return t!=null&&typeof t!="function"&&RKe.isLength(t.length)}n(EKe,"isArrayLike");Sye.isArrayLike=EKe});var Cye=Ft(wye=>{function AKe(t){return typeof t=="object"&&t!==null}n(AKe,"isObjectLike");wye.isObjectLike=AKe});var Rye=Ft(Fye=>{var TKe=iW(),kKe=Cye();function MKe(t){return kKe.isObjectLike(t)&&TKe.isArrayLike(t)}n(MKe,"isArrayLikeObject");Fye.isArrayLikeObject=MKe});var Aye=Ft(Eye=>{var PKe=Mxe(),OKe=Oxe(),NKe=Zq(),DKe=yye(),_Ke=Rye();function LKe(t,e=NKe.identity){return _Ke.isArrayLikeObject(t)?PKe.uniqBy(Array.from(t),OKe.ary(DKe.iteratee(e),1)):[]}n(LKe,"uniqBy");Eye.uniqBy=LKe});var kye=Ft((REo,Tye)=>{Tye.exports=Aye().uniqBy});var Dye=Ft(Nye=>{function zKe(t,e=1){let o=[],r=Math.floor(e),a=n((s,i)=>{for(let c=0;c<s.length;c++){let d=s[c];Array.isArray(d)&&i<r?a(d,i+1):o.push(d)}},"recursive");return a(t,0),o}n(zKe,"flatten");Nye.flatten=zKe});var cW=Ft(_ye=>{var $Ke=hL();oW();var HKe=iW(),jKe=rW(),qKe=sW();function WKe(t,e,o){return jKe.isObject(o)&&(typeof e=="number"&&HKe.isArrayLike(o)&&qKe.isIndex(e)&&e<o.length||typeof e=="string"&&e in o)?$Ke.isEqualsSameValueZero(o[e],t):!1}n(WKe,"isIterateeCall");_ye.isIterateeCall=WKe});var Vye=Ft(Bye=>{function Lye(t){return typeof t=="symbol"?1:t===null?2:t===void 0?3:t!==t?4:0}n(Lye,"getPriority");var GKe=n((t,e,o)=>{if(t!==e){let r=Lye(t),a=Lye(e);if(r===a&&r===0){if(t<e)return o==="desc"?1:-1;if(t>e)return o==="desc"?-1:1}return o==="desc"?a-r:r-a}return 0},"compareValues");Bye.compareValues=GKe});var uW=Ft(Uye=>{function KKe(t){return typeof t=="symbol"||t instanceof Symbol}n(KKe,"isSymbol");Uye.isSymbol=KKe});var $ye=Ft(zye=>{var YKe=uW(),XKe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,QKe=/^\w*$/;function ZKe(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||YKe.isSymbol(t)?!0:typeof t=="string"&&(QKe.test(t)||!XKe.test(t))||e!=null&&Object.hasOwn(e,t)}n(ZKe,"isKey");zye.isKey=ZKe});var jye=Ft(Hye=>{var JKe=cL(),eYe=Vye(),tYe=$ye();function oYe(t,e,o,r){if(t==null)return[];o=r?void 0:o,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(o)||(o=o==null?[]:[o]),o=o.map(c=>String(c));let a=n((c,d)=>{let f=c;for(let p=0;p<d.length&&f!=null;++p)f=f[d[p]];return f},"getValueByNestedPath"),s=n((c,d)=>d==null||c==null?d:typeof c=="object"&&"key"in c?Object.hasOwn(d,c.key)?d[c.key]:a(d,c.path):typeof c=="function"?c(d):Array.isArray(c)?a(d,c):typeof d=="object"?d[c]:d,"getValueByCriterion"),i=e.map(c=>(Array.isArray(c)&&c.length===1&&(c=c[0]),c==null||typeof c=="function"||Array.isArray(c)||tYe.isKey(c)?c:{key:c,path:JKe.toPath(c)}));return t.map(c=>({original:c,criteria:i.map(d=>s(d,c))})).slice().sort((c,d)=>{for(let f=0;f<i.length;f++){let p=eYe.compareValues(c.criteria[f],d.criteria[f],o[f]);if(p!==0)return p}return 0}).map(c=>c.original)}n(oYe,"orderBy");Hye.orderBy=oYe});var Gye=Ft(Wye=>{var rYe=Dye(),qye=cW(),nYe=jye();function aYe(t,...e){let o=e.length;return o>1&&qye.isIterateeCall(t,e[0],e[1])?e=[]:o>2&&qye.isIterateeCall(e[0],e[1],e[2])&&(e=[e[0]]),nYe.orderBy(t,rYe.flatten(e),["asc"])}n(aYe,"sortBy");Wye.sortBy=aYe});var GE=Ft((GEo,Kye)=>{Kye.exports=Gye().sortBy});var bbe=Ft(Ibe=>{function VXe(t,e,{signal:o,edges:r}={}){let a,s=null,i=r!=null&&r.includes("leading"),c=r==null||r.includes("trailing"),d=n(()=>{s!==null&&(t.apply(a,s),a=void 0,s=null)},"invoke"),f=n(()=>{c&&d(),v()},"onTimerEnd"),p=null,m=n(()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},e)},"schedule"),h=n(()=>{p!==null&&(clearTimeout(p),p=null)},"cancelTimer"),v=n(()=>{h(),a=void 0,s=null},"cancel"),x=n(()=>{d()},"flush"),y=n(function(...b){if(o?.aborted)return;a=this,s=b;let S=p==null;m(),i&&S&&d()},"debounced");return y.schedule=m,y.cancel=v,y.flush=x,o?.addEventListener("abort",v,{once:!0}),y}n(VXe,"debounce");Ibe.debounce=VXe});var wbe=Ft(Sbe=>{var UXe=bbe();function zXe(t,e=0,o={}){typeof o!="object"&&(o={});let{leading:r=!1,trailing:a=!0,maxWait:s}=o,i=Array(2);r&&(i[0]="leading"),a&&(i[1]="trailing");let c,d=null,f=UXe.debounce(function(...h){c=t.apply(this,h),d=null},e,{edges:i}),p=n(function(...h){return s!=null&&(d===null&&(d=Date.now()),Date.now()-d>=s)?(c=t.apply(this,h),d=Date.now(),f.cancel(),f.schedule(),c):(f.apply(this,h),c)},"debounced"),m=n(()=>(f.flush(),c),"flush");return p.cancel=f.cancel,p.flush=m,p}n(zXe,"debounce");Sbe.debounce=zXe});var Fbe=Ft(Cbe=>{var $Xe=wbe();function HXe(t,e=0,o={}){let{leading:r=!0,trailing:a=!0}=o;return $Xe.debounce(t,e,{leading:r,maxWait:e,trailing:a})}n(HXe,"throttle");Cbe.throttle=HXe});var Ebe=Ft((nAo,Rbe)=>{Rbe.exports=Fbe().throttle});var Gbe=Ft(Wbe=>{"use strict";(function(){function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}n(t,"is"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=oe(),o=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,a=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;Wbe.useSyncExternalStoreWithSelector=function(d,f,p,m,h){var v=a(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=i(function(){function b(T){if(!S){if(S=!0,w=T,T=m(T),h!==void 0&&x.hasValue){var E=x.value;if(h(E,T))return C=E}return C=T}if(E=C,o(w,T))return E;var k=m(T);return h!==void 0&&h(E,k)?(w=T,E):(w=T,C=k)}n(b,"memoizedSelector");var S=!1,w,C,F=p===void 0?null:p;return[function(){return b(f())},F===null?void 0:function(){return b(F())}]},[f,p,m,h]);var y=r(d,v[0],v[1]);return s(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var Ybe=Ft((OAo,Kbe)=>{"use strict";Kbe.exports=Gbe()});var fSe=Ft(dSe=>{var aJe=uW();function sJe(t){return aJe.isSymbol(t)?NaN:Number(t)}n(sJe,"toNumber");dSe.toNumber=sJe});var mSe=Ft(pSe=>{var iJe=fSe();function lJe(t){return t?(t=iJe.toNumber(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}n(lJe,"toFinite");pSe.toFinite=lJe});var gSe=Ft(hSe=>{var QW=mSe(),cJe=cW();function uJe(t,e,o){o&&typeof o!="number"&&cJe.isIterateeCall(t,e,o)&&(e=o=void 0),t=QW.toFinite(t),e===void 0?(e=t,t=0):e=QW.toFinite(e),o=o===void 0?t<e?1:-1:QW.toFinite(o);let r=Math.max(Math.ceil((e-t)/(o||1)),0),a=new Array(r);for(let s=0;s<r;s++)a[s]=t,t+=o;return a}n(uJe,"range");hSe.range=uJe});var xSe=Ft((Mko,vSe)=>{vSe.exports=gSe().range});var eG=Ft((CSe,m3)=>{(function(t){"use strict";var e=1e9,o={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},r=!0,a="[DecimalError] ",s=a+"Invalid argument: ",i=a+"Exponent out of range: ",c=Math.floor,d=Math.pow,f=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,p,m=1e7,h=7,v=9007199254740991,x=c(v/h),y={};y.absoluteValue=y.abs=function(){var N=new this.constructor(this);return N.s&&(N.s=1),N},y.comparedTo=y.cmp=function(N){var _,B,z,q,$=this;if(N=new $.constructor(N),$.s!==N.s)return $.s||-N.s;if($.e!==N.e)return $.e>N.e^$.s<0?1:-1;for(z=$.d.length,q=N.d.length,_=0,B=z<q?z:q;_<B;++_)if($.d[_]!==N.d[_])return $.d[_]>N.d[_]^$.s<0?1:-1;return z===q?0:z>q^$.s<0?1:-1},y.decimalPlaces=y.dp=function(){var N=this,_=N.d.length-1,B=(_-N.e)*h;if(_=N.d[_],_)for(;_%10==0;_/=10)B--;return B<0?0:B},y.dividedBy=y.div=function(N){return C(this,new this.constructor(N))},y.dividedToIntegerBy=y.idiv=function(N){var _=this,B=_.constructor;return M(C(_,new B(N),0,1),B.precision)},y.equals=y.eq=function(N){return!this.cmp(N)},y.exponent=function(){return T(this)},y.greaterThan=y.gt=function(N){return this.cmp(N)>0},y.greaterThanOrEqualTo=y.gte=function(N){return this.cmp(N)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return this.s===0},y.lessThan=y.lt=function(N){return this.cmp(N)<0},y.lessThanOrEqualTo=y.lte=function(N){return this.cmp(N)<1},y.logarithm=y.log=function(N){var _,B=this,z=B.constructor,q=z.precision,$=q+5;if(N===void 0)N=new z(10);else if(N=new z(N),N.s<1||N.eq(p))throw Error(a+"NaN");if(B.s<1)throw Error(a+(B.s?"NaN":"-Infinity"));return B.eq(p)?new z(0):(r=!1,_=C(O(B,$),O(N,$),$),r=!0,M(_,q))},y.minus=y.sub=function(N){var _=this;return N=new _.constructor(N),_.s==N.s?L(_,N):b(_,(N.s=-N.s,N))},y.modulo=y.mod=function(N){var _,B=this,z=B.constructor,q=z.precision;if(N=new z(N),!N.s)throw Error(a+"NaN");return B.s?(r=!1,_=C(B,N,0,1).times(N),r=!0,B.minus(_)):M(new z(B),q)},y.naturalExponential=y.exp=function(){return F(this)},y.naturalLogarithm=y.ln=function(){return O(this)},y.negated=y.neg=function(){var N=new this.constructor(this);return N.s=-N.s||0,N},y.plus=y.add=function(N){var _=this;return N=new _.constructor(N),_.s==N.s?b(_,N):L(_,(N.s=-N.s,N))},y.precision=y.sd=function(N){var _,B,z,q=this;if(N!==void 0&&N!==!!N&&N!==1&&N!==0)throw Error(s+N);if(_=T(q)+1,z=q.d.length-1,B=z*h+1,z=q.d[z],z){for(;z%10==0;z/=10)B--;for(z=q.d[0];z>=10;z/=10)B++}return N&&_>B?_:B},y.squareRoot=y.sqrt=function(){var N,_,B,z,q,$,Y,Q=this,X=Q.constructor;if(Q.s<1){if(!Q.s)return new X(0);throw Error(a+"NaN")}for(N=T(Q),r=!1,q=Math.sqrt(+Q),q==0||q==1/0?(_=w(Q.d),(_.length+N)%2==0&&(_+="0"),q=Math.sqrt(_),N=c((N+1)/2)-(N<0||N%2),q==1/0?_="5e"+N:(_=q.toExponential(),_=_.slice(0,_.indexOf("e")+1)+N),z=new X(_)):z=new X(q.toString()),B=X.precision,q=Y=B+3;;)if($=z,z=$.plus(C(Q,$,Y+2)).times(.5),w($.d).slice(0,Y)===(_=w(z.d)).slice(0,Y)){if(_=_.slice(Y-3,Y+1),q==Y&&_=="4999"){if(M($,B+1,0),$.times($).eq(Q)){z=$;break}}else if(_!="9999")break;Y+=4}return r=!0,M(z,B)},y.times=y.mul=function(N){var _,B,z,q,$,Y,Q,X,te,ae=this,se=ae.constructor,J=ae.d,ne=(N=new se(N)).d;if(!ae.s||!N.s)return new se(0);for(N.s*=ae.s,B=ae.e+N.e,X=J.length,te=ne.length,X<te&&($=J,J=ne,ne=$,Y=X,X=te,te=Y),$=[],Y=X+te,z=Y;z--;)$.push(0);for(z=te;--z>=0;){for(_=0,q=X+z;q>z;)Q=$[q]+ne[z]*J[q-z-1]+_,$[q--]=Q%m|0,_=Q/m|0;$[q]=($[q]+_)%m|0}for(;!$[--Y];)$.pop();return _?++B:$.shift(),N.d=$,N.e=B,r?M(N,se.precision):N},y.toDecimalPlaces=y.todp=function(N,_){var B=this,z=B.constructor;return B=new z(B),N===void 0?B:(S(N,0,e),_===void 0?_=z.rounding:S(_,0,8),M(B,N+T(B)+1,_))},y.toExponential=function(N,_){var B,z=this,q=z.constructor;return N===void 0?B=U(z,!0):(S(N,0,e),_===void 0?_=q.rounding:S(_,0,8),z=M(new q(z),N+1,_),B=U(z,!0,N+1)),B},y.toFixed=function(N,_){var B,z,q=this,$=q.constructor;return N===void 0?U(q):(S(N,0,e),_===void 0?_=$.rounding:S(_,0,8),z=M(new $(q),N+T(q)+1,_),B=U(z.abs(),!1,N+T(z)+1),q.isneg()&&!q.isZero()?"-"+B:B)},y.toInteger=y.toint=function(){var N=this,_=N.constructor;return M(new _(N),T(N)+1,_.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(N){var _,B,z,q,$,Y,Q=this,X=Q.constructor,te=12,ae=+(N=new X(N));if(!N.s)return new X(p);if(Q=new X(Q),!Q.s){if(N.s<1)throw Error(a+"Infinity");return Q}if(Q.eq(p))return Q;if(z=X.precision,N.eq(p))return M(Q,z);if(_=N.e,B=N.d.length-1,Y=_>=B,$=Q.s,Y){if((B=ae<0?-ae:ae)<=v){for(q=new X(p),_=Math.ceil(z/h+4),r=!1;B%2&&(q=q.times(Q),W(q.d,_)),B=c(B/2),B!==0;)Q=Q.times(Q),W(Q.d,_);return r=!0,N.s<0?new X(p).div(q):M(q,z)}}else if($<0)throw Error(a+"NaN");return $=$<0&&N.d[Math.max(_,B)]&1?-1:1,Q.s=1,r=!1,q=N.times(O(Q,z+te)),r=!0,q=F(q),q.s=$,q},y.toPrecision=function(N,_){var B,z,q=this,$=q.constructor;return N===void 0?(B=T(q),z=U(q,B<=$.toExpNeg||B>=$.toExpPos)):(S(N,1,e),_===void 0?_=$.rounding:S(_,0,8),q=M(new $(q),N,_),B=T(q),z=U(q,N<=B||B<=$.toExpNeg,N)),z},y.toSignificantDigits=y.tosd=function(N,_){var B=this,z=B.constructor;return N===void 0?(N=z.precision,_=z.rounding):(S(N,1,e),_===void 0?_=z.rounding:S(_,0,8)),M(new z(B),N,_)},y.toString=y.valueOf=y.val=y.toJSON=function(){var N=this,_=T(N),B=N.constructor;return U(N,_<=B.toExpNeg||_>=B.toExpPos)};function b(N,_){var B,z,q,$,Y,Q,X,te,ae=N.constructor,se=ae.precision;if(!N.s||!_.s)return _.s||(_=new ae(N)),r?M(_,se):_;if(X=N.d,te=_.d,Y=N.e,q=_.e,X=X.slice(),$=Y-q,$){for($<0?(z=X,$=-$,Q=te.length):(z=te,q=Y,Q=X.length),Y=Math.ceil(se/h),Q=Y>Q?Y+1:Q+1,$>Q&&($=Q,z.length=1),z.reverse();$--;)z.push(0);z.reverse()}for(Q=X.length,$=te.length,Q-$<0&&($=Q,z=te,te=X,X=z),B=0;$;)B=(X[--$]=X[$]+te[$]+B)/m|0,X[$]%=m;for(B&&(X.unshift(B),++q),Q=X.length;X[--Q]==0;)X.pop();return _.d=X,_.e=q,r?M(_,se):_}n(b,"add");function S(N,_,B){if(N!==~~N||N<_||N>B)throw Error(s+N)}n(S,"checkInt32");function w(N){var _,B,z,q=N.length-1,$="",Y=N[0];if(q>0){for($+=Y,_=1;_<q;_++)z=N[_]+"",B=h-z.length,B&&($+=k(B)),$+=z;Y=N[_],z=Y+"",B=h-z.length,B&&($+=k(B))}else if(Y===0)return"0";for(;Y%10===0;)Y/=10;return $+Y}n(w,"digitsToString");var C=(function(){function N(z,q){var $,Y=0,Q=z.length;for(z=z.slice();Q--;)$=z[Q]*q+Y,z[Q]=$%m|0,Y=$/m|0;return Y&&z.unshift(Y),z}n(N,"multiplyInteger");function _(z,q,$,Y){var Q,X;if($!=Y)X=$>Y?1:-1;else for(Q=X=0;Q<$;Q++)if(z[Q]!=q[Q]){X=z[Q]>q[Q]?1:-1;break}return X}n(_,"compare");function B(z,q,$){for(var Y=0;$--;)z[$]-=Y,Y=z[$]<q[$]?1:0,z[$]=Y*m+z[$]-q[$];for(;!z[0]&&z.length>1;)z.shift()}return n(B,"subtract"),function(z,q,$,Y){var Q,X,te,ae,se,J,ne,pe,le,ie,de,ue,he,Re,Ae,ye,ge,Te,ze=z.constructor,Ze=z.s==q.s?1:-1,_e=z.d,Ie=q.d;if(!z.s)return new ze(z);if(!q.s)throw Error(a+"Division by zero");for(X=z.e-q.e,ge=Ie.length,Ae=_e.length,ne=new ze(Ze),pe=ne.d=[],te=0;Ie[te]==(_e[te]||0);)++te;if(Ie[te]>(_e[te]||0)&&--X,$==null?ue=$=ze.precision:Y?ue=$+(T(z)-T(q))+1:ue=$,ue<0)return new ze(0);if(ue=ue/h+2|0,te=0,ge==1)for(ae=0,Ie=Ie[0],ue++;(te<Ae||ae)&&ue--;te++)he=ae*m+(_e[te]||0),pe[te]=he/Ie|0,ae=he%Ie|0;else{for(ae=m/(Ie[0]+1)|0,ae>1&&(Ie=N(Ie,ae),_e=N(_e,ae),ge=Ie.length,Ae=_e.length),Re=ge,le=_e.slice(0,ge),ie=le.length;ie<ge;)le[ie++]=0;Te=Ie.slice(),Te.unshift(0),ye=Ie[0],Ie[1]>=m/2&&++ye;do ae=0,Q=_(Ie,le,ge,ie),Q<0?(de=le[0],ge!=ie&&(de=de*m+(le[1]||0)),ae=de/ye|0,ae>1?(ae>=m&&(ae=m-1),se=N(Ie,ae),J=se.length,ie=le.length,Q=_(se,le,J,ie),Q==1&&(ae--,B(se,ge<J?Te:Ie,J))):(ae==0&&(Q=ae=1),se=Ie.slice()),J=se.length,J<ie&&se.unshift(0),B(le,se,ie),Q==-1&&(ie=le.length,Q=_(Ie,le,ge,ie),Q<1&&(ae++,B(le,ge<ie?Te:Ie,ie))),ie=le.length):Q===0&&(ae++,le=[0]),pe[te++]=ae,Q&&le[0]?le[ie++]=_e[Re]||0:(le=[_e[Re]],ie=1);while((Re++<Ae||le[0]!==void 0)&&ue--)}return pe[0]||pe.shift(),ne.e=X,M(ne,Y?$+T(ne)+1:$)}})();function F(N,_){var B,z,q,$,Y,Q,X=0,te=0,ae=N.constructor,se=ae.precision;if(T(N)>16)throw Error(i+T(N));if(!N.s)return new ae(p);for(_==null?(r=!1,Q=se):Q=_,Y=new ae(.03125);N.abs().gte(.1);)N=N.times(Y),te+=5;for(z=Math.log(d(2,te))/Math.LN10*2+5|0,Q+=z,B=q=$=new ae(p),ae.precision=Q;;){if(q=M(q.times(N),Q),B=B.times(++X),Y=$.plus(C(q,B,Q)),w(Y.d).slice(0,Q)===w($.d).slice(0,Q)){for(;te--;)$=M($.times($),Q);return ae.precision=se,_==null?(r=!0,M($,se)):$}$=Y}}n(F,"exp");function T(N){for(var _=N.e*h,B=N.d[0];B>=10;B/=10)_++;return _}n(T,"getBase10Exponent");function E(N,_,B){if(_>N.LN10.sd())throw r=!0,B&&(N.precision=B),Error(a+"LN10 precision limit exceeded");return M(new N(N.LN10),_)}n(E,"getLn10");function k(N){for(var _="";N--;)_+="0";return _}n(k,"getZeroString");function O(N,_){var B,z,q,$,Y,Q,X,te,ae,se=1,J=10,ne=N,pe=ne.d,le=ne.constructor,ie=le.precision;if(ne.s<1)throw Error(a+(ne.s?"NaN":"-Infinity"));if(ne.eq(p))return new le(0);if(_==null?(r=!1,te=ie):te=_,ne.eq(10))return _==null&&(r=!0),E(le,te);if(te+=J,le.precision=te,B=w(pe),z=B.charAt(0),$=T(ne),Math.abs($)<15e14){for(;z<7&&z!=1||z==1&&B.charAt(1)>3;)ne=ne.times(N),B=w(ne.d),z=B.charAt(0),se++;$=T(ne),z>1?(ne=new le("0."+B),$++):ne=new le(z+"."+B.slice(1))}else return X=E(le,te+2,ie).times($+""),ne=O(new le(z+"."+B.slice(1)),te-J).plus(X),le.precision=ie,_==null?(r=!0,M(ne,ie)):ne;for(Q=Y=ne=C(ne.minus(p),ne.plus(p),te),ae=M(ne.times(ne),te),q=3;;){if(Y=M(Y.times(ae),te),X=Q.plus(C(Y,new le(q),te)),w(X.d).slice(0,te)===w(Q.d).slice(0,te))return Q=Q.times(2),$!==0&&(Q=Q.plus(E(le,te+2,ie).times($+""))),Q=C(Q,new le(se),te),le.precision=ie,_==null?(r=!0,M(Q,ie)):Q;Q=X,q+=2}}n(O,"ln");function D(N,_){var B,z,q;for((B=_.indexOf("."))>-1&&(_=_.replace(".","")),(z=_.search(/e/i))>0?(B<0&&(B=z),B+=+_.slice(z+1),_=_.substring(0,z)):B<0&&(B=_.length),z=0;_.charCodeAt(z)===48;)++z;for(q=_.length;_.charCodeAt(q-1)===48;)--q;if(_=_.slice(z,q),_){if(q-=z,B=B-z-1,N.e=c(B/h),N.d=[],z=(B+1)%h,B<0&&(z+=h),z<q){for(z&&N.d.push(+_.slice(0,z)),q-=h;z<q;)N.d.push(+_.slice(z,z+=h));_=_.slice(z),z=h-_.length}else z-=q;for(;z--;)_+="0";if(N.d.push(+_),r&&(N.e>x||N.e<-x))throw Error(i+B)}else N.s=0,N.e=0,N.d=[0];return N}n(D,"parseDecimal");function M(N,_,B){var z,q,$,Y,Q,X,te,ae,se=N.d;for(Y=1,$=se[0];$>=10;$/=10)Y++;if(z=_-Y,z<0)z+=h,q=_,te=se[ae=0];else{if(ae=Math.ceil((z+1)/h),$=se.length,ae>=$)return N;for(te=$=se[ae],Y=1;$>=10;$/=10)Y++;z%=h,q=z-h+Y}if(B!==void 0&&($=d(10,Y-q-1),Q=te/$%10|0,X=_<0||se[ae+1]!==void 0||te%$,X=B<4?(Q||X)&&(B==0||B==(N.s<0?3:2)):Q>5||Q==5&&(B==4||X||B==6&&(z>0?q>0?te/d(10,Y-q):0:se[ae-1])%10&1||B==(N.s<0?8:7))),_<1||!se[0])return X?($=T(N),se.length=1,_=_-$-1,se[0]=d(10,(h-_%h)%h),N.e=c(-_/h)||0):(se.length=1,se[0]=N.e=N.s=0),N;if(z==0?(se.length=ae,$=1,ae--):(se.length=ae+1,$=d(10,h-z),se[ae]=q>0?(te/d(10,Y-q)%d(10,q)|0)*$:0),X)for(;;)if(ae==0){(se[0]+=$)==m&&(se[0]=1,++N.e);break}else{if(se[ae]+=$,se[ae]!=m)break;se[ae--]=0,$=1}for(z=se.length;se[--z]===0;)se.pop();if(r&&(N.e>x||N.e<-x))throw Error(i+T(N));return N}n(M,"round");function L(N,_){var B,z,q,$,Y,Q,X,te,ae,se,J=N.constructor,ne=J.precision;if(!N.s||!_.s)return _.s?_.s=-_.s:_=new J(N),r?M(_,ne):_;if(X=N.d,se=_.d,z=_.e,te=N.e,X=X.slice(),Y=te-z,Y){for(ae=Y<0,ae?(B=X,Y=-Y,Q=se.length):(B=se,z=te,Q=X.length),q=Math.max(Math.ceil(ne/h),Q)+2,Y>q&&(Y=q,B.length=1),B.reverse(),q=Y;q--;)B.push(0);B.reverse()}else{for(q=X.length,Q=se.length,ae=q<Q,ae&&(Q=q),q=0;q<Q;q++)if(X[q]!=se[q]){ae=X[q]<se[q];break}Y=0}for(ae&&(B=X,X=se,se=B,_.s=-_.s),Q=X.length,q=se.length-Q;q>0;--q)X[Q++]=0;for(q=se.length;q>Y;){if(X[--q]<se[q]){for($=q;$&&X[--$]===0;)X[$]=m-1;--X[$],X[q]+=m}X[q]-=se[q]}for(;X[--Q]===0;)X.pop();for(;X[0]===0;X.shift())--z;return X[0]?(_.d=X,_.e=z,r?M(_,ne):_):new J(0)}n(L,"subtract");function U(N,_,B){var z,q=T(N),$=w(N.d),Y=$.length;return _?(B&&(z=B-Y)>0?$=$.charAt(0)+"."+$.slice(1)+k(z):Y>1&&($=$.charAt(0)+"."+$.slice(1)),$=$+(q<0?"e":"e+")+q):q<0?($="0."+k(-q-1)+$,B&&(z=B-Y)>0&&($+=k(z))):q>=Y?($+=k(q+1-Y),B&&(z=B-q-1)>0&&($=$+"."+k(z))):((z=q+1)<Y&&($=$.slice(0,z)+"."+$.slice(z)),B&&(z=B-Y)>0&&(q+1===Y&&($+="."),$+=k(z))),N.s<0?"-"+$:$}n(U,"toString");function W(N,_){if(N.length>_)return N.length=_,!0}n(W,"truncate");function V(N){var _,B,z;function q($){var Y=this;if(!(Y instanceof q))return new q($);if(Y.constructor=q,$ instanceof q){Y.s=$.s,Y.e=$.e,Y.d=($=$.d)?$.slice():$;return}if(typeof $=="number"){if($*0!==0)throw Error(s+$);if($>0)Y.s=1;else if($<0)$=-$,Y.s=-1;else{Y.s=0,Y.e=0,Y.d=[0];return}if($===~~$&&$<1e7){Y.e=0,Y.d=[$];return}return D(Y,$.toString())}else if(typeof $!="string")throw Error(s+$);if($.charCodeAt(0)===45?($=$.slice(1),Y.s=-1):Y.s=1,f.test($))D(Y,$);else throw Error(s+$)}if(n(q,"Decimal"),q.prototype=y,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.clone=V,q.config=q.set=j,N===void 0&&(N={}),N)for(z=["precision","rounding","toExpNeg","toExpPos","LN10"],_=0;_<z.length;)N.hasOwnProperty(B=z[_++])||(N[B]=this[B]);return q.config(N),q}n(V,"clone");function j(N){if(!N||typeof N!="object")throw Error(a+"Object expected");var _,B,z,q=["precision",1,e,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(_=0;_<q.length;_+=3)if((z=N[B=q[_]])!==void 0)if(c(z)===z&&z>=q[_+1]&&z<=q[_+2])this[B]=z;else throw Error(s+B+": "+z);if((z=N[B="LN10"])!==void 0)if(z==Math.LN10)this[B]=new this(z);else throw Error(s+B+": "+z);return this}n(j,"config"),o=V(o),o.default=o.Decimal=o,p=new o(1),typeof define=="function"&&define.amd?define(function(){return o}):typeof m3<"u"&&m3.exports?m3.exports=o:(t||(t=typeof self<"u"&&self&&self.self==self?self:Function("return this")()),t.Decimal=o)})(CSe)});var vFe=Ft((U5o,JK)=>{"use strict";var nnt=Object.prototype.hasOwnProperty,Zi="~";function H2(){}n(H2,"Events");Object.create&&(H2.prototype=Object.create(null),new H2().__proto__||(Zi=!1));function ant(t,e,o){this.fn=t,this.context=e,this.once=o||!1}n(ant,"EE");function gFe(t,e,o,r,a){if(typeof o!="function")throw new TypeError("The listener must be a function");var s=new ant(o,r||t,a),i=Zi?Zi+e:e;return t._events[i]?t._events[i].fn?t._events[i]=[t._events[i],s]:t._events[i].push(s):(t._events[i]=s,t._eventsCount++),t}n(gFe,"addListener");function zB(t,e){--t._eventsCount===0?t._events=new H2:delete t._events[e]}n(zB,"clearEvent");function bi(){this._events=new H2,this._eventsCount=0}n(bi,"EventEmitter");bi.prototype.eventNames=n(function(){var e=[],o,r;if(this._eventsCount===0)return e;for(r in o=this._events)nnt.call(o,r)&&e.push(Zi?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(o)):e},"eventNames");bi.prototype.listeners=n(function(e){var o=Zi?Zi+e:e,r=this._events[o];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,s=r.length,i=new Array(s);a<s;a++)i[a]=r[a].fn;return i},"listeners");bi.prototype.listenerCount=n(function(e){var o=Zi?Zi+e:e,r=this._events[o];return r?r.fn?1:r.length:0},"listenerCount");bi.prototype.emit=n(function(e,o,r,a,s,i){var c=Zi?Zi+e:e;if(!this._events[c])return!1;var d=this._events[c],f=arguments.length,p,m;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),f){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,o),!0;case 3:return d.fn.call(d.context,o,r),!0;case 4:return d.fn.call(d.context,o,r,a),!0;case 5:return d.fn.call(d.context,o,r,a,s),!0;case 6:return d.fn.call(d.context,o,r,a,s,i),!0}for(m=1,p=new Array(f-1);m<f;m++)p[m-1]=arguments[m];d.fn.apply(d.context,p)}else{var h=d.length,v;for(m=0;m<h;m++)switch(d[m].once&&this.removeListener(e,d[m].fn,void 0,!0),f){case 1:d[m].fn.call(d[m].context);break;case 2:d[m].fn.call(d[m].context,o);break;case 3:d[m].fn.call(d[m].context,o,r);break;case 4:d[m].fn.call(d[m].context,o,r,a);break;default:if(!p)for(v=1,p=new Array(f-1);v<f;v++)p[v-1]=arguments[v];d[m].fn.apply(d[m].context,p)}}return!0},"emit");bi.prototype.on=n(function(e,o,r){return gFe(this,e,o,r,!1)},"on");bi.prototype.once=n(function(e,o,r){return gFe(this,e,o,r,!0)},"once");bi.prototype.removeListener=n(function(e,o,r,a){var s=Zi?Zi+e:e;if(!this._events[s])return this;if(!o)return zB(this,s),this;var i=this._events[s];if(i.fn)i.fn===o&&(!a||i.once)&&(!r||i.context===r)&&zB(this,s);else{for(var c=0,d=[],f=i.length;c<f;c++)(i[c].fn!==o||a&&!i[c].once||r&&i[c].context!==r)&&d.push(i[c]);d.length?this._events[s]=d.length===1?d[0]:d:zB(this,s)}return this},"removeListener");bi.prototype.removeAllListeners=n(function(e){var o;return e?(o=Zi?Zi+e:e,this._events[o]&&zB(this,o)):(this._events=new H2,this._eventsCount=0),this},"removeAllListeners");bi.prototype.off=bi.prototype.removeListener;bi.prototype.addListener=bi.prototype.on;bi.prefixed=Zi;bi.EventEmitter=bi;typeof JK<"u"&&(JK.exports=bi)});var vRe=Ft(an=>{"use strict";(function(){"use strict";var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),x=!1,y=!1,b=!1,S=!1,w=!1,C;C=Symbol.for("react.module.reference");function F(ue){return!!(typeof ue=="string"||typeof ue=="function"||ue===o||ue===a||w||ue===r||ue===f||ue===p||S||ue===v||x||y||b||typeof ue=="object"&&ue!==null&&(ue.$$typeof===h||ue.$$typeof===m||ue.$$typeof===s||ue.$$typeof===i||ue.$$typeof===d||ue.$$typeof===C||ue.getModuleId!==void 0))}n(F,"isValidElementType");function T(ue){if(typeof ue=="object"&&ue!==null){var he=ue.$$typeof;switch(he){case t:var Re=ue.type;switch(Re){case o:case a:case r:case f:case p:return Re;default:var Ae=Re&&Re.$$typeof;switch(Ae){case c:case i:case d:case h:case m:case s:return Ae;default:return he}}case e:return he}}}n(T,"typeOf");var E=i,k=s,O=t,D=d,M=o,L=h,U=m,W=e,V=a,j=r,N=f,_=p,B=!1,z=!1;function q(ue){return B||(B=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}n(q,"isAsyncMode");function $(ue){return z||(z=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}n($,"isConcurrentMode");function Y(ue){return T(ue)===i}n(Y,"isContextConsumer");function Q(ue){return T(ue)===s}n(Q,"isContextProvider");function X(ue){return typeof ue=="object"&&ue!==null&&ue.$$typeof===t}n(X,"isElement");function te(ue){return T(ue)===d}n(te,"isForwardRef");function ae(ue){return T(ue)===o}n(ae,"isFragment");function se(ue){return T(ue)===h}n(se,"isLazy");function J(ue){return T(ue)===m}n(J,"isMemo");function ne(ue){return T(ue)===e}n(ne,"isPortal");function pe(ue){return T(ue)===a}n(pe,"isProfiler");function le(ue){return T(ue)===r}n(le,"isStrictMode");function ie(ue){return T(ue)===f}n(ie,"isSuspense");function de(ue){return T(ue)===p}n(de,"isSuspenseList"),an.ContextConsumer=E,an.ContextProvider=k,an.Element=O,an.ForwardRef=D,an.Fragment=M,an.Lazy=L,an.Memo=U,an.Portal=W,an.Profiler=V,an.StrictMode=j,an.Suspense=N,an.SuspenseList=_,an.isAsyncMode=q,an.isConcurrentMode=$,an.isContextConsumer=Y,an.isContextProvider=Q,an.isElement=X,an.isForwardRef=te,an.isFragment=ae,an.isLazy=se,an.isMemo=J,an.isPortal=ne,an.isProfiler=pe,an.isStrictMode=le,an.isSuspense=ie,an.isSuspenseList=de,an.isValidElementType=F,an.typeOf=T})()});var yRe=Ft((U6o,xRe)=>{"use strict";xRe.exports=vRe()});var sNe=K(Rae(),1);var Dw=K(Eo(),1);var kae=n(()=>{let t=null;return{get:n(()=>t,"get"),set:n(e=>{t=e},"set")}},"createInMemoryBookmarkStorage");var Mae="_creationTime",qLe=n(t=>{if(typeof t!="object"||t===null)return;let e=t._id;return typeof e=="string"?e:void 0},"rowId"),WLe=n((t,e)=>{let o=e[Mae];if(typeof o!="number")return t.length;for(let[r,a]of t.entries()){let s=a[Mae];if(typeof s=="number"&&s>o)return r}return t.length},"insertionIndex"),Pae=n(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")},"isMutationDelta"),Oae=n((t,e)=>{if(!Array.isArray(t))return;let o=[];for(let d of t){if(qLe(d)===void 0)return;o.push(d)}let{key:r,op:a,row:s}=e;if(a==="delete"){let d=o.filter(f=>f._id!==r);return d.length===o.length?[...o]:d}if(s===void 0)return;let i=o.findIndex(d=>d._id===r);if(i===-1){let d=[...o];return d.splice(WLe(o,s),0,s),d}let c=[...o];return c[i]=s,c},"applyDelta");var cM=n((t,e)=>{let o=t;for(let r of e)try{o=r.transform(o)}catch{}return o},"foldOptimistic"),dF=n((t,e)=>{if(e!==t.lastValue){t.lastValue=e;for(let o of t.callbacks)try{o(e)}catch{}}},"notifySubscription"),Nz=n((t,e)=>{let o;try{o=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e};t.optimisticLayers.push(r),dF(t,o);let a=n(()=>{let i=t.optimisticLayers.findIndex(c=>c.id===r.id);return i===-1?!1:(t.optimisticLayers.splice(i,1),!0)},"remove"),s=n(()=>{dF(t,cM(t.serverBase,t.optimisticLayers))},"refold");return{confirm:n(i=>{if(i===void 0){a();return}r.commitCursor=i,t.serverCursor!==void 0&&t.serverCursor>=i&&a()&&s()},"confirm"),rollback:n(()=>{a()&&s()},"rollback")}},"applyOptimisticLayer"),Dz=n((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let o=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==o},"dropConfirmedLayers"),Nae=n((t,e,o)=>{let r=[],a=[],s=n((c,d)=>{for(let f of t.all())if(f.fn.__lunoraRef===c&&f.shardKey===e&&f.argsKey===d)return f},"findState");return{confirms:r,rollbacks:a,store:{getAllQueries:n(c=>{let d=[];for(let f of t.all())f.fn.__lunoraRef===c.__lunoraRef&&f.shardKey===e&&d.push({args:f.args,value:f.lastValue});return d},"getAllQueries"),getQuery:n((c,d)=>s(c.__lunoraRef,o(d??{}))?.lastValue,"getQuery"),setQuery:n((c,d,f)=>{let p=s(c.__lunoraRef,o(d??{}));if(!p)return;let m=Nz(p,()=>f);m&&(r.push(m.confirm),a.push(m.rollback))},"setQuery")}}},"createLocalStore");var GLe=n((t,e)=>t<e?-1:t>e?1:0,"compareKeys"),WI=n(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a cache key (query/subscription/shape args) \u2014 pass it as a string");if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(s=>WI(s)).join(",")}]`;let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype){let s=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${s} in a cache key (query/subscription/shape args) \u2014 only plain objects, arrays, and JSON primitives are supported`)}let o=t,r=Object.keys(o).toSorted(GLe),a=[];for(let s of r){let i=o[s];i!==void 0&&a.push(`${JSON.stringify(s)}:${WI(i)}`)}return`{${a.join(",")}}`},"stableStringify"),GI=class t{static{n(this,"SubscriptionRegistry")}static key(e,o,r){return`${e}::${WI(o)}::${r??""}`}byKey=new Map;byId=new Map;get(e){return this.byKey.get(e)}getById(e){return this.byId.get(e)}add(e){this.byKey.set(t.key(e.fn.__lunoraRef,e.args,e.shardKey),e),this.byId.set(e.id,e)}remove(e){this.byKey.delete(t.key(e.fn.__lunoraRef,e.args,e.shardKey)),this.byId.delete(e.id)}all(){return[...this.byKey.values()]}};var _z=n((t,e)=>t!==void 0&&e!==t,"isStaleVersion"),Dae=0,dM=n(()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();Dae+=1;let t=typeof crypto<"u"&&typeof crypto.getRandomValues=="function"?[...crypto.getRandomValues(new Uint8Array(8))].map(e=>e.toString(16).padStart(2,"0")).join(""):Math.random().toString(16).slice(2,12);return`m_${Date.now().toString(36)}_${Dae.toString(36)}_${t}`},"nextId"),KI=n((t,e,o,r)=>{if(t){t({error:o,mutationId:r,operation:e});return}console.warn(`[lunora] offline-queue persistence ${e} failed`,o)},"reportPersistenceError"),uM=class{static{n(this,"OfflineQueue")}queueBeforeFirstConnect;maxItems;onPersistenceError;persistence;onEvict;onSizeChange;version;items=[];constructor(e={},o={}){this.maxItems=e.maxItems??1e3,this.queueBeforeFirstConnect=e.queueBeforeFirstConnect??!1,this.onPersistenceError=e.onPersistenceError,this.persistence=o.persistence,this.onEvict=o.onEvict,this.onSizeChange=o.onSizeChange,this.version=o.version}get size(){return this.items.length}enqueue(e){let o=e;for(o.id??=dM(),this.items.push(o),this.persistence?.append({args:o.args,functionPath:o.functionPath,id:o.id,identity:o.identity,shardKey:o.shardKey,...this.version===void 0?{}:{version:this.version}}).catch(r=>{KI(this.onPersistenceError,"append",r,o.id)});this.items.length>this.maxItems;){let r=this.items.shift();if(r){r.id&&this.persistence?.remove(r.id).catch(s=>{KI(this.onPersistenceError,"remove",s,r.id)});let a=new Error("offline queue overflow");a.code="OFFLINE_QUEUE_OVERFLOW",r.reject(a),this.onEvict?.(r,a)}}this.notifySize()}async hydrate(){if(!this.persistence)return[];let e;try{e=await this.persistence.load()}catch(r){throw KI(this.onPersistenceError,"load",r),r}let o=new Set;for(let r of e)if(!this.items.some(a=>a.id===r.id)){if(_z(this.version,r.version)){this.persistence.remove(r.id).catch(a=>{KI(this.onPersistenceError,"remove",a,r.id)});continue}this.items.push({args:r.args,functionPath:r.functionPath,id:r.id,identity:r.identity,reject:n(()=>{},"reject"),resolve:n(()=>{},"resolve"),shardKey:r.shardKey}),o.add(r.shardKey)}return this.notifySize(),[...o]}drain(e){if(!e){let a=[...this.items];return this.items.length=0,this.notifySize(),a}let o=[],r=[];for(let a of this.items)(e(a)?o:r).push(a);return this.items.length=0,this.items.push(...r),this.notifySize(),o}requeue(e){e.length!==0&&(this.items.unshift(...e),this.notifySize())}clear(){for(let e of this.items){let o=new Error("CLIENT_CLOSED");o.code="CLIENT_CLOSED",e.reject(o)}this.items.length=0,this.notifySize()}notifySize(){this.onSizeChange?.(this.items.length)}};var KLe="lunora-outbox",YLe="offline-mutations",_ae="by_id",fF=n(t=>new Promise((e,o)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{o(t.error??new Error("IndexedDB request failed"))})}),"promisifyRequest"),XLe=n((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new Error("createIndexedDbPersistence: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryPersistence()");let o=t.databaseName??KLe,r=t.storeName??YLe,a,s=n(()=>a||(a=new Promise((c,d)=>{let f=e.open(o,1);f.addEventListener("upgradeneeded",()=>{let p=f.result;p.objectStoreNames.contains(r)||p.createObjectStore(r,{autoIncrement:!0}).createIndex(_ae,"id",{unique:!0})}),f.addEventListener("success",()=>{c(f.result)}),f.addEventListener("error",()=>{d(f.error??new Error("IndexedDB open failed"))})}),a),"openDatabase"),i=n(async(c,d)=>{let p=(await s()).transaction(r,c),m=await d(p.objectStore(r));return await new Promise((h,v)=>{p.addEventListener("complete",()=>{h()}),p.addEventListener("error",()=>{v(p.error??new Error("IndexedDB transaction failed"))}),p.addEventListener("abort",()=>{v(p.error??new Error("IndexedDB transaction aborted"))})}),m},"withStore");return{append:n(async c=>{await i("readwrite",d=>fF(d.add(c)))},"append"),clear:n(async()=>{await i("readwrite",c=>fF(c.clear()))},"clear"),load:n(async()=>i("readonly",c=>fF(c.getAll())),"load"),remove:n(async c=>{await i("readwrite",async d=>{let f=await fF(d.index(_ae).getKey(c));f!==void 0&&await fF(d.delete(f))})},"remove")}},"createIndexedDbPersistence"),Lae=n((t,e=!0)=>{if(t!==!1){if(t)return t;if(!(!e||typeof indexedDB>"u"))return XLe()}},"resolvePersistenceAdapter");var Lz=n((t,e,o)=>`${t}::${e}::${o??""}`,"queryCacheKey"),QLe=500;var ZLe="lunora-query-cache",JLe="query-cache",Bae="by_ts",e3e=1,pF=n(t=>new Promise((e,o)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{o(t.error??new Error("IndexedDB request failed"))})}),"promisifyRequest"),t3e=n((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new Error("createIndexedDbQueryCache: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryQueryCache()");let o=t.databaseName??ZLe,r=t.storeName??JLe,a=t.maxEntries??QLe,s,i=n(()=>s||(s=new Promise((f,p)=>{let m=e.open(o,e3e);m.addEventListener("upgradeneeded",()=>{let h=m.result;h.objectStoreNames.contains(r)||h.createObjectStore(r,{keyPath:"key"}).createIndex(Bae,"ts",{unique:!1})}),m.addEventListener("success",()=>{f(m.result)}),m.addEventListener("error",()=>{p(m.error??new Error("IndexedDB open failed"))})}),s),"openDatabase"),c=n(async(f,p)=>{let h=(await i()).transaction(r,f),v=await p(h.objectStore(r));return await new Promise((x,y)=>{h.addEventListener("complete",()=>{x()}),h.addEventListener("error",()=>{y(h.error??new Error("IndexedDB transaction failed"))}),h.addEventListener("abort",()=>{y(h.error??new Error("IndexedDB transaction aborted"))})}),v},"withStore"),d=n(async f=>{let m=await pF(f.count())-a;m<=0||await new Promise((h,v)=>{let x=f.index(Bae).openCursor();x.addEventListener("success",()=>{let y=x.result;if(!y||m<=0){h();return}y.delete(),m-=1,y.continue()}),x.addEventListener("error",()=>{v(x.error??new Error("IndexedDB eviction failed"))})})},"evict");return{clear:n(async()=>{await c("readwrite",f=>pF(f.clear()))},"clear"),load:n(async()=>c("readonly",f=>pF(f.getAll())),"load"),put:n(async(f,p)=>{await c("readwrite",async m=>{await pF(m.put({...p,key:f})),await d(m)})},"put"),remove:n(async f=>{await c("readwrite",p=>pF(p.delete(f)))},"remove")}},"createIndexedDbQueryCache"),Vae=n(t=>{if(t!==!1){if(t)return t;if(!(typeof indexedDB>"u"))return t3e()}},"resolveQueryCacheAdapter");var Bz=n((t={},e=Math.random)=>{let o=t.initialDelayMs??250,r=t.maxDelayMs??3e4,a=t.jitter??!0,s=0;return{next(){let i=Math.min(r,o*2**s);if(s+=1,!a)return i;let c=i/2;return Math.floor(c+e()*(i-c))},reset(){s=0}}},"createReconnect");var Uae=n(t=>{let e=t.maxBuffer??1024,o=[],r=[],a=!1,s,i=!1,c=n(()=>{let m=r.shift();if(!m)return!1;if(s)return m.reject(s),!0;if(o.length>0){let h=o.shift();return m.resolve({done:!1,value:h}),!0}return a?(m.resolve({done:!0,value:void 0}),!0):(r.unshift(m),!1)},"flushOne"),d={complete(){if(!(a||s))for(a=!0;c(););},fail(m){if(!(a||s))for(s=m,o.length=0;c(););},push(m){if(!(a||s||i)){if(o.length>=e){d.fail(Object.assign(new Error(`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`),{code:"STREAM_BACKPRESSURE"}));return}o.push(m),c()}}},f=n(()=>{if(!i){i=!0,a=!0,o.length=0;try{t.onCancel()}catch{}for(;c(););}},"cancel");return{handle:d,iterable:{cancel:f,[Symbol.asyncIterator](){return{next(){if(s)return Promise.reject(s);if(o.length>0){let m=o.shift();return Promise.resolve({done:!1,value:m})}return a?Promise.resolve({done:!0,value:void 0}):new Promise((m,h)=>{r.push({reject:h,resolve:m})})},return(){return f(),Promise.resolve({done:!0,value:void 0})}}}}}},"createStream");var Vz=500,ni="$lunora.wire$",pM=64,zae=1024,o3e="__proto__",$ae={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},Hae={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Uz=n(t=>{let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)},"toBase64"),r3e=n(t=>{let e=atob(t),o=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)o[r]=e.codePointAt(r)??0;return o},"fromBase64"),Ep=n((t,e=0)=>{if(e>pM)throw new RangeError(`wire-codec: value nesting exceeds the ${pM}-level limit`);if(t===void 0)return[ni,"undefined"];if(t===null)return null;let o=typeof t;if(o==="bigint")return[ni,"bigint",t.toString()];if(o==="number"){let i=t;return Number.isNaN(i)?[ni,"nan"]:i===1/0?[ni,"inf"]:i===-1/0?[ni,"-inf"]:i}if(o!=="object")return t;if(t instanceof Date)return[ni,"date",Ep(t.getTime(),e+1)];if(t instanceof Error){let i=t,c={};for(let f of Object.keys(i))i[f]!==void 0&&(c[f]=Ep(i[f],e+1));let d=[ni,"error",i.name,i.message,c];return i.cause!==void 0&&d.push(Ep(i.cause,e+1)),d}if(t instanceof URL)return[ni,"url",t.href];if(t instanceof Map)return[ni,"map",[...t.entries()].map(([i,c])=>[Ep(i,e+1),Ep(c,e+1)])];if(t instanceof Set)return[ni,"set",[...t].map(i=>Ep(i,e+1))];if(t instanceof ArrayBuffer)return[ni,"bytes",Uz(new Uint8Array(t)),"ArrayBuffer"];if(ArrayBuffer.isView(t)){let i=t,c=i.constructor.name,d=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);return c==="Uint8Array"?[ni,"bytes",Uz(d)]:[ni,"bytes",Uz(d),c]}if(Array.isArray(t)){let i=t.map(c=>Ep(c,e+1));return i.length>0&&i[0]===ni?[ni,"arr",i]:i}let r=Object.getPrototypeOf(t);if(r!==null&&r!==Object.prototype){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`)}let a=t,s={};for(let i of Object.keys(a)){let c=a[i];c!==void 0&&(s[i]=Ep(c,e+1))}return s},"encodeWire"),rs=n((t,e=0)=>{if(e>pM)throw new RangeError(`wire-codec: value nesting exceeds the ${pM}-level limit`);if(t===null||typeof t!="object")return t;if(Array.isArray(t)){if(t[0]===ni)switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>rs(s,e+1));case"bigint":{let s=t[2];if(typeof s!="string"||s.length>zae||!/^-?\d+$/.test(s))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${zae} digits)`);return BigInt(s)}case"date":return new Date(rs(t[2],e+1));case"map":return new Map(t[2].map(([s,i])=>[rs(s,e+1),rs(i,e+1)]));case"set":return new Set(t[2].map(s=>rs(s,e+1)));case"url":return new URL(t[2]);case"error":{let s=t[2],i=t[3],c=(Object.hasOwn(Hae,s)?Hae[s]:void 0)??Error,d=new c(i);return d.name!==s&&Object.defineProperty(d,"name",{configurable:!0,value:s,writable:!0}),Object.assign(d,rs(t[4],e+1)),t.length>5&&Object.defineProperty(d,"cause",{configurable:!0,value:rs(t[5],e+1),writable:!0}),d}case"bytes":{let s=r3e(t[2]),i=t[3]??"Uint8Array";if(i==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:s.slice().buffer;let c=Object.hasOwn($ae,i)?$ae[i]:void 0;return c?new c(s.slice().buffer):s}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return t.map(s=>rs(s,e+1))}return t.map(a=>rs(a,e+1))}let o=t,r={};for(let a of Object.keys(o)){let s=rs(o[a],e+1);a===o3e?Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:s,writable:!0}):r[a]=s}return r},"decodeWire"),wv=class{static{n(this,"Listeners")}listeners=new Set;add(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(...e){let[o]=e;for(let r of this.listeners)try{r(o)}catch{}}clear(){this.listeners.clear()}},n3e="/_lunora/rpc",jae="/_lunora/rpc-batch",a3e="/_lunora/ws",zz=n(t=>t===void 0||t===""?"":`&bucket=${encodeURIComponent(t)}`,"bucketQuery"),$z=n(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"rollbackOptimistic"),s3e=n((t,e)=>{for(let o of e)o.op==="delete"?t.delete(o.key):o.value!==void 0&&t.set(o.key,o.value)},"applyRowOpsToView"),i3e="lunora-ping",l3e=3e4,c3e=1e4,u3e=250,d3e=64,f3e="/_lunora/admin/shard-traffic",p3e="/_lunora/admin/scheduled",m3e="/_lunora/admin/scheduled/status",h3e="/_lunora/admin/scheduled/ws",g3e="/_lunora/admin/scheduled/cancel",v3e="/_lunora/admin/scheduled/dead",x3e="/_lunora/admin/scheduled/dead/retry",y3e="/_lunora/admin/scheduled/dead/cancel",I3e="/_lunora/admin/workflows/instances",b3e="/_lunora/admin/workflows/instance",S3e="/_lunora/admin/workflows/status",fM="/_lunora/admin/storage",w3e="/_lunora/admin/storage/url",C3e="/_lunora/admin/storage/buckets",F3e="/_lunora/admin/functions",R3e="/_lunora/admin/cron-jobs",E3e="/_lunora/admin/cron-jobs/run",A3e="/_lunora/admin/openapi",T3e="/_lunora/admin/openrpc",k3e="/_lunora/admin/global/tables",M3e="/_lunora/admin/global/table",P3e="/_lunora/admin/global/facet",O3e="/_lunora/admin/vector/indexes",N3e="/_lunora/admin/vector/query",D3e="/_lunora/admin/auth/users",qae="/_lunora/admin/auth/sessions",_3e="/_lunora/admin/auth/users/create",L3e="/_lunora/admin/auth/users/role",B3e="/_lunora/admin/auth/users/ban",V3e="/_lunora/admin/auth/users/unban",U3e="/_lunora/admin/auth/users/password",z3e="/_lunora/admin/auth/users/remove",$3e="/_lunora/admin/auth/users/impersonate",H3e="/_lunora/admin/auth/sessions/revoke",j3e="/_lunora/admin/auth/sessions/revoke-all",q3e="/_lunora/admin/auth/capabilities",W3e="/_lunora/admin/auth/users/update",G3e="/_lunora/admin/auth/accounts",K3e="/_lunora/admin/auth/accounts/unlink",Y3e="/_lunora/admin/auth/passkeys",X3e="/_lunora/admin/auth/passkeys/delete",Q3e="/_lunora/admin/auth/two-factor/disable",Z3e="/_lunora/admin/auth/organizations",J3e="/_lunora/admin/auth/organizations/members",eBe="/_lunora/admin/auth/organizations/invitations",tBe="/_lunora/admin/auth/organizations/members/remove",oBe="/_lunora/admin/auth/organizations/invitations/cancel",rBe="/api/auth",nBe="/get-session",Wae=n(t=>t.startsWith("https://")?`wss://${t.slice(8)}`:t.startsWith("http://")?`ws://${t.slice(7)}`:t,"deriveWsUrl"),Sv=n((t,e)=>`${t.endsWith("/")?t.slice(0,-1):t}${e}`,"joinUrl"),YI=n((t,e)=>{let o=new URLSearchParams;for(let[a,s]of Object.entries(e))s!==void 0&&s!==""&&o.set(a,String(s));let r=o.toString();return r===""?t:`${t}?${r}`},"withQuery"),ri=n(t=>t??"","connectionKey"),aBe=n(t=>{let e=t.error,o=typeof e?.code=="string"?e.code:void 0,r=typeof e?.message=="string"?e.message:void 0,a=(typeof t.message=="string"?t.message:void 0)??r??"stream error";return Object.assign(new Error(a),o===void 0?void 0:{code:o})},"buildStreamError"),Gae=n(t=>{let e=t.error,o=typeof e?.code=="string"?e.code:void 0,r=typeof e?.message=="string"?e.message:void 0;return{message:(typeof t.message=="string"?t.message:void 0)??r??"subscription error",...o===void 0?{}:{code:o}}},"buildSubscriptionError"),Kae=n((t,e)=>{for(let o of t)try{o(e)}catch{}},"fanSubscriptionError"),sBe=new TextDecoder,iBe=n(t=>{if(typeof t=="string")return t;if(t instanceof ArrayBuffer)return sBe.decode(t)},"decodeServerFrame"),Zl=n((t,e)=>{if(!t.socket||t.wsState!=="open")return!1;try{return t.socket.send(JSON.stringify(e)),!0}catch{return!1}},"sendOn"),mF=n(t=>{let e=new Error(t.message??"request failed");return e.code=t.code,t.data!==void 0&&(e.data=rs(t.data)),e},"reconstructError"),XI=n((t,e)=>{try{return Ep(t)}catch(o){let r=o instanceof Error?o.message:String(o);throw new TypeError(`LunoraClient: cannot encode ${e} \u2014 ${r}`,o instanceof Error?{cause:o}:void 0)}},"encodeCallArgs"),lBe=n((t,e)=>{let o=Array.from({length:e});for(let r of t){if(typeof r.id!="number"||r.id<0||r.id>=e)continue;let a=r.body;o[r.id]=a&&"error"in a&&a.error?{error:mF(a.error),ok:!1}:{ok:!0,value:rs(a?.result)}}return o.map(r=>r??{error:new Error("batch call returned no result"),ok:!1})},"demuxBatchResults"),cBe=new Set(["SHARD_ERROR","SHARD_UNAVAILABLE"]),hF=class t{static{n(this,"LunoraClient")}static MAX_POKE_BUFFERS=256;url;wsUrl;wsToken;authBasePath;fetchImpl;WebSocketImpl;bookmark;reconnectOptions;connectTimeoutMs;heartbeatIntervalMs;offlineQueue;outbox;clientId;clientWatermarks=new Map;outboxMutationCounter=0;onPersistenceError;persistence;persistenceVersion;outboxLeaderRelease;queryCache;hydratedQueryCache=new Map;pendingCacheWrites=new Map;cacheFlushTimer;subscriptions=new GI;connections=new Map;defaultConnectionContext;connectionContexts=new Map;connectionContextHolders=new Map;authToken=null;authSubject=void 0;queuedIdentities=new Map;closed=!1;authTokenListeners=new wv;statusListeners=new wv;tokenExpiredListeners=new wv;mutationSettledListeners=new wv;pendingChangeListeners=new wv;whisperHandlers=new Map;lastStatus="idle";nextSubId=0;nextStreamId=0;streams=new Map;shapeSubscriptions=new Map;pokeBuffers=new Map;nextShapeId=0;constructor(e){this.url=e.url,this.wsUrl=e.wsUrl??Sv(Wae(e.url),a3e),this.wsToken=e.wsToken;let o=e.authBasePath??rBe;this.authBasePath=o.endsWith("/")?o.slice(0,-1):o,this.fetchImpl=e.fetch??(typeof fetch=="function"?fetch.bind(globalThis):void 0),this.WebSocketImpl=e.WebSocket??(typeof WebSocket=="function"?WebSocket:void 0),this.bookmark=e.bookmarkStorage??kae(),this.reconnectOptions=e.reconnect,this.heartbeatIntervalMs=e.heartbeatIntervalMs??l3e,this.connectTimeoutMs=e.connectTimeoutMs??c3e,this.defaultConnectionContext=e.connectionContext,this.persistence=Lae(e.persistence,e.outbox===void 0),this.persistenceVersion=e.persistenceVersion,this.queryCache=Vae(e.queryCache),this.onPersistenceError=e.offlineQueue?.onPersistenceError,this.offlineQueue=new uM(e.offlineQueue,{onEvict:n((r,a)=>{this.emitItemSettled(r,"rejected",a)},"onEvict"),onSizeChange:n(r=>{this.pendingChangeListeners.emit(r)},"onSizeChange"),persistence:this.persistence,version:e.persistenceVersion}),this.outbox=e.outbox,this.clientId=e.clientId??`client-${dM()}`,this.persistence&&queueMicrotask(()=>{this.hydrateAsOutboxLeader()}),this.queryCache&&queueMicrotask(()=>{this.hydrateQueryCache().catch(()=>{})})}setAuthToken(e,o){let r=this.authToken!==e,a=this.identityFingerprint();this.authToken=e,o!==void 0&&(this.authSubject=o);let s=this.identityFingerprint();s!==a&&(r?this.rejectQueuedForIdentityChange():this.restampQueuedIdentity(a,s)),r&&this.authTokenListeners.emit(e)}getAuthToken(){return this.authToken}currentIdentity(){return this.identityFingerprint()}clientIdentifier(){return this.clientId}confirmedMutationWatermark(e){return this.clientWatermarks.get(e??"")??0}async callMutator(e,o,r){let a=r?.clientSeq;if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw new Error(`callMutator: clientSeq must be a positive integer, got ${String(a)}`);let s=r?.shardKey??"",i,c=await this.rpc(e,o,r?.shardKey,{captureBookmark:!0,clientId:this.clientId,clientSeq:a,onMutationAck:n(f=>{i=f},"onMutationAck")});return i!==void 0&&i>(this.clientWatermarks.get(s)??0)&&this.clientWatermarks.set(s,i),{applied:i===void 0||i===a,result:c}}onAuthTokenChange(e){return this.authTokenListeners.add(e)}async getCurrentUser(){if(this.closed||!this.fetchImpl)return null;let e={};this.authToken&&(e.authorization=`Bearer ${this.authToken}`);try{let o=await this.fetchImpl(Sv(this.url,`${this.authBasePath}${nBe}`),{credentials:"include",headers:e,method:"GET"});return o.ok?(await o.json())?.user??null:null}catch{return null}}setWsToken(e){if(this.wsToken!==e){this.wsToken=e;for(let o of this.connections.values())if(o.socket)try{o.socket.close()}catch{}}}setConnectionContext(e,o={}){let r=ri(o.shardKey);e===void 0?this.connectionContexts.delete(r):this.connectionContexts.set(r,e),this.refreshConnectionContext(r)}acquireConnectionContext(e,o={}){let r=ri(o.shardKey),a={context:e},s=this.connectionContextHolders.get(r);s?s.push(a):this.connectionContextHolders.set(r,[a]),this.refreshConnectionContext(r);let i=!1;return()=>{if(i)return;i=!0;let c=this.connectionContextHolders.get(r);if(!c)return;let d=c.indexOf(a);d!==-1&&c.splice(d,1),c.length===0&&this.connectionContextHolders.delete(r),this.refreshConnectionContext(r)}}whisperSubscribe(e,o,r={}){let a=ri(r.shardKey),s=this.whisperHandlers.get(a);s||(s=new Map,this.whisperHandlers.set(a,s));let i=s.get(e),c=i===void 0;if(i||(i=new Set,s.set(e,i)),i.add(o),this.ensureSocket(r.shardKey),c){let d=this.getConnection(r.shardKey);d&&Zl(d,{topic:e,type:"whisper_subscribe"})}return()=>{let d=this.whisperHandlers.get(a),f=d?.get(e);if(!f?.delete(o)||f.size>0)return;d?.delete(e),d?.size===0&&this.whisperHandlers.delete(a);let p=this.getConnection(r.shardKey);p&&Zl(p,{topic:e,type:"whisper_unsubscribe"})}}whisper(e,o,r={}){this.ensureSocket(r.shardKey);let a=this.getConnection(r.shardKey);a&&Zl(a,{data:XI(o??null,`whisper data for topic '${e}'`),topic:e,type:"whisper"})}onTokenExpired(e){return this.tokenExpiredListeners.add(e)}connectionStatus(){return this.computeStatus()}onConnectionStatus(e){let o=this.statusListeners.add(e);return e(this.computeStatus()),o}pendingCount(){return this.offlineQueue.size}onPendingChange(e){let o=this.pendingChangeListeners.add(e);return e(this.offlineQueue.size),o}onMutationSettled(e){return this.mutationSettledListeners.add(e)}async query(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");return await this.rpc(e.__lunoraRef,o,r.shardKey,{attachBookmark:!0})}async batch(e){if(this.closed)throw new Error("LunoraClient is closed");if(!this.fetchImpl)throw new Error("LunoraClient: no `fetch` implementation available");if(e.length===0)return[];let o=await this.fetchImpl(Sv(this.url,jae),{body:JSON.stringify({calls:e.map((s,i)=>({args:XI(s.args??{},`args for batch call '${s.fn.__lunoraRef}'`),functionPath:s.fn.__lunoraRef,id:i,shardKey:s.shardKey}))}),headers:this.rpcRequestHeaders({attachBookmark:!0}),method:"POST"}),r=o.headers.get("x-d1-bookmark");r&&this.bookmark.set(r);let a;try{a=await o.json()}catch{throw new Error(`LunoraClient: batch response was not JSON (status ${o.status.toString()})`)}if(!o.ok||a.error&&!a.results)throw a.error?mF(a.error):new Error(`LunoraClient: batch request failed (status ${o.status.toString()})`);return lBe(a.results??[],e.length)}async mutation(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");let a=o,s=r.mutationId??dM(),{confirms:i,rollbacks:c}=this.applyOptimisticUpdates(e.__lunoraRef,a,r.shardKey,r.optimistic);r.optimisticUpdate&&this.applyOptimisticUpdate(r.optimisticUpdate,o,r.shardKey,c,i);let d=this.getConnection(r.shardKey),f=d?.wsState??"idle",p=d?.socket!==void 0,m=d?.wasEverConnected??!1,{queueBeforeFirstConnect:h}=this.offlineQueue,v=m||h,x=this.WebSocketImpl!==void 0&&v;if(f!=="open"&&!p&&x||f==="connecting"&&v)return this.enqueueOfflineMutation(e,a,r.shardKey,s,c,i);try{let b,S=await this.rpc(e.__lunoraRef,a,r.shardKey,{captureBookmark:!0,mutationId:s,onCommitCursor:n(w=>{b=w},"onCommitCursor")});for(let w of i)w(b);return S}catch(b){throw $z(c),b}}async action(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");return await this.rpc(e.__lunoraRef,o,r.shardKey)}async shardTraffic(e){if(this.closed)throw new Error("LunoraClient is closed");let o=await this.adminFetch(f3e,"POST",{table:e});return{failed:o.failed??0,ok:o.ok??0,shards:o.shards??[]}}async listScheduledJobs(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(p3e,"GET")).records??[]}async schedulerStatus(){if(this.closed)throw new Error("LunoraClient is closed");let e=await this.adminFetch(m3e,"GET");return{backlog:e.backlog??0,inFlight:e.inFlight??0,pools:e.pools??[]}}async cancelScheduledJob(e){if(this.closed)throw new Error("LunoraClient is closed");return{cancelled:(await this.adminFetch(g3e,"POST",{id:e})).cancelled===!0}}async listDeadJobs(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(v3e,"GET")).records??[]}async retryDeadJob(e){if(this.closed)throw new Error("LunoraClient is closed");return{retried:(await this.adminFetch(x3e,"POST",{id:e})).retried===!0}}async removeDeadJob(e){if(this.closed)throw new Error("LunoraClient is closed");return{removed:(await this.adminFetch(y3e,"POST",{id:e})).removed===!0}}async listWorkflowInstances(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({name:e.name});e.status!==void 0&&o.set("status",e.status),e.page!==void 0&&o.set("page",String(e.page)),e.perPage!==void 0&&o.set("perPage",String(e.perPage));let r=await this.adminFetch(`${I3e}?${o.toString()}`,"GET");return{configured:r.configured,instances:r.instances??[],page:r.page??1,perPage:r.perPage??e.perPage??0,totalCount:r.totalCount}}async getWorkflowInstance(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({id:e.id,name:e.name}),r=await this.adminFetch(`${b3e}?${o.toString()}`,"GET");return{createdOn:r.createdOn,endedOn:r.endedOn,error:r.error,id:r.id??e.id,output:r.output,params:r.params,startedOn:r.startedOn,status:r.status??"unknown",steps:r.steps??[]}}async setWorkflowInstanceStatus(e){if(this.closed)throw new Error("LunoraClient is closed");return{status:(await this.adminFetch(S3e,"POST",{action:e.action,id:e.id,name:e.name})).status??"unknown"}}subscribeScheduledJobs(e){if(this.closed)throw new Error("LunoraClient is closed");if(this.WebSocketImpl===void 0)return()=>{};let o=Sv(Wae(this.url),h3e),r=Bz(this.reconnectOptions),a,s,i=!1,c=n(()=>{if(i||this.WebSocketImpl===void 0)return;let d=this.wsToken===void 0?o:`${o}?token=${encodeURIComponent(this.wsToken)}`;a=new this.WebSocketImpl(d),a.addEventListener("open",()=>{r.reset()}),a.addEventListener("message",f=>{try{let p=JSON.parse(typeof f.data=="string"?f.data:"");p.type==="jobs"&&Array.isArray(p.records)&&e(p.records)}catch{}}),a.addEventListener("close",()=>{a=void 0,i||(s=setTimeout(c,r.next()))}),a.addEventListener("error",()=>{})},"connect");return c(),()=>{i=!0,s!==void 0&&clearTimeout(s),a?.close()}}async listFunctions(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(F3e,"GET")).functions??[]}async getCronJobs(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(R3e,"GET")).jobs??[]}async runCronJob(e){if(this.closed)throw new Error("LunoraClient is closed");let o=await this.adminFetch(E3e,"POST",{name:e});return{name:o.name??e,ran:o.ran===!0}}async fetchOpenApi(){if(this.closed)throw new Error("LunoraClient is closed");return await this.adminFetch(A3e,"GET")}async fetchOpenRpc(){if(this.closed)throw new Error("LunoraClient is closed");return await this.adminFetch(T3e,"GET")}async listStorageObjects(e={}){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams;e.prefix!==void 0&&e.prefix!==""&&o.set("prefix",e.prefix),e.cursor!==void 0&&e.cursor!==""&&o.set("cursor",e.cursor),e.limit!==void 0&&o.set("limit",String(e.limit)),e.bucket!==void 0&&e.bucket!==""&&o.set("bucket",e.bucket);let r=o.toString(),a=r===""?fM:`${fM}?${r}`,s=await this.adminFetch(a,"GET");return{cursor:s.cursor,objects:s.objects??[]}}async deleteStorageObject(e,o){if(this.closed)throw new Error("LunoraClient is closed");let r=`${fM}?key=${encodeURIComponent(e)}${zz(o?.bucket)}`,a=await this.adminFetch(r,"DELETE");return{deleted:a.deleted??!0,key:a.key??e}}async listStorageBuckets(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(C3e,"GET")).buckets??[]}async uploadStorageObject(e){if(this.closed)throw new Error("LunoraClient is closed");let o=`${fM}?key=${encodeURIComponent(e.key)}${zz(e.bucket)}`,r=await this.adminFetch(o,"PUT",e.body,e.contentType);return{etag:r.etag,key:r.key??e.key}}async signedStorageUrl(e,o){if(this.closed)throw new Error("LunoraClient is closed");let r=o?.expiresInSeconds,a=r===void 0?"":`&expiresIn=${encodeURIComponent(r.toString())}`,s=`${w3e}?key=${encodeURIComponent(e)}${a}${zz(o?.bucket)}`,i=await this.adminFetch(s,"GET");if(typeof i.url!="string")throw new TypeError("LunoraClient: storage URL endpoint returned no `url`");return i.url}async listGlobalTables(){if(this.closed)throw new Error("LunoraClient is closed");return await this.adminFetch(k3e,"GET")}async readGlobalTablePage(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({table:e.table});return e.limit!==void 0&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset)),e.filters!==void 0&&e.filters.length>0&&o.set("filters",JSON.stringify(e.filters)),await this.adminFetch(`${M3e}?${o.toString()}`,"GET")}async facetGlobalColumn(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({column:e.column,table:e.table});return e.limit!==void 0&&o.set("limit",String(e.limit)),e.filters!==void 0&&e.filters.length>0&&o.set("filters",JSON.stringify(e.filters)),await this.adminFetch(`${P3e}?${o.toString()}`,"GET")}async listVectorIndexes(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(O3e,"GET")).indexes??[]}async queryVectorIndex(e){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(N3e,"POST",e)).matches??[]}async listAuthUsers(e={}){if(this.closed)throw new Error("LunoraClient is closed");let o=YI(D3e,{filterField:e.filterField,filterValue:e.filterValue,limit:e.limit,offset:e.offset,search:e.search,searchField:e.searchField,sortBy:e.sortBy,sortDirection:e.sortDirection});return await this.adminFetch(o,"GET")}async createAuthUser(e){return await this.adminFetch(_3e,"POST",e)}async setAuthUserRole(e){return await this.adminFetch(L3e,"POST",e)}async banAuthUser(e){return await this.adminFetch(B3e,"POST",e)}async unbanAuthUser(e){return await this.adminFetch(V3e,"POST",e)}async setAuthUserPassword(e){await this.adminFetch(U3e,"POST",e)}async removeAuthUser(e){await this.adminFetch(z3e,"POST",e)}async impersonateAuthUser(e){return await this.adminFetch($3e,"POST",e)}async revokeAuthSession(e){await this.adminFetch(H3e,"POST",e)}async revokeAuthUserSessions(e){await this.adminFetch(j3e,"POST",e)}async getAuthCapabilities(){return await this.adminFetch(q3e,"GET")}async updateAuthUser(e){return await this.adminFetch(W3e,"POST",e)}async listAuthAccounts(e){return await this.adminFetch(YI(G3e,{userId:e.userId}),"GET")}async unlinkAuthAccount(e){await this.adminFetch(K3e,"POST",e)}async listAuthPasskeys(e){return await this.adminFetch(YI(Y3e,{userId:e.userId}),"GET")}async deleteAuthPasskey(e){await this.adminFetch(X3e,"POST",e)}async disableAuthTwoFactor(e){await this.adminFetch(Q3e,"POST",e)}async listAuthOrganizations(e={}){return await this.adminFetch(YI(Z3e,{limit:e.limit,offset:e.offset}),"GET")}async listAuthOrgMembers(e){let o=YI(J3e,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(o,"GET")}async listAuthOrgInvitations(e){let o=YI(eBe,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(o,"GET")}async removeAuthOrgMember(e){await this.adminFetch(tBe,"POST",e)}async cancelAuthOrgInvitation(e){await this.adminFetch(oBe,"POST",e)}async listAuthSessions(e={}){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams;e.userId!==void 0&&e.userId!==""&&o.set("userId",e.userId),e.limit!==void 0&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset));let r=o.toString();return await this.adminFetch(r===""?qae:`${qae}?${r}`,"GET")}subscribe(e,o,r,a={}){if(this.closed)throw new Error("LunoraClient is closed");let s=o??{},i=GI.key(e.__lunoraRef,s,a.shardKey),c=this.subscriptions.get(i),d=r,f=a.onError;if(!c){this.nextSubId+=1;let m=`sub_${this.nextSubId.toString()}`,h=WI(s),v=this.takeHydratedCache(e.__lunoraRef,h,a.shardKey);c={acked:!1,args:s,argsKey:h,callbacks:new Set,checkpointCallbacks:new Set,errorCallbacks:new Set,fn:e,id:m,lastValue:v?.value,optimisticLayers:[],serverBase:v?.value,serverCursor:v?.serverCursor,shardKey:a.shardKey,...v?.serverEpoch===void 0?{}:{serverEpoch:v.serverEpoch}},this.subscriptions.add(c)}if(c.callbacks.add(d),f&&c.errorCallbacks.add(f),a.onCheckpoint&&c.checkpointCallbacks.add(a.onCheckpoint),c.lastValue!==void 0)try{d(c.lastValue)}catch{}this.ensureSocket(a.shardKey),this.sendSubscribeIfOpen(c);let p=c;return()=>{if(p.callbacks.delete(d),f&&p.errorCallbacks.delete(f),a.onCheckpoint&&p.checkpointCallbacks.delete(a.onCheckpoint),p.callbacks.size===0){let m=this.getConnection(p.shardKey);!(m&&Zl(m,{id:p.id,type:"unsubscribe"}))&&m&&m.pendingUnsubscribes.push({id:p.id,type:"unsubscribe"}),this.subscriptions.remove(p)}}}subscribeShape(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");this.nextShapeId+=1;let a=`shape_${this.nextShapeId.toString()}`,s={args:e.args,callbacks:new Set([o]),errorCallbacks:r.onError?new Set([r.onError]):new Set,id:a,name:e.name,onCheckpoint:r.onCheckpoint,rows:new Map,shardKey:r.shardKey};return this.shapeSubscriptions.set(a,s),this.ensureSocket(r.shardKey),this.sendShapeSubscribeIfOpen(s),()=>{this.shapeSubscriptions.delete(a);let i=this.getConnection(s.shardKey);!(i&&Zl(i,{id:a,type:"shape_unsubscribe"}))&&i&&i.pendingUnsubscribes.push({id:a,type:"shape_unsubscribe"})}}stream(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");if(this.WebSocketImpl===void 0)throw new Error("LunoraClient: streams require a WebSocket implementation");this.nextStreamId+=1;let a=`stream_${this.nextStreamId.toString()}`,{shardKey:s}=r,i=o??{},{handle:c,iterable:d}=Uae({maxBuffer:r.maxBuffer,onCancel:n(()=>{let h=this.getConnection(s);h&&Zl(h,{id:a,type:"unsubscribe"}),this.streams.delete(a)},"onCancel")});this.streams.set(a,{handle:c,shardKey:s}),this.ensureSocket(s);let f=this.getConnection(s),p={id:a,query:{args:XI(i,`stream args for '${e.__lunoraRef}'`),functionPath:e.__lunoraRef,shardKey:s},type:"stream"};if(!(f?.wsState==="open"&&Zl(f,p))&&f){for(f.pendingStreams=f.pendingStreams??[];f.pendingStreams.length>=d3e;){let v=f.pendingStreams.shift()?.id,x=v?this.streams.get(v):void 0;x&&(x.handle.fail(Object.assign(new Error("stream-start frame evicted while socket was unreachable"),{code:"STREAM_QUEUE_OVERFLOW"})),this.streams.delete(v))}f.pendingStreams.push(p)}return d}close(){this.closed=!0,this.outboxLeaderRelease?.(),this.outboxLeaderRelease=void 0;for(let e of this.streams.values())e.handle.fail(Object.assign(new Error("LunoraClient closed"),{code:"CLIENT_CLOSED"}));this.streams.clear();for(let e of this.connections.values()){if(e.reconnectTimer!==void 0&&(clearTimeout(e.reconnectTimer),e.reconnectTimer=void 0),e.connectTimer!==void 0&&(clearTimeout(e.connectTimer),e.connectTimer=void 0),this.stopHeartbeat(e),e.socket){try{e.socket.close()}catch{}e.socket=void 0}e.wsState="closed"}this.offlineQueue.clear(),this.queuedIdentities.clear(),this.cacheFlushTimer!==void 0&&(clearTimeout(this.cacheFlushTimer),this.cacheFlushTimer=void 0),this.pendingCacheWrites.size>0&&this.flushQueryCacheWrites().catch(()=>{}),this.authTokenListeners.clear(),this.statusListeners.clear(),this.tokenExpiredListeners.clear(),this.mutationSettledListeners.clear(),this.pendingChangeListeners.clear(),this.whisperHandlers.clear(),this.shapeSubscriptions.clear(),this.pokeBuffers.clear()}async enqueueOfflineMutation(e,o,r,a,s,i){let c=this.identityFingerprint();if(this.outbox){this.outboxMutationCounter+=1;let d=this.outboxMutationCounter;try{await this.outbox.enqueue({args:o,clientId:this.clientId,functionPath:e.__lunoraRef,idempotencyKey:`${this.clientId}:${String(d)}`,identity:c,mutationId:d,shardKey:r})}catch(f){throw $z(s),f instanceof Error?f:new Error(String(f))}for(let f of i)f(void 0);return}return new Promise((d,f)=>{let p={args:o,functionPath:e.__lunoraRef,liveAwaiter:!0,id:a,identity:c,onCommit:n(m=>{for(let h of i)h(m)},"onCommit"),reject:n(m=>{this.queuedIdentities.delete(a),$z(s),f(m instanceof Error?m:new Error(String(m)))},"reject"),resolve:d,shardKey:r};this.offlineQueue.enqueue(p),p.id!==void 0&&this.queuedIdentities.set(p.id,c)})}async hydratePersistedQueue(){try{let e=await this.offlineQueue.hydrate();for(let o of e)this.ensureSocket(o)}catch{}}hydrateAsOutboxLeader(){let e=n(()=>{this.hydratePersistedQueue().catch(()=>{})},"hydrate"),o=globalThis.navigator?.locks;if(!o){e();return}o.request(`lunora:outbox-leader:${this.url}`,()=>(this.closed||e(),new Promise(r=>{if(this.closed){r();return}this.outboxLeaderRelease=r}))).catch(e)}async hydrateQueryCache(){if(this.queryCache)try{let e=await this.queryCache.load();for(let{key:o,...r}of e){if(_z(this.persistenceVersion,r.version)){this.queryCache.remove(o).catch(()=>{});continue}this.hydratedQueryCache.set(o,r)}}catch{}}takeHydratedCache(e,o,r){let a=Lz(e,o,r),s=this.hydratedQueryCache.get(a);if(s!==void 0)return this.hydratedQueryCache.delete(a),s.identity===this.identityFingerprint()?s:void 0}persistQueryValue(e){let o=e.serverBase;if(!this.queryCache||o===void 0)return;let r=Lz(e.fn.__lunoraRef,e.argsKey,e.shardKey);this.pendingCacheWrites.set(r,{identity:this.identityFingerprint(),serverCursor:e.serverCursor,ts:Date.now(),value:o,...e.serverEpoch===void 0?{}:{serverEpoch:e.serverEpoch},...this.persistenceVersion===void 0?{}:{version:this.persistenceVersion}}),this.cacheFlushTimer??=setTimeout(()=>{this.flushQueryCacheWrites().catch(()=>{})},u3e)}async flushQueryCacheWrites(){this.cacheFlushTimer=void 0;let{queryCache:e}=this;if(!e){this.pendingCacheWrites.clear();return}let o=[...this.pendingCacheWrites.entries()];this.pendingCacheWrites.clear(),await Promise.allSettled(o.map(([r,a])=>e.put(r,a)))}computeStatus(){let e=[...this.connections.values()];return e.length===0?"idle":e.some(o=>o.wsState==="open")?"connected":e.some(o=>o.wsState==="connecting")?"connecting":"offline"}emitConnectionStatus(){let e=this.computeStatus();e!==this.lastStatus&&(this.lastStatus=e,this.statusListeners.emit(e))}emitItemSettled(e,o,r){this.mutationSettledListeners.emit({args:e.args,code:r===void 0?void 0:r.code,error:r,functionPath:e.functionPath,hadAwaiter:e.liveAwaiter??!1,id:e.id??"",shardKey:e.shardKey,status:o})}applyOptimisticUpdates(e,o,r,a){let s=[],i=[];if(!a)return{confirms:s,rollbacks:i};let c=GI.key(e,o,r),d=this.subscriptions.get(c);if(d){let f=Nz(d,a);f&&(s.push(f.confirm),i.push(f.rollback))}return{confirms:s,rollbacks:i}}applyOptimisticUpdate(e,o,r,a,s){let{confirms:i,rollbacks:c,store:d}=Nae(this.subscriptions,r,WI);try{e(d,o)}catch{for(let f=c.length-1;f>=0;f-=1)c[f]?.();return}a.push(...c),s.push(...i)}getConnection(e){return this.connections.get(ri(e))}getOrCreateConnection(e){let o=ri(e),r=this.connections.get(o);return r||(r={connectTimer:void 0,heartbeatTimer:void 0,pendingUnsubscribes:[],reconnect:Bz(this.reconnectOptions),reconnectTimer:void 0,shardKey:e,socket:void 0,wasEverConnected:!1,wsState:"idle"},this.connections.set(o,r)),r}wsUrlFor(e){let o=[];if(e!==void 0&&o.push(`shard=${encodeURIComponent(e)}`),this.wsToken!==void 0&&o.push(`token=${encodeURIComponent(this.wsToken)}`),o.length===0)return this.wsUrl;let r=this.wsUrl.includes("?")?"&":"?";return`${this.wsUrl}${r}${o.join("&")}`}rpcRequestHeaders(e){let o={"content-type":"application/json"};if(this.authToken&&(o.authorization=`Bearer ${this.authToken}`),e.mutationId&&(o["x-lunora-mutation-id"]=e.mutationId),e.clientId!==void 0&&(o["x-lunora-client-id"]=e.clientId),e.clientSeq!==void 0&&(o["x-lunora-client-seq"]=e.clientSeq.toString()),e.attachBookmark){let r=this.bookmark.get();r&&(o["x-d1-bookmark"]=r)}return o}async rpc(e,o,r,a={}){if(!this.fetchImpl)throw new Error("LunoraClient: no `fetch` implementation available");let s=this.rpcRequestHeaders(a),i=await this.fetchImpl(Sv(this.url,n3e),{body:JSON.stringify({args:XI(o,`args for '${e}'`),functionPath:e,shardKey:r}),headers:s,method:"POST"});if(a.captureBookmark){let d=i.headers.get("x-d1-bookmark");d&&this.bookmark.set(d)}let c;try{c=await i.json()}catch{let d=i.statusText?` ${i.statusText}`:"";throw new Error(`LunoraClient: response was not JSON (status ${i.status.toString()}${d})`)}if("error"in c)throw mF(c.error);if(!i.ok){let d=i.statusText?` ${i.statusText}`:"";throw new Error(`LunoraClient: request failed (status ${i.status.toString()}${d})`)}return a.onMutationAck?.(c.lastMutationId),a.onCommitCursor?.(c.commitCursor),rs(c.result)}async adminFetch(e,o,r,a){if(!this.fetchImpl)throw new Error("LunoraClient: no `fetch` implementation available");let s={};this.authToken&&(s.authorization=`Bearer ${this.authToken}`);let i=r instanceof ArrayBuffer||r instanceof Blob,c;r===void 0?c=void 0:i?(c=r,a!==void 0&&(s["content-type"]=a)):(c=JSON.stringify(r),s["content-type"]="application/json");let d=await this.fetchImpl(Sv(this.url,e),{body:c,headers:s,method:o}),f;try{f=await d.json()}catch{let p=d.statusText?` ${d.statusText}`:"";throw new Error(`LunoraClient: response was not JSON (status ${d.status.toString()}${p})`)}if(typeof f=="object"&&f!==null&&"error"in f){let p=f.error,m=new Error(p.message??"admin request failed");throw m.code=p.code,m}if(!d.ok){let p=d.statusText?` ${d.statusText}`:"";throw new Error(`LunoraClient: admin request failed (status ${d.status.toString()}${p})`)}return f}effectiveConnectionContext(e){let o=this.connectionContextHolders.get(e);return o&&o.length>0?o[o.length-1]?.context:this.connectionContexts.get(e)??this.defaultConnectionContext}refreshConnectionContext(e){let o=this.connections.get(e);o?.wsState==="open"&&this.sendConnectEnvelope(o)}sendConnectEnvelope(e){let o=this.effectiveConnectionContext(ri(e.shardKey));Zl(e,{clientId:this.clientId,id:"connect",type:"connect",...o===void 0?{}:{context:o}})}resendShapeSubscriptions(e){for(let o of this.shapeSubscriptions.values())ri(o.shardKey)===ri(e)&&this.sendShapeSubscribeIfOpen(o)}ensureSocket(e){if(this.closed||this.WebSocketImpl===void 0)return;let o=this.getOrCreateConnection(e);if(o.wsState==="open"||o.wsState==="connecting")return;o.wsState="connecting",this.emitConnectionStatus();let r=new this.WebSocketImpl(this.wsUrlFor(e));o.socket=r,this.connectTimeoutMs>0&&(o.connectTimer=setTimeout(()=>{if(o.connectTimer=void 0,!(o.socket!==r||o.wsState!=="connecting")){try{r.close()}catch{}this.handleDisconnect(o)}},this.connectTimeoutMs)),r.addEventListener("open",()=>{if(o.socket!==r)return;o.connectTimer!==void 0&&(clearTimeout(o.connectTimer),o.connectTimer=void 0),o.wsState="open",o.wasEverConnected=!0,o.reconnect.reset(),this.emitConnectionStatus(),this.sendConnectEnvelope(o),this.markShardPendingAck(e);for(let s of this.subscriptions.all())ri(s.shardKey)===ri(e)&&this.sendSubscribeIfOpen(s);if(this.resendShapeSubscriptions(e),o.pendingUnsubscribes.length>0){let s=o.pendingUnsubscribes;o.pendingUnsubscribes=[];for(let{id:i,type:c}of s)Zl(o,{id:i,type:c})}if(o.pendingStreams&&o.pendingStreams.length>0){let s=o.pendingStreams;o.pendingStreams=[];for(let i of s)Zl(o,i)}let a=this.whisperHandlers.get(ri(e));if(a)for(let s of a.keys())Zl(o,{topic:s,type:"whisper_subscribe"});this.flushOfflineQueue(e).catch(()=>{}),this.startHeartbeat(o)}),r.addEventListener("message",a=>{this.handleServerMessage(a.data,e)}),r.addEventListener("close",a=>{o.socket===r&&(a?.code===4001&&this.notifyTokenExpired(),this.handleDisconnect(o))}),r.addEventListener("error",()=>{o.socket===r&&(o.wsState==="connecting"||o.wsState==="open")&&this.handleDisconnect(o)})}handleDisconnect(e){if(this.closed||e.wsState==="idle"||e.wsState==="closed"||(this.stopHeartbeat(e),e.connectTimer!==void 0&&(clearTimeout(e.connectTimer),e.connectTimer=void 0),e.socket=void 0,e.wsState="idle",this.emitConnectionStatus(),this.markShardPendingAck(e.shardKey),this.WebSocketImpl===void 0))return;let o=e.reconnect.next();e.reconnectTimer=setTimeout(()=>{e.reconnectTimer=void 0,this.ensureSocket(e.shardKey)},o)}startHeartbeat(e){this.stopHeartbeat(e),!(this.heartbeatIntervalMs<=0)&&(e.heartbeatTimer=setInterval(()=>{if(!(e.wsState!=="open"||!e.socket))try{e.socket.send(i3e)}catch{}},this.heartbeatIntervalMs))}stopHeartbeat(e){e.heartbeatTimer!==void 0&&(clearInterval(e.heartbeatTimer),e.heartbeatTimer=void 0)}markShardPendingAck(e){let o=ri(e);for(let r of this.subscriptions.all())ri(r.shardKey)===o&&(r.acked=!1)}sendSubscribeIfOpen(e){let o=this.getConnection(e.shardKey);if(o?.wsState!=="open"||e.acked)return;let r=e.fn.__lunoraTable??e.fn.__lunoraRef;Zl(o,{id:e.id,query:{args:e.args,functionPath:e.fn.__lunoraRef,table:r,...e.serverCursor===void 0?{}:{sinceSeq:e.serverCursor},...e.serverEpoch===void 0?{}:{sinceEpoch:e.serverEpoch}},type:"subscribe"})}sendShapeSubscribeIfOpen(e){let o=this.getConnection(e.shardKey);o?.wsState==="open"&&Zl(o,{id:e.id,shape:{name:e.name,...e.args===void 0?{}:{args:e.args}},type:"shape_subscribe",...e.serverCursor===void 0?{}:{sinceCheckpoint:e.serverCursor},...e.serverEpoch===void 0?{}:{sinceEpoch:e.serverEpoch}})}handleServerMessage(e,o){let r=iBe(e);if(r===void 0)return;let a;try{a=JSON.parse(r)}catch{return}switch(a.type){case"ack":{let s=this.subscriptions.getById(a.id);s&&(s.acked=!0);return}case"chunk":{let{data:s,id:i}=a;this.streams.get(i)?.handle.push(rs(s));return}case"complete":{this.handleCompleteMessage(a.id);return}case"data":case"delta":{this.handleDataMessage(a);return}case"error":{this.handleErrorMessage(a);break}case"pokeEnd":{this.handlePokeEnd(a);break}case"pokePart":{this.handlePokePart(a);break}case"pokeStart":{this.handlePokeStart(a);break}case"resume":{this.handleResumeMessage(a);break}case"settled":{this.handleSettledMessage(a);break}case"whisper":{this.dispatchWhisper(a,o);break}}}handleErrorMessage(e){if(e.error?.code==="TOKEN_EXPIRED"){this.notifyTokenExpired();return}let{id:r}=e,a=r===void 0?void 0:this.streams.get(r);if(a&&r!==void 0){a.handle.fail(aBe(e)),this.streams.delete(r);return}let s=r===void 0?void 0:this.subscriptions.getById(r);if(s){Kae(s.errorCallbacks,Gae(e));return}let i=r===void 0?void 0:this.shapeSubscriptions.get(r);i&&Kae(i.errorCallbacks,Gae(e))}handlePokeStart(e){if(this.pokeBuffers.size>=t.MAX_POKE_BUFFERS){let o=this.pokeBuffers.keys().next().value;o!==void 0&&this.pokeBuffers.delete(o)}this.pokeBuffers.set(e.pokeId,{baseCheckpoint:e.baseCheckpoint,epoch:e.epoch,lastMutationId:new Map,parts:new Map})}handlePokePart(e){let o=this.pokeBuffers.get(e.pokeId);if(!o)return;let r=o.parts.get(e.shapeId)??[];for(let a of e.rowsPatch)r.push(a.value===void 0?a:{...a,value:rs(a.value)});o.parts.set(e.shapeId,r),e.lastMutationId!==void 0&&o.lastMutationId.set(e.shapeId,e.lastMutationId)}handlePokeEnd(e){let o=this.pokeBuffers.get(e.pokeId);if(o){this.pokeBuffers.delete(e.pokeId);for(let[r,a]of o.parts){let s=this.shapeSubscriptions.get(r);if(!s)continue;let i=o.epoch!==void 0&&s.serverEpoch!==void 0&&o.epoch!==s.serverEpoch,c=o.baseCheckpoint!==void 0&&s.serverCursor!==void 0&&s.serverCursor!==o.baseCheckpoint;if(i||c){s.rows.clear(),s.serverCursor=void 0,s.serverEpoch=void 0,this.emitShapeRows(s),this.sendShapeSubscribeIfOpen(s);continue}s3e(s.rows,a),e.checkpoint!==void 0&&(s.serverCursor=e.checkpoint),e.epoch!==void 0&&(s.serverEpoch=e.epoch);let d=o.lastMutationId.get(r);d!==void 0&&(s.lastMutationId=d),this.emitShapeRows(s),s.onCheckpoint?.({checkpoint:s.serverCursor,mutationId:s.lastMutationId})}}}emitShapeRows(e){let o=[...e.rows.values()];for(let r of e.callbacks)try{r(o)}catch{}}handleDataMessage(e){let{id:o}=e,r=o?this.subscriptions.getById(o):void 0;if(!r)return;let a=this.resolveDataPayload(e,r);r.serverBase=a,e.cursor!==void 0&&(r.serverCursor=e.cursor),e.epoch!==void 0&&(r.serverEpoch=e.epoch),this.persistQueryValue(r),Dz(r,r.serverCursor),dF(r,r.optimisticLayers.length===0?a:cM(a,r.optimisticLayers))}handleResumeMessage(e){let o=this.subscriptions.getById(e.id);o&&this.ackAndAdvanceCursor(o,e.cursor,e.epoch)}handleSettledMessage(e){let o=this.subscriptions.getById(e.id);if(o){this.ackAndAdvanceCursor(o,e.cursor,e.epoch),e.lastMutationId!==void 0&&(o.lastMutationId=e.lastMutationId);for(let r of o.checkpointCallbacks)r({checkpoint:o.serverCursor,mutationId:o.lastMutationId})}}ackAndAdvanceCursor(e,o,r){e.acked=!0,(o!==void 0&&o!==e.serverCursor||r!==void 0&&r!==e.serverEpoch)&&(o!==void 0&&(e.serverCursor=o),r!==void 0&&(e.serverEpoch=r),this.persistQueryValue(e),Dz(e,e.serverCursor)&&dF(e,cM(e.serverBase,e.optimisticLayers)))}resolveDataPayload(e,o){if("data"in e&&e.data!==void 0)return rs(e.data);let r=rs(e.delta);if(Pae(r)&&o.serverBase!==void 0){let a=Oae(o.serverBase,r);if(a!==void 0)return a}return r}dispatchWhisper(e,o){let r=this.whisperHandlers.get(ri(o))?.get(e.topic);if(!r)return;let a=rs(e.data);for(let s of r)try{s(a,e.from)}catch{}}notifyTokenExpired(){this.tokenExpiredListeners.emit()}handleCompleteMessage(e){let o=this.streams.get(e);if(o){o.handle.complete(),this.streams.delete(e);return}let r=this.subscriptions.getById(e);r&&this.subscriptions.remove(r)}unpersist(e){e&&this.persistence?.remove(e).catch(o=>{KI(this.onPersistenceError,"remove",o,e)})}identityFingerprint(){if(this.authSubject!==void 0)return this.authSubject===null?null:`subj:${this.authSubject}`;let e=this.authToken;if(e===null)return null;let o=2166136261;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,16777619);return`${e.length.toString(36)}:${(o>>>0).toString(36)}`}rejectQueuedForIdentityChange(){let e=this.offlineQueue.drain();for(let o of e){this.queuedIdentities.delete(o.id??""),this.unpersist(o.id);let r=new Error("offline mutation discarded: auth identity changed before replay");r.code="OFFLINE_IDENTITY_CHANGED",o.reject(r),this.emitItemSettled(o,"rejected",r)}this.clearQueryCacheForIdentityChange()}restampQueuedIdentity(e,o){for(let[r,a]of this.queuedIdentities)a===e&&this.queuedIdentities.set(r,o)}clearQueryCacheForIdentityChange(){this.cacheFlushTimer!==void 0&&(clearTimeout(this.cacheFlushTimer),this.cacheFlushTimer=void 0),this.pendingCacheWrites.clear(),this.hydratedQueryCache.clear(),this.queryCache?.clear().catch(()=>{})}async flushOfflineQueue(e){let o=ri(e),r=this.offlineQueue.drain(d=>ri(d.shardKey)===o);if(r.length===0)return;let a=this.identityFingerprint(),s=[];for(let d of r)this.passesReplayIdentityGate(d,a)&&s.push(d);if(s.length===0)return;let i=this.encodableOrSettleTerminal(s);if(i.length===0)return;if(i.length===1){await this.replaySequential(i);return}let c=[];for(let d=0;d<i.length;d+=Vz){let f=i.slice(d,d+Vz),p=await this.replayBatched(f);if(c.push(...p.requeue),p.stop){c.push(...i.slice(d+Vz));break}}c.length>0&&this.offlineQueue.requeue(c)}encodableOrSettleTerminal(e){let o=[];for(let r of e)try{XI(r.args,`args for '${r.functionPath}'`),o.push(r)}catch(a){this.settleReplayTerminal(r,a instanceof Error?a:new Error(String(a)))}return o}passesReplayIdentityGate(e,o){let r=e.id===void 0?void 0:this.queuedIdentities.get(e.id),a=r===void 0?e.identity:r;if(a!==void 0&&a!==o){this.queuedIdentities.delete(e.id??""),this.unpersist(e.id);let s=new Error("offline mutation skipped: auth identity changed before replay");return s.code="OFFLINE_IDENTITY_CHANGED",e.reject(s),this.emitItemSettled(e,"rejected",s),!1}return this.queuedIdentities.delete(e.id??""),!0}settleReplaySuccess(e,o,r){this.unpersist(e.id),e.onCommit?.(r),e.resolve(o),this.emitItemSettled(e,"committed")}settleReplayTerminal(e,o){this.unpersist(e.id),e.reject(o),this.emitItemSettled(e,"rejected",o)}async replaySequential(e){for(let o=0;o<e.length;o+=1){let r=e[o];if(r)try{let a,s=await this.rpc(r.functionPath,r.args,r.shardKey,{captureBookmark:!0,mutationId:r.id,onCommitCursor:n(i=>{a=i},"onCommitCursor")});this.settleReplaySuccess(r,s,a)}catch(a){if(a.code!==void 0){this.settleReplayTerminal(r,a);continue}this.offlineQueue.requeue(e.slice(o));return}}}async replayBatched(e){if(!this.fetchImpl)return{requeue:e,stop:!0};let o;try{o=await this.fetchImpl(Sv(this.url,jae),{body:JSON.stringify({calls:e.map((s,i)=>({args:XI(s.args,`args for '${s.functionPath}'`),functionPath:s.functionPath,id:i,mutationId:s.id,shardKey:s.shardKey}))}),headers:this.rpcRequestHeaders({attachBookmark:!0}),method:"POST"})}catch{return{requeue:e,stop:!0}}let r=o.headers.get("x-d1-bookmark");r&&this.bookmark.set(r);let a;try{a=await o.json()}catch{return{requeue:e,stop:!0}}if(!a.results){if(a.error){let s=mF(a.error);for(let i of e)this.settleReplayTerminal(i,s);return{requeue:[],stop:!1}}return{requeue:e,stop:!0}}return{requeue:this.settleReplayBatchSlots(e,a.results),stop:!1}}settleReplayBatchSlots(e,o){let r=new Map;for(let s of o)typeof s.id=="number"&&s.body!==void 0&&r.set(s.id,s.body);let a=[];for(let[s,i]of e.entries()){let c=r.get(s);c===void 0?a.push(i):"error"in c?cBe.has(c.error.code)?a.push(i):this.settleReplayTerminal(i,mF(c.error)):this.settleReplaySuccess(i,rs(c.result),c.commitCursor)}return a}};var kse=K(Eo(),1);var Wd=class{static{n(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 uBe=class extends Wd{static{n(this,"FocusManager")}#t;#e;#o;constructor(){super(),this.#o=t=>{if(typeof window<"u"&&window.addEventListener){let e=n(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#o)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#o=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},QI=new uBe;var dBe={setTimeout:n((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:n(t=>clearTimeout(t),"clearTimeout"),setInterval:n((t,e)=>setInterval(t,e),"setInterval"),clearInterval:n(t=>clearInterval(t),"clearInterval")},fBe=class{static{n(this,"TimeoutManager")}#t=dBe;#e=!1;setTimeoutProvider(t){this.#e&&t!==this.#t&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#t,provider:t}),this.#t=t,this.#e=!1}setTimeout(t,e){return this.#e=!0,this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#e=!0,this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},Gd=new fBe;function Yae(t){setTimeout(t,0)}n(Yae,"systemSetTimeoutZero");var jz=typeof window>"u"||"Deno"in globalThis;function Ua(){}n(Ua,"noop");function Zae(t,e){return typeof t=="function"?t(e):t}n(Zae,"functionalUpdate");function gF(t){return typeof t=="number"&&t>=0&&t!==1/0}n(gF,"isValidTimeout");function hM(t,e){return Math.max(t+(e||0)-Date.now(),0)}n(hM,"timeUntilStale");function $u(t,e){return typeof t=="function"?t(e):t}n($u,"resolveStaleTime");function Bi(t,e){return typeof t=="function"?t(e):t}n(Bi,"resolveQueryBoolean");function gM(t,e){let{type:o="all",exact:r,fetchStatus:a,predicate:s,queryKey:i,stale:c}=t;if(i){if(r){if(e.queryHash!==vF(i,e.options))return!1}else if(!Rv(e.queryKey,i))return!1}if(o!=="all"){let d=e.isActive();if(o==="active"&&!d||o==="inactive"&&d)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||a&&a!==e.state.fetchStatus||s&&!s(e))}n(gM,"matchQuery");function vM(t,e){let{exact:o,status:r,predicate:a,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(o){if(Cv(e.options.mutationKey)!==Cv(s))return!1}else if(!Rv(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||a&&!a(e))}n(vM,"matchMutation");function vF(t,e){return(e?.queryKeyHashFn||Cv)(t)}n(vF,"hashQueryKeyByOptions");function Cv(t){return JSON.stringify(t,(e,o)=>Hz(o)?Object.keys(o).sort().reduce((r,a)=>(r[a]=o[a],r),{}):o)}n(Cv,"hashKey");function Rv(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(o=>Rv(t[o],e[o])):!1}n(Rv,"partialMatchKey");var pBe=Object.prototype.hasOwnProperty;function mM(t,e,o=0){if(t===e)return t;if(o>500)return e;let r=Xae(t)&&Xae(e);if(!r&&!(Hz(t)&&Hz(e)))return e;let s=(r?t:Object.keys(t)).length,i=r?e:Object.keys(e),c=i.length,d=r?new Array(c):{},f=0;for(let p=0;p<c;p++){let m=r?p:i[p],h=t[m],v=e[m];if(h===v){d[m]=h,(r?p<s:pBe.call(t,m))&&f++;continue}if(h===null||v===null||typeof h!="object"||typeof v!="object"){d[m]=v;continue}let x=mM(h,v,o+1);d[m]=x,x===h&&f++}return s===c&&f===s?t:d}n(mM,"replaceEqualDeep");function xM(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let o in t)if(t[o]!==e[o])return!1;return!0}n(xM,"shallowEqualObjects");function Xae(t){return Array.isArray(t)&&t.length===Object.keys(t).length}n(Xae,"isPlainArray");function Hz(t){if(!Qae(t))return!1;let e=t.constructor;if(e===void 0)return!0;let o=e.prototype;return!(!Qae(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}n(Hz,"isPlainObject");function Qae(t){return Object.prototype.toString.call(t)==="[object Object]"}n(Qae,"hasObjectPrototype");function Jae(t){return new Promise(e=>{Gd.setTimeout(e,t)})}n(Jae,"sleep");function xF(t,e,o){if(typeof o.structuralSharing=="function")return o.structuralSharing(t,e);if(o.structuralSharing!==!1){try{return mM(t,e)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${o.queryHash}]: ${r}`),r}return mM(t,e)}return e}n(xF,"replaceData");function qz(t){return t}n(qz,"keepPreviousData");function ese(t,e,o=0){let r=[...t,e];return o&&r.length>o?r.slice(1):r}n(ese,"addToEnd");function tse(t,e,o=0){let r=[e,...t];return o&&r.length>o?r.slice(0,-1):r}n(tse,"addToStart");var Fv=Symbol();function yM(t,e){return t.queryFn===Fv&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Fv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}n(yM,"ensureQueryFn");function IM(t,e){return typeof t=="function"?t(...e):!!t}n(IM,"shouldThrowError");function ose(t,e,o){let r=!1,a;return Object.defineProperty(t,"signal",{enumerable:!0,get:n(()=>(a??=e(),r||(r=!0,a.aborted?o():a.addEventListener("abort",o,{once:!0})),a),"get")}),t}n(ose,"addConsumeAwareSignal");var Kd=(()=>{let t=n(()=>jz,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function yF(){let t,e,o=new Promise((a,s)=>{t=a,e=s});o.status="pending",o.catch(()=>{});function r(a){Object.assign(o,a),delete o.resolve,delete o.reject}return n(r,"finalize"),o.resolve=a=>{r({status:"fulfilled",value:a}),t(a)},o.reject=a=>{r({status:"rejected",reason:a}),e(a)},o}n(yF,"pendingThenable");var rse=Yae;function mBe(){let t=[],e=0,o=n(c=>{c()},"notifyFn"),r=n(c=>{c()},"batchNotifyFn"),a=rse,s=n(c=>{e?t.push(c):a(()=>{o(c)})},"schedule"),i=n(()=>{let c=t;t=[],c.length&&a(()=>{r(()=>{c.forEach(d=>{o(d)})})})},"flush");return{batch:n(c=>{let d;e++;try{d=c()}finally{e--,e||i()}return d},"batch"),batchCalls:n(c=>(...d)=>{s(()=>{c(...d)})},"batchCalls"),schedule:s,setNotifyFunction:n(c=>{o=c},"setNotifyFunction"),setBatchNotifyFunction:n(c=>{r=c},"setBatchNotifyFunction"),setScheduler:n(c=>{a=c},"setScheduler")}}n(mBe,"createNotifyManager");var _n=mBe();var hBe=class extends Wd{static{n(this,"OnlineManager")}#t=!0;#e;#o;constructor(){super(),this.#o=t=>{if(typeof window<"u"&&window.addEventListener){let e=n(()=>t(!0),"onlineListener"),o=n(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",o)}}}}onSubscribe(){this.#e||this.setEventListener(this.#o)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#o=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(o=>{o(t)}))}isOnline(){return this.#t}},ZI=new hBe;function gBe(t){return Math.min(1e3*2**t,3e4)}n(gBe,"defaultRetryDelay");function Wz(t){return(t??"online")==="online"?ZI.isOnline():!0}n(Wz,"canFetch");var bM=class extends Error{static{n(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function SM(t){let e=!1,o=0,r,a=yF(),s=n(()=>a.status!=="pending","isResolved"),i=n(y=>{if(!s()){let b=new bM(y);h(b),t.onCancel?.(b)}},"cancel"),c=n(()=>{e=!0},"cancelRetry"),d=n(()=>{e=!1},"continueRetry"),f=n(()=>QI.isFocused()&&(t.networkMode==="always"||ZI.isOnline())&&t.canRun(),"canContinue"),p=n(()=>Wz(t.networkMode)&&t.canRun(),"canStart"),m=n(y=>{s()||(r?.(),a.resolve(y))},"resolve"),h=n(y=>{s()||(r?.(),a.reject(y))},"reject"),v=n(()=>new Promise(y=>{r=n(b=>{(s()||f())&&y(b)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,s()||t.onContinue?.()}),"pause"),x=n(()=>{if(s())return;let y,b=o===0?t.initialPromise:void 0;try{y=b??t.fn()}catch(S){y=Promise.reject(S)}Promise.resolve(y).then(m).catch(S=>{if(s())return;let w=t.retry??(Kd.isServer()?0:3),C=t.retryDelay??gBe,F=typeof C=="function"?C(o,S):C,T=w===!0||typeof w=="number"&&o<w||typeof w=="function"&&w(o,S);if(e||!T){h(S);return}o++,t.onFail?.(o,S),Jae(F).then(()=>f()?void 0:v()).then(()=>{e?h(S):x()})})},"run");return{promise:a,status:n(()=>a.status,"status"),cancel:i,continue:n(()=>(r?.(),a),"continue"),cancelRetry:c,continueRetry:d,canStart:p,start:n(()=>(p()?x():v().then(x),a),"start")}}n(SM,"createRetryer");var wM=class{static{n(this,"Removable")}#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gF(this.gcTime)&&(this.#t=Gd.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Kd.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(Gd.clearTimeout(this.#t),this.#t=void 0)}};function ase(t){return{onFetch:n((e,o)=>{let r=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,s=e.state.data?.pages||[],i=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},d=0,f=n(async()=>{let p=!1,m=n(x=>{ose(x,()=>e.signal,()=>p=!0)},"addSignalProperty"),h=yM(e.options,e.fetchOptions),v=n(async(x,y,b)=>{if(p)return Promise.reject(e.signal.reason);if(y==null&&x.pages.length)return Promise.resolve(x);let w=n(()=>{let E={client:e.client,queryKey:e.queryKey,pageParam:y,direction:b?"backward":"forward",meta:e.options.meta};return m(E),E},"createQueryFnContext")(),C=await h(w),{maxPages:F}=e.options,T=b?tse:ese;return{pages:T(x.pages,C,F),pageParams:T(x.pageParams,y,F)}},"fetchPage");if(a&&s.length){let x=a==="backward",y=x?vBe:nse,b={pages:s,pageParams:i},S=y(r,b);c=await v(b,S,x)}else{let x=t??s.length;do{let y=d===0?i[0]??r.initialPageParam:nse(r,c);if(d>0&&y==null)break;c=await v(c,y),d++}while(d<x)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},o):e.fetchFn=f},"onFetch")}}n(ase,"infiniteQueryBehavior");function nse(t,{pages:e,pageParams:o}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,o[r],o):void 0}n(nse,"getNextPageParam");function vBe(t,{pages:e,pageParams:o}){return e.length>0?t.getPreviousPageParam?.(e[0],e,o[0],o):void 0}n(vBe,"getPreviousPageParam");var lse=class extends wM{static{n(this,"Query")}#t;#e;#o;#r;#a;#n;#i;#s;constructor(t){super(),this.#s=!1,this.#i=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#a=t.client,this.#r=this.#a.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=ise(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#i,...t},t?._type&&(this.#t=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ise(this.options);e.data!==void 0&&(this.setState(sse(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let o=xF(this.state.data,t,this.options);return this.#l({data:o,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),o}setState(t){this.#l({type:"setState",state:t})}cancel(t){let e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(Ua).catch(Ua):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Bi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>$u(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:!hM(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.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.#n&&(this.#s||this.#u()?this.#n.cancel({revert:!0}):this.#n.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.#l({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){let d=this.observers.find(f=>f.options.queryFn);d&&this.setOptions(d.options)}Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");let o=new AbortController,r=n(d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:n(()=>(this.#s=!0,o.signal),"get")})},"addSignalProperty"),a=n(()=>{let d=yM(this.options,e),p=n(()=>{let m={client:this.#a,queryKey:this.queryKey,meta:this.meta};return r(m),m},"createQueryFnContext")();return this.#s=!1,this.options.persister?this.options.persister(d,p,this):d(p)},"fetchFn"),i=n(()=>{let d={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:a};return r(d),d},"createFetchContext")();(this.#t==="infinite"?ase(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#o=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#l({type:"fetch",meta:i.fetchOptions?.meta}),this.#n=SM({initialPromise:e?.initialPromise,fn:i.fetchFn,onCancel:n(d=>{d instanceof bM&&d.revert&&this.setState({...this.#o,fetchStatus:"idle"}),o.abort()},"onCancel"),onFail:n((d,f)=>{this.#l({type:"failed",failureCount:d,error:f})},"onFail"),onPause:n(()=>{this.#l({type:"pause"})},"onPause"),onContinue:n(()=>{this.#l({type:"continue"})},"onContinue"),retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:n(()=>!0,"canRun")});try{let d=await this.#n.start();if(d===void 0)throw console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#r.config.onSuccess?.(d,this),this.#r.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof bM){if(d.silent)return this.#n.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#l({type:"error",error:d}),this.#r.config.onError?.(d,this),this.#r.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#l(t){let e=n(o=>{switch(t.type){case"failed":return{...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...Gz(o.data,this.options),fetchMeta:t.meta??null};case"success":let r={...o,...sse(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#o=t.manual?r:void 0,r;case"error":let a=t.error;return{...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...t.state}}},"reducer");this.state=e(this.state),_n.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Gz(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wz(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}n(Gz,"fetchState");function sse(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}n(sse,"successState");function ise(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,o=e!==void 0,r=o?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:o?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}n(ise,"getDefaultState");var Yz=class extends Wd{static{n(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#t=t,this.#s=null,this.#i=yF(),this.bindMethods(),this.setOptions(e)}#t;#e=void 0;#o=void 0;#r=void 0;#a;#n;#i;#s;#u;#l;#m;#d;#f;#c;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),cse(this.#e,this.options)?this.#p():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Kz(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Kz(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#I(),this.#b(),this.#e.removeObserver(this)}setOptions(t){let e=this.options,o=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Bi(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),e._defaulted&&!xM(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});let r=this.hasListeners();r&&use(this.#e,o,this.options,e)&&this.#p(),this.updateResult(),r&&(this.#e!==o||Bi(this.options.enabled,this.#e)!==Bi(e.enabled,this.#e)||$u(this.options.staleTime,this.#e)!==$u(e.staleTime,this.#e))&&this.#g();let a=this.#v();r&&(this.#e!==o||Bi(this.options.enabled,this.#e)!==Bi(e.enabled,this.#e)||a!==this.#c)&&this.#x(a)}getOptimisticResult(t){let e=this.#t.getQueryCache().build(this.#t,t),o=this.createResult(e,t);return yBe(this,o)&&(this.#r=o,this.#n=this.options,this.#a=this.#e.state),o}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:n((o,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,r)),"get")})}trackProp(t){this.#h.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#t.defaultQueryOptions(t),o=this.#t.getQueryCache().build(this.#t,e);return o.fetch().then(()=>this.createResult(o,e))}fetch(t){return this.#p({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(t){this.#S();let e=this.#e.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Ua)),e}#g(){this.#I();let t=$u(this.options.staleTime,this.#e);if(Kd.isServer()||this.#r.isStale||!gF(t))return;let o=hM(this.#r.dataUpdatedAt,t)+1;this.#d=Gd.setTimeout(()=>{this.#r.isStale||this.updateResult()},o)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#x(t){this.#b(),this.#c=t,!(Kd.isServer()||Bi(this.options.enabled,this.#e)===!1||!gF(this.#c)||this.#c===0)&&(this.#f=Gd.setInterval(()=>{(this.options.refetchIntervalInBackground||QI.isFocused())&&this.#p()},this.#c))}#y(){this.#g(),this.#x(this.#v())}#I(){this.#d!==void 0&&(Gd.clearTimeout(this.#d),this.#d=void 0)}#b(){this.#f!==void 0&&(Gd.clearInterval(this.#f),this.#f=void 0)}createResult(t,e){let o=this.#e,r=this.options,a=this.#r,s=this.#a,i=this.#n,d=t!==o?t.state:this.#o,{state:f}=t,p={...f},m=!1,h;if(e._optimisticResults){let O=this.hasListeners(),D=!O&&cse(t,e),M=O&&use(t,o,e,r);(D||M)&&(p={...p,...Gz(f.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:v,errorUpdatedAt:x,status:y}=p;h=p.data;let b=!1;if(e.placeholderData!==void 0&&h===void 0&&y==="pending"){let O;a?.isPlaceholderData&&e.placeholderData===i?.placeholderData?(O=a.data,b=!0):O=typeof e.placeholderData=="function"?e.placeholderData(this.#m?.state.data,this.#m):e.placeholderData,O!==void 0&&(y="success",h=xF(a?.data,O,e),m=!0)}if(e.select&&h!==void 0&&!b)if(a&&h===s?.data&&e.select===this.#u)h=this.#l;else try{this.#u=e.select,h=e.select(h),h=xF(a?.data,h,e),this.#l=h,this.#s=null}catch(O){this.#s=O}this.#s&&(v=this.#s,h=this.#l,x=Date.now(),y="error");let S=p.fetchStatus==="fetching",w=y==="pending",C=y==="error",F=w&&S,T=h!==void 0,k={status:y,fetchStatus:p.fetchStatus,isPending:w,isSuccess:y==="success",isError:C,isInitialLoading:F,isLoading:F,data:h,dataUpdatedAt:p.dataUpdatedAt,error:v,errorUpdatedAt:x,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:S,isRefetching:S&&!w,isLoadingError:C&&!T,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&T,isStale:Xz(t,e),refetch:this.refetch,promise:this.#i,isEnabled:Bi(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let O=k.data!==void 0,D=k.status==="error"&&!O,M=n(W=>{D?W.reject(k.error):O&&W.resolve(k.data)},"finalizeThenableIfPossible"),L=n(()=>{let W=this.#i=k.promise=yF();M(W)},"recreateThenable"),U=this.#i;switch(U.status){case"pending":t.queryHash===o.queryHash&&M(U);break;case"fulfilled":(D||k.data!==U.value)&&L();break;case"rejected":(!D||k.error!==U.reason)&&L();break}}return k}updateResult(){let t=this.#r,e=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#n=this.options,this.#a.data!==void 0&&(this.#m=this.#e),xM(e,t))return;this.#r=e;let o=n(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,a=typeof r=="function"?r():r;if(a==="all"||!a&&!this.#h.size)return!0;let s=new Set(a??this.#h);return this.options.throwOnError&&s.add("error"),Object.keys(this.#r).some(i=>{let c=i;return this.#r[c]!==t[c]&&s.has(c)})},"shouldNotifyListeners");this.#w({listeners:o()})}#S(){let t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;let e=this.#e;this.#e=t,this.#o=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#w(t){_n.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function xBe(t,e){return Bi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Bi(e.retryOnMount,t)===!1)}n(xBe,"shouldLoadOnMount");function cse(t,e){return xBe(t,e)||t.state.data!==void 0&&Kz(t,e,e.refetchOnMount)}n(cse,"shouldFetchOnMount");function Kz(t,e,o){if(Bi(e.enabled,t)!==!1&&$u(e.staleTime,t)!=="static"){let r=typeof o=="function"?o(t):o;return r==="always"||r!==!1&&Xz(t,e)}return!1}n(Kz,"shouldFetchOn");function use(t,e,o,r){return(t!==e||Bi(r.enabled,t)===!1)&&(!o.suspense||t.state.status!=="error")&&Xz(t,o)}n(use,"shouldFetchOptionally");function Xz(t,e){return Bi(e.enabled,t)!==!1&&t.isStaleByTime($u(e.staleTime,t))}n(Xz,"isStale");function yBe(t,e){return!xM(t.getCurrentResult(),e)}n(yBe,"shouldAssignObserverCurrentProperties");var dse=class extends wM{static{n(this,"Mutation")}#t;#e;#o;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#o=t.mutationCache,this.#e=[],this.state=t.state||IBe(),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.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#o.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#o.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=n(()=>{this.#a({type:"continue"})},"onContinue"),o={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=SM({fn:n(()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:n((s,i)=>{this.#a({type:"failed",failureCount:s,error:i})},"onFail"),onPause:n(()=>{this.#a({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:n(()=>this.#o.canRun(this),"canRun")});let r=this.state.status==="pending",a=!this.#r.canStart();try{if(r)e();else{this.#a({type:"pending",variables:t,isPaused:a}),this.#o.config.onMutate&&await this.#o.config.onMutate(t,this,o);let i=await this.options.onMutate?.(t,o);i!==this.state.context&&this.#a({type:"pending",context:i,variables:t,isPaused:a})}let s=await this.#r.start();return await this.#o.config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await this.#o.config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),this.#a({type:"success",data:s}),s}catch(s){try{await this.#o.config.onError?.(s,t,this.state.context,this,o)}catch(i){Promise.reject(i)}try{await this.options.onError?.(s,t,this.state.context,o)}catch(i){Promise.reject(i)}try{await this.#o.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o)}catch(i){Promise.reject(i)}throw this.#a({type:"error",error:s}),s}finally{this.#o.runNext(this)}}#a(t){let e=n(o=>{switch(t.type){case"failed":return{...o,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,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{...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),_n.batch(()=>{this.#e.forEach(o=>{o.onMutationUpdate(t)}),this.#o.notify({mutation:this,type:"updated",action:t})})}};function IBe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}n(IBe,"getDefaultState");var fse=class extends Wd{static{n(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#o=0}#t;#e;#o;build(t,e,o){let r=new dse({client:t,mutationCache:this,mutationId:++this.#o,options:t.defaultMutationOptions(e),state:o});return this.add(r),r}add(t){this.#t.add(t);let e=CM(t);if(typeof e=="string"){let o=this.#e.get(e);o?o.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){let e=CM(t);if(typeof e=="string"){let o=this.#e.get(e);if(o)if(o.length>1){let r=o.indexOf(t);r!==-1&&o.splice(r,1)}else o[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=CM(t);if(typeof e=="string"){let r=this.#e.get(e)?.find(a=>a.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=CM(t);return typeof e=="string"?this.#e.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){let e={exact:!0,...t};return this.getAll().find(o=>vM(e,o))}findAll(t={}){return this.getAll().filter(e=>vM(t,e))}notify(t){_n.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return _n.batch(()=>Promise.all(t.map(e=>e.continue().catch(Ua))))}};function CM(t){return t.options.scope?.id}n(CM,"scopeFor");var pse=class extends Wd{static{n(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,o){let r=e.queryKey,a=e.queryHash??vF(r,e),s=this.get(a);return s||(s=new lse({client:t,queryKey:r,queryHash:a,options:t.defaultQueryOptions(e),state:o,defaultOptions:t.getQueryDefaults(r)}),this.add(s)),s}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){_n.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(o=>gM(e,o))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(o=>gM(t,o)):e}notify(t){_n.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var Qz=class{static{n(this,"QueryClient")}#t;#e;#o;#r;#a;#n;#i;#s;constructor(t={}){this.#t=t.queryCache||new pse,this.#e=t.mutationCache||new fse,this.#o=t.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#i=QI.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=ZI.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#i?.(),this.#i=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),o=this.#t.build(this,e),r=o.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&o.isStaleByTime($u(e.staleTime,o))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:o})=>{let r=o.data;return[e,r]})}setQueryData(t,e,o){let r=this.defaultQueryOptions({queryKey:t}),s=this.#t.get(r.queryHash)?.state.data,i=Zae(e,s);if(i!==void 0)return this.#t.build(this,r).setData(i,{...o,manual:!0})}setQueriesData(t,e,o){return _n.batch(()=>this.#t.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,o)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){let e=this.#t;_n.batch(()=>{e.findAll(t).forEach(o=>{e.remove(o)})})}resetQueries(t,e){let o=this.#t;return _n.batch(()=>(o.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let o={revert:!0,...e},r=_n.batch(()=>this.#t.findAll(t).map(a=>a.cancel(o)));return Promise.all(r).then(Ua).catch(Ua)}invalidateQueries(t,e={}){return _n.batch(()=>(this.#t.findAll(t).forEach(o=>{o.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let o={...e,cancelRefetch:e.cancelRefetch??!0},r=_n.batch(()=>this.#t.findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let s=a.fetch(void 0,o);return o.throwOnError||(s=s.catch(Ua)),a.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ua)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let o=this.#t.build(this,e);return o.isStaleByTime($u(e.staleTime,o))?o.fetch(e):Promise.resolve(o.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ua).catch(Ua)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ua).catch(Ua)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ZI.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#o}setDefaultOptions(t){this.#o=t}setQueryDefaults(t,e){this.#r.set(Cv(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],o={};return e.forEach(r=>{Rv(t,r.queryKey)&&Object.assign(o,r.defaultOptions)}),o}setMutationDefaults(t,e){this.#a.set(Cv(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#a.values()],o={};return e.forEach(r=>{Rv(t,r.mutationKey)&&Object.assign(o,r.defaultOptions)}),o}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#o.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vF(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===Fv&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#o.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};var JI=K(oe(),1),gse=K($t(),1);var IF=JI.createContext(void 0),eb=n(t=>{let e=JI.useContext(IF);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),Zz=n(({client:t,children:e})=>(JI.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,gse.jsx)(IF.Provider,{value:t,children:e})),"QueryClientProvider");var RM=K(oe(),1);var vse=RM.createContext(!1),xse=n(()=>RM.useContext(vse),"useIsRestoring"),yFt=vse.Provider;var bF=K(oe(),1),bBe=K($t(),1);function SBe(){let t=!1;return{clearReset:n(()=>{t=!1},"clearReset"),reset:n(()=>{t=!0},"reset"),isReset:n(()=>t,"isReset")}}n(SBe,"createValue");var wBe=bF.createContext(SBe()),yse=n(()=>bF.useContext(wBe),"useQueryErrorResetBoundary");var Ise=K(oe(),1);var bse=n((t,e,o)=>{let r=o?.state.error&&typeof t.throwOnError=="function"?IM(t.throwOnError,[o.state.error,o]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),Sse=n(t=>{Ise.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),wse=n(({result:t,errorResetBoundary:e,throwOnError:o,query:r,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(a&&t.data===void 0||IM(o,[t.error,r])),"getHasError");var Cse=n(t=>{if(t.suspense){let o=n(a=>a==="static"?a:Math.max(a??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...a)=>o(r(...a)):o(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),Fse=n((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),Rse=n((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),Jz=n((t,e,o)=>e.fetchOptimistic(t).catch(()=>{o.clearReset()}),"fetchOptimistic");var Th=K(oe(),1);function Ese(t,e,o){if(typeof t!="object"||Array.isArray(t))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let r=xse(),a=yse(),s=eb(o),i=s.defaultQueryOptions(t);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let c=s.getQueryCache().get(i.queryHash);i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);let d=t.subscribed!==!1;i._optimisticResults=r?"isRestoring":d?"optimistic":void 0,Cse(i),bse(i,a,c),Sse(a);let f=!s.getQueryCache().get(i.queryHash),[p]=Th.useState(()=>new e(s,i)),m=p.getOptimisticResult(i),h=!r&&d;if(Th.useSyncExternalStore(Th.useCallback(v=>{let x=h?p.subscribe(_n.batchCalls(v)):Ua;return p.updateResult(),x},[p,h]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),Th.useEffect(()=>{p.setOptions(i)},[i,p]),Rse(i,m))throw Jz(i,p,a);if(wse({result:m,errorResetBoundary:a,throwOnError:i.throwOnError,query:c,suspense:i.suspense}))throw m.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,m),i.experimental_prefetchInRender&&!Kd.isServer()&&Fse(m,r)&&(f?Jz(i,p,a):c?.promise)?.catch(Ua).finally(()=>{p.updateResult()}),i.notifyOnChangeProps?m:p.trackResult(m)}n(Ese,"useBaseQuery");function e$(t,e){return Ese(t,Yz,e)}n(e$,"useQuery");var Ev=K(oe(),1),o$=K(po(),1);var Mse=(0,Ev.createContext)(null),CBe=n(()=>new Qz({defaultOptions:{mutations:{retry:0},queries:{gcTime:5*6e4,retry:0,staleTime:Number.POSITIVE_INFINITY}}}),"createDefaultQueryClient"),r$=n(t=>{let e=(0,kse.c)(9),{children:o,client:r,queryClient:a}=t,s=(0,Ev.use)(IF),i;e[0]!==s||e[1]!==a?(i=n(()=>a??s??CBe(),"t1"),e[0]=s,e[1]=a,e[2]=i):i=e[2];let[c]=(0,Ev.useState)(i),d=a??s??c;if(!d)throw new Error("LunoraProvider: failed to resolve a QueryClient");let f;e[3]!==o||e[4]!==r?(f=(0,o$.jsxDEV)(Mse,{value:r,children:o},void 0,!1),e[3]=o,e[4]=r,e[5]=f):f=e[5];let p=f;if(s===d)return p;let m;return e[6]!==p||e[7]!==d?(m=(0,o$.jsxDEV)(Zz,{client:d,children:p},void 0,!1),e[6]=p,e[7]=d,e[8]=m):m=e[8],m},"LunoraProvider"),Wt=n(()=>{let t=(0,Ev.use)(Mse);if(!t)throw new Error("useLunora must be used inside <LunoraProvider />");return t},"useLunora");var Pse=K(Eo(),1),Ose=K(oe(),1);var n$=n(()=>{let t=(0,Pse.c)(4),e=Wt(),o,r,a;return t[0]!==e?(o=n(s=>e.onConnectionStatus(()=>{s()}),"t0"),r=n(()=>e.connectionStatus(),"t1"),a=n(()=>e.connectionStatus(),"t2"),t[0]=e,t[1]=o,t[2]=r,t[3]=a):(o=t[1],r=t[2],a=t[3]),(0,Ose.useSyncExternalStore)(o,r,a)},"useConnectionStatus");var Nw=K(oe(),1);var Nse=K(oe(),1),kh=K(po(),1);var FBe={border:"1px solid var(--destructive)",color:"var(--destructive)",padding:12},RBe={overflow:"auto",whiteSpace:"pre-wrap"},tb=class extends Nse.Component{static{n(this,"ErrorBoundary")}static getDerivedStateFromError(e){return{error:e}}state={error:null};componentDidCatch(e,o){console.error("[lunora-studio] panel error",e,o.componentStack)}reset=n(()=>{this.setState({error:null})},"reset");render(){let{children:e,fallbackTitle:o,label:r,retryLabel:a}=this.props,{error:s}=this.state;if(s===null)return(0,kh.jsxDEV)(kh.Fragment,{children:e},void 0,!1);let i=o??(r===void 0?"Something went wrong":`${r} failed`);return(0,kh.jsxDEV)("div",{"data-testid":"dash-error-boundary",role:"alert",style:FBe,children:[(0,kh.jsxDEV)("strong",{children:i},void 0,!1),(0,kh.jsxDEV)("pre",{"data-testid":"dash-error-message",style:RBe,children:s.message},void 0,!1),(0,kh.jsxDEV)("button",{"data-testid":"dash-error-retry",onClick:this.reset,type:"button",children:a??"Try again"},void 0,!1)]},void 0,!0)}};var Yt=K(Eo(),1);var Hu=K(oe(),1);var Av=typeof window<"u"?Hu.useLayoutEffect:Hu.useEffect;function EM(t){let e=Hu.useRef({value:t,prev:null}),o=e.current.value;return t!==o&&(e.current={value:t,prev:o}),e.current.prev}n(EM,"usePrevious");function Dse(t,e,o={},r={}){Hu.useEffect(()=>{if(!t.current||r.disabled||typeof IntersectionObserver!="function")return;let a=new IntersectionObserver(([s])=>{e(s)},o);return a.observe(t.current),()=>{a.disconnect()}},[e,o,r.disabled,t])}n(Dse,"useIntersectionObserver");function _se(t){let e=Hu.useRef(null);return Hu.useImperativeHandle(t,()=>e.current,[]),e}n(_se,"useForwardedRef");function Mh(t){return t[t.length-1]}n(Mh,"last");function EBe(t){return typeof t=="function"}n(EBe,"isFunction");function pl(t,e){return EBe(t)?t(e):t}n(pl,"functionalUpdate");var zse=Object.prototype.hasOwnProperty,Lse=Object.prototype.propertyIsEnumerable;function Ph(t){for(let e in t)if(zse.call(t,e))return!0;return!1}n(Ph,"hasKeys");var ABe=n(()=>Object.create(null),"createNull"),Oh=n((t,e)=>Yd(t,e,ABe),"nullReplaceEqualDeep");function Yd(t,e,o=()=>({}),r=0){if(!1)return e;if(t===e)return t;if(r>500)return e;let a=e,s=a$(t)&&a$(a);if(!s&&!(SF(t)&&SF(a)))return a;let i=s?t:Bse(t);if(!i)return a;let c=s?a:Bse(a);if(!c)return a;let d=i.length,f=c.length,p=s?new Array(f):o(),m=0;for(let h=0;h<f;h++){let v=s?h:c[h],x=t[v],y=a[v];if(x===y){p[v]=x,(s?h<d:zse.call(t,v))&&m++;continue}if(x===null||y===null||typeof x!="object"||typeof y!="object"){p[v]=y;continue}let b=Yd(x,y,o,r+1);p[v]=b,b===x&&m++}return d===f&&m===d?t:p}n(Yd,"replaceEqualDeep");function Bse(t){let e=Object.getOwnPropertyNames(t);for(let a of e)if(!Lse.call(t,a))return!1;let o=Object.getOwnPropertySymbols(t);if(o.length===0)return e;let r=e;for(let a of o){if(!Lse.call(t,a))return!1;r.push(a)}return r}n(Bse,"getEnumerableOwnKeys");function SF(t){if(!Vse(t))return!1;let e=t.constructor;if(typeof e>"u")return!0;let o=e.prototype;return!(!Vse(o)||!o.hasOwnProperty("isPrototypeOf"))}n(SF,"isPlainObject");function Vse(t){return Object.prototype.toString.call(t)==="[object Object]"}n(Vse,"hasObjectPrototype");function a$(t){return Array.isArray(t)&&t.length===Object.keys(t).length}n(a$,"isPlainArray");function ju(t,e,o){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0,a=t.length;r<a;r++)if(!ju(t[r],e[r],o))return!1;return!0}if(SF(t)&&SF(e)){let r=o?.ignoreUndefined??!0;if(o?.partial){for(let i in e)if((!r||e[i]!==void 0)&&!ju(t[i],e[i],o))return!1;return!0}let a=0;if(!r)a=Object.keys(t).length;else for(let i in t)t[i]!==void 0&&a++;let s=0;for(let i in e)if((!r||e[i]!==void 0)&&(s++,s>a||!ju(t[i],e[i],o)))return!1;return a===s}return!1}n(ju,"deepEqual");function Xd(t){let e,o,r=new Promise((a,s)=>{e=a,o=s});return r.status="pending",r.resolve=a=>{r.status="resolved",r.value=a,e(a),t?.(a)},r.reject=a=>{r.status="rejected",o(a)},r}n(Xd,"createControlledPromise");function Nh(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}n(Nh,"isPromise");function s$(t,e){for(let o=t.length-1;o>=0;o--){let r=t[o];if(e(r))return r}}n(s$,"findLast");function TBe(t){return t.replace(/[\x00-\x1f\x7f]/g,"")}n(TBe,"sanitizePathSegment");function Use(t){let e;try{e=decodeURI(t)}catch{e=t.replaceAll(/%[0-9A-F]{2}/gi,o=>{try{return decodeURI(o)}catch{return o}})}return TBe(e)}n(Use,"decodeSegment");var i$=["http:","https:","mailto:","tel:"];function Qd(t,e){if(!t)return!1;try{let o=new URL(t);return!e.has(o.protocol)}catch{return!1}}n(Qd,"isDangerousProtocol");function ob(t){if(!t)return{path:t,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(t)&&!t.startsWith("//"))return{path:t,handledProtocolRelativeURL:!1};let e=/%25|%5C/gi,o=0,r="",a;for(;(a=e.exec(t))!==null;)r+=Use(t.slice(o,a.index))+a[0],o=e.lastIndex;r=r+Use(o?t.slice(o):t);let s=!1;return r.startsWith("//")&&(s=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:s}}n(ob,"decodePath");function $se(t){return/\s|[^\u0000-\u007F]/.test(t)?t.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):t}n($se,"encodePathLikeUrl");function Hse(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}n(Hse,"arraysEqual");function za(){throw new Error("Invariant failed")}n(za,"invariant");function Dh(t){let e=new Map,o,r,a=n(s=>{s.next&&(s.prev?(s.prev.next=s.next,s.next.prev=s.prev,s.next=void 0,r&&(r.next=s,s.prev=r)):(s.next.prev=void 0,o=s.next,s.next=void 0,r&&(s.prev=r,r.next=s)),r=s)},"touch");return{get(s){let i=e.get(s);if(i)return a(i),i.value},set(s,i){if(e.size>=t&&o){let d=o;e.delete(d.key),d.next&&(o=d.next,d.next.prev=void 0),d===r&&(r=void 0)}let c=e.get(s);if(c)c.value=i,a(c);else{let d={key:s,value:i,prev:r};r&&(r.next=d),r=d,o||(o=d),e.set(s,d)}},clear(){e.clear(),o=void 0,r=void 0}}}n(Dh,"createLRUCache");var Lh=4,qse=5;function kBe(t){let e=t.indexOf("{");if(e===-1)return null;let o=t.indexOf("}",e);return o===-1||e+1>=t.length?null:[e,o]}n(kBe,"getOpenAndCloseBraces");function u$(t,e,o=new Uint16Array(6)){let r=t.indexOf("/",e),a=r===-1?t.length:r,s=t.substring(e,a);if(!s||!s.includes("$"))return o[0]=0,o[1]=e,o[2]=e,o[3]=a,o[4]=a,o[5]=a,o;if(s==="$"){let c=t.length;return o[0]=2,o[1]=e,o[2]=e,o[3]=c,o[4]=c,o[5]=c,o}if(s.charCodeAt(0)===36)return o[0]=1,o[1]=e,o[2]=e+1,o[3]=a,o[4]=a,o[5]=a,o;let i=kBe(s);if(i){let[c,d]=i,f=s.charCodeAt(c+1);if(f===45){if(c+2<s.length&&s.charCodeAt(c+2)===36){let p=c+3,m=d;if(p<m)return o[0]=3,o[1]=e+c,o[2]=e+p,o[3]=e+m,o[4]=e+d+1,o[5]=a,o}}else if(f===36){let p=c+1,m=c+2;return m===d?(o[0]=2,o[1]=e+c,o[2]=e+p,o[3]=e+m,o[4]=e+d+1,o[5]=t.length,o):(o[0]=1,o[1]=e+c,o[2]=e+m,o[3]=e+d,o[4]=e+d+1,o[5]=a,o)}}return o[0]=0,o[1]=e,o[2]=e,o[3]=a,o[4]=a,o[5]=a,o}n(u$,"parseSegment");function kM(t,e,o,r,a,s,i){i?.(o);let c=r;{let d=o.fullPath??o.from,f=d.length,p=o.options?.caseSensitive??t,m=o.options?.params?.parse??o.options?.parseParams;for(;c<f;){let v=u$(d,c,e),x,y=c,b=v[5];switch(c=b+1,s++,v[0]){case 0:{let S=d.substring(v[2],v[3]);if(p){let w=a.static?.get(S);if(w)x=w;else{a.static??=new Map;let C=Tv(o.fullPath??o.from);C.parent=a,C.depth=s,x=C,a.static.set(S,C)}}else{let w=S.toLowerCase(),C=a.staticInsensitive?.get(w);if(C)x=C;else{a.staticInsensitive??=new Map;let F=Tv(o.fullPath??o.from);F.parent=a,F.depth=s,x=F,a.staticInsensitive.set(w,F)}}break}case 1:{let S=d.substring(y,v[1]),w=d.substring(v[4],b),C=p&&!!(S||w),F=S?C?S:S.toLowerCase():void 0,T=w?C?w:w.toLowerCase():void 0,E=!m&&a.dynamic?.find(k=>!k.parse&&k.caseSensitive===C&&k.prefix===F&&k.suffix===T);if(E)x=E;else{let k=c$(1,o.fullPath??o.from,C,F,T);x=k,k.depth=s,k.parent=a,a.dynamic??=[],a.dynamic.push(k)}break}case 3:{let S=d.substring(y,v[1]),w=d.substring(v[4],b),C=p&&!!(S||w),F=S?C?S:S.toLowerCase():void 0,T=w?C?w:w.toLowerCase():void 0,E=!m&&a.optional?.find(k=>!k.parse&&k.caseSensitive===C&&k.prefix===F&&k.suffix===T);if(E)x=E;else{let k=c$(3,o.fullPath??o.from,C,F,T);x=k,k.parent=a,k.depth=s,a.optional??=[],a.optional.push(k)}break}case 2:{let S=d.substring(y,v[1]),w=d.substring(v[4],b),C=p&&!!(S||w),F=S?C?S:S.toLowerCase():void 0,T=w?C?w:w.toLowerCase():void 0,E=c$(2,o.fullPath??o.from,C,F,T);x=E,E.parent=a,E.depth=s,a.wildcard??=[],a.wildcard.push(E)}}a=x}if(m&&o.children&&!o.isRoot&&o.id&&o.id.charCodeAt(o.id.lastIndexOf("/")+1)===95){let v=Tv(o.fullPath??o.from);v.kind=qse,v.parent=a,s++,v.depth=s,a.pathless??=[],a.pathless.push(v),a=v}let h=(o.path||!o.children)&&!o.isRoot;if(h&&d.endsWith("/")){let v=Tv(o.fullPath??o.from);v.kind=Lh,v.parent=a,s++,v.depth=s,a.index=v,a=v}a.parse=m??null,a.priority=o.options?.params?.priority??0,h&&!a.route&&(a.route=o,a.fullPath=o.fullPath??o.from)}if(o.children)for(let d of o.children)kM(t,e,d,c,a,s,i)}n(kM,"parseSegments");function l$(t,e){if(t.parse&&!e.parse)return-1;if(!t.parse&&e.parse)return 1;if(t.parse&&e.parse&&(t.priority||e.priority))return e.priority-t.priority;if(t.prefix&&e.prefix&&t.prefix!==e.prefix){if(t.prefix.startsWith(e.prefix))return-1;if(e.prefix.startsWith(t.prefix))return 1}if(t.suffix&&e.suffix&&t.suffix!==e.suffix){if(t.suffix.endsWith(e.suffix))return-1;if(e.suffix.endsWith(t.suffix))return 1}return t.prefix&&!e.prefix?-1:!t.prefix&&e.prefix?1:t.suffix&&!e.suffix?-1:!t.suffix&&e.suffix?1:t.caseSensitive&&!e.caseSensitive?-1:!t.caseSensitive&&e.caseSensitive?1:0}n(l$,"sortDynamic");function _h(t){if(t.pathless)for(let e of t.pathless)_h(e);if(t.static)for(let e of t.static.values())_h(e);if(t.staticInsensitive)for(let e of t.staticInsensitive.values())_h(e);if(t.dynamic?.length){t.dynamic.sort(l$);for(let e of t.dynamic)_h(e)}if(t.optional?.length){t.optional.sort(l$);for(let e of t.optional)_h(e)}if(t.wildcard?.length){t.wildcard.sort(l$);for(let e of t.wildcard)_h(e)}}n(_h,"sortTreeNodes");function Tv(t){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0}}n(Tv,"createStaticNode");function c$(t,e,o,r,a){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0,caseSensitive:o,prefix:r,suffix:a}}n(c$,"createDynamicNode");function Wse(t,e){let o=Tv("/"),r=new Uint16Array(6);for(let a of t)kM(!1,r,a,1,o,0);_h(o),e.masksTree=o,e.flatCache=Dh(1e3)}n(Wse,"processRouteMasks");function Gse(t,e){t||="/";let o=e.flatCache.get(t);if(o)return o;let r=d$(t,e.masksTree);return e.flatCache.set(t,r),r}n(Gse,"findFlatMatch");function Kse(t,e,o,r,a){t||="/",r||="/";let s=e?`case\0${t}`:t,i=a.singleCache.get(s);return i||(i=Tv("/"),kM(e,new Uint16Array(6),{from:t},1,i,0),a.singleCache.set(s,i)),d$(r,i,o)}n(Kse,"findSingleMatch");function Yse(t,e,o=!1){let r=o?t:`nofuzz\0${t}`,a=e.matchCache.get(r);if(a!==void 0)return a;t||="/";let s;try{s=d$(t,e.segmentTree,o)}catch(i){if(i instanceof URIError)s=null;else throw i}return s&&(s.branch=f$(s.route)),e.matchCache.set(r,s),s}n(Yse,"findRouteMatch");function MBe(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}n(MBe,"trimPathRight");function Xse(t,e=!1,o){let r=Tv(t.fullPath),a=new Uint16Array(6),s={},i={},c=0;return kM(e,a,t,1,r,0,d=>{if(o?.(d,c),d.id in s)throw new Error(`Invariant failed: Duplicate routes found with id: ${String(d.id)}`);if(s[d.id]=d,c!==0&&d.path){let f=MBe(d.fullPath);(!i[f]||d.fullPath.endsWith("/"))&&(i[f]=d)}c++}),_h(r),{processedTree:{segmentTree:r,singleCache:Dh(1e3),matchCache:Dh(1e3),flatCache:null,masksTree:null},routesById:s,routesByPath:i}}n(Xse,"processRouteTree");function d$(t,e,o=!1){let r=t.split("/"),a=OBe(t,r,e,o);if(!a)return null;let[s]=Qse(t,r,a);return{route:a.node.route,rawParams:s}}n(d$,"findMatch");function Qse(t,e,o){let r=PBe(o.node),a=null,s=Object.create(null),i=o.extract?.part??0,c=o.extract?.node??0,d=o.extract?.path??0,f=o.extract?.segment??0;for(;c<r.length;i++,c++,d++,f++){let p=r[c];if(p.kind===Lh)break;if(p.kind===qse){f--,i--,d--;continue}let m=e[i],h=d;if(m&&(d+=m.length),p.kind===1){a??=o.node.fullPath.split("/");let v=a[f],x=p.prefix?.length??0;if(v.charCodeAt(x)===123){let y=p.suffix?.length??0,b=v.substring(x+2,v.length-y-1),S=m.substring(x,m.length-y);s[b]=decodeURIComponent(S)}else{let y=v.substring(1);s[y]=decodeURIComponent(m)}}else if(p.kind===3){if(o.skipped&1<<c){i--,d=h-1;continue}a??=o.node.fullPath.split("/");let v=a[f],x=p.prefix?.length??0,y=p.suffix?.length??0,b=v.substring(x+3,v.length-y-1),S=p.suffix||p.prefix?m.substring(x,m.length-y):m;S&&(s[b]=decodeURIComponent(S))}else if(p.kind===2){let v=p,x=t.substring(h+(v.prefix?.length??0),t.length-(v.suffix?.length??0)),y=decodeURIComponent(x);s["*"]=y,s._splat=y;break}}return o.rawParams&&Object.assign(s,o.rawParams),[s,{part:i,node:c,path:d,segment:f}]}n(Qse,"extractParams");function f$(t){let e=[t];for(;t.parentRoute;)t=t.parentRoute,e.push(t);return e.reverse(),e}n(f$,"buildRouteBranch");function PBe(t){let e=Array(t.depth+1);do e[t.depth]=t,t=t.parent;while(t);return e}n(PBe,"buildBranch");function OBe(t,e,o,r){if(t==="/"&&o.index)return{node:o.index,skipped:0};let a=!Mh(e),s=a&&t!=="/",i=e.length-(a?1:0),c=[{node:o,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],d=null,f=null;for(;c.length;){let p=c.pop(),{node:m,index:h,skipped:v,depth:x,statics:y,dynamics:b,optionals:S}=p,{extract:w,rawParams:C}=p;if(m.kind===2&&m.route&&!TM(f,p))continue;if(m.parse){if(!jse(t,e,p))continue;C=p.rawParams,w=p.extract}r&&m.route&&m.kind!==Lh&&TM(d,p)&&(d=p);let F=h===i;if(F&&(m.route&&(!s||m.kind===Lh||m.kind===2)&&TM(f,p)&&(f=p),!m.optional&&!m.wildcard&&!m.index&&!m.pathless))continue;let T=F?void 0:e[h],E;if(F&&m.index){let k={node:m.index,index:h,skipped:v,depth:x+1,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C},O=!0;if(m.index.parse&&(jse(t,e,k)||(O=!1)),O){if(!b&&!S&&!v&&NBe(y,i))return k;TM(f,k)&&(f=k)}}if(m.wildcard)for(let k=m.wildcard.length-1;k>=0;k--){let O=m.wildcard[k],{prefix:D,suffix:M}=O;if(!(D&&(F||!(O.caseSensitive?T:E??=T.toLowerCase()).startsWith(D)))){if(M){if(F)continue;let L=e.slice(h).join("/").slice(-M.length);if((O.caseSensitive?L:L.toLowerCase())!==M)continue}c.push({node:O,index:i,skipped:v,depth:x+1,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C})}}if(m.optional){let k=v|1<<x,O=x+1;for(let D=m.optional.length-1;D>=0;D--){let M=m.optional[D];c.push({node:M,index:h,skipped:k,depth:O,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C})}if(!F)for(let D=m.optional.length-1;D>=0;D--){let M=m.optional[D],{prefix:L,suffix:U}=M;if(L||U){let W=M.caseSensitive?T:E??=T.toLowerCase();if(L&&!W.startsWith(L)||U&&!W.endsWith(U))continue}c.push({node:M,index:h+1,skipped:v,depth:O,statics:y,dynamics:b,optionals:S+AM(i,h),extract:w,rawParams:C})}}if(!F&&m.dynamic&&T)for(let k=m.dynamic.length-1;k>=0;k--){let O=m.dynamic[k],{prefix:D,suffix:M}=O;if(D||M){let L=O.caseSensitive?T:E??=T.toLowerCase();if(D&&!L.startsWith(D)||M&&!L.endsWith(M))continue}c.push({node:O,index:h+1,skipped:v,depth:x+1,statics:y,dynamics:b+AM(i,h),optionals:S,extract:w,rawParams:C})}if(!F&&m.staticInsensitive){let k=m.staticInsensitive.get(E??=T.toLowerCase());k&&c.push({node:k,index:h+1,skipped:v,depth:x+1,statics:y+AM(i,h),dynamics:b,optionals:S,extract:w,rawParams:C})}if(!F&&m.static){let k=m.static.get(T);k&&c.push({node:k,index:h+1,skipped:v,depth:x+1,statics:y+AM(i,h),dynamics:b,optionals:S,extract:w,rawParams:C})}if(m.pathless){let k=x+1;for(let O=m.pathless.length-1;O>=0;O--){let D=m.pathless[O];c.push({node:D,index:h,skipped:v,depth:k,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C})}}}if(f)return f;if(r&&d){let p=d.index;for(let h=0;h<d.index;h++)p+=e[h].length;let m=p===t.length?"/":t.slice(p);return d.rawParams??=Object.create(null),d.rawParams["**"]=decodeURIComponent(m),d}return null}n(OBe,"getNodeMatch");function AM(t,e){return 2**(t-e-1)}n(AM,"segmentScore");function NBe(t,e){return t===2**(e-1)-1}n(NBe,"isPerfectStaticMatch");function jse(t,e,o){let r,a;try{[r,a]=Qse(t,e,o)}catch{return null}if(o.rawParams=r,o.extract=a,!o.node.parse)return!0;try{if(o.node.parse(r)===!1)return null}catch{}return!0}n(jse,"validateParseParams");function TM(t,e){return t?e.statics>t.statics||e.statics===t.statics&&(e.dynamics>t.dynamics||e.dynamics===t.dynamics&&(e.optionals>t.optionals||e.optionals===t.optionals&&((e.node.kind===Lh)>(t.node.kind===Lh)||e.node.kind===Lh==(t.node.kind===Lh)&&e.depth>t.depth))):!0}n(TM,"isFrameMoreSpecific");function kv(t){return CF(t.filter(e=>e!==void 0).join("/"))}n(kv,"joinPaths");function CF(t){return t.replace(/\/{2,}/g,"/")}n(CF,"cleanPath");function MM(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}n(MM,"trimPathLeft");function Jl(t){let e=t.length;return e>1&&t[e-1]==="/"?t.replace(/\/{1,}$/,""):t}n(Jl,"trimPathRight");function FF(t){return Jl(MM(t))}n(FF,"trimPath");function Bh(t,e){return t?.endsWith("/")&&t!=="/"&&t!==`${e}/`?t.slice(0,-1):t}n(Bh,"removeTrailingSlash");function PM(t,e,o){return Bh(t,o)===Bh(e,o)}n(PM,"exactPathTest");function p$({base:t,to:e,trailingSlash:o="never",cache:r}){let a=e.startsWith("/"),s=!a&&e===".",i;if(r){i=a?e:s?t:t+"\0"+e;let f=r.get(i);if(f)return f}let c;if(s)c=t.split("/");else if(a)c=e.split("/");else{for(c=t.split("/");c.length>1&&Mh(c)==="";)c.pop();let f=e.split("/");for(let p=0,m=f.length;p<m;p++){let h=f[p];h===""?p?p===m-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Mh(c)===""?o==="never"&&c.pop():o==="always"&&c.push(""));let d=CF(c.join("/"))||"/";return i&&r&&r.set(i,d),d}n(p$,"resolvePath");function Jse(t){let e=new Map(t.map(a=>[encodeURIComponent(a),a])),o=Array.from(e.keys()).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(o,"g");return a=>a.replace(r,s=>e.get(s)??s)}n(Jse,"compileDecodeCharMap");function wF(t,e,o){let r=e[t];return typeof r!="string"?r:t==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(a=>Zse(a,o)).join("/"):Zse(r,o)}n(wF,"encodeParam");function OM({path:t,params:e,decoder:o,...r}){let a=!1,s=Object.create(null);if(!t||t==="/")return{interpolatedPath:"/",usedParams:s,isMissingParams:a};if(!t.includes("$"))return{interpolatedPath:t,usedParams:s,isMissingParams:a};if(!1){let p=t.length,m=0,h="";for(;m<p;){for(;m<p&&t.charCodeAt(m)===47;)m++;if(m>=p)break;let v=m,x=t.indexOf("/",m);x===-1&&(x=p),m=x;let y=t.substring(v,x);if(y)if(y.charCodeAt(0)===36)if(y.length===1){let b=e._splat;if(s._splat=b,s["*"]=b,!b){a=!0;continue}let S=wF("_splat",e,o);h+="/"+S}else{let b=y.substring(1);!a&&!(b in e)&&(a=!0),s[b]=e[b];let S=wF(b,e,o)??"undefined";h+="/"+S}else h+="/"+y}return t.endsWith("/")&&(h+="/"),{usedParams:s,interpolatedPath:h||"/",isMissingParams:a}}let i=t.length,c=0,d,f="";for(;c<i;){let p=c;d=u$(t,p,d);let m=d[5];if(c=m+1,p===m)continue;let h=d[0];if(h===0){f+="/"+t.substring(p,m);continue}if(h===2){let v=e._splat;s._splat=v,s["*"]=v;let x=t.substring(p,d[1]),y=t.substring(d[4],m);if(!v){a=!0,(x||y)&&(f+="/"+x+y);continue}let b=wF("_splat",e,o);f+="/"+x+b+y;continue}if(h===1){let v=t.substring(d[2],d[3]);!a&&!(v in e)&&(a=!0),s[v]=e[v];let x=t.substring(p,d[1]),y=t.substring(d[4],m),b=wF(v,e,o)??"undefined";f+="/"+x+b+y;continue}if(h===3){let v=t.substring(d[2],d[3]),x=e[v];if(x==null)continue;s[v]=x;let y=t.substring(p,d[1]),b=t.substring(d[4],m),S=wF(v,e,o)??"";f+="/"+y+S+b;continue}}return t.endsWith("/")&&(f+="/"),{usedParams:s,interpolatedPath:f||"/",isMissingParams:a}}n(OM,"interpolatePath");function Zse(t,e){let o=encodeURIComponent(t);return e?.(o)??o}n(Zse,"encodePathParam");function Hn(t){return t?.isNotFound===!0}n(Hn,"isNotFound");function eie(t,e=String){let o=new URLSearchParams;for(let r in t){let a=t[r];a!==void 0&&o.set(r,e(a))}return o.toString()}n(eie,"encode");function m$(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}n(m$,"toValue");function tie(t){let e=new URLSearchParams(t),o=Object.create(null);for(let[r,a]of e.entries()){let s=o[r];s==null?o[r]=m$(a):Array.isArray(s)?s.push(m$(a)):o[r]=[s,m$(a)]}return o}n(tie,"decode");var oie=DBe(JSON.parse),rie=_Be(JSON.stringify,JSON.parse);function DBe(t){return e=>{e[0]==="?"&&(e=e.substring(1));let o=tie(e);for(let r in o){let a=o[r];if(typeof a=="string")try{o[r]=t(a)}catch{}}return o}}n(DBe,"parseSearchWith");function _Be(t,e){let o=typeof e=="function";function r(a){if(typeof a=="object"&&a!==null)try{return t(a)}catch{}else if(o&&typeof a=="string")try{return e(a),t(a)}catch{}return a}return n(r,"stringifyValue"),a=>{let s=eie(a,r);return s?`?${s}`:""}}n(_Be,"stringifySearchWith");var ml="__root__";function rb(t){if(t.statusCode=t.statusCode||t.code||307,!t._builtLocation&&!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}let e=new Headers(t.headers);t.href&&e.get("Location")===null&&e.set("Location",t.href);let o=new Response(null,{status:t.statusCode,headers:e});if(o.options=t,t.throw)throw o;return o}n(rb,"redirect");function ns(t){return t instanceof Response&&!!t.options}n(ns,"isRedirect");var h$=n(t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},"triggerOnReady"),LBe=n(t=>t.stores.matchesId.get().some(e=>t.stores.matchStores.get(e)?.get()._forcePending),"hasForcePendingActiveMatch"),_M=n((t,e)=>!!(t.preload&&!t.router.stores.matchStores.has(e)),"resolvePreload"),Mv=n((t,e,o=!0)=>{let r={...t.router.options.context??{}},a=o?e:e-1;for(let s=0;s<=a;s++){let i=t.matches[s];if(!i)continue;let c=t.router.getMatch(i.id);c&&Object.assign(r,c.__routeContext,c.__beforeLoadContext)}return r},"buildMatchContext"),nie=n((t,e)=>{if(!t.matches.length)return;let o=e.routeId,r=t.matches.findIndex(i=>i.routeId===t.router.routeTree.id),a=r>=0?r:0,s=o?t.matches.findIndex(i=>i.routeId===o):t.firstBadMatchIndex??t.matches.length-1;s<0&&(s=a);for(let i=s;i>=0;i--){let c=t.matches[i];if(t.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return o?s:a},"getNotFoundBoundaryIndex"),Vh=n((t,e,o)=>{if(!(!ns(o)&&!Hn(o)))throw ns(o)&&o.redirectHandled&&!o.options.reloadDocument||(e&&(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.loaderPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loaderPromise=void 0,e._nonReactive.error=o,t.updateMatch(e.id,r=>({...r,status:ns(o)?"redirected":Hn(o)?"notFound":r.status==="pending"?"success":r.status,context:Mv(t,e.index),isFetching:!1,error:o})),Hn(o)&&!o.routeId&&(o.routeId=e.routeId),e._nonReactive.loadPromise?.resolve()),ns(o)&&(t.rendered=!0,o.options._fromLocation=t.location,o.redirectHandled=!0,o=t.router.resolveRedirect(o))),o},"handleRedirectAndNotFound"),lie=n((t,e)=>{let o=t.router.getMatch(e);return!!(!o||!!1&&o._nonReactive.dehydrated||!1)},"shouldSkipLoader"),aie=n((t,e,o)=>{let r=Mv(t,o);t.updateMatch(e,a=>({...a,context:r}))},"syncMatchContext"),RF=n((t,e,o)=>{let{id:r,routeId:a}=t.matches[e],s=t.router.looseRoutesById[a];if(o instanceof Promise)throw o;t.firstBadMatchIndex??=e,Vh(t,t.router.getMatch(r),o);try{s.options.onError?.(o)}catch(i){o=i,Vh(t,t.router.getMatch(r),o)}t.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:o,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!t.preload&&!ns(o)&&!Hn(o)&&(t.serialError??=o)},"handleSerialError"),BBe=n((t,e,o,r)=>{let a=t.router.getMatch(e),s=t.matches[o-1]?.id,i=s?t.router.getMatch(s):void 0;if(t.router.isShell()){a.ssr=r.id===ml;return}if(i?.ssr===!1){a.ssr=!1;return}let c=n(v=>v===!0&&i?.ssr==="data-only"?"data-only":v,"parentOverride"),d=t.router.options.defaultSsr??!0;if(r.options.ssr===void 0){a.ssr=c(d);return}if(typeof r.options.ssr!="function"){a.ssr=c(r.options.ssr);return}let{search:f,params:p}=a,m={search:NM(f,a.searchError),params:NM(p,a.paramsError),location:t.location,matches:t.matches.map(v=>({index:v.index,pathname:v.pathname,fullPath:v.fullPath,staticData:v.staticData,id:v.id,routeId:v.routeId,search:NM(v.search,v.searchError),params:NM(v.params,v.paramsError),ssr:v.ssr}))},h=r.options.ssr(m);if(Nh(h))return h.then(v=>{a.ssr=c(v??d)});a.ssr=c(h??d)},"isBeforeLoadSsr"),cie=n((t,e,o,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let a=o.options.pendingMs??t.router.options.defaultPendingMs;if(t.onReady&&!!1&&!_M(t,e)&&(o.options.loader||o.options.beforeLoad||v$(o))&&typeof a=="number"&&a!==1/0&&(o.options.pendingComponent??t.router.options?.defaultPendingComponent)){let s=setTimeout(()=>{h$(t)},a);r._nonReactive.pendingTimeout=s}},"setupPendingTimeout"),VBe=n((t,e,o)=>{let r=t.router.getMatch(e);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;cie(t,e,o,r);let a=n(()=>{let s=t.router.getMatch(e);s.preload&&(s.status==="redirected"||s.status==="notFound")&&Vh(t,s,s.error)},"then");return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(a):a()},"preBeforeLoadSetup"),UBe=n((t,e,o,r)=>{let a=t.router.getMatch(e),s=a._nonReactive.loadPromise;a._nonReactive.loadPromise=Xd(()=>{s?.resolve(),s=void 0});let{paramsError:i,searchError:c}=a;i&&RF(t,o,i),c&&RF(t,o,c),cie(t,e,r,a);let d=new AbortController,f=!1,p=n(()=>{f||(f=!0,t.updateMatch(e,F=>({...F,isFetching:"beforeLoad",fetchCount:F.fetchCount+1,abortController:d})))},"pending"),m=n(()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,t.updateMatch(e,F=>({...F,isFetching:!1}))},"resolve");if(!r.options.beforeLoad){t.router.batch(()=>{p(),m()});return}a._nonReactive.beforeLoadPromise=Xd();let h={...Mv(t,o,!1),...a.__routeContext},{search:v,params:x,cause:y}=a,b=_M(t,e),S={search:v,abortController:d,params:x,preload:b,context:h,location:t.location,navigate:n(F=>t.router.navigate({...F,_fromLocation:t.location}),"navigate"),buildLocation:t.router.buildLocation,cause:b?"preload":y,matches:t.matches,routeId:r.id,...t.router.options.additionalContext},w=n(F=>{if(F===void 0){t.router.batch(()=>{p(),m()});return}(ns(F)||Hn(F))&&(p(),RF(t,o,F)),t.router.batch(()=>{p(),t.updateMatch(e,T=>({...T,__beforeLoadContext:F})),m()})},"updateContext"),C;try{if(C=r.options.beforeLoad(S),Nh(C))return p(),C.catch(F=>{RF(t,o,F)}).then(w)}catch(F){p(),RF(t,o,F)}w(C)},"executeBeforeLoad"),zBe=n((t,e)=>{let{id:o,routeId:r}=t.matches[e],a=t.router.looseRoutesById[r],s=n(()=>{if(!1){let d=BBe(t,o,e,a);if(Nh(d))return d.then(c)}return c()},"serverSsr"),i=n(()=>UBe(t,o,e,a),"execute"),c=n(()=>{if(lie(t,o))return;let d=VBe(t,o,a);return Nh(d)?d.then(i):i()},"queueExecution");return s()},"handleBeforeLoad"),$Be=n((t,e,o)=>{let r=t.router.getMatch(e);if(!r||!o.options.head&&!o.options.scripts&&!o.options.headers)return;let a={ssr:t.router.options.ssr,matches:t.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([o.options.head?.(a),o.options.scripts?.(a),o.options.headers?.(a)]).then(([s,i,c])=>({meta:s?.meta,links:s?.links,headScripts:s?.scripts,headers:c,scripts:i,styles:s?.styles}))},"executeHead"),uie=n((t,e,o,r,a)=>{let s=e[r-1],{params:i,loaderDeps:c,abortController:d,cause:f}=t.router.getMatch(o),p=Mv(t,r),m=_M(t,o);return{params:i,deps:c,preload:!!m,parentMatchPromise:s,abortController:d,context:p,location:t.location,navigate:n(h=>t.router.navigate({...h,_fromLocation:t.location}),"navigate"),cause:m?"preload":f,route:a,...t.router.options.additionalContext}},"getLoaderContext"),sie=n(async(t,e,o,r,a)=>{try{let s=t.router.getMatch(o);try{(!!1||s.ssr===!0)&&nb(a);let i=a.options.loader,c=typeof i=="function"?i:i?.handler,d=c?.(uie(t,e,o,r,a)),f=!!c&&Nh(d);if((f||a._lazyPromise||a._componentsPromise||a.options.head||a.options.scripts||a.options.headers||s._nonReactive.minPendingPromise)&&t.updateMatch(o,m=>({...m,isFetching:"loader"})),c){let m=f?await d:d;Vh(t,t.router.getMatch(o),m),m!==void 0&&t.updateMatch(o,h=>({...h,loaderData:m}))}a._lazyPromise&&await a._lazyPromise;let p=s._nonReactive.minPendingPromise;p&&await p,a._componentsPromise&&await a._componentsPromise,t.updateMatch(o,m=>({...m,error:void 0,context:Mv(t,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(s.abortController.signal.aborted){s._nonReactive.loaderPromise?.resolve(),s._nonReactive.loaderPromise=void 0;return}t.updateMatch(o,f=>({...f,status:f.status==="pending"?"success":f.status,isFetching:!1,context:Mv(t,r)}));return}let d=s._nonReactive.minPendingPromise;d&&await d,Hn(i)&&await a.options.notFoundComponent?.preload?.(),Vh(t,t.router.getMatch(o),i);try{a.options.onError?.(i)}catch(f){c=f,Vh(t,t.router.getMatch(o),f)}!ns(c)&&!Hn(c)&&await nb(a,["errorComponent"]),t.updateMatch(o,f=>({...f,error:c,context:Mv(t,r),status:"error",isFetching:!1}))}}catch(s){let i=t.router.getMatch(o);i&&(i._nonReactive.loaderPromise=void 0),Vh(t,i,s)}},"runLoader"),HBe=n(async(t,e,o)=>{async function r(v,x,y,b,S){let w=Date.now()-x.updatedAt,C=v?S.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:S.options.staleTime??t.router.options.defaultStaleTime??0,F=S.options.shouldReload,T=typeof F=="function"?F(uie(t,e,a,o,S)):F,{status:E,invalid:k}=b,O=w>=C&&(!!t.forceStaleReload||b.cause==="enter"||y!==void 0&&y!==b.id);i=E==="success"&&(k||(T??O)),v&&S.options.preload===!1||(i&&!t.sync&&p?(c=!0,(async()=>{try{await sie(t,e,a,o,S);let D=t.router.getMatch(a);D._nonReactive.loaderPromise?.resolve(),D._nonReactive.loadPromise?.resolve(),D._nonReactive.loaderPromise=void 0,D._nonReactive.loadPromise=void 0}catch(D){ns(D)&&await t.router.navigate(D.options)}})()):E!=="success"||i?await sie(t,e,a,o,S):aie(t,a,o))}n(r,"handleLoader");let{id:a,routeId:s}=t.matches[o],i=!1,c=!1,d=t.router.looseRoutesById[s],f=d.options.loader,p=((typeof f=="function"?void 0:f?.staleReloadMode)??t.router.options.defaultStaleReloadMode)!=="blocking";if(lie(t,a)){if(!t.router.getMatch(a))return t.matches[o];if(aie(t,a,o),!1)return t.router.getMatch(a)}else{let v=t.router.getMatch(a),x=t.router.stores.matchesId.get()[o],y=(x&&t.router.stores.matchStores.get(x)||null)?.routeId===s?x:t.router.stores.matches.get().find(S=>S.routeId===s)?.id,b=_M(t,a);if(v._nonReactive.loaderPromise){if(v.status==="success"&&!t.sync&&!v.preload&&p)return v;await v._nonReactive.loaderPromise;let S=t.router.getMatch(a),w=S._nonReactive.error||S.error;w&&Vh(t,S,w),S.status==="pending"&&await r(b,v,y,S,d)}else{let S=b&&!t.router.stores.matchStores.has(a),w=t.router.getMatch(a);w._nonReactive.loaderPromise=Xd(),S!==w.preload&&t.updateMatch(a,C=>({...C,preload:S})),await r(b,v,y,w,d)}}let m=t.router.getMatch(a);c||(m._nonReactive.loaderPromise?.resolve(),m._nonReactive.loadPromise?.resolve(),m._nonReactive.loadPromise=void 0),clearTimeout(m._nonReactive.pendingTimeout),m._nonReactive.pendingTimeout=void 0,c||(m._nonReactive.loaderPromise=void 0),m._nonReactive.dehydrated=void 0;let h=c?m.isFetching:!1;return h!==m.isFetching||m.invalid!==!1?(t.updateMatch(a,v=>({...v,isFetching:h,invalid:!1})),t.router.getMatch(a)):m},"loadRouteMatch");async function g$(t){let e=t,o=[];!!1&&LBe(e.router)&&h$(e);let r;for(let h=0;h<e.matches.length;h++){try{let v=zBe(e,h);Nh(v)&&await v}catch(v){if(ns(v))throw v;if(Hn(v))r=v;else if(!e.preload)throw v;break}if(e.serialError||e.firstBadMatchIndex!=null)break}let a=e.firstBadMatchIndex??e.matches.length,s=r&&!e.preload?nie(e,r):void 0,i=r&&e.preload?0:s!==void 0?Math.min(s+1,a):a,c,d;for(let h=0;h<i;h++)o.push(HBe(e,o,h));try{await Promise.all(o)}catch{let h=await Promise.allSettled(o);for(let v of h){if(v.status!=="rejected")continue;let x=v.reason;if(ns(x))throw x;Hn(x)?c??=x:d??=x}if(d!==void 0)throw d}let f=c??(r&&!e.preload?r:void 0),p=e.firstBadMatchIndex!==void 0?e.firstBadMatchIndex:e.matches.length-1;if(!f&&r&&e.preload)return e.matches;if(f){let h=nie(e,f);if(h===void 0)throw new Error("Invariant failed: Could not find match for notFound boundary");let v=e.matches[h],x=e.router.looseRoutesById[v.routeId],y=e.router.options?.defaultNotFoundComponent;!x.options.notFoundComponent&&y&&(x.options.notFoundComponent=y),f.routeId=v.routeId;let b=v.routeId===e.router.routeTree.id;e.updateMatch(v.id,S=>({...S,...b?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:f},isFetching:!1})),p=h,await nb(x,["notFoundComponent"])}else if(!e.preload){let h=e.matches[0];h.globalNotFound||e.router.getMatch(h.id)?.globalNotFound&&e.updateMatch(h.id,v=>({...v,globalNotFound:!1,error:void 0}))}if(e.serialError&&e.firstBadMatchIndex!==void 0){let h=e.router.looseRoutesById[e.matches[e.firstBadMatchIndex].routeId];await nb(h,["errorComponent"])}for(let h=0;h<=p;h++){let{id:v,routeId:x}=e.matches[h],y=e.router.looseRoutesById[x];try{let b=$Be(e,v,y);if(b){let S=await b;e.updateMatch(v,w=>({...w,...S}))}}catch(b){console.error(`Error executing head for route ${x}:`,b)}}let m=h$(e);if(Nh(m)&&await m,f)throw f;if(e.serialError&&!e.preload&&!e.onReady)throw e.serialError;return e.matches}n(g$,"loadMatches");function iie(t,e){let o=e.map(r=>t.options[r]?.preload?.()).filter(Boolean);if(o.length!==0)return Promise.all(o)}n(iie,"preloadRouteComponents");function nb(t,e=DM){!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(r=>{let{id:a,...s}=r.options;Object.assign(t.options,s),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0);let o=n(()=>t._componentsLoaded?void 0:e===DM?(()=>{if(t._componentsPromise===void 0){let r=iie(t,DM);r?t._componentsPromise=r.then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0}):t._componentsLoaded=!0}return t._componentsPromise})():iie(t,e),"runAfterLazy");return t._lazyPromise?t._lazyPromise.then(o):o()}n(nb,"loadRouteChunk");function NM(t,e){return e?{status:"error",error:e}:{status:"success",value:t}}n(NM,"makeMaybe");function v$(t){for(let e of DM)if(t.options[e]?.preload)return!0;return!1}n(v$,"routeNeedsPreload");var DM=["component","errorComponent","pendingComponent","notFoundComponent"];function die(t){return{input:n(({url:e})=>{for(let o of t)e=LM(o,e);return e},"input"),output:n(({url:e})=>{for(let o=t.length-1;o>=0;o--)e=x$(t[o],e);return e},"output")}}n(die,"composeRewrites");function fie(t){let e=FF(t.basepath),o=`/${e}`,r=t.caseSensitive?o:o.toLowerCase(),a=`${r}/`;return{input:n(({url:s})=>{let i=t.caseSensitive?s.pathname:s.pathname.toLowerCase();return i===r?s.pathname="/":i.startsWith(a)&&(s.pathname=s.pathname.slice(o.length)),s},"input"),output:n(({url:s})=>(s.pathname=kv(["/",e,s.pathname]),s),"output")}}n(fie,"rewriteBasepath");function LM(t,e){let o=t?.input?.({url:e});if(o){if(typeof o=="string")return new URL(o);if(o instanceof URL)return o}return e}n(LM,"executeRewriteInput");function x$(t,e){let o=t?.output?.({url:e});if(o){if(typeof o=="string")return new URL(o);if(o instanceof URL)return o}return e}n(x$,"executeRewriteOutput");function b$(t){let e=t;return{get(){return e},set(o){e=pl(o,e)}}}n(b$,"createNonReactiveMutableStore");function S$(t){return{get(){return t()}}}n(S$,"createNonReactiveReadonlyStore");function pie(t,e){let{createMutableStore:o,createReadonlyStore:r,batch:a,init:s}=e,i=new Map,c=new Map,d=new Map,f=o(t.status),p=o(t.loadedAt),m=o(t.isLoading),h=o(t.isTransitioning),v=o(t.location),x=o(t.resolvedLocation),y=o(t.statusCode),b=o(t.redirect),S=o([]),w=o([]),C=o([]),F=r(()=>y$(i,S.get())),T=r(()=>y$(c,w.get())),E=r(()=>y$(d,C.get())),k=r(()=>S.get()[0]),O=r(()=>S.get().some(_=>i.get(_)?.get().status==="pending")),D=r(()=>({locationHref:v.get().href,resolvedLocationHref:x.get()?.href,status:f.get()})),M=r(()=>({status:f.get(),loadedAt:p.get(),isLoading:m.get(),isTransitioning:h.get(),matches:F.get(),location:v.get(),resolvedLocation:x.get(),statusCode:y.get(),redirect:b.get()})),L=Dh(64);function U(_){let B=L.get(_);return B||(B=r(()=>{let z=S.get();for(let q of z){let $=i.get(q);if($&&$.routeId===_)return $.get()}}),L.set(_,B)),B}n(U,"getRouteMatchStore");let W={status:f,loadedAt:p,isLoading:m,isTransitioning:h,location:v,resolvedLocation:x,statusCode:y,redirect:b,matchesId:S,pendingIds:w,cachedIds:C,matches:F,pendingMatches:T,cachedMatches:E,firstId:k,hasPending:O,matchRouteDeps:D,matchStores:i,pendingMatchStores:c,cachedMatchStores:d,__store:M,getRouteMatchStore:U,setMatches:V,setPending:j,setCached:N};V(t.matches),s?.(W);function V(_){I$(_,i,S,o,a)}n(V,"setMatches");function j(_){I$(_,c,w,o,a)}n(j,"setPending");function N(_){I$(_,d,C,o,a)}return n(N,"setCached"),W}n(pie,"createRouterStores");function y$(t,e){let o=[];for(let r of e){let a=t.get(r);a&&o.push(a.get())}return o}n(y$,"readPoolMatches");function I$(t,e,o,r,a){let s=t.map(c=>c.id),i=new Set(s);a(()=>{for(let c of e.keys())i.has(c)||e.delete(c);for(let c of t){let d=e.get(c.id);if(!d){let f=r(c);f.routeId=c.routeId,e.set(c.id,f);continue}d.routeId=c.routeId,d.get()!==c&&d.set(c)}Hse(o.get(),s)||o.set(s)})}n(I$,"reconcileMatchPool");var Uh="__TSR_index",mie="popstate",hie="beforeunload";function C$(t){let e=t.getLocation(),o=new Set,r=n(i=>{e=t.getLocation(),o.forEach(c=>c({location:e,action:i}))},"notify"),a=n(i=>{t.notifyOnIndexChange??!0?r(i):e=t.getLocation()},"handleIndexChange"),s=n(async({task:i,navigateOpts:c,...d})=>{if(c?.ignoreBlocker??!1){i();return}let f=t.getBlockers?.()??[],p=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&f.length&&p)for(let m of f){let h=ab(d.path,d.state);if(await m.blockerFn({currentLocation:e,nextLocation:h,action:d.type})){t.onBlocked?.();return}}i()},"tryNavigation");return{get location(){return e},get length(){return t.getLength()},subscribers:o,subscribe:n(i=>(o.add(i),()=>{o.delete(i)}),"subscribe"),push:n((i,c,d)=>{let f=e.state[Uh];c=w$(f+1,c),s({task:n(()=>{t.pushState(i,c),r({type:"PUSH"})},"task"),navigateOpts:d,type:"PUSH",path:i,state:c})},"push"),replace:n((i,c,d)=>{let f=e.state[Uh];c=w$(f,c),s({task:n(()=>{t.replaceState(i,c),r({type:"REPLACE"})},"task"),navigateOpts:d,type:"REPLACE",path:i,state:c})},"replace"),go:n((i,c)=>{s({task:n(()=>{t.go(i),a({type:"GO",index:i})},"task"),navigateOpts:c,type:"GO"})},"go"),back:n(i=>{s({task:n(()=>{t.back(i?.ignoreBlocker??!1),a({type:"BACK"})},"task"),navigateOpts:i,type:"BACK"})},"back"),forward:n(i=>{s({task:n(()=>{t.forward(i?.ignoreBlocker??!1),a({type:"FORWARD"})},"task"),navigateOpts:i,type:"FORWARD"})},"forward"),canGoBack:n(()=>e.state[Uh]!==0,"canGoBack"),createHref:n(i=>t.createHref(i),"createHref"),block:n(i=>{if(!t.setBlockers)return()=>{};let c=t.getBlockers?.()??[];return t.setBlockers([...c,i]),()=>{let d=t.getBlockers?.()??[];t.setBlockers?.(d.filter(f=>f!==i))}},"block"),flush:n(()=>t.flush?.(),"flush"),destroy:n(()=>t.destroy?.(),"destroy"),notify:r}}n(C$,"createHistory");function w$(t,e){e||(e={});let o=R$();return{...e,key:o,__TSR_key:o,[Uh]:t}}n(w$,"assignKeyAndIndex");function EF(t){let e=t?.window??(typeof document<"u"?window:void 0),o=e.history.pushState,r=e.history.replaceState,a=[],s=n(()=>a,"_getBlockers"),i=n(O=>a=O,"_setBlockers"),c=t?.createHref??(O=>O),d=t?.parseLocation??(()=>ab(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));if(!e.history.state?.__TSR_key&&!e.history.state?.key){let O=R$();e.history.replaceState({[Uh]:0,key:O,__TSR_key:O},"")}let f=d(),p,m=!1,h=!1,v=!1,x=!1,y=n(()=>f,"getLocation"),b,S,w=n(()=>{b&&(k._ignoreSubscribers=!0,(b.isPush?e.history.pushState:e.history.replaceState)(b.state,"",b.href),k._ignoreSubscribers=!1,b=void 0,S=void 0,p=void 0)},"flush"),C=n((O,D,M)=>{let L=c(D);S||(p=f),f=ab(D,M),b={href:L,state:M,isPush:b?.isPush||O==="push"},S||(S=Promise.resolve().then(()=>w()))},"queueHistoryAction"),F=n(O=>{f=d(),k.notify({type:O})},"onPushPop"),T=n(async()=>{if(h){h=!1;return}let O=d(),D=O.state[Uh]-f.state[Uh],M=D===1,L=D===-1,U=!M&&!L||m;m=!1;let W=U?"GO":L?"BACK":"FORWARD",V=U?{type:"GO",index:D}:{type:L?"BACK":"FORWARD"};if(v)v=!1;else{let j=s();if(typeof document<"u"&&j.length){for(let N of j)if(await N.blockerFn({currentLocation:f,nextLocation:O,action:W})){h=!0,e.history.go(1),k.notify(V);return}}}f=d(),k.notify(V)},"onPushPopEvent"),E=n(O=>{if(x){x=!1;return}let D=!1,M=s();if(typeof document<"u"&&M.length)for(let L of M){let U=L.enableBeforeUnload??!0;if(U===!0){D=!0;break}if(typeof U=="function"&&U()===!0){D=!0;break}}if(D)return O.preventDefault(),O.returnValue=""},"onBeforeUnload"),k=C$({getLocation:y,getLength:n(()=>e.history.length,"getLength"),pushState:n((O,D)=>C("push",O,D),"pushState"),replaceState:n((O,D)=>C("replace",O,D),"replaceState"),back:n(O=>(O&&(v=!0),x=!0,e.history.back()),"back"),forward:n(O=>{O&&(v=!0),x=!0,e.history.forward()},"forward"),go:n(O=>{m=!0,e.history.go(O)},"go"),createHref:n(O=>c(O),"createHref"),flush:w,destroy:n(()=>{e.history.pushState=o,e.history.replaceState=r,e.removeEventListener(hie,E,{capture:!0}),e.removeEventListener(mie,T)},"destroy"),onBlocked:n(()=>{p&&f!==p&&(f=p)},"onBlocked"),getBlockers:s,setBlockers:i,notifyOnIndexChange:!1});return e.addEventListener(hie,E,{capture:!0}),e.addEventListener(mie,T),e.history.pushState=function(...O){let D=o.apply(e.history,O);return k._ignoreSubscribers||F("PUSH"),D},e.history.replaceState=function(...O){let D=r.apply(e.history,O);return k._ignoreSubscribers||F("REPLACE"),D},k}n(EF,"createBrowserHistory");function F$(t={initialEntries:["/"]}){let e=t.initialEntries,o=t.initialIndex?Math.min(Math.max(t.initialIndex,0),e.length-1):e.length-1,r=e.map((d,f)=>w$(f,void 0)),a=n(()=>ab(e[o],r[o]),"getLocation"),s=[];return C$({getLocation:a,getLength:n(()=>e.length,"getLength"),pushState:n((d,f)=>{o<e.length-1&&(e.splice(o+1),r.splice(o+1)),r.push(f),e.push(d),o=Math.max(e.length-1,0)},"pushState"),replaceState:n((d,f)=>{r[o]=f,e[o]=d},"replaceState"),back:n(()=>{o=Math.max(o-1,0)},"back"),forward:n(()=>{o=Math.min(o+1,e.length-1)},"forward"),go:n(d=>{o=Math.min(Math.max(o+d,0),e.length-1)},"go"),createHref:n(d=>d,"createHref"),getBlockers:n(()=>s,"_getBlockers"),setBlockers:n(d=>s=d,"_setBlockers")})}n(F$,"createMemoryHistory");function jBe(t){let e=t.replace(/[\x00-\x1f\x7f]/g,"");return e.startsWith("//")&&(e="/"+e.replace(/^\/+/,"")),e}n(jBe,"sanitizePath");function ab(t,e){let o=jBe(t),r=o.indexOf("#"),a=o.indexOf("?"),s=R$();return{href:o,pathname:o.substring(0,r>0?a>0?Math.min(r,a):r:a>0?a:o.length),hash:r>-1?o.substring(r):"",search:a>-1?o.slice(a,r===-1?void 0:r):"",state:e||{[Uh]:0,key:s,__TSR_key:s}}}n(ab,"parseHref");function R$(){return(Math.random()+1).toString(36).substring(7)}n(R$,"createRandomKey");function Ap(t,e){let o=e,r=t;return{fromLocation:o,toLocation:r,pathChanged:o?.pathname!==r.pathname,hrefChanged:o?.href!==r.href,hashChanged:o?.hash!==r.hash}}n(Ap,"getLocationChangeInfo");var VM=new WeakMap,E$=class{static{n(this,"RouterCore")}constructor(t,e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=o=>o(),this.update=o=>{o.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");let r=this.options,a=this.basepath??r?.basepath??"/",s=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...o},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Jse(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=EF()),this.origin=this.options.origin,this.origin||(!!1&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let p;!1,this.resolvePathCache=Dh(1e3),p=this.buildRouteTree(),!1,this.setRoutes(p)}if(!this.stores&&this.latestLocation){let p=this.getStoreConfig(this);this.batch=p.batch,this.stores=pie(Iie(this.latestLocation),p),Sie(this)}let c=!1,d=this.options.basepath??"/",f=this.options.rewrite;if(s||a!==d||i!==f){this.basepath=d;let p=[],m=FF(d);m&&m!=="/"&&p.push(fie({basepath:d})),f&&p.push(f),this.rewrite=p.length===0?void 0:p.length===1?p[0]:die(p),this.history&&this.updateLatestLocation(),c=!0}c&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let o=Xse(this.routeTree,this.options.caseSensitive,(r,a)=>{r.init({originalIndex:a})});return this.options.routeMasks&&Wse(this.options.routeMasks,o.processedTree),o},this.subscribe=(o,r)=>{let a={eventType:o,fn:r};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=o=>{this.subscribers.forEach(r=>{r.eventType===o.type&&r.fn(o)})},this.parseLocation=(o,r)=>{let a=n(({pathname:d,search:f,hash:p,href:m,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){let S=this.options.parseSearch(f),w=this.options.stringifySearch(S);return{href:d+w+p,publicHref:d+w+p,pathname:ob(d).path,external:!1,searchStr:w,search:Oh(r?.search,S),hash:ob(p.slice(1)).path,state:Yd(r?.state,h)}}let v=new URL(m,this.origin),x=LM(this.rewrite,v),y=this.options.parseSearch(x.search),b=this.options.stringifySearch(y);return x.search=b,{href:x.href.replace(x.origin,""),publicHref:m,pathname:ob(x.pathname).path,external:!!this.rewrite&&x.origin!==this.origin,searchStr:b,search:Oh(r?.search,y),hash:ob(x.hash.slice(1)).path,state:Yd(r?.state,h)}},"parse"),s=a(o),{__tempLocation:i,__tempKey:c}=s.state;if(i&&(!c||c===this.tempLocationKey)){let d=a(i);return d.state.key=s.state.key,d.state.__TSR_key=s.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:s}}return s},this.resolvePathWithBase=(o,r)=>p$({base:o,to:r.includes("//")?CF(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(o,r,a)=>typeof o=="string"?this.matchRoutesInternal({pathname:o,search:r},a):this.matchRoutesInternal(o,r),this.getMatchedRoutes=o=>bie({pathname:o,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=o=>{let r=this.getMatch(o);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(o=>{this.cancelMatch(o)}),this.stores.matchesId.get().forEach(o=>{if(this.stores.pendingMatchStores.has(o))return;let r=this.stores.matchStores.get(o)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(o)})},this.buildLocation=o=>{let r=n((s={})=>{let i=s._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(s.from&&s._isNavigate){let L=this.getMatchedRoutes(s.from).matchedRoutes,U=s$(c.matchedRoutes,V=>vie(V.fullPath,s.from)),W=s$(L,V=>vie(V.fullPath,c.fullPath));!U&&!W&&console.warn(`Could not find match for from: ${s.from}`)}let d=s.unsafeRelative==="path"?i.pathname:s.from??c.fullPath,f=s.to?`${s.to}`:void 0,p=c.search,m=Object.assign(Object.create(null),c.params),h=f?.charCodeAt(0)===47?"/":this.resolvePathWithBase(d,"."),v=f?this.resolvePathWithBase(h,f):h,x=s.params===!1||s.params===null?Object.create(null):(s.params??!0)===!0?m:Object.assign(m,pl(s.params,m)),y=this.routesByPath[Jl(v)],b;if(y)b=this.getRouteBranch(y);else if(v.includes("$"))b=[];else{let L=this.getMatchedRoutes(v);b=L.matchedRoutes,this.options.notFoundRoute&&(!L.foundRoute||L.foundRoute.path!=="/"&&L.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&Ph(x))for(let L of b){let U=L.options.params?.stringify??L.options.stringifyParams;if(U)try{Object.assign(x,U(x))}catch{}}let S=o.leaveParams?v:ob(OM({path:v,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(y&&!o.leaveParams)try{let L=this.getMatchedRoutes(S);L.foundRoute?.id!==y.id&&console.warn(`Generated path "${S}" for route "${y.id}" matched route "${L.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let w=p;if(o._includeValidateSearch&&this.options.search?.strict){let L={};b.forEach(U=>{if(U.options.validateSearch)try{Object.assign(L,BM(U.options.validateSearch,{...L,...w}))}catch{}}),w=L}w=qBe({search:w,dest:s,destRoutes:b,_includeValidateSearch:o._includeValidateSearch}),w=Oh(p,w);let C=this.options.stringifySearch(w),F=s.hash===!0?i.hash:s.hash?pl(s.hash,i.hash):void 0,T=F?`#${F}`:"",E=s.state===!0?i.state:s.state?pl(s.state,i.state):{};E=Yd(i.state,E);let k=`${S}${C}${T}`,O,D,M=!1;if(this.rewrite){let L=new URL(k,this.origin),U=x$(this.rewrite,L);O=L.href.replace(L.origin,""),U.origin!==this.origin?(D=U.href,M=!0):D=U.pathname+U.search+U.hash}else O=$se(k),D=O;return{publicHref:D,href:O,pathname:S,search:w,searchStr:C,state:E,hash:F??"",external:M,unmaskOnReload:s.unmaskOnReload}},"build"),a=n((s={},i)=>{let c=r(s),d=i?r(i):void 0;if(!d){let f=Object.create(null);if(this.options.routeMasks){let p=Gse(c.pathname,this.processedTree);if(p){Object.assign(f,p.rawParams);let{from:m,params:h,...v}=p.route,x=h===!1||h===null?Object.create(null):(h??!0)===!0?f:Object.assign(f,pl(h,f));i={from:o.from,...v,params:x},d=r(i)}}}return d&&(c.maskedLocation=d),c},"buildWithMatches");return o.mask?a(o,{from:o.from,...o.mask}):a(o)},this.commitLocation=async({viewTransition:o,ignoreBlocker:r,...a})=>{let s,i=n(()=>{let f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(m=>{a.state[m]=this.latestLocation.state[m]});let p=ju(a.state,this.latestLocation.state);return f.forEach(m=>{delete a.state[m]}),p},"isSameState"),c=Jl(this.latestLocation.href)===Jl(a.href),d=this.commitLocationPromise;if(this.commitLocationPromise=Xd(()=>{d?.resolve(),d=void 0}),c&&i())this.load();else{let{maskedLocation:f,hashScrollIntoView:p,...m}=a;f&&(m={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=p??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=o,s=a.replace?"REPLACE":"PUSH",this.history[s==="REPLACE"?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:r})}return this._scroll.next=a.resetScroll??!0,this.history.subscribers.size||this.load(s?{action:{type:s}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:o,resetScroll:r,hashScrollIntoView:a,viewTransition:s,ignoreBlocker:i,href:c,...d}={})=>{if(c){let m=this.history.location.state.__TSR_index,h=ab(c,{__TSR_index:o?m:m+1}),v=new URL(h.pathname,this.origin);d.to=LM(this.rewrite,v).pathname,d.search=this.options.parseSearch(h.search),d.hash=h.hash.slice(1)}let f=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=f;let p=this.commitLocation({...f,viewTransition:s,replace:o,resetScroll:r,hashScrollIntoView:a,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:o,reloadDocument:r,href:a,publicHref:s,...i})=>{let c=!1;if(a)try{new URL(`${a}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(o!==void 0||!a){let f=this.buildLocation({to:o,...i});a=a??f.publicHref,s=s??f.publicHref}let d=!c&&s?s:a;if(Qd(d,this.protocolAllowlist))return console.warn(`Blocked navigation to dangerous protocol: ${d}`),Promise.resolve();if(!i.ignoreBlocker){let f=this.history.getBlockers?.()??[];for(let p of f)if(p?.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return i.replace?window.location.replace(d):window.location.href=d,Promise.resolve()}return this.buildAndCommitLocation({...i,href:a,to:o,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),!1){let a=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(this.latestLocation.publicHref!==a.publicHref){let s=this.getParsedLocationHref(a);throw a.external?rb({href:s}):rb({href:s,_builtLocation:a})}}let o=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(a=>!o.some(s=>s.id===a.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(o),this.stores.setCached(r)})},this.load=async o=>{let r=o?.action?.type,a,s,i,c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad(),r?VM.set(this.latestLocation,r):VM.delete(this.latestLocation);let p=this.latestLocation,m=Ap(p,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...m}),this.emit({type:"onBeforeLoad",...m}),await g$({router:this,sync:o?.sync,forceStaleReload:c.href===p.href,matches:this.stores.pendingMatches.get(),location:p,updateMatch:this.updateMatch,onReady:n(async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,v=null,x=null,y=null;this.batch(()=>{let b=this.stores.pendingMatches.get(),S=b.length,w=this.stores.matches.get();h=S?w.filter(T=>!this.stores.pendingMatchStores.has(T.id)):null;let C=new Set;for(let T of this.stores.pendingMatchStores.values())T.routeId&&C.add(T.routeId);let F=new Set;for(let T of this.stores.matchStores.values())T.routeId&&F.add(T.routeId);v=S?w.filter(T=>!C.has(T.routeId)):null,x=S?b.filter(T=>!F.has(T.routeId)):null,y=S?b.filter(T=>F.has(T.routeId)):w,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),S&&(this.stores.setMatches(b),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...h.filter(T=>T.status!=="error"&&T.status!=="notFound"&&T.status!=="redirected")]),this.clearExpiredCache())});for(let[b,S]of[[v,"onLeave"],[x,"onEnter"],[y,"onStay"]])if(b)for(let w of b)this.looseRoutesById[w.routeId].options[S]?.(w)})})},"onReady")})}catch(p){ns(p)?(a=p,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):Hn(p)&&(s=p);let m=a?a.status:s?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(m),this.stores.redirect.set(a)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let d;this.hasNotFoundMatch()?d=404:this.stores.matches.get().some(f=>f.status==="error")&&(d=500),d!==void 0&&this.stores.statusCode.set(d)},this.startViewTransition=o=>{let r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof r=="object"&&this.isViewTransitionTypesSupported){let s=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(Ap(s,i)):r.types;if(c===!1){o();return}a={update:o,types:c}}else a=o;document.startViewTransition(a)}else o()},this.updateMatch=(o,r)=>{this.startTransition(()=>{let a=this.stores.pendingMatchStores.get(o);if(a){a.set(r);return}let s=this.stores.matchStores.get(o);if(s){s.set(r);return}let i=this.stores.cachedMatchStores.get(o);if(i){let c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(o)&&this.stores.cachedIds.set(d=>d.filter(f=>f!==o)):i.set(c)}})},this.getMatch=o=>this.stores.cachedMatchStores.get(o)?.get()??this.stores.pendingMatchStores.get(o)?.get()??this.stores.matchStores.get(o)?.get(),this.invalidate=o=>{let r=n(a=>o?.filter?.(a)??!0?{...a,invalid:!0,...o?.forcePending||a.status==="error"||a.status==="notFound"?{status:"pending",error:void 0}:void 0}:a,"invalidate");return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(r)),this.stores.setCached(this.stores.cachedMatches.get().map(r)),this.stores.setPending(this.stores.pendingMatches.get().map(r))}),this.shouldViewTransition=!1,this.load({sync:o?.sync})},this.getParsedLocationHref=o=>o.publicHref||"/",this.resolveRedirect=o=>{let r=o.headers.get("Location");if(!o.options.href||o.options._builtLocation){let a=o.options._builtLocation??this.buildLocation(o.options),s=this.getParsedLocationHref(a);o.options.href=s,o.headers.set("Location",s)}else if(r)try{let a=new URL(r);if(this.origin&&a.origin===this.origin){let s=a.pathname+a.search+a.hash;o.options.href=s,o.headers.set("Location",s)}}catch{}if(o.options.href&&!o.options._builtLocation&&Qd(o.options.href,this.protocolAllowlist))throw new Error(`Redirect blocked: unsafe protocol in href "${o.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`);return o.headers.get("Location")||o.headers.set("Location",o.options.href),o},this.clearCache=o=>{let r=o?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(a=>!r(a))):this.stores.setCached([])},this.clearExpiredCache=()=>{let o=Date.now(),r=n(a=>{let s=this.looseRoutesById[a.routeId];if(!s.options.loader)return!0;let i=(a.preload?s.options.preloadGcTime??this.options.defaultPreloadGcTime:s.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:o-a.updatedAt>=i},"filter");this.clearCache({filter:r})},this.loadRouteChunk=nb,this.preloadRoute=async o=>{let r=o._builtLocation??this.buildLocation(o),a=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:o}),s=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...s,...this.stores.cachedIds.get()]),c=a.filter(d=>!i.has(d.id));if(c.length){let d=this.stores.cachedMatches.get();this.stores.setCached([...d,...c])}try{return a=await g$({router:this,matches:a,location:r,preload:!0,updateMatch:n((d,f)=>{s.has(d)?a=a.map(p=>p.id===d?f(p):p):this.updateMatch(d,f)},"updateMatch")}),a}catch(d){if(ns(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:r});Hn(d)||console.error(d);return}},this.matchRoute=(o,r)=>{let a={...o,to:o.to?this.resolvePathWithBase(o.from||"",o.to):void 0,params:o.params||{},leaveParams:!0},s=this.buildLocation(a);if(r?.pending&&this.stores.status.get()!=="pending")return!1;let i=(r?.pending===void 0?!this.stores.isLoading.get():r.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=Kse(s.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||o.params&&!ju(c.rawParams,o.params,{partial:!0})?!1:r?.includeSearch??!0?ju(i.search,s.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(o=>o.status==="notFound"||o.globalNotFound),this.getStoreConfig=e,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??rie,parseSearch:t.parseSearch??oie,protocolAllowlist:t.protocolAllowlist??i$}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:t,routesByPath:e,processedTree:o}){this.routesById=t,this.routesByPath=e,this.processedTree=o;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(t){let e=this.routeBranchCache.get(t);return e||(e=f$(t),this.routeBranchCache.set(t,e)),e}get looseRoutesById(){return this.routesById}getParentContext(t){return t?.id?t.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(t,e){let o=this.getMatchedRoutes(t.pathname),{foundRoute:r,routeParams:a}=o,{matchedRoutes:s}=o,i=!1;(r?r.path!=="/"&&a["**"]:Jl(t.pathname))&&(this.options.notFoundRoute?s=[...s,this.options.notFoundRoute]:i=!0);let c=i?GBe(this.options.notFoundMode,s):void 0,d=new Array(s.length),f=new Map;for(let p of this.stores.matchStores.values())p.routeId&&f.set(p.routeId,p.get());for(let p=0;p<s.length;p++){let m=s[p],h=d[p-1],v,x,y;{let U=h?.search??t.search,W=h?._strictSearch??void 0;try{let V=BM(m.options.validateSearch,{...U})??void 0;v={...U,...V},x={...W,...V},y=void 0}catch(V){let j=V;if(V instanceof AF||(j=new AF(V.message,{cause:V})),e?.throwOnError)throw j;v=U,x={},y=j}}let b=m.options.loaderDeps?.({search:v})??"",S=b?JSON.stringify(b):"",{interpolatedPath:w,usedParams:C}=OM({path:m.fullPath,params:a,decoder:this.pathParamsDecoder,server:this.isServer}),F=m.id+w+S,T=this.getMatch(F),E=f.get(m.id),k=T?._strictParams??C,O;if(!T)try{xie(m,k)}catch(U){if(Hn(U)||ns(U)?O=U:O=new yie(U.message,{cause:U}),e?.throwOnError)throw O}Object.assign(a,k);let D=E?"stay":"enter",M;if(T)M={...T,cause:D,params:E?.params??a,_strictParams:k,search:E?Oh(E.search,v):Oh(T.search,v),_strictSearch:x};else{let U=m.options.loader||m.options.beforeLoad||m.lazyFn||v$(m)?"pending":"success";M={id:F,ssr:m.options.ssr,index:p,routeId:m.id,params:E?.params??a,_strictParams:k,pathname:w,updatedAt:Date.now(),search:E?Oh(E.search,v):v,_strictSearch:x,searchError:void 0,status:U,isFetching:!1,error:void 0,paramsError:O,__routeContext:void 0,_nonReactive:{loadPromise:Xd()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:D,loaderDeps:E?Yd(E.loaderDeps,b):b,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:m.options.staticData||{},fullPath:m.fullPath}}e?.preload||(M.globalNotFound=c===m.id),M.searchError=y;let L=this.getParentContext(h);M.context={...L,...M.__routeContext,...M.__beforeLoadContext},d[p]=M}for(let p=0;p<d.length;p++){let m=d[p],h=this.looseRoutesById[m.routeId],v=this.getMatch(m.id),x=f.get(m.routeId);if(m.params=x?Oh(x.params,a):a,!v){let y=d[p-1],b=this.getParentContext(y);if(h.options.context){let S={deps:m.loaderDeps,params:m.params,context:b??{},location:t,navigate:n(w=>this.navigate({...w,_fromLocation:t}),"navigate"),buildLocation:this.buildLocation,cause:m.cause,abortController:m.abortController,preload:!!m.preload,matches:d,routeId:h.id};m.__routeContext=h.options.context(S)??void 0}m.context={...b,...m.__routeContext,...m.__beforeLoadContext}}}return d}matchRoutesLightweight(t){let{matchedRoutes:e,routeParams:o}=this.getMatchedRoutes(t.pathname),r=Mh(e),a={...t.search};for(let f of e)try{Object.assign(a,BM(f.options.validateSearch,a))}catch{}let s=Mh(this.stores.matchesId.get()),i=s&&this.stores.matchStores.get(s)?.get(),c=i&&i.routeId===r.id&&i.pathname===t.pathname,d;if(c)d=i.params;else{let f=Object.assign(Object.create(null),o);for(let p of e)try{xie(p,f)}catch{}d=f}return{matchedRoutes:e,fullPath:r.fullPath,search:a,params:d}}},AF=class extends Error{static{n(this,"SearchParamError")}},yie=class extends Error{static{n(this,"PathParamError")}},gie=n(t=>t.endsWith("/")&&t.length>1?t.slice(0,-1):t,"normalize");function vie(t,e){return gie(t)===gie(e)}n(vie,"comparePaths");function Iie(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],statusCode:200}}n(Iie,"getInitialRouterState");function BM(t,e){if(t==null)return{};if("~standard"in t){let o=t["~standard"].validate(e);if(o instanceof Promise)throw new AF("Async validation not supported");if(o.issues)throw new AF(JSON.stringify(o.issues,void 0,2),{cause:o});return o.value}return"parse"in t?t.parse(e):typeof t=="function"?t(e):{}}n(BM,"validateSearch");function bie({pathname:t,routesById:e,processedTree:o}){let r=Object.create(null),a=Jl(t),s,i=Yse(a,o,!0);return i&&(s=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[e.__root__],routeParams:r,foundRoute:s}}n(bie,"getMatchedRoutes");function qBe({search:t,dest:e,destRoutes:o,_includeValidateSearch:r}){return WBe(o)(t,e,r??!1)}n(qBe,"applySearchMiddleware");function WBe(t){let e,o,r=[];for(let s of t){let i=s.options;if("search"in i)i.search?.middlewares&&r.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){let d=n(({search:f,next:p})=>{let m=p(i.preSearchFilters?i.preSearchFilters.reduce((h,v)=>v(h),f):f);return i.postSearchFilters?i.postSearchFilters.reduce((h,v)=>v(h),m):m},"legacyMiddleware");r.push(d)}let c=i.validateSearch;if(c){let d=n(({search:f,next:p,meta:m})=>{let h=p(f);if(o)try{let v=BM(c,h);if(m&&v)for(let x in v)x in h||(m.defaulted||=new Map).set(x,v[x]);return{...h,...v}}catch{}return h},"validate");r.push(d)}}let a=n((s,i,c)=>{if(s>=r.length){if(!e.search)return{};if(e.search===!0)return i;let f=pl(e.search,i);return c&&(c.explicit=f),f}let d=n((f,p)=>{if(p){let m=c||{};return{search:a(s+1,f,m),meta:m}}return a(s+1,f,c)},"next");return r[s]({search:i,next:d,meta:c})},"applyNext");return n(function(i,c,d){return e=c,o=d,a(0,i)},"middleware")}n(WBe,"buildMiddlewareChain");function GBe(t,e){if(t!=="root")for(let o=e.length-1;o>=0;o--){let r=e[o];if(r.children)return r.id}return ml}n(GBe,"findGlobalNotFoundRouteId");function xie(t,e){let o=t.options.params?.parse??t.options.parseParams;if(o){let r=o(e);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(e,r)}}n(xie,"extractStrictParams");function KBe(){try{return sessionStorage}catch{return}}n(KBe,"getSafeSessionStorage");var YBe="tsr-scroll-restoration-v1_3",Fie=KBe();function XBe(){try{return JSON.parse(Fie?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}n(XBe,"createScrollRestorationCache");function QBe(){try{Fie?.setItem(YBe,JSON.stringify(sb))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}n(QBe,"persistScrollRestorationCache");var sb=XBe(),wie="data-scroll-restoration-id",ZBe=n(t=>t.state.__TSR_key||t.href,"defaultGetScrollRestorationKey");function JBe(t){let e=t.getAttribute(wie);if(e)return`[${wie}="${e}"]`;let o="",r=t,a;for(;a=r.parentNode;){let s=1,i=r;for(;i=i.previousElementSibling;)s++;let c=`${r.localName}:nth-child(${s})`;o=o?`${c} > ${o}`:c,r=a}return o}n(JBe,"getScrollRestorationSelector");var UM=!1,ib="window";function A$(t){try{return typeof t=="function"?t():document.querySelector(t)}catch{}}n(A$,"getElement");function Cie(t){let e=[];for(let o of t){if(o===ib)continue;let r=A$(o);r&&e.push(r)}return e}n(Cie,"getScrollToTopElements");function Sie(t,e){let o=e??t.options.scrollRestoration,r=t._scroll;if(o&&(r.restoring=!0),!1)return;let a=t.options.getScrollRestorationKey||ZBe,s=new Map,i=n((f,p,m)=>{let h=s.get(f)||{};h.scrollX=p,h.scrollY=m,s.set(f,h)},"setTrackedScrollEntry"),c=n(f=>{if(!(UM||!r.restoring))if(f.target===document)i(ib,scrollX,scrollY);else{let p=f.target;i(p,p.scrollLeft,p.scrollTop)}},"onScroll"),d=n(f=>{if(!r.restoring)return;let p=sb[f]||={};for(let[m,h]of s)m===ib?p[ib]=h:m.isConnected&&(p[JBe(m)]=h)},"snapshotCurrentScrollTargets");o&&!r.restoration&&(r.restoration=!0,UM=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),t.subscribe("onBeforeLoad",f=>{f.fromLocation&&d(a(f.fromLocation)),s.clear()}),addEventListener("pagehide",()=>{d(a(t.stores.resolvedLocation.get()??t.stores.location.get())),QBe()})),!r.reset&&(r.reset=!0,t.subscribe("onRendered",f=>{let p=t.options.scrollRestorationBehavior,m=t.options.scrollToTopSelectors,h=r.next,v;if(s.clear(),h||(r.next=!0),typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return;let x=a(f.toLocation),y=f.fromLocation&&a(f.fromLocation);if(r.restoring&&y&&y!==x){let b=sb[y];if(b){let S=sb[x];for(let w in b){if(w===ib){if(h)continue}else{let C=A$(w);if(!C||h&&m&&(v??=Cie(m),v.includes(C)))continue}S||(S=sb[x]={}),S[w]??=b[w]}}}UM=!0;try{let b=f.toLocation.hash,S=f.toLocation.state.__hashScrollIntoViewOptions??!0,w=!1;if(h){let C=VM.get(f.toLocation),F=b&&S&&(C==="PUSH"||C==="REPLACE"),T=r.restoring?sb[x]:void 0;if(T)for(let E in T){let{scrollX:k,scrollY:O}=T[E];if(E===ib){if(F)continue;scrollTo({top:O,left:k,behavior:p}),w=!0}else{let D=A$(E);D&&(D.scrollLeft=k,D.scrollTop=O)}}if(!w&&!b){let E={top:0,left:0,behavior:p};if(scrollTo(E),m){v??=Cie(m);for(let k of v)k.scrollTo(E)}}}!w&&b&&S&&document.getElementById(b)?.scrollIntoView(S)}finally{UM=!1}}))}n(Sie,"setupScrollRestoration");var T$="Error preloading route! \u261D\uFE0F";var zM=class{static{n(this,"BaseRoute")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(t){if(this.init=e=>{this.originalIndex=e.originalIndex;let o=this.options,r=!o?.path&&!o?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=ml;else if(!this.parentRoute)throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");let a=r?ml:o?.path;a&&a!=="/"&&(a=MM(a));let s=o?.id||a,i=r?ml:kv([this.parentRoute.id==="__root__"?"":this.parentRoute.id,s]);a==="__root__"&&(a="/"),i!=="__root__"&&(i=kv(["/",i]));let c=i==="__root__"?"/":kv([this.parentRoute.fullPath,a]);this._path=a,this._id=i,this._fullPath=c,this._to=Jl(c)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>rb({from:this.fullPath,...e}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}};var k$=class extends zM{static{n(this,"BaseRootRoute")}constructor(t){super(t)}};var lb=K(oe(),1),qu=K($t(),1);function Pv(t){let e=t.errorComponent??Ov;return(0,qu.jsx)(o4e,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:n(({error:o,reset:r})=>o?lb.createElement(e,{error:o,reset:r}):t.children,"children")})}n(Pv,"CatchBoundary");var o4e=class extends lb.Component{static{n(this,"CatchBoundaryImpl")}constructor(...t){super(...t),this.state={error:null}}static getDerivedStateFromProps(t,e){let o=t.getResetKey();return e.error&&e.resetKey!==o?{resetKey:o,error:null}:{resetKey:o}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidCatch(t,e){this.props.onCatch&&this.props.onCatch(t,e)}render(){return this.props.children({error:this.state.error,reset:n(()=>{this.reset()},"reset")})}};function Ov({error:t}){let[e,o]=lb.useState(!0);return(0,qu.jsxs)("div",{style:{padding:".5rem",maxWidth:"100%"},children:[(0,qu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[(0,qu.jsx)("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),(0,qu.jsx)("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:n(()=>o(r=>!r),"onClick"),children:e?"Hide Error":"Show Error"})]}),(0,qu.jsx)("div",{style:{height:".25rem"}}),e?(0,qu.jsx)("div",{children:(0,qu.jsx)("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?(0,qu.jsx)("code",{children:t.message}):null})}):null]})}n(Ov,"ErrorComponent");var $M=K(oe(),1),M$=K($t(),1);function Rie({children:t,fallback:e=null}){return P$()?(0,M$.jsx)($M.default.Fragment,{children:t}):(0,M$.jsx)($M.default.Fragment,{children:e})}n(Rie,"ClientOnly");function P$(){return $M.default.useSyncExternalStore(r4e,()=>!0,()=>!1)}n(P$,"useHydrated");function r4e(){return()=>{}}n(r4e,"subscribe");var Eie=K(oe(),1),HM=Eie.createContext(null);var Aie=K(oe(),1);function vn(t){let e=Aie.useContext(HM);return(t?.warn??!0)&&!e&&console.warn("Warning: useRouter must be used inside a <RouterProvider> component!"),e}n(vn,"useRouter");var O$=K(oe(),1),Nv=O$.createContext(void 0),Tie=O$.createContext(void 0);var KM=K(oe(),1);var Ln=(t=>(t[t.None=0]="None",t[t.Mutable=1]="Mutable",t[t.Watching=2]="Watching",t[t.RecursedCheck=4]="RecursedCheck",t[t.Recursed=8]="Recursed",t[t.Dirty=16]="Dirty",t[t.Pending=32]="Pending",t))(Ln||{});function kie({update:t,notify:e,unwatched:o}){return{link:r,unlink:a,propagate:s,checkDirty:i,shallowPropagate:c};function r(f,p,m){let h=p.depsTail;if(h!==void 0&&h.dep===f)return;let v=h!==void 0?h.nextDep:p.deps;if(v!==void 0&&v.dep===f){v.version=m,p.depsTail=v;return}let x=f.subsTail;if(x!==void 0&&x.version===m&&x.sub===p)return;let y=p.depsTail=f.subsTail={version:m,dep:f,sub:p,prevDep:h,nextDep:v,prevSub:x,nextSub:void 0};v!==void 0&&(v.prevDep=y),h!==void 0?h.nextDep=y:p.deps=y,x!==void 0?x.nextSub=y:f.subs=y}function a(f,p=f.sub){let m=f.dep,h=f.prevDep,v=f.nextDep,x=f.nextSub,y=f.prevSub;return v!==void 0?v.prevDep=h:p.depsTail=h,h!==void 0?h.nextDep=v:p.deps=v,x!==void 0?x.prevSub=y:m.subsTail=y,y!==void 0?y.nextSub=x:(m.subs=x)===void 0&&o(m),v}function s(f){let p=f.nextSub,m;e:do{let h=f.sub,v=h.flags;if(v&60?v&12?v&4?!(v&48)&&d(f,h)?(h.flags=v|40,v&=1):v=0:h.flags=v&-9|32:v=0:h.flags=v|32,v&2&&e(h),v&1){let x=h.subs;if(x!==void 0){let y=(f=x).nextSub;y!==void 0&&(m={value:p,prev:m},p=y);continue}}if((f=p)!==void 0){p=f.nextSub;continue}for(;m!==void 0;)if(f=m.value,m=m.prev,f!==void 0){p=f.nextSub;continue e}break}while(!0)}function i(f,p){let m,h=0,v=!1;e:do{let x=f.dep,y=x.flags;if(p.flags&16)v=!0;else if((y&17)===17){if(t(x)){let b=x.subs;b.nextSub!==void 0&&c(b),v=!0}}else if((y&33)===33){(f.nextSub!==void 0||f.prevSub!==void 0)&&(m={value:f,prev:m}),f=x.deps,p=x,++h;continue}if(!v){let b=f.nextDep;if(b!==void 0){f=b;continue}}for(;h--;){let b=p.subs,S=b.nextSub!==void 0;if(S?(f=m.value,m=m.prev):f=b,v){if(t(p)){S&&c(b),p=f.sub;continue}v=!1}else p.flags&=-33;p=f.sub;let w=f.nextDep;if(w!==void 0){f=w;continue e}}return v}while(!0)}function c(f){do{let p=f.sub,m=p.flags;(m&48)===32&&(p.flags=m|16,(m&6)===2&&e(p))}while((f=f.nextSub)!==void 0)}function d(f,p){let m=p.depsTail;for(;m!==void 0;){if(m===f)return!0;m=m.prevDep}return!1}}n(kie,"createReactiveSystem");function Oie(t,e,o){let r=typeof t=="object",a=r?t:void 0;return{next:(r?t.next:t)?.bind(a),error:(r?t.error:e)?.bind(a),complete:(r?t.complete:o)?.bind(a)}}n(Oie,"toObserver");var N$=[],qM=0,{link:Mie,unlink:n4e,propagate:a4e,checkDirty:Nie,shallowPropagate:Pie}=kie({update(t){return t._update()},notify(t){N$[D$++]=t,t.flags&=~Ln.Watching},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=Ln.Mutable|Ln.Dirty,WM(t))}}),jM=0,D$=0,Zd,_$=0;function TF(t){try{++_$,t()}finally{--_$||L$()}}n(TF,"batch");function WM(t){let e=t.depsTail,o=e!==void 0?e.nextDep:t.deps;for(;o!==void 0;)o=n4e(o,t)}n(WM,"purgeDeps");function L$(){if(!(_$>0)){for(;jM<D$;){let t=N$[jM];N$[jM++]=void 0,t.notify()}jM=0,D$=0}}n(L$,"flush");function GM(t,e){let o=typeof t=="function",r=t,a={_snapshot:o?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:o?Ln.None:Ln.Mutable,get(){return Zd!==void 0&&Mie(a,Zd,qM),a._snapshot},subscribe(s){let i=Oie(s),c={current:!1},d=s4e(()=>{a.get(),c.current?i.next?.(a._snapshot):c.current=!0});return{unsubscribe:n(()=>{d.stop()},"unsubscribe")}},_update(s){let i=Zd,c=e?.compare??Object.is;if(o)Zd=a,++qM,a.depsTail=void 0;else if(s===void 0)return!1;o&&(a.flags=Ln.Mutable|Ln.RecursedCheck);try{let d=a._snapshot,f=typeof s=="function"?s(d):s===void 0&&o?r(d):s;return d===void 0||!c(d,f)?(a._snapshot=f,!0):!1}finally{Zd=i,o&&(a.flags&=~Ln.RecursedCheck),WM(a)}}};return o?(a.flags=Ln.Mutable|Ln.Dirty,a.get=function(){let s=a.flags;if(s&Ln.Dirty||s&Ln.Pending&&Nie(a.deps,a)){if(a._update()){let i=a.subs;i!==void 0&&Pie(i)}}else s&Ln.Pending&&(a.flags=s&~Ln.Pending);return Zd!==void 0&&Mie(a,Zd,qM),a._snapshot}):a.set=function(s){if(a._update(s)){let i=a.subs;i!==void 0&&(a4e(i),Pie(i),L$())}},a}n(GM,"createAtom");function s4e(t){let e=n(()=>{let r=Zd;Zd=o,++qM,o.depsTail=void 0,o.flags=Ln.Watching|Ln.RecursedCheck;try{return t()}finally{Zd=r,o.flags&=~Ln.RecursedCheck,WM(o)}},"run"),o={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Ln.Watching|Ln.RecursedCheck,notify(){let r=this.flags;r&Ln.Dirty||r&Ln.Pending&&Nie(this.deps,this)?e():this.flags=Ln.Watching},stop(){this.flags=Ln.None,this.depsTail=void 0,WM(this)}};return e(),o}n(s4e,"effect");var V$=K(oe(),1),zie=K(kF(),1);function i4e(t,e){return t===e}n(i4e,"defaultCompare");function Zn(t,e,o=i4e){let r=(0,V$.useCallback)(i=>{if(!t)return()=>{};let{unsubscribe:c}=t.subscribe(i);return c},[t]),a=(0,V$.useCallback)(()=>t?.get(),[t]);return(0,zie.useSyncExternalStoreWithSelector)(r,a,a,e,o)}n(Zn,"useStore");var U$={get(){},subscribe(){return{unsubscribe(){}}}};function z$(t,e){let o=KM.useRef();return r=>{let a=t?.select?t.select(r):r;return t?.structuralSharing??e.options.defaultStructuralSharing?o.current=Yd(o.current,a):a}}n(z$,"useStructuralSharing");function ec(t){let e=vn(),o=KM.useContext(t.from?Tie:Nv),r=t.from?e.stores.getRouteMatchStore(t.from):e.stores.matchStores.get(o);if(!1){let i=r?.get();if(!i){if(t.shouldThrow??!0)throw new Error(`Invariant failed: Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`);return}return t.select?t.select(i):i}let a=z$(t,e),s=Zn(r??U$,i=>i?a(i):U$);if(s!==U$)return s;if(t.shouldThrow??!0)throw new Error(`Invariant failed: Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`)}n(ec,"useMatch");function $$(t){return ec({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:n(e=>t.select?t.select(e.loaderData):e.loaderData,"select")})}n($$,"useLoaderData");function H$(t){let{select:e,...o}=t;return ec({...o,select:n(r=>e?e(r.loaderDeps):r.loaderDeps,"select")})}n(H$,"useLoaderDeps");function j$(t){return ec({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:n(e=>{let o=t.strict===!1?e.params:e._strictParams;return t.select?t.select(o):o},"select")})}n(j$,"useParams");function zh(t){return ec({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:n(e=>t.select?t.select(e.search):e.search,"select")})}n(zh,"useSearch");var q$=K(oe(),1);function zs(t){let e=vn();return q$.useCallback(o=>e.navigate({...o,from:o.from??t?.from}),[t?.from,e])}n(zs,"useNavigate");function W$(t){return ec({...t,select:n(e=>t.select?t.select(e.context):e.context,"select")})}n(W$,"useRouteContext");var $a=K(oe(),1),l4e=K($t(),1);var Gie=K(oi(),1);function c4e(t,e){let o=vn(),r=_se(e),a=!1,{activeProps:s,inactiveProps:i,activeOptions:c,to:d,preload:f,preloadDelay:p,preloadIntentProximity:m,hashScrollIntoView:h,replace:v,startTransition:x,resetScroll:y,viewTransition:b,children:S,target:w,disabled:C,style:F,className:T,onClick:E,onBlur:k,onFocus:O,onMouseEnter:D,onMouseLeave:M,onTouchStart:L,ignoreBlocker:U,params:W,search:V,hash:j,state:N,mask:_,reloadDocument:B,unsafeRelative:z,from:q,_fromLocation:$,...Y}=t;if(a){let Be=Wie(d);if(typeof d=="string"&&!Be&&d.indexOf(":")>-1)try{return new URL(d),Qd(d,o.protocolAllowlist)?(console.warn(`Blocked Link with dangerous protocol: ${d}`),{...Y,ref:r,href:void 0,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T}}):{...Y,ref:r,href:d,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T}}}catch{}let Me=o.buildLocation({...t,from:t.from}),je=qie(Me.maskedLocation?Me.maskedLocation.publicHref:Me.publicHref,Me.maskedLocation?Me.maskedLocation.external:Me.external,o.history,C),mt=(()=>{if(je?.external){if(Qd(je.href,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${je.href}`);return}return je.href}if(!Be&&typeof d=="string"&&d.indexOf(":")>-1)try{if(new URL(d),Qd(d,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${d}`);return}return d}catch{}})(),ht=(()=>{if(mt)return!1;let At=o.stores.location.get(),ee=c?.exact??!1;if(ee){if(!PM(At.pathname,Me.pathname,o.basepath))return!1}else{let ce=Bh(At.pathname,o.basepath),Ee=Bh(Me.pathname,o.basepath);if(!(ce.startsWith(Ee)&&(ce.length===Ee.length||ce[Ee.length]==="/")))return!1}if((c?.includeSearch??!0)&&At.search!==Me.search){let ce=!At.search||typeof At.search=="object"&&!Ph(At.search),Ee=!Me.search||typeof Me.search=="object"&&!Ph(Me.search);if(!(ce&&Ee)&&!ju(At.search,Me.search,{partial:!ee,ignoreUndefined:!c?.explicitUndefined}))return!1}return!c?.includeHash})();if(mt)return{...Y,ref:r,href:mt,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T}};let yt=ht?pl(s,{})??$ie:cb,Et=ht?cb:pl(i,{})??cb,St=(()=>{let At=F,ee=yt.style,ce=Et.style;if(!(!At&&!ee&&!ce))return At&&!ee&&!ce?At:!At&&ee&&!ce?ee:!At&&!ee&&ce?ce:{...At,...ee,...ce}})(),jt=(()=>{let At=T,ee=yt.className,ce=Et.className;if(!At&&!ee&&!ce)return"";let Ee="";return At&&(Ee=At),ee&&(Ee=Ee?`${Ee} ${ee}`:ee),ce&&(Ee=Ee?`${Ee} ${ce}`:ce),Ee})();return{...Y,...yt,...Et,href:je?.href,ref:r,disabled:!!C,target:w,...St&&{style:St},...jt&&{className:jt},...C&&Hie,...ht&&jie}}let Q=P$(),X=$a.useMemo(()=>t,[o,t.from,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),te=Zn(o.stores.location,Be=>Be,(Be,Me)=>Be.href===Me.href),ae=$a.useMemo(()=>{let Be={_fromLocation:te,...X};return o.buildLocation(Be)},[o,te,X]),se=ae.maskedLocation?ae.maskedLocation.publicHref:ae.publicHref,J=ae.maskedLocation?ae.maskedLocation.external:ae.external,ne=$a.useMemo(()=>qie(se,J,o.history,C),[C,J,se,o.history]),pe=$a.useMemo(()=>{if(ne?.external){if(Qd(ne.href,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${ne.href}`);return}return ne.href}if(!Wie(d)&&!(typeof d!="string"||d.indexOf(":")===-1))try{if(new URL(d),Qd(d,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${d}`);return}return d}catch{}},[d,ne,o.protocolAllowlist]),le=$a.useMemo(()=>{if(pe)return!1;if(c?.exact){if(!PM(te.pathname,ae.pathname,o.basepath))return!1}else{let Be=Bh(te.pathname,o.basepath),Me=Bh(ae.pathname,o.basepath);if(!(Be.startsWith(Me)&&(Be.length===Me.length||Be[Me.length]==="/")))return!1}return(c?.includeSearch??!0)&&!ju(te.search,ae.search,{partial:!c?.exact,ignoreUndefined:!c?.explicitUndefined})?!1:c?.includeHash?Q&&te.hash===ae.hash:!0},[c?.exact,c?.explicitUndefined,c?.includeHash,c?.includeSearch,te,pe,Q,ae.hash,ae.pathname,ae.search,o.basepath]),ie=le?pl(s,{})??$ie:cb,de=le?cb:pl(i,{})??cb,ue=[T,ie.className,de.className].filter(Boolean).join(" "),he=(F||ie.style||de.style)&&{...F,...ie.style,...de.style},[Re,Ae]=$a.useState(!1),ye=$a.useRef(!1),ge=t.reloadDocument||pe?!1:f??o.options.defaultPreload,Te=p??o.options.defaultPreloadDelay??0,ze=$a.useCallback(()=>{o.preloadRoute({...X,_builtLocation:ae}).catch(Be=>{console.warn(Be),console.warn(T$)})},[o,X,ae]);Dse(r,$a.useCallback(Be=>{Be?.isIntersecting&&ze()},[ze]),d4e,{disabled:!!C||ge!=="viewport"}),$a.useEffect(()=>{ye.current||!C&&ge==="render"&&(ze(),ye.current=!0)},[C,ze,ge]);let Ze=n(Be=>{let Me=Be.currentTarget.getAttribute("target"),je=w!==void 0?w:Me;if(!C&&!f4e(Be)&&!Be.defaultPrevented&&(!je||je==="_self")&&Be.button===0){Be.preventDefault(),(0,Gie.flushSync)(()=>{Ae(!0)});let mt=o.subscribe("onResolved",()=>{mt(),Ae(!1)});o.navigate({...X,replace:v,resetScroll:y,hashScrollIntoView:h,startTransition:x,viewTransition:b,ignoreBlocker:U})}},"handleClick");if(pe)return{...Y,ref:r,href:pe,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T},...E&&{onClick:E},...k&&{onBlur:k},...O&&{onFocus:O},...D&&{onMouseEnter:D},...M&&{onMouseLeave:M},...L&&{onTouchStart:L}};let _e=n(Be=>{if(C||ge!=="intent")return;if(!Te){ze();return}let Me=Be.currentTarget;if(MF.has(Me))return;let je=setTimeout(()=>{MF.delete(Me),ze()},Te);MF.set(Me,je)},"enqueueIntentPreload"),Ie=n(Be=>{C||ge!=="intent"||ze()},"handleTouchStart"),ke=n(Be=>{if(C||!ge||!Te)return;let Me=Be.currentTarget,je=MF.get(Me);je&&(clearTimeout(je),MF.delete(Me))},"handleLeave");return{...Y,...ie,...de,href:ne?.href,ref:r,onClick:ub([E,Ze]),onBlur:ub([k,ke]),onFocus:ub([O,_e]),onMouseEnter:ub([D,_e]),onMouseLeave:ub([M,ke]),onTouchStart:ub([L,Ie]),disabled:!!C,target:w,...he&&{style:he},...ue&&{className:ue},...C&&Hie,...le&&jie,...Q&&Re&&u4e}}n(c4e,"useLinkProps");var cb={},$ie={className:"active"},Hie={role:"link","aria-disabled":!0},jie={"data-status":"active","aria-current":"page"},u4e={"data-transitioning":"transitioning"},MF=new WeakMap,d4e={rootMargin:"100px"},ub=n(t=>e=>{for(let o of t)if(o){if(e.defaultPrevented)return;o(e)}},"composeHandlers");function qie(t,e,o,r){if(!r)return e?{href:t,external:!0}:{href:o.createHref(t)||"/",external:!1}}n(qie,"getHrefOption");function Wie(t){if(typeof t!="string")return!1;let e=t.charCodeAt(0);return e===47?t.charCodeAt(1)!==47:e===46}n(Wie,"isSafeInternal");var G$=$a.forwardRef((t,e)=>{let{_asChild:o,...r}=t,{type:a,...s}=c4e(r,e),i=typeof r.children=="function"?r.children({isActive:s["data-status"]==="active"}):r.children;if(!o){let{disabled:c,...d}=s;return $a.createElement("a",d,i)}return $a.createElement(o,s,i)});function f4e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}n(f4e,"isCtrlEvent");var K$=K(oe(),1),Y$=K($t(),1);var Kie=class extends zM{static{n(this,"Route")}constructor(t){super(t),this.useMatch=e=>ec({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W$({...e,from:this.id}),this.useSearch=e=>zh({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>j$({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>H$({...e,from:this.id}),this.useLoaderData=e=>$$({...e,from:this.id}),this.useNavigate=()=>zs({from:this.fullPath}),this.Link=K$.default.forwardRef((e,o)=>(0,Y$.jsx)(G$,{ref:o,from:this.fullPath,...e}))}};function PF(t){return new Kie(t)}n(PF,"createRoute");var Yie=class extends k${static{n(this,"RootRoute")}constructor(t){super(t),this.useMatch=e=>ec({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W$({...e,from:this.id}),this.useSearch=e=>zh({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>j$({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>H$({...e,from:this.id}),this.useLoaderData=e=>$$({...e,from:this.id}),this.useNavigate=()=>zs({from:this.fullPath}),this.Link=K$.default.forwardRef((e,o)=>(0,Y$.jsx)(G$,{ref:o,from:this.fullPath,...e}))}};function X$(t){return new Yie(t)}n(X$,"createRootRoute");var pAt=K(oe(),1),YM=K($t(),1);function Xie(t){let e=vn();if(!1){let r=`not-found-${e.stores.location.get().pathname}-${e.stores.status.get()}`;return(0,YM.jsx)(Pv,{getResetKey:n(()=>r,"getResetKey"),onCatch:n((a,s)=>{if(Hn(a))t.onCatch?.(a,s);else throw a},"onCatch"),errorComponent:n(({error:a})=>{if(Hn(a))return t.fallback?.(a);throw a},"errorComponent"),children:t.children})}let o=`not-found-${Zn(e.stores.location,r=>r.pathname)}-${Zn(e.stores.status,r=>r)}`;return(0,YM.jsx)(Pv,{getResetKey:n(()=>o,"getResetKey"),onCatch:n((r,a)=>{if(Hn(r))t.onCatch?.(r,a);else throw r},"onCatch"),errorComponent:n(({error:r})=>{if(Hn(r))return t.fallback?.(r);throw r},"errorComponent"),children:t.children})}n(Xie,"CatchNotFound");function Qie(){return(0,YM.jsx)("p",{children:"Not Found"})}n(Qie,"DefaultGlobalNotFound");var Zie=K($t(),1);function Jie({children:t}){let e=vn();return null}n(Jie,"ScriptOnce");var IAt=K(oe(),1),XM=K($t(),1);function $h(t){return(0,XM.jsx)(XM.Fragment,{children:t.children})}n($h,"SafeFragment");var CAt=K(oe(),1),QM=K($t(),1);function ZM(t,e,o){return e.options.notFoundComponent?(0,QM.jsx)(e.options.notFoundComponent,{...o}):t.options.defaultNotFoundComponent?(0,QM.jsx)(t.options.defaultNotFoundComponent,{...o}):(e.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${e.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`),(0,QM.jsx)(Qie,{}))}n(ZM,"renderRouteNotFound");var tle=K($t(),1);function ele(t){return null}n(ele,"getScrollRestorationScriptForRouter");function ole(){let t=ele(vn());return t?(0,tle.jsx)(Jie,{children:t}):null}n(ole,"ScrollRestoration");var $s=K(oe(),1),xn=K($t(),1);var p4e=n((t,e)=>t.routeId===e.routeId&&t._displayPending===e._displayPending,"matchViewFieldsEqual"),m4e=n((t,e)=>t[0]===e[0]&&t[1]===e[1],"outletMatchSelectionEqual"),JM=$s.memo(n(function({matchId:e}){let o=vn();if(!1){let i=o.stores.matchStores.get(e)?.get();if(!i)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let c=i.routeId,d=o.routesById[c].parentRoute?.id;return(0,xn.jsx)(rle,{router:o,matchId:e,resetKey:o.stores.loadedAt.get(),matchState:{routeId:c,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:d}})}let r=o.stores.matchStores.get(e);if(!r)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let a=Zn(o.stores.loadedAt,i=>i),s=Zn(r,i=>i,p4e);return(0,xn.jsx)(rle,{router:o,matchId:e,resetKey:a,matchState:$s.useMemo(()=>{let i=s.routeId,c=o.routesById[i].parentRoute?.id;return{routeId:i,ssr:s.ssr,_displayPending:s._displayPending,parentRouteId:c}},[s._displayPending,s.routeId,s.ssr,o.routesById])})},"MatchImpl"));function rle({router:t,matchId:e,resetKey:o,matchState:r}){let a=t.routesById[r.routeId],s=a.options.pendingComponent??t.options.defaultPendingComponent,i=s?(0,xn.jsx)(s,{}):null,c=a.options.errorComponent??t.options.defaultErrorComponent,d=a.options.onCatch??t.options.defaultOnCatch,f=a.isRoot?a.options.notFoundComponent??t.options.notFoundRoute?.options.component:a.options.notFoundComponent,p=r.ssr===!1||r.ssr==="data-only",m=(!a.isRoot||a.options.wrapInSuspense||p)&&(a.options.wrapInSuspense??s??(a.options.errorComponent?.preload||p))?$s.Suspense:$h,h=c?Pv:$h,v=f?Xie:$h;return(0,xn.jsxs)(a.isRoot?a.options.shellComponent??$h:$h,{children:[(0,xn.jsx)(Nv.Provider,{value:e,children:(0,xn.jsx)(m,{fallback:i,children:(0,xn.jsx)(h,{getResetKey:n(()=>o,"getResetKey"),errorComponent:c||Ov,onCatch:n((x,y)=>{if(Hn(x))throw x.routeId??=r.routeId,x;console.warn(`Warning: Error in route match: ${e}`),d?.(x,y)},"onCatch"),children:(0,xn.jsx)(v,{fallback:n(x=>{if(x.routeId??=r.routeId,!f||x.routeId&&x.routeId!==r.routeId||!x.routeId&&!a.isRoot)throw x;return $s.createElement(f,x)},"fallback"),children:p||r._displayPending?(0,xn.jsx)(Rie,{fallback:i,children:(0,xn.jsx)(nle,{matchId:e})}):(0,xn.jsx)(nle,{matchId:e})})})})}),r.parentRouteId===ml?(0,xn.jsxs)(xn.Fragment,{children:[(0,xn.jsx)(h4e,{}),t.options.scrollRestoration&&!1?(0,xn.jsx)(ole,{}):null]}):null]})}n(rle,"MatchView");function h4e(){let t=vn();if(!1)return null;let e=$s.useRef();return Av(()=>{let o=t.stores.resolvedLocation.get(),r=e.current;o&&(!r||r.href!==o.href)&&t.emit({type:"onRendered",...Ap(t.stores.location.get(),r??o)}),e.current=o},[Zn(t.stores.resolvedLocation,o=>o?.state.__TSR_key),t]),null}n(h4e,"OnRendered");var nle=$s.memo(n(function({matchId:e}){let o=vn(),r=n((p,m)=>o.getMatch(p.id)?._nonReactive[m]??p._nonReactive[m],"getMatchPromise");if(!1){let p=o.stores.matchStores.get(e)?.get();if(!p)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let m=p.routeId,h=o.routesById[m],v=(o.routesById[m].options.remountDeps??o.options.defaultRemountDeps)?.({routeId:m,loaderDeps:p.loaderDeps,params:p._strictParams,search:p._strictSearch}),x=v?JSON.stringify(v):void 0,y=h.options.component??o.options.defaultComponent,b=y?(0,xn.jsx)(y,{},x):(0,xn.jsx)(OF,{});if(p._displayPending)throw r(p,"displayPendingPromise");if(p._forcePending)throw r(p,"minPendingPromise");if(p.status==="pending")throw r(p,"loadPromise");if(p.status==="notFound"){if(!Hn(p.error))throw new Error("Invariant failed: Expected a notFound error");return ZM(o,h,p.error)}if(p.status==="redirected")throw ns(p.error)?r(p,"loadPromise"):new Error("Invariant failed: Expected a redirect error");return p.status==="error"?(0,xn.jsx)((h.options.errorComponent??o.options.defaultErrorComponent)||Ov,{error:p.error,reset:void 0,info:{componentStack:""}}):b}let a=o.stores.matchStores.get(e);if(!a)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let s=Zn(a,p=>p),i=s.routeId,c=o.routesById[i],d=$s.useMemo(()=>{let p=(o.routesById[i].options.remountDeps??o.options.defaultRemountDeps)?.({routeId:i,loaderDeps:s.loaderDeps,params:s._strictParams,search:s._strictSearch});return p?JSON.stringify(p):void 0},[i,s.loaderDeps,s._strictParams,s._strictSearch,o.options.defaultRemountDeps,o.routesById]),f=$s.useMemo(()=>{let p=c.options.component??o.options.defaultComponent;return p?(0,xn.jsx)(p,{},d):(0,xn.jsx)(OF,{})},[d,c.options.component,o.options.defaultComponent]);if(s._displayPending)throw r(s,"displayPendingPromise");if(s._forcePending)throw r(s,"minPendingPromise");if(s.status==="pending"){let p=c.options.pendingMinMs??o.options.defaultPendingMinMs;if(p){let m=o.getMatch(s.id);if(m&&!m._nonReactive.minPendingPromise&&!!1){let h=Xd();m._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),m._nonReactive.minPendingPromise=void 0},p)}}throw r(s,"loadPromise")}if(s.status==="notFound"){if(!Hn(s.error))throw new Error("Invariant failed: Expected a notFound error");return ZM(o,c,s.error)}if(s.status==="redirected")throw ns(s.error)?r(s,"loadPromise"):new Error("Invariant failed: Expected a redirect error");if(s.status==="error"){if(!1)return(0,xn.jsx)((c.options.errorComponent??o.options.defaultErrorComponent)||Ov,{error:s.error,reset:void 0,info:{componentStack:""}});throw s.error}return f},"MatchInnerImpl")),OF=$s.memo(n(function(){let e=vn(),o=$s.useContext(Nv),r,a=!1,s;if(!1){let f=e.stores.matches.get(),p=o?f.findIndex(h=>h.id===o):-1,m=p>=0?f[p]:void 0;r=m?.routeId,a=m?.globalNotFound??!1,s=p>=0?f[p+1]?.id:void 0}else{let f=o?e.stores.matchStores.get(o):void 0;[r,a]=Zn(f,p=>[p?.routeId,p?.globalNotFound??!1],m4e),s=Zn(e.stores.matchesId,p=>p[p.findIndex(m=>m===o)+1])}let i=r?e.routesById[r]:void 0,c=e.options.defaultPendingComponent?(0,xn.jsx)(e.options.defaultPendingComponent,{}):null;if(a){if(!i)throw new Error("Invariant failed: Could not resolve route for Outlet render");return ZM(e,i,void 0)}if(!s)return null;let d=(0,xn.jsx)(JM,{matchId:s});return r===ml?(0,xn.jsx)($s.Suspense,{fallback:c,children:d}):d},"OutletImpl"));var Hh=K(oe(),1);function ale(){let t=vn(),e=Hh.useRef({router:t,mounted:!1}),[o,r]=Hh.useState(!1),a=Zn(t.stores.isLoading,m=>m),s=Zn(t.stores.hasPending,m=>m),i=EM(a),c=a||o||s,d=EM(c),f=a||s,p=EM(f);return t.startTransition=m=>{r(!0),Hh.startTransition(()=>{m(),r(!1)})},Hh.useEffect(()=>{let m=t.history.subscribe(t.load),h=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Jl(t.latestLocation.publicHref)!==Jl(h.publicHref)&&t.commitLocation({...h,replace:!0}),()=>{m()}},[t,t.history]),Av(()=>{if(typeof window<"u"&&t.ssr||e.current.router===t&&e.current.mounted)return;e.current={router:t,mounted:!0},n(async()=>{try{await t.load()}catch(h){console.error(h)}},"tryLoad")()},[t]),Av(()=>{i&&!a&&t.emit({type:"onLoad",...Ap(t.stores.location.get(),t.stores.resolvedLocation.get())})},[i,t,a]),Av(()=>{p&&!f&&t.emit({type:"onBeforeRouteMount",...Ap(t.stores.location.get(),t.stores.resolvedLocation.get())})},[f,p,t]),Av(()=>{if(d&&!c){let m=Ap(t.stores.location.get(),t.stores.resolvedLocation.get());t.emit({type:"onResolved",...m}),TF(()=>{t.stores.status.set("idle"),t.stores.resolvedLocation.set(t.stores.location.get())})}},[c,d,t]),null}n(ale,"Transitioner");var eP=K(oe(),1),Jd=K($t(),1);function sle(){let t=vn(),e=t.routesById[ml].options.pendingComponent??t.options.defaultPendingComponent,o=e?(0,Jd.jsx)(e,{}):null,r=(0,Jd.jsxs)(typeof document<"u"&&t.ssr?$h:eP.Suspense,{fallback:o,children:[!!1&&(0,Jd.jsx)(ale,{}),(0,Jd.jsx)(g4e,{})]});return t.options.InnerWrap?(0,Jd.jsx)(t.options.InnerWrap,{children:r}):r}n(sle,"Matches");function g4e(){let t=vn(),e=!1,o=e?t.stores.firstId.get():Zn(t.stores.firstId,s=>s),r=e?t.stores.loadedAt.get():Zn(t.stores.loadedAt,s=>s),a=o?(0,Jd.jsx)(JM,{matchId:o}):null;return(0,Jd.jsx)(Nv.Provider,{value:o,children:t.options.disableGlobalCatchBoundary?a:(0,Jd.jsx)(Pv,{getResetKey:n(()=>r,"getResetKey"),errorComponent:Ov,onCatch:s=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${s.message||s.toString()}`)},children:a})})}n(g4e,"MatchesInner");var ile=n(t=>({createMutableStore:GM,createReadonlyStore:GM,batch:TF}),"getStoreFactory");var Q$=n(t=>new lle(t),"createRouter"),lle=class extends E${static{n(this,"Router")}constructor(t){super(t,ile)}};var bTt=K(oe(),1),NF=K($t(),1);function cle({router:t,children:e,...o}){Ph(o)&&t.update({...t.options,...o,context:{...t.options.context,...o.context}});let r=(0,NF.jsx)(HM.Provider,{value:t,children:e});return t.options.Wrap?(0,NF.jsx)(t.options.Wrap,{children:r}):r}n(cle,"RouterContextProvider");function Z$({router:t,...e}){return(0,NF.jsx)(cle,{router:t,...e,children:(0,NF.jsx)(sle,{})})}n(Z$,"RouterProvider");function J$(t){let e=vn({warn:t?.router===void 0}),o=t?.router||e;if(!1){let r=o.stores.__store.get();return t?.select?t.select(r):r}return Zn(o.stores.__store,z$(t,o))}n(J$,"useRouterState");var Um=K(oe(),1),st=K(oe(),1);function ule(t){var e,o,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(o=ule(t[e]))&&(r&&(r+=" "),r+=o)}else for(o in t)t[o]&&(r&&(r+=" "),r+=o);return r}n(ule,"r");function xo(){for(var t,e,o=0,r="",a=arguments.length;o<a;o++)(t=arguments[o])&&(e=ule(t))&&(r&&(r+=" "),r+=e);return r}n(xo,"clsx");var v4e=n((t,e)=>{let o=new Array(t.length+e.length);for(let r=0;r<t.length;r++)o[r]=t[r];for(let r=0;r<e.length;r++)o[t.length+r]=e[r];return o},"concatArrays"),x4e=n((t,e)=>({classGroupId:t,validator:e}),"createClassValidatorObject"),vle=n((t=new Map,e=null,o)=>({nextPart:t,validators:e,classGroupId:o}),"createClassPartObject"),rP="-",dle=[],y4e="arbitrary..",I4e=n(t=>{let e=S4e(t),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:n(i=>{if(i.startsWith("[")&&i.endsWith("]"))return b4e(i);let c=i.split(rP),d=c[0]===""&&c.length>1?1:0;return xle(c,d,e)},"getClassGroupId"),getConflictingClassGroupIds:n((i,c)=>{if(c){let d=r[i],f=o[i];return d?f?v4e(f,d):d:f||dle}return o[i]||dle},"getConflictingClassGroupIds")}},"createClassGroupUtils"),xle=n((t,e,o)=>{if(t.length-e===0)return o.classGroupId;let a=t[e],s=o.nextPart.get(a);if(s){let f=xle(t,e+1,s);if(f)return f}let i=o.validators;if(i===null)return;let c=e===0?t.join(rP):t.slice(e).join(rP),d=i.length;for(let f=0;f<d;f++){let p=i[f];if(p.validator(c))return p.classGroupId}},"getGroupRecursive"),b4e=n(t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let e=t.slice(1,-1),o=e.indexOf(":"),r=e.slice(0,o);return r?y4e+r:void 0})(),"getGroupIdForArbitraryProperty"),S4e=n(t=>{let{theme:e,classGroups:o}=t;return w4e(o,e)},"createClassMap"),w4e=n((t,e)=>{let o=vle();for(let r in t){let a=t[r];oH(a,o,r,e)}return o},"processClassGroups"),oH=n((t,e,o,r)=>{let a=t.length;for(let s=0;s<a;s++){let i=t[s];C4e(i,e,o,r)}},"processClassesRecursively"),C4e=n((t,e,o,r)=>{if(typeof t=="string"){F4e(t,e,o);return}if(typeof t=="function"){R4e(t,e,o,r);return}E4e(t,e,o,r)},"processClassDefinition"),F4e=n((t,e,o)=>{let r=t===""?e:yle(e,t);r.classGroupId=o},"processStringDefinition"),R4e=n((t,e,o,r)=>{if(A4e(t)){oH(t(r),e,o,r);return}e.validators===null&&(e.validators=[]),e.validators.push(x4e(o,t))},"processFunctionDefinition"),E4e=n((t,e,o,r)=>{let a=Object.entries(t),s=a.length;for(let i=0;i<s;i++){let[c,d]=a[i];oH(d,yle(e,c),o,r)}},"processObjectDefinition"),yle=n((t,e)=>{let o=t,r=e.split(rP),a=r.length;for(let s=0;s<a;s++){let i=r[s],c=o.nextPart.get(i);c||(c=vle(),o.nextPart.set(i,c)),o=c}return o},"getPart"),A4e=n(t=>"isThemeGetter"in t&&t.isThemeGetter===!0,"isThemeGetter"),T4e=n(t=>{if(t<1)return{get:n(()=>{},"get"),set:n(()=>{},"set")};let e=0,o=Object.create(null),r=Object.create(null),a=n((s,i)=>{o[s]=i,e++,e>t&&(e=0,r=o,o=Object.create(null))},"update");return{get(s){let i=o[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return a(s,i),i},set(s,i){s in o?o[s]=i:a(s,i)}}},"createLruCache"),tH="!",fle=":",k4e=[],ple=n((t,e,o,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:o,maybePostfixModifierPosition:r,isExternal:a}),"createResultObject"),M4e=n(t=>{let{prefix:e,experimentalParseClassName:o}=t,r=n(a=>{let s=[],i=0,c=0,d=0,f,p=a.length;for(let y=0;y<p;y++){let b=a[y];if(i===0&&c===0){if(b===fle){s.push(a.slice(d,y)),d=y+1;continue}if(b==="/"){f=y;continue}}b==="["?i++:b==="]"?i--:b==="("?c++:b===")"&&c--}let m=s.length===0?a:a.slice(d),h=m,v=!1;m.endsWith(tH)?(h=m.slice(0,-1),v=!0):m.startsWith(tH)&&(h=m.slice(1),v=!0);let x=f&&f>d?f-d:void 0;return ple(s,v,h,x)},"parseClassName");if(e){let a=e+fle,s=r;r=n(i=>i.startsWith(a)?s(i.slice(a.length)):ple(k4e,!1,i,void 0,!0),"parseClassName")}if(o){let a=r;r=n(s=>o({className:s,parseClassName:a}),"parseClassName")}return r},"createParseClassName"),P4e=n(t=>{let e=new Map;return t.orderSensitiveModifiers.forEach((o,r)=>{e.set(o,1e6+r)}),o=>{let r=[],a=[];for(let s=0;s<o.length;s++){let i=o[s],c=i[0]==="[",d=e.has(i);c||d?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},"createSortModifiers"),O4e=n(t=>({cache:T4e(t.cacheSize),parseClassName:M4e(t),sortModifiers:P4e(t),postfixLookupClassGroupIds:N4e(t),...I4e(t)}),"createConfigUtils"),N4e=n(t=>{let e=Object.create(null),o=t.postfixLookupClassGroups;if(o)for(let r=0;r<o.length;r++)e[o[r]]=!0;return e},"createPostfixLookupClassGroupIds"),D4e=/\s+/,_4e=n((t,e)=>{let{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s,postfixLookupClassGroupIds:i}=e,c=[],d=t.trim().split(D4e),f="";for(let p=d.length-1;p>=0;p-=1){let m=d[p],{isExternal:h,modifiers:v,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:b}=o(m);if(h){f=m+(f.length>0?" "+f:f);continue}let S=!!b,w;if(S){let k=y.substring(0,b);w=r(k);let O=w&&i[w]?r(y):void 0;O&&O!==w&&(w=O,S=!1)}else w=r(y);if(!w){if(!S){f=m+(f.length>0?" "+f:f);continue}if(w=r(y),!w){f=m+(f.length>0?" "+f:f);continue}S=!1}let C=v.length===0?"":v.length===1?v[0]:s(v).join(":"),F=x?C+tH:C,T=F+w;if(c.indexOf(T)>-1)continue;c.push(T);let E=a(w,S);for(let k=0;k<E.length;++k){let O=E[k];c.push(F+O)}f=m+(f.length>0?" "+f:f)}return f},"mergeClassList"),L4e=n((...t)=>{let e=0,o,r,a="";for(;e<t.length;)(o=t[e++])&&(r=Ile(o))&&(a&&(a+=" "),a+=r);return a},"twJoin"),Ile=n(t=>{if(typeof t=="string")return t;let e,o="";for(let r=0;r<t.length;r++)t[r]&&(e=Ile(t[r]))&&(o&&(o+=" "),o+=e);return o},"toValue"),B4e=n((t,...e)=>{let o,r,a,s,i=n(d=>{let f=e.reduce((p,m)=>m(p),t());return o=O4e(f),r=o.cache.get,a=o.cache.set,s=c,c(d)},"initTailwindMerge"),c=n(d=>{let f=r(d);if(f)return f;let p=_4e(d,o);return a(d,p),p},"tailwindMerge");return s=i,(...d)=>s(L4e(...d))},"createTailwindMerge"),V4e=[],as=n(t=>{let e=n(o=>o[t]||V4e,"themeGetter");return e.isThemeGetter=!0,e},"fromTheme"),ble=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Sle=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U4e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,z4e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$4e=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H4e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,j4e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q4e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jh=n(t=>U4e.test(t),"isFraction"),ir=n(t=>!!t&&!Number.isNaN(Number(t)),"isNumber"),ef=n(t=>!!t&&Number.isInteger(Number(t)),"isInteger"),eH=n(t=>t.endsWith("%")&&ir(t.slice(0,-1)),"isPercent"),Tp=n(t=>z4e.test(t),"isTshirtSize"),wle=n(()=>!0,"isAny"),W4e=n(t=>$4e.test(t)&&!H4e.test(t),"isLengthOnly"),rH=n(()=>!1,"isNever"),G4e=n(t=>j4e.test(t),"isShadow"),K4e=n(t=>q4e.test(t),"isImage"),Y4e=n(t=>!Gt(t)&&!Kt(t),"isAnyNonArbitrary"),X4e=n(t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),"isNamedContainerQuery"),Q4e=n(t=>qh(t,Rle,rH),"isArbitrarySize"),Gt=n(t=>ble.test(t),"isArbitraryValue"),Dv=n(t=>qh(t,Ele,W4e),"isArbitraryLength"),mle=n(t=>qh(t,a5e,ir),"isArbitraryNumber"),Z4e=n(t=>qh(t,Tle,wle),"isArbitraryWeight"),J4e=n(t=>qh(t,Ale,rH),"isArbitraryFamilyName"),hle=n(t=>qh(t,Cle,rH),"isArbitraryPosition"),e5e=n(t=>qh(t,Fle,K4e),"isArbitraryImage"),tP=n(t=>qh(t,kle,G4e),"isArbitraryShadow"),Kt=n(t=>Sle.test(t),"isArbitraryVariable"),DF=n(t=>_v(t,Ele),"isArbitraryVariableLength"),t5e=n(t=>_v(t,Ale),"isArbitraryVariableFamilyName"),gle=n(t=>_v(t,Cle),"isArbitraryVariablePosition"),o5e=n(t=>_v(t,Rle),"isArbitraryVariableSize"),r5e=n(t=>_v(t,Fle),"isArbitraryVariableImage"),oP=n(t=>_v(t,kle,!0),"isArbitraryVariableShadow"),n5e=n(t=>_v(t,Tle,!0),"isArbitraryVariableWeight"),qh=n((t,e,o)=>{let r=ble.exec(t);return r?r[1]?e(r[1]):o(r[2]):!1},"getIsArbitraryValue"),_v=n((t,e,o=!1)=>{let r=Sle.exec(t);return r?r[1]?e(r[1]):o:!1},"getIsArbitraryVariable"),Cle=n(t=>t==="position"||t==="percentage","isLabelPosition"),Fle=n(t=>t==="image"||t==="url","isLabelImage"),Rle=n(t=>t==="length"||t==="size"||t==="bg-size","isLabelSize"),Ele=n(t=>t==="length","isLabelLength"),a5e=n(t=>t==="number","isLabelNumber"),Ale=n(t=>t==="family-name","isLabelFamilyName"),Tle=n(t=>t==="number"||t==="weight","isLabelWeight"),kle=n(t=>t==="shadow","isLabelShadow");var s5e=n(()=>{let t=as("color"),e=as("font"),o=as("text"),r=as("font-weight"),a=as("tracking"),s=as("leading"),i=as("breakpoint"),c=as("container"),d=as("spacing"),f=as("radius"),p=as("shadow"),m=as("inset-shadow"),h=as("text-shadow"),v=as("drop-shadow"),x=as("blur"),y=as("perspective"),b=as("aspect"),S=as("ease"),w=as("animate"),C=n(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"scaleBreak"),F=n(()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],"scalePosition"),T=n(()=>[...F(),Kt,Gt],"scalePositionWithArbitrary"),E=n(()=>["auto","hidden","clip","visible","scroll"],"scaleOverflow"),k=n(()=>["auto","contain","none"],"scaleOverscroll"),O=n(()=>[Kt,Gt,d],"scaleUnambiguousSpacing"),D=n(()=>[jh,"full","auto",...O()],"scaleInset"),M=n(()=>[ef,"none","subgrid",Kt,Gt],"scaleGridTemplateColsRows"),L=n(()=>["auto",{span:["full",ef,Kt,Gt]},ef,Kt,Gt],"scaleGridColRowStartAndEnd"),U=n(()=>[ef,"auto",Kt,Gt],"scaleGridColRowStartOrEnd"),W=n(()=>["auto","min","max","fr",Kt,Gt],"scaleGridAutoColsRows"),V=n(()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],"scaleAlignPrimaryAxis"),j=n(()=>["start","end","center","stretch","center-safe","end-safe"],"scaleAlignSecondaryAxis"),N=n(()=>["auto",...O()],"scaleMargin"),_=n(()=>[jh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],"scaleSizing"),B=n(()=>[jh,"screen","full","dvw","lvw","svw","min","max","fit",...O()],"scaleSizingInline"),z=n(()=>[jh,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],"scaleSizingBlock"),q=n(()=>[t,Kt,Gt],"scaleColor"),$=n(()=>[...F(),gle,hle,{position:[Kt,Gt]}],"scaleBgPosition"),Y=n(()=>["no-repeat",{repeat:["","x","y","space","round"]}],"scaleBgRepeat"),Q=n(()=>["auto","cover","contain",o5e,Q4e,{size:[Kt,Gt]}],"scaleBgSize"),X=n(()=>[eH,DF,Dv],"scaleGradientStopPosition"),te=n(()=>["","none","full",f,Kt,Gt],"scaleRadius"),ae=n(()=>["",ir,DF,Dv],"scaleBorderWidth"),se=n(()=>["solid","dashed","dotted","double"],"scaleLineStyle"),J=n(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"scaleBlendMode"),ne=n(()=>[ir,eH,gle,hle],"scaleMaskImagePosition"),pe=n(()=>["","none",x,Kt,Gt],"scaleBlur"),le=n(()=>["none",ir,Kt,Gt],"scaleRotate"),ie=n(()=>["none",ir,Kt,Gt],"scaleScale"),de=n(()=>[ir,Kt,Gt],"scaleSkew"),ue=n(()=>[jh,"full",...O()],"scaleTranslate");return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tp],breakpoint:[Tp],color:[wle],container:[Tp],"drop-shadow":[Tp],ease:["in","out","in-out"],font:[Y4e],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tp],shadow:[Tp],spacing:["px",ir],text:[Tp],"text-shadow":[Tp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",jh,Gt,Kt,b]}],container:["container"],"container-type":[{"@container":["","normal","size",Kt,Gt]}],"container-named":[X4e],columns:[{columns:[ir,Gt,Kt,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ef,"auto",Kt,Gt]}],basis:[{basis:[jh,"full","auto",c,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ir,jh,"auto","initial","none",Gt]}],grow:[{grow:["",ir,Kt,Gt]}],shrink:[{shrink:["",ir,Kt,Gt]}],order:[{order:[ef,"first","last","none",Kt,Gt]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mbs:[{mbs:N()}],mbe:[{mbe:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[c,"screen",..._()]}],"min-w":[{"min-w":[c,"screen","none",..._()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",o,DF,Dv]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,n5e,Z4e]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",eH,Gt]}],"font-family":[{font:[t5e,J4e,e]}],"font-features":[{"font-features":[Gt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Kt,Gt]}],"line-clamp":[{"line-clamp":[ir,"none",Kt,mle]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",Kt,Gt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Kt,Gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[ir,"from-font","auto",Kt,Dv]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[ir,"auto",Kt,Gt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[ef,Kt,Gt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Kt,Gt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Kt,Gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ef,Kt,Gt],radial:["",Kt,Gt],conic:[ef,Kt,Gt]},r5e,e5e]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ir,Kt,Gt]}],"outline-w":[{outline:["",ir,DF,Dv]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",p,oP,tP]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",m,oP,tP]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[ir,Dv]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",h,oP,tP]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[ir,Kt,Gt]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ir]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[Kt,Gt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":F()}],"mask-image-conic-pos":[{"mask-conic":[ir]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Kt,Gt]}],filter:[{filter:["","none",Kt,Gt]}],blur:[{blur:pe()}],brightness:[{brightness:[ir,Kt,Gt]}],contrast:[{contrast:[ir,Kt,Gt]}],"drop-shadow":[{"drop-shadow":["","none",v,oP,tP]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",ir,Kt,Gt]}],"hue-rotate":[{"hue-rotate":[ir,Kt,Gt]}],invert:[{invert:["",ir,Kt,Gt]}],saturate:[{saturate:[ir,Kt,Gt]}],sepia:[{sepia:["",ir,Kt,Gt]}],"backdrop-filter":[{"backdrop-filter":["","none",Kt,Gt]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[ir,Kt,Gt]}],"backdrop-contrast":[{"backdrop-contrast":[ir,Kt,Gt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ir,Kt,Gt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ir,Kt,Gt]}],"backdrop-invert":[{"backdrop-invert":["",ir,Kt,Gt]}],"backdrop-opacity":[{"backdrop-opacity":[ir,Kt,Gt]}],"backdrop-saturate":[{"backdrop-saturate":[ir,Kt,Gt]}],"backdrop-sepia":[{"backdrop-sepia":["",ir,Kt,Gt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Kt,Gt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ir,"initial",Kt,Gt]}],ease:[{ease:["linear","initial",S,Kt,Gt]}],delay:[{delay:[ir,Kt,Gt]}],animate:[{animate:["none",w,Kt,Gt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Kt,Gt]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[Kt,Gt,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],zoom:[{zoom:[ef,Kt,Gt]}],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Kt,Gt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":q()}],"scrollbar-track-color":[{"scrollbar-track":q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Kt,Gt]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[ir,DF,Dv,mle]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},"getDefaultConfig");var Mle=B4e(s5e);function tt(...t){return Mle(xo(t))}n(tt,"cn");var P=K(po(),1);var Ule=K(Lle(),1);var tf=class extends Error{static{n(this,"DateFormatError")}constructor(e,o,r){super(e),this.token=o,this.type=r||"error"}},Ble=n(t=>t<4?"short":t===4?"long":"narrow","alpha"),LF=n(t=>t%2===0?"2-digit":"numeric","numeric");function f5e(t,e){switch(t.char){case"y":return{year:LF(t.width)};case"r":return{calendar:"gregory",year:"numeric"};default:return e(`${t.desc} is not supported; falling back to year:numeric`,tf.WARNING),{year:"numeric"}}}n(f5e,"yearOptions");function p5e(t,e){switch(t.width){case 1:return"numeric";case 2:return"2-digit";case 3:return"short";case 4:return"long";case 5:return"narrow";default:e(`${t.desc} is not supported with width ${t.width}`);return}}n(p5e,"monthStyle");function m5e(t,e){let{char:o,desc:r,width:a}=t;if(o==="d")return LF(a);e(`${r} is not supported`)}n(m5e,"dayStyle");function h5e(t,e){let{char:o,desc:r,width:a}=t;if((o==="c"||o==="e")&&a<3){let s=`Numeric value is not supported for ${r}; falling back to weekday:short`;e(s,tf.WARNING)}return Ble(a)}n(h5e,"weekdayStyle");function g5e(t){let e=LF(t.width),o;switch(t.char){case"h":o="h12";break;case"H":o="h23";break;case"k":o="h24";break;case"K":o="h11";break}return o?{hour:e,hourCycle:o}:{hour:e}}n(g5e,"hourOptions");function v5e(t,e){let{char:o,desc:r,width:a}=t;switch(o){case"v":case"z":return a===4?"long":"short";case"V":if(a===4)return"long";e(`${r} is not supported with width ${a}`);return;case"X":e(`${r} is not supported`);return}return"short"}n(v5e,"timeZoneNameStyle");function x5e(t,e){switch(t.field){case"era":return{era:Ble(t.width)};case"year":return f5e(t,e);case"month":return{month:p5e(t,e)};case"day":return{day:m5e(t,e)};case"weekday":return{weekday:h5e(t,e)};case"period":return;case"hour":return g5e(t);case"min":return{minute:LF(t.width)};case"sec":return{second:LF(t.width)};case"tz":return{timeZoneName:v5e(t,e)};case"quarter":case"week":case"sec-frac":case"ms":e(`${t.desc} is not supported`)}}n(x5e,"compileOptions");function sH(t,e,o=r=>{throw r}){let r={timeZone:e},a=[];for(let s of t){let{error:i,field:c,str:d}=s;if(i){let p=new tf(i.message,s);p.stack=i.stack,o(p)}if(d){let p=`Ignoring string part: ${d}`;o(new tf(p,s,tf.WARNING))}c&&(a.indexOf(c)===-1?a.push(c):o(new tf(`Duplicate ${c} token`,s)));let f=x5e(s,(p,m)=>o(new tf(p,s,m)));f&&Object.assign(r,f)}return r}n(sH,"getDateFormatOptions");var y5e={G:{field:"era",desc:"Era"},y:{field:"year",desc:"Year"},Y:{field:"year",desc:'Year of "Week of Year"'},u:{field:"year",desc:"Extended year"},U:{field:"year",desc:"Cyclic year name"},r:{field:"year",desc:"Related Gregorian year"},Q:{field:"quarter",desc:"Quarter"},q:{field:"quarter",desc:"Stand-alone quarter"},M:{field:"month",desc:"Month in year"},L:{field:"month",desc:"Stand-alone month in year"},w:{field:"week",desc:"Week of year"},W:{field:"week",desc:"Week of month"},d:{field:"day",desc:"Day in month"},D:{field:"day",desc:"Day of year"},F:{field:"day",desc:"Day of week in month"},g:{field:"day",desc:"Modified julian day"},E:{field:"weekday",desc:"Day of week"},e:{field:"weekday",desc:"Local day of week"},c:{field:"weekday",desc:"Stand-alone local day of week"},a:{field:"period",desc:"AM/PM marker"},b:{field:"period",desc:"AM/PM/noon/midnight marker"},B:{field:"period",desc:"Flexible day period"},h:{field:"hour",desc:"Hour in AM/PM (1~12)"},H:{field:"hour",desc:"Hour in day (0~23)"},k:{field:"hour",desc:"Hour in day (1~24)"},K:{field:"hour",desc:"Hour in AM/PM (0~11)"},j:{field:"hour",desc:"Hour in preferred cycle"},J:{field:"hour",desc:"Hour in preferred cycle without marker"},C:{field:"hour",desc:"Hour in preferred cycle with flexible marker"},m:{field:"min",desc:"Minute in hour"},s:{field:"sec",desc:"Second in minute"},S:{field:"sec-frac",desc:"Fractional second"},A:{field:"ms",desc:"Milliseconds in day"},z:{field:"tz",desc:"Time Zone: specific non-location"},Z:{field:"tz",desc:"Time Zone"},O:{field:"tz",desc:"Time Zone: localized"},v:{field:"tz",desc:"Time Zone: generic non-location"},V:{field:"tz",desc:"Time Zone: ID"},X:{field:"tz",desc:"Time Zone: ISO8601 with Z"},x:{field:"tz",desc:"Time Zone: ISO8601"}},Vle=n(t=>t>="A"&&t<="Z"||t>="a"&&t<="z","isLetter");function I5e(t,e){let o=t[e],r=1;for(;t[++e]===o;)++r;let a=y5e[o];if(!a){let s=`The letter ${o} is not a valid field identifier`;return{char:o,error:new Error(s),width:r}}return{char:o,field:a.field,desc:a.desc,width:r}}n(I5e,"readFieldToken");function b5e(t,e){let o=t[++e],r=2;if(o==="'")return{char:"'",str:o,width:r};for(;;){let a=t[++e];if(++r,a===void 0){let s=`Unterminated quoted literal in pattern: ${o||t}`;return{char:"'",error:new Error(s),str:o,width:r}}else if(a==="'"){if(t[++e]!=="'")return{char:"'",str:o,width:r};++r}o+=a}}n(b5e,"readQuotedToken");function S5e(t,e){let o=t[e];if(!o)return null;if(Vle(o))return I5e(t,e);if(o==="'")return b5e(t,e);let r=o,a=1;for(;;){let s=t[++e];if(!s||Vle(s)||s==="'")return{char:o,str:r,width:a};r+=s,a+=1}}n(S5e,"readToken");function sP(t){let e=[],o=0;for(;;){let r=S5e(t,o);if(!r)return e;e.push(r),o+=r.width}}n(sP,"parseDateTokens");function zle(t,e){return t.filter(o=>o.type!=="content").length?t.map(o=>{if(o.type==="content")return e(o.value);if(o.type==="octothorpe")return"#";if(o.type==="argument")return[o.arg];if(o.type==="function"){let s=o?.param?.[0];if(o.key==="date"&&s){let i=w5e(s.value.trim(),c=>{throw new Error(`Unable to compile date expression: ${c.message}`)});return[o.arg,o.key,i]}return s?[o.arg,o.key,s.value.trim()]:[o.arg,o.key]}let r=o.pluralOffset,a={};return o.cases.forEach(({key:s,tokens:i})=>{let c=s[0]==="="?s.slice(1):s;a[c]=zle(i,e)}),[o.arg,o.type,{offset:r,...a}]}):t.map(o=>e(o.value))}n(zle,"processTokens");function w5e(t,e){if(/^::/.test(t)){let o=sP(t.substring(2));return sH(o,void 0,e)}return t}n(w5e,"compileDateExpression");function C5e(t,e=o=>o){return zle((0,Ule.parse)(t),e)}n(C5e,"compileMessageOrThrow");function iP(t,e=o=>o){try{return C5e(t,e)}catch(o){return console.error(`${o.message}
251
+ `)},E.prototype.clone=function(){return new E(this.states,this.state)},E.prototype.has=function(M){return!0},{compile:w,states:F,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:T}})});var Nle=Ft(kp=>{"use strict";var i5e=kp&&kp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kp,"__esModule",{value:!0});kp.lexer=kp.states=void 0;var l5e=i5e(Ole());kp.states={body:{doubleapos:{match:"''",value:n(()=>"'","value")},quoted:{lineBreaks:!0,match:/'[{}#](?:[^']|'')*'(?!')/u,value:n(t=>t.slice(1,-1).replace(/''/g,"'"),"value")},argument:{lineBreaks:!0,match:/\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,push:"arg",value:n(t=>t.substring(1).trim(),"value")},octothorpe:"#",end:{match:"}",pop:1},content:{lineBreaks:!0,match:/[^][^{}#']*/u}},arg:{select:{lineBreaks:!0,match:/,\s*(?:plural|select|selectordinal)\s*,\s*/u,next:"select",value:n(t=>t.split(",")[1].trim(),"value")},"func-args":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,next:"body",value:n(t=>t.split(",")[1].trim(),"value")},"func-simple":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,value:n(t=>t.substring(1).trim(),"value")},end:{match:"}",pop:1}},select:{offset:{lineBreaks:!0,match:/\s*offset\s*:\s*\d+\s*/u,value:n(t=>t.split(":")[1].trim(),"value")},case:{lineBreaks:!0,match:/\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,push:"body",value:n(t=>t.substring(0,t.indexOf("{")).trim(),"value")},end:{match:/\s*\}/u,pop:1}}};kp.lexer=l5e.default.states(kp.states)});var Lle=Ft(_F=>{"use strict";Object.defineProperty(_F,"__esModule",{value:!0});_F.ParseError=void 0;_F.parse=d5e;var _le=Nle(),aP=n(t=>({offset:t.offset,line:t.line,col:t.col,text:t.text,lineBreaks:t.lineBreaks}),"getContext"),nH=n(t=>t==="plural"||t==="select"||t==="selectordinal","isSelectType");function c5e(t,e){let o="",r="";for(let s of e){let i=s.ctx.text;switch(r+=i,s.type){case"content":o+=s.value;break;case"argument":case"function":case"octothorpe":o+=i;break;default:throw new Ha(t,`Unsupported part in strict mode function arg style: ${i}`)}}return[{type:"content",value:o.trim(),ctx:Object.assign({},e[0].ctx,{text:r})}]}n(c5e,"strictArgStyleParam");var u5e=["number","date","time","spellout","ordinal","duration"],Dle=["zero","one","two","few","many","other"],Ha=class extends Error{static{n(this,"ParseError")}constructor(e,o){super(_le.lexer.formatError(e,o))}};_F.ParseError=Ha;var aH=class{static{n(this,"Parser")}constructor(e,o){var r,a,s,i;this.lexer=_le.lexer.reset(e),this.cardinalKeys=(r=o?.cardinal)!==null&&r!==void 0?r:Dle,this.ordinalKeys=(a=o?.ordinal)!==null&&a!==void 0?a:Dle,this.strict=(s=o?.strict)!==null&&s!==void 0?s:!1,this.strictPluralKeys=(i=o?.strictPluralKeys)!==null&&i!==void 0?i:!0}parse(){return this.parseBody(!1,!0)}checkSelectKey(e,o,r){if(r[0]==="="){if(o==="select")throw new Ha(e,`The case ${r} is not valid with select`)}else if(o!=="select"){let a=o==="plural"?this.cardinalKeys:this.ordinalKeys;if(this.strictPluralKeys&&a.length>0&&!a.includes(r)){let s=`The ${o} case ${r} is not valid in this locale`;throw new Ha(e,s)}}}parseSelect({value:e},o,r,a){let s={type:a,arg:e,cases:[],ctx:r};a==="plural"||a==="selectordinal"?o=!0:this.strict&&(o=!1);for(let i of this.lexer)switch(i.type){case"offset":if(a==="select")throw new Ha(i,"Unexpected plural offset for select");if(s.cases.length>0)throw new Ha(i,"Plural offset must be set before cases");s.pluralOffset=Number(i.value),r.text+=i.text,r.lineBreaks+=i.lineBreaks;break;case"case":{this.checkSelectKey(i,a,i.value),s.cases.push({key:i.value,tokens:this.parseBody(o),ctx:aP(i)});break}case"end":return s;default:throw new Ha(i,`Unexpected lexer token: ${i.type}`)}throw new Ha(null,"Unexpected message end")}parseArgToken(e,o){let r=aP(e),a=this.lexer.next();if(!a)throw new Ha(null,"Unexpected message end");if(r.text+=a.text,r.lineBreaks+=a.lineBreaks,this.strict&&(a.type==="func-simple"||a.type==="func-args")&&!u5e.includes(a.value)){let s=`Invalid strict mode function arg type: ${a.value}`;throw new Ha(e,s)}switch(a.type){case"end":return{type:"argument",arg:e.value,ctx:r};case"func-simple":{let s=this.lexer.next();if(!s)throw new Ha(null,"Unexpected message end");if(s.type!=="end")throw new Ha(s,`Unexpected lexer token: ${s.type}`);if(r.text+=s.text,nH(a.value.toLowerCase()))throw new Ha(a,`Invalid type identifier: ${a.value}`);return{type:"function",arg:e.value,key:a.value,ctx:r}}case"func-args":{if(nH(a.value.toLowerCase())){let i=`Invalid type identifier: ${a.value}`;throw new Ha(a,i)}let s=this.parseBody(this.strict?!1:o);return this.strict&&s.length>0&&(s=c5e(e,s)),{type:"function",arg:e.value,key:a.value,param:s,ctx:r}}case"select":if(nH(a.value))return this.parseSelect(e,o,r,a.value);throw new Ha(a,`Unexpected select type ${a.value}`);default:throw new Ha(a,`Unexpected lexer token: ${a.type}`)}}parseBody(e,o){let r=[],a=null;for(let s of this.lexer)if(s.type==="argument")a&&(a=null),r.push(this.parseArgToken(s,e));else if(s.type==="octothorpe"&&e)a&&(a=null),r.push({type:"octothorpe",ctx:aP(s)});else{if(s.type==="end"&&!o)return r;{let i=s.value;if(!e&&s.type==="quoted"&&i[0]==="#"){if(i.includes("{")){let c=`Unsupported escape pattern: ${i}`;throw new Ha(s,c)}i=s.text}a?(a.value+=i,a.ctx.text+=s.text,a.ctx.lineBreaks+=s.lineBreaks):(a={type:"content",value:i,ctx:aP(s)},r.push(a))}}if(o)return r;throw new Ha(null,"Unexpected message end")}};function d5e(t,e={}){return new aH(t,e).parse()}n(d5e,"parse")});var vxe=Ft(gxe=>{function DWe(t){return t==="__proto__"}n(DWe,"isUnsafeProperty");gxe.isUnsafeProperty=DWe});var Yq=Ft(xxe=>{function _We(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return t.includes(".")||t.includes("[")||t.includes("]")}}n(_We,"isDeepKey");xxe.isDeepKey=_We});var lL=Ft(yxe=>{function LWe(t){return typeof t=="string"||typeof t=="symbol"?t:Object.is(t?.valueOf?.(),-0)?"-0":String(t)}n(LWe,"toKey");yxe.toKey=LWe});var Sxe=Ft(bxe=>{function Ixe(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t))return t.map(Ixe).join(",");let e=String(t);return e==="0"&&Object.is(Number(t),-0)?"-0":e}n(Ixe,"toString");bxe.toString=Ixe});var cL=Ft(wxe=>{var BWe=lL(),VWe=Sxe();function UWe(t){if(Array.isArray(t))return t.map(BWe.toKey);if(typeof t=="symbol")return[t];t=VWe.toString(t);let e=[],o=t.length;if(o===0)return e;let r=0,a="",s="",i=!1;for(t.charCodeAt(0)===46&&(e.push(""),r++);r<o;){let c=t[r];s?c==="\\"&&r+1<o?(r++,a+=t[r]):c===s?s="":a+=c:i?c==='"'||c==="'"?s=c:c==="]"?(i=!1,e.push(a),a=""):a+=c:c==="["?(i=!0,a&&(e.push(a),a="")):c==="."?a&&(e.push(a),a=""):a+=c,r++}return a&&e.push(a),e}n(UWe,"toPath");wxe.toPath=UWe});var uL=Ft(Fxe=>{var Xq=vxe(),zWe=Yq(),$We=lL(),HWe=cL();function Cxe(t,e,o){if(t==null)return o;switch(typeof e){case"string":{if(Xq.isUnsafeProperty(e))return o;let r=t[e];return r===void 0?zWe.isDeepKey(e)?Cxe(t,HWe.toPath(e),o):o:r}case"number":case"symbol":{typeof e=="number"&&(e=$We.toKey(e));let r=t[e];return r===void 0?o:r}default:{if(Array.isArray(e))return jWe(t,e,o);if(Object.is(e?.valueOf(),-0)?e="-0":e=String(e),Xq.isUnsafeProperty(e))return o;let r=t[e];return r===void 0?o:r}}}n(Cxe,"get");function jWe(t,e,o){if(e.length===0)return o;let r=t;for(let a=0;a<e.length;a++){if(r==null||Xq.isUnsafeProperty(e[a]))return o;r=r[e[a]]}return r===void 0?o:r}n(jWe,"getWithPath");Fxe.get=Cxe});var HE=Ft((cRo,Rxe)=>{Rxe.exports=uL().get});var Mxe=Ft(kxe=>{function ZWe(t,e){let o=new Map;for(let r=0;r<t.length;r++){let a=t[r],s=e(a,r,t);o.has(s)||o.set(s,a)}return Array.from(o.values())}n(ZWe,"uniqBy");kxe.uniqBy=ZWe});var Oxe=Ft(Pxe=>{function JWe(t,e){return function(...o){return t.apply(this,o.slice(0,e))}}n(JWe,"ary");Pxe.ary=JWe});var Zq=Ft(Nxe=>{function eGe(t){return t}n(eGe,"identity");Nxe.identity=eGe});var _xe=Ft(Dxe=>{var tGe=uL();function oGe(t){return function(e){return tGe.get(e,t)}}n(oGe,"property");Dxe.property=oGe});var Jq=Ft(Lxe=>{function rGe(t){return t==null||typeof t!="object"&&typeof t!="function"}n(rGe,"isPrimitive");Lxe.isPrimitive=rGe});var Vxe=Ft(Bxe=>{function nGe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}n(nGe,"isTypedArray");Bxe.isTypedArray=nGe});var zxe=Ft(Uxe=>{function aGe(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}n(aGe,"getSymbols");Uxe.getSymbols=aGe});var pL=Ft($xe=>{function sGe(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}n(sGe,"getTag");$xe.getTag=sGe});var eW=Ft(In=>{var iGe="[object RegExp]",lGe="[object String]",cGe="[object Number]",uGe="[object Boolean]",dGe="[object Arguments]",fGe="[object Symbol]",pGe="[object Date]",mGe="[object Map]",hGe="[object Set]",gGe="[object Array]",vGe="[object Function]",xGe="[object ArrayBuffer]",yGe="[object Object]",IGe="[object Error]",bGe="[object DataView]",SGe="[object Uint8Array]",wGe="[object Uint8ClampedArray]",CGe="[object Uint16Array]",FGe="[object Uint32Array]",RGe="[object BigUint64Array]",EGe="[object Int8Array]",AGe="[object Int16Array]",TGe="[object Int32Array]",kGe="[object BigInt64Array]",MGe="[object Float32Array]",PGe="[object Float64Array]";In.argumentsTag=dGe;In.arrayBufferTag=xGe;In.arrayTag=gGe;In.bigInt64ArrayTag=kGe;In.bigUint64ArrayTag=RGe;In.booleanTag=uGe;In.dataViewTag=bGe;In.dateTag=pGe;In.errorTag=IGe;In.float32ArrayTag=MGe;In.float64ArrayTag=PGe;In.functionTag=vGe;In.int16ArrayTag=AGe;In.int32ArrayTag=TGe;In.int8ArrayTag=EGe;In.mapTag=mGe;In.numberTag=cGe;In.objectTag=yGe;In.regexpTag=iGe;In.setTag=hGe;In.stringTag=lGe;In.symbolTag=fGe;In.uint16ArrayTag=CGe;In.uint32ArrayTag=FGe;In.uint8ArrayTag=SGe;In.uint8ClampedArrayTag=wGe});var jxe=Ft(Hxe=>{var OGe=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})()||Function("return this")();Hxe.globalThis_=OGe});var Gxe=Ft(Wxe=>{var qxe=jxe();function NGe(t){return typeof qxe.globalThis_.Buffer<"u"&&qxe.globalThis_.Buffer.isBuffer(t)}n(NGe,"isBuffer");Wxe.isBuffer=NGe});var tW=Ft(mL=>{var DGe=Jq(),_Ge=Vxe(),LGe=zxe(),BGe=pL(),ha=eW(),VGe=Gxe();function UGe(t,e){return $x(t,void 0,t,new Map,e)}n(UGe,"cloneDeepWith");function $x(t,e,o,r=new Map,a=void 0){let s=a?.(t,e,o,r);if(s!==void 0)return s;if(DGe.isPrimitive(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){let i=new Array(t.length);r.set(t,i);for(let c=0;c<t.length;c++)i[c]=$x(t[c],c,o,r,a);return Object.hasOwn(t,"index")&&(i.index=t.index),Object.hasOwn(t,"input")&&(i.input=t.input),i}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let i=new RegExp(t.source,t.flags);return i.lastIndex=t.lastIndex,i}if(t instanceof Map){let i=new Map;r.set(t,i);for(let[c,d]of t)i.set(c,$x(d,c,o,r,a));return i}if(t instanceof Set){let i=new Set;r.set(t,i);for(let c of t)i.add($x(c,void 0,o,r,a));return i}if(VGe.isBuffer(t))return t.subarray();if(_Ge.isTypedArray(t)){let i=new(Object.getPrototypeOf(t)).constructor(t.length);r.set(t,i);for(let c=0;c<t.length;c++)i[c]=$x(t[c],c,o,r,a);return i}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){let i=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,i),um(i,t,o,r,a),i}if(typeof File<"u"&&t instanceof File){let i=new File([t],t.name,{type:t.type});return r.set(t,i),um(i,t,o,r,a),i}if(typeof Blob<"u"&&t instanceof Blob){let i=new Blob([t],{type:t.type});return r.set(t,i),um(i,t,o,r,a),i}if(t instanceof Error){let i=structuredClone(t);return r.set(t,i),i.message=t.message,i.name=t.name,i.stack=t.stack,i.cause=t.cause,i.constructor=t.constructor,um(i,t,o,r,a),i}if(t instanceof Boolean){let i=new Boolean(t.valueOf());return r.set(t,i),um(i,t,o,r,a),i}if(t instanceof Number){let i=new Number(t.valueOf());return r.set(t,i),um(i,t,o,r,a),i}if(t instanceof String){let i=new String(t.valueOf());return r.set(t,i),um(i,t,o,r,a),i}if(typeof t=="object"&&zGe(t)){let i=Object.create(Object.getPrototypeOf(t));return r.set(t,i),um(i,t,o,r,a),i}return t}n($x,"cloneDeepWithImpl");function um(t,e,o=t,r,a){let s=[...Object.keys(e),...LGe.getSymbols(e)];for(let i=0;i<s.length;i++){let c=s[i],d=Object.getOwnPropertyDescriptor(t,c);(d==null||d.writable)&&(t[c]=$x(e[c],c,o,r,a))}}n(um,"copyProperties");function zGe(t){switch(BGe.getTag(t)){case ha.argumentsTag:case ha.arrayTag:case ha.arrayBufferTag:case ha.dataViewTag:case ha.booleanTag:case ha.dateTag:case ha.float32ArrayTag:case ha.float64ArrayTag:case ha.int8ArrayTag:case ha.int16ArrayTag:case ha.int32ArrayTag:case ha.mapTag:case ha.numberTag:case ha.objectTag:case ha.regexpTag:case ha.setTag:case ha.stringTag:case ha.symbolTag:case ha.uint8ArrayTag:case ha.uint8ClampedArrayTag:case ha.uint16ArrayTag:case ha.uint32ArrayTag:return!0;default:return!1}}n(zGe,"isCloneableObject");mL.cloneDeepWith=UGe;mL.cloneDeepWithImpl=$x;mL.copyProperties=um});var Yxe=Ft(Kxe=>{var $Ge=tW();function HGe(t){return $Ge.cloneDeepWithImpl(t,void 0,t,new Map,void 0)}n(HGe,"cloneDeep");Kxe.cloneDeep=HGe});var hL=Ft(Xxe=>{function jGe(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}n(jGe,"isEqualsSameValueZero");Xxe.isEqualsSameValueZero=jGe});var oW=Ft(()=>{hL()});var rW=Ft(Qxe=>{function qGe(t){return t!==null&&(typeof t=="object"||typeof t=="function")}n(qGe,"isObject");Qxe.isObject=qGe});var rye=Ft(oye=>{var Zxe=Jq(),Jxe=hL();oW();var WGe=rW();function eye(t,e,o){return typeof o!="function"?eye(t,e,()=>{}):nW(t,e,n(function r(a,s,i,c,d,f){let p=o(a,s,i,c,d,f);return p!==void 0?!!p:nW(a,s,r,f)},"doesMatch"),new Map)}n(eye,"isMatchWith");function nW(t,e,o,r){if(e===t)return!0;switch(typeof e){case"object":return GGe(t,e,o,r);case"function":return Object.keys(e).length>0?nW(t,{...e},o,r):Jxe.isEqualsSameValueZero(t,e);default:return WGe.isObject(t)?typeof e=="string"?e==="":!0:Jxe.isEqualsSameValueZero(t,e)}}n(nW,"isMatchWithInternal");function GGe(t,e,o,r){if(e==null)return!0;if(Array.isArray(e))return tye(t,e,o,r);if(e instanceof Map)return KGe(t,e,o,r);if(e instanceof Set)return YGe(t,e,o,r);let a=Object.keys(e);if(t==null||Zxe.isPrimitive(t))return a.length===0;if(a.length===0)return!0;if(r?.has(e))return r.get(e)===t;r?.set(e,t);try{for(let s=0;s<a.length;s++){let i=a[s];if(!Zxe.isPrimitive(t)&&!(i in t)||e[i]===void 0&&t[i]!==void 0||e[i]===null&&t[i]!==null||!o(t[i],e[i],i,t,e,r))return!1}return!0}finally{r?.delete(e)}}n(GGe,"isObjectMatch");function KGe(t,e,o,r){if(e.size===0)return!0;if(!(t instanceof Map))return!1;for(let[a,s]of e.entries())if(o(t.get(a),s,a,t,e,r)===!1)return!1;return!0}n(KGe,"isMapMatch");function tye(t,e,o,r){if(e.length===0)return!0;if(!Array.isArray(t))return!1;let a=new Set;for(let s=0;s<e.length;s++){let i=e[s],c=!1;for(let d=0;d<t.length;d++){if(a.has(d))continue;let f=t[d],p=!1;if(o(f,i,s,t,e,r)&&(p=!0),p){a.add(d),c=!0;break}}if(!c)return!1}return!0}n(tye,"isArrayMatch");function YGe(t,e,o,r){return e.size===0?!0:t instanceof Set?tye([...t],[...e],o,r):!1}n(YGe,"isSetMatch");oye.isMatchWith=eye});var aW=Ft(nye=>{var XGe=rye();function QGe(t,e){return XGe.isMatchWith(t,e,()=>{})}n(QGe,"isMatch");nye.isMatch=QGe});var sye=Ft(aye=>{var ZGe=Yxe(),JGe=aW();function eKe(t){return t=ZGe.cloneDeep(t),e=>JGe.isMatch(e,t)}n(eKe,"matches");aye.matches=eKe});var lye=Ft(iye=>{var tKe=pL(),gL=eW(),vL=tW();function oKe(t,e){return vL.cloneDeepWith(t,(o,r,a,s)=>{let i=e?.(o,r,a,s);if(i!==void 0)return i;if(typeof t=="object"){if(tKe.getTag(t)==="[object Object]"&&typeof t.constructor!="function"){let c={};return s.set(t,c),vL.copyProperties(c,t,a,s),c}switch(Object.prototype.toString.call(t)){case gL.numberTag:case gL.stringTag:case gL.booleanTag:{let c=new t.constructor(t?.valueOf());return vL.copyProperties(c,t),c}case gL.argumentsTag:{let c={};return vL.copyProperties(c,t),c.length=t.length,c[Symbol.iterator]=t[Symbol.iterator],c}default:return}}})}n(oKe,"cloneDeepWith");iye.cloneDeepWith=oKe});var uye=Ft(cye=>{var rKe=lye();function nKe(t){return rKe.cloneDeepWith(t)}n(nKe,"cloneDeep");cye.cloneDeep=nKe});var sW=Ft(dye=>{var aKe=/^(?:0|[1-9]\d*)$/;function sKe(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<e;case"symbol":return!1;case"string":return aKe.test(t)}}n(sKe,"isIndex");dye.isIndex=sKe});var pye=Ft(fye=>{var iKe=pL();function lKe(t){return t!==null&&typeof t=="object"&&iKe.getTag(t)==="[object Arguments]"}n(lKe,"isArguments");fye.isArguments=lKe});var hye=Ft(mye=>{var cKe=Yq(),uKe=cL(),dKe=sW(),fKe=pye();function pKe(t,e){let o;if(Array.isArray(e)?o=e:typeof e=="string"&&cKe.isDeepKey(e)&&t?.[e]==null?o=uKe.toPath(e):o=[e],o.length===0)return!1;let r=t;for(let a=0;a<o.length;a++){let s=o[a];if((r==null||!Object.hasOwn(r,s))&&!((Array.isArray(r)||fKe.isArguments(r))&&dKe.isIndex(s)&&s<r.length))return!1;r=r[s]}return!0}n(pKe,"has");mye.has=pKe});var vye=Ft(gye=>{var mKe=lL(),hKe=uL(),gKe=aW(),vKe=uye(),xKe=hye();function yKe(t,e){switch(typeof t){case"object":Object.is(t?.valueOf(),-0)&&(t="-0");break;case"number":t=mKe.toKey(t);break}return e=vKe.cloneDeep(e),function(o){let r=hKe.get(o,t);return r===void 0?xKe.has(o,t):e===void 0?r===void 0:gKe.isMatch(r,e)}}n(yKe,"matchesProperty");gye.matchesProperty=yKe});var yye=Ft(xye=>{var IKe=Zq(),bKe=_xe(),SKe=sye(),wKe=vye();function CKe(t){if(t==null)return IKe.identity;switch(typeof t){case"function":return t;case"object":return Array.isArray(t)&&t.length===2?wKe.matchesProperty(t[0],t[1]):SKe.matches(t);case"string":case"symbol":case"number":return bKe.property(t)}}n(CKe,"iteratee");xye.iteratee=CKe});var bye=Ft(Iye=>{function FKe(t){return Number.isSafeInteger(t)&&t>=0}n(FKe,"isLength");Iye.isLength=FKe});var iW=Ft(Sye=>{var RKe=bye();function EKe(t){return t!=null&&typeof t!="function"&&RKe.isLength(t.length)}n(EKe,"isArrayLike");Sye.isArrayLike=EKe});var Cye=Ft(wye=>{function AKe(t){return typeof t=="object"&&t!==null}n(AKe,"isObjectLike");wye.isObjectLike=AKe});var Rye=Ft(Fye=>{var TKe=iW(),kKe=Cye();function MKe(t){return kKe.isObjectLike(t)&&TKe.isArrayLike(t)}n(MKe,"isArrayLikeObject");Fye.isArrayLikeObject=MKe});var Aye=Ft(Eye=>{var PKe=Mxe(),OKe=Oxe(),NKe=Zq(),DKe=yye(),_Ke=Rye();function LKe(t,e=NKe.identity){return _Ke.isArrayLikeObject(t)?PKe.uniqBy(Array.from(t),OKe.ary(DKe.iteratee(e),1)):[]}n(LKe,"uniqBy");Eye.uniqBy=LKe});var kye=Ft((REo,Tye)=>{Tye.exports=Aye().uniqBy});var Dye=Ft(Nye=>{function zKe(t,e=1){let o=[],r=Math.floor(e),a=n((s,i)=>{for(let c=0;c<s.length;c++){let d=s[c];Array.isArray(d)&&i<r?a(d,i+1):o.push(d)}},"recursive");return a(t,0),o}n(zKe,"flatten");Nye.flatten=zKe});var cW=Ft(_ye=>{var $Ke=hL();oW();var HKe=iW(),jKe=rW(),qKe=sW();function WKe(t,e,o){return jKe.isObject(o)&&(typeof e=="number"&&HKe.isArrayLike(o)&&qKe.isIndex(e)&&e<o.length||typeof e=="string"&&e in o)?$Ke.isEqualsSameValueZero(o[e],t):!1}n(WKe,"isIterateeCall");_ye.isIterateeCall=WKe});var Vye=Ft(Bye=>{function Lye(t){return typeof t=="symbol"?1:t===null?2:t===void 0?3:t!==t?4:0}n(Lye,"getPriority");var GKe=n((t,e,o)=>{if(t!==e){let r=Lye(t),a=Lye(e);if(r===a&&r===0){if(t<e)return o==="desc"?1:-1;if(t>e)return o==="desc"?-1:1}return o==="desc"?a-r:r-a}return 0},"compareValues");Bye.compareValues=GKe});var uW=Ft(Uye=>{function KKe(t){return typeof t=="symbol"||t instanceof Symbol}n(KKe,"isSymbol");Uye.isSymbol=KKe});var $ye=Ft(zye=>{var YKe=uW(),XKe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,QKe=/^\w*$/;function ZKe(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||YKe.isSymbol(t)?!0:typeof t=="string"&&(QKe.test(t)||!XKe.test(t))||e!=null&&Object.hasOwn(e,t)}n(ZKe,"isKey");zye.isKey=ZKe});var jye=Ft(Hye=>{var JKe=cL(),eYe=Vye(),tYe=$ye();function oYe(t,e,o,r){if(t==null)return[];o=r?void 0:o,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(o)||(o=o==null?[]:[o]),o=o.map(c=>String(c));let a=n((c,d)=>{let f=c;for(let p=0;p<d.length&&f!=null;++p)f=f[d[p]];return f},"getValueByNestedPath"),s=n((c,d)=>d==null||c==null?d:typeof c=="object"&&"key"in c?Object.hasOwn(d,c.key)?d[c.key]:a(d,c.path):typeof c=="function"?c(d):Array.isArray(c)?a(d,c):typeof d=="object"?d[c]:d,"getValueByCriterion"),i=e.map(c=>(Array.isArray(c)&&c.length===1&&(c=c[0]),c==null||typeof c=="function"||Array.isArray(c)||tYe.isKey(c)?c:{key:c,path:JKe.toPath(c)}));return t.map(c=>({original:c,criteria:i.map(d=>s(d,c))})).slice().sort((c,d)=>{for(let f=0;f<i.length;f++){let p=eYe.compareValues(c.criteria[f],d.criteria[f],o[f]);if(p!==0)return p}return 0}).map(c=>c.original)}n(oYe,"orderBy");Hye.orderBy=oYe});var Gye=Ft(Wye=>{var rYe=Dye(),qye=cW(),nYe=jye();function aYe(t,...e){let o=e.length;return o>1&&qye.isIterateeCall(t,e[0],e[1])?e=[]:o>2&&qye.isIterateeCall(e[0],e[1],e[2])&&(e=[e[0]]),nYe.orderBy(t,rYe.flatten(e),["asc"])}n(aYe,"sortBy");Wye.sortBy=aYe});var GE=Ft((GEo,Kye)=>{Kye.exports=Gye().sortBy});var bbe=Ft(Ibe=>{function VXe(t,e,{signal:o,edges:r}={}){let a,s=null,i=r!=null&&r.includes("leading"),c=r==null||r.includes("trailing"),d=n(()=>{s!==null&&(t.apply(a,s),a=void 0,s=null)},"invoke"),f=n(()=>{c&&d(),v()},"onTimerEnd"),p=null,m=n(()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},e)},"schedule"),h=n(()=>{p!==null&&(clearTimeout(p),p=null)},"cancelTimer"),v=n(()=>{h(),a=void 0,s=null},"cancel"),x=n(()=>{d()},"flush"),y=n(function(...b){if(o?.aborted)return;a=this,s=b;let S=p==null;m(),i&&S&&d()},"debounced");return y.schedule=m,y.cancel=v,y.flush=x,o?.addEventListener("abort",v,{once:!0}),y}n(VXe,"debounce");Ibe.debounce=VXe});var wbe=Ft(Sbe=>{var UXe=bbe();function zXe(t,e=0,o={}){typeof o!="object"&&(o={});let{leading:r=!1,trailing:a=!0,maxWait:s}=o,i=Array(2);r&&(i[0]="leading"),a&&(i[1]="trailing");let c,d=null,f=UXe.debounce(function(...h){c=t.apply(this,h),d=null},e,{edges:i}),p=n(function(...h){return s!=null&&(d===null&&(d=Date.now()),Date.now()-d>=s)?(c=t.apply(this,h),d=Date.now(),f.cancel(),f.schedule(),c):(f.apply(this,h),c)},"debounced"),m=n(()=>(f.flush(),c),"flush");return p.cancel=f.cancel,p.flush=m,p}n(zXe,"debounce");Sbe.debounce=zXe});var Fbe=Ft(Cbe=>{var $Xe=wbe();function HXe(t,e=0,o={}){let{leading:r=!0,trailing:a=!0}=o;return $Xe.debounce(t,e,{leading:r,maxWait:e,trailing:a})}n(HXe,"throttle");Cbe.throttle=HXe});var Ebe=Ft((nAo,Rbe)=>{Rbe.exports=Fbe().throttle});var Gbe=Ft(Wbe=>{"use strict";(function(){function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}n(t,"is"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=oe(),o=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,a=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;Wbe.useSyncExternalStoreWithSelector=function(d,f,p,m,h){var v=a(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=i(function(){function b(T){if(!S){if(S=!0,w=T,T=m(T),h!==void 0&&x.hasValue){var E=x.value;if(h(E,T))return C=E}return C=T}if(E=C,o(w,T))return E;var k=m(T);return h!==void 0&&h(E,k)?(w=T,E):(w=T,C=k)}n(b,"memoizedSelector");var S=!1,w,C,F=p===void 0?null:p;return[function(){return b(f())},F===null?void 0:function(){return b(F())}]},[f,p,m,h]);var y=r(d,v[0],v[1]);return s(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var Ybe=Ft((OAo,Kbe)=>{"use strict";Kbe.exports=Gbe()});var fSe=Ft(dSe=>{var aJe=uW();function sJe(t){return aJe.isSymbol(t)?NaN:Number(t)}n(sJe,"toNumber");dSe.toNumber=sJe});var mSe=Ft(pSe=>{var iJe=fSe();function lJe(t){return t?(t=iJe.toNumber(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}n(lJe,"toFinite");pSe.toFinite=lJe});var gSe=Ft(hSe=>{var QW=mSe(),cJe=cW();function uJe(t,e,o){o&&typeof o!="number"&&cJe.isIterateeCall(t,e,o)&&(e=o=void 0),t=QW.toFinite(t),e===void 0?(e=t,t=0):e=QW.toFinite(e),o=o===void 0?t<e?1:-1:QW.toFinite(o);let r=Math.max(Math.ceil((e-t)/(o||1)),0),a=new Array(r);for(let s=0;s<r;s++)a[s]=t,t+=o;return a}n(uJe,"range");hSe.range=uJe});var xSe=Ft((Mko,vSe)=>{vSe.exports=gSe().range});var eG=Ft((CSe,m3)=>{(function(t){"use strict";var e=1e9,o={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},r=!0,a="[DecimalError] ",s=a+"Invalid argument: ",i=a+"Exponent out of range: ",c=Math.floor,d=Math.pow,f=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,p,m=1e7,h=7,v=9007199254740991,x=c(v/h),y={};y.absoluteValue=y.abs=function(){var N=new this.constructor(this);return N.s&&(N.s=1),N},y.comparedTo=y.cmp=function(N){var _,B,z,q,$=this;if(N=new $.constructor(N),$.s!==N.s)return $.s||-N.s;if($.e!==N.e)return $.e>N.e^$.s<0?1:-1;for(z=$.d.length,q=N.d.length,_=0,B=z<q?z:q;_<B;++_)if($.d[_]!==N.d[_])return $.d[_]>N.d[_]^$.s<0?1:-1;return z===q?0:z>q^$.s<0?1:-1},y.decimalPlaces=y.dp=function(){var N=this,_=N.d.length-1,B=(_-N.e)*h;if(_=N.d[_],_)for(;_%10==0;_/=10)B--;return B<0?0:B},y.dividedBy=y.div=function(N){return C(this,new this.constructor(N))},y.dividedToIntegerBy=y.idiv=function(N){var _=this,B=_.constructor;return M(C(_,new B(N),0,1),B.precision)},y.equals=y.eq=function(N){return!this.cmp(N)},y.exponent=function(){return T(this)},y.greaterThan=y.gt=function(N){return this.cmp(N)>0},y.greaterThanOrEqualTo=y.gte=function(N){return this.cmp(N)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return this.s===0},y.lessThan=y.lt=function(N){return this.cmp(N)<0},y.lessThanOrEqualTo=y.lte=function(N){return this.cmp(N)<1},y.logarithm=y.log=function(N){var _,B=this,z=B.constructor,q=z.precision,$=q+5;if(N===void 0)N=new z(10);else if(N=new z(N),N.s<1||N.eq(p))throw Error(a+"NaN");if(B.s<1)throw Error(a+(B.s?"NaN":"-Infinity"));return B.eq(p)?new z(0):(r=!1,_=C(O(B,$),O(N,$),$),r=!0,M(_,q))},y.minus=y.sub=function(N){var _=this;return N=new _.constructor(N),_.s==N.s?L(_,N):b(_,(N.s=-N.s,N))},y.modulo=y.mod=function(N){var _,B=this,z=B.constructor,q=z.precision;if(N=new z(N),!N.s)throw Error(a+"NaN");return B.s?(r=!1,_=C(B,N,0,1).times(N),r=!0,B.minus(_)):M(new z(B),q)},y.naturalExponential=y.exp=function(){return F(this)},y.naturalLogarithm=y.ln=function(){return O(this)},y.negated=y.neg=function(){var N=new this.constructor(this);return N.s=-N.s||0,N},y.plus=y.add=function(N){var _=this;return N=new _.constructor(N),_.s==N.s?b(_,N):L(_,(N.s=-N.s,N))},y.precision=y.sd=function(N){var _,B,z,q=this;if(N!==void 0&&N!==!!N&&N!==1&&N!==0)throw Error(s+N);if(_=T(q)+1,z=q.d.length-1,B=z*h+1,z=q.d[z],z){for(;z%10==0;z/=10)B--;for(z=q.d[0];z>=10;z/=10)B++}return N&&_>B?_:B},y.squareRoot=y.sqrt=function(){var N,_,B,z,q,$,Y,Q=this,X=Q.constructor;if(Q.s<1){if(!Q.s)return new X(0);throw Error(a+"NaN")}for(N=T(Q),r=!1,q=Math.sqrt(+Q),q==0||q==1/0?(_=w(Q.d),(_.length+N)%2==0&&(_+="0"),q=Math.sqrt(_),N=c((N+1)/2)-(N<0||N%2),q==1/0?_="5e"+N:(_=q.toExponential(),_=_.slice(0,_.indexOf("e")+1)+N),z=new X(_)):z=new X(q.toString()),B=X.precision,q=Y=B+3;;)if($=z,z=$.plus(C(Q,$,Y+2)).times(.5),w($.d).slice(0,Y)===(_=w(z.d)).slice(0,Y)){if(_=_.slice(Y-3,Y+1),q==Y&&_=="4999"){if(M($,B+1,0),$.times($).eq(Q)){z=$;break}}else if(_!="9999")break;Y+=4}return r=!0,M(z,B)},y.times=y.mul=function(N){var _,B,z,q,$,Y,Q,X,te,ae=this,se=ae.constructor,J=ae.d,ne=(N=new se(N)).d;if(!ae.s||!N.s)return new se(0);for(N.s*=ae.s,B=ae.e+N.e,X=J.length,te=ne.length,X<te&&($=J,J=ne,ne=$,Y=X,X=te,te=Y),$=[],Y=X+te,z=Y;z--;)$.push(0);for(z=te;--z>=0;){for(_=0,q=X+z;q>z;)Q=$[q]+ne[z]*J[q-z-1]+_,$[q--]=Q%m|0,_=Q/m|0;$[q]=($[q]+_)%m|0}for(;!$[--Y];)$.pop();return _?++B:$.shift(),N.d=$,N.e=B,r?M(N,se.precision):N},y.toDecimalPlaces=y.todp=function(N,_){var B=this,z=B.constructor;return B=new z(B),N===void 0?B:(S(N,0,e),_===void 0?_=z.rounding:S(_,0,8),M(B,N+T(B)+1,_))},y.toExponential=function(N,_){var B,z=this,q=z.constructor;return N===void 0?B=U(z,!0):(S(N,0,e),_===void 0?_=q.rounding:S(_,0,8),z=M(new q(z),N+1,_),B=U(z,!0,N+1)),B},y.toFixed=function(N,_){var B,z,q=this,$=q.constructor;return N===void 0?U(q):(S(N,0,e),_===void 0?_=$.rounding:S(_,0,8),z=M(new $(q),N+T(q)+1,_),B=U(z.abs(),!1,N+T(z)+1),q.isneg()&&!q.isZero()?"-"+B:B)},y.toInteger=y.toint=function(){var N=this,_=N.constructor;return M(new _(N),T(N)+1,_.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(N){var _,B,z,q,$,Y,Q=this,X=Q.constructor,te=12,ae=+(N=new X(N));if(!N.s)return new X(p);if(Q=new X(Q),!Q.s){if(N.s<1)throw Error(a+"Infinity");return Q}if(Q.eq(p))return Q;if(z=X.precision,N.eq(p))return M(Q,z);if(_=N.e,B=N.d.length-1,Y=_>=B,$=Q.s,Y){if((B=ae<0?-ae:ae)<=v){for(q=new X(p),_=Math.ceil(z/h+4),r=!1;B%2&&(q=q.times(Q),W(q.d,_)),B=c(B/2),B!==0;)Q=Q.times(Q),W(Q.d,_);return r=!0,N.s<0?new X(p).div(q):M(q,z)}}else if($<0)throw Error(a+"NaN");return $=$<0&&N.d[Math.max(_,B)]&1?-1:1,Q.s=1,r=!1,q=N.times(O(Q,z+te)),r=!0,q=F(q),q.s=$,q},y.toPrecision=function(N,_){var B,z,q=this,$=q.constructor;return N===void 0?(B=T(q),z=U(q,B<=$.toExpNeg||B>=$.toExpPos)):(S(N,1,e),_===void 0?_=$.rounding:S(_,0,8),q=M(new $(q),N,_),B=T(q),z=U(q,N<=B||B<=$.toExpNeg,N)),z},y.toSignificantDigits=y.tosd=function(N,_){var B=this,z=B.constructor;return N===void 0?(N=z.precision,_=z.rounding):(S(N,1,e),_===void 0?_=z.rounding:S(_,0,8)),M(new z(B),N,_)},y.toString=y.valueOf=y.val=y.toJSON=function(){var N=this,_=T(N),B=N.constructor;return U(N,_<=B.toExpNeg||_>=B.toExpPos)};function b(N,_){var B,z,q,$,Y,Q,X,te,ae=N.constructor,se=ae.precision;if(!N.s||!_.s)return _.s||(_=new ae(N)),r?M(_,se):_;if(X=N.d,te=_.d,Y=N.e,q=_.e,X=X.slice(),$=Y-q,$){for($<0?(z=X,$=-$,Q=te.length):(z=te,q=Y,Q=X.length),Y=Math.ceil(se/h),Q=Y>Q?Y+1:Q+1,$>Q&&($=Q,z.length=1),z.reverse();$--;)z.push(0);z.reverse()}for(Q=X.length,$=te.length,Q-$<0&&($=Q,z=te,te=X,X=z),B=0;$;)B=(X[--$]=X[$]+te[$]+B)/m|0,X[$]%=m;for(B&&(X.unshift(B),++q),Q=X.length;X[--Q]==0;)X.pop();return _.d=X,_.e=q,r?M(_,se):_}n(b,"add");function S(N,_,B){if(N!==~~N||N<_||N>B)throw Error(s+N)}n(S,"checkInt32");function w(N){var _,B,z,q=N.length-1,$="",Y=N[0];if(q>0){for($+=Y,_=1;_<q;_++)z=N[_]+"",B=h-z.length,B&&($+=k(B)),$+=z;Y=N[_],z=Y+"",B=h-z.length,B&&($+=k(B))}else if(Y===0)return"0";for(;Y%10===0;)Y/=10;return $+Y}n(w,"digitsToString");var C=(function(){function N(z,q){var $,Y=0,Q=z.length;for(z=z.slice();Q--;)$=z[Q]*q+Y,z[Q]=$%m|0,Y=$/m|0;return Y&&z.unshift(Y),z}n(N,"multiplyInteger");function _(z,q,$,Y){var Q,X;if($!=Y)X=$>Y?1:-1;else for(Q=X=0;Q<$;Q++)if(z[Q]!=q[Q]){X=z[Q]>q[Q]?1:-1;break}return X}n(_,"compare");function B(z,q,$){for(var Y=0;$--;)z[$]-=Y,Y=z[$]<q[$]?1:0,z[$]=Y*m+z[$]-q[$];for(;!z[0]&&z.length>1;)z.shift()}return n(B,"subtract"),function(z,q,$,Y){var Q,X,te,ae,se,J,ne,pe,le,ie,de,ue,he,Re,Ae,ye,ge,Te,ze=z.constructor,Ze=z.s==q.s?1:-1,_e=z.d,Ie=q.d;if(!z.s)return new ze(z);if(!q.s)throw Error(a+"Division by zero");for(X=z.e-q.e,ge=Ie.length,Ae=_e.length,ne=new ze(Ze),pe=ne.d=[],te=0;Ie[te]==(_e[te]||0);)++te;if(Ie[te]>(_e[te]||0)&&--X,$==null?ue=$=ze.precision:Y?ue=$+(T(z)-T(q))+1:ue=$,ue<0)return new ze(0);if(ue=ue/h+2|0,te=0,ge==1)for(ae=0,Ie=Ie[0],ue++;(te<Ae||ae)&&ue--;te++)he=ae*m+(_e[te]||0),pe[te]=he/Ie|0,ae=he%Ie|0;else{for(ae=m/(Ie[0]+1)|0,ae>1&&(Ie=N(Ie,ae),_e=N(_e,ae),ge=Ie.length,Ae=_e.length),Re=ge,le=_e.slice(0,ge),ie=le.length;ie<ge;)le[ie++]=0;Te=Ie.slice(),Te.unshift(0),ye=Ie[0],Ie[1]>=m/2&&++ye;do ae=0,Q=_(Ie,le,ge,ie),Q<0?(de=le[0],ge!=ie&&(de=de*m+(le[1]||0)),ae=de/ye|0,ae>1?(ae>=m&&(ae=m-1),se=N(Ie,ae),J=se.length,ie=le.length,Q=_(se,le,J,ie),Q==1&&(ae--,B(se,ge<J?Te:Ie,J))):(ae==0&&(Q=ae=1),se=Ie.slice()),J=se.length,J<ie&&se.unshift(0),B(le,se,ie),Q==-1&&(ie=le.length,Q=_(Ie,le,ge,ie),Q<1&&(ae++,B(le,ge<ie?Te:Ie,ie))),ie=le.length):Q===0&&(ae++,le=[0]),pe[te++]=ae,Q&&le[0]?le[ie++]=_e[Re]||0:(le=[_e[Re]],ie=1);while((Re++<Ae||le[0]!==void 0)&&ue--)}return pe[0]||pe.shift(),ne.e=X,M(ne,Y?$+T(ne)+1:$)}})();function F(N,_){var B,z,q,$,Y,Q,X=0,te=0,ae=N.constructor,se=ae.precision;if(T(N)>16)throw Error(i+T(N));if(!N.s)return new ae(p);for(_==null?(r=!1,Q=se):Q=_,Y=new ae(.03125);N.abs().gte(.1);)N=N.times(Y),te+=5;for(z=Math.log(d(2,te))/Math.LN10*2+5|0,Q+=z,B=q=$=new ae(p),ae.precision=Q;;){if(q=M(q.times(N),Q),B=B.times(++X),Y=$.plus(C(q,B,Q)),w(Y.d).slice(0,Q)===w($.d).slice(0,Q)){for(;te--;)$=M($.times($),Q);return ae.precision=se,_==null?(r=!0,M($,se)):$}$=Y}}n(F,"exp");function T(N){for(var _=N.e*h,B=N.d[0];B>=10;B/=10)_++;return _}n(T,"getBase10Exponent");function E(N,_,B){if(_>N.LN10.sd())throw r=!0,B&&(N.precision=B),Error(a+"LN10 precision limit exceeded");return M(new N(N.LN10),_)}n(E,"getLn10");function k(N){for(var _="";N--;)_+="0";return _}n(k,"getZeroString");function O(N,_){var B,z,q,$,Y,Q,X,te,ae,se=1,J=10,ne=N,pe=ne.d,le=ne.constructor,ie=le.precision;if(ne.s<1)throw Error(a+(ne.s?"NaN":"-Infinity"));if(ne.eq(p))return new le(0);if(_==null?(r=!1,te=ie):te=_,ne.eq(10))return _==null&&(r=!0),E(le,te);if(te+=J,le.precision=te,B=w(pe),z=B.charAt(0),$=T(ne),Math.abs($)<15e14){for(;z<7&&z!=1||z==1&&B.charAt(1)>3;)ne=ne.times(N),B=w(ne.d),z=B.charAt(0),se++;$=T(ne),z>1?(ne=new le("0."+B),$++):ne=new le(z+"."+B.slice(1))}else return X=E(le,te+2,ie).times($+""),ne=O(new le(z+"."+B.slice(1)),te-J).plus(X),le.precision=ie,_==null?(r=!0,M(ne,ie)):ne;for(Q=Y=ne=C(ne.minus(p),ne.plus(p),te),ae=M(ne.times(ne),te),q=3;;){if(Y=M(Y.times(ae),te),X=Q.plus(C(Y,new le(q),te)),w(X.d).slice(0,te)===w(Q.d).slice(0,te))return Q=Q.times(2),$!==0&&(Q=Q.plus(E(le,te+2,ie).times($+""))),Q=C(Q,new le(se),te),le.precision=ie,_==null?(r=!0,M(Q,ie)):Q;Q=X,q+=2}}n(O,"ln");function D(N,_){var B,z,q;for((B=_.indexOf("."))>-1&&(_=_.replace(".","")),(z=_.search(/e/i))>0?(B<0&&(B=z),B+=+_.slice(z+1),_=_.substring(0,z)):B<0&&(B=_.length),z=0;_.charCodeAt(z)===48;)++z;for(q=_.length;_.charCodeAt(q-1)===48;)--q;if(_=_.slice(z,q),_){if(q-=z,B=B-z-1,N.e=c(B/h),N.d=[],z=(B+1)%h,B<0&&(z+=h),z<q){for(z&&N.d.push(+_.slice(0,z)),q-=h;z<q;)N.d.push(+_.slice(z,z+=h));_=_.slice(z),z=h-_.length}else z-=q;for(;z--;)_+="0";if(N.d.push(+_),r&&(N.e>x||N.e<-x))throw Error(i+B)}else N.s=0,N.e=0,N.d=[0];return N}n(D,"parseDecimal");function M(N,_,B){var z,q,$,Y,Q,X,te,ae,se=N.d;for(Y=1,$=se[0];$>=10;$/=10)Y++;if(z=_-Y,z<0)z+=h,q=_,te=se[ae=0];else{if(ae=Math.ceil((z+1)/h),$=se.length,ae>=$)return N;for(te=$=se[ae],Y=1;$>=10;$/=10)Y++;z%=h,q=z-h+Y}if(B!==void 0&&($=d(10,Y-q-1),Q=te/$%10|0,X=_<0||se[ae+1]!==void 0||te%$,X=B<4?(Q||X)&&(B==0||B==(N.s<0?3:2)):Q>5||Q==5&&(B==4||X||B==6&&(z>0?q>0?te/d(10,Y-q):0:se[ae-1])%10&1||B==(N.s<0?8:7))),_<1||!se[0])return X?($=T(N),se.length=1,_=_-$-1,se[0]=d(10,(h-_%h)%h),N.e=c(-_/h)||0):(se.length=1,se[0]=N.e=N.s=0),N;if(z==0?(se.length=ae,$=1,ae--):(se.length=ae+1,$=d(10,h-z),se[ae]=q>0?(te/d(10,Y-q)%d(10,q)|0)*$:0),X)for(;;)if(ae==0){(se[0]+=$)==m&&(se[0]=1,++N.e);break}else{if(se[ae]+=$,se[ae]!=m)break;se[ae--]=0,$=1}for(z=se.length;se[--z]===0;)se.pop();if(r&&(N.e>x||N.e<-x))throw Error(i+T(N));return N}n(M,"round");function L(N,_){var B,z,q,$,Y,Q,X,te,ae,se,J=N.constructor,ne=J.precision;if(!N.s||!_.s)return _.s?_.s=-_.s:_=new J(N),r?M(_,ne):_;if(X=N.d,se=_.d,z=_.e,te=N.e,X=X.slice(),Y=te-z,Y){for(ae=Y<0,ae?(B=X,Y=-Y,Q=se.length):(B=se,z=te,Q=X.length),q=Math.max(Math.ceil(ne/h),Q)+2,Y>q&&(Y=q,B.length=1),B.reverse(),q=Y;q--;)B.push(0);B.reverse()}else{for(q=X.length,Q=se.length,ae=q<Q,ae&&(Q=q),q=0;q<Q;q++)if(X[q]!=se[q]){ae=X[q]<se[q];break}Y=0}for(ae&&(B=X,X=se,se=B,_.s=-_.s),Q=X.length,q=se.length-Q;q>0;--q)X[Q++]=0;for(q=se.length;q>Y;){if(X[--q]<se[q]){for($=q;$&&X[--$]===0;)X[$]=m-1;--X[$],X[q]+=m}X[q]-=se[q]}for(;X[--Q]===0;)X.pop();for(;X[0]===0;X.shift())--z;return X[0]?(_.d=X,_.e=z,r?M(_,ne):_):new J(0)}n(L,"subtract");function U(N,_,B){var z,q=T(N),$=w(N.d),Y=$.length;return _?(B&&(z=B-Y)>0?$=$.charAt(0)+"."+$.slice(1)+k(z):Y>1&&($=$.charAt(0)+"."+$.slice(1)),$=$+(q<0?"e":"e+")+q):q<0?($="0."+k(-q-1)+$,B&&(z=B-Y)>0&&($+=k(z))):q>=Y?($+=k(q+1-Y),B&&(z=B-q-1)>0&&($=$+"."+k(z))):((z=q+1)<Y&&($=$.slice(0,z)+"."+$.slice(z)),B&&(z=B-Y)>0&&(q+1===Y&&($+="."),$+=k(z))),N.s<0?"-"+$:$}n(U,"toString");function W(N,_){if(N.length>_)return N.length=_,!0}n(W,"truncate");function V(N){var _,B,z;function q($){var Y=this;if(!(Y instanceof q))return new q($);if(Y.constructor=q,$ instanceof q){Y.s=$.s,Y.e=$.e,Y.d=($=$.d)?$.slice():$;return}if(typeof $=="number"){if($*0!==0)throw Error(s+$);if($>0)Y.s=1;else if($<0)$=-$,Y.s=-1;else{Y.s=0,Y.e=0,Y.d=[0];return}if($===~~$&&$<1e7){Y.e=0,Y.d=[$];return}return D(Y,$.toString())}else if(typeof $!="string")throw Error(s+$);if($.charCodeAt(0)===45?($=$.slice(1),Y.s=-1):Y.s=1,f.test($))D(Y,$);else throw Error(s+$)}if(n(q,"Decimal"),q.prototype=y,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.clone=V,q.config=q.set=j,N===void 0&&(N={}),N)for(z=["precision","rounding","toExpNeg","toExpPos","LN10"],_=0;_<z.length;)N.hasOwnProperty(B=z[_++])||(N[B]=this[B]);return q.config(N),q}n(V,"clone");function j(N){if(!N||typeof N!="object")throw Error(a+"Object expected");var _,B,z,q=["precision",1,e,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(_=0;_<q.length;_+=3)if((z=N[B=q[_]])!==void 0)if(c(z)===z&&z>=q[_+1]&&z<=q[_+2])this[B]=z;else throw Error(s+B+": "+z);if((z=N[B="LN10"])!==void 0)if(z==Math.LN10)this[B]=new this(z);else throw Error(s+B+": "+z);return this}n(j,"config"),o=V(o),o.default=o.Decimal=o,p=new o(1),typeof define=="function"&&define.amd?define(function(){return o}):typeof m3<"u"&&m3.exports?m3.exports=o:(t||(t=typeof self<"u"&&self&&self.self==self?self:Function("return this")()),t.Decimal=o)})(CSe)});var vFe=Ft((U5o,JK)=>{"use strict";var nnt=Object.prototype.hasOwnProperty,Zi="~";function H2(){}n(H2,"Events");Object.create&&(H2.prototype=Object.create(null),new H2().__proto__||(Zi=!1));function ant(t,e,o){this.fn=t,this.context=e,this.once=o||!1}n(ant,"EE");function gFe(t,e,o,r,a){if(typeof o!="function")throw new TypeError("The listener must be a function");var s=new ant(o,r||t,a),i=Zi?Zi+e:e;return t._events[i]?t._events[i].fn?t._events[i]=[t._events[i],s]:t._events[i].push(s):(t._events[i]=s,t._eventsCount++),t}n(gFe,"addListener");function zB(t,e){--t._eventsCount===0?t._events=new H2:delete t._events[e]}n(zB,"clearEvent");function bi(){this._events=new H2,this._eventsCount=0}n(bi,"EventEmitter");bi.prototype.eventNames=n(function(){var e=[],o,r;if(this._eventsCount===0)return e;for(r in o=this._events)nnt.call(o,r)&&e.push(Zi?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(o)):e},"eventNames");bi.prototype.listeners=n(function(e){var o=Zi?Zi+e:e,r=this._events[o];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,s=r.length,i=new Array(s);a<s;a++)i[a]=r[a].fn;return i},"listeners");bi.prototype.listenerCount=n(function(e){var o=Zi?Zi+e:e,r=this._events[o];return r?r.fn?1:r.length:0},"listenerCount");bi.prototype.emit=n(function(e,o,r,a,s,i){var c=Zi?Zi+e:e;if(!this._events[c])return!1;var d=this._events[c],f=arguments.length,p,m;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),f){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,o),!0;case 3:return d.fn.call(d.context,o,r),!0;case 4:return d.fn.call(d.context,o,r,a),!0;case 5:return d.fn.call(d.context,o,r,a,s),!0;case 6:return d.fn.call(d.context,o,r,a,s,i),!0}for(m=1,p=new Array(f-1);m<f;m++)p[m-1]=arguments[m];d.fn.apply(d.context,p)}else{var h=d.length,v;for(m=0;m<h;m++)switch(d[m].once&&this.removeListener(e,d[m].fn,void 0,!0),f){case 1:d[m].fn.call(d[m].context);break;case 2:d[m].fn.call(d[m].context,o);break;case 3:d[m].fn.call(d[m].context,o,r);break;case 4:d[m].fn.call(d[m].context,o,r,a);break;default:if(!p)for(v=1,p=new Array(f-1);v<f;v++)p[v-1]=arguments[v];d[m].fn.apply(d[m].context,p)}}return!0},"emit");bi.prototype.on=n(function(e,o,r){return gFe(this,e,o,r,!1)},"on");bi.prototype.once=n(function(e,o,r){return gFe(this,e,o,r,!0)},"once");bi.prototype.removeListener=n(function(e,o,r,a){var s=Zi?Zi+e:e;if(!this._events[s])return this;if(!o)return zB(this,s),this;var i=this._events[s];if(i.fn)i.fn===o&&(!a||i.once)&&(!r||i.context===r)&&zB(this,s);else{for(var c=0,d=[],f=i.length;c<f;c++)(i[c].fn!==o||a&&!i[c].once||r&&i[c].context!==r)&&d.push(i[c]);d.length?this._events[s]=d.length===1?d[0]:d:zB(this,s)}return this},"removeListener");bi.prototype.removeAllListeners=n(function(e){var o;return e?(o=Zi?Zi+e:e,this._events[o]&&zB(this,o)):(this._events=new H2,this._eventsCount=0),this},"removeAllListeners");bi.prototype.off=bi.prototype.removeListener;bi.prototype.addListener=bi.prototype.on;bi.prefixed=Zi;bi.EventEmitter=bi;typeof JK<"u"&&(JK.exports=bi)});var vRe=Ft(an=>{"use strict";(function(){"use strict";var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),x=!1,y=!1,b=!1,S=!1,w=!1,C;C=Symbol.for("react.module.reference");function F(ue){return!!(typeof ue=="string"||typeof ue=="function"||ue===o||ue===a||w||ue===r||ue===f||ue===p||S||ue===v||x||y||b||typeof ue=="object"&&ue!==null&&(ue.$$typeof===h||ue.$$typeof===m||ue.$$typeof===s||ue.$$typeof===i||ue.$$typeof===d||ue.$$typeof===C||ue.getModuleId!==void 0))}n(F,"isValidElementType");function T(ue){if(typeof ue=="object"&&ue!==null){var he=ue.$$typeof;switch(he){case t:var Re=ue.type;switch(Re){case o:case a:case r:case f:case p:return Re;default:var Ae=Re&&Re.$$typeof;switch(Ae){case c:case i:case d:case h:case m:case s:return Ae;default:return he}}case e:return he}}}n(T,"typeOf");var E=i,k=s,O=t,D=d,M=o,L=h,U=m,W=e,V=a,j=r,N=f,_=p,B=!1,z=!1;function q(ue){return B||(B=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}n(q,"isAsyncMode");function $(ue){return z||(z=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}n($,"isConcurrentMode");function Y(ue){return T(ue)===i}n(Y,"isContextConsumer");function Q(ue){return T(ue)===s}n(Q,"isContextProvider");function X(ue){return typeof ue=="object"&&ue!==null&&ue.$$typeof===t}n(X,"isElement");function te(ue){return T(ue)===d}n(te,"isForwardRef");function ae(ue){return T(ue)===o}n(ae,"isFragment");function se(ue){return T(ue)===h}n(se,"isLazy");function J(ue){return T(ue)===m}n(J,"isMemo");function ne(ue){return T(ue)===e}n(ne,"isPortal");function pe(ue){return T(ue)===a}n(pe,"isProfiler");function le(ue){return T(ue)===r}n(le,"isStrictMode");function ie(ue){return T(ue)===f}n(ie,"isSuspense");function de(ue){return T(ue)===p}n(de,"isSuspenseList"),an.ContextConsumer=E,an.ContextProvider=k,an.Element=O,an.ForwardRef=D,an.Fragment=M,an.Lazy=L,an.Memo=U,an.Portal=W,an.Profiler=V,an.StrictMode=j,an.Suspense=N,an.SuspenseList=_,an.isAsyncMode=q,an.isConcurrentMode=$,an.isContextConsumer=Y,an.isContextProvider=Q,an.isElement=X,an.isForwardRef=te,an.isFragment=ae,an.isLazy=se,an.isMemo=J,an.isPortal=ne,an.isProfiler=pe,an.isStrictMode=le,an.isSuspense=ie,an.isSuspenseList=de,an.isValidElementType=F,an.typeOf=T})()});var yRe=Ft((U6o,xRe)=>{"use strict";xRe.exports=vRe()});var sNe=K(Rae(),1);var Dw=K(Eo(),1);var kae=n(()=>{let t=null;return{get:n(()=>t,"get"),set:n(e=>{t=e},"set")}},"createInMemoryBookmarkStorage");var Mae="_creationTime",qLe=n(t=>{if(typeof t!="object"||t===null)return;let e=t._id;return typeof e=="string"?e:void 0},"rowId"),WLe=n((t,e)=>{let o=e[Mae];if(typeof o!="number")return t.length;for(let[r,a]of t.entries()){let s=a[Mae];if(typeof s=="number"&&s>o)return r}return t.length},"insertionIndex"),Pae=n(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")},"isMutationDelta"),Oae=n((t,e)=>{if(!Array.isArray(t))return;let o=[];for(let d of t){if(qLe(d)===void 0)return;o.push(d)}let{key:r,op:a,row:s}=e;if(a==="delete"){let d=o.filter(f=>f._id!==r);return d.length===o.length?[...o]:d}if(s===void 0)return;let i=o.findIndex(d=>d._id===r);if(i===-1){let d=[...o];return d.splice(WLe(o,s),0,s),d}let c=[...o];return c[i]=s,c},"applyDelta");var cM=n((t,e)=>{let o=t;for(let r of e)try{o=r.transform(o)}catch{}return o},"foldOptimistic"),dF=n((t,e)=>{if(e!==t.lastValue){t.lastValue=e;for(let o of t.callbacks)try{o(e)}catch{}}},"notifySubscription"),Nz=n((t,e)=>{let o;try{o=e(t.lastValue)}catch{return}let r={id:Symbol("optimistic"),transform:e};t.optimisticLayers.push(r),dF(t,o);let a=n(()=>{let i=t.optimisticLayers.findIndex(c=>c.id===r.id);return i===-1?!1:(t.optimisticLayers.splice(i,1),!0)},"remove"),s=n(()=>{dF(t,cM(t.serverBase,t.optimisticLayers))},"refold");return{confirm:n(i=>{if(i===void 0){a();return}r.commitCursor=i,t.serverCursor!==void 0&&t.serverCursor>=i&&a()&&s()},"confirm"),rollback:n(()=>{a()&&s()},"rollback")}},"applyOptimisticLayer"),Dz=n((t,e)=>{if(e===void 0||t.optimisticLayers.length===0)return!1;let o=t.optimisticLayers.length;return t.optimisticLayers=t.optimisticLayers.filter(r=>r.commitCursor===void 0||r.commitCursor>e),t.optimisticLayers.length!==o},"dropConfirmedLayers"),Nae=n((t,e,o)=>{let r=[],a=[],s=n((c,d)=>{for(let f of t.all())if(f.fn.__lunoraRef===c&&f.shardKey===e&&f.argsKey===d)return f},"findState");return{confirms:r,rollbacks:a,store:{getAllQueries:n(c=>{let d=[];for(let f of t.all())f.fn.__lunoraRef===c.__lunoraRef&&f.shardKey===e&&d.push({args:f.args,value:f.lastValue});return d},"getAllQueries"),getQuery:n((c,d)=>s(c.__lunoraRef,o(d??{}))?.lastValue,"getQuery"),setQuery:n((c,d,f)=>{let p=s(c.__lunoraRef,o(d??{}));if(!p)return;let m=Nz(p,()=>f);m&&(r.push(m.confirm),a.push(m.rollback))},"setQuery")}}},"createLocalStore");var GLe=n((t,e)=>t<e?-1:t>e?1:0,"compareKeys"),WI=n(t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a cache key (query/subscription/shape args) \u2014 pass it as a string");if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(s=>WI(s)).join(",")}]`;let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype){let s=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${s} in a cache key (query/subscription/shape args) \u2014 only plain objects, arrays, and JSON primitives are supported`)}let o=t,r=Object.keys(o).toSorted(GLe),a=[];for(let s of r){let i=o[s];i!==void 0&&a.push(`${JSON.stringify(s)}:${WI(i)}`)}return`{${a.join(",")}}`},"stableStringify"),GI=class t{static{n(this,"SubscriptionRegistry")}static key(e,o,r){return`${e}::${WI(o)}::${r??""}`}byKey=new Map;byId=new Map;get(e){return this.byKey.get(e)}getById(e){return this.byId.get(e)}add(e){this.byKey.set(t.key(e.fn.__lunoraRef,e.args,e.shardKey),e),this.byId.set(e.id,e)}remove(e){this.byKey.delete(t.key(e.fn.__lunoraRef,e.args,e.shardKey)),this.byId.delete(e.id)}all(){return[...this.byKey.values()]}};var _z=n((t,e)=>t!==void 0&&e!==t,"isStaleVersion"),Dae=0,dM=n(()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();Dae+=1;let t=typeof crypto<"u"&&typeof crypto.getRandomValues=="function"?[...crypto.getRandomValues(new Uint8Array(8))].map(e=>e.toString(16).padStart(2,"0")).join(""):Math.random().toString(16).slice(2,12);return`m_${Date.now().toString(36)}_${Dae.toString(36)}_${t}`},"nextId"),KI=n((t,e,o,r)=>{if(t){t({error:o,mutationId:r,operation:e});return}console.warn(`[lunora] offline-queue persistence ${e} failed`,o)},"reportPersistenceError"),uM=class{static{n(this,"OfflineQueue")}queueBeforeFirstConnect;maxItems;onPersistenceError;persistence;onEvict;onSizeChange;version;items=[];constructor(e={},o={}){this.maxItems=e.maxItems??1e3,this.queueBeforeFirstConnect=e.queueBeforeFirstConnect??!1,this.onPersistenceError=e.onPersistenceError,this.persistence=o.persistence,this.onEvict=o.onEvict,this.onSizeChange=o.onSizeChange,this.version=o.version}get size(){return this.items.length}enqueue(e){let o=e;for(o.id??=dM(),this.items.push(o),this.persistence?.append({args:o.args,functionPath:o.functionPath,id:o.id,identity:o.identity,shardKey:o.shardKey,...this.version===void 0?{}:{version:this.version}}).catch(r=>{KI(this.onPersistenceError,"append",r,o.id)});this.items.length>this.maxItems;){let r=this.items.shift();if(r){r.id&&this.persistence?.remove(r.id).catch(s=>{KI(this.onPersistenceError,"remove",s,r.id)});let a=new Error("offline queue overflow");a.code="OFFLINE_QUEUE_OVERFLOW",r.reject(a),this.onEvict?.(r,a)}}this.notifySize()}async hydrate(){if(!this.persistence)return[];let e;try{e=await this.persistence.load()}catch(r){throw KI(this.onPersistenceError,"load",r),r}let o=new Set;for(let r of e)if(!this.items.some(a=>a.id===r.id)){if(_z(this.version,r.version)){this.persistence.remove(r.id).catch(a=>{KI(this.onPersistenceError,"remove",a,r.id)});continue}this.items.push({args:r.args,functionPath:r.functionPath,id:r.id,identity:r.identity,reject:n(()=>{},"reject"),resolve:n(()=>{},"resolve"),shardKey:r.shardKey}),o.add(r.shardKey)}return this.notifySize(),[...o]}drain(e){if(!e){let a=[...this.items];return this.items.length=0,this.notifySize(),a}let o=[],r=[];for(let a of this.items)(e(a)?o:r).push(a);return this.items.length=0,this.items.push(...r),this.notifySize(),o}requeue(e){e.length!==0&&(this.items.unshift(...e),this.notifySize())}clear(){for(let e of this.items){let o=new Error("CLIENT_CLOSED");o.code="CLIENT_CLOSED",e.reject(o)}this.items.length=0,this.notifySize()}notifySize(){this.onSizeChange?.(this.items.length)}};var KLe="lunora-outbox",YLe="offline-mutations",_ae="by_id",fF=n(t=>new Promise((e,o)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{o(t.error??new Error("IndexedDB request failed"))})}),"promisifyRequest"),XLe=n((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new Error("createIndexedDbPersistence: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryPersistence()");let o=t.databaseName??KLe,r=t.storeName??YLe,a,s=n(()=>a||(a=new Promise((c,d)=>{let f=e.open(o,1);f.addEventListener("upgradeneeded",()=>{let p=f.result;p.objectStoreNames.contains(r)||p.createObjectStore(r,{autoIncrement:!0}).createIndex(_ae,"id",{unique:!0})}),f.addEventListener("success",()=>{c(f.result)}),f.addEventListener("error",()=>{d(f.error??new Error("IndexedDB open failed"))})}),a),"openDatabase"),i=n(async(c,d)=>{let p=(await s()).transaction(r,c),m=await d(p.objectStore(r));return await new Promise((h,v)=>{p.addEventListener("complete",()=>{h()}),p.addEventListener("error",()=>{v(p.error??new Error("IndexedDB transaction failed"))}),p.addEventListener("abort",()=>{v(p.error??new Error("IndexedDB transaction aborted"))})}),m},"withStore");return{append:n(async c=>{await i("readwrite",d=>fF(d.add(c)))},"append"),clear:n(async()=>{await i("readwrite",c=>fF(c.clear()))},"clear"),load:n(async()=>i("readonly",c=>fF(c.getAll())),"load"),remove:n(async c=>{await i("readwrite",async d=>{let f=await fF(d.index(_ae).getKey(c));f!==void 0&&await fF(d.delete(f))})},"remove")}},"createIndexedDbPersistence"),Lae=n((t,e=!0)=>{if(t!==!1){if(t)return t;if(!(!e||typeof indexedDB>"u"))return XLe()}},"resolvePersistenceAdapter");var Lz=n((t,e,o)=>`${t}::${e}::${o??""}`,"queryCacheKey"),QLe=500;var ZLe="lunora-query-cache",JLe="query-cache",Bae="by_ts",e3e=1,pF=n(t=>new Promise((e,o)=>{t.addEventListener("success",()=>{e(t.result)}),t.addEventListener("error",()=>{o(t.error??new Error("IndexedDB request failed"))})}),"promisifyRequest"),t3e=n((t={})=>{let e=t.indexedDB??(typeof indexedDB>"u"?void 0:indexedDB);if(!e)throw new Error("createIndexedDbQueryCache: no IndexedDB available \u2014 pass `indexedDB` or use createInMemoryQueryCache()");let o=t.databaseName??ZLe,r=t.storeName??JLe,a=t.maxEntries??QLe,s,i=n(()=>s||(s=new Promise((f,p)=>{let m=e.open(o,e3e);m.addEventListener("upgradeneeded",()=>{let h=m.result;h.objectStoreNames.contains(r)||h.createObjectStore(r,{keyPath:"key"}).createIndex(Bae,"ts",{unique:!1})}),m.addEventListener("success",()=>{f(m.result)}),m.addEventListener("error",()=>{p(m.error??new Error("IndexedDB open failed"))})}),s),"openDatabase"),c=n(async(f,p)=>{let h=(await i()).transaction(r,f),v=await p(h.objectStore(r));return await new Promise((x,y)=>{h.addEventListener("complete",()=>{x()}),h.addEventListener("error",()=>{y(h.error??new Error("IndexedDB transaction failed"))}),h.addEventListener("abort",()=>{y(h.error??new Error("IndexedDB transaction aborted"))})}),v},"withStore"),d=n(async f=>{let m=await pF(f.count())-a;m<=0||await new Promise((h,v)=>{let x=f.index(Bae).openCursor();x.addEventListener("success",()=>{let y=x.result;if(!y||m<=0){h();return}y.delete(),m-=1,y.continue()}),x.addEventListener("error",()=>{v(x.error??new Error("IndexedDB eviction failed"))})})},"evict");return{clear:n(async()=>{await c("readwrite",f=>pF(f.clear()))},"clear"),load:n(async()=>c("readonly",f=>pF(f.getAll())),"load"),put:n(async(f,p)=>{await c("readwrite",async m=>{await pF(m.put({...p,key:f})),await d(m)})},"put"),remove:n(async f=>{await c("readwrite",p=>pF(p.delete(f)))},"remove")}},"createIndexedDbQueryCache"),Vae=n(t=>{if(t!==!1){if(t)return t;if(!(typeof indexedDB>"u"))return t3e()}},"resolveQueryCacheAdapter");var Bz=n((t={},e=Math.random)=>{let o=t.initialDelayMs??250,r=t.maxDelayMs??3e4,a=t.jitter??!0,s=0;return{next(){let i=Math.min(r,o*2**s);if(s+=1,!a)return i;let c=i/2;return Math.floor(c+e()*(i-c))},reset(){s=0}}},"createReconnect");var Uae=n(t=>{let e=t.maxBuffer??1024,o=[],r=[],a=!1,s,i=!1,c=n(()=>{let m=r.shift();if(!m)return!1;if(s)return m.reject(s),!0;if(o.length>0){let h=o.shift();return m.resolve({done:!1,value:h}),!0}return a?(m.resolve({done:!0,value:void 0}),!0):(r.unshift(m),!1)},"flushOne"),d={complete(){if(!(a||s))for(a=!0;c(););},fail(m){if(!(a||s))for(s=m,o.length=0;c(););},push(m){if(!(a||s||i)){if(o.length>=e){d.fail(Object.assign(new Error(`stream buffer overflow (max=${e.toString()}); the consumer cannot keep up with the producer`),{code:"STREAM_BACKPRESSURE"}));return}o.push(m),c()}}},f=n(()=>{if(!i){i=!0,a=!0,o.length=0;try{t.onCancel()}catch{}for(;c(););}},"cancel");return{handle:d,iterable:{cancel:f,[Symbol.asyncIterator](){return{next(){if(s)return Promise.reject(s);if(o.length>0){let m=o.shift();return Promise.resolve({done:!1,value:m})}return a?Promise.resolve({done:!0,value:void 0}):new Promise((m,h)=>{r.push({reject:h,resolve:m})})},return(){return f(),Promise.resolve({done:!0,value:void 0})}}}}}},"createStream");var Vz=500,ni="$lunora.wire$",pM=64,zae=1024,o3e="__proto__",$ae={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},Hae={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},Uz=n(t=>{let e="";for(let r=0;r<t.length;r+=32768)e+=String.fromCharCode(...t.subarray(r,r+32768));return btoa(e)},"toBase64"),r3e=n(t=>{let e=atob(t),o=new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)o[r]=e.codePointAt(r)??0;return o},"fromBase64"),Ep=n((t,e=0)=>{if(e>pM)throw new RangeError(`wire-codec: value nesting exceeds the ${pM}-level limit`);if(t===void 0)return[ni,"undefined"];if(t===null)return null;let o=typeof t;if(o==="bigint")return[ni,"bigint",t.toString()];if(o==="number"){let i=t;return Number.isNaN(i)?[ni,"nan"]:i===1/0?[ni,"inf"]:i===-1/0?[ni,"-inf"]:i}if(o!=="object")return t;if(t instanceof Date)return[ni,"date",Ep(t.getTime(),e+1)];if(t instanceof Error){let i=t,c={};for(let f of Object.keys(i))i[f]!==void 0&&(c[f]=Ep(i[f],e+1));let d=[ni,"error",i.name,i.message,c];return i.cause!==void 0&&d.push(Ep(i.cause,e+1)),d}if(t instanceof URL)return[ni,"url",t.href];if(t instanceof Map)return[ni,"map",[...t.entries()].map(([i,c])=>[Ep(i,e+1),Ep(c,e+1)])];if(t instanceof Set)return[ni,"set",[...t].map(i=>Ep(i,e+1))];if(t instanceof ArrayBuffer)return[ni,"bytes",Uz(new Uint8Array(t)),"ArrayBuffer"];if(ArrayBuffer.isView(t)){let i=t,c=i.constructor.name,d=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);return c==="Uint8Array"?[ni,"bytes",Uz(d)]:[ni,"bytes",Uz(d),c]}if(Array.isArray(t)){let i=t.map(c=>Ep(c,e+1));return i.length>0&&i[0]===ni?[ni,"arr",i]:i}let r=Object.getPrototypeOf(t);if(r!==null&&r!==Object.prototype){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`)}let a=t,s={};for(let i of Object.keys(a)){let c=a[i];c!==void 0&&(s[i]=Ep(c,e+1))}return s},"encodeWire"),rs=n((t,e=0)=>{if(e>pM)throw new RangeError(`wire-codec: value nesting exceeds the ${pM}-level limit`);if(t===null||typeof t!="object")return t;if(Array.isArray(t)){if(t[0]===ni)switch(t[1]){case"-inf":return-1/0;case"arr":return t[2].map(s=>rs(s,e+1));case"bigint":{let s=t[2];if(typeof s!="string"||s.length>zae||!/^-?\d+$/.test(s))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${zae} digits)`);return BigInt(s)}case"date":return new Date(rs(t[2],e+1));case"map":return new Map(t[2].map(([s,i])=>[rs(s,e+1),rs(i,e+1)]));case"set":return new Set(t[2].map(s=>rs(s,e+1)));case"url":return new URL(t[2]);case"error":{let s=t[2],i=t[3],c=(Object.hasOwn(Hae,s)?Hae[s]:void 0)??Error,d=new c(i);return d.name!==s&&Object.defineProperty(d,"name",{configurable:!0,value:s,writable:!0}),Object.assign(d,rs(t[4],e+1)),t.length>5&&Object.defineProperty(d,"cause",{configurable:!0,value:rs(t[5],e+1),writable:!0}),d}case"bytes":{let s=r3e(t[2]),i=t[3]??"Uint8Array";if(i==="ArrayBuffer")return s.buffer.byteLength===s.byteLength?s.buffer:s.slice().buffer;let c=Object.hasOwn($ae,i)?$ae[i]:void 0;return c?new c(s.slice().buffer):s}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return t.map(s=>rs(s,e+1))}return t.map(a=>rs(a,e+1))}let o=t,r={};for(let a of Object.keys(o)){let s=rs(o[a],e+1);a===o3e?Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:s,writable:!0}):r[a]=s}return r},"decodeWire"),wv=class{static{n(this,"Listeners")}listeners=new Set;add(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(...e){let[o]=e;for(let r of this.listeners)try{r(o)}catch{}}clear(){this.listeners.clear()}},n3e="/_lunora/rpc",jae="/_lunora/rpc-batch",a3e="/_lunora/ws",zz=n(t=>t===void 0||t===""?"":`&bucket=${encodeURIComponent(t)}`,"bucketQuery"),$z=n(t=>{for(let e=t.length-1;e>=0;e-=1)t[e]?.()},"rollbackOptimistic"),s3e=n((t,e)=>{for(let o of e)o.op==="delete"?t.delete(o.key):o.value!==void 0&&t.set(o.key,o.value)},"applyRowOpsToView"),i3e="lunora-ping",l3e=3e4,c3e=1e4,u3e=250,d3e=64,f3e="/_lunora/admin/shard-traffic",p3e="/_lunora/admin/scheduled",m3e="/_lunora/admin/scheduled/status",h3e="/_lunora/admin/scheduled/ws",g3e="/_lunora/admin/scheduled/cancel",v3e="/_lunora/admin/scheduled/dead",x3e="/_lunora/admin/scheduled/dead/retry",y3e="/_lunora/admin/scheduled/dead/cancel",I3e="/_lunora/admin/workflows/instances",b3e="/_lunora/admin/workflows/instance",S3e="/_lunora/admin/workflows/status",fM="/_lunora/admin/storage",w3e="/_lunora/admin/storage/url",C3e="/_lunora/admin/storage/buckets",F3e="/_lunora/admin/functions",R3e="/_lunora/admin/cron-jobs",E3e="/_lunora/admin/cron-jobs/run",A3e="/_lunora/admin/openapi",T3e="/_lunora/admin/openrpc",k3e="/_lunora/admin/global/tables",M3e="/_lunora/admin/global/table",P3e="/_lunora/admin/global/facet",O3e="/_lunora/admin/vector/indexes",N3e="/_lunora/admin/vector/query",D3e="/_lunora/admin/auth/users",qae="/_lunora/admin/auth/sessions",_3e="/_lunora/admin/auth/users/create",L3e="/_lunora/admin/auth/users/role",B3e="/_lunora/admin/auth/users/ban",V3e="/_lunora/admin/auth/users/unban",U3e="/_lunora/admin/auth/users/password",z3e="/_lunora/admin/auth/users/remove",$3e="/_lunora/admin/auth/users/impersonate",H3e="/_lunora/admin/auth/sessions/revoke",j3e="/_lunora/admin/auth/sessions/revoke-all",q3e="/_lunora/admin/auth/capabilities",W3e="/_lunora/admin/auth/users/update",G3e="/_lunora/admin/auth/accounts",K3e="/_lunora/admin/auth/accounts/unlink",Y3e="/_lunora/admin/auth/passkeys",X3e="/_lunora/admin/auth/passkeys/delete",Q3e="/_lunora/admin/auth/two-factor/disable",Z3e="/_lunora/admin/auth/organizations",J3e="/_lunora/admin/auth/organizations/members",eBe="/_lunora/admin/auth/organizations/invitations",tBe="/_lunora/admin/auth/organizations/members/remove",oBe="/_lunora/admin/auth/organizations/invitations/cancel",rBe="/api/auth",nBe="/get-session",Wae=n(t=>t.startsWith("https://")?`wss://${t.slice(8)}`:t.startsWith("http://")?`ws://${t.slice(7)}`:t,"deriveWsUrl"),Sv=n((t,e)=>`${t.endsWith("/")?t.slice(0,-1):t}${e}`,"joinUrl"),YI=n((t,e)=>{let o=new URLSearchParams;for(let[a,s]of Object.entries(e))s!==void 0&&s!==""&&o.set(a,String(s));let r=o.toString();return r===""?t:`${t}?${r}`},"withQuery"),ri=n(t=>t??"","connectionKey"),aBe=n(t=>{let e=t.error,o=typeof e?.code=="string"?e.code:void 0,r=typeof e?.message=="string"?e.message:void 0,a=(typeof t.message=="string"?t.message:void 0)??r??"stream error";return Object.assign(new Error(a),o===void 0?void 0:{code:o})},"buildStreamError"),Gae=n(t=>{let e=t.error,o=typeof e?.code=="string"?e.code:void 0,r=typeof e?.message=="string"?e.message:void 0;return{message:(typeof t.message=="string"?t.message:void 0)??r??"subscription error",...o===void 0?{}:{code:o}}},"buildSubscriptionError"),Kae=n((t,e)=>{for(let o of t)try{o(e)}catch{}},"fanSubscriptionError"),sBe=new TextDecoder,iBe=n(t=>{if(typeof t=="string")return t;if(t instanceof ArrayBuffer)return sBe.decode(t)},"decodeServerFrame"),Zl=n((t,e)=>{if(!t.socket||t.wsState!=="open")return!1;try{return t.socket.send(JSON.stringify(e)),!0}catch{return!1}},"sendOn"),mF=n(t=>{let e=new Error(t.message??"request failed");return e.code=t.code,t.data!==void 0&&(e.data=rs(t.data)),e},"reconstructError"),XI=n((t,e)=>{try{return Ep(t)}catch(o){let r=o instanceof Error?o.message:String(o);throw new TypeError(`LunoraClient: cannot encode ${e} \u2014 ${r}`,o instanceof Error?{cause:o}:void 0)}},"encodeCallArgs"),lBe=n((t,e)=>{let o=Array.from({length:e});for(let r of t){if(typeof r.id!="number"||r.id<0||r.id>=e)continue;let a=r.body;o[r.id]=a&&"error"in a&&a.error?{error:mF(a.error),ok:!1}:{ok:!0,value:rs(a?.result)}}return o.map(r=>r??{error:new Error("batch call returned no result"),ok:!1})},"demuxBatchResults"),cBe=new Set(["SHARD_ERROR","SHARD_UNAVAILABLE"]),hF=class t{static{n(this,"LunoraClient")}static MAX_POKE_BUFFERS=256;url;wsUrl;wsToken;authBasePath;fetchImpl;WebSocketImpl;bookmark;reconnectOptions;connectTimeoutMs;heartbeatIntervalMs;offlineQueue;outbox;clientId;clientWatermarks=new Map;outboxMutationCounter=0;onPersistenceError;persistence;persistenceVersion;outboxLeaderRelease;queryCache;hydratedQueryCache=new Map;pendingCacheWrites=new Map;cacheFlushTimer;subscriptions=new GI;connections=new Map;defaultConnectionContext;connectionContexts=new Map;connectionContextHolders=new Map;authToken=null;authSubject=void 0;queuedIdentities=new Map;closed=!1;authTokenListeners=new wv;statusListeners=new wv;tokenExpiredListeners=new wv;mutationSettledListeners=new wv;pendingChangeListeners=new wv;whisperHandlers=new Map;lastStatus="idle";nextSubId=0;nextStreamId=0;streams=new Map;shapeSubscriptions=new Map;pokeBuffers=new Map;nextShapeId=0;constructor(e){this.url=e.url,this.wsUrl=e.wsUrl??Sv(Wae(e.url),a3e),this.wsToken=e.wsToken;let o=e.authBasePath??rBe;this.authBasePath=o.endsWith("/")?o.slice(0,-1):o,this.fetchImpl=e.fetch??(typeof fetch=="function"?fetch.bind(globalThis):void 0),this.WebSocketImpl=e.WebSocket??(typeof WebSocket=="function"?WebSocket:void 0),this.bookmark=e.bookmarkStorage??kae(),this.reconnectOptions=e.reconnect,this.heartbeatIntervalMs=e.heartbeatIntervalMs??l3e,this.connectTimeoutMs=e.connectTimeoutMs??c3e,this.defaultConnectionContext=e.connectionContext,this.persistence=Lae(e.persistence,e.outbox===void 0),this.persistenceVersion=e.persistenceVersion,this.queryCache=Vae(e.queryCache),this.onPersistenceError=e.offlineQueue?.onPersistenceError,this.offlineQueue=new uM(e.offlineQueue,{onEvict:n((r,a)=>{this.emitItemSettled(r,"rejected",a)},"onEvict"),onSizeChange:n(r=>{this.pendingChangeListeners.emit(r)},"onSizeChange"),persistence:this.persistence,version:e.persistenceVersion}),this.outbox=e.outbox,this.clientId=e.clientId??`client-${dM()}`,this.persistence&&queueMicrotask(()=>{this.hydrateAsOutboxLeader()}),this.queryCache&&queueMicrotask(()=>{this.hydrateQueryCache().catch(()=>{})})}setAuthToken(e,o){let r=this.authToken!==e,a=this.identityFingerprint();this.authToken=e,o!==void 0&&(this.authSubject=o);let s=this.identityFingerprint();s!==a&&(r?this.rejectQueuedForIdentityChange():this.restampQueuedIdentity(a,s)),r&&this.authTokenListeners.emit(e)}getAuthToken(){return this.authToken}currentIdentity(){return this.identityFingerprint()}clientIdentifier(){return this.clientId}confirmedMutationWatermark(e){return this.clientWatermarks.get(e??"")??0}async callMutator(e,o,r){let a=r?.clientSeq;if(a!==void 0&&(!Number.isInteger(a)||a<=0))throw new Error(`callMutator: clientSeq must be a positive integer, got ${String(a)}`);let s=r?.shardKey??"",i,c=await this.rpc(e,o,r?.shardKey,{captureBookmark:!0,clientId:this.clientId,clientSeq:a,onMutationAck:n(f=>{i=f},"onMutationAck")});return i!==void 0&&i>(this.clientWatermarks.get(s)??0)&&this.clientWatermarks.set(s,i),{applied:i===void 0||i===a,result:c}}onAuthTokenChange(e){return this.authTokenListeners.add(e)}async getCurrentUser(){if(this.closed||!this.fetchImpl)return null;let e={};this.authToken&&(e.authorization=`Bearer ${this.authToken}`);try{let o=await this.fetchImpl(Sv(this.url,`${this.authBasePath}${nBe}`),{credentials:"include",headers:e,method:"GET"});return o.ok?(await o.json())?.user??null:null}catch{return null}}setWsToken(e){if(this.wsToken!==e){this.wsToken=e;for(let o of this.connections.values())if(o.socket)try{o.socket.close()}catch{}}}setConnectionContext(e,o={}){let r=ri(o.shardKey);e===void 0?this.connectionContexts.delete(r):this.connectionContexts.set(r,e),this.refreshConnectionContext(r)}acquireConnectionContext(e,o={}){let r=ri(o.shardKey),a={context:e},s=this.connectionContextHolders.get(r);s?s.push(a):this.connectionContextHolders.set(r,[a]),this.refreshConnectionContext(r);let i=!1;return()=>{if(i)return;i=!0;let c=this.connectionContextHolders.get(r);if(!c)return;let d=c.indexOf(a);d!==-1&&c.splice(d,1),c.length===0&&this.connectionContextHolders.delete(r),this.refreshConnectionContext(r)}}whisperSubscribe(e,o,r={}){let a=ri(r.shardKey),s=this.whisperHandlers.get(a);s||(s=new Map,this.whisperHandlers.set(a,s));let i=s.get(e),c=i===void 0;if(i||(i=new Set,s.set(e,i)),i.add(o),this.ensureSocket(r.shardKey),c){let d=this.getConnection(r.shardKey);d&&Zl(d,{topic:e,type:"whisper_subscribe"})}return()=>{let d=this.whisperHandlers.get(a),f=d?.get(e);if(!f?.delete(o)||f.size>0)return;d?.delete(e),d?.size===0&&this.whisperHandlers.delete(a);let p=this.getConnection(r.shardKey);p&&Zl(p,{topic:e,type:"whisper_unsubscribe"})}}whisper(e,o,r={}){this.ensureSocket(r.shardKey);let a=this.getConnection(r.shardKey);a&&Zl(a,{data:XI(o??null,`whisper data for topic '${e}'`),topic:e,type:"whisper"})}onTokenExpired(e){return this.tokenExpiredListeners.add(e)}connectionStatus(){return this.computeStatus()}onConnectionStatus(e){let o=this.statusListeners.add(e);return e(this.computeStatus()),o}pendingCount(){return this.offlineQueue.size}onPendingChange(e){let o=this.pendingChangeListeners.add(e);return e(this.offlineQueue.size),o}onMutationSettled(e){return this.mutationSettledListeners.add(e)}async query(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");return await this.rpc(e.__lunoraRef,o,r.shardKey,{attachBookmark:!0})}async batch(e){if(this.closed)throw new Error("LunoraClient is closed");if(!this.fetchImpl)throw new Error("LunoraClient: no `fetch` implementation available");if(e.length===0)return[];let o=await this.fetchImpl(Sv(this.url,jae),{body:JSON.stringify({calls:e.map((s,i)=>({args:XI(s.args??{},`args for batch call '${s.fn.__lunoraRef}'`),functionPath:s.fn.__lunoraRef,id:i,shardKey:s.shardKey}))}),headers:this.rpcRequestHeaders({attachBookmark:!0}),method:"POST"}),r=o.headers.get("x-d1-bookmark");r&&this.bookmark.set(r);let a;try{a=await o.json()}catch{throw new Error(`LunoraClient: batch response was not JSON (status ${o.status.toString()})`)}if(!o.ok||a.error&&!a.results)throw a.error?mF(a.error):new Error(`LunoraClient: batch request failed (status ${o.status.toString()})`);return lBe(a.results??[],e.length)}async mutation(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");let a=o,s=r.mutationId??dM(),{confirms:i,rollbacks:c}=this.applyOptimisticUpdates(e.__lunoraRef,a,r.shardKey,r.optimistic);r.optimisticUpdate&&this.applyOptimisticUpdate(r.optimisticUpdate,o,r.shardKey,c,i);let d=this.getConnection(r.shardKey),f=d?.wsState??"idle",p=d?.socket!==void 0,m=d?.wasEverConnected??!1,{queueBeforeFirstConnect:h}=this.offlineQueue,v=m||h,x=this.WebSocketImpl!==void 0&&v;if(f!=="open"&&!p&&x||f==="connecting"&&v)return this.enqueueOfflineMutation(e,a,r.shardKey,s,c,i);try{let b,S=await this.rpc(e.__lunoraRef,a,r.shardKey,{captureBookmark:!0,mutationId:s,onCommitCursor:n(w=>{b=w},"onCommitCursor")});for(let w of i)w(b);return S}catch(b){throw $z(c),b}}async action(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");return await this.rpc(e.__lunoraRef,o,r.shardKey)}async shardTraffic(e){if(this.closed)throw new Error("LunoraClient is closed");let o=await this.adminFetch(f3e,"POST",{table:e});return{failed:o.failed??0,ok:o.ok??0,shards:o.shards??[]}}async listScheduledJobs(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(p3e,"GET")).records??[]}async schedulerStatus(){if(this.closed)throw new Error("LunoraClient is closed");let e=await this.adminFetch(m3e,"GET");return{backlog:e.backlog??0,inFlight:e.inFlight??0,pools:e.pools??[]}}async cancelScheduledJob(e){if(this.closed)throw new Error("LunoraClient is closed");return{cancelled:(await this.adminFetch(g3e,"POST",{id:e})).cancelled===!0}}async listDeadJobs(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(v3e,"GET")).records??[]}async retryDeadJob(e){if(this.closed)throw new Error("LunoraClient is closed");return{retried:(await this.adminFetch(x3e,"POST",{id:e})).retried===!0}}async removeDeadJob(e){if(this.closed)throw new Error("LunoraClient is closed");return{removed:(await this.adminFetch(y3e,"POST",{id:e})).removed===!0}}async listWorkflowInstances(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({name:e.name});e.status!==void 0&&o.set("status",e.status),e.page!==void 0&&o.set("page",String(e.page)),e.perPage!==void 0&&o.set("perPage",String(e.perPage));let r=await this.adminFetch(`${I3e}?${o.toString()}`,"GET");return{configured:r.configured,instances:r.instances??[],page:r.page??1,perPage:r.perPage??e.perPage??0,totalCount:r.totalCount}}async getWorkflowInstance(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({id:e.id,name:e.name}),r=await this.adminFetch(`${b3e}?${o.toString()}`,"GET");return{createdOn:r.createdOn,endedOn:r.endedOn,error:r.error,id:r.id??e.id,output:r.output,params:r.params,startedOn:r.startedOn,status:r.status??"unknown",steps:r.steps??[]}}async setWorkflowInstanceStatus(e){if(this.closed)throw new Error("LunoraClient is closed");return{status:(await this.adminFetch(S3e,"POST",{action:e.action,id:e.id,name:e.name})).status??"unknown"}}subscribeScheduledJobs(e){if(this.closed)throw new Error("LunoraClient is closed");if(this.WebSocketImpl===void 0)return()=>{};let o=Sv(Wae(this.url),h3e),r=Bz(this.reconnectOptions),a,s,i=!1,c=n(()=>{if(i||this.WebSocketImpl===void 0)return;let d=this.wsToken===void 0?o:`${o}?token=${encodeURIComponent(this.wsToken)}`;a=new this.WebSocketImpl(d),a.addEventListener("open",()=>{r.reset()}),a.addEventListener("message",f=>{try{let p=JSON.parse(typeof f.data=="string"?f.data:"");p.type==="jobs"&&Array.isArray(p.records)&&e(p.records)}catch{}}),a.addEventListener("close",()=>{a=void 0,i||(s=setTimeout(c,r.next()))}),a.addEventListener("error",()=>{})},"connect");return c(),()=>{i=!0,s!==void 0&&clearTimeout(s),a?.close()}}async listFunctions(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(F3e,"GET")).functions??[]}async getCronJobs(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(R3e,"GET")).jobs??[]}async runCronJob(e){if(this.closed)throw new Error("LunoraClient is closed");let o=await this.adminFetch(E3e,"POST",{name:e});return{name:o.name??e,ran:o.ran===!0}}async fetchOpenApi(){if(this.closed)throw new Error("LunoraClient is closed");return await this.adminFetch(A3e,"GET")}async fetchOpenRpc(){if(this.closed)throw new Error("LunoraClient is closed");return await this.adminFetch(T3e,"GET")}async listStorageObjects(e={}){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams;e.prefix!==void 0&&e.prefix!==""&&o.set("prefix",e.prefix),e.cursor!==void 0&&e.cursor!==""&&o.set("cursor",e.cursor),e.limit!==void 0&&o.set("limit",String(e.limit)),e.bucket!==void 0&&e.bucket!==""&&o.set("bucket",e.bucket);let r=o.toString(),a=r===""?fM:`${fM}?${r}`,s=await this.adminFetch(a,"GET");return{cursor:s.cursor,objects:s.objects??[]}}async deleteStorageObject(e,o){if(this.closed)throw new Error("LunoraClient is closed");let r=`${fM}?key=${encodeURIComponent(e)}${zz(o?.bucket)}`,a=await this.adminFetch(r,"DELETE");return{deleted:a.deleted??!0,key:a.key??e}}async listStorageBuckets(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(C3e,"GET")).buckets??[]}async uploadStorageObject(e){if(this.closed)throw new Error("LunoraClient is closed");let o=`${fM}?key=${encodeURIComponent(e.key)}${zz(e.bucket)}`,r=await this.adminFetch(o,"PUT",e.body,e.contentType);return{etag:r.etag,key:r.key??e.key}}async signedStorageUrl(e,o){if(this.closed)throw new Error("LunoraClient is closed");let r=o?.expiresInSeconds,a=r===void 0?"":`&expiresIn=${encodeURIComponent(r.toString())}`,s=`${w3e}?key=${encodeURIComponent(e)}${a}${zz(o?.bucket)}`,i=await this.adminFetch(s,"GET");if(typeof i.url!="string")throw new TypeError("LunoraClient: storage URL endpoint returned no `url`");return i.url}async listGlobalTables(){if(this.closed)throw new Error("LunoraClient is closed");return await this.adminFetch(k3e,"GET")}async readGlobalTablePage(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({table:e.table});return e.limit!==void 0&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset)),e.filters!==void 0&&e.filters.length>0&&o.set("filters",JSON.stringify(e.filters)),await this.adminFetch(`${M3e}?${o.toString()}`,"GET")}async facetGlobalColumn(e){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams({column:e.column,table:e.table});return e.limit!==void 0&&o.set("limit",String(e.limit)),e.filters!==void 0&&e.filters.length>0&&o.set("filters",JSON.stringify(e.filters)),await this.adminFetch(`${P3e}?${o.toString()}`,"GET")}async listVectorIndexes(){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(O3e,"GET")).indexes??[]}async queryVectorIndex(e){if(this.closed)throw new Error("LunoraClient is closed");return(await this.adminFetch(N3e,"POST",e)).matches??[]}async listAuthUsers(e={}){if(this.closed)throw new Error("LunoraClient is closed");let o=YI(D3e,{filterField:e.filterField,filterValue:e.filterValue,limit:e.limit,offset:e.offset,search:e.search,searchField:e.searchField,sortBy:e.sortBy,sortDirection:e.sortDirection});return await this.adminFetch(o,"GET")}async createAuthUser(e){return await this.adminFetch(_3e,"POST",e)}async setAuthUserRole(e){return await this.adminFetch(L3e,"POST",e)}async banAuthUser(e){return await this.adminFetch(B3e,"POST",e)}async unbanAuthUser(e){return await this.adminFetch(V3e,"POST",e)}async setAuthUserPassword(e){await this.adminFetch(U3e,"POST",e)}async removeAuthUser(e){await this.adminFetch(z3e,"POST",e)}async impersonateAuthUser(e){return await this.adminFetch($3e,"POST",e)}async revokeAuthSession(e){await this.adminFetch(H3e,"POST",e)}async revokeAuthUserSessions(e){await this.adminFetch(j3e,"POST",e)}async getAuthCapabilities(){return await this.adminFetch(q3e,"GET")}async updateAuthUser(e){return await this.adminFetch(W3e,"POST",e)}async listAuthAccounts(e){return await this.adminFetch(YI(G3e,{userId:e.userId}),"GET")}async unlinkAuthAccount(e){await this.adminFetch(K3e,"POST",e)}async listAuthPasskeys(e){return await this.adminFetch(YI(Y3e,{userId:e.userId}),"GET")}async deleteAuthPasskey(e){await this.adminFetch(X3e,"POST",e)}async disableAuthTwoFactor(e){await this.adminFetch(Q3e,"POST",e)}async listAuthOrganizations(e={}){return await this.adminFetch(YI(Z3e,{limit:e.limit,offset:e.offset}),"GET")}async listAuthOrgMembers(e){let o=YI(J3e,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(o,"GET")}async listAuthOrgInvitations(e){let o=YI(eBe,{limit:e.limit,offset:e.offset,organizationId:e.organizationId});return await this.adminFetch(o,"GET")}async removeAuthOrgMember(e){await this.adminFetch(tBe,"POST",e)}async cancelAuthOrgInvitation(e){await this.adminFetch(oBe,"POST",e)}async listAuthSessions(e={}){if(this.closed)throw new Error("LunoraClient is closed");let o=new URLSearchParams;e.userId!==void 0&&e.userId!==""&&o.set("userId",e.userId),e.limit!==void 0&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset));let r=o.toString();return await this.adminFetch(r===""?qae:`${qae}?${r}`,"GET")}subscribe(e,o,r,a={}){if(this.closed)throw new Error("LunoraClient is closed");let s=o??{},i=GI.key(e.__lunoraRef,s,a.shardKey),c=this.subscriptions.get(i),d=r,f=a.onError;if(!c){this.nextSubId+=1;let m=`sub_${this.nextSubId.toString()}`,h=WI(s),v=this.takeHydratedCache(e.__lunoraRef,h,a.shardKey);c={acked:!1,args:s,argsKey:h,callbacks:new Set,checkpointCallbacks:new Set,errorCallbacks:new Set,fn:e,id:m,lastValue:v?.value,optimisticLayers:[],serverBase:v?.value,serverCursor:v?.serverCursor,shardKey:a.shardKey,...v?.serverEpoch===void 0?{}:{serverEpoch:v.serverEpoch}},this.subscriptions.add(c)}if(c.callbacks.add(d),f&&c.errorCallbacks.add(f),a.onCheckpoint&&c.checkpointCallbacks.add(a.onCheckpoint),c.lastValue!==void 0)try{d(c.lastValue)}catch{}this.ensureSocket(a.shardKey),this.sendSubscribeIfOpen(c);let p=c;return()=>{if(p.callbacks.delete(d),f&&p.errorCallbacks.delete(f),a.onCheckpoint&&p.checkpointCallbacks.delete(a.onCheckpoint),p.callbacks.size===0){let m=this.getConnection(p.shardKey);!(m&&Zl(m,{id:p.id,type:"unsubscribe"}))&&m&&m.pendingUnsubscribes.push({id:p.id,type:"unsubscribe"}),this.subscriptions.remove(p)}}}subscribeShape(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");this.nextShapeId+=1;let a=`shape_${this.nextShapeId.toString()}`,s={args:e.args,callbacks:new Set([o]),errorCallbacks:r.onError?new Set([r.onError]):new Set,id:a,name:e.name,onCheckpoint:r.onCheckpoint,rows:new Map,shardKey:r.shardKey};return this.shapeSubscriptions.set(a,s),this.ensureSocket(r.shardKey),this.sendShapeSubscribeIfOpen(s),()=>{this.shapeSubscriptions.delete(a);let i=this.getConnection(s.shardKey);!(i&&Zl(i,{id:a,type:"shape_unsubscribe"}))&&i&&i.pendingUnsubscribes.push({id:a,type:"shape_unsubscribe"})}}stream(e,o,r={}){if(this.closed)throw new Error("LunoraClient is closed");if(this.WebSocketImpl===void 0)throw new Error("LunoraClient: streams require a WebSocket implementation");this.nextStreamId+=1;let a=`stream_${this.nextStreamId.toString()}`,{shardKey:s}=r,i=o??{},{handle:c,iterable:d}=Uae({maxBuffer:r.maxBuffer,onCancel:n(()=>{let h=this.getConnection(s);h&&Zl(h,{id:a,type:"unsubscribe"}),this.streams.delete(a)},"onCancel")});this.streams.set(a,{handle:c,shardKey:s}),this.ensureSocket(s);let f=this.getConnection(s),p={id:a,query:{args:XI(i,`stream args for '${e.__lunoraRef}'`),functionPath:e.__lunoraRef,shardKey:s},type:"stream"};if(!(f?.wsState==="open"&&Zl(f,p))&&f){for(f.pendingStreams=f.pendingStreams??[];f.pendingStreams.length>=d3e;){let v=f.pendingStreams.shift()?.id,x=v?this.streams.get(v):void 0;x&&(x.handle.fail(Object.assign(new Error("stream-start frame evicted while socket was unreachable"),{code:"STREAM_QUEUE_OVERFLOW"})),this.streams.delete(v))}f.pendingStreams.push(p)}return d}close(){this.closed=!0,this.outboxLeaderRelease?.(),this.outboxLeaderRelease=void 0;for(let e of this.streams.values())e.handle.fail(Object.assign(new Error("LunoraClient closed"),{code:"CLIENT_CLOSED"}));this.streams.clear();for(let e of this.connections.values()){if(e.reconnectTimer!==void 0&&(clearTimeout(e.reconnectTimer),e.reconnectTimer=void 0),e.connectTimer!==void 0&&(clearTimeout(e.connectTimer),e.connectTimer=void 0),this.stopHeartbeat(e),e.socket){try{e.socket.close()}catch{}e.socket=void 0}e.wsState="closed"}this.offlineQueue.clear(),this.queuedIdentities.clear(),this.cacheFlushTimer!==void 0&&(clearTimeout(this.cacheFlushTimer),this.cacheFlushTimer=void 0),this.pendingCacheWrites.size>0&&this.flushQueryCacheWrites().catch(()=>{}),this.authTokenListeners.clear(),this.statusListeners.clear(),this.tokenExpiredListeners.clear(),this.mutationSettledListeners.clear(),this.pendingChangeListeners.clear(),this.whisperHandlers.clear(),this.shapeSubscriptions.clear(),this.pokeBuffers.clear()}async enqueueOfflineMutation(e,o,r,a,s,i){let c=this.identityFingerprint();if(this.outbox){this.outboxMutationCounter+=1;let d=this.outboxMutationCounter;try{await this.outbox.enqueue({args:o,clientId:this.clientId,functionPath:e.__lunoraRef,idempotencyKey:`${this.clientId}:${String(d)}`,identity:c,mutationId:d,shardKey:r})}catch(f){throw $z(s),f instanceof Error?f:new Error(String(f))}for(let f of i)f(void 0);return}return new Promise((d,f)=>{let p={args:o,functionPath:e.__lunoraRef,liveAwaiter:!0,id:a,identity:c,onCommit:n(m=>{for(let h of i)h(m)},"onCommit"),reject:n(m=>{this.queuedIdentities.delete(a),$z(s),f(m instanceof Error?m:new Error(String(m)))},"reject"),resolve:d,shardKey:r};this.offlineQueue.enqueue(p),p.id!==void 0&&this.queuedIdentities.set(p.id,c)})}async hydratePersistedQueue(){try{let e=await this.offlineQueue.hydrate();for(let o of e)this.ensureSocket(o)}catch{}}hydrateAsOutboxLeader(){let e=n(()=>{this.hydratePersistedQueue().catch(()=>{})},"hydrate"),o=globalThis.navigator?.locks;if(!o){e();return}o.request(`lunora:outbox-leader:${this.url}`,()=>(this.closed||e(),new Promise(r=>{if(this.closed){r();return}this.outboxLeaderRelease=r}))).catch(e)}async hydrateQueryCache(){if(this.queryCache)try{let e=await this.queryCache.load();for(let{key:o,...r}of e){if(_z(this.persistenceVersion,r.version)){this.queryCache.remove(o).catch(()=>{});continue}this.hydratedQueryCache.set(o,r)}}catch{}}takeHydratedCache(e,o,r){let a=Lz(e,o,r),s=this.hydratedQueryCache.get(a);if(s!==void 0)return this.hydratedQueryCache.delete(a),s.identity===this.identityFingerprint()?s:void 0}persistQueryValue(e){let o=e.serverBase;if(!this.queryCache||o===void 0)return;let r=Lz(e.fn.__lunoraRef,e.argsKey,e.shardKey);this.pendingCacheWrites.set(r,{identity:this.identityFingerprint(),serverCursor:e.serverCursor,ts:Date.now(),value:o,...e.serverEpoch===void 0?{}:{serverEpoch:e.serverEpoch},...this.persistenceVersion===void 0?{}:{version:this.persistenceVersion}}),this.cacheFlushTimer??=setTimeout(()=>{this.flushQueryCacheWrites().catch(()=>{})},u3e)}async flushQueryCacheWrites(){this.cacheFlushTimer=void 0;let{queryCache:e}=this;if(!e){this.pendingCacheWrites.clear();return}let o=[...this.pendingCacheWrites.entries()];this.pendingCacheWrites.clear(),await Promise.allSettled(o.map(([r,a])=>e.put(r,a)))}computeStatus(){let e=[...this.connections.values()];return e.length===0?"idle":e.some(o=>o.wsState==="open")?"connected":e.some(o=>o.wsState==="connecting")?"connecting":"offline"}emitConnectionStatus(){let e=this.computeStatus();e!==this.lastStatus&&(this.lastStatus=e,this.statusListeners.emit(e))}emitItemSettled(e,o,r){this.mutationSettledListeners.emit({args:e.args,code:r===void 0?void 0:r.code,error:r,functionPath:e.functionPath,hadAwaiter:e.liveAwaiter??!1,id:e.id??"",shardKey:e.shardKey,status:o})}applyOptimisticUpdates(e,o,r,a){let s=[],i=[];if(!a)return{confirms:s,rollbacks:i};let c=GI.key(e,o,r),d=this.subscriptions.get(c);if(d){let f=Nz(d,a);f&&(s.push(f.confirm),i.push(f.rollback))}return{confirms:s,rollbacks:i}}applyOptimisticUpdate(e,o,r,a,s){let{confirms:i,rollbacks:c,store:d}=Nae(this.subscriptions,r,WI);try{e(d,o)}catch{for(let f=c.length-1;f>=0;f-=1)c[f]?.();return}a.push(...c),s.push(...i)}getConnection(e){return this.connections.get(ri(e))}getOrCreateConnection(e){let o=ri(e),r=this.connections.get(o);return r||(r={connectTimer:void 0,heartbeatTimer:void 0,pendingUnsubscribes:[],reconnect:Bz(this.reconnectOptions),reconnectTimer:void 0,shardKey:e,socket:void 0,wasEverConnected:!1,wsState:"idle"},this.connections.set(o,r)),r}wsUrlFor(e){let o=[];if(e!==void 0&&o.push(`shard=${encodeURIComponent(e)}`),this.wsToken!==void 0&&o.push(`token=${encodeURIComponent(this.wsToken)}`),o.length===0)return this.wsUrl;let r=this.wsUrl.includes("?")?"&":"?";return`${this.wsUrl}${r}${o.join("&")}`}rpcRequestHeaders(e){let o={"content-type":"application/json"};if(this.authToken&&(o.authorization=`Bearer ${this.authToken}`),e.mutationId&&(o["x-lunora-mutation-id"]=e.mutationId),e.clientId!==void 0&&(o["x-lunora-client-id"]=e.clientId),e.clientSeq!==void 0&&(o["x-lunora-client-seq"]=e.clientSeq.toString()),e.attachBookmark){let r=this.bookmark.get();r&&(o["x-d1-bookmark"]=r)}return o}async rpc(e,o,r,a={}){if(!this.fetchImpl)throw new Error("LunoraClient: no `fetch` implementation available");let s=this.rpcRequestHeaders(a),i=await this.fetchImpl(Sv(this.url,n3e),{body:JSON.stringify({args:XI(o,`args for '${e}'`),functionPath:e,shardKey:r}),headers:s,method:"POST"});if(a.captureBookmark){let d=i.headers.get("x-d1-bookmark");d&&this.bookmark.set(d)}let c;try{c=await i.json()}catch{let d=i.statusText?` ${i.statusText}`:"";throw new Error(`LunoraClient: response was not JSON (status ${i.status.toString()}${d})`)}if("error"in c)throw mF(c.error);if(!i.ok){let d=i.statusText?` ${i.statusText}`:"";throw new Error(`LunoraClient: request failed (status ${i.status.toString()}${d})`)}return a.onMutationAck?.(c.lastMutationId),a.onCommitCursor?.(c.commitCursor),rs(c.result)}async adminFetch(e,o,r,a){if(!this.fetchImpl)throw new Error("LunoraClient: no `fetch` implementation available");let s={};this.authToken&&(s.authorization=`Bearer ${this.authToken}`);let i=r instanceof ArrayBuffer||r instanceof Blob,c;r===void 0?c=void 0:i?(c=r,a!==void 0&&(s["content-type"]=a)):(c=JSON.stringify(r),s["content-type"]="application/json");let d=await this.fetchImpl(Sv(this.url,e),{body:c,headers:s,method:o}),f;try{f=await d.json()}catch{let p=d.statusText?` ${d.statusText}`:"";throw new Error(`LunoraClient: response was not JSON (status ${d.status.toString()}${p})`)}if(typeof f=="object"&&f!==null&&"error"in f){let p=f.error,m=new Error(p.message??"admin request failed");throw m.code=p.code,m}if(!d.ok){let p=d.statusText?` ${d.statusText}`:"";throw new Error(`LunoraClient: admin request failed (status ${d.status.toString()}${p})`)}return f}effectiveConnectionContext(e){let o=this.connectionContextHolders.get(e);return o&&o.length>0?o[o.length-1]?.context:this.connectionContexts.get(e)??this.defaultConnectionContext}refreshConnectionContext(e){let o=this.connections.get(e);o?.wsState==="open"&&this.sendConnectEnvelope(o)}sendConnectEnvelope(e){let o=this.effectiveConnectionContext(ri(e.shardKey));Zl(e,{clientId:this.clientId,id:"connect",type:"connect",...o===void 0?{}:{context:o}})}resendShapeSubscriptions(e){for(let o of this.shapeSubscriptions.values())ri(o.shardKey)===ri(e)&&this.sendShapeSubscribeIfOpen(o)}ensureSocket(e){if(this.closed||this.WebSocketImpl===void 0)return;let o=this.getOrCreateConnection(e);if(o.wsState==="open"||o.wsState==="connecting")return;o.wsState="connecting",this.emitConnectionStatus();let r=new this.WebSocketImpl(this.wsUrlFor(e));o.socket=r,this.connectTimeoutMs>0&&(o.connectTimer=setTimeout(()=>{if(o.connectTimer=void 0,!(o.socket!==r||o.wsState!=="connecting")){try{r.close()}catch{}this.handleDisconnect(o)}},this.connectTimeoutMs)),r.addEventListener("open",()=>{if(o.socket!==r)return;o.connectTimer!==void 0&&(clearTimeout(o.connectTimer),o.connectTimer=void 0),o.wsState="open",o.wasEverConnected=!0,o.reconnect.reset(),this.emitConnectionStatus(),this.sendConnectEnvelope(o),this.markShardPendingAck(e);for(let s of this.subscriptions.all())ri(s.shardKey)===ri(e)&&this.sendSubscribeIfOpen(s);if(this.resendShapeSubscriptions(e),o.pendingUnsubscribes.length>0){let s=o.pendingUnsubscribes;o.pendingUnsubscribes=[];for(let{id:i,type:c}of s)Zl(o,{id:i,type:c})}if(o.pendingStreams&&o.pendingStreams.length>0){let s=o.pendingStreams;o.pendingStreams=[];for(let i of s)Zl(o,i)}let a=this.whisperHandlers.get(ri(e));if(a)for(let s of a.keys())Zl(o,{topic:s,type:"whisper_subscribe"});this.flushOfflineQueue(e).catch(()=>{}),this.startHeartbeat(o)}),r.addEventListener("message",a=>{this.handleServerMessage(a.data,e)}),r.addEventListener("close",a=>{o.socket===r&&(a?.code===4001&&this.notifyTokenExpired(),this.handleDisconnect(o))}),r.addEventListener("error",()=>{o.socket===r&&(o.wsState==="connecting"||o.wsState==="open")&&this.handleDisconnect(o)})}handleDisconnect(e){if(this.closed||e.wsState==="idle"||e.wsState==="closed"||(this.stopHeartbeat(e),e.connectTimer!==void 0&&(clearTimeout(e.connectTimer),e.connectTimer=void 0),e.socket=void 0,e.wsState="idle",this.emitConnectionStatus(),this.markShardPendingAck(e.shardKey),this.WebSocketImpl===void 0))return;let o=e.reconnect.next();e.reconnectTimer=setTimeout(()=>{e.reconnectTimer=void 0,this.ensureSocket(e.shardKey)},o)}startHeartbeat(e){this.stopHeartbeat(e),!(this.heartbeatIntervalMs<=0)&&(e.heartbeatTimer=setInterval(()=>{if(!(e.wsState!=="open"||!e.socket))try{e.socket.send(i3e)}catch{}},this.heartbeatIntervalMs))}stopHeartbeat(e){e.heartbeatTimer!==void 0&&(clearInterval(e.heartbeatTimer),e.heartbeatTimer=void 0)}markShardPendingAck(e){let o=ri(e);for(let r of this.subscriptions.all())ri(r.shardKey)===o&&(r.acked=!1)}sendSubscribeIfOpen(e){let o=this.getConnection(e.shardKey);if(o?.wsState!=="open"||e.acked)return;let r=e.fn.__lunoraTable??e.fn.__lunoraRef;Zl(o,{id:e.id,query:{args:e.args,functionPath:e.fn.__lunoraRef,table:r,...e.serverCursor===void 0?{}:{sinceSeq:e.serverCursor},...e.serverEpoch===void 0?{}:{sinceEpoch:e.serverEpoch}},type:"subscribe"})}sendShapeSubscribeIfOpen(e){let o=this.getConnection(e.shardKey);o?.wsState==="open"&&Zl(o,{id:e.id,shape:{name:e.name,...e.args===void 0?{}:{args:e.args}},type:"shape_subscribe",...e.serverCursor===void 0?{}:{sinceCheckpoint:e.serverCursor},...e.serverEpoch===void 0?{}:{sinceEpoch:e.serverEpoch}})}handleServerMessage(e,o){let r=iBe(e);if(r===void 0)return;let a;try{a=JSON.parse(r)}catch{return}switch(a.type){case"ack":{let s=this.subscriptions.getById(a.id);s&&(s.acked=!0);return}case"chunk":{let{data:s,id:i}=a;this.streams.get(i)?.handle.push(rs(s));return}case"complete":{this.handleCompleteMessage(a.id);return}case"data":case"delta":{this.handleDataMessage(a);return}case"error":{this.handleErrorMessage(a);break}case"pokeEnd":{this.handlePokeEnd(a);break}case"pokePart":{this.handlePokePart(a);break}case"pokeStart":{this.handlePokeStart(a);break}case"resume":{this.handleResumeMessage(a);break}case"settled":{this.handleSettledMessage(a);break}case"whisper":{this.dispatchWhisper(a,o);break}}}handleErrorMessage(e){if(e.error?.code==="TOKEN_EXPIRED"){this.notifyTokenExpired();return}let{id:r}=e,a=r===void 0?void 0:this.streams.get(r);if(a&&r!==void 0){a.handle.fail(aBe(e)),this.streams.delete(r);return}let s=r===void 0?void 0:this.subscriptions.getById(r);if(s){Kae(s.errorCallbacks,Gae(e));return}let i=r===void 0?void 0:this.shapeSubscriptions.get(r);i&&Kae(i.errorCallbacks,Gae(e))}handlePokeStart(e){if(this.pokeBuffers.size>=t.MAX_POKE_BUFFERS){let o=this.pokeBuffers.keys().next().value;o!==void 0&&this.pokeBuffers.delete(o)}this.pokeBuffers.set(e.pokeId,{baseCheckpoint:e.baseCheckpoint,epoch:e.epoch,lastMutationId:new Map,parts:new Map})}handlePokePart(e){let o=this.pokeBuffers.get(e.pokeId);if(!o)return;let r=o.parts.get(e.shapeId)??[];for(let a of e.rowsPatch)r.push(a.value===void 0?a:{...a,value:rs(a.value)});o.parts.set(e.shapeId,r),e.lastMutationId!==void 0&&o.lastMutationId.set(e.shapeId,e.lastMutationId)}handlePokeEnd(e){let o=this.pokeBuffers.get(e.pokeId);if(o){this.pokeBuffers.delete(e.pokeId);for(let[r,a]of o.parts){let s=this.shapeSubscriptions.get(r);if(!s)continue;let i=o.epoch!==void 0&&s.serverEpoch!==void 0&&o.epoch!==s.serverEpoch,c=o.baseCheckpoint!==void 0&&s.serverCursor!==void 0&&s.serverCursor!==o.baseCheckpoint;if(i||c){s.rows.clear(),s.serverCursor=void 0,s.serverEpoch=void 0,this.emitShapeRows(s),this.sendShapeSubscribeIfOpen(s);continue}s3e(s.rows,a),e.checkpoint!==void 0&&(s.serverCursor=e.checkpoint),e.epoch!==void 0&&(s.serverEpoch=e.epoch);let d=o.lastMutationId.get(r);d!==void 0&&(s.lastMutationId=d),this.emitShapeRows(s),s.onCheckpoint?.({checkpoint:s.serverCursor,mutationId:s.lastMutationId})}}}emitShapeRows(e){let o=[...e.rows.values()];for(let r of e.callbacks)try{r(o)}catch{}}handleDataMessage(e){let{id:o}=e,r=o?this.subscriptions.getById(o):void 0;if(!r)return;let a=this.resolveDataPayload(e,r);r.serverBase=a,e.cursor!==void 0&&(r.serverCursor=e.cursor),e.epoch!==void 0&&(r.serverEpoch=e.epoch),this.persistQueryValue(r),Dz(r,r.serverCursor),dF(r,r.optimisticLayers.length===0?a:cM(a,r.optimisticLayers))}handleResumeMessage(e){let o=this.subscriptions.getById(e.id);o&&this.ackAndAdvanceCursor(o,e.cursor,e.epoch)}handleSettledMessage(e){let o=this.subscriptions.getById(e.id);if(o){this.ackAndAdvanceCursor(o,e.cursor,e.epoch),e.lastMutationId!==void 0&&(o.lastMutationId=e.lastMutationId);for(let r of o.checkpointCallbacks)r({checkpoint:o.serverCursor,mutationId:o.lastMutationId})}}ackAndAdvanceCursor(e,o,r){e.acked=!0,(o!==void 0&&o!==e.serverCursor||r!==void 0&&r!==e.serverEpoch)&&(o!==void 0&&(e.serverCursor=o),r!==void 0&&(e.serverEpoch=r),this.persistQueryValue(e),Dz(e,e.serverCursor)&&dF(e,cM(e.serverBase,e.optimisticLayers)))}resolveDataPayload(e,o){if("data"in e&&e.data!==void 0)return rs(e.data);let r=rs(e.delta);if(Pae(r)&&o.serverBase!==void 0){let a=Oae(o.serverBase,r);if(a!==void 0)return a}return r}dispatchWhisper(e,o){let r=this.whisperHandlers.get(ri(o))?.get(e.topic);if(!r)return;let a=rs(e.data);for(let s of r)try{s(a,e.from)}catch{}}notifyTokenExpired(){this.tokenExpiredListeners.emit()}handleCompleteMessage(e){let o=this.streams.get(e);if(o){o.handle.complete(),this.streams.delete(e);return}let r=this.subscriptions.getById(e);r&&this.subscriptions.remove(r)}unpersist(e){e&&this.persistence?.remove(e).catch(o=>{KI(this.onPersistenceError,"remove",o,e)})}identityFingerprint(){if(this.authSubject!==void 0)return this.authSubject===null?null:`subj:${this.authSubject}`;let e=this.authToken;if(e===null)return null;let o=2166136261,r=5381;for(let a=0;a<e.length;a+=1){let s=e.charCodeAt(a);o^=s,o=Math.imul(o,16777619),r=Math.imul(r,33)+s}return`${e.length.toString(36)}:${(o>>>0).toString(36)}:${(r>>>0).toString(36)}`}rejectQueuedForIdentityChange(){let e=this.offlineQueue.drain();for(let o of e){this.queuedIdentities.delete(o.id??""),this.unpersist(o.id);let r=new Error("offline mutation discarded: auth identity changed before replay");r.code="OFFLINE_IDENTITY_CHANGED",o.reject(r),this.emitItemSettled(o,"rejected",r)}this.clearQueryCacheForIdentityChange()}restampQueuedIdentity(e,o){for(let[r,a]of this.queuedIdentities)a===e&&this.queuedIdentities.set(r,o)}clearQueryCacheForIdentityChange(){this.cacheFlushTimer!==void 0&&(clearTimeout(this.cacheFlushTimer),this.cacheFlushTimer=void 0),this.pendingCacheWrites.clear(),this.hydratedQueryCache.clear(),this.queryCache?.clear().catch(()=>{})}async flushOfflineQueue(e){let o=ri(e),r=this.offlineQueue.drain(d=>ri(d.shardKey)===o);if(r.length===0)return;let a=this.identityFingerprint(),s=[];for(let d of r)this.passesReplayIdentityGate(d,a)&&s.push(d);if(s.length===0)return;let i=this.encodableOrSettleTerminal(s);if(i.length===0)return;if(i.length===1){await this.replaySequential(i);return}let c=[];for(let d=0;d<i.length;d+=Vz){let f=i.slice(d,d+Vz),p=await this.replayBatched(f);if(c.push(...p.requeue),p.stop){c.push(...i.slice(d+Vz));break}}c.length>0&&this.offlineQueue.requeue(c)}encodableOrSettleTerminal(e){let o=[];for(let r of e)try{XI(r.args,`args for '${r.functionPath}'`),o.push(r)}catch(a){this.settleReplayTerminal(r,a instanceof Error?a:new Error(String(a)))}return o}passesReplayIdentityGate(e,o){let r=e.id===void 0?void 0:this.queuedIdentities.get(e.id),a=r===void 0?e.identity:r;if(a!==void 0&&a!==o){this.queuedIdentities.delete(e.id??""),this.unpersist(e.id);let s=new Error("offline mutation skipped: auth identity changed before replay");return s.code="OFFLINE_IDENTITY_CHANGED",e.reject(s),this.emitItemSettled(e,"rejected",s),!1}return this.queuedIdentities.delete(e.id??""),!0}settleReplaySuccess(e,o,r){this.unpersist(e.id),e.onCommit?.(r),e.resolve(o),this.emitItemSettled(e,"committed")}settleReplayTerminal(e,o){this.unpersist(e.id),e.reject(o),this.emitItemSettled(e,"rejected",o)}async replaySequential(e){for(let o=0;o<e.length;o+=1){let r=e[o];if(r)try{let a,s=await this.rpc(r.functionPath,r.args,r.shardKey,{captureBookmark:!0,mutationId:r.id,onCommitCursor:n(i=>{a=i},"onCommitCursor")});this.settleReplaySuccess(r,s,a)}catch(a){if(a.code!==void 0){this.settleReplayTerminal(r,a);continue}this.offlineQueue.requeue(e.slice(o));return}}}async replayBatched(e){if(!this.fetchImpl)return{requeue:e,stop:!0};let o;try{o=await this.fetchImpl(Sv(this.url,jae),{body:JSON.stringify({calls:e.map((s,i)=>({args:XI(s.args,`args for '${s.functionPath}'`),functionPath:s.functionPath,id:i,mutationId:s.id,shardKey:s.shardKey}))}),headers:this.rpcRequestHeaders({attachBookmark:!0}),method:"POST"})}catch{return{requeue:e,stop:!0}}let r=o.headers.get("x-d1-bookmark");r&&this.bookmark.set(r);let a;try{a=await o.json()}catch{return{requeue:e,stop:!0}}if(!a.results){if(a.error){let s=mF(a.error);for(let i of e)this.settleReplayTerminal(i,s);return{requeue:[],stop:!1}}return{requeue:e,stop:!0}}return{requeue:this.settleReplayBatchSlots(e,a.results),stop:!1}}settleReplayBatchSlots(e,o){let r=new Map;for(let s of o)typeof s.id=="number"&&s.body!==void 0&&r.set(s.id,s.body);let a=[];for(let[s,i]of e.entries()){let c=r.get(s);c===void 0?a.push(i):"error"in c?cBe.has(c.error.code)?a.push(i):this.settleReplayTerminal(i,mF(c.error)):this.settleReplaySuccess(i,rs(c.result),c.commitCursor)}return a}};var kse=K(Eo(),1);var Wd=class{static{n(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 uBe=class extends Wd{static{n(this,"FocusManager")}#t;#e;#o;constructor(){super(),this.#o=t=>{if(typeof window<"u"&&window.addEventListener){let e=n(()=>t(),"listener");return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#o)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#o=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},QI=new uBe;var dBe={setTimeout:n((t,e)=>setTimeout(t,e),"setTimeout"),clearTimeout:n(t=>clearTimeout(t),"clearTimeout"),setInterval:n((t,e)=>setInterval(t,e),"setInterval"),clearInterval:n(t=>clearInterval(t),"clearInterval")},fBe=class{static{n(this,"TimeoutManager")}#t=dBe;#e=!1;setTimeoutProvider(t){this.#e&&t!==this.#t&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#t,provider:t}),this.#t=t,this.#e=!1}setTimeout(t,e){return this.#e=!0,this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#e=!0,this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},Gd=new fBe;function Yae(t){setTimeout(t,0)}n(Yae,"systemSetTimeoutZero");var jz=typeof window>"u"||"Deno"in globalThis;function Ua(){}n(Ua,"noop");function Zae(t,e){return typeof t=="function"?t(e):t}n(Zae,"functionalUpdate");function gF(t){return typeof t=="number"&&t>=0&&t!==1/0}n(gF,"isValidTimeout");function hM(t,e){return Math.max(t+(e||0)-Date.now(),0)}n(hM,"timeUntilStale");function $u(t,e){return typeof t=="function"?t(e):t}n($u,"resolveStaleTime");function Bi(t,e){return typeof t=="function"?t(e):t}n(Bi,"resolveQueryBoolean");function gM(t,e){let{type:o="all",exact:r,fetchStatus:a,predicate:s,queryKey:i,stale:c}=t;if(i){if(r){if(e.queryHash!==vF(i,e.options))return!1}else if(!Rv(e.queryKey,i))return!1}if(o!=="all"){let d=e.isActive();if(o==="active"&&!d||o==="inactive"&&d)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||a&&a!==e.state.fetchStatus||s&&!s(e))}n(gM,"matchQuery");function vM(t,e){let{exact:o,status:r,predicate:a,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(o){if(Cv(e.options.mutationKey)!==Cv(s))return!1}else if(!Rv(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||a&&!a(e))}n(vM,"matchMutation");function vF(t,e){return(e?.queryKeyHashFn||Cv)(t)}n(vF,"hashQueryKeyByOptions");function Cv(t){return JSON.stringify(t,(e,o)=>Hz(o)?Object.keys(o).sort().reduce((r,a)=>(r[a]=o[a],r),{}):o)}n(Cv,"hashKey");function Rv(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(o=>Rv(t[o],e[o])):!1}n(Rv,"partialMatchKey");var pBe=Object.prototype.hasOwnProperty;function mM(t,e,o=0){if(t===e)return t;if(o>500)return e;let r=Xae(t)&&Xae(e);if(!r&&!(Hz(t)&&Hz(e)))return e;let s=(r?t:Object.keys(t)).length,i=r?e:Object.keys(e),c=i.length,d=r?new Array(c):{},f=0;for(let p=0;p<c;p++){let m=r?p:i[p],h=t[m],v=e[m];if(h===v){d[m]=h,(r?p<s:pBe.call(t,m))&&f++;continue}if(h===null||v===null||typeof h!="object"||typeof v!="object"){d[m]=v;continue}let x=mM(h,v,o+1);d[m]=x,x===h&&f++}return s===c&&f===s?t:d}n(mM,"replaceEqualDeep");function xM(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let o in t)if(t[o]!==e[o])return!1;return!0}n(xM,"shallowEqualObjects");function Xae(t){return Array.isArray(t)&&t.length===Object.keys(t).length}n(Xae,"isPlainArray");function Hz(t){if(!Qae(t))return!1;let e=t.constructor;if(e===void 0)return!0;let o=e.prototype;return!(!Qae(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}n(Hz,"isPlainObject");function Qae(t){return Object.prototype.toString.call(t)==="[object Object]"}n(Qae,"hasObjectPrototype");function Jae(t){return new Promise(e=>{Gd.setTimeout(e,t)})}n(Jae,"sleep");function xF(t,e,o){if(typeof o.structuralSharing=="function")return o.structuralSharing(t,e);if(o.structuralSharing!==!1){try{return mM(t,e)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${o.queryHash}]: ${r}`),r}return mM(t,e)}return e}n(xF,"replaceData");function qz(t){return t}n(qz,"keepPreviousData");function ese(t,e,o=0){let r=[...t,e];return o&&r.length>o?r.slice(1):r}n(ese,"addToEnd");function tse(t,e,o=0){let r=[e,...t];return o&&r.length>o?r.slice(0,-1):r}n(tse,"addToStart");var Fv=Symbol();function yM(t,e){return t.queryFn===Fv&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===Fv?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}n(yM,"ensureQueryFn");function IM(t,e){return typeof t=="function"?t(...e):!!t}n(IM,"shouldThrowError");function ose(t,e,o){let r=!1,a;return Object.defineProperty(t,"signal",{enumerable:!0,get:n(()=>(a??=e(),r||(r=!0,a.aborted?o():a.addEventListener("abort",o,{once:!0})),a),"get")}),t}n(ose,"addConsumeAwareSignal");var Kd=(()=>{let t=n(()=>jz,"isServerFn");return{isServer(){return t()},setIsServer(e){t=e}}})();function yF(){let t,e,o=new Promise((a,s)=>{t=a,e=s});o.status="pending",o.catch(()=>{});function r(a){Object.assign(o,a),delete o.resolve,delete o.reject}return n(r,"finalize"),o.resolve=a=>{r({status:"fulfilled",value:a}),t(a)},o.reject=a=>{r({status:"rejected",reason:a}),e(a)},o}n(yF,"pendingThenable");var rse=Yae;function mBe(){let t=[],e=0,o=n(c=>{c()},"notifyFn"),r=n(c=>{c()},"batchNotifyFn"),a=rse,s=n(c=>{e?t.push(c):a(()=>{o(c)})},"schedule"),i=n(()=>{let c=t;t=[],c.length&&a(()=>{r(()=>{c.forEach(d=>{o(d)})})})},"flush");return{batch:n(c=>{let d;e++;try{d=c()}finally{e--,e||i()}return d},"batch"),batchCalls:n(c=>(...d)=>{s(()=>{c(...d)})},"batchCalls"),schedule:s,setNotifyFunction:n(c=>{o=c},"setNotifyFunction"),setBatchNotifyFunction:n(c=>{r=c},"setBatchNotifyFunction"),setScheduler:n(c=>{a=c},"setScheduler")}}n(mBe,"createNotifyManager");var _n=mBe();var hBe=class extends Wd{static{n(this,"OnlineManager")}#t=!0;#e;#o;constructor(){super(),this.#o=t=>{if(typeof window<"u"&&window.addEventListener){let e=n(()=>t(!0),"onlineListener"),o=n(()=>t(!1),"offlineListener");return window.addEventListener("online",e,!1),window.addEventListener("offline",o,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",o)}}}}onSubscribe(){this.#e||this.setEventListener(this.#o)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#o=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(o=>{o(t)}))}isOnline(){return this.#t}},ZI=new hBe;function gBe(t){return Math.min(1e3*2**t,3e4)}n(gBe,"defaultRetryDelay");function Wz(t){return(t??"online")==="online"?ZI.isOnline():!0}n(Wz,"canFetch");var bM=class extends Error{static{n(this,"CancelledError")}constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function SM(t){let e=!1,o=0,r,a=yF(),s=n(()=>a.status!=="pending","isResolved"),i=n(y=>{if(!s()){let b=new bM(y);h(b),t.onCancel?.(b)}},"cancel"),c=n(()=>{e=!0},"cancelRetry"),d=n(()=>{e=!1},"continueRetry"),f=n(()=>QI.isFocused()&&(t.networkMode==="always"||ZI.isOnline())&&t.canRun(),"canContinue"),p=n(()=>Wz(t.networkMode)&&t.canRun(),"canStart"),m=n(y=>{s()||(r?.(),a.resolve(y))},"resolve"),h=n(y=>{s()||(r?.(),a.reject(y))},"reject"),v=n(()=>new Promise(y=>{r=n(b=>{(s()||f())&&y(b)},"continueFn"),t.onPause?.()}).then(()=>{r=void 0,s()||t.onContinue?.()}),"pause"),x=n(()=>{if(s())return;let y,b=o===0?t.initialPromise:void 0;try{y=b??t.fn()}catch(S){y=Promise.reject(S)}Promise.resolve(y).then(m).catch(S=>{if(s())return;let w=t.retry??(Kd.isServer()?0:3),C=t.retryDelay??gBe,F=typeof C=="function"?C(o,S):C,T=w===!0||typeof w=="number"&&o<w||typeof w=="function"&&w(o,S);if(e||!T){h(S);return}o++,t.onFail?.(o,S),Jae(F).then(()=>f()?void 0:v()).then(()=>{e?h(S):x()})})},"run");return{promise:a,status:n(()=>a.status,"status"),cancel:i,continue:n(()=>(r?.(),a),"continue"),cancelRetry:c,continueRetry:d,canStart:p,start:n(()=>(p()?x():v().then(x),a),"start")}}n(SM,"createRetryer");var wM=class{static{n(this,"Removable")}#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gF(this.gcTime)&&(this.#t=Gd.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Kd.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#t!==void 0&&(Gd.clearTimeout(this.#t),this.#t=void 0)}};function ase(t){return{onFetch:n((e,o)=>{let r=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,s=e.state.data?.pages||[],i=e.state.data?.pageParams||[],c={pages:[],pageParams:[]},d=0,f=n(async()=>{let p=!1,m=n(x=>{ose(x,()=>e.signal,()=>p=!0)},"addSignalProperty"),h=yM(e.options,e.fetchOptions),v=n(async(x,y,b)=>{if(p)return Promise.reject(e.signal.reason);if(y==null&&x.pages.length)return Promise.resolve(x);let w=n(()=>{let E={client:e.client,queryKey:e.queryKey,pageParam:y,direction:b?"backward":"forward",meta:e.options.meta};return m(E),E},"createQueryFnContext")(),C=await h(w),{maxPages:F}=e.options,T=b?tse:ese;return{pages:T(x.pages,C,F),pageParams:T(x.pageParams,y,F)}},"fetchPage");if(a&&s.length){let x=a==="backward",y=x?vBe:nse,b={pages:s,pageParams:i},S=y(r,b);c=await v(b,S,x)}else{let x=t??s.length;do{let y=d===0?i[0]??r.initialPageParam:nse(r,c);if(d>0&&y==null)break;c=await v(c,y),d++}while(d<x)}return c},"fetchFn");e.options.persister?e.fetchFn=()=>e.options.persister?.(f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},o):e.fetchFn=f},"onFetch")}}n(ase,"infiniteQueryBehavior");function nse(t,{pages:e,pageParams:o}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,o[r],o):void 0}n(nse,"getNextPageParam");function vBe(t,{pages:e,pageParams:o}){return e.length>0?t.getPreviousPageParam?.(e[0],e,o[0],o):void 0}n(vBe,"getPreviousPageParam");var lse=class extends wM{static{n(this,"Query")}#t;#e;#o;#r;#a;#n;#i;#s;constructor(t){super(),this.#s=!1,this.#i=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#a=t.client,this.#r=this.#a.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=ise(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#t}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#i,...t},t?._type&&(this.#t=t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ise(this.options);e.data!==void 0&&(this.setState(sse(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){let o=xF(this.state.data,t,this.options);return this.#l({data:o,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),o}setState(t){this.#l({type:"setState",state:t})}cancel(t){let e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(Ua).catch(Ua):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Bi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>$u(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:!hM(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.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.#n&&(this.#s||this.#u()?this.#n.cancel({revert:!0}):this.#n.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.#l({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){let d=this.observers.find(f=>f.options.queryFn);d&&this.setOptions(d.options)}Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']");let o=new AbortController,r=n(d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:n(()=>(this.#s=!0,o.signal),"get")})},"addSignalProperty"),a=n(()=>{let d=yM(this.options,e),p=n(()=>{let m={client:this.#a,queryKey:this.queryKey,meta:this.meta};return r(m),m},"createQueryFnContext")();return this.#s=!1,this.options.persister?this.options.persister(d,p,this):d(p)},"fetchFn"),i=n(()=>{let d={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:a};return r(d),d},"createFetchContext")();(this.#t==="infinite"?ase(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#o=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#l({type:"fetch",meta:i.fetchOptions?.meta}),this.#n=SM({initialPromise:e?.initialPromise,fn:i.fetchFn,onCancel:n(d=>{d instanceof bM&&d.revert&&this.setState({...this.#o,fetchStatus:"idle"}),o.abort()},"onCancel"),onFail:n((d,f)=>{this.#l({type:"failed",failureCount:d,error:f})},"onFail"),onPause:n(()=>{this.#l({type:"pause"})},"onPause"),onContinue:n(()=>{this.#l({type:"continue"})},"onContinue"),retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:n(()=>!0,"canRun")});try{let d=await this.#n.start();if(d===void 0)throw console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#r.config.onSuccess?.(d,this),this.#r.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof bM){if(d.silent)return this.#n.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#l({type:"error",error:d}),this.#r.config.onError?.(d,this),this.#r.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#l(t){let e=n(o=>{switch(t.type){case"failed":return{...o,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...o,fetchStatus:"paused"};case"continue":return{...o,fetchStatus:"fetching"};case"fetch":return{...o,...Gz(o.data,this.options),fetchMeta:t.meta??null};case"success":let r={...o,...sse(t.data,t.dataUpdatedAt),dataUpdateCount:o.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#o=t.manual?r:void 0,r;case"error":let a=t.error;return{...o,error:a,errorUpdateCount:o.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:o.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...o,isInvalidated:!0};case"setState":return{...o,...t.state}}},"reducer");this.state=e(this.state),_n.batch(()=>{this.observers.forEach(o=>{o.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Gz(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wz(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}n(Gz,"fetchState");function sse(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}n(sse,"successState");function ise(t){let e=typeof t.initialData=="function"?t.initialData():t.initialData,o=e!==void 0,r=o?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:o?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}n(ise,"getDefaultState");var Yz=class extends Wd{static{n(this,"QueryObserver")}constructor(t,e){super(),this.options=e,this.#t=t,this.#s=null,this.#i=yF(),this.bindMethods(),this.setOptions(e)}#t;#e=void 0;#o=void 0;#r=void 0;#a;#n;#i;#s;#u;#l;#m;#d;#f;#c;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),cse(this.#e,this.options)?this.#p():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Kz(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Kz(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#I(),this.#b(),this.#e.removeObserver(this)}setOptions(t){let e=this.options,o=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Bi(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),e._defaulted&&!xM(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});let r=this.hasListeners();r&&use(this.#e,o,this.options,e)&&this.#p(),this.updateResult(),r&&(this.#e!==o||Bi(this.options.enabled,this.#e)!==Bi(e.enabled,this.#e)||$u(this.options.staleTime,this.#e)!==$u(e.staleTime,this.#e))&&this.#g();let a=this.#v();r&&(this.#e!==o||Bi(this.options.enabled,this.#e)!==Bi(e.enabled,this.#e)||a!==this.#c)&&this.#x(a)}getOptimisticResult(t){let e=this.#t.getQueryCache().build(this.#t,t),o=this.createResult(e,t);return yBe(this,o)&&(this.#r=o,this.#n=this.options,this.#a=this.#e.state),o}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:n((o,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,r)),"get")})}trackProp(t){this.#h.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#t.defaultQueryOptions(t),o=this.#t.getQueryCache().build(this.#t,e);return o.fetch().then(()=>this.createResult(o,e))}fetch(t){return this.#p({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(t){this.#S();let e=this.#e.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Ua)),e}#g(){this.#I();let t=$u(this.options.staleTime,this.#e);if(Kd.isServer()||this.#r.isStale||!gF(t))return;let o=hM(this.#r.dataUpdatedAt,t)+1;this.#d=Gd.setTimeout(()=>{this.#r.isStale||this.updateResult()},o)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#x(t){this.#b(),this.#c=t,!(Kd.isServer()||Bi(this.options.enabled,this.#e)===!1||!gF(this.#c)||this.#c===0)&&(this.#f=Gd.setInterval(()=>{(this.options.refetchIntervalInBackground||QI.isFocused())&&this.#p()},this.#c))}#y(){this.#g(),this.#x(this.#v())}#I(){this.#d!==void 0&&(Gd.clearTimeout(this.#d),this.#d=void 0)}#b(){this.#f!==void 0&&(Gd.clearInterval(this.#f),this.#f=void 0)}createResult(t,e){let o=this.#e,r=this.options,a=this.#r,s=this.#a,i=this.#n,d=t!==o?t.state:this.#o,{state:f}=t,p={...f},m=!1,h;if(e._optimisticResults){let O=this.hasListeners(),D=!O&&cse(t,e),M=O&&use(t,o,e,r);(D||M)&&(p={...p,...Gz(f.data,t.options)}),e._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:v,errorUpdatedAt:x,status:y}=p;h=p.data;let b=!1;if(e.placeholderData!==void 0&&h===void 0&&y==="pending"){let O;a?.isPlaceholderData&&e.placeholderData===i?.placeholderData?(O=a.data,b=!0):O=typeof e.placeholderData=="function"?e.placeholderData(this.#m?.state.data,this.#m):e.placeholderData,O!==void 0&&(y="success",h=xF(a?.data,O,e),m=!0)}if(e.select&&h!==void 0&&!b)if(a&&h===s?.data&&e.select===this.#u)h=this.#l;else try{this.#u=e.select,h=e.select(h),h=xF(a?.data,h,e),this.#l=h,this.#s=null}catch(O){this.#s=O}this.#s&&(v=this.#s,h=this.#l,x=Date.now(),y="error");let S=p.fetchStatus==="fetching",w=y==="pending",C=y==="error",F=w&&S,T=h!==void 0,k={status:y,fetchStatus:p.fetchStatus,isPending:w,isSuccess:y==="success",isError:C,isInitialLoading:F,isLoading:F,data:h,dataUpdatedAt:p.dataUpdatedAt,error:v,errorUpdatedAt:x,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:S,isRefetching:S&&!w,isLoadingError:C&&!T,isPaused:p.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&T,isStale:Xz(t,e),refetch:this.refetch,promise:this.#i,isEnabled:Bi(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){let O=k.data!==void 0,D=k.status==="error"&&!O,M=n(W=>{D?W.reject(k.error):O&&W.resolve(k.data)},"finalizeThenableIfPossible"),L=n(()=>{let W=this.#i=k.promise=yF();M(W)},"recreateThenable"),U=this.#i;switch(U.status){case"pending":t.queryHash===o.queryHash&&M(U);break;case"fulfilled":(D||k.data!==U.value)&&L();break;case"rejected":(!D||k.error!==U.reason)&&L();break}}return k}updateResult(){let t=this.#r,e=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#n=this.options,this.#a.data!==void 0&&(this.#m=this.#e),xM(e,t))return;this.#r=e;let o=n(()=>{if(!t)return!0;let{notifyOnChangeProps:r}=this.options,a=typeof r=="function"?r():r;if(a==="all"||!a&&!this.#h.size)return!0;let s=new Set(a??this.#h);return this.options.throwOnError&&s.add("error"),Object.keys(this.#r).some(i=>{let c=i;return this.#r[c]!==t[c]&&s.has(c)})},"shouldNotifyListeners");this.#w({listeners:o()})}#S(){let t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;let e=this.#e;this.#e=t,this.#o=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#w(t){_n.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function xBe(t,e){return Bi(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Bi(e.retryOnMount,t)===!1)}n(xBe,"shouldLoadOnMount");function cse(t,e){return xBe(t,e)||t.state.data!==void 0&&Kz(t,e,e.refetchOnMount)}n(cse,"shouldFetchOnMount");function Kz(t,e,o){if(Bi(e.enabled,t)!==!1&&$u(e.staleTime,t)!=="static"){let r=typeof o=="function"?o(t):o;return r==="always"||r!==!1&&Xz(t,e)}return!1}n(Kz,"shouldFetchOn");function use(t,e,o,r){return(t!==e||Bi(r.enabled,t)===!1)&&(!o.suspense||t.state.status!=="error")&&Xz(t,o)}n(use,"shouldFetchOptionally");function Xz(t,e){return Bi(e.enabled,t)!==!1&&t.isStaleByTime($u(e.staleTime,t))}n(Xz,"isStale");function yBe(t,e){return!xM(t.getCurrentResult(),e)}n(yBe,"shouldAssignObserverCurrentProperties");var dse=class extends wM{static{n(this,"Mutation")}#t;#e;#o;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#o=t.mutationCache,this.#e=[],this.state=t.state||IBe(),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.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#o.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#o.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#o.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){let e=n(()=>{this.#a({type:"continue"})},"onContinue"),o={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=SM({fn:n(()=>this.options.mutationFn?this.options.mutationFn(t,o):Promise.reject(new Error("No mutationFn found")),"fn"),onFail:n((s,i)=>{this.#a({type:"failed",failureCount:s,error:i})},"onFail"),onPause:n(()=>{this.#a({type:"pause"})},"onPause"),onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:n(()=>this.#o.canRun(this),"canRun")});let r=this.state.status==="pending",a=!this.#r.canStart();try{if(r)e();else{this.#a({type:"pending",variables:t,isPaused:a}),this.#o.config.onMutate&&await this.#o.config.onMutate(t,this,o);let i=await this.options.onMutate?.(t,o);i!==this.state.context&&this.#a({type:"pending",context:i,variables:t,isPaused:a})}let s=await this.#r.start();return await this.#o.config.onSuccess?.(s,t,this.state.context,this,o),await this.options.onSuccess?.(s,t,this.state.context,o),await this.#o.config.onSettled?.(s,null,this.state.variables,this.state.context,this,o),await this.options.onSettled?.(s,null,t,this.state.context,o),this.#a({type:"success",data:s}),s}catch(s){try{await this.#o.config.onError?.(s,t,this.state.context,this,o)}catch(i){Promise.reject(i)}try{await this.options.onError?.(s,t,this.state.context,o)}catch(i){Promise.reject(i)}try{await this.#o.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,o)}catch(i){Promise.reject(i)}try{await this.options.onSettled?.(void 0,s,t,this.state.context,o)}catch(i){Promise.reject(i)}throw this.#a({type:"error",error:s}),s}finally{this.#o.runNext(this)}}#a(t){let e=n(o=>{switch(t.type){case"failed":return{...o,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...o,isPaused:!0};case"continue":return{...o,isPaused:!1};case"pending":return{...o,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{...o,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...o,data:void 0,error:t.error,failureCount:o.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}},"reducer");this.state=e(this.state),_n.batch(()=>{this.#e.forEach(o=>{o.onMutationUpdate(t)}),this.#o.notify({mutation:this,type:"updated",action:t})})}};function IBe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}n(IBe,"getDefaultState");var fse=class extends Wd{static{n(this,"MutationCache")}constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#o=0}#t;#e;#o;build(t,e,o){let r=new dse({client:t,mutationCache:this,mutationId:++this.#o,options:t.defaultMutationOptions(e),state:o});return this.add(r),r}add(t){this.#t.add(t);let e=CM(t);if(typeof e=="string"){let o=this.#e.get(e);o?o.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){let e=CM(t);if(typeof e=="string"){let o=this.#e.get(e);if(o)if(o.length>1){let r=o.indexOf(t);r!==-1&&o.splice(r,1)}else o[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=CM(t);if(typeof e=="string"){let r=this.#e.get(e)?.find(a=>a.state.status==="pending");return!r||r===t}else return!0}runNext(t){let e=CM(t);return typeof e=="string"?this.#e.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){let e={exact:!0,...t};return this.getAll().find(o=>vM(e,o))}findAll(t={}){return this.getAll().filter(e=>vM(t,e))}notify(t){_n.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(e=>e.state.isPaused);return _n.batch(()=>Promise.all(t.map(e=>e.continue().catch(Ua))))}};function CM(t){return t.options.scope?.id}n(CM,"scopeFor");var pse=class extends Wd{static{n(this,"QueryCache")}constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,o){let r=e.queryKey,a=e.queryHash??vF(r,e),s=this.get(a);return s||(s=new lse({client:t,queryKey:r,queryHash:a,options:t.defaultQueryOptions(e),state:o,defaultOptions:t.getQueryDefaults(r)}),this.add(s)),s}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){_n.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(o=>gM(e,o))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(o=>gM(t,o)):e}notify(t){_n.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}};var Qz=class{static{n(this,"QueryClient")}#t;#e;#o;#r;#a;#n;#i;#s;constructor(t={}){this.#t=t.queryCache||new pse,this.#e=t.mutationCache||new fse,this.#o=t.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#i=QI.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=ZI.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#i?.(),this.#i=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),o=this.#t.build(this,e),r=o.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&o.isStaleByTime($u(e.staleTime,o))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:o})=>{let r=o.data;return[e,r]})}setQueryData(t,e,o){let r=this.defaultQueryOptions({queryKey:t}),s=this.#t.get(r.queryHash)?.state.data,i=Zae(e,s);if(i!==void 0)return this.#t.build(this,r).setData(i,{...o,manual:!0})}setQueriesData(t,e,o){return _n.batch(()=>this.#t.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,o)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){let e=this.#t;_n.batch(()=>{e.findAll(t).forEach(o=>{e.remove(o)})})}resetQueries(t,e){let o=this.#t;return _n.batch(()=>(o.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let o={revert:!0,...e},r=_n.batch(()=>this.#t.findAll(t).map(a=>a.cancel(o)));return Promise.all(r).then(Ua).catch(Ua)}invalidateQueries(t,e={}){return _n.batch(()=>(this.#t.findAll(t).forEach(o=>{o.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){let o={...e,cancelRefetch:e.cancelRefetch??!0},r=_n.batch(()=>this.#t.findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let s=a.fetch(void 0,o);return o.throwOnError||(s=s.catch(Ua)),a.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ua)}fetchQuery(t){let e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);let o=this.#t.build(this,e);return o.isStaleByTime($u(e.staleTime,o))?o.fetch(e):Promise.resolve(o.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ua).catch(Ua)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ua).catch(Ua)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ZI.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#o}setDefaultOptions(t){this.#o=t}setQueryDefaults(t,e){this.#r.set(Cv(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#r.values()],o={};return e.forEach(r=>{Rv(t,r.queryKey)&&Object.assign(o,r.defaultOptions)}),o}setMutationDefaults(t,e){this.#a.set(Cv(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#a.values()],o={};return e.forEach(r=>{Rv(t,r.mutationKey)&&Object.assign(o,r.defaultOptions)}),o}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#o.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vF(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===Fv&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#o.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};var JI=K(oe(),1),gse=K($t(),1);var IF=JI.createContext(void 0),eb=n(t=>{let e=JI.useContext(IF);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},"useQueryClient"),Zz=n(({client:t,children:e})=>(JI.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,gse.jsx)(IF.Provider,{value:t,children:e})),"QueryClientProvider");var RM=K(oe(),1);var vse=RM.createContext(!1),xse=n(()=>RM.useContext(vse),"useIsRestoring"),yFt=vse.Provider;var bF=K(oe(),1),bBe=K($t(),1);function SBe(){let t=!1;return{clearReset:n(()=>{t=!1},"clearReset"),reset:n(()=>{t=!0},"reset"),isReset:n(()=>t,"isReset")}}n(SBe,"createValue");var wBe=bF.createContext(SBe()),yse=n(()=>bF.useContext(wBe),"useQueryErrorResetBoundary");var Ise=K(oe(),1);var bse=n((t,e,o)=>{let r=o?.state.error&&typeof t.throwOnError=="function"?IM(t.throwOnError,[o.state.error,o]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},"ensurePreventErrorBoundaryRetry"),Sse=n(t=>{Ise.useEffect(()=>{t.clearReset()},[t])},"useClearResetErrorBoundary"),wse=n(({result:t,errorResetBoundary:e,throwOnError:o,query:r,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(a&&t.data===void 0||IM(o,[t.error,r])),"getHasError");var Cse=n(t=>{if(t.suspense){let o=n(a=>a==="static"?a:Math.max(a??1e3,1e3),"clamp"),r=t.staleTime;t.staleTime=typeof r=="function"?(...a)=>o(r(...a)):o(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},"ensureSuspenseTimers"),Fse=n((t,e)=>t.isLoading&&t.isFetching&&!e,"willFetch"),Rse=n((t,e)=>t?.suspense&&e.isPending,"shouldSuspend"),Jz=n((t,e,o)=>e.fetchOptimistic(t).catch(()=>{o.clearReset()}),"fetchOptimistic");var Th=K(oe(),1);function Ese(t,e,o){if(typeof t!="object"||Array.isArray(t))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');let r=xse(),a=yse(),s=eb(o),i=s.defaultQueryOptions(t);s.getDefaultOptions().queries?._experimental_beforeQuery?.(i);let c=s.getQueryCache().get(i.queryHash);i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);let d=t.subscribed!==!1;i._optimisticResults=r?"isRestoring":d?"optimistic":void 0,Cse(i),bse(i,a,c),Sse(a);let f=!s.getQueryCache().get(i.queryHash),[p]=Th.useState(()=>new e(s,i)),m=p.getOptimisticResult(i),h=!r&&d;if(Th.useSyncExternalStore(Th.useCallback(v=>{let x=h?p.subscribe(_n.batchCalls(v)):Ua;return p.updateResult(),x},[p,h]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),Th.useEffect(()=>{p.setOptions(i)},[i,p]),Rse(i,m))throw Jz(i,p,a);if(wse({result:m,errorResetBoundary:a,throwOnError:i.throwOnError,query:c,suspense:i.suspense}))throw m.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(i,m),i.experimental_prefetchInRender&&!Kd.isServer()&&Fse(m,r)&&(f?Jz(i,p,a):c?.promise)?.catch(Ua).finally(()=>{p.updateResult()}),i.notifyOnChangeProps?m:p.trackResult(m)}n(Ese,"useBaseQuery");function e$(t,e){return Ese(t,Yz,e)}n(e$,"useQuery");var Ev=K(oe(),1),o$=K(po(),1);var Mse=(0,Ev.createContext)(null),CBe=n(()=>new Qz({defaultOptions:{mutations:{retry:0},queries:{gcTime:5*6e4,retry:0,staleTime:Number.POSITIVE_INFINITY}}}),"createDefaultQueryClient"),r$=n(t=>{let e=(0,kse.c)(9),{children:o,client:r,queryClient:a}=t,s=(0,Ev.use)(IF),i;e[0]!==s||e[1]!==a?(i=n(()=>a??s??CBe(),"t1"),e[0]=s,e[1]=a,e[2]=i):i=e[2];let[c]=(0,Ev.useState)(i),d=a??s??c;if(!d)throw new Error("LunoraProvider: failed to resolve a QueryClient");let f;e[3]!==o||e[4]!==r?(f=(0,o$.jsxDEV)(Mse,{value:r,children:o},void 0,!1),e[3]=o,e[4]=r,e[5]=f):f=e[5];let p=f;if(s===d)return p;let m;return e[6]!==p||e[7]!==d?(m=(0,o$.jsxDEV)(Zz,{client:d,children:p},void 0,!1),e[6]=p,e[7]=d,e[8]=m):m=e[8],m},"LunoraProvider"),Wt=n(()=>{let t=(0,Ev.use)(Mse);if(!t)throw new Error("useLunora must be used inside <LunoraProvider />");return t},"useLunora");var Pse=K(Eo(),1),Ose=K(oe(),1);var n$=n(()=>{let t=(0,Pse.c)(4),e=Wt(),o,r,a;return t[0]!==e?(o=n(s=>e.onConnectionStatus(()=>{s()}),"t0"),r=n(()=>e.connectionStatus(),"t1"),a=n(()=>e.connectionStatus(),"t2"),t[0]=e,t[1]=o,t[2]=r,t[3]=a):(o=t[1],r=t[2],a=t[3]),(0,Ose.useSyncExternalStore)(o,r,a)},"useConnectionStatus");var Nw=K(oe(),1);var Nse=K(oe(),1),kh=K(po(),1);var FBe={border:"1px solid var(--destructive)",color:"var(--destructive)",padding:12},RBe={overflow:"auto",whiteSpace:"pre-wrap"},tb=class extends Nse.Component{static{n(this,"ErrorBoundary")}static getDerivedStateFromError(e){return{error:e}}state={error:null};componentDidCatch(e,o){console.error("[lunora-studio] panel error",e,o.componentStack)}reset=n(()=>{this.setState({error:null})},"reset");render(){let{children:e,fallbackTitle:o,label:r,retryLabel:a}=this.props,{error:s}=this.state;if(s===null)return(0,kh.jsxDEV)(kh.Fragment,{children:e},void 0,!1);let i=o??(r===void 0?"Something went wrong":`${r} failed`);return(0,kh.jsxDEV)("div",{"data-testid":"dash-error-boundary",role:"alert",style:FBe,children:[(0,kh.jsxDEV)("strong",{children:i},void 0,!1),(0,kh.jsxDEV)("pre",{"data-testid":"dash-error-message",style:RBe,children:s.message},void 0,!1),(0,kh.jsxDEV)("button",{"data-testid":"dash-error-retry",onClick:this.reset,type:"button",children:a??"Try again"},void 0,!1)]},void 0,!0)}};var Yt=K(Eo(),1);var Hu=K(oe(),1);var Av=typeof window<"u"?Hu.useLayoutEffect:Hu.useEffect;function EM(t){let e=Hu.useRef({value:t,prev:null}),o=e.current.value;return t!==o&&(e.current={value:t,prev:o}),e.current.prev}n(EM,"usePrevious");function Dse(t,e,o={},r={}){Hu.useEffect(()=>{if(!t.current||r.disabled||typeof IntersectionObserver!="function")return;let a=new IntersectionObserver(([s])=>{e(s)},o);return a.observe(t.current),()=>{a.disconnect()}},[e,o,r.disabled,t])}n(Dse,"useIntersectionObserver");function _se(t){let e=Hu.useRef(null);return Hu.useImperativeHandle(t,()=>e.current,[]),e}n(_se,"useForwardedRef");function Mh(t){return t[t.length-1]}n(Mh,"last");function EBe(t){return typeof t=="function"}n(EBe,"isFunction");function pl(t,e){return EBe(t)?t(e):t}n(pl,"functionalUpdate");var zse=Object.prototype.hasOwnProperty,Lse=Object.prototype.propertyIsEnumerable;function Ph(t){for(let e in t)if(zse.call(t,e))return!0;return!1}n(Ph,"hasKeys");var ABe=n(()=>Object.create(null),"createNull"),Oh=n((t,e)=>Yd(t,e,ABe),"nullReplaceEqualDeep");function Yd(t,e,o=()=>({}),r=0){if(!1)return e;if(t===e)return t;if(r>500)return e;let a=e,s=a$(t)&&a$(a);if(!s&&!(SF(t)&&SF(a)))return a;let i=s?t:Bse(t);if(!i)return a;let c=s?a:Bse(a);if(!c)return a;let d=i.length,f=c.length,p=s?new Array(f):o(),m=0;for(let h=0;h<f;h++){let v=s?h:c[h],x=t[v],y=a[v];if(x===y){p[v]=x,(s?h<d:zse.call(t,v))&&m++;continue}if(x===null||y===null||typeof x!="object"||typeof y!="object"){p[v]=y;continue}let b=Yd(x,y,o,r+1);p[v]=b,b===x&&m++}return d===f&&m===d?t:p}n(Yd,"replaceEqualDeep");function Bse(t){let e=Object.getOwnPropertyNames(t);for(let a of e)if(!Lse.call(t,a))return!1;let o=Object.getOwnPropertySymbols(t);if(o.length===0)return e;let r=e;for(let a of o){if(!Lse.call(t,a))return!1;r.push(a)}return r}n(Bse,"getEnumerableOwnKeys");function SF(t){if(!Vse(t))return!1;let e=t.constructor;if(typeof e>"u")return!0;let o=e.prototype;return!(!Vse(o)||!o.hasOwnProperty("isPrototypeOf"))}n(SF,"isPlainObject");function Vse(t){return Object.prototype.toString.call(t)==="[object Object]"}n(Vse,"hasObjectPrototype");function a$(t){return Array.isArray(t)&&t.length===Object.keys(t).length}n(a$,"isPlainArray");function ju(t,e,o){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0,a=t.length;r<a;r++)if(!ju(t[r],e[r],o))return!1;return!0}if(SF(t)&&SF(e)){let r=o?.ignoreUndefined??!0;if(o?.partial){for(let i in e)if((!r||e[i]!==void 0)&&!ju(t[i],e[i],o))return!1;return!0}let a=0;if(!r)a=Object.keys(t).length;else for(let i in t)t[i]!==void 0&&a++;let s=0;for(let i in e)if((!r||e[i]!==void 0)&&(s++,s>a||!ju(t[i],e[i],o)))return!1;return a===s}return!1}n(ju,"deepEqual");function Xd(t){let e,o,r=new Promise((a,s)=>{e=a,o=s});return r.status="pending",r.resolve=a=>{r.status="resolved",r.value=a,e(a),t?.(a)},r.reject=a=>{r.status="rejected",o(a)},r}n(Xd,"createControlledPromise");function Nh(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}n(Nh,"isPromise");function s$(t,e){for(let o=t.length-1;o>=0;o--){let r=t[o];if(e(r))return r}}n(s$,"findLast");function TBe(t){return t.replace(/[\x00-\x1f\x7f]/g,"")}n(TBe,"sanitizePathSegment");function Use(t){let e;try{e=decodeURI(t)}catch{e=t.replaceAll(/%[0-9A-F]{2}/gi,o=>{try{return decodeURI(o)}catch{return o}})}return TBe(e)}n(Use,"decodeSegment");var i$=["http:","https:","mailto:","tel:"];function Qd(t,e){if(!t)return!1;try{let o=new URL(t);return!e.has(o.protocol)}catch{return!1}}n(Qd,"isDangerousProtocol");function ob(t){if(!t)return{path:t,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(t)&&!t.startsWith("//"))return{path:t,handledProtocolRelativeURL:!1};let e=/%25|%5C/gi,o=0,r="",a;for(;(a=e.exec(t))!==null;)r+=Use(t.slice(o,a.index))+a[0],o=e.lastIndex;r=r+Use(o?t.slice(o):t);let s=!1;return r.startsWith("//")&&(s=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:s}}n(ob,"decodePath");function $se(t){return/\s|[^\u0000-\u007F]/.test(t)?t.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):t}n($se,"encodePathLikeUrl");function Hse(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}n(Hse,"arraysEqual");function za(){throw new Error("Invariant failed")}n(za,"invariant");function Dh(t){let e=new Map,o,r,a=n(s=>{s.next&&(s.prev?(s.prev.next=s.next,s.next.prev=s.prev,s.next=void 0,r&&(r.next=s,s.prev=r)):(s.next.prev=void 0,o=s.next,s.next=void 0,r&&(s.prev=r,r.next=s)),r=s)},"touch");return{get(s){let i=e.get(s);if(i)return a(i),i.value},set(s,i){if(e.size>=t&&o){let d=o;e.delete(d.key),d.next&&(o=d.next,d.next.prev=void 0),d===r&&(r=void 0)}let c=e.get(s);if(c)c.value=i,a(c);else{let d={key:s,value:i,prev:r};r&&(r.next=d),r=d,o||(o=d),e.set(s,d)}},clear(){e.clear(),o=void 0,r=void 0}}}n(Dh,"createLRUCache");var Lh=4,qse=5;function kBe(t){let e=t.indexOf("{");if(e===-1)return null;let o=t.indexOf("}",e);return o===-1||e+1>=t.length?null:[e,o]}n(kBe,"getOpenAndCloseBraces");function u$(t,e,o=new Uint16Array(6)){let r=t.indexOf("/",e),a=r===-1?t.length:r,s=t.substring(e,a);if(!s||!s.includes("$"))return o[0]=0,o[1]=e,o[2]=e,o[3]=a,o[4]=a,o[5]=a,o;if(s==="$"){let c=t.length;return o[0]=2,o[1]=e,o[2]=e,o[3]=c,o[4]=c,o[5]=c,o}if(s.charCodeAt(0)===36)return o[0]=1,o[1]=e,o[2]=e+1,o[3]=a,o[4]=a,o[5]=a,o;let i=kBe(s);if(i){let[c,d]=i,f=s.charCodeAt(c+1);if(f===45){if(c+2<s.length&&s.charCodeAt(c+2)===36){let p=c+3,m=d;if(p<m)return o[0]=3,o[1]=e+c,o[2]=e+p,o[3]=e+m,o[4]=e+d+1,o[5]=a,o}}else if(f===36){let p=c+1,m=c+2;return m===d?(o[0]=2,o[1]=e+c,o[2]=e+p,o[3]=e+m,o[4]=e+d+1,o[5]=t.length,o):(o[0]=1,o[1]=e+c,o[2]=e+m,o[3]=e+d,o[4]=e+d+1,o[5]=a,o)}}return o[0]=0,o[1]=e,o[2]=e,o[3]=a,o[4]=a,o[5]=a,o}n(u$,"parseSegment");function kM(t,e,o,r,a,s,i){i?.(o);let c=r;{let d=o.fullPath??o.from,f=d.length,p=o.options?.caseSensitive??t,m=o.options?.params?.parse??o.options?.parseParams;for(;c<f;){let v=u$(d,c,e),x,y=c,b=v[5];switch(c=b+1,s++,v[0]){case 0:{let S=d.substring(v[2],v[3]);if(p){let w=a.static?.get(S);if(w)x=w;else{a.static??=new Map;let C=Tv(o.fullPath??o.from);C.parent=a,C.depth=s,x=C,a.static.set(S,C)}}else{let w=S.toLowerCase(),C=a.staticInsensitive?.get(w);if(C)x=C;else{a.staticInsensitive??=new Map;let F=Tv(o.fullPath??o.from);F.parent=a,F.depth=s,x=F,a.staticInsensitive.set(w,F)}}break}case 1:{let S=d.substring(y,v[1]),w=d.substring(v[4],b),C=p&&!!(S||w),F=S?C?S:S.toLowerCase():void 0,T=w?C?w:w.toLowerCase():void 0,E=!m&&a.dynamic?.find(k=>!k.parse&&k.caseSensitive===C&&k.prefix===F&&k.suffix===T);if(E)x=E;else{let k=c$(1,o.fullPath??o.from,C,F,T);x=k,k.depth=s,k.parent=a,a.dynamic??=[],a.dynamic.push(k)}break}case 3:{let S=d.substring(y,v[1]),w=d.substring(v[4],b),C=p&&!!(S||w),F=S?C?S:S.toLowerCase():void 0,T=w?C?w:w.toLowerCase():void 0,E=!m&&a.optional?.find(k=>!k.parse&&k.caseSensitive===C&&k.prefix===F&&k.suffix===T);if(E)x=E;else{let k=c$(3,o.fullPath??o.from,C,F,T);x=k,k.parent=a,k.depth=s,a.optional??=[],a.optional.push(k)}break}case 2:{let S=d.substring(y,v[1]),w=d.substring(v[4],b),C=p&&!!(S||w),F=S?C?S:S.toLowerCase():void 0,T=w?C?w:w.toLowerCase():void 0,E=c$(2,o.fullPath??o.from,C,F,T);x=E,E.parent=a,E.depth=s,a.wildcard??=[],a.wildcard.push(E)}}a=x}if(m&&o.children&&!o.isRoot&&o.id&&o.id.charCodeAt(o.id.lastIndexOf("/")+1)===95){let v=Tv(o.fullPath??o.from);v.kind=qse,v.parent=a,s++,v.depth=s,a.pathless??=[],a.pathless.push(v),a=v}let h=(o.path||!o.children)&&!o.isRoot;if(h&&d.endsWith("/")){let v=Tv(o.fullPath??o.from);v.kind=Lh,v.parent=a,s++,v.depth=s,a.index=v,a=v}a.parse=m??null,a.priority=o.options?.params?.priority??0,h&&!a.route&&(a.route=o,a.fullPath=o.fullPath??o.from)}if(o.children)for(let d of o.children)kM(t,e,d,c,a,s,i)}n(kM,"parseSegments");function l$(t,e){if(t.parse&&!e.parse)return-1;if(!t.parse&&e.parse)return 1;if(t.parse&&e.parse&&(t.priority||e.priority))return e.priority-t.priority;if(t.prefix&&e.prefix&&t.prefix!==e.prefix){if(t.prefix.startsWith(e.prefix))return-1;if(e.prefix.startsWith(t.prefix))return 1}if(t.suffix&&e.suffix&&t.suffix!==e.suffix){if(t.suffix.endsWith(e.suffix))return-1;if(e.suffix.endsWith(t.suffix))return 1}return t.prefix&&!e.prefix?-1:!t.prefix&&e.prefix?1:t.suffix&&!e.suffix?-1:!t.suffix&&e.suffix?1:t.caseSensitive&&!e.caseSensitive?-1:!t.caseSensitive&&e.caseSensitive?1:0}n(l$,"sortDynamic");function _h(t){if(t.pathless)for(let e of t.pathless)_h(e);if(t.static)for(let e of t.static.values())_h(e);if(t.staticInsensitive)for(let e of t.staticInsensitive.values())_h(e);if(t.dynamic?.length){t.dynamic.sort(l$);for(let e of t.dynamic)_h(e)}if(t.optional?.length){t.optional.sort(l$);for(let e of t.optional)_h(e)}if(t.wildcard?.length){t.wildcard.sort(l$);for(let e of t.wildcard)_h(e)}}n(_h,"sortTreeNodes");function Tv(t){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0}}n(Tv,"createStaticNode");function c$(t,e,o,r,a){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0,caseSensitive:o,prefix:r,suffix:a}}n(c$,"createDynamicNode");function Wse(t,e){let o=Tv("/"),r=new Uint16Array(6);for(let a of t)kM(!1,r,a,1,o,0);_h(o),e.masksTree=o,e.flatCache=Dh(1e3)}n(Wse,"processRouteMasks");function Gse(t,e){t||="/";let o=e.flatCache.get(t);if(o)return o;let r=d$(t,e.masksTree);return e.flatCache.set(t,r),r}n(Gse,"findFlatMatch");function Kse(t,e,o,r,a){t||="/",r||="/";let s=e?`case\0${t}`:t,i=a.singleCache.get(s);return i||(i=Tv("/"),kM(e,new Uint16Array(6),{from:t},1,i,0),a.singleCache.set(s,i)),d$(r,i,o)}n(Kse,"findSingleMatch");function Yse(t,e,o=!1){let r=o?t:`nofuzz\0${t}`,a=e.matchCache.get(r);if(a!==void 0)return a;t||="/";let s;try{s=d$(t,e.segmentTree,o)}catch(i){if(i instanceof URIError)s=null;else throw i}return s&&(s.branch=f$(s.route)),e.matchCache.set(r,s),s}n(Yse,"findRouteMatch");function MBe(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}n(MBe,"trimPathRight");function Xse(t,e=!1,o){let r=Tv(t.fullPath),a=new Uint16Array(6),s={},i={},c=0;return kM(e,a,t,1,r,0,d=>{if(o?.(d,c),d.id in s)throw new Error(`Invariant failed: Duplicate routes found with id: ${String(d.id)}`);if(s[d.id]=d,c!==0&&d.path){let f=MBe(d.fullPath);(!i[f]||d.fullPath.endsWith("/"))&&(i[f]=d)}c++}),_h(r),{processedTree:{segmentTree:r,singleCache:Dh(1e3),matchCache:Dh(1e3),flatCache:null,masksTree:null},routesById:s,routesByPath:i}}n(Xse,"processRouteTree");function d$(t,e,o=!1){let r=t.split("/"),a=OBe(t,r,e,o);if(!a)return null;let[s]=Qse(t,r,a);return{route:a.node.route,rawParams:s}}n(d$,"findMatch");function Qse(t,e,o){let r=PBe(o.node),a=null,s=Object.create(null),i=o.extract?.part??0,c=o.extract?.node??0,d=o.extract?.path??0,f=o.extract?.segment??0;for(;c<r.length;i++,c++,d++,f++){let p=r[c];if(p.kind===Lh)break;if(p.kind===qse){f--,i--,d--;continue}let m=e[i],h=d;if(m&&(d+=m.length),p.kind===1){a??=o.node.fullPath.split("/");let v=a[f],x=p.prefix?.length??0;if(v.charCodeAt(x)===123){let y=p.suffix?.length??0,b=v.substring(x+2,v.length-y-1),S=m.substring(x,m.length-y);s[b]=decodeURIComponent(S)}else{let y=v.substring(1);s[y]=decodeURIComponent(m)}}else if(p.kind===3){if(o.skipped&1<<c){i--,d=h-1;continue}a??=o.node.fullPath.split("/");let v=a[f],x=p.prefix?.length??0,y=p.suffix?.length??0,b=v.substring(x+3,v.length-y-1),S=p.suffix||p.prefix?m.substring(x,m.length-y):m;S&&(s[b]=decodeURIComponent(S))}else if(p.kind===2){let v=p,x=t.substring(h+(v.prefix?.length??0),t.length-(v.suffix?.length??0)),y=decodeURIComponent(x);s["*"]=y,s._splat=y;break}}return o.rawParams&&Object.assign(s,o.rawParams),[s,{part:i,node:c,path:d,segment:f}]}n(Qse,"extractParams");function f$(t){let e=[t];for(;t.parentRoute;)t=t.parentRoute,e.push(t);return e.reverse(),e}n(f$,"buildRouteBranch");function PBe(t){let e=Array(t.depth+1);do e[t.depth]=t,t=t.parent;while(t);return e}n(PBe,"buildBranch");function OBe(t,e,o,r){if(t==="/"&&o.index)return{node:o.index,skipped:0};let a=!Mh(e),s=a&&t!=="/",i=e.length-(a?1:0),c=[{node:o,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],d=null,f=null;for(;c.length;){let p=c.pop(),{node:m,index:h,skipped:v,depth:x,statics:y,dynamics:b,optionals:S}=p,{extract:w,rawParams:C}=p;if(m.kind===2&&m.route&&!TM(f,p))continue;if(m.parse){if(!jse(t,e,p))continue;C=p.rawParams,w=p.extract}r&&m.route&&m.kind!==Lh&&TM(d,p)&&(d=p);let F=h===i;if(F&&(m.route&&(!s||m.kind===Lh||m.kind===2)&&TM(f,p)&&(f=p),!m.optional&&!m.wildcard&&!m.index&&!m.pathless))continue;let T=F?void 0:e[h],E;if(F&&m.index){let k={node:m.index,index:h,skipped:v,depth:x+1,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C},O=!0;if(m.index.parse&&(jse(t,e,k)||(O=!1)),O){if(!b&&!S&&!v&&NBe(y,i))return k;TM(f,k)&&(f=k)}}if(m.wildcard)for(let k=m.wildcard.length-1;k>=0;k--){let O=m.wildcard[k],{prefix:D,suffix:M}=O;if(!(D&&(F||!(O.caseSensitive?T:E??=T.toLowerCase()).startsWith(D)))){if(M){if(F)continue;let L=e.slice(h).join("/").slice(-M.length);if((O.caseSensitive?L:L.toLowerCase())!==M)continue}c.push({node:O,index:i,skipped:v,depth:x+1,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C})}}if(m.optional){let k=v|1<<x,O=x+1;for(let D=m.optional.length-1;D>=0;D--){let M=m.optional[D];c.push({node:M,index:h,skipped:k,depth:O,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C})}if(!F)for(let D=m.optional.length-1;D>=0;D--){let M=m.optional[D],{prefix:L,suffix:U}=M;if(L||U){let W=M.caseSensitive?T:E??=T.toLowerCase();if(L&&!W.startsWith(L)||U&&!W.endsWith(U))continue}c.push({node:M,index:h+1,skipped:v,depth:O,statics:y,dynamics:b,optionals:S+AM(i,h),extract:w,rawParams:C})}}if(!F&&m.dynamic&&T)for(let k=m.dynamic.length-1;k>=0;k--){let O=m.dynamic[k],{prefix:D,suffix:M}=O;if(D||M){let L=O.caseSensitive?T:E??=T.toLowerCase();if(D&&!L.startsWith(D)||M&&!L.endsWith(M))continue}c.push({node:O,index:h+1,skipped:v,depth:x+1,statics:y,dynamics:b+AM(i,h),optionals:S,extract:w,rawParams:C})}if(!F&&m.staticInsensitive){let k=m.staticInsensitive.get(E??=T.toLowerCase());k&&c.push({node:k,index:h+1,skipped:v,depth:x+1,statics:y+AM(i,h),dynamics:b,optionals:S,extract:w,rawParams:C})}if(!F&&m.static){let k=m.static.get(T);k&&c.push({node:k,index:h+1,skipped:v,depth:x+1,statics:y+AM(i,h),dynamics:b,optionals:S,extract:w,rawParams:C})}if(m.pathless){let k=x+1;for(let O=m.pathless.length-1;O>=0;O--){let D=m.pathless[O];c.push({node:D,index:h,skipped:v,depth:k,statics:y,dynamics:b,optionals:S,extract:w,rawParams:C})}}}if(f)return f;if(r&&d){let p=d.index;for(let h=0;h<d.index;h++)p+=e[h].length;let m=p===t.length?"/":t.slice(p);return d.rawParams??=Object.create(null),d.rawParams["**"]=decodeURIComponent(m),d}return null}n(OBe,"getNodeMatch");function AM(t,e){return 2**(t-e-1)}n(AM,"segmentScore");function NBe(t,e){return t===2**(e-1)-1}n(NBe,"isPerfectStaticMatch");function jse(t,e,o){let r,a;try{[r,a]=Qse(t,e,o)}catch{return null}if(o.rawParams=r,o.extract=a,!o.node.parse)return!0;try{if(o.node.parse(r)===!1)return null}catch{}return!0}n(jse,"validateParseParams");function TM(t,e){return t?e.statics>t.statics||e.statics===t.statics&&(e.dynamics>t.dynamics||e.dynamics===t.dynamics&&(e.optionals>t.optionals||e.optionals===t.optionals&&((e.node.kind===Lh)>(t.node.kind===Lh)||e.node.kind===Lh==(t.node.kind===Lh)&&e.depth>t.depth))):!0}n(TM,"isFrameMoreSpecific");function kv(t){return CF(t.filter(e=>e!==void 0).join("/"))}n(kv,"joinPaths");function CF(t){return t.replace(/\/{2,}/g,"/")}n(CF,"cleanPath");function MM(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}n(MM,"trimPathLeft");function Jl(t){let e=t.length;return e>1&&t[e-1]==="/"?t.replace(/\/{1,}$/,""):t}n(Jl,"trimPathRight");function FF(t){return Jl(MM(t))}n(FF,"trimPath");function Bh(t,e){return t?.endsWith("/")&&t!=="/"&&t!==`${e}/`?t.slice(0,-1):t}n(Bh,"removeTrailingSlash");function PM(t,e,o){return Bh(t,o)===Bh(e,o)}n(PM,"exactPathTest");function p$({base:t,to:e,trailingSlash:o="never",cache:r}){let a=e.startsWith("/"),s=!a&&e===".",i;if(r){i=a?e:s?t:t+"\0"+e;let f=r.get(i);if(f)return f}let c;if(s)c=t.split("/");else if(a)c=e.split("/");else{for(c=t.split("/");c.length>1&&Mh(c)==="";)c.pop();let f=e.split("/");for(let p=0,m=f.length;p<m;p++){let h=f[p];h===""?p?p===m-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Mh(c)===""?o==="never"&&c.pop():o==="always"&&c.push(""));let d=CF(c.join("/"))||"/";return i&&r&&r.set(i,d),d}n(p$,"resolvePath");function Jse(t){let e=new Map(t.map(a=>[encodeURIComponent(a),a])),o=Array.from(e.keys()).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(o,"g");return a=>a.replace(r,s=>e.get(s)??s)}n(Jse,"compileDecodeCharMap");function wF(t,e,o){let r=e[t];return typeof r!="string"?r:t==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(a=>Zse(a,o)).join("/"):Zse(r,o)}n(wF,"encodeParam");function OM({path:t,params:e,decoder:o,...r}){let a=!1,s=Object.create(null);if(!t||t==="/")return{interpolatedPath:"/",usedParams:s,isMissingParams:a};if(!t.includes("$"))return{interpolatedPath:t,usedParams:s,isMissingParams:a};if(!1){let p=t.length,m=0,h="";for(;m<p;){for(;m<p&&t.charCodeAt(m)===47;)m++;if(m>=p)break;let v=m,x=t.indexOf("/",m);x===-1&&(x=p),m=x;let y=t.substring(v,x);if(y)if(y.charCodeAt(0)===36)if(y.length===1){let b=e._splat;if(s._splat=b,s["*"]=b,!b){a=!0;continue}let S=wF("_splat",e,o);h+="/"+S}else{let b=y.substring(1);!a&&!(b in e)&&(a=!0),s[b]=e[b];let S=wF(b,e,o)??"undefined";h+="/"+S}else h+="/"+y}return t.endsWith("/")&&(h+="/"),{usedParams:s,interpolatedPath:h||"/",isMissingParams:a}}let i=t.length,c=0,d,f="";for(;c<i;){let p=c;d=u$(t,p,d);let m=d[5];if(c=m+1,p===m)continue;let h=d[0];if(h===0){f+="/"+t.substring(p,m);continue}if(h===2){let v=e._splat;s._splat=v,s["*"]=v;let x=t.substring(p,d[1]),y=t.substring(d[4],m);if(!v){a=!0,(x||y)&&(f+="/"+x+y);continue}let b=wF("_splat",e,o);f+="/"+x+b+y;continue}if(h===1){let v=t.substring(d[2],d[3]);!a&&!(v in e)&&(a=!0),s[v]=e[v];let x=t.substring(p,d[1]),y=t.substring(d[4],m),b=wF(v,e,o)??"undefined";f+="/"+x+b+y;continue}if(h===3){let v=t.substring(d[2],d[3]),x=e[v];if(x==null)continue;s[v]=x;let y=t.substring(p,d[1]),b=t.substring(d[4],m),S=wF(v,e,o)??"";f+="/"+y+S+b;continue}}return t.endsWith("/")&&(f+="/"),{usedParams:s,interpolatedPath:f||"/",isMissingParams:a}}n(OM,"interpolatePath");function Zse(t,e){let o=encodeURIComponent(t);return e?.(o)??o}n(Zse,"encodePathParam");function Hn(t){return t?.isNotFound===!0}n(Hn,"isNotFound");function eie(t,e=String){let o=new URLSearchParams;for(let r in t){let a=t[r];a!==void 0&&o.set(r,e(a))}return o.toString()}n(eie,"encode");function m$(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}n(m$,"toValue");function tie(t){let e=new URLSearchParams(t),o=Object.create(null);for(let[r,a]of e.entries()){let s=o[r];s==null?o[r]=m$(a):Array.isArray(s)?s.push(m$(a)):o[r]=[s,m$(a)]}return o}n(tie,"decode");var oie=DBe(JSON.parse),rie=_Be(JSON.stringify,JSON.parse);function DBe(t){return e=>{e[0]==="?"&&(e=e.substring(1));let o=tie(e);for(let r in o){let a=o[r];if(typeof a=="string")try{o[r]=t(a)}catch{}}return o}}n(DBe,"parseSearchWith");function _Be(t,e){let o=typeof e=="function";function r(a){if(typeof a=="object"&&a!==null)try{return t(a)}catch{}else if(o&&typeof a=="string")try{return e(a),t(a)}catch{}return a}return n(r,"stringifyValue"),a=>{let s=eie(a,r);return s?`?${s}`:""}}n(_Be,"stringifySearchWith");var ml="__root__";function rb(t){if(t.statusCode=t.statusCode||t.code||307,!t._builtLocation&&!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}let e=new Headers(t.headers);t.href&&e.get("Location")===null&&e.set("Location",t.href);let o=new Response(null,{status:t.statusCode,headers:e});if(o.options=t,t.throw)throw o;return o}n(rb,"redirect");function ns(t){return t instanceof Response&&!!t.options}n(ns,"isRedirect");var h$=n(t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},"triggerOnReady"),LBe=n(t=>t.stores.matchesId.get().some(e=>t.stores.matchStores.get(e)?.get()._forcePending),"hasForcePendingActiveMatch"),_M=n((t,e)=>!!(t.preload&&!t.router.stores.matchStores.has(e)),"resolvePreload"),Mv=n((t,e,o=!0)=>{let r={...t.router.options.context??{}},a=o?e:e-1;for(let s=0;s<=a;s++){let i=t.matches[s];if(!i)continue;let c=t.router.getMatch(i.id);c&&Object.assign(r,c.__routeContext,c.__beforeLoadContext)}return r},"buildMatchContext"),nie=n((t,e)=>{if(!t.matches.length)return;let o=e.routeId,r=t.matches.findIndex(i=>i.routeId===t.router.routeTree.id),a=r>=0?r:0,s=o?t.matches.findIndex(i=>i.routeId===o):t.firstBadMatchIndex??t.matches.length-1;s<0&&(s=a);for(let i=s;i>=0;i--){let c=t.matches[i];if(t.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return o?s:a},"getNotFoundBoundaryIndex"),Vh=n((t,e,o)=>{if(!(!ns(o)&&!Hn(o)))throw ns(o)&&o.redirectHandled&&!o.options.reloadDocument||(e&&(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.loaderPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loaderPromise=void 0,e._nonReactive.error=o,t.updateMatch(e.id,r=>({...r,status:ns(o)?"redirected":Hn(o)?"notFound":r.status==="pending"?"success":r.status,context:Mv(t,e.index),isFetching:!1,error:o})),Hn(o)&&!o.routeId&&(o.routeId=e.routeId),e._nonReactive.loadPromise?.resolve()),ns(o)&&(t.rendered=!0,o.options._fromLocation=t.location,o.redirectHandled=!0,o=t.router.resolveRedirect(o))),o},"handleRedirectAndNotFound"),lie=n((t,e)=>{let o=t.router.getMatch(e);return!!(!o||!!1&&o._nonReactive.dehydrated||!1)},"shouldSkipLoader"),aie=n((t,e,o)=>{let r=Mv(t,o);t.updateMatch(e,a=>({...a,context:r}))},"syncMatchContext"),RF=n((t,e,o)=>{let{id:r,routeId:a}=t.matches[e],s=t.router.looseRoutesById[a];if(o instanceof Promise)throw o;t.firstBadMatchIndex??=e,Vh(t,t.router.getMatch(r),o);try{s.options.onError?.(o)}catch(i){o=i,Vh(t,t.router.getMatch(r),o)}t.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:o,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!t.preload&&!ns(o)&&!Hn(o)&&(t.serialError??=o)},"handleSerialError"),BBe=n((t,e,o,r)=>{let a=t.router.getMatch(e),s=t.matches[o-1]?.id,i=s?t.router.getMatch(s):void 0;if(t.router.isShell()){a.ssr=r.id===ml;return}if(i?.ssr===!1){a.ssr=!1;return}let c=n(v=>v===!0&&i?.ssr==="data-only"?"data-only":v,"parentOverride"),d=t.router.options.defaultSsr??!0;if(r.options.ssr===void 0){a.ssr=c(d);return}if(typeof r.options.ssr!="function"){a.ssr=c(r.options.ssr);return}let{search:f,params:p}=a,m={search:NM(f,a.searchError),params:NM(p,a.paramsError),location:t.location,matches:t.matches.map(v=>({index:v.index,pathname:v.pathname,fullPath:v.fullPath,staticData:v.staticData,id:v.id,routeId:v.routeId,search:NM(v.search,v.searchError),params:NM(v.params,v.paramsError),ssr:v.ssr}))},h=r.options.ssr(m);if(Nh(h))return h.then(v=>{a.ssr=c(v??d)});a.ssr=c(h??d)},"isBeforeLoadSsr"),cie=n((t,e,o,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let a=o.options.pendingMs??t.router.options.defaultPendingMs;if(t.onReady&&!!1&&!_M(t,e)&&(o.options.loader||o.options.beforeLoad||v$(o))&&typeof a=="number"&&a!==1/0&&(o.options.pendingComponent??t.router.options?.defaultPendingComponent)){let s=setTimeout(()=>{h$(t)},a);r._nonReactive.pendingTimeout=s}},"setupPendingTimeout"),VBe=n((t,e,o)=>{let r=t.router.getMatch(e);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;cie(t,e,o,r);let a=n(()=>{let s=t.router.getMatch(e);s.preload&&(s.status==="redirected"||s.status==="notFound")&&Vh(t,s,s.error)},"then");return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(a):a()},"preBeforeLoadSetup"),UBe=n((t,e,o,r)=>{let a=t.router.getMatch(e),s=a._nonReactive.loadPromise;a._nonReactive.loadPromise=Xd(()=>{s?.resolve(),s=void 0});let{paramsError:i,searchError:c}=a;i&&RF(t,o,i),c&&RF(t,o,c),cie(t,e,r,a);let d=new AbortController,f=!1,p=n(()=>{f||(f=!0,t.updateMatch(e,F=>({...F,isFetching:"beforeLoad",fetchCount:F.fetchCount+1,abortController:d})))},"pending"),m=n(()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,t.updateMatch(e,F=>({...F,isFetching:!1}))},"resolve");if(!r.options.beforeLoad){t.router.batch(()=>{p(),m()});return}a._nonReactive.beforeLoadPromise=Xd();let h={...Mv(t,o,!1),...a.__routeContext},{search:v,params:x,cause:y}=a,b=_M(t,e),S={search:v,abortController:d,params:x,preload:b,context:h,location:t.location,navigate:n(F=>t.router.navigate({...F,_fromLocation:t.location}),"navigate"),buildLocation:t.router.buildLocation,cause:b?"preload":y,matches:t.matches,routeId:r.id,...t.router.options.additionalContext},w=n(F=>{if(F===void 0){t.router.batch(()=>{p(),m()});return}(ns(F)||Hn(F))&&(p(),RF(t,o,F)),t.router.batch(()=>{p(),t.updateMatch(e,T=>({...T,__beforeLoadContext:F})),m()})},"updateContext"),C;try{if(C=r.options.beforeLoad(S),Nh(C))return p(),C.catch(F=>{RF(t,o,F)}).then(w)}catch(F){p(),RF(t,o,F)}w(C)},"executeBeforeLoad"),zBe=n((t,e)=>{let{id:o,routeId:r}=t.matches[e],a=t.router.looseRoutesById[r],s=n(()=>{if(!1){let d=BBe(t,o,e,a);if(Nh(d))return d.then(c)}return c()},"serverSsr"),i=n(()=>UBe(t,o,e,a),"execute"),c=n(()=>{if(lie(t,o))return;let d=VBe(t,o,a);return Nh(d)?d.then(i):i()},"queueExecution");return s()},"handleBeforeLoad"),$Be=n((t,e,o)=>{let r=t.router.getMatch(e);if(!r||!o.options.head&&!o.options.scripts&&!o.options.headers)return;let a={ssr:t.router.options.ssr,matches:t.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([o.options.head?.(a),o.options.scripts?.(a),o.options.headers?.(a)]).then(([s,i,c])=>({meta:s?.meta,links:s?.links,headScripts:s?.scripts,headers:c,scripts:i,styles:s?.styles}))},"executeHead"),uie=n((t,e,o,r,a)=>{let s=e[r-1],{params:i,loaderDeps:c,abortController:d,cause:f}=t.router.getMatch(o),p=Mv(t,r),m=_M(t,o);return{params:i,deps:c,preload:!!m,parentMatchPromise:s,abortController:d,context:p,location:t.location,navigate:n(h=>t.router.navigate({...h,_fromLocation:t.location}),"navigate"),cause:m?"preload":f,route:a,...t.router.options.additionalContext}},"getLoaderContext"),sie=n(async(t,e,o,r,a)=>{try{let s=t.router.getMatch(o);try{(!!1||s.ssr===!0)&&nb(a);let i=a.options.loader,c=typeof i=="function"?i:i?.handler,d=c?.(uie(t,e,o,r,a)),f=!!c&&Nh(d);if((f||a._lazyPromise||a._componentsPromise||a.options.head||a.options.scripts||a.options.headers||s._nonReactive.minPendingPromise)&&t.updateMatch(o,m=>({...m,isFetching:"loader"})),c){let m=f?await d:d;Vh(t,t.router.getMatch(o),m),m!==void 0&&t.updateMatch(o,h=>({...h,loaderData:m}))}a._lazyPromise&&await a._lazyPromise;let p=s._nonReactive.minPendingPromise;p&&await p,a._componentsPromise&&await a._componentsPromise,t.updateMatch(o,m=>({...m,error:void 0,context:Mv(t,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(s.abortController.signal.aborted){s._nonReactive.loaderPromise?.resolve(),s._nonReactive.loaderPromise=void 0;return}t.updateMatch(o,f=>({...f,status:f.status==="pending"?"success":f.status,isFetching:!1,context:Mv(t,r)}));return}let d=s._nonReactive.minPendingPromise;d&&await d,Hn(i)&&await a.options.notFoundComponent?.preload?.(),Vh(t,t.router.getMatch(o),i);try{a.options.onError?.(i)}catch(f){c=f,Vh(t,t.router.getMatch(o),f)}!ns(c)&&!Hn(c)&&await nb(a,["errorComponent"]),t.updateMatch(o,f=>({...f,error:c,context:Mv(t,r),status:"error",isFetching:!1}))}}catch(s){let i=t.router.getMatch(o);i&&(i._nonReactive.loaderPromise=void 0),Vh(t,i,s)}},"runLoader"),HBe=n(async(t,e,o)=>{async function r(v,x,y,b,S){let w=Date.now()-x.updatedAt,C=v?S.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:S.options.staleTime??t.router.options.defaultStaleTime??0,F=S.options.shouldReload,T=typeof F=="function"?F(uie(t,e,a,o,S)):F,{status:E,invalid:k}=b,O=w>=C&&(!!t.forceStaleReload||b.cause==="enter"||y!==void 0&&y!==b.id);i=E==="success"&&(k||(T??O)),v&&S.options.preload===!1||(i&&!t.sync&&p?(c=!0,(async()=>{try{await sie(t,e,a,o,S);let D=t.router.getMatch(a);D._nonReactive.loaderPromise?.resolve(),D._nonReactive.loadPromise?.resolve(),D._nonReactive.loaderPromise=void 0,D._nonReactive.loadPromise=void 0}catch(D){ns(D)&&await t.router.navigate(D.options)}})()):E!=="success"||i?await sie(t,e,a,o,S):aie(t,a,o))}n(r,"handleLoader");let{id:a,routeId:s}=t.matches[o],i=!1,c=!1,d=t.router.looseRoutesById[s],f=d.options.loader,p=((typeof f=="function"?void 0:f?.staleReloadMode)??t.router.options.defaultStaleReloadMode)!=="blocking";if(lie(t,a)){if(!t.router.getMatch(a))return t.matches[o];if(aie(t,a,o),!1)return t.router.getMatch(a)}else{let v=t.router.getMatch(a),x=t.router.stores.matchesId.get()[o],y=(x&&t.router.stores.matchStores.get(x)||null)?.routeId===s?x:t.router.stores.matches.get().find(S=>S.routeId===s)?.id,b=_M(t,a);if(v._nonReactive.loaderPromise){if(v.status==="success"&&!t.sync&&!v.preload&&p)return v;await v._nonReactive.loaderPromise;let S=t.router.getMatch(a),w=S._nonReactive.error||S.error;w&&Vh(t,S,w),S.status==="pending"&&await r(b,v,y,S,d)}else{let S=b&&!t.router.stores.matchStores.has(a),w=t.router.getMatch(a);w._nonReactive.loaderPromise=Xd(),S!==w.preload&&t.updateMatch(a,C=>({...C,preload:S})),await r(b,v,y,w,d)}}let m=t.router.getMatch(a);c||(m._nonReactive.loaderPromise?.resolve(),m._nonReactive.loadPromise?.resolve(),m._nonReactive.loadPromise=void 0),clearTimeout(m._nonReactive.pendingTimeout),m._nonReactive.pendingTimeout=void 0,c||(m._nonReactive.loaderPromise=void 0),m._nonReactive.dehydrated=void 0;let h=c?m.isFetching:!1;return h!==m.isFetching||m.invalid!==!1?(t.updateMatch(a,v=>({...v,isFetching:h,invalid:!1})),t.router.getMatch(a)):m},"loadRouteMatch");async function g$(t){let e=t,o=[];!!1&&LBe(e.router)&&h$(e);let r;for(let h=0;h<e.matches.length;h++){try{let v=zBe(e,h);Nh(v)&&await v}catch(v){if(ns(v))throw v;if(Hn(v))r=v;else if(!e.preload)throw v;break}if(e.serialError||e.firstBadMatchIndex!=null)break}let a=e.firstBadMatchIndex??e.matches.length,s=r&&!e.preload?nie(e,r):void 0,i=r&&e.preload?0:s!==void 0?Math.min(s+1,a):a,c,d;for(let h=0;h<i;h++)o.push(HBe(e,o,h));try{await Promise.all(o)}catch{let h=await Promise.allSettled(o);for(let v of h){if(v.status!=="rejected")continue;let x=v.reason;if(ns(x))throw x;Hn(x)?c??=x:d??=x}if(d!==void 0)throw d}let f=c??(r&&!e.preload?r:void 0),p=e.firstBadMatchIndex!==void 0?e.firstBadMatchIndex:e.matches.length-1;if(!f&&r&&e.preload)return e.matches;if(f){let h=nie(e,f);if(h===void 0)throw new Error("Invariant failed: Could not find match for notFound boundary");let v=e.matches[h],x=e.router.looseRoutesById[v.routeId],y=e.router.options?.defaultNotFoundComponent;!x.options.notFoundComponent&&y&&(x.options.notFoundComponent=y),f.routeId=v.routeId;let b=v.routeId===e.router.routeTree.id;e.updateMatch(v.id,S=>({...S,...b?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:f},isFetching:!1})),p=h,await nb(x,["notFoundComponent"])}else if(!e.preload){let h=e.matches[0];h.globalNotFound||e.router.getMatch(h.id)?.globalNotFound&&e.updateMatch(h.id,v=>({...v,globalNotFound:!1,error:void 0}))}if(e.serialError&&e.firstBadMatchIndex!==void 0){let h=e.router.looseRoutesById[e.matches[e.firstBadMatchIndex].routeId];await nb(h,["errorComponent"])}for(let h=0;h<=p;h++){let{id:v,routeId:x}=e.matches[h],y=e.router.looseRoutesById[x];try{let b=$Be(e,v,y);if(b){let S=await b;e.updateMatch(v,w=>({...w,...S}))}}catch(b){console.error(`Error executing head for route ${x}:`,b)}}let m=h$(e);if(Nh(m)&&await m,f)throw f;if(e.serialError&&!e.preload&&!e.onReady)throw e.serialError;return e.matches}n(g$,"loadMatches");function iie(t,e){let o=e.map(r=>t.options[r]?.preload?.()).filter(Boolean);if(o.length!==0)return Promise.all(o)}n(iie,"preloadRouteComponents");function nb(t,e=DM){!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(r=>{let{id:a,...s}=r.options;Object.assign(t.options,s),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0);let o=n(()=>t._componentsLoaded?void 0:e===DM?(()=>{if(t._componentsPromise===void 0){let r=iie(t,DM);r?t._componentsPromise=r.then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0}):t._componentsLoaded=!0}return t._componentsPromise})():iie(t,e),"runAfterLazy");return t._lazyPromise?t._lazyPromise.then(o):o()}n(nb,"loadRouteChunk");function NM(t,e){return e?{status:"error",error:e}:{status:"success",value:t}}n(NM,"makeMaybe");function v$(t){for(let e of DM)if(t.options[e]?.preload)return!0;return!1}n(v$,"routeNeedsPreload");var DM=["component","errorComponent","pendingComponent","notFoundComponent"];function die(t){return{input:n(({url:e})=>{for(let o of t)e=LM(o,e);return e},"input"),output:n(({url:e})=>{for(let o=t.length-1;o>=0;o--)e=x$(t[o],e);return e},"output")}}n(die,"composeRewrites");function fie(t){let e=FF(t.basepath),o=`/${e}`,r=t.caseSensitive?o:o.toLowerCase(),a=`${r}/`;return{input:n(({url:s})=>{let i=t.caseSensitive?s.pathname:s.pathname.toLowerCase();return i===r?s.pathname="/":i.startsWith(a)&&(s.pathname=s.pathname.slice(o.length)),s},"input"),output:n(({url:s})=>(s.pathname=kv(["/",e,s.pathname]),s),"output")}}n(fie,"rewriteBasepath");function LM(t,e){let o=t?.input?.({url:e});if(o){if(typeof o=="string")return new URL(o);if(o instanceof URL)return o}return e}n(LM,"executeRewriteInput");function x$(t,e){let o=t?.output?.({url:e});if(o){if(typeof o=="string")return new URL(o);if(o instanceof URL)return o}return e}n(x$,"executeRewriteOutput");function b$(t){let e=t;return{get(){return e},set(o){e=pl(o,e)}}}n(b$,"createNonReactiveMutableStore");function S$(t){return{get(){return t()}}}n(S$,"createNonReactiveReadonlyStore");function pie(t,e){let{createMutableStore:o,createReadonlyStore:r,batch:a,init:s}=e,i=new Map,c=new Map,d=new Map,f=o(t.status),p=o(t.loadedAt),m=o(t.isLoading),h=o(t.isTransitioning),v=o(t.location),x=o(t.resolvedLocation),y=o(t.statusCode),b=o(t.redirect),S=o([]),w=o([]),C=o([]),F=r(()=>y$(i,S.get())),T=r(()=>y$(c,w.get())),E=r(()=>y$(d,C.get())),k=r(()=>S.get()[0]),O=r(()=>S.get().some(_=>i.get(_)?.get().status==="pending")),D=r(()=>({locationHref:v.get().href,resolvedLocationHref:x.get()?.href,status:f.get()})),M=r(()=>({status:f.get(),loadedAt:p.get(),isLoading:m.get(),isTransitioning:h.get(),matches:F.get(),location:v.get(),resolvedLocation:x.get(),statusCode:y.get(),redirect:b.get()})),L=Dh(64);function U(_){let B=L.get(_);return B||(B=r(()=>{let z=S.get();for(let q of z){let $=i.get(q);if($&&$.routeId===_)return $.get()}}),L.set(_,B)),B}n(U,"getRouteMatchStore");let W={status:f,loadedAt:p,isLoading:m,isTransitioning:h,location:v,resolvedLocation:x,statusCode:y,redirect:b,matchesId:S,pendingIds:w,cachedIds:C,matches:F,pendingMatches:T,cachedMatches:E,firstId:k,hasPending:O,matchRouteDeps:D,matchStores:i,pendingMatchStores:c,cachedMatchStores:d,__store:M,getRouteMatchStore:U,setMatches:V,setPending:j,setCached:N};V(t.matches),s?.(W);function V(_){I$(_,i,S,o,a)}n(V,"setMatches");function j(_){I$(_,c,w,o,a)}n(j,"setPending");function N(_){I$(_,d,C,o,a)}return n(N,"setCached"),W}n(pie,"createRouterStores");function y$(t,e){let o=[];for(let r of e){let a=t.get(r);a&&o.push(a.get())}return o}n(y$,"readPoolMatches");function I$(t,e,o,r,a){let s=t.map(c=>c.id),i=new Set(s);a(()=>{for(let c of e.keys())i.has(c)||e.delete(c);for(let c of t){let d=e.get(c.id);if(!d){let f=r(c);f.routeId=c.routeId,e.set(c.id,f);continue}d.routeId=c.routeId,d.get()!==c&&d.set(c)}Hse(o.get(),s)||o.set(s)})}n(I$,"reconcileMatchPool");var Uh="__TSR_index",mie="popstate",hie="beforeunload";function C$(t){let e=t.getLocation(),o=new Set,r=n(i=>{e=t.getLocation(),o.forEach(c=>c({location:e,action:i}))},"notify"),a=n(i=>{t.notifyOnIndexChange??!0?r(i):e=t.getLocation()},"handleIndexChange"),s=n(async({task:i,navigateOpts:c,...d})=>{if(c?.ignoreBlocker??!1){i();return}let f=t.getBlockers?.()??[],p=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&f.length&&p)for(let m of f){let h=ab(d.path,d.state);if(await m.blockerFn({currentLocation:e,nextLocation:h,action:d.type})){t.onBlocked?.();return}}i()},"tryNavigation");return{get location(){return e},get length(){return t.getLength()},subscribers:o,subscribe:n(i=>(o.add(i),()=>{o.delete(i)}),"subscribe"),push:n((i,c,d)=>{let f=e.state[Uh];c=w$(f+1,c),s({task:n(()=>{t.pushState(i,c),r({type:"PUSH"})},"task"),navigateOpts:d,type:"PUSH",path:i,state:c})},"push"),replace:n((i,c,d)=>{let f=e.state[Uh];c=w$(f,c),s({task:n(()=>{t.replaceState(i,c),r({type:"REPLACE"})},"task"),navigateOpts:d,type:"REPLACE",path:i,state:c})},"replace"),go:n((i,c)=>{s({task:n(()=>{t.go(i),a({type:"GO",index:i})},"task"),navigateOpts:c,type:"GO"})},"go"),back:n(i=>{s({task:n(()=>{t.back(i?.ignoreBlocker??!1),a({type:"BACK"})},"task"),navigateOpts:i,type:"BACK"})},"back"),forward:n(i=>{s({task:n(()=>{t.forward(i?.ignoreBlocker??!1),a({type:"FORWARD"})},"task"),navigateOpts:i,type:"FORWARD"})},"forward"),canGoBack:n(()=>e.state[Uh]!==0,"canGoBack"),createHref:n(i=>t.createHref(i),"createHref"),block:n(i=>{if(!t.setBlockers)return()=>{};let c=t.getBlockers?.()??[];return t.setBlockers([...c,i]),()=>{let d=t.getBlockers?.()??[];t.setBlockers?.(d.filter(f=>f!==i))}},"block"),flush:n(()=>t.flush?.(),"flush"),destroy:n(()=>t.destroy?.(),"destroy"),notify:r}}n(C$,"createHistory");function w$(t,e){e||(e={});let o=R$();return{...e,key:o,__TSR_key:o,[Uh]:t}}n(w$,"assignKeyAndIndex");function EF(t){let e=t?.window??(typeof document<"u"?window:void 0),o=e.history.pushState,r=e.history.replaceState,a=[],s=n(()=>a,"_getBlockers"),i=n(O=>a=O,"_setBlockers"),c=t?.createHref??(O=>O),d=t?.parseLocation??(()=>ab(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));if(!e.history.state?.__TSR_key&&!e.history.state?.key){let O=R$();e.history.replaceState({[Uh]:0,key:O,__TSR_key:O},"")}let f=d(),p,m=!1,h=!1,v=!1,x=!1,y=n(()=>f,"getLocation"),b,S,w=n(()=>{b&&(k._ignoreSubscribers=!0,(b.isPush?e.history.pushState:e.history.replaceState)(b.state,"",b.href),k._ignoreSubscribers=!1,b=void 0,S=void 0,p=void 0)},"flush"),C=n((O,D,M)=>{let L=c(D);S||(p=f),f=ab(D,M),b={href:L,state:M,isPush:b?.isPush||O==="push"},S||(S=Promise.resolve().then(()=>w()))},"queueHistoryAction"),F=n(O=>{f=d(),k.notify({type:O})},"onPushPop"),T=n(async()=>{if(h){h=!1;return}let O=d(),D=O.state[Uh]-f.state[Uh],M=D===1,L=D===-1,U=!M&&!L||m;m=!1;let W=U?"GO":L?"BACK":"FORWARD",V=U?{type:"GO",index:D}:{type:L?"BACK":"FORWARD"};if(v)v=!1;else{let j=s();if(typeof document<"u"&&j.length){for(let N of j)if(await N.blockerFn({currentLocation:f,nextLocation:O,action:W})){h=!0,e.history.go(1),k.notify(V);return}}}f=d(),k.notify(V)},"onPushPopEvent"),E=n(O=>{if(x){x=!1;return}let D=!1,M=s();if(typeof document<"u"&&M.length)for(let L of M){let U=L.enableBeforeUnload??!0;if(U===!0){D=!0;break}if(typeof U=="function"&&U()===!0){D=!0;break}}if(D)return O.preventDefault(),O.returnValue=""},"onBeforeUnload"),k=C$({getLocation:y,getLength:n(()=>e.history.length,"getLength"),pushState:n((O,D)=>C("push",O,D),"pushState"),replaceState:n((O,D)=>C("replace",O,D),"replaceState"),back:n(O=>(O&&(v=!0),x=!0,e.history.back()),"back"),forward:n(O=>{O&&(v=!0),x=!0,e.history.forward()},"forward"),go:n(O=>{m=!0,e.history.go(O)},"go"),createHref:n(O=>c(O),"createHref"),flush:w,destroy:n(()=>{e.history.pushState=o,e.history.replaceState=r,e.removeEventListener(hie,E,{capture:!0}),e.removeEventListener(mie,T)},"destroy"),onBlocked:n(()=>{p&&f!==p&&(f=p)},"onBlocked"),getBlockers:s,setBlockers:i,notifyOnIndexChange:!1});return e.addEventListener(hie,E,{capture:!0}),e.addEventListener(mie,T),e.history.pushState=function(...O){let D=o.apply(e.history,O);return k._ignoreSubscribers||F("PUSH"),D},e.history.replaceState=function(...O){let D=r.apply(e.history,O);return k._ignoreSubscribers||F("REPLACE"),D},k}n(EF,"createBrowserHistory");function F$(t={initialEntries:["/"]}){let e=t.initialEntries,o=t.initialIndex?Math.min(Math.max(t.initialIndex,0),e.length-1):e.length-1,r=e.map((d,f)=>w$(f,void 0)),a=n(()=>ab(e[o],r[o]),"getLocation"),s=[];return C$({getLocation:a,getLength:n(()=>e.length,"getLength"),pushState:n((d,f)=>{o<e.length-1&&(e.splice(o+1),r.splice(o+1)),r.push(f),e.push(d),o=Math.max(e.length-1,0)},"pushState"),replaceState:n((d,f)=>{r[o]=f,e[o]=d},"replaceState"),back:n(()=>{o=Math.max(o-1,0)},"back"),forward:n(()=>{o=Math.min(o+1,e.length-1)},"forward"),go:n(d=>{o=Math.min(Math.max(o+d,0),e.length-1)},"go"),createHref:n(d=>d,"createHref"),getBlockers:n(()=>s,"_getBlockers"),setBlockers:n(d=>s=d,"_setBlockers")})}n(F$,"createMemoryHistory");function jBe(t){let e=t.replace(/[\x00-\x1f\x7f]/g,"");return e.startsWith("//")&&(e="/"+e.replace(/^\/+/,"")),e}n(jBe,"sanitizePath");function ab(t,e){let o=jBe(t),r=o.indexOf("#"),a=o.indexOf("?"),s=R$();return{href:o,pathname:o.substring(0,r>0?a>0?Math.min(r,a):r:a>0?a:o.length),hash:r>-1?o.substring(r):"",search:a>-1?o.slice(a,r===-1?void 0:r):"",state:e||{[Uh]:0,key:s,__TSR_key:s}}}n(ab,"parseHref");function R$(){return(Math.random()+1).toString(36).substring(7)}n(R$,"createRandomKey");function Ap(t,e){let o=e,r=t;return{fromLocation:o,toLocation:r,pathChanged:o?.pathname!==r.pathname,hrefChanged:o?.href!==r.href,hashChanged:o?.hash!==r.hash}}n(Ap,"getLocationChangeInfo");var VM=new WeakMap,E$=class{static{n(this,"RouterCore")}constructor(t,e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=o=>o(),this.update=o=>{o.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");let r=this.options,a=this.basepath??r?.basepath??"/",s=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...o},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Jse(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=EF()),this.origin=this.options.origin,this.origin||(!!1&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let p;!1,this.resolvePathCache=Dh(1e3),p=this.buildRouteTree(),!1,this.setRoutes(p)}if(!this.stores&&this.latestLocation){let p=this.getStoreConfig(this);this.batch=p.batch,this.stores=pie(Iie(this.latestLocation),p),Sie(this)}let c=!1,d=this.options.basepath??"/",f=this.options.rewrite;if(s||a!==d||i!==f){this.basepath=d;let p=[],m=FF(d);m&&m!=="/"&&p.push(fie({basepath:d})),f&&p.push(f),this.rewrite=p.length===0?void 0:p.length===1?p[0]:die(p),this.history&&this.updateLatestLocation(),c=!0}c&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let o=Xse(this.routeTree,this.options.caseSensitive,(r,a)=>{r.init({originalIndex:a})});return this.options.routeMasks&&Wse(this.options.routeMasks,o.processedTree),o},this.subscribe=(o,r)=>{let a={eventType:o,fn:r};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=o=>{this.subscribers.forEach(r=>{r.eventType===o.type&&r.fn(o)})},this.parseLocation=(o,r)=>{let a=n(({pathname:d,search:f,hash:p,href:m,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){let S=this.options.parseSearch(f),w=this.options.stringifySearch(S);return{href:d+w+p,publicHref:d+w+p,pathname:ob(d).path,external:!1,searchStr:w,search:Oh(r?.search,S),hash:ob(p.slice(1)).path,state:Yd(r?.state,h)}}let v=new URL(m,this.origin),x=LM(this.rewrite,v),y=this.options.parseSearch(x.search),b=this.options.stringifySearch(y);return x.search=b,{href:x.href.replace(x.origin,""),publicHref:m,pathname:ob(x.pathname).path,external:!!this.rewrite&&x.origin!==this.origin,searchStr:b,search:Oh(r?.search,y),hash:ob(x.hash.slice(1)).path,state:Yd(r?.state,h)}},"parse"),s=a(o),{__tempLocation:i,__tempKey:c}=s.state;if(i&&(!c||c===this.tempLocationKey)){let d=a(i);return d.state.key=s.state.key,d.state.__TSR_key=s.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:s}}return s},this.resolvePathWithBase=(o,r)=>p$({base:o,to:r.includes("//")?CF(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(o,r,a)=>typeof o=="string"?this.matchRoutesInternal({pathname:o,search:r},a):this.matchRoutesInternal(o,r),this.getMatchedRoutes=o=>bie({pathname:o,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=o=>{let r=this.getMatch(o);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(o=>{this.cancelMatch(o)}),this.stores.matchesId.get().forEach(o=>{if(this.stores.pendingMatchStores.has(o))return;let r=this.stores.matchStores.get(o)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(o)})},this.buildLocation=o=>{let r=n((s={})=>{let i=s._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(s.from&&s._isNavigate){let L=this.getMatchedRoutes(s.from).matchedRoutes,U=s$(c.matchedRoutes,V=>vie(V.fullPath,s.from)),W=s$(L,V=>vie(V.fullPath,c.fullPath));!U&&!W&&console.warn(`Could not find match for from: ${s.from}`)}let d=s.unsafeRelative==="path"?i.pathname:s.from??c.fullPath,f=s.to?`${s.to}`:void 0,p=c.search,m=Object.assign(Object.create(null),c.params),h=f?.charCodeAt(0)===47?"/":this.resolvePathWithBase(d,"."),v=f?this.resolvePathWithBase(h,f):h,x=s.params===!1||s.params===null?Object.create(null):(s.params??!0)===!0?m:Object.assign(m,pl(s.params,m)),y=this.routesByPath[Jl(v)],b;if(y)b=this.getRouteBranch(y);else if(v.includes("$"))b=[];else{let L=this.getMatchedRoutes(v);b=L.matchedRoutes,this.options.notFoundRoute&&(!L.foundRoute||L.foundRoute.path!=="/"&&L.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&Ph(x))for(let L of b){let U=L.options.params?.stringify??L.options.stringifyParams;if(U)try{Object.assign(x,U(x))}catch{}}let S=o.leaveParams?v:ob(OM({path:v,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(y&&!o.leaveParams)try{let L=this.getMatchedRoutes(S);L.foundRoute?.id!==y.id&&console.warn(`Generated path "${S}" for route "${y.id}" matched route "${L.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let w=p;if(o._includeValidateSearch&&this.options.search?.strict){let L={};b.forEach(U=>{if(U.options.validateSearch)try{Object.assign(L,BM(U.options.validateSearch,{...L,...w}))}catch{}}),w=L}w=qBe({search:w,dest:s,destRoutes:b,_includeValidateSearch:o._includeValidateSearch}),w=Oh(p,w);let C=this.options.stringifySearch(w),F=s.hash===!0?i.hash:s.hash?pl(s.hash,i.hash):void 0,T=F?`#${F}`:"",E=s.state===!0?i.state:s.state?pl(s.state,i.state):{};E=Yd(i.state,E);let k=`${S}${C}${T}`,O,D,M=!1;if(this.rewrite){let L=new URL(k,this.origin),U=x$(this.rewrite,L);O=L.href.replace(L.origin,""),U.origin!==this.origin?(D=U.href,M=!0):D=U.pathname+U.search+U.hash}else O=$se(k),D=O;return{publicHref:D,href:O,pathname:S,search:w,searchStr:C,state:E,hash:F??"",external:M,unmaskOnReload:s.unmaskOnReload}},"build"),a=n((s={},i)=>{let c=r(s),d=i?r(i):void 0;if(!d){let f=Object.create(null);if(this.options.routeMasks){let p=Gse(c.pathname,this.processedTree);if(p){Object.assign(f,p.rawParams);let{from:m,params:h,...v}=p.route,x=h===!1||h===null?Object.create(null):(h??!0)===!0?f:Object.assign(f,pl(h,f));i={from:o.from,...v,params:x},d=r(i)}}}return d&&(c.maskedLocation=d),c},"buildWithMatches");return o.mask?a(o,{from:o.from,...o.mask}):a(o)},this.commitLocation=async({viewTransition:o,ignoreBlocker:r,...a})=>{let s,i=n(()=>{let f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(m=>{a.state[m]=this.latestLocation.state[m]});let p=ju(a.state,this.latestLocation.state);return f.forEach(m=>{delete a.state[m]}),p},"isSameState"),c=Jl(this.latestLocation.href)===Jl(a.href),d=this.commitLocationPromise;if(this.commitLocationPromise=Xd(()=>{d?.resolve(),d=void 0}),c&&i())this.load();else{let{maskedLocation:f,hashScrollIntoView:p,...m}=a;f&&(m={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...m,search:m.searchStr,state:{...m.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(m.unmaskOnReload??this.options.unmaskOnReload??!1)&&(m.state.__tempKey=this.tempLocationKey)),m.state.__hashScrollIntoViewOptions=p??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=o,s=a.replace?"REPLACE":"PUSH",this.history[s==="REPLACE"?"replace":"push"](m.publicHref,m.state,{ignoreBlocker:r})}return this._scroll.next=a.resetScroll??!0,this.history.subscribers.size||this.load(s?{action:{type:s}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:o,resetScroll:r,hashScrollIntoView:a,viewTransition:s,ignoreBlocker:i,href:c,...d}={})=>{if(c){let m=this.history.location.state.__TSR_index,h=ab(c,{__TSR_index:o?m:m+1}),v=new URL(h.pathname,this.origin);d.to=LM(this.rewrite,v).pathname,d.search=this.options.parseSearch(h.search),d.hash=h.hash.slice(1)}let f=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=f;let p=this.commitLocation({...f,viewTransition:s,replace:o,resetScroll:r,hashScrollIntoView:a,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===f&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:o,reloadDocument:r,href:a,publicHref:s,...i})=>{let c=!1;if(a)try{new URL(`${a}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(o!==void 0||!a){let f=this.buildLocation({to:o,...i});a=a??f.publicHref,s=s??f.publicHref}let d=!c&&s?s:a;if(Qd(d,this.protocolAllowlist))return console.warn(`Blocked navigation to dangerous protocol: ${d}`),Promise.resolve();if(!i.ignoreBlocker){let f=this.history.getBlockers?.()??[];for(let p of f)if(p?.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return i.replace?window.location.replace(d):window.location.href=d,Promise.resolve()}return this.buildAndCommitLocation({...i,href:a,to:o,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),!1){let a=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(this.latestLocation.publicHref!==a.publicHref){let s=this.getParsedLocationHref(a);throw a.external?rb({href:s}):rb({href:s,_builtLocation:a})}}let o=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(a=>!o.some(s=>s.id===a.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(o),this.stores.setCached(r)})},this.load=async o=>{let r=o?.action?.type,a,s,i,c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad(),r?VM.set(this.latestLocation,r):VM.delete(this.latestLocation);let p=this.latestLocation,m=Ap(p,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...m}),this.emit({type:"onBeforeLoad",...m}),await g$({router:this,sync:o?.sync,forceStaleReload:c.href===p.href,matches:this.stores.pendingMatches.get(),location:p,updateMatch:this.updateMatch,onReady:n(async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,v=null,x=null,y=null;this.batch(()=>{let b=this.stores.pendingMatches.get(),S=b.length,w=this.stores.matches.get();h=S?w.filter(T=>!this.stores.pendingMatchStores.has(T.id)):null;let C=new Set;for(let T of this.stores.pendingMatchStores.values())T.routeId&&C.add(T.routeId);let F=new Set;for(let T of this.stores.matchStores.values())T.routeId&&F.add(T.routeId);v=S?w.filter(T=>!C.has(T.routeId)):null,x=S?b.filter(T=>!F.has(T.routeId)):null,y=S?b.filter(T=>F.has(T.routeId)):w,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),S&&(this.stores.setMatches(b),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...h.filter(T=>T.status!=="error"&&T.status!=="notFound"&&T.status!=="redirected")]),this.clearExpiredCache())});for(let[b,S]of[[v,"onLeave"],[x,"onEnter"],[y,"onStay"]])if(b)for(let w of b)this.looseRoutesById[w.routeId].options[S]?.(w)})})},"onReady")})}catch(p){ns(p)?(a=p,this.navigate({...a.options,replace:!0,ignoreBlocker:!0})):Hn(p)&&(s=p);let m=a?a.status:s?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(m),this.stores.redirect.set(a)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let d;this.hasNotFoundMatch()?d=404:this.stores.matches.get().some(f=>f.status==="error")&&(d=500),d!==void 0&&this.stores.statusCode.set(d)},this.startViewTransition=o=>{let r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof r=="object"&&this.isViewTransitionTypesSupported){let s=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(Ap(s,i)):r.types;if(c===!1){o();return}a={update:o,types:c}}else a=o;document.startViewTransition(a)}else o()},this.updateMatch=(o,r)=>{this.startTransition(()=>{let a=this.stores.pendingMatchStores.get(o);if(a){a.set(r);return}let s=this.stores.matchStores.get(o);if(s){s.set(r);return}let i=this.stores.cachedMatchStores.get(o);if(i){let c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(o)&&this.stores.cachedIds.set(d=>d.filter(f=>f!==o)):i.set(c)}})},this.getMatch=o=>this.stores.cachedMatchStores.get(o)?.get()??this.stores.pendingMatchStores.get(o)?.get()??this.stores.matchStores.get(o)?.get(),this.invalidate=o=>{let r=n(a=>o?.filter?.(a)??!0?{...a,invalid:!0,...o?.forcePending||a.status==="error"||a.status==="notFound"?{status:"pending",error:void 0}:void 0}:a,"invalidate");return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(r)),this.stores.setCached(this.stores.cachedMatches.get().map(r)),this.stores.setPending(this.stores.pendingMatches.get().map(r))}),this.shouldViewTransition=!1,this.load({sync:o?.sync})},this.getParsedLocationHref=o=>o.publicHref||"/",this.resolveRedirect=o=>{let r=o.headers.get("Location");if(!o.options.href||o.options._builtLocation){let a=o.options._builtLocation??this.buildLocation(o.options),s=this.getParsedLocationHref(a);o.options.href=s,o.headers.set("Location",s)}else if(r)try{let a=new URL(r);if(this.origin&&a.origin===this.origin){let s=a.pathname+a.search+a.hash;o.options.href=s,o.headers.set("Location",s)}}catch{}if(o.options.href&&!o.options._builtLocation&&Qd(o.options.href,this.protocolAllowlist))throw new Error(`Redirect blocked: unsafe protocol in href "${o.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`);return o.headers.get("Location")||o.headers.set("Location",o.options.href),o},this.clearCache=o=>{let r=o?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(a=>!r(a))):this.stores.setCached([])},this.clearExpiredCache=()=>{let o=Date.now(),r=n(a=>{let s=this.looseRoutesById[a.routeId];if(!s.options.loader)return!0;let i=(a.preload?s.options.preloadGcTime??this.options.defaultPreloadGcTime:s.options.gcTime??this.options.defaultGcTime)??300*1e3;return a.status==="error"?!0:o-a.updatedAt>=i},"filter");this.clearCache({filter:r})},this.loadRouteChunk=nb,this.preloadRoute=async o=>{let r=o._builtLocation??this.buildLocation(o),a=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:o}),s=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...s,...this.stores.cachedIds.get()]),c=a.filter(d=>!i.has(d.id));if(c.length){let d=this.stores.cachedMatches.get();this.stores.setCached([...d,...c])}try{return a=await g$({router:this,matches:a,location:r,preload:!0,updateMatch:n((d,f)=>{s.has(d)?a=a.map(p=>p.id===d?f(p):p):this.updateMatch(d,f)},"updateMatch")}),a}catch(d){if(ns(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:r});Hn(d)||console.error(d);return}},this.matchRoute=(o,r)=>{let a={...o,to:o.to?this.resolvePathWithBase(o.from||"",o.to):void 0,params:o.params||{},leaveParams:!0},s=this.buildLocation(a);if(r?.pending&&this.stores.status.get()!=="pending")return!1;let i=(r?.pending===void 0?!this.stores.isLoading.get():r.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=Kse(s.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||o.params&&!ju(c.rawParams,o.params,{partial:!0})?!1:r?.includeSearch??!0?ju(i.search,s.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(o=>o.status==="notFound"||o.globalNotFound),this.getStoreConfig=e,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??rie,parseSearch:t.parseSearch??oie,protocolAllowlist:t.protocolAllowlist??i$}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:t,routesByPath:e,processedTree:o}){this.routesById=t,this.routesByPath=e,this.processedTree=o;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(t){let e=this.routeBranchCache.get(t);return e||(e=f$(t),this.routeBranchCache.set(t,e)),e}get looseRoutesById(){return this.routesById}getParentContext(t){return t?.id?t.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(t,e){let o=this.getMatchedRoutes(t.pathname),{foundRoute:r,routeParams:a}=o,{matchedRoutes:s}=o,i=!1;(r?r.path!=="/"&&a["**"]:Jl(t.pathname))&&(this.options.notFoundRoute?s=[...s,this.options.notFoundRoute]:i=!0);let c=i?GBe(this.options.notFoundMode,s):void 0,d=new Array(s.length),f=new Map;for(let p of this.stores.matchStores.values())p.routeId&&f.set(p.routeId,p.get());for(let p=0;p<s.length;p++){let m=s[p],h=d[p-1],v,x,y;{let U=h?.search??t.search,W=h?._strictSearch??void 0;try{let V=BM(m.options.validateSearch,{...U})??void 0;v={...U,...V},x={...W,...V},y=void 0}catch(V){let j=V;if(V instanceof AF||(j=new AF(V.message,{cause:V})),e?.throwOnError)throw j;v=U,x={},y=j}}let b=m.options.loaderDeps?.({search:v})??"",S=b?JSON.stringify(b):"",{interpolatedPath:w,usedParams:C}=OM({path:m.fullPath,params:a,decoder:this.pathParamsDecoder,server:this.isServer}),F=m.id+w+S,T=this.getMatch(F),E=f.get(m.id),k=T?._strictParams??C,O;if(!T)try{xie(m,k)}catch(U){if(Hn(U)||ns(U)?O=U:O=new yie(U.message,{cause:U}),e?.throwOnError)throw O}Object.assign(a,k);let D=E?"stay":"enter",M;if(T)M={...T,cause:D,params:E?.params??a,_strictParams:k,search:E?Oh(E.search,v):Oh(T.search,v),_strictSearch:x};else{let U=m.options.loader||m.options.beforeLoad||m.lazyFn||v$(m)?"pending":"success";M={id:F,ssr:m.options.ssr,index:p,routeId:m.id,params:E?.params??a,_strictParams:k,pathname:w,updatedAt:Date.now(),search:E?Oh(E.search,v):v,_strictSearch:x,searchError:void 0,status:U,isFetching:!1,error:void 0,paramsError:O,__routeContext:void 0,_nonReactive:{loadPromise:Xd()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:D,loaderDeps:E?Yd(E.loaderDeps,b):b,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:m.options.staticData||{},fullPath:m.fullPath}}e?.preload||(M.globalNotFound=c===m.id),M.searchError=y;let L=this.getParentContext(h);M.context={...L,...M.__routeContext,...M.__beforeLoadContext},d[p]=M}for(let p=0;p<d.length;p++){let m=d[p],h=this.looseRoutesById[m.routeId],v=this.getMatch(m.id),x=f.get(m.routeId);if(m.params=x?Oh(x.params,a):a,!v){let y=d[p-1],b=this.getParentContext(y);if(h.options.context){let S={deps:m.loaderDeps,params:m.params,context:b??{},location:t,navigate:n(w=>this.navigate({...w,_fromLocation:t}),"navigate"),buildLocation:this.buildLocation,cause:m.cause,abortController:m.abortController,preload:!!m.preload,matches:d,routeId:h.id};m.__routeContext=h.options.context(S)??void 0}m.context={...b,...m.__routeContext,...m.__beforeLoadContext}}}return d}matchRoutesLightweight(t){let{matchedRoutes:e,routeParams:o}=this.getMatchedRoutes(t.pathname),r=Mh(e),a={...t.search};for(let f of e)try{Object.assign(a,BM(f.options.validateSearch,a))}catch{}let s=Mh(this.stores.matchesId.get()),i=s&&this.stores.matchStores.get(s)?.get(),c=i&&i.routeId===r.id&&i.pathname===t.pathname,d;if(c)d=i.params;else{let f=Object.assign(Object.create(null),o);for(let p of e)try{xie(p,f)}catch{}d=f}return{matchedRoutes:e,fullPath:r.fullPath,search:a,params:d}}},AF=class extends Error{static{n(this,"SearchParamError")}},yie=class extends Error{static{n(this,"PathParamError")}},gie=n(t=>t.endsWith("/")&&t.length>1?t.slice(0,-1):t,"normalize");function vie(t,e){return gie(t)===gie(e)}n(vie,"comparePaths");function Iie(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],statusCode:200}}n(Iie,"getInitialRouterState");function BM(t,e){if(t==null)return{};if("~standard"in t){let o=t["~standard"].validate(e);if(o instanceof Promise)throw new AF("Async validation not supported");if(o.issues)throw new AF(JSON.stringify(o.issues,void 0,2),{cause:o});return o.value}return"parse"in t?t.parse(e):typeof t=="function"?t(e):{}}n(BM,"validateSearch");function bie({pathname:t,routesById:e,processedTree:o}){let r=Object.create(null),a=Jl(t),s,i=Yse(a,o,!0);return i&&(s=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[e.__root__],routeParams:r,foundRoute:s}}n(bie,"getMatchedRoutes");function qBe({search:t,dest:e,destRoutes:o,_includeValidateSearch:r}){return WBe(o)(t,e,r??!1)}n(qBe,"applySearchMiddleware");function WBe(t){let e,o,r=[];for(let s of t){let i=s.options;if("search"in i)i.search?.middlewares&&r.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){let d=n(({search:f,next:p})=>{let m=p(i.preSearchFilters?i.preSearchFilters.reduce((h,v)=>v(h),f):f);return i.postSearchFilters?i.postSearchFilters.reduce((h,v)=>v(h),m):m},"legacyMiddleware");r.push(d)}let c=i.validateSearch;if(c){let d=n(({search:f,next:p,meta:m})=>{let h=p(f);if(o)try{let v=BM(c,h);if(m&&v)for(let x in v)x in h||(m.defaulted||=new Map).set(x,v[x]);return{...h,...v}}catch{}return h},"validate");r.push(d)}}let a=n((s,i,c)=>{if(s>=r.length){if(!e.search)return{};if(e.search===!0)return i;let f=pl(e.search,i);return c&&(c.explicit=f),f}let d=n((f,p)=>{if(p){let m=c||{};return{search:a(s+1,f,m),meta:m}}return a(s+1,f,c)},"next");return r[s]({search:i,next:d,meta:c})},"applyNext");return n(function(i,c,d){return e=c,o=d,a(0,i)},"middleware")}n(WBe,"buildMiddlewareChain");function GBe(t,e){if(t!=="root")for(let o=e.length-1;o>=0;o--){let r=e[o];if(r.children)return r.id}return ml}n(GBe,"findGlobalNotFoundRouteId");function xie(t,e){let o=t.options.params?.parse??t.options.parseParams;if(o){let r=o(e);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(e,r)}}n(xie,"extractStrictParams");function KBe(){try{return sessionStorage}catch{return}}n(KBe,"getSafeSessionStorage");var YBe="tsr-scroll-restoration-v1_3",Fie=KBe();function XBe(){try{return JSON.parse(Fie?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}n(XBe,"createScrollRestorationCache");function QBe(){try{Fie?.setItem(YBe,JSON.stringify(sb))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}n(QBe,"persistScrollRestorationCache");var sb=XBe(),wie="data-scroll-restoration-id",ZBe=n(t=>t.state.__TSR_key||t.href,"defaultGetScrollRestorationKey");function JBe(t){let e=t.getAttribute(wie);if(e)return`[${wie}="${e}"]`;let o="",r=t,a;for(;a=r.parentNode;){let s=1,i=r;for(;i=i.previousElementSibling;)s++;let c=`${r.localName}:nth-child(${s})`;o=o?`${c} > ${o}`:c,r=a}return o}n(JBe,"getScrollRestorationSelector");var UM=!1,ib="window";function A$(t){try{return typeof t=="function"?t():document.querySelector(t)}catch{}}n(A$,"getElement");function Cie(t){let e=[];for(let o of t){if(o===ib)continue;let r=A$(o);r&&e.push(r)}return e}n(Cie,"getScrollToTopElements");function Sie(t,e){let o=e??t.options.scrollRestoration,r=t._scroll;if(o&&(r.restoring=!0),!1)return;let a=t.options.getScrollRestorationKey||ZBe,s=new Map,i=n((f,p,m)=>{let h=s.get(f)||{};h.scrollX=p,h.scrollY=m,s.set(f,h)},"setTrackedScrollEntry"),c=n(f=>{if(!(UM||!r.restoring))if(f.target===document)i(ib,scrollX,scrollY);else{let p=f.target;i(p,p.scrollLeft,p.scrollTop)}},"onScroll"),d=n(f=>{if(!r.restoring)return;let p=sb[f]||={};for(let[m,h]of s)m===ib?p[ib]=h:m.isConnected&&(p[JBe(m)]=h)},"snapshotCurrentScrollTargets");o&&!r.restoration&&(r.restoration=!0,UM=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),t.subscribe("onBeforeLoad",f=>{f.fromLocation&&d(a(f.fromLocation)),s.clear()}),addEventListener("pagehide",()=>{d(a(t.stores.resolvedLocation.get()??t.stores.location.get())),QBe()})),!r.reset&&(r.reset=!0,t.subscribe("onRendered",f=>{let p=t.options.scrollRestorationBehavior,m=t.options.scrollToTopSelectors,h=r.next,v;if(s.clear(),h||(r.next=!0),typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return;let x=a(f.toLocation),y=f.fromLocation&&a(f.fromLocation);if(r.restoring&&y&&y!==x){let b=sb[y];if(b){let S=sb[x];for(let w in b){if(w===ib){if(h)continue}else{let C=A$(w);if(!C||h&&m&&(v??=Cie(m),v.includes(C)))continue}S||(S=sb[x]={}),S[w]??=b[w]}}}UM=!0;try{let b=f.toLocation.hash,S=f.toLocation.state.__hashScrollIntoViewOptions??!0,w=!1;if(h){let C=VM.get(f.toLocation),F=b&&S&&(C==="PUSH"||C==="REPLACE"),T=r.restoring?sb[x]:void 0;if(T)for(let E in T){let{scrollX:k,scrollY:O}=T[E];if(E===ib){if(F)continue;scrollTo({top:O,left:k,behavior:p}),w=!0}else{let D=A$(E);D&&(D.scrollLeft=k,D.scrollTop=O)}}if(!w&&!b){let E={top:0,left:0,behavior:p};if(scrollTo(E),m){v??=Cie(m);for(let k of v)k.scrollTo(E)}}}!w&&b&&S&&document.getElementById(b)?.scrollIntoView(S)}finally{UM=!1}}))}n(Sie,"setupScrollRestoration");var T$="Error preloading route! \u261D\uFE0F";var zM=class{static{n(this,"BaseRoute")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(t){if(this.init=e=>{this.originalIndex=e.originalIndex;let o=this.options,r=!o?.path&&!o?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=ml;else if(!this.parentRoute)throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");let a=r?ml:o?.path;a&&a!=="/"&&(a=MM(a));let s=o?.id||a,i=r?ml:kv([this.parentRoute.id==="__root__"?"":this.parentRoute.id,s]);a==="__root__"&&(a="/"),i!=="__root__"&&(i=kv(["/",i]));let c=i==="__root__"?"/":kv([this.parentRoute.fullPath,a]);this._path=a,this._id=i,this._fullPath=c,this._to=Jl(c)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>rb({from:this.fullPath,...e}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}};var k$=class extends zM{static{n(this,"BaseRootRoute")}constructor(t){super(t)}};var lb=K(oe(),1),qu=K($t(),1);function Pv(t){let e=t.errorComponent??Ov;return(0,qu.jsx)(o4e,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:n(({error:o,reset:r})=>o?lb.createElement(e,{error:o,reset:r}):t.children,"children")})}n(Pv,"CatchBoundary");var o4e=class extends lb.Component{static{n(this,"CatchBoundaryImpl")}constructor(...t){super(...t),this.state={error:null}}static getDerivedStateFromProps(t,e){let o=t.getResetKey();return e.error&&e.resetKey!==o?{resetKey:o,error:null}:{resetKey:o}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidCatch(t,e){this.props.onCatch&&this.props.onCatch(t,e)}render(){return this.props.children({error:this.state.error,reset:n(()=>{this.reset()},"reset")})}};function Ov({error:t}){let[e,o]=lb.useState(!0);return(0,qu.jsxs)("div",{style:{padding:".5rem",maxWidth:"100%"},children:[(0,qu.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[(0,qu.jsx)("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),(0,qu.jsx)("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:n(()=>o(r=>!r),"onClick"),children:e?"Hide Error":"Show Error"})]}),(0,qu.jsx)("div",{style:{height:".25rem"}}),e?(0,qu.jsx)("div",{children:(0,qu.jsx)("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?(0,qu.jsx)("code",{children:t.message}):null})}):null]})}n(Ov,"ErrorComponent");var $M=K(oe(),1),M$=K($t(),1);function Rie({children:t,fallback:e=null}){return P$()?(0,M$.jsx)($M.default.Fragment,{children:t}):(0,M$.jsx)($M.default.Fragment,{children:e})}n(Rie,"ClientOnly");function P$(){return $M.default.useSyncExternalStore(r4e,()=>!0,()=>!1)}n(P$,"useHydrated");function r4e(){return()=>{}}n(r4e,"subscribe");var Eie=K(oe(),1),HM=Eie.createContext(null);var Aie=K(oe(),1);function vn(t){let e=Aie.useContext(HM);return(t?.warn??!0)&&!e&&console.warn("Warning: useRouter must be used inside a <RouterProvider> component!"),e}n(vn,"useRouter");var O$=K(oe(),1),Nv=O$.createContext(void 0),Tie=O$.createContext(void 0);var KM=K(oe(),1);var Ln=(t=>(t[t.None=0]="None",t[t.Mutable=1]="Mutable",t[t.Watching=2]="Watching",t[t.RecursedCheck=4]="RecursedCheck",t[t.Recursed=8]="Recursed",t[t.Dirty=16]="Dirty",t[t.Pending=32]="Pending",t))(Ln||{});function kie({update:t,notify:e,unwatched:o}){return{link:r,unlink:a,propagate:s,checkDirty:i,shallowPropagate:c};function r(f,p,m){let h=p.depsTail;if(h!==void 0&&h.dep===f)return;let v=h!==void 0?h.nextDep:p.deps;if(v!==void 0&&v.dep===f){v.version=m,p.depsTail=v;return}let x=f.subsTail;if(x!==void 0&&x.version===m&&x.sub===p)return;let y=p.depsTail=f.subsTail={version:m,dep:f,sub:p,prevDep:h,nextDep:v,prevSub:x,nextSub:void 0};v!==void 0&&(v.prevDep=y),h!==void 0?h.nextDep=y:p.deps=y,x!==void 0?x.nextSub=y:f.subs=y}function a(f,p=f.sub){let m=f.dep,h=f.prevDep,v=f.nextDep,x=f.nextSub,y=f.prevSub;return v!==void 0?v.prevDep=h:p.depsTail=h,h!==void 0?h.nextDep=v:p.deps=v,x!==void 0?x.prevSub=y:m.subsTail=y,y!==void 0?y.nextSub=x:(m.subs=x)===void 0&&o(m),v}function s(f){let p=f.nextSub,m;e:do{let h=f.sub,v=h.flags;if(v&60?v&12?v&4?!(v&48)&&d(f,h)?(h.flags=v|40,v&=1):v=0:h.flags=v&-9|32:v=0:h.flags=v|32,v&2&&e(h),v&1){let x=h.subs;if(x!==void 0){let y=(f=x).nextSub;y!==void 0&&(m={value:p,prev:m},p=y);continue}}if((f=p)!==void 0){p=f.nextSub;continue}for(;m!==void 0;)if(f=m.value,m=m.prev,f!==void 0){p=f.nextSub;continue e}break}while(!0)}function i(f,p){let m,h=0,v=!1;e:do{let x=f.dep,y=x.flags;if(p.flags&16)v=!0;else if((y&17)===17){if(t(x)){let b=x.subs;b.nextSub!==void 0&&c(b),v=!0}}else if((y&33)===33){(f.nextSub!==void 0||f.prevSub!==void 0)&&(m={value:f,prev:m}),f=x.deps,p=x,++h;continue}if(!v){let b=f.nextDep;if(b!==void 0){f=b;continue}}for(;h--;){let b=p.subs,S=b.nextSub!==void 0;if(S?(f=m.value,m=m.prev):f=b,v){if(t(p)){S&&c(b),p=f.sub;continue}v=!1}else p.flags&=-33;p=f.sub;let w=f.nextDep;if(w!==void 0){f=w;continue e}}return v}while(!0)}function c(f){do{let p=f.sub,m=p.flags;(m&48)===32&&(p.flags=m|16,(m&6)===2&&e(p))}while((f=f.nextSub)!==void 0)}function d(f,p){let m=p.depsTail;for(;m!==void 0;){if(m===f)return!0;m=m.prevDep}return!1}}n(kie,"createReactiveSystem");function Oie(t,e,o){let r=typeof t=="object",a=r?t:void 0;return{next:(r?t.next:t)?.bind(a),error:(r?t.error:e)?.bind(a),complete:(r?t.complete:o)?.bind(a)}}n(Oie,"toObserver");var N$=[],qM=0,{link:Mie,unlink:n4e,propagate:a4e,checkDirty:Nie,shallowPropagate:Pie}=kie({update(t){return t._update()},notify(t){N$[D$++]=t,t.flags&=~Ln.Watching},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=Ln.Mutable|Ln.Dirty,WM(t))}}),jM=0,D$=0,Zd,_$=0;function TF(t){try{++_$,t()}finally{--_$||L$()}}n(TF,"batch");function WM(t){let e=t.depsTail,o=e!==void 0?e.nextDep:t.deps;for(;o!==void 0;)o=n4e(o,t)}n(WM,"purgeDeps");function L$(){if(!(_$>0)){for(;jM<D$;){let t=N$[jM];N$[jM++]=void 0,t.notify()}jM=0,D$=0}}n(L$,"flush");function GM(t,e){let o=typeof t=="function",r=t,a={_snapshot:o?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:o?Ln.None:Ln.Mutable,get(){return Zd!==void 0&&Mie(a,Zd,qM),a._snapshot},subscribe(s){let i=Oie(s),c={current:!1},d=s4e(()=>{a.get(),c.current?i.next?.(a._snapshot):c.current=!0});return{unsubscribe:n(()=>{d.stop()},"unsubscribe")}},_update(s){let i=Zd,c=e?.compare??Object.is;if(o)Zd=a,++qM,a.depsTail=void 0;else if(s===void 0)return!1;o&&(a.flags=Ln.Mutable|Ln.RecursedCheck);try{let d=a._snapshot,f=typeof s=="function"?s(d):s===void 0&&o?r(d):s;return d===void 0||!c(d,f)?(a._snapshot=f,!0):!1}finally{Zd=i,o&&(a.flags&=~Ln.RecursedCheck),WM(a)}}};return o?(a.flags=Ln.Mutable|Ln.Dirty,a.get=function(){let s=a.flags;if(s&Ln.Dirty||s&Ln.Pending&&Nie(a.deps,a)){if(a._update()){let i=a.subs;i!==void 0&&Pie(i)}}else s&Ln.Pending&&(a.flags=s&~Ln.Pending);return Zd!==void 0&&Mie(a,Zd,qM),a._snapshot}):a.set=function(s){if(a._update(s)){let i=a.subs;i!==void 0&&(a4e(i),Pie(i),L$())}},a}n(GM,"createAtom");function s4e(t){let e=n(()=>{let r=Zd;Zd=o,++qM,o.depsTail=void 0,o.flags=Ln.Watching|Ln.RecursedCheck;try{return t()}finally{Zd=r,o.flags&=~Ln.RecursedCheck,WM(o)}},"run"),o={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Ln.Watching|Ln.RecursedCheck,notify(){let r=this.flags;r&Ln.Dirty||r&Ln.Pending&&Nie(this.deps,this)?e():this.flags=Ln.Watching},stop(){this.flags=Ln.None,this.depsTail=void 0,WM(this)}};return e(),o}n(s4e,"effect");var V$=K(oe(),1),zie=K(kF(),1);function i4e(t,e){return t===e}n(i4e,"defaultCompare");function Zn(t,e,o=i4e){let r=(0,V$.useCallback)(i=>{if(!t)return()=>{};let{unsubscribe:c}=t.subscribe(i);return c},[t]),a=(0,V$.useCallback)(()=>t?.get(),[t]);return(0,zie.useSyncExternalStoreWithSelector)(r,a,a,e,o)}n(Zn,"useStore");var U$={get(){},subscribe(){return{unsubscribe(){}}}};function z$(t,e){let o=KM.useRef();return r=>{let a=t?.select?t.select(r):r;return t?.structuralSharing??e.options.defaultStructuralSharing?o.current=Yd(o.current,a):a}}n(z$,"useStructuralSharing");function ec(t){let e=vn(),o=KM.useContext(t.from?Tie:Nv),r=t.from?e.stores.getRouteMatchStore(t.from):e.stores.matchStores.get(o);if(!1){let i=r?.get();if(!i){if(t.shouldThrow??!0)throw new Error(`Invariant failed: Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`);return}return t.select?t.select(i):i}let a=z$(t,e),s=Zn(r??U$,i=>i?a(i):U$);if(s!==U$)return s;if(t.shouldThrow??!0)throw new Error(`Invariant failed: Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`)}n(ec,"useMatch");function $$(t){return ec({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:n(e=>t.select?t.select(e.loaderData):e.loaderData,"select")})}n($$,"useLoaderData");function H$(t){let{select:e,...o}=t;return ec({...o,select:n(r=>e?e(r.loaderDeps):r.loaderDeps,"select")})}n(H$,"useLoaderDeps");function j$(t){return ec({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:n(e=>{let o=t.strict===!1?e.params:e._strictParams;return t.select?t.select(o):o},"select")})}n(j$,"useParams");function zh(t){return ec({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:n(e=>t.select?t.select(e.search):e.search,"select")})}n(zh,"useSearch");var q$=K(oe(),1);function zs(t){let e=vn();return q$.useCallback(o=>e.navigate({...o,from:o.from??t?.from}),[t?.from,e])}n(zs,"useNavigate");function W$(t){return ec({...t,select:n(e=>t.select?t.select(e.context):e.context,"select")})}n(W$,"useRouteContext");var $a=K(oe(),1),l4e=K($t(),1);var Gie=K(oi(),1);function c4e(t,e){let o=vn(),r=_se(e),a=!1,{activeProps:s,inactiveProps:i,activeOptions:c,to:d,preload:f,preloadDelay:p,preloadIntentProximity:m,hashScrollIntoView:h,replace:v,startTransition:x,resetScroll:y,viewTransition:b,children:S,target:w,disabled:C,style:F,className:T,onClick:E,onBlur:k,onFocus:O,onMouseEnter:D,onMouseLeave:M,onTouchStart:L,ignoreBlocker:U,params:W,search:V,hash:j,state:N,mask:_,reloadDocument:B,unsafeRelative:z,from:q,_fromLocation:$,...Y}=t;if(a){let Be=Wie(d);if(typeof d=="string"&&!Be&&d.indexOf(":")>-1)try{return new URL(d),Qd(d,o.protocolAllowlist)?(console.warn(`Blocked Link with dangerous protocol: ${d}`),{...Y,ref:r,href:void 0,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T}}):{...Y,ref:r,href:d,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T}}}catch{}let Me=o.buildLocation({...t,from:t.from}),je=qie(Me.maskedLocation?Me.maskedLocation.publicHref:Me.publicHref,Me.maskedLocation?Me.maskedLocation.external:Me.external,o.history,C),mt=(()=>{if(je?.external){if(Qd(je.href,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${je.href}`);return}return je.href}if(!Be&&typeof d=="string"&&d.indexOf(":")>-1)try{if(new URL(d),Qd(d,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${d}`);return}return d}catch{}})(),ht=(()=>{if(mt)return!1;let At=o.stores.location.get(),ee=c?.exact??!1;if(ee){if(!PM(At.pathname,Me.pathname,o.basepath))return!1}else{let ce=Bh(At.pathname,o.basepath),Ee=Bh(Me.pathname,o.basepath);if(!(ce.startsWith(Ee)&&(ce.length===Ee.length||ce[Ee.length]==="/")))return!1}if((c?.includeSearch??!0)&&At.search!==Me.search){let ce=!At.search||typeof At.search=="object"&&!Ph(At.search),Ee=!Me.search||typeof Me.search=="object"&&!Ph(Me.search);if(!(ce&&Ee)&&!ju(At.search,Me.search,{partial:!ee,ignoreUndefined:!c?.explicitUndefined}))return!1}return!c?.includeHash})();if(mt)return{...Y,ref:r,href:mt,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T}};let yt=ht?pl(s,{})??$ie:cb,Et=ht?cb:pl(i,{})??cb,St=(()=>{let At=F,ee=yt.style,ce=Et.style;if(!(!At&&!ee&&!ce))return At&&!ee&&!ce?At:!At&&ee&&!ce?ee:!At&&!ee&&ce?ce:{...At,...ee,...ce}})(),jt=(()=>{let At=T,ee=yt.className,ce=Et.className;if(!At&&!ee&&!ce)return"";let Ee="";return At&&(Ee=At),ee&&(Ee=Ee?`${Ee} ${ee}`:ee),ce&&(Ee=Ee?`${Ee} ${ce}`:ce),Ee})();return{...Y,...yt,...Et,href:je?.href,ref:r,disabled:!!C,target:w,...St&&{style:St},...jt&&{className:jt},...C&&Hie,...ht&&jie}}let Q=P$(),X=$a.useMemo(()=>t,[o,t.from,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),te=Zn(o.stores.location,Be=>Be,(Be,Me)=>Be.href===Me.href),ae=$a.useMemo(()=>{let Be={_fromLocation:te,...X};return o.buildLocation(Be)},[o,te,X]),se=ae.maskedLocation?ae.maskedLocation.publicHref:ae.publicHref,J=ae.maskedLocation?ae.maskedLocation.external:ae.external,ne=$a.useMemo(()=>qie(se,J,o.history,C),[C,J,se,o.history]),pe=$a.useMemo(()=>{if(ne?.external){if(Qd(ne.href,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${ne.href}`);return}return ne.href}if(!Wie(d)&&!(typeof d!="string"||d.indexOf(":")===-1))try{if(new URL(d),Qd(d,o.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${d}`);return}return d}catch{}},[d,ne,o.protocolAllowlist]),le=$a.useMemo(()=>{if(pe)return!1;if(c?.exact){if(!PM(te.pathname,ae.pathname,o.basepath))return!1}else{let Be=Bh(te.pathname,o.basepath),Me=Bh(ae.pathname,o.basepath);if(!(Be.startsWith(Me)&&(Be.length===Me.length||Be[Me.length]==="/")))return!1}return(c?.includeSearch??!0)&&!ju(te.search,ae.search,{partial:!c?.exact,ignoreUndefined:!c?.explicitUndefined})?!1:c?.includeHash?Q&&te.hash===ae.hash:!0},[c?.exact,c?.explicitUndefined,c?.includeHash,c?.includeSearch,te,pe,Q,ae.hash,ae.pathname,ae.search,o.basepath]),ie=le?pl(s,{})??$ie:cb,de=le?cb:pl(i,{})??cb,ue=[T,ie.className,de.className].filter(Boolean).join(" "),he=(F||ie.style||de.style)&&{...F,...ie.style,...de.style},[Re,Ae]=$a.useState(!1),ye=$a.useRef(!1),ge=t.reloadDocument||pe?!1:f??o.options.defaultPreload,Te=p??o.options.defaultPreloadDelay??0,ze=$a.useCallback(()=>{o.preloadRoute({...X,_builtLocation:ae}).catch(Be=>{console.warn(Be),console.warn(T$)})},[o,X,ae]);Dse(r,$a.useCallback(Be=>{Be?.isIntersecting&&ze()},[ze]),d4e,{disabled:!!C||ge!=="viewport"}),$a.useEffect(()=>{ye.current||!C&&ge==="render"&&(ze(),ye.current=!0)},[C,ze,ge]);let Ze=n(Be=>{let Me=Be.currentTarget.getAttribute("target"),je=w!==void 0?w:Me;if(!C&&!f4e(Be)&&!Be.defaultPrevented&&(!je||je==="_self")&&Be.button===0){Be.preventDefault(),(0,Gie.flushSync)(()=>{Ae(!0)});let mt=o.subscribe("onResolved",()=>{mt(),Ae(!1)});o.navigate({...X,replace:v,resetScroll:y,hashScrollIntoView:h,startTransition:x,viewTransition:b,ignoreBlocker:U})}},"handleClick");if(pe)return{...Y,ref:r,href:pe,...S&&{children:S},...w&&{target:w},...C&&{disabled:C},...F&&{style:F},...T&&{className:T},...E&&{onClick:E},...k&&{onBlur:k},...O&&{onFocus:O},...D&&{onMouseEnter:D},...M&&{onMouseLeave:M},...L&&{onTouchStart:L}};let _e=n(Be=>{if(C||ge!=="intent")return;if(!Te){ze();return}let Me=Be.currentTarget;if(MF.has(Me))return;let je=setTimeout(()=>{MF.delete(Me),ze()},Te);MF.set(Me,je)},"enqueueIntentPreload"),Ie=n(Be=>{C||ge!=="intent"||ze()},"handleTouchStart"),ke=n(Be=>{if(C||!ge||!Te)return;let Me=Be.currentTarget,je=MF.get(Me);je&&(clearTimeout(je),MF.delete(Me))},"handleLeave");return{...Y,...ie,...de,href:ne?.href,ref:r,onClick:ub([E,Ze]),onBlur:ub([k,ke]),onFocus:ub([O,_e]),onMouseEnter:ub([D,_e]),onMouseLeave:ub([M,ke]),onTouchStart:ub([L,Ie]),disabled:!!C,target:w,...he&&{style:he},...ue&&{className:ue},...C&&Hie,...le&&jie,...Q&&Re&&u4e}}n(c4e,"useLinkProps");var cb={},$ie={className:"active"},Hie={role:"link","aria-disabled":!0},jie={"data-status":"active","aria-current":"page"},u4e={"data-transitioning":"transitioning"},MF=new WeakMap,d4e={rootMargin:"100px"},ub=n(t=>e=>{for(let o of t)if(o){if(e.defaultPrevented)return;o(e)}},"composeHandlers");function qie(t,e,o,r){if(!r)return e?{href:t,external:!0}:{href:o.createHref(t)||"/",external:!1}}n(qie,"getHrefOption");function Wie(t){if(typeof t!="string")return!1;let e=t.charCodeAt(0);return e===47?t.charCodeAt(1)!==47:e===46}n(Wie,"isSafeInternal");var G$=$a.forwardRef((t,e)=>{let{_asChild:o,...r}=t,{type:a,...s}=c4e(r,e),i=typeof r.children=="function"?r.children({isActive:s["data-status"]==="active"}):r.children;if(!o){let{disabled:c,...d}=s;return $a.createElement("a",d,i)}return $a.createElement(o,s,i)});function f4e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}n(f4e,"isCtrlEvent");var K$=K(oe(),1),Y$=K($t(),1);var Kie=class extends zM{static{n(this,"Route")}constructor(t){super(t),this.useMatch=e=>ec({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W$({...e,from:this.id}),this.useSearch=e=>zh({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>j$({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>H$({...e,from:this.id}),this.useLoaderData=e=>$$({...e,from:this.id}),this.useNavigate=()=>zs({from:this.fullPath}),this.Link=K$.default.forwardRef((e,o)=>(0,Y$.jsx)(G$,{ref:o,from:this.fullPath,...e}))}};function PF(t){return new Kie(t)}n(PF,"createRoute");var Yie=class extends k${static{n(this,"RootRoute")}constructor(t){super(t),this.useMatch=e=>ec({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>W$({...e,from:this.id}),this.useSearch=e=>zh({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>j$({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>H$({...e,from:this.id}),this.useLoaderData=e=>$$({...e,from:this.id}),this.useNavigate=()=>zs({from:this.fullPath}),this.Link=K$.default.forwardRef((e,o)=>(0,Y$.jsx)(G$,{ref:o,from:this.fullPath,...e}))}};function X$(t){return new Yie(t)}n(X$,"createRootRoute");var pAt=K(oe(),1),YM=K($t(),1);function Xie(t){let e=vn();if(!1){let r=`not-found-${e.stores.location.get().pathname}-${e.stores.status.get()}`;return(0,YM.jsx)(Pv,{getResetKey:n(()=>r,"getResetKey"),onCatch:n((a,s)=>{if(Hn(a))t.onCatch?.(a,s);else throw a},"onCatch"),errorComponent:n(({error:a})=>{if(Hn(a))return t.fallback?.(a);throw a},"errorComponent"),children:t.children})}let o=`not-found-${Zn(e.stores.location,r=>r.pathname)}-${Zn(e.stores.status,r=>r)}`;return(0,YM.jsx)(Pv,{getResetKey:n(()=>o,"getResetKey"),onCatch:n((r,a)=>{if(Hn(r))t.onCatch?.(r,a);else throw r},"onCatch"),errorComponent:n(({error:r})=>{if(Hn(r))return t.fallback?.(r);throw r},"errorComponent"),children:t.children})}n(Xie,"CatchNotFound");function Qie(){return(0,YM.jsx)("p",{children:"Not Found"})}n(Qie,"DefaultGlobalNotFound");var Zie=K($t(),1);function Jie({children:t}){let e=vn();return null}n(Jie,"ScriptOnce");var IAt=K(oe(),1),XM=K($t(),1);function $h(t){return(0,XM.jsx)(XM.Fragment,{children:t.children})}n($h,"SafeFragment");var CAt=K(oe(),1),QM=K($t(),1);function ZM(t,e,o){return e.options.notFoundComponent?(0,QM.jsx)(e.options.notFoundComponent,{...o}):t.options.defaultNotFoundComponent?(0,QM.jsx)(t.options.defaultNotFoundComponent,{...o}):(e.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${e.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`),(0,QM.jsx)(Qie,{}))}n(ZM,"renderRouteNotFound");var tle=K($t(),1);function ele(t){return null}n(ele,"getScrollRestorationScriptForRouter");function ole(){let t=ele(vn());return t?(0,tle.jsx)(Jie,{children:t}):null}n(ole,"ScrollRestoration");var $s=K(oe(),1),xn=K($t(),1);var p4e=n((t,e)=>t.routeId===e.routeId&&t._displayPending===e._displayPending,"matchViewFieldsEqual"),m4e=n((t,e)=>t[0]===e[0]&&t[1]===e[1],"outletMatchSelectionEqual"),JM=$s.memo(n(function({matchId:e}){let o=vn();if(!1){let i=o.stores.matchStores.get(e)?.get();if(!i)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let c=i.routeId,d=o.routesById[c].parentRoute?.id;return(0,xn.jsx)(rle,{router:o,matchId:e,resetKey:o.stores.loadedAt.get(),matchState:{routeId:c,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:d}})}let r=o.stores.matchStores.get(e);if(!r)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let a=Zn(o.stores.loadedAt,i=>i),s=Zn(r,i=>i,p4e);return(0,xn.jsx)(rle,{router:o,matchId:e,resetKey:a,matchState:$s.useMemo(()=>{let i=s.routeId,c=o.routesById[i].parentRoute?.id;return{routeId:i,ssr:s.ssr,_displayPending:s._displayPending,parentRouteId:c}},[s._displayPending,s.routeId,s.ssr,o.routesById])})},"MatchImpl"));function rle({router:t,matchId:e,resetKey:o,matchState:r}){let a=t.routesById[r.routeId],s=a.options.pendingComponent??t.options.defaultPendingComponent,i=s?(0,xn.jsx)(s,{}):null,c=a.options.errorComponent??t.options.defaultErrorComponent,d=a.options.onCatch??t.options.defaultOnCatch,f=a.isRoot?a.options.notFoundComponent??t.options.notFoundRoute?.options.component:a.options.notFoundComponent,p=r.ssr===!1||r.ssr==="data-only",m=(!a.isRoot||a.options.wrapInSuspense||p)&&(a.options.wrapInSuspense??s??(a.options.errorComponent?.preload||p))?$s.Suspense:$h,h=c?Pv:$h,v=f?Xie:$h;return(0,xn.jsxs)(a.isRoot?a.options.shellComponent??$h:$h,{children:[(0,xn.jsx)(Nv.Provider,{value:e,children:(0,xn.jsx)(m,{fallback:i,children:(0,xn.jsx)(h,{getResetKey:n(()=>o,"getResetKey"),errorComponent:c||Ov,onCatch:n((x,y)=>{if(Hn(x))throw x.routeId??=r.routeId,x;console.warn(`Warning: Error in route match: ${e}`),d?.(x,y)},"onCatch"),children:(0,xn.jsx)(v,{fallback:n(x=>{if(x.routeId??=r.routeId,!f||x.routeId&&x.routeId!==r.routeId||!x.routeId&&!a.isRoot)throw x;return $s.createElement(f,x)},"fallback"),children:p||r._displayPending?(0,xn.jsx)(Rie,{fallback:i,children:(0,xn.jsx)(nle,{matchId:e})}):(0,xn.jsx)(nle,{matchId:e})})})})}),r.parentRouteId===ml?(0,xn.jsxs)(xn.Fragment,{children:[(0,xn.jsx)(h4e,{}),t.options.scrollRestoration&&!1?(0,xn.jsx)(ole,{}):null]}):null]})}n(rle,"MatchView");function h4e(){let t=vn();if(!1)return null;let e=$s.useRef();return Av(()=>{let o=t.stores.resolvedLocation.get(),r=e.current;o&&(!r||r.href!==o.href)&&t.emit({type:"onRendered",...Ap(t.stores.location.get(),r??o)}),e.current=o},[Zn(t.stores.resolvedLocation,o=>o?.state.__TSR_key),t]),null}n(h4e,"OnRendered");var nle=$s.memo(n(function({matchId:e}){let o=vn(),r=n((p,m)=>o.getMatch(p.id)?._nonReactive[m]??p._nonReactive[m],"getMatchPromise");if(!1){let p=o.stores.matchStores.get(e)?.get();if(!p)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let m=p.routeId,h=o.routesById[m],v=(o.routesById[m].options.remountDeps??o.options.defaultRemountDeps)?.({routeId:m,loaderDeps:p.loaderDeps,params:p._strictParams,search:p._strictSearch}),x=v?JSON.stringify(v):void 0,y=h.options.component??o.options.defaultComponent,b=y?(0,xn.jsx)(y,{},x):(0,xn.jsx)(OF,{});if(p._displayPending)throw r(p,"displayPendingPromise");if(p._forcePending)throw r(p,"minPendingPromise");if(p.status==="pending")throw r(p,"loadPromise");if(p.status==="notFound"){if(!Hn(p.error))throw new Error("Invariant failed: Expected a notFound error");return ZM(o,h,p.error)}if(p.status==="redirected")throw ns(p.error)?r(p,"loadPromise"):new Error("Invariant failed: Expected a redirect error");return p.status==="error"?(0,xn.jsx)((h.options.errorComponent??o.options.defaultErrorComponent)||Ov,{error:p.error,reset:void 0,info:{componentStack:""}}):b}let a=o.stores.matchStores.get(e);if(!a)throw new Error(`Invariant failed: Could not find match for matchId "${e}". Please file an issue!`);let s=Zn(a,p=>p),i=s.routeId,c=o.routesById[i],d=$s.useMemo(()=>{let p=(o.routesById[i].options.remountDeps??o.options.defaultRemountDeps)?.({routeId:i,loaderDeps:s.loaderDeps,params:s._strictParams,search:s._strictSearch});return p?JSON.stringify(p):void 0},[i,s.loaderDeps,s._strictParams,s._strictSearch,o.options.defaultRemountDeps,o.routesById]),f=$s.useMemo(()=>{let p=c.options.component??o.options.defaultComponent;return p?(0,xn.jsx)(p,{},d):(0,xn.jsx)(OF,{})},[d,c.options.component,o.options.defaultComponent]);if(s._displayPending)throw r(s,"displayPendingPromise");if(s._forcePending)throw r(s,"minPendingPromise");if(s.status==="pending"){let p=c.options.pendingMinMs??o.options.defaultPendingMinMs;if(p){let m=o.getMatch(s.id);if(m&&!m._nonReactive.minPendingPromise&&!!1){let h=Xd();m._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),m._nonReactive.minPendingPromise=void 0},p)}}throw r(s,"loadPromise")}if(s.status==="notFound"){if(!Hn(s.error))throw new Error("Invariant failed: Expected a notFound error");return ZM(o,c,s.error)}if(s.status==="redirected")throw ns(s.error)?r(s,"loadPromise"):new Error("Invariant failed: Expected a redirect error");if(s.status==="error"){if(!1)return(0,xn.jsx)((c.options.errorComponent??o.options.defaultErrorComponent)||Ov,{error:s.error,reset:void 0,info:{componentStack:""}});throw s.error}return f},"MatchInnerImpl")),OF=$s.memo(n(function(){let e=vn(),o=$s.useContext(Nv),r,a=!1,s;if(!1){let f=e.stores.matches.get(),p=o?f.findIndex(h=>h.id===o):-1,m=p>=0?f[p]:void 0;r=m?.routeId,a=m?.globalNotFound??!1,s=p>=0?f[p+1]?.id:void 0}else{let f=o?e.stores.matchStores.get(o):void 0;[r,a]=Zn(f,p=>[p?.routeId,p?.globalNotFound??!1],m4e),s=Zn(e.stores.matchesId,p=>p[p.findIndex(m=>m===o)+1])}let i=r?e.routesById[r]:void 0,c=e.options.defaultPendingComponent?(0,xn.jsx)(e.options.defaultPendingComponent,{}):null;if(a){if(!i)throw new Error("Invariant failed: Could not resolve route for Outlet render");return ZM(e,i,void 0)}if(!s)return null;let d=(0,xn.jsx)(JM,{matchId:s});return r===ml?(0,xn.jsx)($s.Suspense,{fallback:c,children:d}):d},"OutletImpl"));var Hh=K(oe(),1);function ale(){let t=vn(),e=Hh.useRef({router:t,mounted:!1}),[o,r]=Hh.useState(!1),a=Zn(t.stores.isLoading,m=>m),s=Zn(t.stores.hasPending,m=>m),i=EM(a),c=a||o||s,d=EM(c),f=a||s,p=EM(f);return t.startTransition=m=>{r(!0),Hh.startTransition(()=>{m(),r(!1)})},Hh.useEffect(()=>{let m=t.history.subscribe(t.load),h=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Jl(t.latestLocation.publicHref)!==Jl(h.publicHref)&&t.commitLocation({...h,replace:!0}),()=>{m()}},[t,t.history]),Av(()=>{if(typeof window<"u"&&t.ssr||e.current.router===t&&e.current.mounted)return;e.current={router:t,mounted:!0},n(async()=>{try{await t.load()}catch(h){console.error(h)}},"tryLoad")()},[t]),Av(()=>{i&&!a&&t.emit({type:"onLoad",...Ap(t.stores.location.get(),t.stores.resolvedLocation.get())})},[i,t,a]),Av(()=>{p&&!f&&t.emit({type:"onBeforeRouteMount",...Ap(t.stores.location.get(),t.stores.resolvedLocation.get())})},[f,p,t]),Av(()=>{if(d&&!c){let m=Ap(t.stores.location.get(),t.stores.resolvedLocation.get());t.emit({type:"onResolved",...m}),TF(()=>{t.stores.status.set("idle"),t.stores.resolvedLocation.set(t.stores.location.get())})}},[c,d,t]),null}n(ale,"Transitioner");var eP=K(oe(),1),Jd=K($t(),1);function sle(){let t=vn(),e=t.routesById[ml].options.pendingComponent??t.options.defaultPendingComponent,o=e?(0,Jd.jsx)(e,{}):null,r=(0,Jd.jsxs)(typeof document<"u"&&t.ssr?$h:eP.Suspense,{fallback:o,children:[!!1&&(0,Jd.jsx)(ale,{}),(0,Jd.jsx)(g4e,{})]});return t.options.InnerWrap?(0,Jd.jsx)(t.options.InnerWrap,{children:r}):r}n(sle,"Matches");function g4e(){let t=vn(),e=!1,o=e?t.stores.firstId.get():Zn(t.stores.firstId,s=>s),r=e?t.stores.loadedAt.get():Zn(t.stores.loadedAt,s=>s),a=o?(0,Jd.jsx)(JM,{matchId:o}):null;return(0,Jd.jsx)(Nv.Provider,{value:o,children:t.options.disableGlobalCatchBoundary?a:(0,Jd.jsx)(Pv,{getResetKey:n(()=>r,"getResetKey"),errorComponent:Ov,onCatch:s=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${s.message||s.toString()}`)},children:a})})}n(g4e,"MatchesInner");var ile=n(t=>({createMutableStore:GM,createReadonlyStore:GM,batch:TF}),"getStoreFactory");var Q$=n(t=>new lle(t),"createRouter"),lle=class extends E${static{n(this,"Router")}constructor(t){super(t,ile)}};var bTt=K(oe(),1),NF=K($t(),1);function cle({router:t,children:e,...o}){Ph(o)&&t.update({...t.options,...o,context:{...t.options.context,...o.context}});let r=(0,NF.jsx)(HM.Provider,{value:t,children:e});return t.options.Wrap?(0,NF.jsx)(t.options.Wrap,{children:r}):r}n(cle,"RouterContextProvider");function Z$({router:t,...e}){return(0,NF.jsx)(cle,{router:t,...e,children:(0,NF.jsx)(sle,{})})}n(Z$,"RouterProvider");function J$(t){let e=vn({warn:t?.router===void 0}),o=t?.router||e;if(!1){let r=o.stores.__store.get();return t?.select?t.select(r):r}return Zn(o.stores.__store,z$(t,o))}n(J$,"useRouterState");var Um=K(oe(),1),st=K(oe(),1);function ule(t){var e,o,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(o=ule(t[e]))&&(r&&(r+=" "),r+=o)}else for(o in t)t[o]&&(r&&(r+=" "),r+=o);return r}n(ule,"r");function xo(){for(var t,e,o=0,r="",a=arguments.length;o<a;o++)(t=arguments[o])&&(e=ule(t))&&(r&&(r+=" "),r+=e);return r}n(xo,"clsx");var v4e=n((t,e)=>{let o=new Array(t.length+e.length);for(let r=0;r<t.length;r++)o[r]=t[r];for(let r=0;r<e.length;r++)o[t.length+r]=e[r];return o},"concatArrays"),x4e=n((t,e)=>({classGroupId:t,validator:e}),"createClassValidatorObject"),vle=n((t=new Map,e=null,o)=>({nextPart:t,validators:e,classGroupId:o}),"createClassPartObject"),rP="-",dle=[],y4e="arbitrary..",I4e=n(t=>{let e=S4e(t),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:n(i=>{if(i.startsWith("[")&&i.endsWith("]"))return b4e(i);let c=i.split(rP),d=c[0]===""&&c.length>1?1:0;return xle(c,d,e)},"getClassGroupId"),getConflictingClassGroupIds:n((i,c)=>{if(c){let d=r[i],f=o[i];return d?f?v4e(f,d):d:f||dle}return o[i]||dle},"getConflictingClassGroupIds")}},"createClassGroupUtils"),xle=n((t,e,o)=>{if(t.length-e===0)return o.classGroupId;let a=t[e],s=o.nextPart.get(a);if(s){let f=xle(t,e+1,s);if(f)return f}let i=o.validators;if(i===null)return;let c=e===0?t.join(rP):t.slice(e).join(rP),d=i.length;for(let f=0;f<d;f++){let p=i[f];if(p.validator(c))return p.classGroupId}},"getGroupRecursive"),b4e=n(t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let e=t.slice(1,-1),o=e.indexOf(":"),r=e.slice(0,o);return r?y4e+r:void 0})(),"getGroupIdForArbitraryProperty"),S4e=n(t=>{let{theme:e,classGroups:o}=t;return w4e(o,e)},"createClassMap"),w4e=n((t,e)=>{let o=vle();for(let r in t){let a=t[r];oH(a,o,r,e)}return o},"processClassGroups"),oH=n((t,e,o,r)=>{let a=t.length;for(let s=0;s<a;s++){let i=t[s];C4e(i,e,o,r)}},"processClassesRecursively"),C4e=n((t,e,o,r)=>{if(typeof t=="string"){F4e(t,e,o);return}if(typeof t=="function"){R4e(t,e,o,r);return}E4e(t,e,o,r)},"processClassDefinition"),F4e=n((t,e,o)=>{let r=t===""?e:yle(e,t);r.classGroupId=o},"processStringDefinition"),R4e=n((t,e,o,r)=>{if(A4e(t)){oH(t(r),e,o,r);return}e.validators===null&&(e.validators=[]),e.validators.push(x4e(o,t))},"processFunctionDefinition"),E4e=n((t,e,o,r)=>{let a=Object.entries(t),s=a.length;for(let i=0;i<s;i++){let[c,d]=a[i];oH(d,yle(e,c),o,r)}},"processObjectDefinition"),yle=n((t,e)=>{let o=t,r=e.split(rP),a=r.length;for(let s=0;s<a;s++){let i=r[s],c=o.nextPart.get(i);c||(c=vle(),o.nextPart.set(i,c)),o=c}return o},"getPart"),A4e=n(t=>"isThemeGetter"in t&&t.isThemeGetter===!0,"isThemeGetter"),T4e=n(t=>{if(t<1)return{get:n(()=>{},"get"),set:n(()=>{},"set")};let e=0,o=Object.create(null),r=Object.create(null),a=n((s,i)=>{o[s]=i,e++,e>t&&(e=0,r=o,o=Object.create(null))},"update");return{get(s){let i=o[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return a(s,i),i},set(s,i){s in o?o[s]=i:a(s,i)}}},"createLruCache"),tH="!",fle=":",k4e=[],ple=n((t,e,o,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:o,maybePostfixModifierPosition:r,isExternal:a}),"createResultObject"),M4e=n(t=>{let{prefix:e,experimentalParseClassName:o}=t,r=n(a=>{let s=[],i=0,c=0,d=0,f,p=a.length;for(let y=0;y<p;y++){let b=a[y];if(i===0&&c===0){if(b===fle){s.push(a.slice(d,y)),d=y+1;continue}if(b==="/"){f=y;continue}}b==="["?i++:b==="]"?i--:b==="("?c++:b===")"&&c--}let m=s.length===0?a:a.slice(d),h=m,v=!1;m.endsWith(tH)?(h=m.slice(0,-1),v=!0):m.startsWith(tH)&&(h=m.slice(1),v=!0);let x=f&&f>d?f-d:void 0;return ple(s,v,h,x)},"parseClassName");if(e){let a=e+fle,s=r;r=n(i=>i.startsWith(a)?s(i.slice(a.length)):ple(k4e,!1,i,void 0,!0),"parseClassName")}if(o){let a=r;r=n(s=>o({className:s,parseClassName:a}),"parseClassName")}return r},"createParseClassName"),P4e=n(t=>{let e=new Map;return t.orderSensitiveModifiers.forEach((o,r)=>{e.set(o,1e6+r)}),o=>{let r=[],a=[];for(let s=0;s<o.length;s++){let i=o[s],c=i[0]==="[",d=e.has(i);c||d?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},"createSortModifiers"),O4e=n(t=>({cache:T4e(t.cacheSize),parseClassName:M4e(t),sortModifiers:P4e(t),postfixLookupClassGroupIds:N4e(t),...I4e(t)}),"createConfigUtils"),N4e=n(t=>{let e=Object.create(null),o=t.postfixLookupClassGroups;if(o)for(let r=0;r<o.length;r++)e[o[r]]=!0;return e},"createPostfixLookupClassGroupIds"),D4e=/\s+/,_4e=n((t,e)=>{let{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s,postfixLookupClassGroupIds:i}=e,c=[],d=t.trim().split(D4e),f="";for(let p=d.length-1;p>=0;p-=1){let m=d[p],{isExternal:h,modifiers:v,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:b}=o(m);if(h){f=m+(f.length>0?" "+f:f);continue}let S=!!b,w;if(S){let k=y.substring(0,b);w=r(k);let O=w&&i[w]?r(y):void 0;O&&O!==w&&(w=O,S=!1)}else w=r(y);if(!w){if(!S){f=m+(f.length>0?" "+f:f);continue}if(w=r(y),!w){f=m+(f.length>0?" "+f:f);continue}S=!1}let C=v.length===0?"":v.length===1?v[0]:s(v).join(":"),F=x?C+tH:C,T=F+w;if(c.indexOf(T)>-1)continue;c.push(T);let E=a(w,S);for(let k=0;k<E.length;++k){let O=E[k];c.push(F+O)}f=m+(f.length>0?" "+f:f)}return f},"mergeClassList"),L4e=n((...t)=>{let e=0,o,r,a="";for(;e<t.length;)(o=t[e++])&&(r=Ile(o))&&(a&&(a+=" "),a+=r);return a},"twJoin"),Ile=n(t=>{if(typeof t=="string")return t;let e,o="";for(let r=0;r<t.length;r++)t[r]&&(e=Ile(t[r]))&&(o&&(o+=" "),o+=e);return o},"toValue"),B4e=n((t,...e)=>{let o,r,a,s,i=n(d=>{let f=e.reduce((p,m)=>m(p),t());return o=O4e(f),r=o.cache.get,a=o.cache.set,s=c,c(d)},"initTailwindMerge"),c=n(d=>{let f=r(d);if(f)return f;let p=_4e(d,o);return a(d,p),p},"tailwindMerge");return s=i,(...d)=>s(L4e(...d))},"createTailwindMerge"),V4e=[],as=n(t=>{let e=n(o=>o[t]||V4e,"themeGetter");return e.isThemeGetter=!0,e},"fromTheme"),ble=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Sle=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U4e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,z4e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$4e=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H4e=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,j4e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q4e=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,jh=n(t=>U4e.test(t),"isFraction"),ir=n(t=>!!t&&!Number.isNaN(Number(t)),"isNumber"),ef=n(t=>!!t&&Number.isInteger(Number(t)),"isInteger"),eH=n(t=>t.endsWith("%")&&ir(t.slice(0,-1)),"isPercent"),Tp=n(t=>z4e.test(t),"isTshirtSize"),wle=n(()=>!0,"isAny"),W4e=n(t=>$4e.test(t)&&!H4e.test(t),"isLengthOnly"),rH=n(()=>!1,"isNever"),G4e=n(t=>j4e.test(t),"isShadow"),K4e=n(t=>q4e.test(t),"isImage"),Y4e=n(t=>!Gt(t)&&!Kt(t),"isAnyNonArbitrary"),X4e=n(t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),"isNamedContainerQuery"),Q4e=n(t=>qh(t,Rle,rH),"isArbitrarySize"),Gt=n(t=>ble.test(t),"isArbitraryValue"),Dv=n(t=>qh(t,Ele,W4e),"isArbitraryLength"),mle=n(t=>qh(t,a5e,ir),"isArbitraryNumber"),Z4e=n(t=>qh(t,Tle,wle),"isArbitraryWeight"),J4e=n(t=>qh(t,Ale,rH),"isArbitraryFamilyName"),hle=n(t=>qh(t,Cle,rH),"isArbitraryPosition"),e5e=n(t=>qh(t,Fle,K4e),"isArbitraryImage"),tP=n(t=>qh(t,kle,G4e),"isArbitraryShadow"),Kt=n(t=>Sle.test(t),"isArbitraryVariable"),DF=n(t=>_v(t,Ele),"isArbitraryVariableLength"),t5e=n(t=>_v(t,Ale),"isArbitraryVariableFamilyName"),gle=n(t=>_v(t,Cle),"isArbitraryVariablePosition"),o5e=n(t=>_v(t,Rle),"isArbitraryVariableSize"),r5e=n(t=>_v(t,Fle),"isArbitraryVariableImage"),oP=n(t=>_v(t,kle,!0),"isArbitraryVariableShadow"),n5e=n(t=>_v(t,Tle,!0),"isArbitraryVariableWeight"),qh=n((t,e,o)=>{let r=ble.exec(t);return r?r[1]?e(r[1]):o(r[2]):!1},"getIsArbitraryValue"),_v=n((t,e,o=!1)=>{let r=Sle.exec(t);return r?r[1]?e(r[1]):o:!1},"getIsArbitraryVariable"),Cle=n(t=>t==="position"||t==="percentage","isLabelPosition"),Fle=n(t=>t==="image"||t==="url","isLabelImage"),Rle=n(t=>t==="length"||t==="size"||t==="bg-size","isLabelSize"),Ele=n(t=>t==="length","isLabelLength"),a5e=n(t=>t==="number","isLabelNumber"),Ale=n(t=>t==="family-name","isLabelFamilyName"),Tle=n(t=>t==="number"||t==="weight","isLabelWeight"),kle=n(t=>t==="shadow","isLabelShadow");var s5e=n(()=>{let t=as("color"),e=as("font"),o=as("text"),r=as("font-weight"),a=as("tracking"),s=as("leading"),i=as("breakpoint"),c=as("container"),d=as("spacing"),f=as("radius"),p=as("shadow"),m=as("inset-shadow"),h=as("text-shadow"),v=as("drop-shadow"),x=as("blur"),y=as("perspective"),b=as("aspect"),S=as("ease"),w=as("animate"),C=n(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"scaleBreak"),F=n(()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],"scalePosition"),T=n(()=>[...F(),Kt,Gt],"scalePositionWithArbitrary"),E=n(()=>["auto","hidden","clip","visible","scroll"],"scaleOverflow"),k=n(()=>["auto","contain","none"],"scaleOverscroll"),O=n(()=>[Kt,Gt,d],"scaleUnambiguousSpacing"),D=n(()=>[jh,"full","auto",...O()],"scaleInset"),M=n(()=>[ef,"none","subgrid",Kt,Gt],"scaleGridTemplateColsRows"),L=n(()=>["auto",{span:["full",ef,Kt,Gt]},ef,Kt,Gt],"scaleGridColRowStartAndEnd"),U=n(()=>[ef,"auto",Kt,Gt],"scaleGridColRowStartOrEnd"),W=n(()=>["auto","min","max","fr",Kt,Gt],"scaleGridAutoColsRows"),V=n(()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],"scaleAlignPrimaryAxis"),j=n(()=>["start","end","center","stretch","center-safe","end-safe"],"scaleAlignSecondaryAxis"),N=n(()=>["auto",...O()],"scaleMargin"),_=n(()=>[jh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],"scaleSizing"),B=n(()=>[jh,"screen","full","dvw","lvw","svw","min","max","fit",...O()],"scaleSizingInline"),z=n(()=>[jh,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],"scaleSizingBlock"),q=n(()=>[t,Kt,Gt],"scaleColor"),$=n(()=>[...F(),gle,hle,{position:[Kt,Gt]}],"scaleBgPosition"),Y=n(()=>["no-repeat",{repeat:["","x","y","space","round"]}],"scaleBgRepeat"),Q=n(()=>["auto","cover","contain",o5e,Q4e,{size:[Kt,Gt]}],"scaleBgSize"),X=n(()=>[eH,DF,Dv],"scaleGradientStopPosition"),te=n(()=>["","none","full",f,Kt,Gt],"scaleRadius"),ae=n(()=>["",ir,DF,Dv],"scaleBorderWidth"),se=n(()=>["solid","dashed","dotted","double"],"scaleLineStyle"),J=n(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"scaleBlendMode"),ne=n(()=>[ir,eH,gle,hle],"scaleMaskImagePosition"),pe=n(()=>["","none",x,Kt,Gt],"scaleBlur"),le=n(()=>["none",ir,Kt,Gt],"scaleRotate"),ie=n(()=>["none",ir,Kt,Gt],"scaleScale"),de=n(()=>[ir,Kt,Gt],"scaleSkew"),ue=n(()=>[jh,"full",...O()],"scaleTranslate");return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tp],breakpoint:[Tp],color:[wle],container:[Tp],"drop-shadow":[Tp],ease:["in","out","in-out"],font:[Y4e],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tp],shadow:[Tp],spacing:["px",ir],text:[Tp],"text-shadow":[Tp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",jh,Gt,Kt,b]}],container:["container"],"container-type":[{"@container":["","normal","size",Kt,Gt]}],"container-named":[X4e],columns:[{columns:[ir,Gt,Kt,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[ef,"auto",Kt,Gt]}],basis:[{basis:[jh,"full","auto",c,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ir,jh,"auto","initial","none",Gt]}],grow:[{grow:["",ir,Kt,Gt]}],shrink:[{shrink:["",ir,Kt,Gt]}],order:[{order:[ef,"first","last","none",Kt,Gt]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mbs:[{mbs:N()}],mbe:[{mbe:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[c,"screen",..._()]}],"min-w":[{"min-w":[c,"screen","none",..._()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",o,DF,Dv]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,n5e,Z4e]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",eH,Gt]}],"font-family":[{font:[t5e,J4e,e]}],"font-features":[{"font-features":[Gt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Kt,Gt]}],"line-clamp":[{"line-clamp":[ir,"none",Kt,mle]}],leading:[{leading:[s,...O()]}],"list-image":[{"list-image":["none",Kt,Gt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Kt,Gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[ir,"from-font","auto",Kt,Dv]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[ir,"auto",Kt,Gt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[ef,Kt,Gt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Kt,Gt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Kt,Gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ef,Kt,Gt],radial:["",Kt,Gt],conic:[ef,Kt,Gt]},r5e,e5e]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ir,Kt,Gt]}],"outline-w":[{outline:["",ir,DF,Dv]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",p,oP,tP]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",m,oP,tP]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[ir,Dv]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",h,oP,tP]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[ir,Kt,Gt]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ir]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[Kt,Gt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":F()}],"mask-image-conic-pos":[{"mask-conic":[ir]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Kt,Gt]}],filter:[{filter:["","none",Kt,Gt]}],blur:[{blur:pe()}],brightness:[{brightness:[ir,Kt,Gt]}],contrast:[{contrast:[ir,Kt,Gt]}],"drop-shadow":[{"drop-shadow":["","none",v,oP,tP]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",ir,Kt,Gt]}],"hue-rotate":[{"hue-rotate":[ir,Kt,Gt]}],invert:[{invert:["",ir,Kt,Gt]}],saturate:[{saturate:[ir,Kt,Gt]}],sepia:[{sepia:["",ir,Kt,Gt]}],"backdrop-filter":[{"backdrop-filter":["","none",Kt,Gt]}],"backdrop-blur":[{"backdrop-blur":pe()}],"backdrop-brightness":[{"backdrop-brightness":[ir,Kt,Gt]}],"backdrop-contrast":[{"backdrop-contrast":[ir,Kt,Gt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ir,Kt,Gt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ir,Kt,Gt]}],"backdrop-invert":[{"backdrop-invert":["",ir,Kt,Gt]}],"backdrop-opacity":[{"backdrop-opacity":[ir,Kt,Gt]}],"backdrop-saturate":[{"backdrop-saturate":[ir,Kt,Gt]}],"backdrop-sepia":[{"backdrop-sepia":["",ir,Kt,Gt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Kt,Gt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ir,"initial",Kt,Gt]}],ease:[{ease:["linear","initial",S,Kt,Gt]}],delay:[{delay:[ir,Kt,Gt]}],animate:[{animate:["none",w,Kt,Gt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,Kt,Gt]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[Kt,Gt,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":["translate-none"],zoom:[{zoom:[ef,Kt,Gt]}],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Kt,Gt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":q()}],"scrollbar-track-color":[{"scrollbar-track":q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Kt,Gt]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[ir,DF,Dv,mle]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},"getDefaultConfig");var Mle=B4e(s5e);function tt(...t){return Mle(xo(t))}n(tt,"cn");var P=K(po(),1);var Ule=K(Lle(),1);var tf=class extends Error{static{n(this,"DateFormatError")}constructor(e,o,r){super(e),this.token=o,this.type=r||"error"}},Ble=n(t=>t<4?"short":t===4?"long":"narrow","alpha"),LF=n(t=>t%2===0?"2-digit":"numeric","numeric");function f5e(t,e){switch(t.char){case"y":return{year:LF(t.width)};case"r":return{calendar:"gregory",year:"numeric"};default:return e(`${t.desc} is not supported; falling back to year:numeric`,tf.WARNING),{year:"numeric"}}}n(f5e,"yearOptions");function p5e(t,e){switch(t.width){case 1:return"numeric";case 2:return"2-digit";case 3:return"short";case 4:return"long";case 5:return"narrow";default:e(`${t.desc} is not supported with width ${t.width}`);return}}n(p5e,"monthStyle");function m5e(t,e){let{char:o,desc:r,width:a}=t;if(o==="d")return LF(a);e(`${r} is not supported`)}n(m5e,"dayStyle");function h5e(t,e){let{char:o,desc:r,width:a}=t;if((o==="c"||o==="e")&&a<3){let s=`Numeric value is not supported for ${r}; falling back to weekday:short`;e(s,tf.WARNING)}return Ble(a)}n(h5e,"weekdayStyle");function g5e(t){let e=LF(t.width),o;switch(t.char){case"h":o="h12";break;case"H":o="h23";break;case"k":o="h24";break;case"K":o="h11";break}return o?{hour:e,hourCycle:o}:{hour:e}}n(g5e,"hourOptions");function v5e(t,e){let{char:o,desc:r,width:a}=t;switch(o){case"v":case"z":return a===4?"long":"short";case"V":if(a===4)return"long";e(`${r} is not supported with width ${a}`);return;case"X":e(`${r} is not supported`);return}return"short"}n(v5e,"timeZoneNameStyle");function x5e(t,e){switch(t.field){case"era":return{era:Ble(t.width)};case"year":return f5e(t,e);case"month":return{month:p5e(t,e)};case"day":return{day:m5e(t,e)};case"weekday":return{weekday:h5e(t,e)};case"period":return;case"hour":return g5e(t);case"min":return{minute:LF(t.width)};case"sec":return{second:LF(t.width)};case"tz":return{timeZoneName:v5e(t,e)};case"quarter":case"week":case"sec-frac":case"ms":e(`${t.desc} is not supported`)}}n(x5e,"compileOptions");function sH(t,e,o=r=>{throw r}){let r={timeZone:e},a=[];for(let s of t){let{error:i,field:c,str:d}=s;if(i){let p=new tf(i.message,s);p.stack=i.stack,o(p)}if(d){let p=`Ignoring string part: ${d}`;o(new tf(p,s,tf.WARNING))}c&&(a.indexOf(c)===-1?a.push(c):o(new tf(`Duplicate ${c} token`,s)));let f=x5e(s,(p,m)=>o(new tf(p,s,m)));f&&Object.assign(r,f)}return r}n(sH,"getDateFormatOptions");var y5e={G:{field:"era",desc:"Era"},y:{field:"year",desc:"Year"},Y:{field:"year",desc:'Year of "Week of Year"'},u:{field:"year",desc:"Extended year"},U:{field:"year",desc:"Cyclic year name"},r:{field:"year",desc:"Related Gregorian year"},Q:{field:"quarter",desc:"Quarter"},q:{field:"quarter",desc:"Stand-alone quarter"},M:{field:"month",desc:"Month in year"},L:{field:"month",desc:"Stand-alone month in year"},w:{field:"week",desc:"Week of year"},W:{field:"week",desc:"Week of month"},d:{field:"day",desc:"Day in month"},D:{field:"day",desc:"Day of year"},F:{field:"day",desc:"Day of week in month"},g:{field:"day",desc:"Modified julian day"},E:{field:"weekday",desc:"Day of week"},e:{field:"weekday",desc:"Local day of week"},c:{field:"weekday",desc:"Stand-alone local day of week"},a:{field:"period",desc:"AM/PM marker"},b:{field:"period",desc:"AM/PM/noon/midnight marker"},B:{field:"period",desc:"Flexible day period"},h:{field:"hour",desc:"Hour in AM/PM (1~12)"},H:{field:"hour",desc:"Hour in day (0~23)"},k:{field:"hour",desc:"Hour in day (1~24)"},K:{field:"hour",desc:"Hour in AM/PM (0~11)"},j:{field:"hour",desc:"Hour in preferred cycle"},J:{field:"hour",desc:"Hour in preferred cycle without marker"},C:{field:"hour",desc:"Hour in preferred cycle with flexible marker"},m:{field:"min",desc:"Minute in hour"},s:{field:"sec",desc:"Second in minute"},S:{field:"sec-frac",desc:"Fractional second"},A:{field:"ms",desc:"Milliseconds in day"},z:{field:"tz",desc:"Time Zone: specific non-location"},Z:{field:"tz",desc:"Time Zone"},O:{field:"tz",desc:"Time Zone: localized"},v:{field:"tz",desc:"Time Zone: generic non-location"},V:{field:"tz",desc:"Time Zone: ID"},X:{field:"tz",desc:"Time Zone: ISO8601 with Z"},x:{field:"tz",desc:"Time Zone: ISO8601"}},Vle=n(t=>t>="A"&&t<="Z"||t>="a"&&t<="z","isLetter");function I5e(t,e){let o=t[e],r=1;for(;t[++e]===o;)++r;let a=y5e[o];if(!a){let s=`The letter ${o} is not a valid field identifier`;return{char:o,error:new Error(s),width:r}}return{char:o,field:a.field,desc:a.desc,width:r}}n(I5e,"readFieldToken");function b5e(t,e){let o=t[++e],r=2;if(o==="'")return{char:"'",str:o,width:r};for(;;){let a=t[++e];if(++r,a===void 0){let s=`Unterminated quoted literal in pattern: ${o||t}`;return{char:"'",error:new Error(s),str:o,width:r}}else if(a==="'"){if(t[++e]!=="'")return{char:"'",str:o,width:r};++r}o+=a}}n(b5e,"readQuotedToken");function S5e(t,e){let o=t[e];if(!o)return null;if(Vle(o))return I5e(t,e);if(o==="'")return b5e(t,e);let r=o,a=1;for(;;){let s=t[++e];if(!s||Vle(s)||s==="'")return{char:o,str:r,width:a};r+=s,a+=1}}n(S5e,"readToken");function sP(t){let e=[],o=0;for(;;){let r=S5e(t,o);if(!r)return e;e.push(r),o+=r.width}}n(sP,"parseDateTokens");function zle(t,e){return t.filter(o=>o.type!=="content").length?t.map(o=>{if(o.type==="content")return e(o.value);if(o.type==="octothorpe")return"#";if(o.type==="argument")return[o.arg];if(o.type==="function"){let s=o?.param?.[0];if(o.key==="date"&&s){let i=w5e(s.value.trim(),c=>{throw new Error(`Unable to compile date expression: ${c.message}`)});return[o.arg,o.key,i]}return s?[o.arg,o.key,s.value.trim()]:[o.arg,o.key]}let r=o.pluralOffset,a={};return o.cases.forEach(({key:s,tokens:i})=>{let c=s[0]==="="?s.slice(1):s;a[c]=zle(i,e)}),[o.arg,o.type,{offset:r,...a}]}):t.map(o=>e(o.value))}n(zle,"processTokens");function w5e(t,e){if(/^::/.test(t)){let o=sP(t.substring(2));return sH(o,void 0,e)}return t}n(w5e,"compileDateExpression");function C5e(t,e=o=>o){return zle((0,Ule.parse)(t),e)}n(C5e,"compileMessageOrThrow");function iP(t,e=o=>o){try{return C5e(t,e)}catch(o){return console.error(`${o.message}
252
252
 
253
253
  Message: ${t}`),[t]}}n(iP,"compileMessage");var Wh=n(t=>typeof t=="string","isString"),F5e=n(t=>typeof t=="function","isFunction"),$le=new Map,jle="en";function uH(t){return[...Array.isArray(t)?t:[t],jle]}n(uH,"normalizeLocales");function dH(t,e,o){let r=uH(t);o||(o="default");let a;if(typeof o=="string")switch(a={day:"numeric",month:"short",year:"numeric"},o){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=o;return lP(()=>cP("date",r,o),()=>new Intl.DateTimeFormat(r,a)).format(Wh(e)?new Date(e):e)}n(dH,"date");function R5e(t,e,o){let r;if(o||(o="default"),typeof o=="string")switch(r={second:"numeric",minute:"numeric",hour:"numeric"},o){case"full":case"long":r.timeZoneName="short";break;case"short":delete r.second}else r=o;return dH(t,e,r)}n(R5e,"time");function iH(t,e,o){let r=uH(t);return lP(()=>cP("number",r,o),()=>new Intl.NumberFormat(r,o)).format(e)}n(iH,"number");function Hle(t,e,o,{offset:r=0,...a}){let s=uH(t),i=e?lP(()=>cP("plural-ordinal",s),()=>new Intl.PluralRules(s,{type:"ordinal"})):lP(()=>cP("plural-cardinal",s),()=>new Intl.PluralRules(s,{type:"cardinal"}));return a[o]??a[i.select(o-r)]??a.other}n(Hle,"plural");function lP(t,e){let o=t(),r=$le.get(o);return r||(r=e(),$le.set(o,r)),r}n(lP,"getMemoized");function cP(t,e,o){let r=e.join("-");return`${t}-${r}-${JSON.stringify(o)}`}n(cP,"cacheKey");var qle=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Wle=n(t=>t.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(e,o,r)=>{if(o){let a=parseInt(o,16);return String.fromCharCode(a)}else{let a=parseInt(r,16);return String.fromCharCode(a)}}),"decodeEscapeSequences"),Gle="%__lingui_octothorpe__%",E5e=n((t,e,o={})=>{let r=e||t,a=n(i=>typeof i=="object"?i:o[i],"style"),s=n((i,c)=>{let d=Object.keys(o).length?a("number"):void 0,f=iH(r,i,d);return c.replace(new RegExp(Gle,"g"),f)},"replaceOctothorpe");return{plural:n((i,c)=>{let{offset:d=0}=c,f=Hle(r,!1,i,c);return s(i-d,f)},"plural"),selectordinal:n((i,c)=>{let{offset:d=0}=c,f=Hle(r,!0,i,c);return s(i-d,f)},"selectordinal"),select:A5e,number:n((i,c)=>iH(r,i,a(c)||{style:c}),"number"),date:n((i,c)=>dH(r,i,a(c)||c),"date"),time:n((i,c)=>R5e(r,i,a(c)||c),"time")}},"getDefaultFormats"),A5e=n((t,e)=>e[t]??e.other,"selectFormatter");function T5e(t,e,o){return(r={},a)=>{let s=E5e(e,o,a),i=n((d,f=!1)=>Array.isArray(d)?d.reduce((p,m)=>{if(m==="#"&&f)return p+Gle;if(Wh(m))return p+m;let[h,v,x]=m,y={};v==="plural"||v==="selectordinal"||v==="select"?Object.entries(x).forEach(([S,w])=>{y[S]=i(w,v==="plural"||v==="selectordinal")}):y=x;let b;if(v){let S=s[v];b=S(r[h],y)}else b=r[h];return b==null?p:p+b},""):d,"formatMessage"),c=i(t);return Wh(c)&&qle.test(c)?Wle(c):Wh(c)?c:c?String(c):""}}n(T5e,"interpolate");var lH=class{static{n(this,"EventEmitter")}_events={};on(e,o){return this._events[e]??=new Set,this._events[e].add(o),()=>this.removeListener(e,o)}removeListener(e,o){let r=this._events[e];r?.delete(o),r?.size===0&&delete this._events[e]}emit(e,...o){let r=this._events[e];if(r)for(let a of[...r])a.apply(this,o)}},cH=class extends lH{static{n(this,"I18n")}_locale="";_locales;_messages={};_missing;_messageCompiler;constructor(e){super(),this.setMessagesCompiler(iP),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),(typeof e.locale=="string"||e.locales)&&this.activate(e.locale??jle,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}setMessagesCompiler(e){return this._messageCompiler=e,this}_load(e,o){let r=this._messages[e];r?Object.assign(r,o):this._messages[e]=o}load(e,o){typeof e=="string"&&typeof o=="object"?this._load(e,o):Object.entries(e).forEach(([r,a])=>this._load(r,a)),this.emit("change")}loadAndActivate({locale:e,locales:o,messages:r}){this._locale=e,this._locales=o||void 0,this._messages[this._locale]=r,this.emit("change")}activate(e,o){this._messages[e]||console.warn(`Messages for locale "${e}" not loaded.`),this._locale=e,this._locales=o,this.emit("change")}_(e,o,r){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=r?.message;e||(e=""),Wh(e)||(o=e.values||o,a=e.message,e=e.id);let s=this.messages[e],i=s===void 0,c=this._missing;if(c&&i)return F5e(c)?c(this._locale,e):c;i&&this.emit("missing",{id:e,locale:this._locale});let d=s||a||e;return Wh(d)&&(this._messageCompiler?d=this._messageCompiler(d):console.warn(`Uncompiled message detected! Message:
254
254
 
@@ -375,4 +375,4 @@ ${t}`})),Wft=n(t=>{let e=[],r=t.replaceAll(/'(?:[^']|'')*'/gu,a=>(e.push(a),`${K
375
375
  `);if(Ce.length===0){V({});return}let Ye={current:!0};return ot((async()=>{try{let it=await o.query(IIt,{keys:Ce},lo(L));Ye.current&&(V(it.references??{}),N(Object.keys(it.storageColumns??{}).length>0))}catch{Ye.current&&(V({}),N(!1))}})()),()=>{Ye.current=!1}},[o,ue,L]);let he=n(Ce=>Ce.key,"keyOf"),{allSelected:Re,clear:Ae,selected:ye,someSelected:ge,toggle:Te,toggleAll:ze}=yIt(de,he),Ze=n(()=>{a(s),Ae(),ot(J(s,void 0,!1))},"listFirst"),_e=n(()=>{ot(J(r,D,!0))},"loadMore"),Ie=n(Ce=>{a(Ce),i(Ce),Ae(),ot(J(Ce,void 0,!1))},"navigate"),ke=n(Ce=>{Ie(`${r}${Ce}`)},"enterFolder"),Be=n(Ce=>se.signedUrl(Ce,{expiresInSeconds:wIt}),"resolveUrl"),Me=n(()=>{p("list")},"showList"),je=n(()=>{p("grid")},"showGrid"),mt=n(Ce=>{x(Ce)},"onSortKeyChange"),ht=n(()=>{b(Ce=>Ce==="asc"?"desc":"asc")},"toggleSortDirection"),yt=n(Ce=>{h(Ce)},"onThumbSizeChange"),Et=n(Ce=>{d(Ce)},"onExpiryChange"),St=n(()=>{F(void 0),E(!0),ot((async()=>{try{for(let Ce of ye)await se.remove(Ce);await J(r,void 0,!1),Ae()}catch(Ce){F(Jt(Ce))}finally{E(!1)}})())},"bulkDelete"),jt=n(Ce=>{F(void 0),ot((async()=>{try{let Ye=await se.signedUrl(Ce,{expiresInSeconds:c});await FIt(Ye),O(Ce)}catch(Ye){F(Jt(Ye))}})())},"onCopy"),At=n(Ce=>{F(void 0),ot((async()=>{try{let Ye=await se.signedUrl(Ce,{expiresInSeconds:c}),it=Ce.slice(Ce.lastIndexOf("/")+1)||Ce;CIt(Ye,it)}catch(Ye){F(Jt(Ye))}})())},"onDownload");(0,lr.useEffect)(()=>{if(k===void 0)return;let Ce=globalThis.setTimeout(()=>{O(void 0)},2e3);return()=>{globalThis.clearTimeout(Ce)}},[k]);let ee=n(Ce=>{F(void 0),E(!0),ot((async()=>{try{await se.remove(Ce),await J(r,void 0,!1)}catch(Ye){F(Jt(Ye))}finally{E(!1)}})())},"onDelete"),ce=n(Ce=>{let Ye=`${r}${Ce.name}`;F(void 0),E(!0),ot((async()=>{try{let it=await Ce.arrayBuffer();await se.upload({body:it,contentType:Ce.type===""?void 0:Ce.type,key:Ye}),await J(r,void 0,!1)}catch(it){F(Jt(it))}finally{E(!1)}})())},"onFile");(0,lr.useEffect)(()=>{B(void 0),Y(!1)},[L]);let Ee=n(()=>{F(void 0),q(!0),ot((async()=>{try{let Ce=[],Ye;do{let ft=await se.list({cursor:Ye,limit:SIt});for(let ct of ft.objects)Ce.push(ct.key);Ye=Ce.length>=pOe?void 0:ft.cursor}while(Ye!==void 0);if(Ce.length>=pOe)B([]),Y(!0);else{let ft=await o.query(bIt,{liveKeys:Ce},lo(L));B(ft.references??[]),Y(ft.truncated===!0)}}catch(Ce){B([]),Y(!1),F(Jt(Ce))}finally{q(!1)}})())},"checkOrphans"),Oe=n(Ce=>{ae(Ce),a(t??""),i(t??""),w(void 0),Ae()},"selectBucket");return{allSelected:Re,bucket:te,buckets:Q,bulkDelete:St,busy:T,checkOrphans:Ee,clearSelection:Ae,copiedKey:k,danglingBusy:z,danglingReferences:_,danglingTruncated:$,draftPrefix:s,enterFolder:ke,error:C,expiry:c,files:de,folders:le,hasObjects:S!==void 0&&S.length>0,hasStorageColumns:j,listFirst:Ze,loaded:S!==void 0,loadMore:_e,navigate:Ie,nextCursor:D,onCopy:jt,onDelete:ee,onDownload:At,onExpiryChange:Et,onFile:ce,onSortKeyChange:mt,onThumbSizeChange:yt,prefix:r,referenceShard:L,references:W,resolveUrl:Be,selectBucket:Oe,selected:ye,setDraftPrefix:i,setReferenceShard:U,showGrid:je,showList:Me,someSelected:ge,sortDirection:y,sortKey:v,tagKeys:ie,thumbSize:m,toggleSelect:Te,toggleSelectAll:ze,toggleSortDirection:ht,view:f}},"useFileBrowser"),EIt=100,mOe=n(t=>{let e=(0,Ja.c)(6),{label:o,onNavigate:r,target:a}=t,s;e[0]!==r||e[1]!==a?(s=n(()=>{r(a)},"t1"),e[0]=r,e[1]=a,e[2]=s):s=e[2];let i=s,c;return e[3]!==i||e[4]!==o?(c=(0,et.jsxDEV)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:i,type:"button",children:o},void 0,!1),e[3]=i,e[4]=o,e[5]=c):c=e[5],c},"Crumb"),AIt=n(t=>{let e=(0,Ja.c)(11),{onNavigate:o,prefix:r,t:a}=t,s;if(e[0]!==o||e[1]!==r||e[2]!==a){let i=r.split("/").filter(TIt),c;e[4]!==a?(c=a("Folder path"),e[4]=a,e[5]=c):c=e[5];let d;e[6]!==a?(d=a("root"),e[6]=a,e[7]=d):d=e[7];let f;e[8]!==o||e[9]!==d?(f=(0,et.jsxDEV)(mOe,{label:d,onNavigate:o,target:""},void 0,!1),e[8]=o,e[9]=d,e[10]=f):f=e[10],s=(0,et.jsxDEV)("nav",{"aria-label":c,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[f,i.map((p,m)=>(0,et.jsxDEV)("span",{className:"flex items-center gap-0.5",children:[(0,et.jsxDEV)("span",{className:"text-muted-foreground/50",children:"/"},void 0,!1),(0,et.jsxDEV)(mOe,{label:p,onNavigate:o,target:`${i.slice(0,m+1).join("/")}/`},void 0,!1)]},`${p}-${m.toString()}`,!0))]},void 0,!0),e[0]=o,e[1]=r,e[2]=a,e[3]=s}else s=e[3];return s},"Breadcrumbs"),yOe=n(({initialPrefix:t,pageSize:e=EIt})=>{let o=Ve(),r=RIt({initialPrefix:t,pageSize:e}),a=(0,lr.useRef)(null),{onCopy:s,onDelete:i,onDownload:c,onFile:d,toggleSelect:f}=r,p={onCopy:s,onDelete:i,onDownload:c,onToggleSelect:f},m=n(()=>{a.current?.click()},"onUploadClick"),h=n(x=>{let y=x.target,b=y.files?.[0];y.value="",b&&d(b)},"onFileChange"),v=r.loaded&&!r.hasObjects;return(0,et.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,et.jsxDEV)(sIt,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:a,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:h,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:m,t:o},void 0,!1),r.loaded&&(0,et.jsxDEV)(AIt,{onNavigate:r.navigate,prefix:r.prefix,t:o},void 0,!1),r.hasObjects&&(0,et.jsxDEV)(iIt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t:o,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view},void 0,!1),r.hasStorageColumns&&(0,et.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,et.jsxDEV)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:o("References shard")},void 0,!1),(0,et.jsxDEV)(Qr,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard},void 0,!1),(0,et.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:o("Which shard's records are checked for references to these files. Empty = root shard.")},void 0,!1)]},void 0,!0),r.hasStorageColumns&&(0,et.jsxDEV)(xIt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t:o,truncated:r.danglingTruncated},void 0,!1),r.selected.size>0&&(0,et.jsxDEV)(oq,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete},void 0,!1),r.error!==void 0&&(0,et.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error},void 0,!1),v&&(0,et.jsxDEV)(co,{description:o("Objects you upload to your R2 buckets will appear here."),icon:(0,et.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,et.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1),(0,et.jsxDEV)("path",{d:"M12 11v5m-2.5-2.5h5"},void 0,!1)]},void 0,!0),testId:"fb-empty",title:o("No objects.")},void 0,!1),r.hasObjects&&r.view==="list"&&(0,et.jsxDEV)(tIt,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:p,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t:o,toggleSelectAll:r.toggleSelectAll},void 0,!1),r.hasObjects&&r.view==="grid"&&(0,et.jsxDEV)(gIt,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:p,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t:o},void 0,!1),r.nextCursor!==void 0&&(0,et.jsxDEV)("div",{children:(0,et.jsxDEV)(dt,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:o("Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"FileBrowser");function TIt(t){return t!==""}n(TIt,"_temp");var IOe=K(Eo(),1);var bOe=K(po(),1);var kIt=n((t,e,o)=>t!==void 0?t:e===void 0&&o===void 0?pH:BF(e,o),"resolveInstance"),YA=n(t=>{let e=(0,IOe.c)(7),{catalogs:o,children:r,i18n:a,locale:s}=t,i;e[0]!==o||e[1]!==a||e[2]!==s?(i=kIt(a,s,o),e[0]=o,e[1]=a,e[2]=s,e[3]=i):i=e[3];let c=i,d;return e[4]!==r||e[5]!==c?(d=(0,bOe.jsxDEV)(mH,{value:c,children:r},void 0,!1),e[4]=r,e[5]=c,e[6]=d):d=e[6],d},"StudioI18nProvider");var UZ=K(Eo(),1);var _0=K(oe(),1);var Ds=K(po(),1);var VZ="lunora:command-palette",SOe=n(()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(VZ))},"openCommandPalette"),MIt=n(t=>{let e=(0,UZ.c)(18),{active:o,index:r,item:a,onActivate:s,onSelect:i}=t,c;e[0]!==a||e[1]!==i?(c=n(()=>{i(a)},"t1"),e[0]=a,e[1]=i,e[2]=c):c=e[2];let d=c,f;e[3]!==r||e[4]!==s?(f=n(()=>{s(r)},"t2"),e[3]=r,e[4]=s,e[5]=f):f=e[5];let p=f,m=o?"bg-accent text-accent-foreground":"text-foreground",h;e[6]!==m?(h=tt("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=h):h=e[7];let v;e[8]!==a.label?(v=(0,Ds.jsxDEV)("span",{children:a.label},void 0,!1),e[8]=a.label,e[9]=v):v=e[9];let x;e[10]!==a.group?(x=(0,Ds.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:a.group},void 0,!1),e[10]=a.group,e[11]=x):x=e[11];let y;return e[12]!==d||e[13]!==p||e[14]!==h||e[15]!==v||e[16]!==x?(y=(0,Ds.jsxDEV)("li",{children:(0,Ds.jsxDEV)("button",{className:h,onClick:d,onMouseEnter:p,type:"button",children:[v,x]},void 0,!0)},void 0,!1),e[12]=d,e[13]=p,e[14]=h,e[15]=v,e[16]=x,e[17]=y):y=e[17],y},"CommandRow"),wOe=n(t=>{let e=(0,UZ.c)(39),{items:o}=t,r=Ve(),a=zs(),[s,i]=(0,_0.useState)(!1),[c,d]=(0,_0.useState)(""),[f,p]=(0,_0.useState)(0),m=(0,_0.useRef)(null),h,v;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n(()=>{let B=n(q=>{(q.metaKey||q.ctrlKey)&&q.key.toLowerCase()==="k"&&(q.preventDefault(),i(!0))},"onKeyDown"),z=n(()=>{i(!0)},"onOpen");return globalThis.addEventListener("keydown",B),globalThis.addEventListener(VZ,z),()=>{globalThis.removeEventListener("keydown",B),globalThis.removeEventListener(VZ,z)}},"t1"),v=[],e[0]=h,e[1]=v):(h=e[0],v=e[1]),(0,_0.useEffect)(h,v);let x;if(e[2]!==o||e[3]!==c){e:{let B=c.trim().toLowerCase();if(B===""){x=o;break e}x=o.filter(z=>z.label.toLowerCase().includes(B)||z.group.toLowerCase().includes(B))}e[2]=o,e[3]=c,e[4]=x}else x=e[4];let y=x,b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n(B=>{i(B),B||(d(""),p(0))},"t4"),e[5]=b):b=e[5];let S=b,w;e[6]!==a?(w=n(B=>{S(!1),ot(a({to:B.to}))},"t5"),e[6]=a,e[7]=w):w=e[7];let C=w,F;e[8]===Symbol.for("react.memo_cache_sentinel")?(F=n(B=>{d(B.target.value),p(0)},"t6"),e[8]=F):F=e[8];let T=F,E;e[9]!==f||e[10]!==y||e[11]!==C?(E=n(B=>{e:switch(B.key){case"ArrowDown":{B.preventDefault(),p(z=>y.length===0?0:(z+1)%y.length);break e}case"ArrowUp":{B.preventDefault(),p(z=>y.length===0?0:(z-1+y.length)%y.length);break e}case"Enter":{B.preventDefault();let z=y[f];z!==void 0&&C(z);break e}}},"t7"),e[9]=f,e[10]=y,e[11]=C,e[12]=E):E=e[12];let k=E,O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=(0,Ds.jsxDEV)(pi.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"},void 0,!1),e[13]=O):O=e[13];let D;e[14]!==r?(D=r("Command palette"),e[14]=r,e[15]=D):D=e[15];let M;e[16]!==D?(M=(0,Ds.jsxDEV)(pi.Title,{className:"sr-only",children:D},void 0,!1),e[16]=D,e[17]=M):M=e[17];let L;e[18]===Symbol.for("react.memo_cache_sentinel")?(L=(0,Ds.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,Ds.jsxDEV)("circle",{cx:"11",cy:"11",r:"7"},void 0,!1),(0,Ds.jsxDEV)("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"},void 0,!1)]},void 0,!0),e[18]=L):L=e[18];let U;e[19]!==r?(U=r("Search\u2026"),e[19]=r,e[20]=U):U=e[20];let W;e[21]!==k||e[22]!==c||e[23]!==U?(W=(0,Ds.jsxDEV)("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[L,(0,Ds.jsxDEV)("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:T,onKeyDown:k,placeholder:U,ref:m,type:"text",value:c},void 0,!1)]},void 0,!0),e[21]=k,e[22]=c,e[23]=U,e[24]=W):W=e[24];let V;e[25]!==f||e[26]!==y||e[27]!==C||e[28]!==r?(V=y.length===0?(0,Ds.jsxDEV)("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:r("No results.")},void 0,!1):y.map((B,z)=>(0,Ds.jsxDEV)(MIt,{active:z===f,index:z,item:B,onActivate:p,onSelect:C},B.to,!1)),e[25]=f,e[26]=y,e[27]=C,e[28]=r,e[29]=V):V=e[29];let j;e[30]!==V?(j=(0,Ds.jsxDEV)("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:V},void 0,!1),e[30]=V,e[31]=j):j=e[31];let N;e[32]!==M||e[33]!==W||e[34]!==j?(N=(0,Ds.jsxDEV)(pi.Portal,{children:[O,(0,Ds.jsxDEV)(pi.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:m,children:[M,W,j]},void 0,!0)]},void 0,!0),e[32]=M,e[33]=W,e[34]=j,e[35]=N):N=e[35];let _;return e[36]!==s||e[37]!==N?(_=(0,Ds.jsxDEV)(pi.Root,{onOpenChange:S,open:s,children:N},void 0,!1),e[36]=s,e[37]=N,e[38]=_):_=e[38],_},"CommandPalette");var VOe="(prefers-color-scheme: dark)",UOe=n(()=>{try{return globalThis.localStorage}catch{return}},"store"),PIt=n(t=>t==="system"||t==="light"||t==="dark","isPreference"),zOe=n(()=>globalThis.matchMedia,"matchMedia"),$Oe="lunora-studio-theme",zZ=["system","light","dark"],OIt=n((t="system")=>{try{let e=UOe()?.getItem($Oe);return PIt(e)?e:t}catch{return t}},"loadThemePreference"),COe=n(t=>{let e=UOe();if(e!==void 0)try{e.setItem($Oe,t)}catch{}},"saveThemePreference"),NIt=n(()=>{try{return zOe()?.(VOe).matches?"dark":"light"}catch{return"light"}},"getSystemTheme"),DIt=n((t,e)=>t==="system"?e:t,"resolveTheme"),_It=n(t=>{let e;try{e=zOe()?.(VOe)}catch{e=void 0}if(e===void 0)return()=>{};let o=n(r=>{t(r.matches?"dark":"light")},"handler");return e.addEventListener("change",o),()=>{e.removeEventListener("change",o)}},"subscribeSystemTheme"),HOe=(0,st.createContext)(null),jOe=n(({children:t,defaultTheme:e="system"})=>{let[o,r]=(0,st.useState)(()=>OIt(e)),[a,s]=(0,st.useState)(()=>NIt());(0,st.useEffect)(()=>_It(s),[]);let i=n(f=>{COe(f),r(f)},"setTheme"),d={cycleTheme:n(()=>{r(f=>{let p=zZ[(zZ.indexOf(f)+1)%zZ.length]??f;return COe(p),p})},"cycleTheme"),resolvedTheme:DIt(o,a),setTheme:i,systemTheme:a,theme:o};return(0,P.jsxDEV)(HOe,{value:d,children:t},void 0,!1)},"ThemeProvider"),aV=n(()=>{let t=(0,st.use)(HOe);if(t===null)throw new Error("useTheme must be used within a <ThemeProvider>");return t},"useTheme");function qOe({delay:t=0,...e}){return(0,P.jsxDEV)(wf.Provider,{"data-slot":"tooltip-provider",delay:t,...e},void 0,!1)}n(qOe,"TooltipProvider");function LIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(wf.Root,{"data-slot":"tooltip",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(LIt,"Tooltip");function BIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(wf.Trigger,{"data-slot":"tooltip-trigger",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(BIt,"TooltipTrigger");function VIt({className:t,side:e="top",sideOffset:o=4,align:r="center",alignOffset:a=0,children:s,...i}){return(0,P.jsxDEV)(wf.Portal,{children:(0,P.jsxDEV)(wf.Positioner,{align:r,alignOffset:a,side:e,sideOffset:o,className:"isolate z-50",children:(0,P.jsxDEV)(wf.Popup,{"data-slot":"tooltip-content",className:tt("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pe-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-md data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...i,children:[s,(0,P.jsxDEV)(wf.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-md bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-start-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-end-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)}n(VIt,"TooltipContent");var GZ=n(t=>{let e=(0,Yt.c)(5),{className:o}=t,r;e[0]!==o?(r=tt("h-full w-full text-foreground",o),e[0]=o,e[1]=r):r=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,P.jsxDEV)("path",{d:"M 259.500 10.552 C 220.080 15.859, 182.424 32.566, 152.500 58.025 C 110.179 94.031, 85.380 137.183, 77.518 188.500 C 75.410 202.255, 74.569 225.677, 75.796 236.466 C 76.757 244.917, 76.683 245.692, 74.518 249.966 C 63.118 272.466, 53.141 303.876, 51.382 322.799 L 50.718 329.943 71.960 320.471 C 83.643 315.262, 93.326 311, 93.478 311 C 93.630 311, 96.547 316.063, 99.959 322.250 C 103.371 328.438, 107.249 334.850, 108.577 336.500 L 110.990 339.500 110.981 336 C 110.977 334.075, 111.499 324.991, 112.143 315.813 L 113.312 299.127 121.406 293.336 C 132.495 285.403, 149.593 271.554, 161 261.268 C 171.556 251.748, 189.116 235, 188.540 235 C 188.337 235, 183.069 238.648, 176.835 243.106 C 142.318 267.789, 68.537 314, 63.646 314 C 61.843 314, 72.791 281.179, 80.905 262.259 C 92.233 235.845, 107.473 212.389, 132.106 183.453 L 138.451 176 148.268 176 C 176.192 176, 197.512 187.154, 212.868 209.797 C 216.470 215.108, 217.035 216.595, 216.477 219.297 C 211.386 243.968, 202.359 274.496, 193.797 296 C 183.898 320.861, 167.147 352.101, 152.395 373.215 L 147.004 380.930 152.891 385.830 C 161.400 392.911, 165.563 396, 166.594 395.998 C 167.092 395.998, 168.772 391.641, 170.327 386.317 C 176.279 365.934, 188.422 338.749, 200.942 317.778 C 223.060 280.731, 256.432 244.369, 294.500 215.836 C 309.956 204.252, 313.937 201.603, 314.719 202.385 C 315.116 202.783, 315.449 213.096, 315.460 225.304 C 315.474 241.855, 315.021 250.405, 313.680 258.924 C 307.009 301.272, 291.175 336.677, 263.112 372 C 255.259 381.883, 227.182 410.673, 218.516 417.727 L 213.532 421.783 223.439 424.880 C 281.705 443.093, 349.165 436.018, 398.616 406.508 C 446.728 377.797, 483.322 331.466, 497.366 281.481 C 503.381 260.075, 504.480 250.741, 504.491 221 C 504.501 191.997, 503.598 184.047, 497.987 163.732 C 484.768 115.871, 452.505 72.708, 407.718 42.964 C 381.051 25.254, 352.818 14.828, 319.695 10.460 C 305.932 8.645, 273.298 8.695, 259.500 10.552",fillRule:"evenodd"},void 0,!1),e[2]=a):a=e[2];let s;return e[3]!==r?(s=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:r,fill:"currentColor",viewBox:"0 0 543 446",children:a},void 0,!1),e[3]=r,e[4]=s):s=e[4],s},"BrandMark"),WOe="lunora.studio.rulesBannerDismissed",UIt=n(()=>{try{return globalThis.localStorage.getItem(WOe)==="1"}catch{return!1}},"readBannerDismissed"),zIt=n(()=>{try{globalThis.localStorage.setItem(WOe,"1")}catch{}},"writeBannerDismissed"),$It=n(()=>{let t=(0,Yt.c)(18),e=Ve(),[o,r]=(0,st.useState)(HIt),a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=n(()=>{r(!0),zIt()},"t0"),t[0]=a):a=t[0];let s=a;if(o)return null;let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-warning",children:"\u26A0"},void 0,!1),t[1]=i):i=t[1];let c;t[2]!==e?(c=e("Lunora AI rules aren't installed."),t[2]=e,t[3]=c):c=t[3];let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=(0,P.jsxDEV)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px]",children:"lunora rules install"},void 0,!1),t[4]=d):d=t[4];let f;t[5]!==e?(f=e("lets your coding agent use Lunora correctly."),t[5]=e,t[6]=f):f=t[6];let p;t[7]!==c||t[8]!==f?(p=(0,P.jsxDEV)("span",{children:[c," ",d," ",f]},void 0,!0),t[7]=c,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==e?(m=e("Dismiss"),t[10]=e,t[11]=m):m=t[11];let h;t[12]===Symbol.for("react.memo_cache_sentinel")?(h=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M18 6 6 18M6 6l12 12"},void 0,!1)},void 0,!1),t[12]=h):h=t[12];let v;t[13]!==m?(v=(0,P.jsxDEV)("button",{"aria-label":m,className:"ms-auto flex size-5 items-center justify-center rounded text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":"dash-app-rules-banner-dismiss",onClick:s,type:"button",children:h},void 0,!1),t[13]=m,t[14]=v):v=t[14];let x;return t[15]!==p||t[16]!==v?(x=(0,P.jsxDEV)("div",{className:"flex shrink-0 items-center gap-2 border-b border-warning/30 bg-warning/10 px-6 py-2 text-[12px] text-foreground","data-testid":"dash-app-rules-banner",role:"note",children:[i,p,v]},void 0,!0),t[15]=p,t[16]=v,t[17]=x):x=t[17],x},"RulesBanner");function HIt(){return UIt()}n(HIt,"_temp$9");var jIt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("rect",{height:"14",rx:"2",width:"20",x:"2",y:"3"},void 0,!1),(0,P.jsxDEV)("path",{d:"M8 21h8M12 17v4"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"MonitorIcon"),qIt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"12",cy:"12",r:"4"},void 0,!1),(0,P.jsxDEV)("path",{d:"M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"SunIcon"),WIt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"},void 0,!1)},void 0,!1),t[0]=e):e=t[0],e},"MoonIcon"),GIt=[{Icon:jIt,value:"system"},{Icon:qIt,value:"light"},{Icon:WIt,value:"dark"}],KIt=n(()=>{let t=(0,Yt.c)(19),{theme:e,setTheme:o}=aV(),r=Ve(),a;t[0]!==r?(a=r("Dark theme"),t[0]=r,t[1]=a):a=t[1];let s;t[2]!==r?(s=r("Light theme"),t[2]=r,t[3]=s):s=t[3];let i;t[4]!==r?(i=r("System theme"),t[4]=r,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==s||t[8]!==i?(c={dark:a,light:s,system:i},t[6]=a,t[7]=s,t[8]=i,t[9]=c):c=t[9];let d=c,f;t[10]!==r?(f=r("Theme"),t[10]=r,t[11]=f):f=t[11];let p;t[12]!==d||t[13]!==o||t[14]!==e?(p=GIt.map(h=>{let{Icon:v,value:x}=h,y=e===x;return(0,P.jsxDEV)("button",{"aria-checked":y,"aria-label":d[x],className:tt("relative flex size-7 cursor-pointer items-center justify-center rounded-md outline-none transition-colors focus-visible:bg-accent",y?"text-foreground":"text-muted-foreground hover:text-foreground"),"data-testid":`dash-app-theme-${x}`,onClick:n(()=>{o(x)},"onClick"),role:"radio",title:d[x],type:"button",children:[y&&(0,P.jsxDEV)(Up.span,{className:"absolute inset-0 rounded-md border border-muted-foreground/40 bg-background/40",layoutId:"studio-theme-active",transition:{bounce:.1,duration:.45,type:"spring"}},void 0,!1),(0,P.jsxDEV)("span",{className:"relative",children:(0,P.jsxDEV)(v,{},void 0,!1)},void 0,!1)]},x,!0)}),t[12]=d,t[13]=o,t[14]=e,t[15]=p):p=t[15];let m;return t[16]!==f||t[17]!==p?(m=(0,P.jsxDEV)("div",{"aria-label":f,className:"inline-flex items-center gap-0.5 overflow-hidden rounded-md border border-border bg-muted/60 p-0.5","data-testid":"dash-app-theme",role:"radiogroup",children:p},void 0,!1),t[16]=f,t[17]=p,t[18]=m):m=t[18],m},"ThemeToggle");function GOe(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(Dg.Root,{"data-slot":"popover",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(GOe,"Popover");function KOe(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(Dg.Trigger,{"data-slot":"popover-trigger",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(KOe,"PopoverTrigger");function YOe({align:t="end",alignOffset:e=0,className:o,keepMounted:r=!1,side:a="bottom",sideOffset:s=6,...i}){return(0,P.jsxDEV)(Dg.Portal,{keepMounted:r,children:(0,P.jsxDEV)(Dg.Positioner,{align:t,alignOffset:e,className:"isolate z-50 outline-none",side:a,sideOffset:s,children:(0,P.jsxDEV)(Dg.Popup,{className:tt("z-50 w-72 origin-(--transform-origin) rounded-lg border border-border bg-popover p-3 text-popover-foreground shadow-md outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",o),"data-slot":"popover-content",...i},void 0,!1)},void 0,!1)},void 0,!1)}n(YOe,"PopoverContent");var $Z=768;function YIt(){let t=(0,Yt.c)(2),[e,o]=(0,st.useState)(void 0),r,a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=n(()=>{let s=globalThis.matchMedia(`(max-width: ${$Z-1}px)`),i=n(()=>{o(globalThis.innerWidth<$Z)},"onChange");return s.addEventListener("change",i),o(globalThis.innerWidth<$Z),()=>{s.removeEventListener("change",i)}},"t0"),a=[],t[0]=r,t[1]=a):(r=t[0],a=t[1]),(0,st.useEffect)(r,a),!!e}n(YIt,"useIsMobile");function XIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(pi.Root,{"data-slot":"sheet",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(XIt,"Sheet");function QIt(t){let e=(0,Yt.c)(4),o;e[0]!==t?({...o}=t,e[0]=t,e[1]=o):o=e[1];let r;return e[2]!==o?(r=(0,P.jsxDEV)(pi.Portal,{"data-slot":"sheet-portal",...o},void 0,!1),e[2]=o,e[3]=r):r=e[3],r}n(QIt,"SheetPortal");function ZIt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("fixed inset-0 z-50 bg-black/10 text-xs/relaxed transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)(pi.Backdrop,{"data-slot":"sheet-overlay",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(ZIt,"SheetOverlay");function JIt({className:t,children:e,side:o="right",showCloseButton:r=!0,...a}){return(0,P.jsxDEV)(QIt,{children:[(0,P.jsxDEV)(ZIt,{},void 0,!1),(0,P.jsxDEV)(pi.Popup,{"data-slot":"sheet-content","data-side":o,className:tt("fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...a,children:[e,r&&(0,P.jsxDEV)(pi.Close,{"data-slot":"sheet-close",render:(0,P.jsxDEV)(dt,{variant:"ghost",className:"absolute top-3 end-3",size:"icon-sm"},void 0,!1),children:[(0,P.jsxDEV)(Ya,{icon:Zp,strokeWidth:2},void 0,!1),(0,P.jsxDEV)("span",{className:"sr-only",children:"Close"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)}n(JIt,"SheetContent");function ebt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex flex-col gap-0.5 p-4",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sheet-header",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(ebt,"SheetHeader");function tbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("text-sm font-medium text-foreground",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)(pi.Title,{"data-slot":"sheet-title",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(tbt,"SheetTitle");function obt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("text-xs/relaxed text-muted-foreground",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)(pi.Description,{"data-slot":"sheet-description",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(obt,"SheetDescription");var rbt="sidebar_state",nbt=3600*24*7,abt="16rem",sbt="18rem",ibt="3rem",lbt="b",XOe=Um.createContext(null);function sV(){let t=Um.useContext(XOe);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}n(sV,"useSidebar");function cbt({defaultOpen:t=!0,open:e,onOpenChange:o,className:r,style:a,children:s,...i}){let c=YIt(),[d,f]=Um.useState(!1),[p,m]=Um.useState(t),h=e??p,v=n(S=>{let w=typeof S=="function"?S(h):S;o?o(w):m(w),document.cookie=`${rbt}=${w}; path=/; max-age=${nbt}`},"setOpen"),x=n(()=>c?f(S=>!S):v(S=>!S),"toggleSidebar");Um.useEffect(()=>{let S=n(w=>{w.key===lbt&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),x())},"handleKeyDown");return globalThis.addEventListener("keydown",S),()=>globalThis.removeEventListener("keydown",S)},[x]);let b={state:h?"expanded":"collapsed",open:h,setOpen:v,isMobile:c,openMobile:d,setOpenMobile:f,toggleSidebar:x};return(0,P.jsxDEV)(XOe.Provider,{value:b,children:(0,P.jsxDEV)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":abt,"--sidebar-width-icon":ibt,...a},className:tt("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...i,children:s},void 0,!1)},void 0,!1)}n(cbt,"SidebarProvider");function ubt({side:t="left",variant:e="sidebar",collapsible:o="offcanvas",className:r,children:a,dir:s,...i}){let{isMobile:c,state:d,openMobile:f,setOpenMobile:p}=sV();return o==="none"?(0,P.jsxDEV)("div",{"data-slot":"sidebar",className:tt("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...i,children:a},void 0,!1):c?(0,P.jsxDEV)(XIt,{open:f,onOpenChange:p,...i,children:(0,P.jsxDEV)(JIt,{dir:s,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":sbt},side:t,children:[(0,P.jsxDEV)(ebt,{className:"sr-only",children:[(0,P.jsxDEV)(tbt,{children:"Sidebar"},void 0,!1),(0,P.jsxDEV)(obt,{children:"Displays the mobile sidebar."},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex h-full w-full flex-col",children:a},void 0,!1)]},void 0,!0)},void 0,!1):(0,P.jsxDEV)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":d==="collapsed"?o:"","data-variant":e,"data-side":t,"data-slot":"sidebar",children:[(0,P.jsxDEV)("div",{"data-slot":"sidebar-gap",className:tt("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")},void 0,!1),(0,P.jsxDEV)("div",{"data-slot":"sidebar-container","data-side":t,className:tt("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-e group-data-[side=right]:border-s",r),...i,children:(0,P.jsxDEV)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-none group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:a},void 0,!1)},void 0,!1)]},void 0,!0)}n(ubt,"Sidebar");function dbt(t){let e=(0,Yt.c)(15),o,r,a;e[0]!==t?({className:o,onClick:r,...a}=t,e[0]=t,e[1]=o,e[2]=r,e[3]=a):(o=e[1],r=e[2],a=e[3]);let{toggleSidebar:s}=sV(),i;e[4]!==o?(i=tt(o),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==r||e[7]!==s?(c=n(m=>{r?.(m),s()},"t2"),e[6]=r,e[7]=s,e[8]=c):c=e[8];let d,f;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,P.jsxDEV)(Ya,{icon:hE,strokeWidth:2,className:"rtl:rotate-180"},void 0,!1),f=(0,P.jsxDEV)("span",{className:"sr-only",children:"Toggle Sidebar"},void 0,!1),e[9]=d,e[10]=f):(d=e[9],f=e[10]);let p;return e[11]!==a||e[12]!==i||e[13]!==c?(p=(0,P.jsxDEV)(dt,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:i,onClick:c,...a,children:[d,f]},void 0,!0),e[11]=a,e[12]=i,e[13]=c,e[14]=p):p=e[14],p}n(dbt,"SidebarTrigger");function fbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-none md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("main",{"data-slot":"sidebar-inset",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(fbt,"SidebarInset");function pbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex flex-col gap-2 p-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(pbt,"SidebarHeader");function mbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex flex-col gap-2 p-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(mbt,"SidebarFooter");function hbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex min-h-0 flex-1 flex-col gap-0 overflow-x-hidden overflow-y-auto [scrollbar-color:color-mix(in_oklch,var(--muted-foreground)_25%,transparent)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/25 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:w-1.5 hover:[scrollbar-color:color-mix(in_oklch,var(--muted-foreground)_50%,transparent)_transparent] hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/50",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(hbt,"SidebarContent");function gbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("relative flex w-full min-w-0 flex-col p-2",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(gbt,"SidebarGroup");function vbt(t){let e=(0,Yt.c)(10),o,r,a,s;if(e[0]!==t){let{className:d,render:f,...p}=t;o=f,s=MR,r="div",a=yr({className:tt("flex h-8 shrink-0 items-center rounded-none px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",d)},p),e[0]=t,e[1]=o,e[2]=r,e[3]=a,e[4]=s}else o=e[1],r=e[2],a=e[3],s=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i={slot:"sidebar-group-label",sidebar:"group-label"},e[5]=i):i=e[5];let c;return e[6]!==o||e[7]!==r||e[8]!==a?(c={defaultTagName:r,props:a,render:o,state:i},e[6]=o,e[7]=r,e[8]=a,e[9]=c):c=e[9],s(c)}n(vbt,"SidebarGroupLabel");function xbt(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("w-full text-xs",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(xbt,"SidebarGroupContent");function FOe(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("flex w-full min-w-0 flex-col gap-0",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(FOe,"SidebarMenu");function ROe(t){let e=(0,Yt.c)(8),o,r;e[0]!==t?({className:o,...r}=t,e[0]=t,e[1]=o,e[2]=r):(o=e[1],r=e[2]);let a;e[3]!==o?(a=tt("group/menu-item relative",o),e[3]=o,e[4]=a):a=e[4];let s;return e[5]!==r||e[6]!==a?(s=(0,P.jsxDEV)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:a,...r},void 0,!1),e[5]=r,e[6]=a,e[7]=s):s=e[7],s}n(ROe,"SidebarMenuItem");var ybt=fg("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-none p-2 text-start text-xs ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-xs",sm:"h-7 text-xs",lg:"h-12 text-xs group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function QOe({render:t,isActive:e=!1,variant:o="default",size:r="default",tooltip:a,className:s,...i}){let{isMobile:c,state:d}=sV(),f=MR({defaultTagName:"button",props:yr({className:tt(ybt({variant:o,size:r}),s)},i),render:a?(0,P.jsxDEV)(BIt,{render:t},void 0,!1):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:e}});return a?(typeof a=="string"&&(a={children:a}),(0,P.jsxDEV)(LIt,{children:[f,(0,P.jsxDEV)(VIt,{side:"right",align:"center",hidden:d!=="collapsed"||c,...a},void 0,!1)]},void 0,!0)):f}n(QOe,"SidebarMenuButton");var EOe=["read","insert","update","delete"],Ibt=n((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"operationLabel$2"),bbt=n(t=>{let e=new Map;for(let o of t){let r=e.get(o.table)??{operations:new Set,procedures:[],table:o.table};r.operations.add(o.on),r.procedures.includes(o.procedure)||r.procedures.push(o.procedure),e.set(o.table,r)}return[...e.values()].toSorted((o,r)=>o.table.localeCompare(r.table))},"groupByTable"),Sbt=n(()=>{let t=(0,Yt.c)(47),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.rlsPolicies,o),s=r!==void 0,i,c,d,f,p,m,h,v,x;if(t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==e){let E=bbt(Array.isArray(r?.policies)?r.policies:[]),k;t[14]!==r?(k=Array.isArray(r?.roles)?r.roles:[],t[14]=r,t[15]=k):k=t[15],c=k,h="flex flex-col gap-6",v="lunora-rls-panel",t[16]!==a?(x=a!==null&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"rls-error",role:"alert",children:a},void 0,!1),t[16]=a,t[17]=x):x=t[17],m="flex flex-col gap-2",i=Rt,d="overflow-hidden py-0";let O;t[18]!==e?(O=e("Policies"),t[18]=e,t[19]=O):O=t[19],t[20]!==O?(f=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O},void 0,!1)},void 0,!1),t[20]=O,t[21]=f):f=t[21],p=s&&E.length===0?(0,P.jsxDEV)(co,{description:e("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:e("No policies defined")},void 0,!1):(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"rls-policies-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Table")},void 0,!1),EOe.map(D=>(0,P.jsxDEV)(Le,{children:Ibt(e,D)},D,!1)),(0,P.jsxDEV)(Le,{children:e("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:E.map(D=>(0,P.jsxDEV)(It,{"data-testid":`rls-table-${D.table}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:D.table},void 0,!1),EOe.map(M=>(0,P.jsxDEV)(Ne,{children:D.operations.has(M)?(0,P.jsxDEV)(Pt,{variant:"secondary",children:e("Guarded")},void 0,!1):(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1)},M,!1)),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:D.procedures.join(", ")},void 0,!1)]},D.table,!0))},void 0,!1)]},void 0,!0)},void 0,!1),t[1]=r,t[2]=a,t[3]=s,t[4]=e,t[5]=i,t[6]=c,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=v,t[13]=x}else i=t[5],c=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],v=t[12],x=t[13];let y;t[22]!==i||t[23]!==d||t[24]!==f||t[25]!==p?(y=(0,P.jsxDEV)(i,{className:d,children:[f,p]},void 0,!0),t[22]=i,t[23]=d,t[24]=f,t[25]=p,t[26]=y):y=t[26];let b;t[27]!==m||t[28]!==y?(b=(0,P.jsxDEV)("section",{className:m,children:y},void 0,!1),t[27]=m,t[28]=y,t[29]=b):b=t[29];let S;t[30]!==e?(S=e("Roles"),t[30]=e,t[31]=S):S=t[31];let w;t[32]!==S?(w=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S},void 0,!1)},void 0,!1),t[32]=S,t[33]=w):w=t[33];let C;t[34]!==s||t[35]!==c||t[36]!==e?(C=s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:e("No roles defined")},void 0,!1):(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"rls-roles-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Role")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Description")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Permissions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(Cbt)},void 0,!1)]},void 0,!0)},void 0,!1),t[34]=s,t[35]=c,t[36]=e,t[37]=C):C=t[37];let F;t[38]!==w||t[39]!==C?(F=(0,P.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[w,C]},void 0,!0)},void 0,!1),t[38]=w,t[39]=C,t[40]=F):F=t[40];let T;return t[41]!==F||t[42]!==h||t[43]!==v||t[44]!==x||t[45]!==b?(T=(0,P.jsxDEV)("div",{className:h,"data-testid":v,children:[x,b,F]},void 0,!0),t[41]=F,t[42]=h,t[43]=v,t[44]=x,t[45]=b,t[46]=T):T=t[46],T},"RlsPanel");function wbt(t){return(0,P.jsxDEV)(Pt,{variant:"outline",children:t},t,!1)}n(wbt,"_temp$8");function Cbt(t){return(0,P.jsxDEV)(It,{"data-testid":`rls-role-${t.name}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground",children:t.description??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:t.permissions.length===0?(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:t.permissions.map(wbt)},void 0,!1)},void 0,!1)]},t.name,!0)}n(Cbt,"_temp2$4");var Fbt="ANALYTICS",AOe=[{key:"volume",sql:n(t=>`SELECT blob2 AS fn, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:n(t=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:n(t=>`SELECT blob3 AS shard, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],Rbt={error:null,loading:!0,result:null},Ebt=n(t=>{let e=(0,Yt.c)(27),{state:o,title:r}=t,a=Ve(),{error:s,loading:i,result:c}=o,d=`analytics-panel-${r}`,f;e[0]!==a||e[1]!==r?(f=a(r),e[0]=a,e[1]=r,e[2]=f):f=e[2];let p;e[3]!==f?(p=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1)},void 0,!1),e[3]=f,e[4]=p):p=e[4];let m;e[5]!==i||e[6]!==a?(m=i&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:a("Loading\u2026")},void 0,!1),e[5]=i,e[6]=a,e[7]=m):m=e[7];let h;e[8]!==s||e[9]!==i?(h=!i&&s!==null&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:s},void 0,!1),e[8]=s,e[9]=i,e[10]=h):h=e[10];let v;e[11]!==s||e[12]!==i||e[13]!==c||e[14]!==a?(v=!i&&s===null&&c!==null&&c.rows.length===0&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:a("No data points yet.")},void 0,!1),e[11]=s,e[12]=i,e[13]=c,e[14]=a,e[15]=v):v=e[15];let x;e[16]!==s||e[17]!==i||e[18]!==c?(x=!i&&s===null&&c!==null&&c.rows.length>0&&(0,P.jsxDEV)(Ao,{children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:c.columns.map(Tbt)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(To,{children:c.rows.map((b,S)=>(0,P.jsxDEV)(It,{children:c.columns.map(w=>(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:jr(b[w.name])},w.name,!1))},S,!1))},void 0,!1)]},void 0,!0),e[16]=s,e[17]=i,e[18]=c,e[19]=x):x=e[19];let y;return e[20]!==d||e[21]!==p||e[22]!==m||e[23]!==h||e[24]!==v||e[25]!==x?(y=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0","data-testid":d,children:[p,m,h,v,x]},void 0,!0),e[20]=d,e[21]=p,e[22]=m,e[23]=h,e[24]=v,e[25]=x,e[26]=y):y=e[26],y},"PanelResult"),Abt=n(({config:t,dataset:e=Fbt,runQuery:o}={})=>{let r=Ve(),[a,s]=(0,st.useState)({}),i=(0,st.useMemo)(()=>{if(o!==void 0)return o;if(t===void 0)return null;let d=E9({accountId:t.accountId,apiToken:t.apiToken});return f=>d.query(f)},[t,o]),c=(0,st.useCallback)(async d=>{if(i!==null)for(let f of AOe){if(d.cancelled)return;s(p=>({...p,[f.key]:{error:null,loading:!0,result:null}}));try{let p=await i(f.sql(e));d.cancelled||s(m=>({...m,[f.key]:{error:null,loading:!1,result:p}}))}catch(p){d.cancelled||s(m=>({...m,[f.key]:{error:Jt(p),loading:!1,result:null}}))}}},[i,e]);return(0,st.useEffect)(()=>{let d={cancelled:!1};return ot(c(d)),()=>{d.cancelled=!0}},[c]),i===null?(0,P.jsxDEV)(co,{description:r("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1)},void 0,!1),testId:"analytics-not-configured",title:r("Analytics is not configured.")},void 0,!1):(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:AOe.map(d=>(0,P.jsxDEV)(Ebt,{state:a[d.key]??Rbt,title:d.title},d.key,!1))},void 0,!1)},"AnalyticsPanel");function Tbt(t){return(0,P.jsxDEV)(Le,{children:t.name},t.name,!1)}n(Tbt,"_temp$7");var kbt=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],Mbt=n(()=>{let t=(0,Yt.c)(29),e=Wt(),o=Ve(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=["lunora-auth-capabilities"],t[0]=r):r=t[0];let a;t[1]!==e?(a=n(()=>e.getAuthCapabilities(),"t1"),t[1]=e,t[2]=a):a=t[2];let{data:s,error:i}=mi(r,a),c;t[3]!==o?(c=o("Enabled capabilities"),t[3]=o,t[4]=c):c=t[4];let d;t[5]!==c?(d=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c},void 0,!1)},void 0,!1),t[5]=c,t[6]=d):d=t[6];let f;t[7]!==i?(f=i!==null&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:i},void 0,!1),t[7]=i,t[8]=f):f=t[8];let p;t[9]!==s||t[10]!==i||t[11]!==o?(p=i===null&&s===void 0&&(0,P.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:o("Loading auth configuration\u2026")},void 0,!1),t[9]=s,t[10]=i,t[11]=o,t[12]=p):p=t[12];let m;t[13]!==s||t[14]!==i||t[15]!==o?(m=i===null&&s!==void 0&&(0,P.jsxDEV)(Xt,{className:"p-3",children:(0,P.jsxDEV)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:kbt.map(b=>{let S=s[b.key];return(0,P.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${b.key}`,children:[(0,P.jsxDEV)("span",{className:"text-sm",children:o(b.label)},void 0,!1),(0,P.jsxDEV)(Pt,{variant:S?"success":"outline",children:o(S?"Enabled":"Disabled")},void 0,!1)]},b.key,!0)})},void 0,!1)},void 0,!1),t[13]=s,t[14]=i,t[15]=o,t[16]=m):m=t[16];let h;t[17]!==d||t[18]!==f||t[19]!==p||t[20]!==m?(h=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[d,f,p,m]},void 0,!0),t[17]=d,t[18]=f,t[19]=p,t[20]=m,t[21]=h):h=t[21];let v;t[22]!==o?(v=o("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output."),t[22]=o,t[23]=v):v=t[23];let x;t[24]!==v?(x=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:(0,P.jsxDEV)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:v},void 0,!1)},void 0,!1),t[24]=v,t[25]=x):x=t[25];let y;return t[26]!==h||t[27]!==x?(y=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[h,x]},void 0,!0),t[26]=h,t[27]=x,t[28]=y):y=t[28],y},"AuthConfigPanel"),TOe=200,Pbt=n(()=>{let t=(0,Yt.c)(21),e=Wt(),o=Ve(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=["lunora-auth-sessions",TOe],t[0]=r):r=t[0];let a;t[1]!==e?(a=n(()=>e.listAuthSessions({limit:TOe}),"t1"),t[1]=e,t[2]=a):a=t[2];let s=mi(r,a),{error:i}=s,c=s.data?.rows??null,d;t[3]!==s?(d=n(()=>{s.refetch()},"t2"),t[3]=s,t[4]=d):d=t[4],us(d,!0);let f;t[5]!==e||t[6]!==s?(f=n(y=>{ot((async()=>{await e.revokeAuthSession({sessionId:y}),s.refetch()})())},"t3"),t[5]=e,t[6]=s,t[7]=f):f=t[7];let p=f,m;t[8]!==i?(m=i!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:i},void 0,!1),t[8]=i,t[9]=m):m=t[9];let h;t[10]!==c||t[11]!==o?(h=c!==null&&c.length===0&&(0,P.jsxDEV)(co,{testId:"auth-sessions-empty",title:o("No active sessions.")},void 0,!1),t[10]=c,t[11]=o,t[12]=h):h=t[12];let v;t[13]!==p||t[14]!==c||t[15]!==o?(v=c!==null&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"auth-sessions-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:o("user")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("expires")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("ip")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("user agent")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("impersonated by")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(y=>(0,P.jsxDEV)(It,{"data-testid":`auth-session-${y.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:y.userId},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(y.expiresAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:y.ipAddress??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-40 truncate",children:y.userAgent??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:y.impersonatedBy??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`auth-session-revoke-${y.id}`,onClick:n(()=>{p(y.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Revoke")},void 0,!1)},void 0,!1)]},y.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[13]=p,t[14]=c,t[15]=o,t[16]=v):v=t[16];let x;return t[17]!==m||t[18]!==h||t[19]!==v?(x=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[m,h,v]},void 0,!0),t[17]=m,t[18]=h,t[19]=v,t[20]=x):x=t[20],x},"AuthSessionsPanel"),Obt={accounts:!0,admin:!0,organization:!1,passkey:!1,twoFactor:!1},ZOe=n(()=>{let t=Wt(),[e,o]=(0,st.useState)(Obt),[r,a]=(0,st.useState)(!1);return(0,st.useEffect)(()=>{ot((async()=>{try{o(await t.getAuthCapabilities())}catch{}finally{a(!0)}})())},[t]),{capabilities:e,ready:r}},"useAuthCapabilities"),kOe=n(t=>{let e=(0,Yt.c)(35),{actionLabel:o,actionPrefix:r,columns:a,heading:s,onAction:i,rowPrefix:c,rows:d,testId:f}=t,p=Ve(),m;e[0]!==s?(m=(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s},void 0,!1)},void 0,!1),e[0]=s,e[1]=m):m=e[1];let h;e[2]!==a?(h=a.map(Dbt),e[2]=a,e[3]=h):h=e[3];let v;e[4]!==p?(v=p("Actions"),e[4]=p,e[5]=v):v=e[5];let x;e[6]!==v?(x=(0,P.jsxDEV)(Le,{"aria-label":v},void 0,!1),e[6]=v,e[7]=x):x=e[7];let y;e[8]!==h||e[9]!==x?(y=(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[h,x]},void 0,!0)},void 0,!1),e[8]=h,e[9]=x,e[10]=y):y=e[10];let b;if(e[11]!==o||e[12]!==r||e[13]!==a||e[14]!==i||e[15]!==c||e[16]!==d){let T;e[18]!==o||e[19]!==r||e[20]!==a||e[21]!==i||e[22]!==c?(T=n(E=>{let k=jr(E.id);return(0,P.jsxDEV)(It,{"data-testid":`${c}-${k}`,children:[a.map(O=>(0,P.jsxDEV)(Ne,{children:O.render(E)},O.head,!1)),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`${r}-${k}`,onClick:n(()=>{i(k)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o},void 0,!1)},void 0,!1)]},k,!0)},"t72"),e[18]=o,e[19]=r,e[20]=a,e[21]=i,e[22]=c,e[23]=T):T=e[23],b=d.map(T),e[11]=o,e[12]=r,e[13]=a,e[14]=i,e[15]=c,e[16]=d,e[17]=b}else b=e[17];let S;e[24]!==b?(S=(0,P.jsxDEV)(To,{children:b},void 0,!1),e[24]=b,e[25]=S):S=e[25];let w;e[26]!==y||e[27]!==S?(w=(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:[y,S]},void 0,!0)},void 0,!1),e[26]=y,e[27]=S,e[28]=w):w=e[28];let C;e[29]!==m||e[30]!==w?(C=(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[m,w]},void 0,!0),e[29]=m,e[30]=w,e[31]=C):C=e[31];let F;return e[32]!==C||e[33]!==f?(F=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":f,children:C},void 0,!1),e[32]=C,e[33]=f,e[34]=F):F=e[34],F},"OrgRowTable"),Nbt=n(()=>{let t=(0,Yt.c)(95),e=Wt(),o=Ve(),{capabilities:r,ready:a}=ZOe(),[s,i]=(0,st.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let d;t[1]!==e?(d=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=d):d=t[2];let f;t[3]!==r.organization?(f={enabled:r.organization},t[3]=r.organization,t[4]=f):f=t[4];let p=mi(c,d,f),m=p.data?.rows??null,h;t[5]!==s?(h=["lunora-auth-org-members",s],t[5]=s,t[6]=h):h=t[6];let v;t[7]!==e||t[8]!==s?(v=n(()=>e.listAuthOrgMembers({limit:200,organizationId:s??""}),"t4"),t[7]=e,t[8]=s,t[9]=v):v=t[9];let x=s!==null,y;t[10]!==x?(y={enabled:x},t[10]=x,t[11]=y):y=t[11];let b=mi(h,v,y),S;t[12]!==s?(S=["lunora-auth-org-invitations",s],t[12]=s,t[13]=S):S=t[13];let w;t[14]!==e||t[15]!==s?(w=n(()=>e.listAuthOrgInvitations({limit:200,organizationId:s??""}),"t8"),t[14]=e,t[15]=s,t[16]=w):w=t[16];let C=s!==null,F;t[17]!==C?(F={enabled:C},t[17]=C,t[18]=F):F=t[18];let T=mi(S,w,F),E=s===null?null:b.data?.rows??null,k=s===null?null:T.data?.rows??null,O=p.error??b.error??T.error,D;t[19]!==T||t[20]!==b||t[21]!==p||t[22]!==s?(D=n(()=>{p.refetch(),s!==null&&(b.refetch(),T.refetch())},"t11"),t[19]=T,t[20]=b,t[21]=p,t[22]=s,t[23]=D):D=t[23],us(D,r.organization);let M;t[24]===Symbol.for("react.memo_cache_sentinel")?(M=n(ye=>{i(ye)},"t12"),t[24]=M):M=t[24];let L=M,U;t[25]!==T||t[26]!==b?(U=n(ye=>{ot((async()=>{await ye(),b.refetch(),T.refetch()})())},"t13"),t[25]=T,t[26]=b,t[27]=U):U=t[27];let W=U,V;t[28]!==e||t[29]!==W?(V=n(ye=>{W(()=>e.removeAuthOrgMember({memberId:ye}))},"t14"),t[28]=e,t[29]=W,t[30]=V):V=t[30];let j=V,N;t[31]!==e||t[32]!==W?(N=n(ye=>{W(()=>e.cancelAuthOrgInvitation({invitationId:ye}))},"t15"),t[31]=e,t[32]=W,t[33]=N):N=t[33];let _=N,B;t[34]!==o?(B=o("userId"),t[34]=o,t[35]=B):B=t[35];let z;t[36]!==B?(z={head:B,render:_bt},t[36]=B,t[37]=z):z=t[37];let q;t[38]!==o?(q=o("role"),t[38]=o,t[39]=q):q=t[39];let $;t[40]!==q?($={head:q,render:Lbt},t[40]=q,t[41]=$):$=t[41];let Y;t[42]!==z||t[43]!==$?(Y=[z,$],t[42]=z,t[43]=$,t[44]=Y):Y=t[44];let Q=Y,X;t[45]!==o?(X=o("email"),t[45]=o,t[46]=X):X=t[46];let te;t[47]!==X?(te={head:X,render:Bbt},t[47]=X,t[48]=te):te=t[48];let ae;t[49]!==o?(ae=o("role"),t[49]=o,t[50]=ae):ae=t[50];let se;t[51]!==ae?(se={head:ae,render:Vbt},t[51]=ae,t[52]=se):se=t[52];let J;t[53]!==o?(J=o("status"),t[53]=o,t[54]=J):J=t[54];let ne;t[55]!==J?(ne={head:J,render:Ubt},t[55]=J,t[56]=ne):ne=t[56];let pe;t[57]!==te||t[58]!==se||t[59]!==ne?(pe=[te,se,ne],t[57]=te,t[58]=se,t[59]=ne,t[60]=pe):pe=t[60];let le=pe;if(a&&!r.organization){let ye;t[61]!==o?(ye=o("Enable the organization() plugin in your auth config to manage organizations here."),t[61]=o,t[62]=ye):ye=t[62];let ge;t[63]!==o?(ge=o("Organizations are not enabled."),t[63]=o,t[64]=ge):ge=t[64];let Te;return t[65]!==ye||t[66]!==ge?(Te=(0,P.jsxDEV)(co,{description:ye,testId:"org-disabled",title:ge},void 0,!1),t[65]=ye,t[66]=ge,t[67]=Te):Te=t[67],Te}let ie;t[68]!==O?(ie=O!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:O},void 0,!1),t[68]=O,t[69]=ie):ie=t[69];let de;t[70]!==m||t[71]!==o?(de=m!==null&&m.length===0&&(0,P.jsxDEV)(co,{testId:"org-empty",title:o("No organizations.")},void 0,!1),t[70]=m,t[71]=o,t[72]=de):de=t[72];let ue;t[73]!==m||t[74]!==s||t[75]!==o?(ue=m!==null&&m.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"org-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:o("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("slug")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:m.map(ye=>{let ge=jr(ye.id);return(0,P.jsxDEV)(It,{"data-testid":`org-row-${ge}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:ge},void 0,!1),(0,P.jsxDEV)(Ne,{children:jr(ye.name)},void 0,!1),(0,P.jsxDEV)(Ne,{children:jr(ye.slug)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(ye.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"aria-pressed":s===ge,"data-testid":`org-select-${ge}`,onClick:n(()=>{L(ge)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Members")},void 0,!1)},void 0,!1)]},ge,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[73]=m,t[74]=s,t[75]=o,t[76]=ue):ue=t[76];let he;t[77]!==Q||t[78]!==E||t[79]!==j||t[80]!==s||t[81]!==o?(he=s!==null&&E!==null&&(0,P.jsxDEV)(kOe,{actionLabel:o("Remove"),actionPrefix:"org-remove-member",columns:Q,heading:o("Members"),onAction:j,rowPrefix:"org-member",rows:E,testId:"org-members"},void 0,!1),t[77]=Q,t[78]=E,t[79]=j,t[80]=s,t[81]=o,t[82]=he):he=t[82];let Re;t[83]!==le||t[84]!==k||t[85]!==_||t[86]!==s||t[87]!==o?(Re=s!==null&&k!==null&&k.length>0&&(0,P.jsxDEV)(kOe,{actionLabel:o("Cancel"),actionPrefix:"org-cancel-invitation",columns:le,heading:o("Invitations"),onAction:_,rowPrefix:"org-invitation",rows:k,testId:"org-invitations"},void 0,!1),t[83]=le,t[84]=k,t[85]=_,t[86]=s,t[87]=o,t[88]=Re):Re=t[88];let Ae;return t[89]!==ie||t[90]!==de||t[91]!==ue||t[92]!==he||t[93]!==Re?(Ae=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[ie,de,ue,he,Re]},void 0,!0),t[89]=ie,t[90]=de,t[91]=ue,t[92]=he,t[93]=Re,t[94]=Ae):Ae=t[94],Ae},"OrganizationsPanel");function Dbt(t){return(0,P.jsxDEV)(Le,{children:t.head},t.head,!1)}n(Dbt,"_temp$6");function _bt(t){return jr(t.userId)}n(_bt,"_temp2$3");function Lbt(t){return jr(t.role)}n(Lbt,"_temp3");function Bbt(t){return jr(t.email)}n(Bbt,"_temp4");function Vbt(t){return jr(t.role)}n(Vbt,"_temp5");function Ubt(t){return jr(t.status)}n(Ubt,"_temp6");var zbt=n(({onClose:t,onCreated:e})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)(""),[i,c]=(0,st.useState)(""),[d,f]=(0,st.useState)(""),[p,m]=(0,st.useState)(""),[h,v]=(0,st.useState)(!1),[x,y]=(0,st.useState)(null),b=n(E=>{s(E.target.value)},"onEmailChange"),S=n(E=>{c(E.target.value)},"onNameChange"),w=n(E=>{f(E.target.value)},"onPasswordChange"),C=n(E=>{m(E.target.value)},"onRoleChange"),F=n(async()=>{v(!0),y(null);try{await o.createAuthUser({email:a.trim(),name:i.trim(),password:d===""?void 0:d,role:p.trim()===""?void 0:p.trim()}),e(),t()}catch(E){y(Jt(E))}finally{v(!1)}},"submit"),T=n(()=>{ot(F())},"onSubmit");return(0,P.jsxDEV)(Px,{label:r("Create user"),onClose:t,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:r("Create user")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-email",children:r("email")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:a},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-name",children:r("name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-name",id:"uc-name",onChange:S,value:i},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-password",children:r("Password (optional)")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-password",id:"uc-password",onChange:w,type:"password",value:d},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"uc-role",children:r("Role (optional)")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"uc-role",id:"uc-role",onChange:C,value:p},void 0,!1)]},void 0,!0),x!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:x},void 0,!1),(0,P.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,P.jsxDEV)(dt,{"data-testid":"uc-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:r("Cancel")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"uc-submit",disabled:h||a.trim()===""||i.trim()==="",onClick:T,size:"sm",type:"button",children:r(h?"Creating\u2026":"Create")},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserCreateDialog"),KZ=n(t=>{let e=(0,Yt.c)(2),{children:o}=t,r;return e[0]!==o?(r=(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=r):r=e[1],r},"SectionHeading"),$bt=n(t=>{let e=(0,Yt.c)(29),{busy:o,runAction:r,userId:a,version:s}=t,i=Wt(),c=Ve(),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(null),h;e[0]!==i||e[1]!==a?(h=n(()=>{ot((async()=>{m(null);try{let E=await i.listAuthSessions({limit:50,userId:a});f(E.rows)}catch(E){let k=E;f(null),m(Jt(k))}})())},"t1"),e[0]=i,e[1]=a,e[2]=h):h=e[2];let v;e[3]!==i||e[4]!==a||e[5]!==s?(v=[i,a,s],e[3]=i,e[4]=a,e[5]=s,e[6]=v):v=e[6],(0,st.useEffect)(h,v);let x;e[7]!==i||e[8]!==r?(x=n(E=>{r(()=>i.revokeAuthSession({sessionId:E}))},"t3"),e[7]=i,e[8]=r,e[9]=x):x=e[9];let y=x,b;e[10]!==c?(b=c("Sessions"),e[10]=c,e[11]=b):b=e[11];let S;e[12]!==b?(S=(0,P.jsxDEV)(KZ,{children:b},void 0,!1),e[12]=b,e[13]=S):S=e[13];let w;e[14]!==p?(w=p!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:p},void 0,!1),e[14]=p,e[15]=w):w=e[15];let C;e[16]!==d||e[17]!==c?(C=d!==null&&d.length===0&&(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:c("No active sessions.")},void 0,!1),e[16]=d,e[17]=c,e[18]=C):C=e[18];let F;e[19]!==o||e[20]!==y||e[21]!==d||e[22]!==c?(F=d!==null&&d.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"ud-sessions-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("expires")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("ip")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("user agent")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:d.map(E=>(0,P.jsxDEV)(It,{"data-testid":`ud-session-${E.id}`,children:[(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(E.expiresAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:E.ipAddress??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-40 truncate",children:E.userAgent??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`ud-revoke-${E.id}`,disabled:o,onClick:n(()=>{y(E.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:c("Revoke")},void 0,!1)},void 0,!1)]},E.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=o,e[20]=y,e[21]=d,e[22]=c,e[23]=F):F=e[23];let T;return e[24]!==S||e[25]!==w||e[26]!==C||e[27]!==F?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[S,w,C,F]},void 0,!0),e[24]=S,e[25]=w,e[26]=C,e[27]=F,e[28]=T):T=e[28],T},"UserSessionsPanel"),Hbt=n(t=>{let e=(0,Yt.c)(30),{busy:o,runAction:r,userId:a,version:s}=t,i=Wt(),c=Ve(),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(null),h;e[0]!==i||e[1]!==a?(h=n(()=>{ot((async()=>{m(null);try{f(await i.listAuthAccounts({userId:a}))}catch(E){let k=E;f(null),m(Jt(k))}})())},"t1"),e[0]=i,e[1]=a,e[2]=h):h=e[2];let v;e[3]!==i||e[4]!==a||e[5]!==s?(v=[i,a,s],e[3]=i,e[4]=a,e[5]=s,e[6]=v):v=e[6],(0,st.useEffect)(h,v);let x;e[7]!==i||e[8]!==r||e[9]!==a?(x=n(E=>{r(()=>i.unlinkAuthAccount({accountId:E,userId:a}))},"t3"),e[7]=i,e[8]=r,e[9]=a,e[10]=x):x=e[10];let y=x,b;e[11]!==c?(b=c("Linked accounts"),e[11]=c,e[12]=b):b=e[12];let S;e[13]!==b?(S=(0,P.jsxDEV)(KZ,{children:b},void 0,!1),e[13]=b,e[14]=S):S=e[14];let w;e[15]!==p?(w=p!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:p},void 0,!1),e[15]=p,e[16]=w):w=e[16];let C;e[17]!==d||e[18]!==c?(C=d!==null&&d.length===0&&(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:c("No linked accounts.")},void 0,!1),e[17]=d,e[18]=c,e[19]=C):C=e[19];let F;e[20]!==d||e[21]!==o||e[22]!==y||e[23]!==c?(F=d!==null&&d.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"ud-accounts-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("provider")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:d.map(E=>{let k=jr(E.id);return(0,P.jsxDEV)(It,{"data-testid":`ud-account-${k}`,children:[(0,P.jsxDEV)(Ne,{children:jr(E.providerId)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(E.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`ud-unlink-${k}`,disabled:o,onClick:n(()=>{y(k)},"onClick"),size:"xs",type:"button",variant:"ghost",children:c("Unlink")},void 0,!1)},void 0,!1)]},k,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=d,e[21]=o,e[22]=y,e[23]=c,e[24]=F):F=e[24];let T;return e[25]!==S||e[26]!==w||e[27]!==C||e[28]!==F?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[S,w,C,F]},void 0,!0),e[25]=S,e[26]=w,e[27]=C,e[28]=F,e[29]=T):T=e[29],T},"UserAccountsPanel"),jbt=n(t=>{let e=(0,Yt.c)(40),{busy:o,capabilities:r,runAction:a,userId:s,version:i}=t,c=Wt(),d=Ve(),[f,p]=(0,st.useState)(null),m;e[0]!==r.passkey||e[1]!==c||e[2]!==s?(m=n(()=>{r.passkey&&ot((async()=>{try{p(await c.listAuthPasskeys({userId:s}))}catch{p(null)}})())},"t1"),e[0]=r.passkey,e[1]=c,e[2]=s,e[3]=m):m=e[3];let h;e[4]!==r.passkey||e[5]!==c||e[6]!==s||e[7]!==i?(h=[r.passkey,c,s,i],e[4]=r.passkey,e[5]=c,e[6]=s,e[7]=i,e[8]=h):h=e[8],(0,st.useEffect)(m,h);let v;e[9]!==c||e[10]!==a||e[11]!==s?(v=n(()=>{a(()=>c.disableAuthTwoFactor({userId:s}))},"t3"),e[9]=c,e[10]=a,e[11]=s,e[12]=v):v=e[12];let x=v,y;e[13]!==c||e[14]!==a?(y=n(k=>{a(()=>c.deleteAuthPasskey({passkeyId:k}))},"t4"),e[13]=c,e[14]=a,e[15]=y):y=e[15];let b=y,S;e[16]!==d?(S=d("Security"),e[16]=d,e[17]=S):S=e[17];let w;e[18]!==S?(w=(0,P.jsxDEV)(KZ,{children:S},void 0,!1),e[18]=S,e[19]=w):w=e[19];let C;e[20]!==o||e[21]!==r.twoFactor||e[22]!==x||e[23]!==d?(C=r.twoFactor&&(0,P.jsxDEV)(dt,{"data-testid":"ud-disable-2fa",disabled:o,onClick:x,size:"sm",type:"button",variant:"outline",children:d("Disable two-factor")},void 0,!1),e[20]=o,e[21]=r.twoFactor,e[22]=x,e[23]=d,e[24]=C):C=e[24];let F;e[25]!==r.passkey||e[26]!==f||e[27]!==d?(F=r.passkey&&f!==null&&f.length===0&&(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d("No passkeys.")},void 0,!1),e[25]=r.passkey,e[26]=f,e[27]=d,e[28]=F):F=e[28];let T;e[29]!==o||e[30]!==r.passkey||e[31]!==b||e[32]!==f||e[33]!==d?(T=r.passkey&&f!==null&&f.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"ud-passkeys-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:d("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:d("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":d("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:f.map(k=>{let O=jr(k.id);return(0,P.jsxDEV)(It,{"data-testid":`ud-passkey-${O}`,children:[(0,P.jsxDEV)(Ne,{children:jr(k.name)||O},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(k.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`ud-delete-passkey-${O}`,disabled:o,onClick:n(()=>{b(O)},"onClick"),size:"xs",type:"button",variant:"ghost",children:d("Delete")},void 0,!1)},void 0,!1)]},O,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=o,e[30]=r.passkey,e[31]=b,e[32]=f,e[33]=d,e[34]=T):T=e[34];let E;return e[35]!==w||e[36]!==C||e[37]!==F||e[38]!==T?(E=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[w,C,F,T]},void 0,!0),e[35]=w,e[36]=C,e[37]=F,e[38]=T,e[39]=E):E=e[39],E},"UserSecurityPanel"),qbt=/(?:at|expires)$/iu,Wbt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),Gbt=n((t,e)=>typeof e=="number"&&qbt.test(t)?pn(e):jr(e),"formatField"),Kbt=n(({capabilities:t,onChanged:e,onClose:o,user:r})=>{let a=Wt(),s=Ve(),i=r.banned===!0,[c,d]=(0,st.useState)(null),[f,p]=(0,st.useState)(!1),[m,h]=(0,st.useState)(0),[v,x]=(0,st.useState)(typeof r.role=="string"?r.role:""),[y,b]=(0,st.useState)(""),[S,w]=(0,st.useState)(""),[C,F]=(0,st.useState)(""),[T,E]=(0,st.useState)(null),[k,O]=(0,st.useState)(!1),D=n((X,te)=>{ot((async()=>{p(!0),d(null);try{let ae=await X();te?.refresh!==!1&&(h(se=>se+1),e()),te?.onResult?.(ae)}catch(ae){d(Jt(ae))}finally{p(!1)}})())},"runAction"),M=n(X=>{x(X.target.value)},"onRoleInputChange"),L=n(X=>{b(X.target.value)},"onBanReasonChange"),U=n(X=>{w(X.target.value)},"onBanDaysChange"),W=n(X=>{F(X.target.value)},"onNewPasswordChange"),V=n(()=>{let X=v.trim();X!==""&&D(async()=>{await a.setAuthUserRole({role:X,userId:r.id})})},"onSetRole"),j=n(()=>{let X=Number.parseInt(S,10),te=Number.isFinite(X)&&X>0?X*86400:void 0;D(async()=>{await a.banAuthUser({expiresInSeconds:te,reason:y.trim()===""?void 0:y.trim(),userId:r.id})})},"onBan"),N=n(()=>{D(async()=>{await a.unbanAuthUser({userId:r.id})})},"onUnban"),_=n(()=>{D(async()=>{await a.setAuthUserPassword({newPassword:C,userId:r.id}),F("")})},"onSetPassword"),B=n(()=>{D(()=>a.impersonateAuthUser({userId:r.id}),{onResult:n(X=>{E(X.token)},"onResult"),refresh:!1})},"onImpersonate"),z=n(()=>{D(async()=>{await a.revokeAuthUserSessions({userId:r.id})})},"onRevokeAll"),q=n(()=>{D(async()=>{await a.removeAuthUser({userId:r.id}),o()})},"onDelete"),$=n(()=>{O(!0)},"onConfirmDelete"),Y=n(()=>{O(!1)},"onCancelDelete"),Q=Object.entries(r).filter(([X])=>!Wbt.has(X));return(0,P.jsxDEV)(Px,{label:s("User details"),onClose:o,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,P.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:r.name??r.email??r.id},void 0,!1),(0,P.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:r.id},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof r.role=="string"&&r.role!==""&&(0,P.jsxDEV)(Pt,{variant:"secondary",children:r.role},void 0,!1),i?(0,P.jsxDEV)(Pt,{variant:"destructive",children:s("Banned")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"outline",children:s("Active")},void 0,!1),r.emailVerified===!0?(0,P.jsxDEV)(Pt,{variant:"secondary",children:s("verified")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"outline",children:s("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-close",onClick:o,size:"sm",type:"button",variant:"ghost",children:s("Close")},void 0,!1)]},void 0,!0),c!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:c},void 0,!1),t.admin&&(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-3 p-3",children:[(0,P.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-role",children:s("Role")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-role-input",id:"ud-role",onChange:M,value:v},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-set-role",disabled:f||v.trim()==="",onClick:V,size:"sm",type:"button",variant:"outline",children:s("Set role")},void 0,!1)]},void 0,!0),i?(0,P.jsxDEV)(dt,{"data-testid":"ud-unban",disabled:f,onClick:N,size:"sm",type:"button",variant:"outline",children:s("Unban")},void 0,!1):(0,P.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-ban-reason",children:s("Ban reason (optional)")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:L,value:y},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-ban-days",children:s("Days")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:U,type:"number",value:S},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-ban",disabled:f,onClick:j,size:"sm",type:"button",variant:"destructive",children:s("Ban user")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,P.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-password",children:s("New password")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-password",id:"ud-password",onChange:W,type:"password",value:C},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"ud-set-password",disabled:f||C==="",onClick:_,size:"sm",type:"button",variant:"outline",children:s("Set password")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"ud-impersonate",disabled:f,onClick:B,size:"sm",type:"button",variant:"outline",children:s("Impersonate")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"ud-revoke-all",disabled:f,onClick:z,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")},void 0,!1),k?(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)(dt,{"data-testid":"ud-delete-confirm",disabled:f,onClick:q,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"ud-delete-cancel",onClick:Y,size:"sm",type:"button",variant:"ghost",children:s("Cancel")},void 0,!1)]},void 0,!0):(0,P.jsxDEV)(dt,{"data-testid":"ud-delete",disabled:f,onClick:$,size:"sm",type:"button",variant:"destructive",children:s("Delete user")},void 0,!1)]},void 0,!0),T!==null&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,P.jsxDEV)(Go,{htmlFor:"ud-token",children:s("Impersonation token")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:T},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)($bt,{busy:f,runAction:D,userId:r.id,version:m},void 0,!1),t.accounts&&(0,P.jsxDEV)(Hbt,{busy:f,runAction:D,userId:r.id,version:m},void 0,!1),(t.twoFactor||t.passkey)&&(0,P.jsxDEV)(jbt,{busy:f,capabilities:t,runAction:D,userId:r.id,version:m},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")},void 0,!1),(0,P.jsxDEV)("dl",{className:"flex flex-col",children:Q.map(([X,te])=>(0,P.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,P.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:X},void 0,!1),(0,P.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:Gbt(X,te)},void 0,!1)]},X,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),Ybt=50,Xbt=n(({pageSize:t=Ybt}={})=>{let e=Wt(),o=Ve(),[r,a]=(0,st.useState)(""),[s,i]=(0,st.useState)(""),c=na(r),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(!1),{capabilities:h}=ZOe(),v=c.trim(),x=s.trim(),y=mi(["lunora-auth-users",v,x,t],()=>e.listAuthUsers({filterField:x===""?void 0:"role",filterValue:x===""?void 0:x,limit:t,search:v===""?void 0:v}),{keepPreviousData:!0}),b=y.data?.rows??null,S=y.error,w=n(()=>{y.refetch()},"reloadUsers");us(()=>{y.refetch()},!0);let C=d===null?null:b?.find(F=>F.id===d)??null;return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{"aria-label":o("Search users"),className:"w-56","data-testid":"us-search",onChange:n(F=>{a(F.target.value)},"onChange"),placeholder:o("Search by email or name\u2026"),value:r},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":o("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:n(F=>{i(F.target.value)},"onChange"),placeholder:o("Filter by role"),value:s},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"us-new",onClick:n(()=>{m(!0)},"onClick"),size:"sm",type:"button",children:o("New user")},void 0,!1)]},void 0,!0),S!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:S},void 0,!1),b!==null&&b.length===0&&(0,P.jsxDEV)(co,{description:o("Users who sign up to your app will appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:o("No users.")},void 0,!1),b!==null&&b.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"us-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:o("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("email")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("role")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("status")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("verified")},void 0,!1),(0,P.jsxDEV)(Le,{children:o("created")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:b.map(F=>(0,P.jsxDEV)(It,{"data-testid":`us-row-${F.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:F.id},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.email??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.name??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:typeof F.role=="string"&&F.role!==""?(0,P.jsxDEV)(Pt,{variant:"secondary",children:F.role},void 0,!1):""},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.banned===!0?(0,P.jsxDEV)(Pt,{variant:"destructive",children:o("Banned")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"success",children:o("Active")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{children:F.emailVerified===!0?(0,P.jsxDEV)(Pt,{variant:"success",children:o("yes")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"outline",children:o("no")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:pn(F.createdAt)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-testid":`us-manage-${F.id}`,onClick:n(()=>{f(F.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Manage")},void 0,!1)},void 0,!1)]},F.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),C!==null&&(0,P.jsxDEV)(Kbt,{capabilities:h,onChanged:w,onClose:n(()=>{f(null)},"onClose"),user:C},void 0,!1),p&&(0,P.jsxDEV)(zbt,{onClose:n(()=>{m(!1)},"onClose"),onCreated:w},void 0,!1)]},void 0,!0)},"UsersPanel"),Qbt=n(t=>{let e=t.trim();if(e.length===0)return{context:void 0,error:null};try{let o=JSON.parse(e);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),Zbt='{ "targetingKey": "user-123", "plan": "premium" }',Jbt=n(t=>t.type==="object"?JSON.stringify(t.value):String(t.value),"formatValue$1"),e1t=n(({initialShardKey:t=""})=>{let e=Ve(),[o,r]=(0,st.useState)(""),{context:a,error:s}=Qbt(o),i=(0,st.useMemo)(()=>a===void 0?{}:{context:a},[a]),{data:c,error:d,liveError:f}=_o(vt.listFlags,i,{live:!0,shardKey:t}),p=c!==void 0,m=c?.configured??!1,h=(0,st.useMemo)(()=>Array.isArray(c?.flags)?[...c.flags].toSorted((x,y)=>x.key.localeCompare(y.key)):[],[c]),v;return p&&!m?v=(0,P.jsxDEV)(co,{description:e("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:e("No flags provider configured")},void 0,!1):p&&h.length===0?v=(0,P.jsxDEV)(co,{description:e('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:e("No flags read")},void 0,!1):v=(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"flags-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Key")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Type")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Value")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Reason")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:h.map(x=>(0,P.jsxDEV)(It,{"data-testid":`flags-row-${x.key}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:x.key},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:x.type},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:Jbt(x)},void 0,!1),(0,P.jsxDEV)(Ne,{children:x.errorCode===void 0?(0,P.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:x.reason??"\u2014"},void 0,!1):(0,P.jsxDEV)(Pt,{"data-testid":`flags-error-${x.key}`,variant:"destructive",children:x.errorCode},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:x.variant??"\u2014"},void 0,!1)]},x.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"flags-error",role:"alert",children:d},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:e('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,P.jsxDEV)(Go,{htmlFor:"flags-targeting-context",children:e("Targeting context (JSON)")},void 0,!1),(0,P.jsxDEV)(Ff,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:n(x=>{r(x.target.value)},"onChange"),placeholder:Zbt,rows:3,value:o},void 0,!1),s!==null&&(0,P.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:e(s)},void 0,!1),f!==void 0&&(0,P.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:e("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),v]},void 0,!0)},"FlagsPanel"),t1t=n(t=>{let e=(0,Yt.c)(23),{destination:o}=t,r=Ve(),a;e[0]!==o.snippet?(a=n(()=>{em(o.snippet)},"t1"),e[0]=o.snippet,e[1]=a):a=e[1];let s=a,i;e[2]!==o.title?(i=(0,P.jsxDEV)("h4",{className:"text-sm font-semibold",children:o.title},void 0,!1),e[2]=o.title,e[3]=i):i=e[3];let c;e[4]!==o.description?(c=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[4]=o.description,e[5]=c):c=e[5];let d;e[6]!==i||e[7]!==c?(d=(0,P.jsxDEV)("div",{children:[i,c]},void 0,!0),e[6]=i,e[7]=c,e[8]=d):d=e[8];let f=`drain-copy-${o.id}`,p;e[9]!==r?(p=r("Copy"),e[9]=r,e[10]=p):p=e[10];let m;e[11]!==s||e[12]!==f||e[13]!==p?(m=(0,P.jsxDEV)(dt,{"data-testid":f,onClick:s,size:"sm",variant:"outline",children:p},void 0,!1),e[11]=s,e[12]=f,e[13]=p,e[14]=m):m=e[14];let h;e[15]!==d||e[16]!==m?(h=(0,P.jsxDEV)("div",{className:"flex items-start justify-between gap-3",children:[d,m]},void 0,!0),e[15]=d,e[16]=m,e[17]=h):h=e[17];let v;e[18]!==o.snippet?(v=(0,P.jsxDEV)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:o.snippet},void 0,!1),e[18]=o.snippet,e[19]=v):v=e[19];let x;return e[20]!==h||e[21]!==v?(x=(0,P.jsxDEV)(Rt,{className:"py-0","data-testid":"drain-card",children:(0,P.jsxDEV)(Xt,{className:"p-3",children:[h,v]},void 0,!0)},void 0,!1),e[20]=h,e[21]=v,e[22]=x):x=e[22],x},"DestinationRow"),o1t=n(()=>{let t=Ve(),e=[{description:t("Stream every request log to R2, a SIEM, or a third-party log service."),id:"logpush",snippet:["{",' "logpush": true',"}"].join(`
376
376
  `),title:t("Logpush")},{description:t("Send logs programmatically to a Worker for custom capture and forwarding."),id:"tail-worker",snippet:["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"].join(`
377
377
  `),title:t("Tail Workers")},{description:t("Retain and query recent request logs directly in Cloudflare's dashboard."),id:"workers-logs",snippet:["{",' "observability": { "enabled": true }',"}"].join(`
378
- `),title:t("Workers Logs")}],[o,r]=(0,st.useState)(""),[a,s]=(0,st.useState)(!1),[i,c]=(0,st.useState)(null),d=n(async()=>{let m=o.trim();if(m==="")return;let h="fetch"in globalThis?globalThis.fetch:void 0;if(h===void 0){c({kind:"error",message:t("fetch is unavailable in this environment.")});return}let v={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};s(!0),c(null);let x=performance.now();try{let y=await h(m,{body:JSON.stringify(v),headers:{"Content-Type":"application/json"},method:"POST"});c({kind:"success",latencyMs:Math.round(performance.now()-x),status:y.status})}catch(y){c({kind:"error",message:Jt(y)})}finally{s(!1)}},"sendTest"),f=n(()=>{ot(d())},"onSendTest"),p=n(m=>{r(m.target.value)},"onWebhookUrlChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,P.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:$_,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Cloudflare destinations")},void 0,!1),e.map(m=>(0,P.jsxDEV)(t1t,{destination:m},m.id,!1))]},void 0,!0),(0,P.jsxDEV)(Rt,{className:"py-0",children:(0,P.jsxDEV)(Xt,{className:"p-3",children:(0,P.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,P.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Webhook test")},void 0,!1),(0,P.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:p,placeholder:t("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"drain-webhook-test",disabled:a||o.trim()==="",onClick:f,children:t(a?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),i!==null&&(0,P.jsxDEV)("p",{className:i.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:i.kind==="error"?"alert":void 0,children:i.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:i.latencyMs,status:i.status}):t("Failed: {message}",{message:i.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel"),r1t={kind:"idle"},n1t=n(({loadCronJobs:t,runCronJob:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)({}),i=mi(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>o.getCronJobs()))()),{data:c,error:d}=i,f=(0,st.useMemo)(()=>e!==void 0?e:t===void 0?m=>o.runCronJob(m):void 0,[o,t,e]),p=n(async m=>{if(f!==void 0){s(h=>({...h,[m]:{kind:"running"}}));try{await f(m),s(h=>({...h,[m]:{kind:"ok"}})),i.refetch()}catch(h){s(v=>({...v,[m]:{kind:"error",message:Jt(h)}}))}}},"run");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:d},void 0,!1),c?.length===0&&(0,P.jsxDEV)(co,{description:r("Triggers declared with the cronJobs() builder appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"12",cy:"12",r:"9"},void 0,!1),(0,P.jsxDEV)("path",{d:"M12 7.5V12l4 2"},void 0,!1)]},void 0,!0),testId:"cron-empty",title:r("No cron triggers.")},void 0,!1),c!==void 0&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"cron-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("schedule")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("target")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("shard")},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Le,{"aria-label":r("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>{let h=a[m.name]??r1t;return(0,P.jsxDEV)(It,{"data-testid":`cron-row-${m.name}`,children:[(0,P.jsxDEV)(Ne,{children:m.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs tabular-nums",children:m.cron},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)("span",{className:"flex items-center gap-2",children:[m.workflow===void 0?(0,P.jsxDEV)(Pt,{variant:"outline",children:r("function")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("workflow")},void 0,!1),(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:m.workflow??m.functionPath},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{children:m.shardKey??""},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("span",{className:"flex items-center justify-end gap-2",children:[h.kind==="ok"&&(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${m.name}`,children:r("ran")},void 0,!1),h.kind==="error"&&(0,P.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${m.name}`,role:"alert",children:h.message},void 0,!1),(0,P.jsxDEV)(pa,{confirmLabel:r("Run now?"),disabled:h.kind==="running",onConfirm:n(()=>{ot(p(m.name))},"onConfirm"),testId:`cron-run-${m.name}`,children:h.kind==="running"?r("Running\u2026"):r("Run now")},void 0,!1)]},void 0,!0)},void 0,!1)]},`${m.cron}:${m.name}`,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"CronTriggersPanel"),a1t=n(t=>Number.isFinite(t)?pn(t,"\u2014"):"\u2014","formatScheduledFor"),s1t=n(t=>{let e=(0,Yt.c)(34),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadJobs:r,removeJob:a,retryJob:s}=o,i=Wt(),c=Ve(),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-dead-jobs"],e[2]=d):d=e[2];let f;e[3]!==i||e[4]!==r?(f=n(async()=>(await(r??(()=>i.listDeadJobs()))()).toSorted(i1t),"t3"),e[3]=i,e[4]=r,e[5]=f):f=e[5];let p=mi(d,f),m=p.data,[h,v]=(0,st.useState)(void 0),x=p.error??h,y=r===void 0,b;e[6]!==i||e[7]!==y||e[8]!==s?(b=s??(y?U=>i.retryDeadJob(U):void 0),e[6]=i,e[7]=y,e[8]=s,e[9]=b):b=e[9];let S=b,w;e[10]!==i||e[11]!==y||e[12]!==a?(w=a??(y?U=>i.removeDeadJob(U):void 0),e[10]=i,e[11]=y,e[12]=a,e[13]=w):w=e[13];let C=w,F;e[14]!==p?(F=n(()=>{p.refetch()},"t6"),e[14]=p,e[15]=F):F=e[15],us(F,!0);let T;e[16]!==p?(T=n(async U=>{v(void 0);try{await U,p.refetch()}catch(W){v(Jt(W))}},"t7"),e[16]=p,e[17]=T):T=e[17];let E=T,k=S!==void 0||C!==void 0,O;e[18]!==x?(O=x!==void 0&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:x},void 0,!1),e[18]=x,e[19]=O):O=e[19];let D;e[20]!==m?.length||e[21]!==c?(D=m?.length===0&&(0,P.jsxDEV)(co,{description:c("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"},void 0,!1)},void 0,!1),testId:"dlq-empty",title:c("No dead-letter jobs.")},void 0,!1),e[20]=m?.length,e[21]=c,e[22]=D):D=e[22];let M;e[23]!==E||e[24]!==k||e[25]!==m||e[26]!==C||e[27]!==S||e[28]!==c?(M=m!==void 0&&m.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"dlq-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("function")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("last tried")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("shard")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("id")},void 0,!1),k&&(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:m.map(U=>(0,P.jsxDEV)(It,{"data-testid":`dlq-row-${U.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.functionPath},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:U.attempts??0},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:a1t(U.scheduledFor)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.pool??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:U.shardKey??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.id},void 0,!1),k&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[S!==void 0&&(0,P.jsxDEV)(dt,{"data-testid":`dlq-retry-${U.id}`,onClick:n(()=>{ot(E(S(U.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:c("Retry")},void 0,!1),C!==void 0&&(0,P.jsxDEV)(pa,{confirmLabel:c("Drop job?"),onConfirm:n(()=>{ot(E(C(U.id)))},"onConfirm"),testId:`dlq-remove-${U.id}`,children:c("Drop")},void 0,!1)]},void 0,!0)},void 0,!1)]},U.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[23]=E,e[24]=k,e[25]=m,e[26]=C,e[27]=S,e[28]=c,e[29]=M):M=e[29];let L;return e[30]!==M||e[31]!==O||e[32]!==D?(L=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[O,D,M]},void 0,!0),e[30]=M,e[31]=O,e[32]=D,e[33]=L):L=e[33],L},"DeadLetterJobs");function i1t(t,e){return(e.attempts??0)-(t.attempts??0)}n(i1t,"_temp$5");var HZ=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"flex-1 py-0",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-1 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatTile"),l1t=n(t=>{let e=(0,Yt.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadStatus:r}=o,a=Wt(),s=Ve(),i=r===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let d;e[4]!==a||e[5]!==r?(d=n(async()=>{let w=await(r??(()=>a.schedulerStatus()))();return{...w,pools:w.pools.toSorted(c1t)}},"t4"),e[4]=a,e[5]=r,e[6]=d):d=e[6];let f=mi(c,d),{data:p,error:m}=f,h;e[7]!==f?(h=n(()=>{f.refetch()},"t5"),e[7]=f,e[8]=h):h=e[8],us(h,!0);let v;e[9]!==m?(v=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m},void 0,!1),e[9]=m,e[10]=v):v=e[10];let x;e[11]!==p||e[12]!==s?(x=p!==void 0&&(0,P.jsxDEV)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,P.jsxDEV)(HZ,{label:s("backlog"),testId:"pools-backlog",value:p.backlog},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("in flight"),testId:"pools-inflight",value:p.inFlight},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("pools"),testId:"pools-count",value:p.pools.length},void 0,!1)]},void 0,!0),e[11]=p,e[12]=s,e[13]=x):x=e[13];let y;e[14]!==p?.pools.length||e[15]!==s?(y=p?.pools.length===0&&(0,P.jsxDEV)(co,{description:s("Pools created with createWorkpool appear here once they have activity."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7h16M4 12h16M4 17h16"},void 0,!1)},void 0,!1),testId:"pools-empty",title:s("No workpools.")},void 0,!1),e[14]=p?.pools.length,e[15]=s,e[16]=y):y=e[16];let b;e[17]!==p||e[18]!==s?(b=p!==void 0&&p.pools.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"pools-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:s("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("queued")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("in flight")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("max concurrency")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.pools.map(u1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[17]=p,e[18]=s,e[19]=b):b=e[19];let S;return e[20]!==v||e[21]!==x||e[22]!==y||e[23]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,x,y,b]},void 0,!0),e[20]=v,e[21]=x,e[22]=y,e[23]=b,e[24]=S):S=e[24],S},"SchedulerPoolsPanel");function c1t(t,e){return e.queued-t.queued}n(c1t,"_temp$4");function u1t(t){return(0,P.jsxDEV)(It,{"data-testid":`pools-row-${t.name}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.queued},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]},void 0,!0),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.maxConcurrency},void 0,!1)]},t.name,!0)}n(u1t,"_temp2$2");var d1t=["jobs","dead","pools","cron"],f1t=n(t=>{let e=(0,Yt.c)(41),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadCronJobs:r,scheduledCancel:a,scheduledLoad:s}=o,i=Ve(),[c,d]=(0,st.useState)("jobs"),f;e[2]!==i?(f=i("Cron triggers"),e[2]=i,e[3]=f):f=e[3];let p;e[4]!==i?(p=i("Dead letter"),e[4]=i,e[5]=p):p=e[5];let m;e[6]!==i?(m=i("Scheduled jobs"),e[6]=i,e[7]=m):m=e[7];let h;e[8]!==i?(h=i("Pools"),e[8]=i,e[9]=h):h=e[9];let v;e[10]!==f||e[11]!==p||e[12]!==m||e[13]!==h?(v={cron:f,dead:p,jobs:m,pools:h},e[10]=f,e[11]=p,e[12]=m,e[13]=h,e[14]=v):v=e[14];let x=v,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n(D=>{d(D.currentTarget.dataset.view)},"t7"),e[15]=y):y=e[15];let b=y,S;e[16]!==i?(S=i("Schedule view"),e[16]=i,e[17]=S):S=e[17];let w;e[18]!==c||e[19]!==x?(w=d1t.map(D=>(0,P.jsxDEV)(dt,{"aria-selected":c===D,"data-testid":`schedule-view-${D}`,"data-view":D,onClick:b,role:"tab",size:"sm",type:"button",variant:c===D?"default":"outline",children:x[D]},D,!1)),e[18]=c,e[19]=x,e[20]=w):w=e[20];let C;e[21]!==S||e[22]!==w?(C=(0,P.jsxDEV)("div",{"aria-label":S,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:w},void 0,!1),e[21]=S,e[22]=w,e[23]=C):C=e[23];let F;e[24]!==a||e[25]!==s||e[26]!==c?(F=c==="jobs"&&(0,P.jsxDEV)(eTe,{cancelJob:a,loadJobs:s},void 0,!1),e[24]=a,e[25]=s,e[26]=c,e[27]=F):F=e[27];let T;e[28]!==c?(T=c==="dead"&&(0,P.jsxDEV)(s1t,{},void 0,!1),e[28]=c,e[29]=T):T=e[29];let E;e[30]!==c?(E=c==="pools"&&(0,P.jsxDEV)(l1t,{},void 0,!1),e[30]=c,e[31]=E):E=e[31];let k;e[32]!==r||e[33]!==c?(k=c==="cron"&&(0,P.jsxDEV)(n1t,{loadCronJobs:r},void 0,!1),e[32]=r,e[33]=c,e[34]=k):k=e[34];let O;return e[35]!==C||e[36]!==F||e[37]!==T||e[38]!==E||e[39]!==k?(O=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[C,F,T,E,k]},void 0,!0),e[35]=C,e[36]=F,e[37]=T,e[38]=E,e[39]=k,e[40]=O):O=e[40],O},"SchedulePanel"),MOe=80,p1t=n(t=>{if(t===void 0)return"";let e=JSON.stringify(t);return e.length>MOe?`${e.slice(0,MOe)}\u2026`:e},"formatArguments"),m1t=n(t=>{let e=[];for(let o of t){let r=o.id.toString();if(o.subscriptions.length===0){e.push({admin:o.admin,connectionId:o.id,key:`c${r}`,subscription:null});continue}o.subscriptions.forEach((a,s)=>{e.push({admin:o.admin,connectionId:o.id,key:`c${r}-s${s.toString()}`,subscription:a})})}return e},"toRows"),jZ=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),h1t=n(t=>{let e=(0,Yt.c)(20),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.listSubscriptions,d,f);us(h,!0);let v;if(e[5]!==m||e[6]!==p||e[7]!==a||e[8]!==r){let x=p===void 0?[]:m1t(p.connections),y;e[10]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"subs-shard-input",value:a},void 0,!1),e[10]=a,e[11]=y):y=e[11];let b;e[12]!==p||e[13]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} subscriptions",{count:p.totalSubscriptions})},void 0,!1)]},void 0,!0),e[12]=p,e[13]=r,e[14]=b):b=e[14];let S;e[15]!==y||e[16]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[15]=y,e[16]=b,e[17]=S):S=e[17];let w;e[18]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"subs-error",role:"alert",children:m},void 0,!1),e[18]=m,e[19]=w):w=e[19],v=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[S,w,m===null&&p!==void 0&&x.length===0&&(0,P.jsxDEV)(co,{description:r("Active WebSocket subscriptions on this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:r("No active subscriptions.")},void 0,!1),m===null&&x.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"subs-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Connection")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Function path")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(C=>{let{subscription:F}=C,T=p1t(F?.args);return(0,P.jsxDEV)(It,{"data-testid":"subs-row",children:[(0,P.jsxDEV)(Ne,{className:"font-medium tabular-nums",children:(0,P.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",C.connectionId,C.admin&&(0,P.jsxDEV)(Pt,{variant:"outline",children:r("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:F?.functionPath??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{children:F?.table??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:T||void 0,children:T||jZ},void 0,!1)]},C.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=m,e[6]=p,e[7]=a,e[8]=r,e[9]=v}else v=e[9];return v},"SubscriptionsPanel"),JOe=new Set(["active","trialing"]),g1t=new Set(["past_due","unpaid"]),Nl=n((t,e)=>{if(t[e]!==void 0)return t[e];let o=t.__doc__;if(typeof o=="string")try{let r=JSON.parse(o);if(r!==null&&typeof r=="object"&&!Array.isArray(r))return r[e]}catch{}},"readField"),Xf=n(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),v1t=n(t=>JOe.has(t)?"default":g1t.has(t)?"destructive":"outline","badgeVariant"),x1t=n(({limit:t=100})=>{let e=Ve(),o=_o(vt.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),r=_o(vt.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});us(()=>{o.refetch(),r.refetch()},!0);let a=o.data?.rows??[],s=r.data?.rows??[],i=o.error??r.error,c=a.filter(f=>JOe.has(Xf(Nl(f,"state")))).length,d=s.toSorted((f,p)=>Number(Nl(p,"processedAt")??0)-Number(Nl(f,"processedAt")??0));return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,P.jsxDEV)(Rt,{className:"justify-between gap-0 py-0",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Subscriptions")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:c},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"default",children:e("{count} active",{count:c})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:e("{total} total",{total:a.length})},void 0,!1)]},void 0,!0)},void 0,!1),i===null?void 0:(0,P.jsxDEV)("p",{className:"text-sm text-destructive",children:i},void 0,!1),a.length===0&&!o.isLoading?(0,P.jsxDEV)(co,{testId:"payments-empty",title:e("No subscriptions yet")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Provider")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Reference")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Plan")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("State")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(f=>{let p=Xf(Nl(f,"state"));return(0,P.jsxDEV)(It,{"data-testid":"payment-subscription-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"referenceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"priceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:v1t(p),children:p},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"currentPeriodEnd"))},void 0,!1)]},Xf(Nl(f,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Recent webhook events")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:(0,P.jsxDEV)(To,{children:d.map(f=>(0,P.jsxDEV)(It,{"data-testid":"payment-event-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-medium",children:Xf(Nl(f,"type"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground",children:Xf(Nl(f,"providerEventId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"processedAt"))},void 0,!1)]},Xf(Nl(f,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel"),POe=["read","insert","update","delete"],y1t=n((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"operationLabel$1"),I1t=n(t=>{let e=new Set;for(let o of t?.advisories??[])if(o.name==="rls_uncovered_table"){let{table:r}=o.metadata;typeof r=="string"&&r!==""&&e.add(r)}return e},"uncoveredTables"),b1t=n((t,e,o)=>{let r=new Map,a=n(s=>{let i=r.get(s);if(i!==void 0)return i;let c={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:s,uncovered:o.has(s)};return r.set(s,c),c},"ensure");for(let s of t)a(s.table).cells[s.on]={procedure:s.procedure};for(let s of e){let i=a(s.table);i.maskedColumns.includes(s.column)||i.maskedColumns.push(s.column)}for(let s of o)a(s);return[...r.values()].toSorted((s,i)=>s.table.localeCompare(i.table))},"buildRows"),S1t=n(t=>{let e=(0,Yt.c)(16),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{onProbe:r}=o,a=Ve(),s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(s={},i={live:!0},e[2]=s,e[3]=i):(s=e[2],i=e[3]);let c=_o(vt.rlsPolicies,s,i),d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={},e[4]=d):d=e[4];let f=_o(vt.maskPolicies,d),p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p={},e[5]=p):p=e[5];let m=_o(vt.getAdvisories,p),h;if(e[6]!==m.data||e[7]!==f.data||e[8]!==r||e[9]!==c||e[10]!==a){let v=null;c.data!==void 0&&(v=Array.isArray(c.data.policies)?c.data.policies:[]);let x=Array.isArray(f.data?.columns)?f.data.columns:[],y=m.data??null,{error:b,liveError:S}=c,w=v===null?[]:b1t(v,x,I1t(y)),C;e[12]!==S?(C=(0,P.jsxDEV)("div",{className:"flex items-center justify-end",children:(0,P.jsxDEV)(Rl,{message:S,prefix:"pm"},void 0,!1)},void 0,!1),e[12]=S,e[13]=C):C=e[13];let F;e[14]!==b?(F=b!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pm-error",role:"alert",children:b},void 0,!1),e[14]=b,e[15]=F):F=e[15],h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[C,F,v!==null&&w.length===0?(0,P.jsxDEV)(co,{description:a("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:a("No policy")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"pm-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:a("Table")},void 0,!1),POe.map(T=>(0,P.jsxDEV)(Le,{children:y1t(a,T)},T,!1)),(0,P.jsxDEV)(Le,{children:a("Masked columns")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:w.map(T=>(0,P.jsxDEV)(It,{"data-testid":`pm-row-${T.table}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:(0,P.jsxDEV)("span",{className:"flex items-center gap-1.5",children:[T.table,T.uncovered&&(0,P.jsxDEV)(Pt,{"data-testid":`pm-uncovered-${T.table}`,title:a("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:a("Uncovered \u2014 reachable without a policy")},void 0,!1)]},void 0,!0)},void 0,!1),POe.map(E=>{let k=T.cells[E];return(0,P.jsxDEV)(Ne,{"data-testid":`pm-cell-${T.table}-${E}`,children:k.procedure===void 0?(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:a("No policy")},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Covered by {procedure}",{procedure:k.procedure})},void 0,!1),r!==void 0&&(0,P.jsxDEV)(dt,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${T.table}-${E}`,onClick:n(()=>{r(T.table,E,k.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Probe this")},void 0,!1)]},void 0,!0)},E,!1)}),(0,P.jsxDEV)(Ne,{children:T.maskedColumns.length===0?(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:T.maskedColumns.map(w1t)},void 0,!1)},void 0,!1)]},T.table,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),e[6]=m.data,e[7]=f.data,e[8]=r,e[9]=c,e[10]=a,e[11]=h}else h=e[11];return h},"PermissionsMatrix");function w1t(t){return(0,P.jsxDEV)(Pt,{variant:"outline",children:t},t,!1)}n(w1t,"_temp$3");var C1t=ro(vt.runAs),F1t=n(()=>{let t=Wt();return async({args:e,functionPath:o,shardKey:r="",userId:a})=>{let s=C1t;try{return{kind:"allowed",value:await t.query(s,{args:e,functionPath:o,userId:a},lo(r))}}catch(i){return{kind:"denied",message:i instanceof Error?i.message:String(i)}}}},"useRunAsProbe"),R1t=n(t=>t===void 0?"undefined":JSON.stringify(t,null,2),"formatValue"),E1t=n(({functions:t,prefill:e,runAsIdentity:o=!1}={})=>{let r=Wt(),a=Ve(),s=F1t(),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),p=t??i??[],[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)("{}"),[y,b]=(0,st.useState)(""),[S,w]=(0,st.useState)(""),[C,F]=(0,st.useState)(!1),[T,E]=(0,st.useState)(null),[k,O]=(0,st.useState)(null),D=(0,st.useRef)(-1);(0,st.useEffect)(()=>{if(t!==void 0)return;let N=!1;return r.listFunctions().then(_=>(N||c(_),_)).catch(_=>{N||f(Jt(_))}),()=>{N=!0}},[r,t]),(0,st.useEffect)(()=>{if(e===void 0||D.current===e.nonce)return;D.current=e.nonce;let N=e.functionPath;queueMicrotask(()=>{h(N),E(null)})},[e]);let M=m===""?p[0]?.path??"":m,L=n(async()=>{if(M==="")return;let N;try{N=v.trim()===""?{}:JSON.parse(v)}catch(_){O(a("Invalid JSON args: {message}",{message:_.message})),E(null);return}O(null),F(!0);try{let _=await s({args:N,functionPath:M,shardKey:y.trim(),userId:S.trim()});E(_)}finally{F(!1)}},"run"),U=n(()=>{ot(L())},"runOnce"),W=n(N=>{h(N.target.value)},"onSelectChange"),V=n(N=>{x(N.target.value)},"onArgsChange"),j=n(N=>{w(N.target.value)},"onUserIdChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:d},void 0,!1),!o&&(0,P.jsxDEV)(co,{description:a("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:a("Set `runAsIdentity` to forge an identity and probe access.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-function",children:a("Function")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:W,value:M,children:p.map(N=>(0,P.jsxDEV)("option",{value:N.path,children:[N.path," (",N.kind,")"]},N.path,!0))},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-args",children:a("Arguments")},void 0,!1),(0,P.jsxDEV)(Ff,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:V,value:v},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Qr,{onChange:b,testId:"pp-shard",value:y},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-user",children:a("Run as (userId)")},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":a("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:j,placeholder:a("Leave empty to run as admin"),value:S},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"pp-run",disabled:!o||C||M==="",onClick:U,type:"button",children:a(C?"Probing\u2026":"Run probe")},void 0,!1),S.trim()!==""&&(0,P.jsxDEV)(Pt,{"data-testid":"pp-as-badge",variant:"secondary",children:a("as {userId}",{userId:S.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),k!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:k},void 0,!1),T!==null&&T.kind==="allowed"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Allowed")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:R1t(T.value)},void 0,!1)]},void 0,!0),T!==null&&T.kind==="denied"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,P.jsxDEV)(Pt,{variant:"destructive",children:a("Denied")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:T.message},void 0,!1)]},void 0,!0)]},void 0,!0)},"PermissionsPlayground"),A1t="/__lunora/policy-scaffold",T1t={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},k1t=n(async t=>{let e=await fetch(A1t,{body:JSON.stringify(t),headers:{"Content-Type":"application/json"},method:"POST"}),o=await e.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(e.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};let r=o.error;return{kind:"error",message:r===void 0?`policy scaffold failed (${String(e.status)})`:T1t[r]??r}},"applyPolicyScaffold"),OOe={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},M1t=n(()=>{let t=Ve(),[e,o]=(0,st.useState)(null),[r,a]=(0,st.useState)(!1),[s,i]=(0,st.useState)(null),[c,d]=(0,st.useState)(OOe),f=n(b=>{let S=b.target.name,{value:w}=b.target;d(C=>({...C,[S]:w}))},"onFieldChange"),p=n(()=>{o(null),d(OOe)},"reset"),m=n(async b=>{a(!0),i(null);try{let S=await k1t(b);i(S),S.kind==="ok"&&p()}catch(S){i({kind:"error",message:S instanceof Error?S.message:String(S)})}finally{a(!1)}},"submit"),h=n(()=>{ot(m({kind:"scaffoldPolicy",name:c.policyName.trim(),table:c.tableName.trim()}))},"onSubmitScaffold"),v=n(()=>{ot(m({exportName:c.exportName.trim(),filePath:c.filePath.trim(),kind:"wireRls",policies:c.policies.trim()}))},"onSubmitWire"),x=n(()=>{i(null),o("scaffold")},"openScaffold"),y=n(()=>{i(null),o("wire")},"openWire");return(0,P.jsxDEV)(Rt,{"data-testid":"policy-scaffolder",size:"sm",children:[(0,P.jsxDEV)(nu,{children:[(0,P.jsxDEV)(au,{children:t("Scaffold access rules")},void 0,!1),(0,P.jsxDEV)(Vg,{children:t("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Xt,{children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:e==="scaffold"?"default":"outline",children:t("New policy file")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-wire",onClick:y,size:"xs",type:"button",variant:e==="wire"?"default":"outline",children:t("Wire into a procedure")},void 0,!1)]},void 0,!0),e==="scaffold"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-name",children:t("Policy name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:f,value:c.policyName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-table",children:t("Table name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:f,value:c.tableName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-create",disabled:r||c.policyName.trim()===""||c.tableName.trim()==="",onClick:h,size:"xs",type:"button",children:t(r?"Creating\u2026":"Create policy file")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),e==="wire"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-file",children:t("Procedure file path")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:f,value:c.filePath},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-export",children:t("Exported procedure")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:f,value:c.exportName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-policies",children:t("Policy set identifier")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:f,value:c.policies},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-apply",disabled:r||c.filePath.trim()===""||c.exportName.trim()===""||c.policies.trim()==="",onClick:v,size:"xs",type:"button",children:t(r?"Wiring\u2026":"Wire RLS")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),s?.kind==="error"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message},void 0,!1),s?.kind==="needs-manual-edit"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:t("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")},void 0,!1),s?.kind==="ok"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,P.jsxDEV)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:t("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})},void 0,!1),s.diagnostics.length>0&&(0,P.jsxDEV)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(b=>(0,P.jsxDEV)("li",{className:"font-mono text-[11px] text-destructive",children:b},b,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"PolicyScaffolder"),P1t=n(({functions:t,runAsIdentity:e=!1,schemaEditable:o=!1}={})=>{let r=Ve(),[a,s]=(0,st.useState)(void 0),i=n((c,d,f)=>{f!==""&&s(p=>({functionPath:f,nonce:(p?.nonce??0)+1}))},"onProbe");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Permissions")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(S1t,{onProbe:i},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Probe")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-4 py-4",children:[(0,P.jsxDEV)("p",{className:"mb-3 text-sm text-muted-foreground",children:r("Pick a function and an identity, then run it to see the access outcome.")},void 0,!1),(0,P.jsxDEV)(E1t,{functions:t,prefill:a,runAsIdentity:e},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),o&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,P.jsxDEV)(M1t,{},void 0,!1)},void 0,!1)]},void 0,!0)},"PermissionsPanel"),O1t=n(()=>{let t=(0,Yt.c)(17),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.listQueues,o),s=r!==void 0,i;t[1]!==r?(i=Array.isArray(r?.queues)?[...r.queues].toSorted(N1t):[],t[1]=r,t[2]=i):i=t[2];let c=i,d;t[3]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"queues-error",role:"alert",children:a},void 0,!1),t[3]=a,t[4]=d):d=t[4];let f;t[5]!==e?(f=e("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),t[5]=e,t[6]=f):f=t[6];let p;t[7]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:f},void 0,!1),t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==c||t[11]!==e?(m=s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:e("No queues defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"queues-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Queue")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Mode")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(D1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[9]=s,t[10]=c,t[11]=e,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[d,p,m]},void 0,!0),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h},"QueuesPanel");function N1t(t,e){return t.exportName.localeCompare(e.exportName)}n(N1t,"_temp$2");function D1t(t){return(0,P.jsxDEV)(It,{"data-testid":`queues-row-${t.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.mode},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.deadLetterQueue??"\u2014"},void 0,!1)]},t.exportName,!0)}n(D1t,"_temp2$1");var _1t=ro(vt.runSql),L1t=n((t,e)=>{let o=Wt(),[r,a]=(0,st.useState)(void 0),[s,i]=(0,st.useState)(void 0),[c,d]=(0,st.useState)(!0),f=(0,st.useCallback)(async p=>{d(!0);try{let m=await o.query(_1t,{sql:t},lo(e));p.cancelled||(a(m),i(void 0))}catch(m){p.cancelled||(a(void 0),i(Jt(m)))}finally{p.cancelled||d(!1)}},[o,t,e]);return(0,st.useEffect)(()=>{let p={cancelled:!1};return ot(f(p)),()=>{p.cancelled=!0}},[f]),{error:s,loading:c,result:r}},"useRunSql"),B1t="lunora-studio-dashboards",qZ={shardKey:"",sql:"",title:""},V1t=n(t=>{let e=(0,Yt.c)(54),{onEdit:o,onRemove:r,widget:a}=t,s=Ve(),{error:i,loading:c,result:d}=L1t(a.sql,a.shardKey??""),f;e[0]!==o||e[1]!==a.id?(f=n(()=>{o(a.id)},"t1"),e[0]=o,e[1]=a.id,e[2]=f):f=e[2];let p=f,m;e[3]!==r||e[4]!==a.id?(m=n(()=>{r(a.id)},"t2"),e[3]=r,e[4]=a.id,e[5]=m):m=e[5];let h=m,v=`dashboards-widget-${a.id}`,x;e[6]!==a.title?(x=(0,P.jsxDEV)(au,{className:"min-w-0 truncate",title:a.title,children:a.title},void 0,!1),e[6]=a.title,e[7]=x):x=e[7];let y;e[8]!==s?(y=s("Edit widget"),e[8]=s,e[9]=y):y=e[9];let b=`dashboards-widget-edit-${a.id}`,S;e[10]!==s?(S=s("Edit widget"),e[10]=s,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==p||e[14]!==y||e[15]!==b||e[16]!==S?(C=(0,P.jsxDEV)(dt,{"aria-label":y,"data-testid":b,onClick:p,size:"icon-xs",title:S,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=p,e[14]=y,e[15]=b,e[16]=S,e[17]=C):C=e[17];let F;e[18]!==s?(F=s("Remove widget"),e[18]=s,e[19]=F):F=e[19];let T=`dashboards-widget-remove-${a.id}`,E;e[20]!==s?(E=s("Remove widget"),e[20]=s,e[21]=E):E=e[21];let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=k):k=e[22];let O;e[23]!==h||e[24]!==F||e[25]!==T||e[26]!==E?(O=(0,P.jsxDEV)(dt,{"aria-label":F,"data-testid":T,onClick:h,size:"icon-xs",title:E,type:"button",variant:"ghost",children:k},void 0,!1),e[23]=h,e[24]=F,e[25]=T,e[26]=E,e[27]=O):O=e[27];let D;e[28]!==O||e[29]!==C?(D=(0,P.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,O]},void 0,!0),e[28]=O,e[29]=C,e[30]=D):D=e[30];let M;e[31]!==D||e[32]!==x?(M=(0,P.jsxDEV)(nu,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[x,D]},void 0,!0),e[31]=D,e[32]=x,e[33]=M):M=e[33];let L;e[34]!==i||e[35]!==a.id?(L=i!==void 0&&(0,P.jsxDEV)(vX,{className:"font-mono text-xs",testId:`dashboards-widget-error-${a.id}`,variant:"destructive",children:i},void 0,!1),e[34]=i,e[35]=a.id,e[36]=L):L=e[36];let U;e[37]!==i||e[38]!==c||e[39]!==d||e[40]!==s||e[41]!==a.id?(U=i===void 0&&c&&d===void 0&&(0,P.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${a.id}`,children:s("Running\u2026")},void 0,!1),e[37]=i,e[38]=c,e[39]=d,e[40]=s,e[41]=a.id,e[42]=U):U=e[42];let W;e[43]!==i||e[44]!==d?(W=i===void 0&&d!==void 0&&(0,P.jsxDEV)(gX,{result:d},void 0,!1),e[43]=i,e[44]=d,e[45]=W):W=e[45];let V;e[46]!==L||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(Xt,{className:"min-h-32 py-2",children:[L,U,W]},void 0,!0),e[46]=L,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;return e[50]!==M||e[51]!==V||e[52]!==v?(j=(0,P.jsxDEV)(Rt,{"data-testid":v,children:[M,V]},void 0,!0),e[50]=M,e[51]=V,e[52]=v,e[53]=j):j=e[53],j},"WidgetCard"),U1t=n(t=>{let e=(0,Yt.c)(58),{draft:o,editing:r,onCancel:a,onChange:s,onSubmit:i}=t,c=Ve(),d;e[0]!==o||e[1]!==s?(d=n(_=>{s({...o,title:_.target.value})},"t1"),e[0]=o,e[1]=s,e[2]=d):d=e[2];let f=d,p;e[3]!==o||e[4]!==s?(p=n(_=>{s({...o,sql:_.target.value})},"t2"),e[3]=o,e[4]=s,e[5]=p):p=e[5];let m=p,h;e[6]!==o||e[7]!==s?(h=n(_=>{s({...o,shardKey:_.target.value})},"t3"),e[6]=o,e[7]=s,e[8]=h):h=e[8];let v=h,x;e[9]!==i?(x=n(()=>{i()},"t4"),e[9]=i,e[10]=x):x=e[10];let y=x,b;e[11]!==o.sql||e[12]!==o.title?(b=o.title.trim()!==""&&o.sql.trim()!=="",e[11]=o.sql,e[12]=o.title,e[13]=b):b=e[13];let S=b,w;e[14]!==c?(w=c("Widget title"),e[14]=c,e[15]=w):w=e[15];let C;e[16]!==c?(C=c("Widget title"),e[16]=c,e[17]=C):C=e[17];let F;e[18]!==o.title||e[19]!==f||e[20]!==w||e[21]!==C?(F=(0,P.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:f,placeholder:C,type:"text",value:o.title},void 0,!1),e[18]=o.title,e[19]=f,e[20]=w,e[21]=C,e[22]=F):F=e[22];let T;e[23]!==c?(T=c("SQL query"),e[23]=c,e[24]=T):T=e[24];let E;e[25]!==o.sql||e[26]!==m||e[27]!==T?(E=(0,P.jsxDEV)("textarea",{"aria-label":T,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:m,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:o.sql},void 0,!1),e[25]=o.sql,e[26]=m,e[27]=T,e[28]=E):E=e[28];let k;e[29]!==c?(k=c("Shard key (optional)"),e[29]=c,e[30]=k):k=e[30];let O;e[31]!==c?(O=c("Shard key (optional)"),e[31]=c,e[32]=O):O=e[32];let D;e[33]!==o.shardKey||e[34]!==v||e[35]!==k||e[36]!==O?(D=(0,P.jsxDEV)("input",{"aria-label":k,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:v,placeholder:O,type:"text",value:o.shardKey},void 0,!1),e[33]=o.shardKey,e[34]=v,e[35]=k,e[36]=O,e[37]=D):D=e[37];let M;e[38]!==c?(M=c("Cancel"),e[38]=c,e[39]=M):M=e[39];let L;e[40]!==a||e[41]!==M?(L=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:M},void 0,!1),e[40]=a,e[41]=M,e[42]=L):L=e[42];let U=!S,W;e[43]!==r||e[44]!==c?(W=c(r?"Save widget":"Add widget"),e[43]=r,e[44]=c,e[45]=W):W=e[45];let V;e[46]!==y||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-save",disabled:U,onClick:y,size:"sm",type:"button",children:W},void 0,!1),e[46]=y,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;e[50]!==L||e[51]!==V?(j=(0,P.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L,V]},void 0,!0),e[50]=L,e[51]=V,e[52]=j):j=e[52];let N;return e[53]!==E||e[54]!==D||e[55]!==j||e[56]!==F?(N=(0,P.jsxDEV)(Rt,{"data-testid":"dashboards-form",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-3 py-4",children:[F,E,D,j]},void 0,!0)},void 0,!1),e[53]=E,e[54]=D,e[55]=j,e[56]=F,e[57]=N):N=e[57],N},"WidgetForm"),z1t=n(t=>{let e=(0,Yt.c)(39),{initialShardKey:o}=t,r=Ve(),[a,s]=rw(B1t),[i,c]=(0,st.useState)(qZ),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(!1),h;e[0]!==o?(h=n(()=>{f(null),c({...qZ,shardKey:o??""}),m(!0)},"t1"),e[0]=o,e[1]=h):h=e[1];let v=h,x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=n(()=>{m(!1),f(null),c(qZ)},"t2"),e[2]=x):x=e[2];let y=x,b;e[3]!==a?(b=n(W=>{let V=a.find(j=>j.id===W);V!==void 0&&(f(W),c({shardKey:V.shardKey??"",sql:V.sql,title:V.title}),m(!0))},"t3"),e[3]=a,e[4]=b):b=e[4];let S=b,w;e[5]!==s?(w=n(W=>{s(V=>V.filter(j=>j.id!==W))},"t4"),e[5]=s,e[6]=w):w=e[6];let C=w,F;e[7]!==i.shardKey||e[8]!==i.sql||e[9]!==i.title||e[10]!==d||e[11]!==s?(F=n(()=>{let W=i.title.trim(),V=i.sql.trim();if(W===""||V==="")return;let j=i.shardKey.trim();s(d===null?N=>[...N,{id:Y4("w"),shardKey:j,sql:V,title:W}]:N=>N.map(_=>_.id===d?{..._,shardKey:j,sql:V,title:W}:_)),y()},"t5"),e[7]=i.shardKey,e[8]=i.sql,e[9]=i.title,e[10]=d,e[11]=s,e[12]=F):F=e[12];let T=F,E;e[13]!==r?(E=r("Chart widgets backed by saved read-only SQL queries."),e[13]=r,e[14]=E):E=e[14];let k;e[15]!==E?(k=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:E},void 0,!1),e[15]=E,e[16]=k):k=e[16];let O;e[17]!==p||e[18]!==v||e[19]!==r?(O=!p&&(0,P.jsxDEV)(dt,{"data-testid":"dashboards-add",onClick:v,size:"sm",type:"button",children:r("Add widget")},void 0,!1),e[17]=p,e[18]=v,e[19]=r,e[20]=O):O=e[20];let D;e[21]!==k||e[22]!==O?(D=(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[k,O]},void 0,!0),e[21]=k,e[22]=O,e[23]=D):D=e[23];let M;e[24]!==i||e[25]!==d||e[26]!==p||e[27]!==T?(M=p&&(0,P.jsxDEV)(U1t,{draft:i,editing:d!==null,onCancel:y,onChange:c,onSubmit:T},void 0,!1),e[24]=i,e[25]=d,e[26]=p,e[27]=T,e[28]=M):M=e[28];let L;e[29]!==p||e[30]!==S||e[31]!==C||e[32]!==r||e[33]!==a?(L=a.length===0&&!p?(0,P.jsxDEV)(co,{description:r("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:r("No widgets yet")},void 0,!1):(0,P.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:a.map(W=>(0,P.jsxDEV)(V1t,{onEdit:S,onRemove:C,widget:W},W.id,!1))},void 0,!1),e[29]=p,e[30]=S,e[31]=C,e[32]=r,e[33]=a,e[34]=L):L=e[34];let U;return e[35]!==M||e[36]!==L||e[37]!==D?(U=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[D,M,L]},void 0,!0),e[35]=M,e[36]=L,e[37]=D,e[38]=U):U=e[38],U},"DashboardsPanel"),NOe=n(t=>`${t.toString()} ms`,"formatMs"),$1t=n(t=>t.totalConnections===0&&t.shapePoke.passes===0&&t.whisper.passes===0,"isFanoutIdle"),Ow=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatCard"),DOe=n(t=>{let e=(0,Yt.c)(48),{counters:o,includeTiming:r,prefix:a,t:s,title:i}=t,c=`${a}-section`,d;e[0]!==i?(d=(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:i},void 0,!1),e[0]=i,e[1]=d):d=e[1];let f=`${a}-stats`,p;e[2]!==s?(p=s("Passes"),e[2]=s,e[3]=p):p=e[3];let m=`${a}-passes`,h;e[4]!==o.passes||e[5]!==p||e[6]!==m?(h=(0,P.jsxDEV)(Ow,{label:p,testId:m,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=p,e[6]=m,e[7]=h):h=e[7];let v;e[8]!==s?(v=s("Sockets iterated"),e[8]=s,e[9]=v):v=e[9];let x=`${a}-iterated`,y;e[10]!==o.socketsIterated||e[11]!==v||e[12]!==x?(y=(0,P.jsxDEV)(Ow,{label:v,testId:x,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=v,e[12]=x,e[13]=y):y=e[13];let b;e[14]!==s?(b=s("Delivered"),e[14]=s,e[15]=b):b=e[15];let S=`${a}-delivered`,w;e[16]!==o.socketsDelivered||e[17]!==b||e[18]!==S?(w=(0,P.jsxDEV)(Ow,{label:b,testId:S,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=b,e[18]=S,e[19]=w):w=e[19];let C;e[20]!==s?(C=s("Peak width"),e[20]=s,e[21]=C):C=e[21];let F=`${a}-peak`,T;e[22]!==o.peakSocketsIterated||e[23]!==C||e[24]!==F?(T=(0,P.jsxDEV)(Ow,{label:C,testId:F,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=C,e[24]=F,e[25]=T):T=e[25];let E;e[26]!==o.totalMs||e[27]!==r||e[28]!==a||e[29]!==s?(E=r&&(0,P.jsxDEV)(Ow,{label:s("Total time"),testId:`${a}-total-ms`,value:NOe(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=r,e[28]=a,e[29]=s,e[30]=E):E=e[30];let k;e[31]!==o.maxMs||e[32]!==r||e[33]!==a||e[34]!==s?(k=r&&(0,P.jsxDEV)(Ow,{label:s("Max time"),testId:`${a}-max-ms`,value:NOe(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=r,e[33]=a,e[34]=s,e[35]=k):k=e[35];let O;e[36]!==w||e[37]!==T||e[38]!==E||e[39]!==k||e[40]!==f||e[41]!==h||e[42]!==y?(O=(0,P.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":f,children:[h,y,w,T,E,k]},void 0,!0),e[36]=w,e[37]=T,e[38]=E,e[39]=k,e[40]=f,e[41]=h,e[42]=y,e[43]=O):O=e[43];let D;return e[44]!==c||e[45]!==O||e[46]!==d?(D=(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":c,children:[d,O]},void 0,!0),e[44]=c,e[45]=O,e[46]=d,e[47]=D):D=e[47],D},"PathCounters"),H1t=n(t=>{let e=(0,Yt.c)(31),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.getFanoutMetrics,d,f);us(h,!0);let v;e[5]!==p?(v=p!==void 0&&$1t(p),e[5]=p,e[6]=v):v=e[6];let x=v,y;e[7]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"fanout-shard-input",value:a},void 0,!1),e[7]=a,e[8]=y):y=e[8];let b;e[9]!==p||e[10]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[p.promoted&&(0,P.jsxDEV)(Pt,{"data-testid":"fanout-promoted",variant:"default",children:r("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:p.maxRelays,relayCount:p.relayCount})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("peak {count} subscribers",{count:p.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=p,e[10]=r,e[11]=b):b=e[11];let S;e[12]!==y||e[13]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[12]=y,e[13]=b,e[14]=S):S=e[14];let w;e[15]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"fanout-error",role:"alert",children:m},void 0,!1),e[15]=m,e[16]=w):w=e[16];let C;e[17]!==m||e[18]!==x||e[19]!==r?(C=m===null&&x&&(0,P.jsxDEV)(co,{description:r("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:r("No fan-out activity yet.")},void 0,!1),e[17]=m,e[18]=x,e[19]=r,e[20]=C):C=e[20];let F;e[21]!==m||e[22]!==x||e[23]!==p||e[24]!==r?(F=m===null&&p!==void 0&&!x&&(0,P.jsxDEV)(P.Fragment,{children:[p.topics.length>0&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:r("Hot topics")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"fanout-topics-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Topic")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Kind")},void 0,!1),(0,P.jsxDEV)(Le,{className:"text-right",children:r("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.topics.map(j1t)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:r("Fan-out cost since this instance woke")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:r,title:r("Shape pokes")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.whisper,includeTiming:!1,prefix:"fanout-whisper",t:r,title:r("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[21]=m,e[22]=x,e[23]=p,e[24]=r,e[25]=F):F=e[25];let T;return e[26]!==F||e[27]!==S||e[28]!==w||e[29]!==C?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[S,w,C,F]},void 0,!0),e[26]=F,e[27]=S,e[28]=w,e[29]=C,e[30]=T):T=e[30],T},"FanoutPanel");function j1t(t){return(0,P.jsxDEV)(It,{"data-testid":"fanout-topic-row",children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.topic},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"outline",children:t.kind},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right font-medium tabular-nums",children:t.subscribers},void 0,!1)]},`${t.kind}:${t.topic}`,!0)}n(j1t,"_temp$1");var q1t=n((t,e)=>({delete:t("Delete"),list:t("List"),read:t("Read"),write:t("Write")})[e],"operationLabel"),_Oe={delete:2,list:3,read:0,write:1},W1t=n(t=>[...t].toSorted((e,o)=>e.bucket.localeCompare(o.bucket)||_Oe[e.on]-_Oe[o.on]||(e.prefix??"").localeCompare(o.prefix??"")),"sortRules"),G1t=n(()=>{let t=(0,Yt.c)(12),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.storageRules,o),s=r!==void 0,i;if(t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==e){let c=W1t(Array.isArray(r?.rules)?r.rules:[]),d;t[6]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-rules-error",role:"alert",children:a},void 0,!1),t[6]=a,t[7]=d):d=t[7];let f;t[8]!==e?(f=e("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),t[8]=e,t[9]=f):f=t[9];let p;t[10]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:f},void 0,!1),t[10]=f,t[11]=p):p=t[11],i=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[d,p,s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:e("No storage rules defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"storage-rules-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Bucket")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Operation")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Key prefix")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>(0,P.jsxDEV)(It,{"data-testid":`storage-rule-${m.bucket}-${m.on}-${m.prefix??""}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.bucket},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"secondary",children:q1t(e,m.on)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.prefix??(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:e("(whole bucket)")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:m.procedure},void 0,!1)]},`${m.bucket}:${m.on}:${m.prefix??""}:${m.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),t[1]=r,t[2]=a,t[3]=s,t[4]=e,t[5]=i}else i=t[5];return i},"StorageRulesPanel"),K1t=10,nV=n(t=>{let e=(0,Yt.c)(7),{label:o,value:r}=t,a;e[0]!==o?(a=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=a):a=e[1];let s=r??"\u2014",i;e[2]!==s?(i=(0,P.jsxDEV)("span",{className:"font-mono text-sm",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=(0,P.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[a,i]},void 0,!0),e[4]=a,e[5]=i,e[6]=c):c=e[6],c},"Detail"),Y1t=n(({loadIndexes:t,runQuery:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)(null),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(""),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)(null),[b,S]=(0,st.useState)(!1);(0,st.useEffect)(()=>{let k={cancelled:!1};return ot((async()=>{try{let O=await(t??(()=>o.listVectorIndexes()))();k.cancelled||(s(O),c(null),f(D=>D??O[0]?.name??null))}catch(O){k.cancelled||(s(null),c(Jt(O)))}})()),()=>{k.cancelled=!0}},[o,t]);let w=a?.find(k=>k.name===d)??null,C=n(k=>{f(k.currentTarget.dataset.index??null),v(null),y(null)},"onSelect"),F=n(k=>{m(k.target.value)},"onQueryTextChange"),T=n(async()=>{let k=p.trim();if(!(d===null||k==="")){S(!0),y(null);try{let O=await(e??(D=>o.queryVectorIndex(D)))({name:d,text:k,topK:K1t});v(O)}catch(O){v(null),y(Jt(O))}finally{S(!1)}}},"search"),E=n(()=>{ot(T())},"onSearch");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[i!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:i},void 0,!1),a!==null&&a.length===0&&(0,P.jsxDEV)(co,{description:r("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:r("No vector indexes.")},void 0,!1),a!==null&&a.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("dimensions")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metric")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(k=>(0,P.jsxDEV)(It,{className:k.name===d?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":k.name,"data-testid":`vector-row-${k.name}`,onClick:C,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.table},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.dimensions??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{children:k.metric??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.vectorsCount??"\u2014"},void 0,!1)]},k.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),w!==null&&(0,P.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,P.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,P.jsxDEV)(nV,{label:r("field"),value:w.field},void 0,!1),(0,P.jsxDEV)(nV,{label:r("dimensions"),value:w.dimensions},void 0,!1),(0,P.jsxDEV)(nV,{label:r("metric"),value:w.metric},void 0,!1),(0,P.jsxDEV)(nV,{label:r("vectors"),value:w.vectorsCount},void 0,!1)]},void 0,!0),w.metadata!==void 0&&w.metadata.length>0&&(0,P.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[r("metadata"),": ",(0,P.jsxDEV)("span",{className:"font-mono",children:w.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:F,placeholder:r("Search by similarity\u2026"),value:p},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"vector-search",disabled:b||p.trim()==="",onClick:E,children:r(b?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),x!==null&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:x},void 0,!1),h!==null&&h.length===0&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:r("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,P.jsxDEV)(Rt,{className:"mt-3 overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-matches",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("score")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:h.map(k=>(0,P.jsxDEV)(It,{"data-testid":`vector-match-${k.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.score.toFixed(4)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-md truncate font-mono text-xs",children:k.metadata===void 0?"\u2014":jr(k.metadata)},void 0,!1)]},k.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser"),X1t=["queued","running","paused","waiting","complete","errored","terminated"],Q1t=["pause","resume","terminate"],Z1t="WORKFLOWS_NOT_CONFIGURED",J1t=n(t=>typeof t=="object"&&t!==null&&t.code===Z1t,"isNotConfigured"),eSt=n(t=>{let e=t.error??t.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e)}catch{return"(unserializable)"}},"formatStepPayload"),tSt=n(({loadDetail:t,loadInstances:e,readOnly:o,runAction:r,workflowName:a})=>{let s=Wt(),i=Ve(),[c,d]=(0,st.useState)(null),[f,p]=(0,st.useState)(null),[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)(null),[y,b]=(0,st.useState)(!1),[S,w]=(0,st.useState)(null),C=t??(M=>s.getWorkflowInstance(M)),E=o?void 0:r??(e===void 0?M=>s.setWorkflowInstanceStatus(M):void 0),k=n(async()=>{x(null),b(!1);let M=m===""?void 0:m;try{if(e===void 0){let L=await s.listWorkflowInstances({name:a,status:M});if(L.configured===!1){d(null),b(!0);return}d(L.instances);return}d(await e({name:a,status:M}))}catch(L){d(null),J1t(L)?b(!0):x(Jt(L))}},"load");(0,st.useEffect)(()=>{p(null),ot(k())},[a,m]);let O=n(async M=>{x(null);try{p(await C({id:M,name:a}))}catch(L){x(Jt(L))}},"openDetail"),D=n(async(M,L)=>{if(E!==void 0){w(M),x(null);try{await E({action:L,id:M,name:a}),await k()}catch(U){x(Jt(U))}finally{w(null)}}},"act");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:i("Instance history")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":i("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(M=>{h(M.target.value)},"onChange"),value:m,children:[(0,P.jsxDEV)("option",{value:"",children:i("All statuses")},void 0,!1),X1t.map(M=>(0,P.jsxDEV)("option",{value:M,children:M},M,!1))]},void 0,!0)]},void 0,!0),v!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v},void 0,!1),y&&(0,P.jsxDEV)(co,{description:i("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:i("Workflow inspection not configured")},void 0,!1),!y&&c!==null&&c.length===0&&(0,P.jsxDEV)(co,{description:i("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:i("No instances")},void 0,!1),c!==null&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Created")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Ended")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(M=>(0,P.jsxDEV)(It,{"data-testid":`workflow-instance-${M.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.createdOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.endedOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-steps-${M.id}`,onClick:n(()=>{ot(O(M.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Steps")},void 0,!1),E!==void 0&&Q1t.map(L=>(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-${L}-${M.id}`,disabled:S===M.id,onClick:n(()=>{ot(D(M.id,L))},"onClick"),size:"sm",type:"button",variant:"ghost",children:i(L)},L,!1))]},void 0,!0)},void 0,!1)]},M.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),f!==null&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:[i("Steps")," \xB7 ",f.id]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{p(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Close")},void 0,!1)]},void 0,!0),f.steps.length===0?(0,P.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i("This instance has no recorded steps yet.")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instance-steps",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Step")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Type")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Started")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:f.steps.map((M,L)=>(0,P.jsxDEV)(It,{"data-testid":`workflow-step-${String(L)}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-xs text-muted-foreground",children:M.type??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:M.attempts??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.start??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:eSt(M)},void 0,!1)]},`${M.name}:${String(L)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),oSt=ro(vt.createWorkflowInstance),rSt=ro(vt.getWorkflowInstanceStatus),nSt=n(t=>{if(t.error)return`${t.error.name}: ${t.error.message}`;if(t.output===void 0)return"\u2014";try{return JSON.stringify(t.output)}catch{return"(unserializable)"}},"formatPayload"),aSt=n(()=>{let t=Wt(),e=Ve(),{data:o,error:r}=_o(vt.listWorkflows,{}),[a,s]=(0,st.useState)(""),[i,c]=(0,st.useState)(""),[d,f]=(0,st.useState)(""),[p,m]=(0,st.useState)(!1),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)([]),[b,S]=(0,st.useState)(null),w=o!==void 0,C=(0,st.useMemo)(()=>Array.isArray(o?.workflows)?[...o.workflows].toSorted((V,j)=>V.exportName.localeCompare(j.exportName)):[],[o]),F=(0,st.useMemo)(()=>C.some(V=>V.exportName===a)?a:C[0]?.exportName??"",[C,a]),T=(0,st.useMemo)(()=>C.find(V=>V.exportName===F),[C,F]),E=n(V=>{y(j=>{let N=j.filter(_=>!(_.exportName===V.exportName&&_.id===V.id));return[V,...N]})},"upsertInstance"),k=n(async()=>{let V=F;if(V==="")return;let j,N=d.trim();if(N!=="")try{j=JSON.parse(N)}catch{v(e("Params must be valid JSON"));return}m(!0),v(null);try{let _=i.trim(),B=await t.query(oSt,{exportName:V,id:_===""?void 0:_,params:j},lo(""));E({exportName:V,id:B.id,status:B.status}),c("")}catch(_){v(Jt(_))}finally{m(!1)}},"start"),O=n(()=>{ot(k())},"startInstance"),D=n(async(V,j)=>{S(j);try{let N=await t.query(rSt,{exportName:V,id:j},lo(""));E({error:N.error,exportName:V,id:N.id,output:N.output,status:N.status})}catch(N){v(Jt(N))}finally{S(null)}},"refreshInstance"),M=n(V=>{s(V.target.value)},"onSelectedExportChange"),L=n(V=>{c(V.target.value)},"onInstanceIdChange"),U=n(V=>{f(V.target.value)},"onParamsChange"),W=n(V=>{let{export:j,id:N}=V.currentTarget.dataset;j!==void 0&&N!==void 0&&ot(D(j,N))},"onRefreshClick");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[r!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:r},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),w&&C.length===0?(0,P.jsxDEV)(co,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Name")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Class")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:C.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-row-${V.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.className},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.binding},void 0,!1)]},V.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),C.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Start instance")},void 0,!1),h!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:h},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:M,value:F,children:C.map(V=>(0,P.jsxDEV)("option",{value:V.exportName,children:V.exportName},V.exportName,!1))},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:L,placeholder:e("Instance id (optional)"),value:i},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"workflows-start-button",disabled:p||F==="",onClick:O,children:e(p?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Ff,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:U,placeholder:e("Params (JSON, optional)"),value:d},void 0,!1)]},void 0,!0),x.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Instances")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Workflow")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Output")},void 0,!1),(0,P.jsxDEV)(Le,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-instance-${V.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:nSt(V)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-export":V.exportName,"data-id":V.id,"data-testid":`workflows-instance-refresh-${V.id}`,disabled:b===V.id,onClick:W,size:"xs",variant:"outline",children:b===V.id?e("Refreshing\u2026"):e("Refresh")},void 0,!1)},void 0,!1)]},`${V.exportName}:${V.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),T!==void 0&&(0,P.jsxDEV)(tSt,{workflowName:T.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel"),sSt=ro(vt.studioFeatures),eNe={flags:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},iSt=n(t=>{if(t===null||typeof t!="object")return eNe;let e=t,o=n(r=>typeof e[r]=="boolean"?e[r]:!0,"flag");return{flags:o("flags"),mail:o("mail"),payments:o("payments"),queues:o("queues"),scheduler:o("scheduler"),storage:o("storage"),vectors:o("vectors"),workflows:o("workflows")}},"coerceFeatures"),lSt=n(()=>{let t=(0,Yt.c)(3),e=Wt(),[o,r]=(0,st.useState)(eNe),a,s;return t[0]!==e?(a=n(()=>{ot((async()=>{try{r(iSt(await e.query(sSt,{},lo(""))))}catch{}})())},"t0"),s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),(0,st.useEffect)(a,s),o},"useStudioFeatures"),tNe=(0,st.createContext)(null),cSt={analytics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),api:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4M13 5l-2 14"},void 0,!1),audit:(0,P.jsxDEV)("path",{d:"M7 4h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm6 0v5h5M9 13h6M9 16h6M9 10h2"},void 0,!1),authConfig:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6h-3.6l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),authSessions:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),dashboards:(0,P.jsxDEV)("path",{d:"M4 5h7v6H4V5Zm9 0h7v4h-7V5ZM4 14h7v5H4v-5Zm9-1h7v6h-7v-6Z"},void 0,!1),drains:(0,P.jsxDEV)("path",{d:"M5 5h14M7 5v6a5 5 0 0 0 10 0V5M10 16h4v3h-4zM12 19v2"},void 0,!1),data:(0,P.jsxDEV)("path",{d:"M5 6c0-1.4 3.1-2.5 7-2.5s7 1.1 7 2.5-3.1 2.5-7 2.5S5 7.4 5 6Zm0 0v12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5V6M5 12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5"},void 0,!1),export:(0,P.jsxDEV)("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"},void 0,!1),fanout:(0,P.jsxDEV)("path",{d:"M12 5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm-7 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm14 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM12 7v3.5M12 10.5 6 17m6-6.5 6 6.5"},void 0,!1),files:(0,P.jsxDEV)("path",{d:"M4 7a2 2 0 0 1 2-2h3l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7Z"},void 0,!1),flags:(0,P.jsxDEV)("path",{d:"M6 21V4m0 0h11l-2 3 2 3H6"},void 0,!1),functions:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4"},void 0,!1),health:(0,P.jsxDEV)("path",{d:"M3 12h4l2 6 4-14 2 8h6"},void 0,!1),home:(0,P.jsxDEV)("path",{d:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9"},void 0,!1),insights:(0,P.jsxDEV)("path",{d:"M12 3a6 6 0 0 0-3.6 10.8c.5.4.8.9.9 1.5l.2 1.2h5l.2-1.2c.1-.6.4-1.1.9-1.5A6 6 0 0 0 12 3ZM9.5 20.5h5M10 18h4"},void 0,!1),logs:(0,P.jsxDEV)("path",{d:"M5 6h14M5 10h14M5 14h9M5 18h11"},void 0,!1),mail:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 1.5 8 6 8-6"},void 0,!1),payments:(0,P.jsxDEV)("path",{d:"M3 7h18v10H3V7Zm0 3h18M7 14h4"},void 0,!1),metrics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),migrations:(0,P.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1),organizations:(0,P.jsxDEV)("path",{d:"M3 21V8l6-4 6 4v13M9 21v-5h2v5M15 11h6v10M18 14v.01M18 17v.01M6 9v.01M6 12v.01M6 15v.01"},void 0,!1),permissions:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8 2.2 2.2L15 9.5M8.5 16h7"},void 0,!1),pitr:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0-9-9M12 7.5V12l3 2M3 12l-2-2m2 2 2-2"},void 0,!1),queues:(0,P.jsxDEV)("path",{d:"M4 6h16M4 10h16M4 14h10M4 18h10m4-2 3 2-3 2v-4Z"},void 0,!1),realtime:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1),rls:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3ZM8.5 10h7M8.5 13h7"},void 0,!1),schedule:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),schema:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"},void 0,!1),sql:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm3 4 3 3-3 3m6 0h4"},void 0,!1),storageRules:(0,P.jsxDEV)("path",{d:"M7 10V7a5 5 0 0 1 10 0v3m-11 0h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1Zm6 4v2"},void 0,!1),security:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-2.5 8.5 2 2 4-4"},void 0,!1),settings:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6H10.5l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),users:(0,P.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85M16 3.13A4 4 0 0 1 16 11"},void 0,!1),vectors:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1),workflows:(0,P.jsxDEV)("path",{d:"M5 5h5v5H5V5Zm9 9h5v5h-5v-5ZM7.5 10v2a2 2 0 0 0 2 2H14m2.5-4V8a2 2 0 0 0-2-2H10"},void 0,!1)},LOe=[{key:"overview",tabs:["home","dashboards"]},{key:"database",tabs:["data","sql","schema","migrations","vectors","pitr","export"]},{key:"functions",tabs:["functions","api","workflows","queues"]},{key:"auth",tabs:["users","organizations","authSessions","authConfig"]},{key:"storage",tabs:["files","storageRules"]},{key:"observability",tabs:["logs","audit","realtime","fanout","metrics","analytics","health"]},{key:"advisors",tabs:["security","rls","permissions","insights"]},{key:"operations",tabs:["schedule","mail","drains","payments","flags"]},{key:"settings",tabs:["settings"]}],uSt={files:"storage",flags:"flags",mail:"mail",payments:"payments",queues:"queues",schedule:"scheduler",storageRules:"storage",vectors:"vectors",workflows:"workflows"},BOe=n((t,e)=>{let o=uSt[t];return o===void 0||e[o]},"isTabVisible"),WZ=n(t=>{let e=(0,Yt.c)(2),{tab:o}=t,r=cSt[o],a;return e[0]!==r?(a=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 shrink-0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r},void 0,!1),e[0]=r,e[1]=a):a=e[1],a},"TabIcon"),oNe=["home","data","sql","functions","api","workflows","queues","schema","migrations","vectors","export","pitr","users","organizations","authSessions","authConfig","files","storageRules","dashboards","metrics","analytics","health","security","rls","permissions","insights","logs","realtime","mail","payments","audit","schedule","drains","flags","settings"],dSt=new Set(["api","data","sql"]),fSt=n(t=>{let e=t.split("/").findLast(Boolean)??"";return oNe.includes(e)?e:"home"},"tabFromPathname"),pSt=n(t=>{let e=(0,Yt.c)(19),{chrome:o,connected:r}=t,a=Ve(),s;e[0]!==a?(s=a("admin token"),e[0]=a,e[1]=s):s=e[1];let i;e[2]!==s?(i=(0,P.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"dash-app-token",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;e[4]!==o.onTokenChange||e[5]!==o.token?(c=(0,P.jsxDEV)(mo,{className:"h-8","data-testid":"dash-app-token",id:"dash-app-token",onChange:o.onTokenChange,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:o.token},void 0,!1),e[4]=o.onTokenChange,e[5]=o.token,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==a?(d=r&&(0,P.jsxDEV)("p",{className:"flex items-start gap-1.5 text-[11px] text-muted-foreground","data-testid":"dash-app-token-warning",role:"note",children:[(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-warning",children:"\u26A0"},void 0,!1),a("Token rides the WebSocket URL \u2014 it can surface in browser DevTools and server logs. Use a dev-only token.")]},void 0,!0),e[7]=r,e[8]=a,e[9]=d):d=e[9];let f;e[10]!==o.clearToken||e[11]!==r||e[12]!==a?(f=r&&(0,P.jsxDEV)("button",{className:"self-start rounded-md border border-border px-2.5 py-1 text-xs font-medium outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"dash-app-clear-token",onClick:o.clearToken,type:"button",children:a("Clear")},void 0,!1),e[10]=o.clearToken,e[11]=r,e[12]=a,e[13]=f):f=e[13];let p;return e[14]!==i||e[15]!==c||e[16]!==d||e[17]!==f?(p=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2",children:[i,c,d,f]},void 0,!0),e[14]=i,e[15]=c,e[16]=d,e[17]=f,e[18]=p):p=e[18],p},"ConnectPopoverContent"),mSt=n(t=>{let e=(0,Yt.c)(25),{current:o,group:r,groupLabel:a,selectTab:s,tabDescription:i,tabLabel:c}=t,d=r.tabs.includes(o)?"page":void 0,f=a[r.key],p=r.tabs[0],m;e[0]!==p?(m=(0,P.jsxDEV)(WZ,{tab:p},void 0,!1),e[0]=p,e[1]=m):m=e[1];let h;e[2]!==d||e[3]!==f||e[4]!==m?(h=(0,P.jsxDEV)(KOe,{"aria-current":d,"aria-label":f,className:"mx-auto flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent data-[popup-open]:bg-sidebar-accent data-[popup-open]:text-sidebar-accent-foreground data-[popup-open]:shadow-xs aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground aria-[current=page]:shadow-xs",delay:120,openOnHover:!0,children:m},void 0,!1),e[2]=d,e[3]=f,e[4]=m,e[5]=h):h=e[5];let v=a[r.key],x;e[6]!==v?(x=(0,P.jsxDEV)("div",{className:"px-2 py-1.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:v},void 0,!1),e[6]=v,e[7]=x):x=e[7];let y;if(e[8]!==o||e[9]!==r.tabs||e[10]!==s||e[11]!==i||e[12]!==c){let w;e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(w=n(C=>(0,P.jsxDEV)("button",{"aria-current":o===C?"page":void 0,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent aria-[current=page]:font-medium [&_svg]:opacity-70 aria-[current=page]:[&_svg]:opacity-100","data-tab":C,"data-testid":`dash-tab-${C}`,onClick:s,title:i[C],type:"button",children:[(0,P.jsxDEV)(WZ,{tab:C},void 0,!1),(0,P.jsxDEV)("span",{children:c[C]},void 0,!1)]},C,!0),"t92"),e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=w):w=e[18],y=r.tabs.map(w),e[8]=o,e[9]=r.tabs,e[10]=s,e[11]=i,e[12]=c,e[13]=y}else y=e[13];let b;e[19]!==x||e[20]!==y?(b=(0,P.jsxDEV)(YOe,{align:"start",className:"w-56 p-1",side:"right",sideOffset:8,children:[x,y]},void 0,!0),e[19]=x,e[20]=y,e[21]=b):b=e[21];let S;return e[22]!==h||e[23]!==b?(S=(0,P.jsxDEV)(GOe,{children:[h,b]},void 0,!0),e[22]=h,e[23]=b,e[24]=S):S=e[24],S},"CollapsedGroupNav"),hSt=n(t=>{let e=(0,Yt.c)(45),{chrome:o,collapsed:r,connected:a}=t,s=Ve();if(o===null){let C;e[0]!==s?(C=s("Admin"),e[0]=s,e[1]=C):C=e[1];let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=(0,P.jsxDEV)("span",{className:"flex size-8 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:"C"},void 0,!1),e[2]=F):F=e[2];let T;e[3]!==s?(T=s("Admin"),e[3]=s,e[4]=T):T=e[4];let E;e[5]!==T?(E=(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:T},void 0,!1),e[5]=T,e[6]=E):E=e[6];let k;e[7]!==s?(k=s("Studio"),e[7]=s,e[8]=k):k=e[8];let O;e[9]!==k?(O=(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:k},void 0,!1),e[9]=k,e[10]=O):O=e[10];let D;e[11]!==E||e[12]!==O?(D=(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[E,O]},void 0,!0),e[11]=E,e[12]=O,e[13]=D):D=e[13];let M;return e[14]!==C||e[15]!==D?(M=(0,P.jsxDEV)(QOe,{className:"data-active:bg-transparent",size:"lg",tooltip:C,children:[F,D]},void 0,!0),e[14]=C,e[15]=D,e[16]=M):M=e[16],M}let i=r?"mx-auto size-8 justify-center":"w-full p-2",c;e[17]!==i?(c=tt("flex items-center gap-2 rounded-md text-start outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",i),e[17]=i,e[18]=c):c=e[18];let d;e[19]!==a||e[20]!==s?(d=s(a?"Connected":"Not connected"),e[19]=a,e[20]=s,e[21]=d):d=e[21];let f=a?"bg-success":"bg-muted-foreground/50",p;e[22]!==f?(p=tt("absolute -end-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar",f),e[22]=f,e[23]=p):p=e[23];let m;e[24]!==p?(m=(0,P.jsxDEV)("span",{className:"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:["C",(0,P.jsxDEV)("span",{"aria-hidden":"true",className:p},void 0,!1)]},void 0,!0),e[24]=p,e[25]=m):m=e[25];let h;e[26]!==r||e[27]!==a||e[28]!==s?(h=!r&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:s("Admin")},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:s(a?"Connected":"Not connected")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m8 9 4-4 4 4M8 15l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1)]},void 0,!0),e[26]=r,e[27]=a,e[28]=s,e[29]=h):h=e[29];let v;e[30]!==c||e[31]!==d||e[32]!==m||e[33]!==h?(v=(0,P.jsxDEV)(KOe,{className:c,"data-testid":"dash-app-connect",title:d,children:[m,h]},void 0,!0),e[30]=c,e[31]=d,e[32]=m,e[33]=h,e[34]=v):v=e[34];let x=r?"end":"start",y=r?"right":"top",b;e[35]!==o||e[36]!==a?(b=(0,P.jsxDEV)(pSt,{chrome:o,connected:a},void 0,!1),e[35]=o,e[36]=a,e[37]=b):b=e[37];let S;e[38]!==y||e[39]!==b||e[40]!==x?(S=(0,P.jsxDEV)(YOe,{align:x,keepMounted:!0,side:y,children:b},void 0,!1),e[38]=y,e[39]=b,e[40]=x,e[41]=S):S=e[41];let w;return e[42]!==S||e[43]!==v?(w=(0,P.jsxDEV)(GOe,{children:[v,S]},void 0,!0),e[42]=S,e[43]=v,e[44]=w):w=e[44],w},"SidebarFooterProfile"),gSt=n(t=>{let e=(0,Yt.c)(28),{chrome:o,connected:r,current:a,groupLabel:s,groups:i,selectTab:c,tabDescription:d,tabLabel:f}=t,p=Ve(),{state:m}=sV(),h=m==="collapsed",v=h&&"justify-center px-0",x;e[0]!==v?(x=tt("flex items-center gap-2.5 px-1.5 py-1",v),e[0]=v,e[1]=x):x=e[1];let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=(0,P.jsxDEV)(GZ,{className:"size-9 shrink-0 text-foreground"},void 0,!1),e[2]=y):y=e[2];let b;e[3]!==h||e[4]!==r||e[5]!==p?(b=!h&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-sm font-semibold text-foreground",children:"lunora"},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:p("Studio")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Pt,{className:"px-1.5 text-[10px] tracking-wider uppercase",variant:"secondary",children:p(r?"Live":"Local")},void 0,!1)]},void 0,!0),e[3]=h,e[4]=r,e[5]=p,e[6]=b):b=e[6];let S;e[7]!==x||e[8]!==b?(S=(0,P.jsxDEV)(pbt,{children:(0,P.jsxDEV)("div",{className:x,children:[y,b]},void 0,!0)},void 0,!1),e[7]=x,e[8]=b,e[9]=S):S=e[9];let w;e[10]!==h||e[11]!==a||e[12]!==s||e[13]!==i||e[14]!==c||e[15]!==d||e[16]!==f?(w=h?i.map(E=>(0,P.jsxDEV)(mSt,{current:a,group:E,groupLabel:s,selectTab:c,tabDescription:d,tabLabel:f},E.key,!1)):i.map(E=>(0,P.jsxDEV)(gbt,{children:[(0,P.jsxDEV)(vbt,{className:"text-[11px] font-medium tracking-wider uppercase",children:s[E.key]},void 0,!1),(0,P.jsxDEV)(xbt,{children:(0,P.jsxDEV)(FOe,{children:E.tabs.map(k=>(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(QOe,{className:"data-active:text-foreground dark:data-active:text-royal-amethyst data-active:shadow-[inset_2px_0_0_0_var(--royal-amethyst)]","data-tab":k,"data-testid":`dash-tab-${k}`,isActive:a===k,onClick:c,title:d[k],tooltip:d[k],children:[(0,P.jsxDEV)(WZ,{tab:k},void 0,!1),(0,P.jsxDEV)("span",{children:f[k]},void 0,!1)]},void 0,!0)},k,!1))},void 0,!1)},void 0,!1)]},E.key,!0)),e[10]=h,e[11]=a,e[12]=s,e[13]=i,e[14]=c,e[15]=d,e[16]=f,e[17]=w):w=e[17];let C;e[18]!==w?(C=(0,P.jsxDEV)(hbt,{children:w},void 0,!1),e[18]=w,e[19]=C):C=e[19];let F;e[20]!==o||e[21]!==h||e[22]!==r?(F=(0,P.jsxDEV)(mbt,{children:(0,P.jsxDEV)(FOe,{children:(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(hSt,{chrome:o,collapsed:h,connected:r},void 0,!1)},void 0,!1)},void 0,!1)},void 0,!1),e[20]=o,e[21]=h,e[22]=r,e[23]=F):F=e[23];let T;return e[24]!==S||e[25]!==C||e[26]!==F?(T=(0,P.jsxDEV)(ubt,{collapsible:"icon",variant:"inset",children:[S,C,F]},void 0,!0),e[24]=S,e[25]=C,e[26]=F,e[27]=T):T=e[27],T},"StudioSidebar"),vSt=n(()=>{let t=(0,Yt.c)(282),e=Ve(),o=zs(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={select:wSt},t[0]=r):r=t[0];let a=J$(r),s,i;t[1]!==a?(s=fSt(a),i=dSt.has(s),t[1]=a,t[2]=s,t[3]=i):(s=t[2],i=t[3]);let c=i,d=lSt(),f;t[4]!==d?(f=n(al=>({...al,tabs:al.tabs.filter(tp=>BOe(tp,d))}),"t2"),t[4]=d,t[5]=f):f=t[5];let p=LOe.map(f).filter(CSt),m,h;t[6]!==s||t[7]!==d||t[8]!==o?(m=n(()=>{BOe(s,d)||ot(o({replace:!0,to:"/home"}))},"t3"),h=[s,d,o],t[6]=s,t[7]=d,t[8]=o,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,st.useEffect)(m,h);let v;t[11]!==e?(v=e("Analytics"),t[11]=e,t[12]=v):v=t[12];let x;t[13]!==e?(x=e("API"),t[13]=e,t[14]=x):x=t[14];let y;t[15]!==e?(y=e("Audit"),t[15]=e,t[16]=y):y=t[16];let b;t[17]!==e?(b=e("Configuration"),t[17]=e,t[18]=b):b=t[18];let S;t[19]!==e?(S=e("Sessions"),t[19]=e,t[20]=S):S=t[20];let w;t[21]!==e?(w=e("Dashboards"),t[21]=e,t[22]=w):w=t[22];let C;t[23]!==e?(C=e("Data"),t[23]=e,t[24]=C):C=t[24];let F;t[25]!==e?(F=e("Log drains"),t[25]=e,t[26]=F):F=t[26];let T;t[27]!==e?(T=e("Export / Import"),t[27]=e,t[28]=T):T=t[28];let E;t[29]!==e?(E=e("Fan-out"),t[29]=e,t[30]=E):E=t[30];let k;t[31]!==e?(k=e("Files"),t[31]=e,t[32]=k):k=t[32];let O;t[33]!==e?(O=e("Flags"),t[33]=e,t[34]=O):O=t[34];let D;t[35]!==e?(D=e("Functions"),t[35]=e,t[36]=D):D=t[36];let M;t[37]!==e?(M=e("Health"),t[37]=e,t[38]=M):M=t[38];let L;t[39]!==e?(L=e("Home"),t[39]=e,t[40]=L):L=t[40];let U;t[41]!==e?(U=e("Performance"),t[41]=e,t[42]=U):U=t[42];let W;t[43]!==e?(W=e("Logs"),t[43]=e,t[44]=W):W=t[44];let V;t[45]!==e?(V=e("Metrics"),t[45]=e,t[46]=V):V=t[46];let j;t[47]!==e?(j=e("Migrations"),t[47]=e,t[48]=j):j=t[48];let N;t[49]!==e?(N=e("Organizations"),t[49]=e,t[50]=N):N=t[50];let _;t[51]!==e?(_=e("Time Travel"),t[51]=e,t[52]=_):_=t[52];let B;t[53]!==e?(B=e("Mail"),t[53]=e,t[54]=B):B=t[54];let z;t[55]!==e?(z=e("Payments"),t[55]=e,t[56]=z):z=t[56];let q;t[57]!==e?(q=e("Permissions"),t[57]=e,t[58]=q):q=t[58];let $;t[59]!==e?($=e("Queues"),t[59]=e,t[60]=$):$=t[60];let Y;t[61]!==e?(Y=e("Realtime"),t[61]=e,t[62]=Y):Y=t[62];let Q;t[63]!==e?(Q=e("RLS Policies"),t[63]=e,t[64]=Q):Q=t[64];let X;t[65]!==e?(X=e("Scheduled"),t[65]=e,t[66]=X):X=t[66];let te;t[67]!==e?(te=e("Schema"),t[67]=e,t[68]=te):te=t[68];let ae;t[69]!==e?(ae=e("Security"),t[69]=e,t[70]=ae):ae=t[70];let se;t[71]!==e?(se=e("Settings"),t[71]=e,t[72]=se):se=t[72];let J;t[73]!==e?(J=e("SQL editor"),t[73]=e,t[74]=J):J=t[74];let ne;t[75]!==e?(ne=e("Access Rules"),t[75]=e,t[76]=ne):ne=t[76];let pe;t[77]!==e?(pe=e("Users"),t[77]=e,t[78]=pe):pe=t[78];let le;t[79]!==e?(le=e("Vectors"),t[79]=e,t[80]=le):le=t[80];let ie;t[81]!==e?(ie=e("Workflows"),t[81]=e,t[82]=ie):ie=t[82];let de;t[83]!==w||t[84]!==C||t[85]!==F||t[86]!==T||t[87]!==E||t[88]!==k||t[89]!==O||t[90]!==D||t[91]!==M||t[92]!==L||t[93]!==U||t[94]!==W||t[95]!==V||t[96]!==j||t[97]!==N||t[98]!==_||t[99]!==B||t[100]!==z||t[101]!==q||t[102]!==$||t[103]!==Y||t[104]!==Q||t[105]!==X||t[106]!==te||t[107]!==ae||t[108]!==se||t[109]!==J||t[110]!==ne||t[111]!==pe||t[112]!==le||t[113]!==ie||t[114]!==v||t[115]!==x||t[116]!==y||t[117]!==b||t[118]!==S?(de={analytics:v,api:x,audit:y,authConfig:b,authSessions:S,dashboards:w,data:C,drains:F,export:T,fanout:E,files:k,flags:O,functions:D,health:M,home:L,insights:U,logs:W,metrics:V,migrations:j,organizations:N,pitr:_,mail:B,payments:z,permissions:q,queues:$,realtime:Y,rls:Q,schedule:X,schema:te,security:ae,settings:se,sql:J,storageRules:ne,users:pe,vectors:le,workflows:ie},t[83]=w,t[84]=C,t[85]=F,t[86]=T,t[87]=E,t[88]=k,t[89]=O,t[90]=D,t[91]=M,t[92]=L,t[93]=U,t[94]=W,t[95]=V,t[96]=j,t[97]=N,t[98]=_,t[99]=B,t[100]=z,t[101]=q,t[102]=$,t[103]=Y,t[104]=Q,t[105]=X,t[106]=te,t[107]=ae,t[108]=se,t[109]=J,t[110]=ne,t[111]=pe,t[112]=le,t[113]=ie,t[114]=v,t[115]=x,t[116]=y,t[117]=b,t[118]=S,t[119]=de):de=t[119];let ue=de,he={advisors:e("Advisors"),auth:e("Auth"),database:e("Database"),functions:e("Functions"),observability:e("Observability"),operations:e("Operations"),overview:e("Overview"),settings:e("Settings"),storage:e("Storage")},Re;t[120]!==e?(Re=e("Usage and latency from Analytics Engine \u2014 request volume, p50/p95, and hot shards."),t[120]=e,t[121]=Re):Re=t[121];let Ae;t[122]!==e?(Ae=e("Interactive OpenAPI reference and copy-paste snippets for your functions."),t[122]=e,t[123]=Ae):Ae=t[123];let ye;t[124]!==e?(ye=e("A durable log of admin state-changing operations."),t[124]=e,t[125]=ye):ye=t[125];let ge;t[126]!==e?(ge=e("Enabled plugins and session config (read-only)."),t[126]=e,t[127]=ge):ge=t[127];let Te;t[128]!==e?(Te=e("Browse and revoke active sessions across all users."),t[128]=e,t[129]=Te):Te=t[129];let ze;t[130]!==e?(ze=e("Chart widgets backed by saved read-only SQL queries."),t[130]=e,t[131]=ze):ze=t[131];let Ze;t[132]!==e?(Ze=e("Browse and edit rows across your shard and global tables."),t[132]=e,t[133]=Ze):Ze=t[133];let _e;t[134]!==e?(_e=e("Forward logs to Logpush, Tail Workers, or a webhook collector."),t[134]=e,t[135]=_e):_e=t[135];let Ie;t[136]!==e?(Ie=e("Export a shard to NDJSON, or import rows from it."),t[136]=e,t[137]=Ie):Ie=t[137];let ke;t[138]!==e?(ke=e("Realtime fan-out cost and per-topic subscriber counts for this shard."),t[138]=e,t[139]=ke):ke=t[139];let Be;t[140]!==e?(Be=e("Browse objects in your R2 storage buckets."),t[140]=e,t[141]=Be):Be=t[141];let Me;t[142]!==e?(Me=e("Inspect feature flags and their live evaluation under a targeting context."),t[142]=e,t[143]=Me):Me=t[143];let je;t[144]!==e?(je=e("Run registered queries, mutations, and actions."),t[144]=e,t[145]=je):je=t[145];let mt;t[146]!==e?(mt=e("At-a-glance connection, error, and shard signals."),t[146]=e,t[147]=mt):mt=t[147];let ht;t[148]!==e?(ht=e("Connection, health, and advisor summary for your deployment."),t[148]=e,t[149]=ht):ht=t[149];let yt;t[150]!==e?(yt=e("Surface slow functions, error spikes, and cache problems."),t[150]=e,t[151]=yt):yt=t[151];let Et;t[152]!==e?(Et=e("A live stream of recent function logs."),t[152]=e,t[153]=Et):Et=t[153];let St;t[154]!==e?(St=e("Per-shard health and aggregate metrics."),t[154]=e,t[155]=St):St=t[155];let jt;t[156]!==e?(jt=e("Review migration status and run them."),t[156]=e,t[157]=jt):jt=t[157];let At;t[158]!==e?(At=e("Browse and manage organizations, members, and invitations."),t[158]=e,t[159]=At):At=t[159];let ee;t[160]!==e?(ee=e("Restore a shard to a point in the last 30 days."),t[160]=e,t[161]=ee):ee=t[161];let ce;t[162]!==e?(ce=e("Email your app sent, captured in dev."),t[162]=e,t[163]=ce):ce=t[163];let Ee;t[164]!==e?(Ee=e("Synced customers, subscriptions, and webhook events."),t[164]=e,t[165]=Ee):Ee=t[165];let Oe;t[166]!==e?(Oe=e("Inspect access policies per table, and probe a function as any identity."),t[166]=e,t[167]=Oe):Oe=t[167];let Ce;t[168]!==e?(Ce=e("Inspect declared Cloudflare Queues \u2014 their producer bindings, consumer mode, and dead-letter queue."),t[168]=e,t[169]=Ce):Ce=t[169];let Ye;t[170]!==e?(Ye=e("Active WebSocket subscriptions on this shard."),t[170]=e,t[171]=Ye):Ye=t[171];let it;t[172]!==e?(it=e("Inspect row-level-security policies and roles, per table."),t[172]=e,t[173]=it):it=t[173];let ft;t[174]!==e?(ft=e("Inspect and cancel scheduled jobs."),t[174]=e,t[175]=ft):ft=t[175];let ct;t[176]!==e?(ct=e("Inspect each table and its columns."),t[176]=e,t[177]=ct):ct=t[177];let Zt;t[178]!==e?(Zt=e("Review admin gates, credentials, and log redaction."),t[178]=e,t[179]=Zt):Zt=t[179];let ao;t[180]!==e?(ao=e("Read-only deployment config \u2014 vars, secrets, and bindings."),t[180]=e,t[181]=ao):ao=t[181];let Vt;t[182]!==e?(Vt=e("Run read-only SQL against a shard."),t[182]=e,t[183]=Vt):Vt=t[183];let Ko;t[184]!==e?(Ko=e("Inspect storage access rules \u2014 per bucket, operation, and key prefix."),t[184]=e,t[185]=Ko):Ko=t[185];let Po;t[186]!==e?(Po=e("Manage auth users \u2014 roles, bans, sessions, and identity."),t[186]=e,t[187]=Po):Po=t[187];let Ge;t[188]!==e?(Ge=e("Browse Vectorize indexes and run similarity searches."),t[188]=e,t[189]=Ge):Ge=t[189];let wt;t[190]!==e?(wt=e("Inspect declared Cloudflare Workflows and their bindings."),t[190]=e,t[191]=wt):wt=t[191];let Ut;t[192]!==Re||t[193]!==Ae||t[194]!==ye||t[195]!==ge||t[196]!==Te||t[197]!==ze||t[198]!==Ze||t[199]!==_e||t[200]!==Ie||t[201]!==ke||t[202]!==Be||t[203]!==Me||t[204]!==je||t[205]!==mt||t[206]!==ht||t[207]!==yt||t[208]!==Et||t[209]!==St||t[210]!==jt||t[211]!==At||t[212]!==ee||t[213]!==ce||t[214]!==Ee||t[215]!==Oe||t[216]!==Ce||t[217]!==Ye||t[218]!==it||t[219]!==ft||t[220]!==ct||t[221]!==Zt||t[222]!==ao||t[223]!==Vt||t[224]!==Ko||t[225]!==Po||t[226]!==Ge||t[227]!==wt?(Ut={analytics:Re,api:Ae,audit:ye,authConfig:ge,authSessions:Te,dashboards:ze,data:Ze,drains:_e,export:Ie,fanout:ke,files:Be,flags:Me,functions:je,health:mt,home:ht,insights:yt,logs:Et,metrics:St,migrations:jt,organizations:At,pitr:ee,mail:ce,payments:Ee,permissions:Oe,queues:Ce,realtime:Ye,rls:it,schedule:ft,schema:ct,security:Zt,settings:ao,sql:Vt,storageRules:Ko,users:Po,vectors:Ge,workflows:wt},t[192]=Re,t[193]=Ae,t[194]=ye,t[195]=ge,t[196]=Te,t[197]=ze,t[198]=Ze,t[199]=_e,t[200]=Ie,t[201]=ke,t[202]=Be,t[203]=Me,t[204]=je,t[205]=mt,t[206]=ht,t[207]=yt,t[208]=Et,t[209]=St,t[210]=jt,t[211]=At,t[212]=ee,t[213]=ce,t[214]=Ee,t[215]=Oe,t[216]=Ce,t[217]=Ye,t[218]=it,t[219]=ft,t[220]=ct,t[221]=Zt,t[222]=ao,t[223]=Vt,t[224]=Ko,t[225]=Po,t[226]=Ge,t[227]=wt,t[228]=Ut):Ut=t[228];let So=Ut,to;t[229]!==o?(to=n(al=>{ot(o({to:`/${al.currentTarget.dataset.tab??""}`}))},"t79"),t[229]=o,t[230]=to):to=t[230];let $o=to,Ho,gr;t[231]!==s||t[232]!==ue?(Ho=n(()=>{typeof document<"u"&&(document.title=`${ue[s]} \xB7 lunora`)},"t80"),gr=[s,ue],t[231]=s,t[232]=ue,t[233]=Ho,t[234]=gr):(Ho=t[233],gr=t[234]),(0,st.useEffect)(Ho,gr);let Ct=p.find(al=>al.tabs.includes(s))??LOe[0],so=p.flatMap(al=>al.tabs.map(tp=>({group:he[al.key],label:ue[tp],to:`/${tp}`}))),Uo=(0,st.use)(tNe),Wr=Uo!==null&&Uo.token!=="",Dr;t[235]!==so?(Dr=(0,P.jsxDEV)(wOe,{items:so},void 0,!1),t[235]=so,t[236]=Dr):Dr=t[236];let Ot;t[237]===Symbol.for("react.memo_cache_sentinel")?(Ot=(0,P.jsxDEV)(dbt,{className:"-ms-1"},void 0,!1),t[237]=Ot):Ot=t[237];let wo;t[238]!==e?(wo=e("Breadcrumb"),t[238]=e,t[239]=wo):wo=t[239];let _r=he[Ct.key],Co;t[240]!==_r?(Co=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:_r},void 0,!1),t[240]=_r,t[241]=Co):Co=t[241];let fr;t[242]===Symbol.for("react.memo_cache_sentinel")?(fr=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1),t[242]=fr):fr=t[242];let Qs=ue[s],rl;t[243]!==Qs?(rl=(0,P.jsxDEV)("span",{className:"font-medium text-foreground",children:Qs},void 0,!1),t[243]=Qs,t[244]=rl):rl=t[244];let Ec;t[245]!==wo||t[246]!==Co||t[247]!==rl?(Ec=(0,P.jsxDEV)("nav",{"aria-label":wo,className:"flex items-center gap-1.5 text-[13px]",children:[Co,fr,rl]},void 0,!0),t[245]=wo,t[246]=Co,t[247]=rl,t[248]=Ec):Ec=t[248];let Qf;t[249]===Symbol.for("react.memo_cache_sentinel")?(Qf=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"11",cy:"11",r:"7"},void 0,!1),(0,P.jsxDEV)("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"},void 0,!1)]},void 0,!0),t[249]=Qf):Qf=t[249];let ia;t[250]!==e?(ia=e("Search\u2026"),t[250]=e,t[251]=ia):ia=t[251];let Dl;t[252]===Symbol.for("react.memo_cache_sentinel")?(Dl=(0,P.jsxDEV)("kbd",{className:"ms-auto rounded border border-border bg-background px-1 font-sans text-[10px] text-muted-foreground",children:"\u2318K"},void 0,!1),t[252]=Dl):Dl=t[252];let Zs;t[253]!==ia?(Zs=(0,P.jsxDEV)("button",{className:"mx-auto hidden h-8 w-72 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted md:flex","data-testid":"dash-app-search",onClick:SOe,type:"button",children:[Qf,ia,Dl]},void 0,!0),t[253]=ia,t[254]=Zs):Zs=t[254];let Zf;t[255]===Symbol.for("react.memo_cache_sentinel")?(Zf=(0,P.jsxDEV)("div",{className:"ms-auto flex items-center gap-1.5 md:ms-0",children:(0,P.jsxDEV)(KIt,{},void 0,!1)},void 0,!1),t[255]=Zf):Zf=t[255];let nl;t[256]!==Ec||t[257]!==Zs?(nl=(0,P.jsxDEV)("header",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border px-4","data-testid":"dash-app-header",children:[Ot,Ec,Zs,Zf]},void 0,!0),t[256]=Ec,t[257]=Zs,t[258]=nl):nl=t[258];let _l;t[259]!==Uo?.rulesInstalled?(_l=Uo?.rulesInstalled===!1&&(0,P.jsxDEV)($It,{},void 0,!1),t[259]=Uo?.rulesInstalled,t[260]=_l):_l=t[260];let Jf=`dash-tab-${s}`,Ac=c?"flex min-w-0 flex-1 flex-col overflow-hidden":"min-w-0 flex-1 overflow-auto p-6",Tc=ue[s],kc;t[261]!==e||t[262]!==Tc?(kc=e("{title} failed",{title:Tc}),t[261]=e,t[262]=Tc,t[263]=kc):kc=t[263];let L0=ue[s],gd;t[264]!==e?(gd=e("Try again"),t[264]=e,t[265]=gd):gd=t[265];let ep;t[266]===Symbol.for("react.memo_cache_sentinel")?(ep=(0,P.jsxDEV)(OF,{},void 0,!1),t[266]=ep):ep=t[266];let Mc;t[267]!==s||t[268]!==kc||t[269]!==L0||t[270]!==gd?(Mc=(0,P.jsxDEV)(tb,{fallbackTitle:kc,label:L0,retryLabel:gd,children:ep},s,!1),t[267]=s,t[268]=kc,t[269]=L0,t[270]=gd,t[271]=Mc):Mc=t[271];let Pc;t[272]!==Mc||t[273]!==Ac?(Pc=(0,P.jsxDEV)("div",{className:Ac,children:Mc},void 0,!1),t[272]=Mc,t[273]=Ac,t[274]=Pc):Pc=t[274];let ku;t[275]!==Pc||t[276]!==Jf?(ku=(0,P.jsxDEV)("div",{"aria-labelledby":Jf,className:"flex min-w-0 flex-1 flex-col overflow-hidden","data-testid":"dash-panel",id:"dash-panel",role:"tabpanel",children:Pc},void 0,!1),t[275]=Pc,t[276]=Jf,t[277]=ku):ku=t[277];let vd;return t[278]!==ku||t[279]!==nl||t[280]!==_l?(vd=(0,P.jsxDEV)(fbt,{className:"overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",children:[nl,_l,ku]},void 0,!0),t[278]=ku,t[279]=nl,t[280]=_l,t[281]=vd):vd=t[281],(0,P.jsxDEV)(cbt,{className:"min-h-0 flex-1","data-testid":"lunora-studio",children:[Dr,(0,P.jsxDEV)(gSt,{chrome:Uo,connected:Wr,current:s,groupLabel:he,groups:p,selectTab:$o,tabDescription:So,tabLabel:ue},void 0,!1),vd]},void 0,!0)},"StudioLayout"),xSt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"dash-pending",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(Rf,{className:"h-8 w-40"},void 0,!1),(0,P.jsxDEV)(Rf,{className:"h-8 w-24"},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Rf,{className:"h-72 w-full"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"RoutePending"),ySt=n(t=>{let e=(0,Yt.c)(5),{initialShardKey:o,schemaEditable:r}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];let s=zh(a),{table:i}=s,c=typeof i=="string"?i:void 0,d;return e[1]!==o||e[2]!==c||e[3]!==r?(d=(0,P.jsxDEV)(cOe,{initialShardKey:o,initialTable:c,schemaEditable:r},void 0,!1),e[1]=o,e[2]=c,e[3]=r,e[4]=d):d=e[4],d},"SchemaRoutePanel"),ISt=n(()=>{let t=(0,Yt.c)(3),e=zs(),o,r;return t[0]!==e?(o=n(()=>{ot(e({replace:!0,to:"/home"}))},"t0"),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),(0,st.useEffect)(o,r),null},"NotFoundRedirect"),bSt=n(({basePath:t,dataEditable:e=!1,functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s,runAsIdentity:i=!1,schemaEditable:c=!1,scheduledCancel:d,scheduledCron:f,scheduledLoad:p})=>{let m=X$({component:vSt}),h={analytics:(0,P.jsxDEV)(Abt,{},void 0,!1),api:(0,P.jsxDEV)(Gge,{functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s},void 0,!1),audit:(0,P.jsxDEV)(kAe,{initialShardKey:r},void 0,!1),authConfig:(0,P.jsxDEV)(Mbt,{},void 0,!1),authSessions:(0,P.jsxDEV)(Pbt,{},void 0,!1),dashboards:(0,P.jsxDEV)(z1t,{initialShardKey:r},void 0,!1),data:(0,P.jsxDEV)(zve,{editable:e,initialShardKey:r},void 0,!1),drains:(0,P.jsxDEV)(o1t,{},void 0,!1),export:(0,P.jsxDEV)($ve,{initialShardKey:r},void 0,!1),fanout:(0,P.jsxDEV)(H1t,{initialShardKey:r},void 0,!1),files:(0,P.jsxDEV)(yOe,{},void 0,!1),flags:(0,P.jsxDEV)(e1t,{initialShardKey:r},void 0,!1),functions:(0,P.jsxDEV)("div",{className:"flex flex-col gap-8",children:[(0,P.jsxDEV)(Xve,{functions:o,initialShardKey:r},void 0,!1),(0,P.jsxDEV)(Gve,{functions:o,runAsIdentity:i},void 0,!1)]},void 0,!0),health:(0,P.jsxDEV)(CTe,{initialShardKey:r},void 0,!1),home:(0,P.jsxDEV)(RAe,{initialShardKey:r},void 0,!1),insights:(0,P.jsxDEV)(Mge,{initialShardKey:r},void 0,!1),logs:(0,P.jsxDEV)(_Ae,{initialShardKey:r},void 0,!1),metrics:(0,P.jsxDEV)(nke,{initialShardKey:r},void 0,!1),migrations:(0,P.jsxDEV)(qve,{initialShardKey:r},void 0,!1),organizations:(0,P.jsxDEV)(Nbt,{},void 0,!1),permissions:(0,P.jsxDEV)(P1t,{functions:o,runAsIdentity:i,schemaEditable:c},void 0,!1),pitr:(0,P.jsxDEV)(Wve,{initialShardKey:r},void 0,!1),mail:(0,P.jsxDEV)(QAe,{},void 0,!1),payments:(0,P.jsxDEV)(x1t,{},void 0,!1),queues:(0,P.jsxDEV)(O1t,{},void 0,!1),realtime:(0,P.jsxDEV)(h1t,{initialShardKey:r},void 0,!1),rls:(0,P.jsxDEV)(Sbt,{},void 0,!1),schedule:(0,P.jsxDEV)(f1t,{loadCronJobs:f,scheduledCancel:d,scheduledLoad:p},void 0,!1),schema:(0,P.jsxDEV)(ySt,{initialShardKey:r,schemaEditable:c},void 0,!1),security:(0,P.jsxDEV)(Dge,{},void 0,!1),settings:(0,P.jsxDEV)(dOe,{initialShardKey:r},void 0,!1),sql:(0,P.jsxDEV)(cTe,{initialShardKey:r},void 0,!1),storageRules:(0,P.jsxDEV)(G1t,{},void 0,!1),users:(0,P.jsxDEV)(Xbt,{},void 0,!1),vectors:(0,P.jsxDEV)(Y1t,{},void 0,!1),workflows:(0,P.jsxDEV)(aSt,{},void 0,!1)},v=PF({component:n(()=>h.home,"component"),getParentRoute:n(()=>m,"getParentRoute"),path:"/"}),x=oNe.map(S=>S==="data"?PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`,validateSearch:Lve}):PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`})),y=m.addChildren([v,...x]),b="window"in globalThis?EF():F$({initialEntries:["/home"]});return Q$({...t===void 0||t==="/"?{}:{basepath:t},defaultNotFoundComponent:ISt,defaultPendingComponent:xSt,defaultPendingMinMs:0,defaultPendingMs:0,history:b,routeTree:y})},"buildRouter"),SSt=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}=t,x;e[0]!==o||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==c||e[5]!==d||e[6]!==f||e[7]!==m||e[8]!==h||e[9]!==v||e[10]!==p?(x=bSt({basePath:o,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}),e[0]=o,e[1]=a,e[2]=s,e[3]=i,e[4]=c,e[5]=d,e[6]=f,e[7]=m,e[8]=h,e[9]=v,e[10]=p,e[11]=x):x=e[11];let y=x,b=r??null,S;e[12]!==y?(S=(0,P.jsxDEV)(Z$,{router:y},void 0,!1),e[12]=y,e[13]=S):S=e[13];let w;return e[14]!==b||e[15]!==S?(w=(0,P.jsxDEV)(tNe,{value:b,children:S},void 0,!1),e[14]=b,e[15]=S,e[16]=w):w=e[16],w},"StudioShell"),rNe=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,i18n:i,initialShardKey:c,locale:d,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,schemaEditable:h,scheduledCancel:v,scheduledCron:x,scheduledLoad:y}=t,b;e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==s||e[4]!==c||e[5]!==f||e[6]!==p||e[7]!==m||e[8]!==v||e[9]!==x||e[10]!==y||e[11]!==h?(b=(0,P.jsxDEV)(SSt,{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:c,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,scheduledCancel:v,scheduledCron:x,scheduledLoad:y,schemaEditable:h},void 0,!1),e[0]=o,e[1]=r,e[2]=a,e[3]=s,e[4]=c,e[5]=f,e[6]=p,e[7]=m,e[8]=v,e[9]=x,e[10]=y,e[11]=h,e[12]=b):b=e[12];let S=b;if(i===void 0&&d===void 0)return S;let w;return e[13]!==i||e[14]!==d||e[15]!==S?(w=(0,P.jsxDEV)(YA,{i18n:i,locale:d,children:S},void 0,!1),e[13]=i,e[14]=d,e[15]=S,e[16]=w):w=e[16],w},"Studio");function wSt(t){return t.location.pathname}n(wSt,"_temp");function CSt(t){return t.tabs.length>0}n(CSt,"_temp2");var YZ="lunora-studio-root";var On=K(po(),1);var XZ="lunora-studio-admin-token",nNe=n(()=>{try{return globalThis.sessionStorage}catch{return}},"store"),FSt=n(()=>{try{return nNe()?.getItem(XZ)??""}catch{return""}},"loadToken"),RSt=n(t=>{let e=nNe();if(e!==void 0)try{t===""?e.removeItem(XZ):e.setItem(XZ,t)}catch{}},"saveToken"),ESt=n(t=>{let e=(0,Dw.c)(42),{onSubmit:o}=t,r=Ve(),[a,s]=(0,Nw.useState)(""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=i,d;e[2]!==o||e[3]!==c?(d=n(L=>{L.preventDefault(),c!==""&&o(c)},"t2"),e[2]=o,e[3]=c,e[4]=d):d=e[4];let f=d,p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,On.jsxDEV)("div",{className:"h-10 w-10 text-foreground",children:(0,On.jsxDEV)(GZ,{},void 0,!1)},void 0,!1),e[5]=p):p=e[5];let m;e[6]!==r?(m=r("Connect to Lunora Studio"),e[6]=r,e[7]=m):m=e[7];let h;e[8]!==m?(h=(0,On.jsxDEV)("h1",{className:"text-base font-semibold text-foreground",children:m},void 0,!1),e[8]=m,e[9]=h):h=e[9];let v;e[10]!==r?(v=r("Enter your admin token to access the studio."),e[10]=r,e[11]=v):v=e[11];let x;e[12]!==v?(x=(0,On.jsxDEV)("p",{className:"text-[13px] text-muted-foreground",children:v},void 0,!1),e[12]=v,e[13]=x):x=e[13];let y;e[14]!==h||e[15]!==x?(y=(0,On.jsxDEV)("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,(0,On.jsxDEV)("div",{className:"flex flex-col gap-1",children:[h,x]},void 0,!0)]},void 0,!0),e[14]=h,e[15]=x,e[16]=y):y=e[16];let b;e[17]!==r?(b=r("admin token"),e[17]=r,e[18]=b):b=e[18];let S;e[19]!==b?(S=(0,On.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:b},void 0,!1),e[19]=b,e[20]=S):S=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=n(L=>{s(L.target.value)},"t11"),e[21]=w):w=e[21];let C;e[22]!==a?(C=(0,On.jsxDEV)(mo,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:w,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:a},void 0,!1),e[22]=a,e[23]=C):C=e[23];let F;e[24]!==r?(F=r("From your worker's LUNORA_ADMIN_TOKEN \u2014 your project's .dev.vars in dev, or a deployment secret in production."),e[24]=r,e[25]=F):F=e[25];let T;e[26]!==F?(T=(0,On.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:F},void 0,!1),e[26]=F,e[27]=T):T=e[27];let E;e[28]!==S||e[29]!==C||e[30]!==T?(E=(0,On.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[S,C,T]},void 0,!0),e[28]=S,e[29]=C,e[30]=T,e[31]=E):E=e[31];let k=c==="",O;e[32]!==r?(O=r("Connect"),e[32]=r,e[33]=O):O=e[33];let D;e[34]!==k||e[35]!==O?(D=(0,On.jsxDEV)(dt,{"data-testid":"lunora-studio-login-submit",disabled:k,type:"submit",children:O},void 0,!1),e[34]=k,e[35]=O,e[36]=D):D=e[36];let M;return e[37]!==f||e[38]!==E||e[39]!==D||e[40]!==y?(M=(0,On.jsxDEV)("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[y,E,D]},void 0,!0),e[37]=f,e[38]=E,e[39]=D,e[40]=y,e[41]=M):M=e[41],M},"StudioLoginForm"),ASt=n(t=>{let e=(0,Dw.c)(10),{i18n:o,onSubmit:r}=t,{resolvedTheme:a}=aV(),s=a==="dark"&&"dark",i;e[0]!==s?(i=tt(YZ,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==r?(c=(0,On.jsxDEV)(ESt,{onSubmit:r},void 0,!1),e[2]=r,e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==c?(d=(0,On.jsxDEV)(YA,{i18n:o,children:c},void 0,!1),e[4]=o,e[5]=c,e[6]=d):d=e[6];let f;return e[7]!==i||e[8]!==d?(f=(0,On.jsxDEV)("div",{className:i,"data-testid":"lunora-studio-login-root",children:d},void 0,!1),e[7]=i,e[8]=d,e[9]=f):f=e[9],f},"StudioLogin"),TSt=n(t=>{if(t!==void 0&&t!=="")return t;let e=globalThis.location;return e?.origin!==void 0&&e.origin!==""?e.origin:"http://localhost:5173"},"resolveBaseUrl"),kSt=n(t=>{let e=(0,Dw.c)(23),{basePath:o,chrome:r,studio:a}=t,s=Ve(),i;e[0]!==s?(i=s("Studio failed"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==s?(c=s("Studio"),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==s?(d=s("Try again"),e[4]=s,e[5]=d):d=e[5];let f=a?.dataEditable,p=a?.functions,m=a?.initialShardKey,h=a?.openApiSpec,v=a?.openRpcSpec,x=a?.runAsIdentity,y=a?.scheduledCancel,b=a?.scheduledLoad,S=a?.schemaEditable,w;e[6]!==o||e[7]!==r||e[8]!==y||e[9]!==b||e[10]!==S||e[11]!==f||e[12]!==p||e[13]!==m||e[14]!==h||e[15]!==v||e[16]!==x?(w=(0,On.jsxDEV)(rNe,{basePath:o,chrome:r,dataEditable:f,functions:p,initialShardKey:m,openApiSpec:h,openRpcSpec:v,runAsIdentity:x,scheduledCancel:y,scheduledLoad:b,schemaEditable:S},void 0,!1),e[6]=o,e[7]=r,e[8]=y,e[9]=b,e[10]=S,e[11]=f,e[12]=p,e[13]=m,e[14]=h,e[15]=v,e[16]=x,e[17]=w):w=e[17];let C;return e[18]!==i||e[19]!==w||e[20]!==c||e[21]!==d?(C=(0,On.jsxDEV)(tb,{fallbackTitle:i,label:c,retryLabel:d,children:w},void 0,!1),e[18]=i,e[19]=w,e[20]=c,e[21]=d,e[22]=C):C=e[22],C},"StudioAppBody"),MSt=n(t=>{let e=(0,Dw.c)(20),{basePath:o,clearToken:r,client:a,i18n:s,onTokenChange:i,rulesInstalled:c,studio:d,token:f}=t,{resolvedTheme:p}=aV(),m;e[0]!==r||e[1]!==i||e[2]!==c||e[3]!==f?(m={clearToken:r,onTokenChange:i,rulesInstalled:c,token:f},e[0]=r,e[1]=i,e[2]=c,e[3]=f,e[4]=m):m=e[4];let h=m,v=p==="dark"&&"dark",x;e[5]!==v?(x=tt(YZ,v,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=v,e[6]=x):x=e[6];let y;e[7]!==o||e[8]!==h||e[9]!==d?(y=(0,On.jsxDEV)(qOe,{children:(0,On.jsxDEV)(kSt,{basePath:o,chrome:h,studio:d},void 0,!1)},void 0,!1),e[7]=o,e[8]=h,e[9]=d,e[10]=y):y=e[10];let b;e[11]!==s||e[12]!==y?(b=(0,On.jsxDEV)(YA,{i18n:s,children:y},void 0,!1),e[11]=s,e[12]=y,e[13]=b):b=e[13];let S;e[14]!==a||e[15]!==b?(S=(0,On.jsxDEV)(r$,{client:a,children:b},void 0,!1),e[14]=a,e[15]=b,e[16]=S):S=e[16];let w;return e[17]!==x||e[18]!==S?(w=(0,On.jsxDEV)("div",{className:x,"data-testid":"lunora-studio-app",children:S},void 0,!1),e[17]=x,e[18]=S,e[19]=w):w=e[19],w},"StudioShell"),aNe=n(t=>{let e=(0,Dw.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{adminToken:r,basePath:a,baseUrl:s,client:i,rulesInstalled:c,studio:d,locale:f}=o,p;e[2]!==r?(p=n(()=>r??FSt(),"t2"),e[2]=r,e[3]=p):p=e[3];let[m,h]=(0,Nw.useState)(p),v,x;e[4]!==m?(v=n(()=>{RSt(m)},"t3"),x=[m],e[4]=m,e[5]=v,e[6]=x):(v=e[5],x=e[6]),(0,Nw.useEffect)(v,x);let y=na(m,300),b;e:{if(i!==void 0){b=i;break e}let L;e[7]!==s||e[8]!==y?(L=new hF({url:TSt(s),...y===""?{}:{wsToken:y}}),y!==""&&L.setAuthToken(y),e[7]=s,e[8]=y,e[9]=L):L=e[9],b=L}let S=b,w,C;e[10]!==S||e[11]!==i?(w=n(()=>()=>{i===void 0&&S.close()},"t6"),C=[S,i],e[10]=S,e[11]=i,e[12]=w,e[13]=C):(w=e[12],C=e[13]),(0,Nw.useEffect)(w,C);let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=n(L=>{h(L.target.value)},"t8"),e[14]=F):F=e[14];let T=F,E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=n(()=>{h("")},"t9"),e[15]=E):E=e[15];let k=E,O;e[16]!==f?(O=BF(f),e[16]=f,e[17]=O):O=e[17];let D=O,M;return e[18]!==a||e[19]!==S||e[20]!==D||e[21]!==c||e[22]!==d||e[23]!==m?(M=(0,On.jsxDEV)(jOe,{children:m===""?(0,On.jsxDEV)(ASt,{i18n:D,onSubmit:h},void 0,!1):(0,On.jsxDEV)(MSt,{basePath:a,clearToken:k,client:S,i18n:D,onTokenChange:T,rulesInstalled:c,studio:d,token:m},void 0,!1)},void 0,!1),e[18]=a,e[19]=S,e[20]=D,e[21]=c,e[22]=d,e[23]=m,e[24]=M):M=e[24],M},"StudioApp");var iNe=K(po(),1);var lNe=n((t={})=>{let{container:e="#root",...o}=t,r=typeof e=="string"?document.querySelector(e):e;if(r===null)throw new Error(`mountStudio: container ${typeof e=="string"?e:"element"} not found`);let a=(0,sNe.createRoot)(r);return a.render((0,iNe.jsxDEV)(aNe,{adminToken:o.adminToken,basePath:o.basePath,baseUrl:o.baseUrl,locale:o.locale,rulesInstalled:o.rulesInstalled,studio:o.studio},void 0,!1)),a},"mountStudio");var zm=globalThis;lNe({basePath:typeof zm.__LUNORA_BASE_PATH__=="string"?zm.__LUNORA_BASE_PATH__:"/",adminToken:typeof zm.__LUNORA_ADMIN_TOKEN__=="string"&&zm.__LUNORA_ADMIN_TOKEN__!==""?zm.__LUNORA_ADMIN_TOKEN__:void 0,studio:{dataEditable:zm.__LUNORA_DATA_EDITABLE__===!0,runAsIdentity:zm.__LUNORA_RUN_AS_IDENTITY__===!0,schemaEditable:zm.__LUNORA_SCHEMA_EDITABLE__===!0},rulesInstalled:zm.__LUNORA_RULES_INSTALLED__!==!1});
378
+ `),title:t("Workers Logs")}],[o,r]=(0,st.useState)(""),[a,s]=(0,st.useState)(!1),[i,c]=(0,st.useState)(null),d=n(async()=>{let m=o.trim();if(m==="")return;let h="fetch"in globalThis?globalThis.fetch:void 0;if(h===void 0){c({kind:"error",message:t("fetch is unavailable in this environment.")});return}let v={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};s(!0),c(null);let x=performance.now();try{let y=await h(m,{body:JSON.stringify(v),headers:{"Content-Type":"application/json"},method:"POST"});c({kind:"success",latencyMs:Math.round(performance.now()-x),status:y.status})}catch(y){c({kind:"error",message:Jt(y)})}finally{s(!1)}},"sendTest"),f=n(()=>{ot(d())},"onSendTest"),p=n(m=>{r(m.target.value)},"onWebhookUrlChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,P.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:$_,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,P.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Cloudflare destinations")},void 0,!1),e.map(m=>(0,P.jsxDEV)(t1t,{destination:m},m.id,!1))]},void 0,!0),(0,P.jsxDEV)(Rt,{className:"py-0",children:(0,P.jsxDEV)(Xt,{className:"p-3",children:(0,P.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,P.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Webhook test")},void 0,!1),(0,P.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:p,placeholder:t("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"drain-webhook-test",disabled:a||o.trim()==="",onClick:f,children:t(a?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),i!==null&&(0,P.jsxDEV)("p",{className:i.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:i.kind==="error"?"alert":void 0,children:i.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:i.latencyMs,status:i.status}):t("Failed: {message}",{message:i.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel"),r1t={kind:"idle"},n1t=n(({loadCronJobs:t,runCronJob:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)({}),i=mi(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>o.getCronJobs()))()),{data:c,error:d}=i,f=(0,st.useMemo)(()=>e!==void 0?e:t===void 0?m=>o.runCronJob(m):void 0,[o,t,e]),p=n(async m=>{if(f!==void 0){s(h=>({...h,[m]:{kind:"running"}}));try{await f(m),s(h=>({...h,[m]:{kind:"ok"}})),i.refetch()}catch(h){s(v=>({...v,[m]:{kind:"error",message:Jt(h)}}))}}},"run");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:d},void 0,!1),c?.length===0&&(0,P.jsxDEV)(co,{description:r("Triggers declared with the cronJobs() builder appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"12",cy:"12",r:"9"},void 0,!1),(0,P.jsxDEV)("path",{d:"M12 7.5V12l4 2"},void 0,!1)]},void 0,!0),testId:"cron-empty",title:r("No cron triggers.")},void 0,!1),c!==void 0&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"cron-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("schedule")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("target")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("shard")},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Le,{"aria-label":r("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>{let h=a[m.name]??r1t;return(0,P.jsxDEV)(It,{"data-testid":`cron-row-${m.name}`,children:[(0,P.jsxDEV)(Ne,{children:m.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs tabular-nums",children:m.cron},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)("span",{className:"flex items-center gap-2",children:[m.workflow===void 0?(0,P.jsxDEV)(Pt,{variant:"outline",children:r("function")},void 0,!1):(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("workflow")},void 0,!1),(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:m.workflow??m.functionPath},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{children:m.shardKey??""},void 0,!1),f!==void 0&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("span",{className:"flex items-center justify-end gap-2",children:[h.kind==="ok"&&(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${m.name}`,children:r("ran")},void 0,!1),h.kind==="error"&&(0,P.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${m.name}`,role:"alert",children:h.message},void 0,!1),(0,P.jsxDEV)(pa,{confirmLabel:r("Run now?"),disabled:h.kind==="running",onConfirm:n(()=>{ot(p(m.name))},"onConfirm"),testId:`cron-run-${m.name}`,children:h.kind==="running"?r("Running\u2026"):r("Run now")},void 0,!1)]},void 0,!0)},void 0,!1)]},`${m.cron}:${m.name}`,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"CronTriggersPanel"),a1t=n(t=>Number.isFinite(t)?pn(t,"\u2014"):"\u2014","formatScheduledFor"),s1t=n(t=>{let e=(0,Yt.c)(34),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadJobs:r,removeJob:a,retryJob:s}=o,i=Wt(),c=Ve(),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-dead-jobs"],e[2]=d):d=e[2];let f;e[3]!==i||e[4]!==r?(f=n(async()=>(await(r??(()=>i.listDeadJobs()))()).toSorted(i1t),"t3"),e[3]=i,e[4]=r,e[5]=f):f=e[5];let p=mi(d,f),m=p.data,[h,v]=(0,st.useState)(void 0),x=p.error??h,y=r===void 0,b;e[6]!==i||e[7]!==y||e[8]!==s?(b=s??(y?U=>i.retryDeadJob(U):void 0),e[6]=i,e[7]=y,e[8]=s,e[9]=b):b=e[9];let S=b,w;e[10]!==i||e[11]!==y||e[12]!==a?(w=a??(y?U=>i.removeDeadJob(U):void 0),e[10]=i,e[11]=y,e[12]=a,e[13]=w):w=e[13];let C=w,F;e[14]!==p?(F=n(()=>{p.refetch()},"t6"),e[14]=p,e[15]=F):F=e[15],us(F,!0);let T;e[16]!==p?(T=n(async U=>{v(void 0);try{await U,p.refetch()}catch(W){v(Jt(W))}},"t7"),e[16]=p,e[17]=T):T=e[17];let E=T,k=S!==void 0||C!==void 0,O;e[18]!==x?(O=x!==void 0&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:x},void 0,!1),e[18]=x,e[19]=O):O=e[19];let D;e[20]!==m?.length||e[21]!==c?(D=m?.length===0&&(0,P.jsxDEV)(co,{description:c("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"},void 0,!1)},void 0,!1),testId:"dlq-empty",title:c("No dead-letter jobs.")},void 0,!1),e[20]=m?.length,e[21]=c,e[22]=D):D=e[22];let M;e[23]!==E||e[24]!==k||e[25]!==m||e[26]!==C||e[27]!==S||e[28]!==c?(M=m!==void 0&&m.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"dlq-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:c("function")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("last tried")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("shard")},void 0,!1),(0,P.jsxDEV)(Le,{children:c("id")},void 0,!1),k&&(0,P.jsxDEV)(Le,{"aria-label":c("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:m.map(U=>(0,P.jsxDEV)(It,{"data-testid":`dlq-row-${U.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.functionPath},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:U.attempts??0},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:a1t(U.scheduledFor)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.pool??""},void 0,!1),(0,P.jsxDEV)(Ne,{children:U.shardKey??""},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:U.id},void 0,!1),k&&(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[S!==void 0&&(0,P.jsxDEV)(dt,{"data-testid":`dlq-retry-${U.id}`,onClick:n(()=>{ot(E(S(U.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:c("Retry")},void 0,!1),C!==void 0&&(0,P.jsxDEV)(pa,{confirmLabel:c("Drop job?"),onConfirm:n(()=>{ot(E(C(U.id)))},"onConfirm"),testId:`dlq-remove-${U.id}`,children:c("Drop")},void 0,!1)]},void 0,!0)},void 0,!1)]},U.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[23]=E,e[24]=k,e[25]=m,e[26]=C,e[27]=S,e[28]=c,e[29]=M):M=e[29];let L;return e[30]!==M||e[31]!==O||e[32]!==D?(L=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[O,D,M]},void 0,!0),e[30]=M,e[31]=O,e[32]=D,e[33]=L):L=e[33],L},"DeadLetterJobs");function i1t(t,e){return(e.attempts??0)-(t.attempts??0)}n(i1t,"_temp$5");var HZ=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"flex-1 py-0",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-1 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatTile"),l1t=n(t=>{let e=(0,Yt.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadStatus:r}=o,a=Wt(),s=Ve(),i=r===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let d;e[4]!==a||e[5]!==r?(d=n(async()=>{let w=await(r??(()=>a.schedulerStatus()))();return{...w,pools:w.pools.toSorted(c1t)}},"t4"),e[4]=a,e[5]=r,e[6]=d):d=e[6];let f=mi(c,d),{data:p,error:m}=f,h;e[7]!==f?(h=n(()=>{f.refetch()},"t5"),e[7]=f,e[8]=h):h=e[8],us(h,!0);let v;e[9]!==m?(v=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m},void 0,!1),e[9]=m,e[10]=v):v=e[10];let x;e[11]!==p||e[12]!==s?(x=p!==void 0&&(0,P.jsxDEV)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,P.jsxDEV)(HZ,{label:s("backlog"),testId:"pools-backlog",value:p.backlog},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("in flight"),testId:"pools-inflight",value:p.inFlight},void 0,!1),(0,P.jsxDEV)(HZ,{label:s("pools"),testId:"pools-count",value:p.pools.length},void 0,!1)]},void 0,!0),e[11]=p,e[12]=s,e[13]=x):x=e[13];let y;e[14]!==p?.pools.length||e[15]!==s?(y=p?.pools.length===0&&(0,P.jsxDEV)(co,{description:s("Pools created with createWorkpool appear here once they have activity."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7h16M4 12h16M4 17h16"},void 0,!1)},void 0,!1),testId:"pools-empty",title:s("No workpools.")},void 0,!1),e[14]=p?.pools.length,e[15]=s,e[16]=y):y=e[16];let b;e[17]!==p||e[18]!==s?(b=p!==void 0&&p.pools.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"pools-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:s("pool")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("queued")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("in flight")},void 0,!1),(0,P.jsxDEV)(Le,{children:s("max concurrency")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.pools.map(u1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[17]=p,e[18]=s,e[19]=b):b=e[19];let S;return e[20]!==v||e[21]!==x||e[22]!==y||e[23]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,x,y,b]},void 0,!0),e[20]=v,e[21]=x,e[22]=y,e[23]=b,e[24]=S):S=e[24],S},"SchedulerPoolsPanel");function c1t(t,e){return e.queued-t.queued}n(c1t,"_temp$4");function u1t(t){return(0,P.jsxDEV)(It,{"data-testid":`pools-row-${t.name}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.queued},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]},void 0,!0),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:t.maxConcurrency},void 0,!1)]},t.name,!0)}n(u1t,"_temp2$2");var d1t=["jobs","dead","pools","cron"],f1t=n(t=>{let e=(0,Yt.c)(41),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{loadCronJobs:r,scheduledCancel:a,scheduledLoad:s}=o,i=Ve(),[c,d]=(0,st.useState)("jobs"),f;e[2]!==i?(f=i("Cron triggers"),e[2]=i,e[3]=f):f=e[3];let p;e[4]!==i?(p=i("Dead letter"),e[4]=i,e[5]=p):p=e[5];let m;e[6]!==i?(m=i("Scheduled jobs"),e[6]=i,e[7]=m):m=e[7];let h;e[8]!==i?(h=i("Pools"),e[8]=i,e[9]=h):h=e[9];let v;e[10]!==f||e[11]!==p||e[12]!==m||e[13]!==h?(v={cron:f,dead:p,jobs:m,pools:h},e[10]=f,e[11]=p,e[12]=m,e[13]=h,e[14]=v):v=e[14];let x=v,y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n(D=>{d(D.currentTarget.dataset.view)},"t7"),e[15]=y):y=e[15];let b=y,S;e[16]!==i?(S=i("Schedule view"),e[16]=i,e[17]=S):S=e[17];let w;e[18]!==c||e[19]!==x?(w=d1t.map(D=>(0,P.jsxDEV)(dt,{"aria-selected":c===D,"data-testid":`schedule-view-${D}`,"data-view":D,onClick:b,role:"tab",size:"sm",type:"button",variant:c===D?"default":"outline",children:x[D]},D,!1)),e[18]=c,e[19]=x,e[20]=w):w=e[20];let C;e[21]!==S||e[22]!==w?(C=(0,P.jsxDEV)("div",{"aria-label":S,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:w},void 0,!1),e[21]=S,e[22]=w,e[23]=C):C=e[23];let F;e[24]!==a||e[25]!==s||e[26]!==c?(F=c==="jobs"&&(0,P.jsxDEV)(eTe,{cancelJob:a,loadJobs:s},void 0,!1),e[24]=a,e[25]=s,e[26]=c,e[27]=F):F=e[27];let T;e[28]!==c?(T=c==="dead"&&(0,P.jsxDEV)(s1t,{},void 0,!1),e[28]=c,e[29]=T):T=e[29];let E;e[30]!==c?(E=c==="pools"&&(0,P.jsxDEV)(l1t,{},void 0,!1),e[30]=c,e[31]=E):E=e[31];let k;e[32]!==r||e[33]!==c?(k=c==="cron"&&(0,P.jsxDEV)(n1t,{loadCronJobs:r},void 0,!1),e[32]=r,e[33]=c,e[34]=k):k=e[34];let O;return e[35]!==C||e[36]!==F||e[37]!==T||e[38]!==E||e[39]!==k?(O=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[C,F,T,E,k]},void 0,!0),e[35]=C,e[36]=F,e[37]=T,e[38]=E,e[39]=k,e[40]=O):O=e[40],O},"SchedulePanel"),MOe=80,p1t=n(t=>{if(t===void 0)return"";let e=JSON.stringify(t);return e.length>MOe?`${e.slice(0,MOe)}\u2026`:e},"formatArguments"),m1t=n(t=>{let e=[];for(let o of t){let r=o.id.toString();if(o.subscriptions.length===0){e.push({admin:o.admin,connectionId:o.id,key:`c${r}`,subscription:null});continue}o.subscriptions.forEach((a,s)=>{e.push({admin:o.admin,connectionId:o.id,key:`c${r}-s${s.toString()}`,subscription:a})})}return e},"toRows"),jZ=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),h1t=n(t=>{let e=(0,Yt.c)(20),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.listSubscriptions,d,f);us(h,!0);let v;if(e[5]!==m||e[6]!==p||e[7]!==a||e[8]!==r){let x=p===void 0?[]:m1t(p.connections),y;e[10]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"subs-shard-input",value:a},void 0,!1),e[10]=a,e[11]=y):y=e[11];let b;e[12]!==p||e[13]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} subscriptions",{count:p.totalSubscriptions})},void 0,!1)]},void 0,!0),e[12]=p,e[13]=r,e[14]=b):b=e[14];let S;e[15]!==y||e[16]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[15]=y,e[16]=b,e[17]=S):S=e[17];let w;e[18]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"subs-error",role:"alert",children:m},void 0,!1),e[18]=m,e[19]=w):w=e[19],v=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[S,w,m===null&&p!==void 0&&x.length===0&&(0,P.jsxDEV)(co,{description:r("Active WebSocket subscriptions on this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:r("No active subscriptions.")},void 0,!1),m===null&&x.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"subs-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Connection")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Function path")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(C=>{let{subscription:F}=C,T=p1t(F?.args);return(0,P.jsxDEV)(It,{"data-testid":"subs-row",children:[(0,P.jsxDEV)(Ne,{className:"font-medium tabular-nums",children:(0,P.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",C.connectionId,C.admin&&(0,P.jsxDEV)(Pt,{variant:"outline",children:r("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:F?.functionPath??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{children:F?.table??jZ},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:T||void 0,children:T||jZ},void 0,!1)]},C.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=m,e[6]=p,e[7]=a,e[8]=r,e[9]=v}else v=e[9];return v},"SubscriptionsPanel"),JOe=new Set(["active","trialing"]),g1t=new Set(["past_due","unpaid"]),Nl=n((t,e)=>{if(t[e]!==void 0)return t[e];let o=t.__doc__;if(typeof o=="string")try{let r=JSON.parse(o);if(r!==null&&typeof r=="object"&&!Array.isArray(r))return r[e]}catch{}},"readField"),Xf=n(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),v1t=n(t=>JOe.has(t)?"default":g1t.has(t)?"destructive":"outline","badgeVariant"),x1t=n(({limit:t=100})=>{let e=Ve(),o=_o(vt.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),r=_o(vt.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});us(()=>{o.refetch(),r.refetch()},!0);let a=o.data?.rows??[],s=r.data?.rows??[],i=o.error??r.error,c=a.filter(f=>JOe.has(Xf(Nl(f,"state")))).length,d=s.toSorted((f,p)=>Number(Nl(p,"processedAt")??0)-Number(Nl(f,"processedAt")??0));return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,P.jsxDEV)(Rt,{className:"justify-between gap-0 py-0",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Subscriptions")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:c},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"default",children:e("{count} active",{count:c})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,P.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:e("{total} total",{total:a.length})},void 0,!1)]},void 0,!0)},void 0,!1),i===null?void 0:(0,P.jsxDEV)("p",{className:"text-sm text-destructive",children:i},void 0,!1),a.length===0&&!o.isLoading?(0,P.jsxDEV)(co,{testId:"payments-empty",title:e("No subscriptions yet")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Provider")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Reference")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Plan")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("State")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(f=>{let p=Xf(Nl(f,"state"));return(0,P.jsxDEV)(It,{"data-testid":"payment-subscription-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"referenceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"priceId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:v1t(p),children:p},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"currentPeriodEnd"))},void 0,!1)]},Xf(Nl(f,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("Recent webhook events")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{children:(0,P.jsxDEV)(To,{children:d.map(f=>(0,P.jsxDEV)(It,{"data-testid":"payment-event-row",children:[(0,P.jsxDEV)(Ne,{children:Xf(Nl(f,"provider"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-medium",children:Xf(Nl(f,"type"))},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground",children:Xf(Nl(f,"providerEventId"))},void 0,!1),(0,P.jsxDEV)(Ne,{children:pn(Nl(f,"processedAt"))},void 0,!1)]},Xf(Nl(f,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel"),POe=["read","insert","update","delete"],y1t=n((t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],"operationLabel$1"),I1t=n(t=>{let e=new Set;for(let o of t?.advisories??[])if(o.name==="rls_uncovered_table"){let{table:r}=o.metadata;typeof r=="string"&&r!==""&&e.add(r)}return e},"uncoveredTables"),b1t=n((t,e,o)=>{let r=new Map,a=n(s=>{let i=r.get(s);if(i!==void 0)return i;let c={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:s,uncovered:o.has(s)};return r.set(s,c),c},"ensure");for(let s of t)a(s.table).cells[s.on]={procedure:s.procedure};for(let s of e){let i=a(s.table);i.maskedColumns.includes(s.column)||i.maskedColumns.push(s.column)}for(let s of o)a(s);return[...r.values()].toSorted((s,i)=>s.table.localeCompare(i.table))},"buildRows"),S1t=n(t=>{let e=(0,Yt.c)(16),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{onProbe:r}=o,a=Ve(),s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(s={},i={live:!0},e[2]=s,e[3]=i):(s=e[2],i=e[3]);let c=_o(vt.rlsPolicies,s,i),d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d={},e[4]=d):d=e[4];let f=_o(vt.maskPolicies,d),p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p={},e[5]=p):p=e[5];let m=_o(vt.getAdvisories,p),h;if(e[6]!==m.data||e[7]!==f.data||e[8]!==r||e[9]!==c||e[10]!==a){let v=null;c.data!==void 0&&(v=Array.isArray(c.data.policies)?c.data.policies:[]);let x=Array.isArray(f.data?.columns)?f.data.columns:[],y=m.data??null,{error:b,liveError:S}=c,w=v===null?[]:b1t(v,x,I1t(y)),C;e[12]!==S?(C=(0,P.jsxDEV)("div",{className:"flex items-center justify-end",children:(0,P.jsxDEV)(Rl,{message:S,prefix:"pm"},void 0,!1)},void 0,!1),e[12]=S,e[13]=C):C=e[13];let F;e[14]!==b?(F=b!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pm-error",role:"alert",children:b},void 0,!1),e[14]=b,e[15]=F):F=e[15],h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[C,F,v!==null&&w.length===0?(0,P.jsxDEV)(co,{description:a("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:a("No policy")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"pm-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:a("Table")},void 0,!1),POe.map(T=>(0,P.jsxDEV)(Le,{children:y1t(a,T)},T,!1)),(0,P.jsxDEV)(Le,{children:a("Masked columns")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:w.map(T=>(0,P.jsxDEV)(It,{"data-testid":`pm-row-${T.table}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:(0,P.jsxDEV)("span",{className:"flex items-center gap-1.5",children:[T.table,T.uncovered&&(0,P.jsxDEV)(Pt,{"data-testid":`pm-uncovered-${T.table}`,title:a("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:a("Uncovered \u2014 reachable without a policy")},void 0,!1)]},void 0,!0)},void 0,!1),POe.map(E=>{let k=T.cells[E];return(0,P.jsxDEV)(Ne,{"data-testid":`pm-cell-${T.table}-${E}`,children:k.procedure===void 0?(0,P.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:a("No policy")},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-col gap-1",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Covered by {procedure}",{procedure:k.procedure})},void 0,!1),r!==void 0&&(0,P.jsxDEV)(dt,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${T.table}-${E}`,onClick:n(()=>{r(T.table,E,k.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Probe this")},void 0,!1)]},void 0,!0)},E,!1)}),(0,P.jsxDEV)(Ne,{children:T.maskedColumns.length===0?(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,P.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:T.maskedColumns.map(w1t)},void 0,!1)},void 0,!1)]},T.table,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),e[6]=m.data,e[7]=f.data,e[8]=r,e[9]=c,e[10]=a,e[11]=h}else h=e[11];return h},"PermissionsMatrix");function w1t(t){return(0,P.jsxDEV)(Pt,{variant:"outline",children:t},t,!1)}n(w1t,"_temp$3");var C1t=ro(vt.runAs),F1t=n(()=>{let t=Wt();return async({args:e,functionPath:o,shardKey:r="",userId:a})=>{let s=C1t;try{return{kind:"allowed",value:await t.query(s,{args:e,functionPath:o,userId:a},lo(r))}}catch(i){return{kind:"denied",message:i instanceof Error?i.message:String(i)}}}},"useRunAsProbe"),R1t=n(t=>t===void 0?"undefined":JSON.stringify(t,null,2),"formatValue"),E1t=n(({functions:t,prefill:e,runAsIdentity:o=!1}={})=>{let r=Wt(),a=Ve(),s=F1t(),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),p=t??i??[],[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)("{}"),[y,b]=(0,st.useState)(""),[S,w]=(0,st.useState)(""),[C,F]=(0,st.useState)(!1),[T,E]=(0,st.useState)(null),[k,O]=(0,st.useState)(null),D=(0,st.useRef)(-1);(0,st.useEffect)(()=>{if(t!==void 0)return;let N=!1;return r.listFunctions().then(_=>(N||c(_),_)).catch(_=>{N||f(Jt(_))}),()=>{N=!0}},[r,t]),(0,st.useEffect)(()=>{if(e===void 0||D.current===e.nonce)return;D.current=e.nonce;let N=e.functionPath;queueMicrotask(()=>{h(N),E(null)})},[e]);let M=m===""?p[0]?.path??"":m,L=n(async()=>{if(M==="")return;let N;try{N=v.trim()===""?{}:JSON.parse(v)}catch(_){O(a("Invalid JSON args: {message}",{message:_.message})),E(null);return}O(null),F(!0);try{let _=await s({args:N,functionPath:M,shardKey:y.trim(),userId:S.trim()});E(_)}finally{F(!1)}},"run"),U=n(()=>{ot(L())},"runOnce"),W=n(N=>{h(N.target.value)},"onSelectChange"),V=n(N=>{x(N.target.value)},"onArgsChange"),j=n(N=>{w(N.target.value)},"onUserIdChange");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[d!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:d},void 0,!1),!o&&(0,P.jsxDEV)(co,{description:a("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:a("Set `runAsIdentity` to forge an identity and probe access.")},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-function",children:a("Function")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:W,value:M,children:p.map(N=>(0,P.jsxDEV)("option",{value:N.path,children:[N.path," (",N.kind,")"]},N.path,!0))},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-args",children:a("Arguments")},void 0,!1),(0,P.jsxDEV)(Ff,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:V,value:v},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Qr,{onChange:b,testId:"pp-shard",value:y},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[(0,P.jsxDEV)(Go,{htmlFor:"pp-user",children:a("Run as (userId)")},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":a("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:j,placeholder:a("Leave empty to run as admin"),value:S},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"pp-run",disabled:!o||C||M==="",onClick:U,type:"button",children:a(C?"Probing\u2026":"Run probe")},void 0,!1),S.trim()!==""&&(0,P.jsxDEV)(Pt,{"data-testid":"pp-as-badge",variant:"secondary",children:a("as {userId}",{userId:S.trim()})},void 0,!1)]},void 0,!0)]},void 0,!0),k!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:k},void 0,!1),T!==null&&T.kind==="allowed"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,P.jsxDEV)(Pt,{variant:"secondary",children:a("Allowed")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:R1t(T.value)},void 0,!1)]},void 0,!0),T!==null&&T.kind==="denied"&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,P.jsxDEV)(Pt,{variant:"destructive",children:a("Denied")},void 0,!1),(0,P.jsxDEV)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:T.message},void 0,!1)]},void 0,!0)]},void 0,!0)},"PermissionsPlayground"),A1t="/__lunora/policy-scaffold",T1t={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},k1t=n(async t=>{let e=await fetch(A1t,{body:JSON.stringify(t),headers:{"Content-Type":"application/json"},method:"POST"}),o=await e.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(e.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};let r=o.error;return{kind:"error",message:r===void 0?`policy scaffold failed (${String(e.status)})`:T1t[r]??r}},"applyPolicyScaffold"),OOe={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},M1t=n(()=>{let t=Ve(),[e,o]=(0,st.useState)(null),[r,a]=(0,st.useState)(!1),[s,i]=(0,st.useState)(null),[c,d]=(0,st.useState)(OOe),f=n(b=>{let S=b.target.name,{value:w}=b.target;d(C=>({...C,[S]:w}))},"onFieldChange"),p=n(()=>{o(null),d(OOe)},"reset"),m=n(async b=>{a(!0),i(null);try{let S=await k1t(b);i(S),S.kind==="ok"&&p()}catch(S){i({kind:"error",message:S instanceof Error?S.message:String(S)})}finally{a(!1)}},"submit"),h=n(()=>{ot(m({kind:"scaffoldPolicy",name:c.policyName.trim(),table:c.tableName.trim()}))},"onSubmitScaffold"),v=n(()=>{ot(m({exportName:c.exportName.trim(),filePath:c.filePath.trim(),kind:"wireRls",policies:c.policies.trim()}))},"onSubmitWire"),x=n(()=>{i(null),o("scaffold")},"openScaffold"),y=n(()=>{i(null),o("wire")},"openWire");return(0,P.jsxDEV)(Rt,{"data-testid":"policy-scaffolder",size:"sm",children:[(0,P.jsxDEV)(nu,{children:[(0,P.jsxDEV)(au,{children:t("Scaffold access rules")},void 0,!1),(0,P.jsxDEV)(Vg,{children:t("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Xt,{children:[(0,P.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:e==="scaffold"?"default":"outline",children:t("New policy file")},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-wire",onClick:y,size:"xs",type:"button",variant:e==="wire"?"default":"outline",children:t("Wire into a procedure")},void 0,!1)]},void 0,!0),e==="scaffold"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-name",children:t("Policy name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:f,value:c.policyName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-table",children:t("Table name")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:f,value:c.tableName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-create",disabled:r||c.policyName.trim()===""||c.tableName.trim()==="",onClick:h,size:"xs",type:"button",children:t(r?"Creating\u2026":"Create policy file")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),e==="wire"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-file",children:t("Procedure file path")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:f,value:c.filePath},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-export",children:t("Exported procedure")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:f,value:c.exportName},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,P.jsxDEV)(Go,{htmlFor:"policy-scaffolder-policies",children:t("Policy set identifier")},void 0,!1),(0,P.jsxDEV)(mo,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:f,value:c.policies},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"policy-scaffolder-apply",disabled:r||c.filePath.trim()===""||c.exportName.trim()===""||c.policies.trim()==="",onClick:v,size:"xs",type:"button",children:t(r?"Wiring\u2026":"Wire RLS")},void 0,!1),(0,P.jsxDEV)(dt,{onClick:p,size:"xs",type:"button",variant:"ghost",children:t("Cancel")},void 0,!1)]},void 0,!0),s?.kind==="error"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message},void 0,!1),s?.kind==="needs-manual-edit"&&(0,P.jsxDEV)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:t("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")},void 0,!1),s?.kind==="ok"&&(0,P.jsxDEV)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,P.jsxDEV)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:t("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})},void 0,!1),s.diagnostics.length>0&&(0,P.jsxDEV)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(b=>(0,P.jsxDEV)("li",{className:"font-mono text-[11px] text-destructive",children:b},b,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"PolicyScaffolder"),P1t=n(({functions:t,runAsIdentity:e=!1,schemaEditable:o=!1}={})=>{let r=Ve(),[a,s]=(0,st.useState)(void 0),i=n((c,d,f)=>{f!==""&&s(p=>({functionPath:f,nonce:(p?.nonce??0)+1}))},"onProbe");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Permissions")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(S1t,{onProbe:i},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3",children:(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:[(0,P.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Probe")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Xt,{className:"px-4 py-4",children:[(0,P.jsxDEV)("p",{className:"mb-3 text-sm text-muted-foreground",children:r("Pick a function and an identity, then run it to see the access outcome.")},void 0,!1),(0,P.jsxDEV)(E1t,{functions:t,prefill:a,runAsIdentity:e},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),o&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,P.jsxDEV)(M1t,{},void 0,!1)},void 0,!1)]},void 0,!0)},"PermissionsPanel"),O1t=n(()=>{let t=(0,Yt.c)(17),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.listQueues,o),s=r!==void 0,i;t[1]!==r?(i=Array.isArray(r?.queues)?[...r.queues].toSorted(N1t):[],t[1]=r,t[2]=i):i=t[2];let c=i,d;t[3]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"queues-error",role:"alert",children:a},void 0,!1),t[3]=a,t[4]=d):d=t[4];let f;t[5]!==e?(f=e("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),t[5]=e,t[6]=f):f=t[6];let p;t[7]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:f},void 0,!1),t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==c||t[11]!==e?(m=s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:e("No queues defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"queues-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Queue")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Mode")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(D1t)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[9]=s,t[10]=c,t[11]=e,t[12]=m):m=t[12];let h;return t[13]!==d||t[14]!==p||t[15]!==m?(h=(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[d,p,m]},void 0,!0),t[13]=d,t[14]=p,t[15]=m,t[16]=h):h=t[16],h},"QueuesPanel");function N1t(t,e){return t.exportName.localeCompare(e.exportName)}n(N1t,"_temp$2");function D1t(t){return(0,P.jsxDEV)(It,{"data-testid":`queues-row-${t.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.mode},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:t.deadLetterQueue??"\u2014"},void 0,!1)]},t.exportName,!0)}n(D1t,"_temp2$1");var _1t=ro(vt.runSql),L1t=n((t,e)=>{let o=Wt(),[r,a]=(0,st.useState)(void 0),[s,i]=(0,st.useState)(void 0),[c,d]=(0,st.useState)(!0),f=(0,st.useCallback)(async p=>{d(!0);try{let m=await o.query(_1t,{sql:t},lo(e));p.cancelled||(a(m),i(void 0))}catch(m){p.cancelled||(a(void 0),i(Jt(m)))}finally{p.cancelled||d(!1)}},[o,t,e]);return(0,st.useEffect)(()=>{let p={cancelled:!1};return ot(f(p)),()=>{p.cancelled=!0}},[f]),{error:s,loading:c,result:r}},"useRunSql"),B1t="lunora-studio-dashboards",qZ={shardKey:"",sql:"",title:""},V1t=n(t=>{let e=(0,Yt.c)(54),{onEdit:o,onRemove:r,widget:a}=t,s=Ve(),{error:i,loading:c,result:d}=L1t(a.sql,a.shardKey??""),f;e[0]!==o||e[1]!==a.id?(f=n(()=>{o(a.id)},"t1"),e[0]=o,e[1]=a.id,e[2]=f):f=e[2];let p=f,m;e[3]!==r||e[4]!==a.id?(m=n(()=>{r(a.id)},"t2"),e[3]=r,e[4]=a.id,e[5]=m):m=e[5];let h=m,v=`dashboards-widget-${a.id}`,x;e[6]!==a.title?(x=(0,P.jsxDEV)(au,{className:"min-w-0 truncate",title:a.title,children:a.title},void 0,!1),e[6]=a.title,e[7]=x):x=e[7];let y;e[8]!==s?(y=s("Edit widget"),e[8]=s,e[9]=y):y=e[9];let b=`dashboards-widget-edit-${a.id}`,S;e[10]!==s?(S=s("Edit widget"),e[10]=s,e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==p||e[14]!==y||e[15]!==b||e[16]!==S?(C=(0,P.jsxDEV)(dt,{"aria-label":y,"data-testid":b,onClick:p,size:"icon-xs",title:S,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=p,e[14]=y,e[15]=b,e[16]=S,e[17]=C):C=e[17];let F;e[18]!==s?(F=s("Remove widget"),e[18]=s,e[19]=F):F=e[19];let T=`dashboards-widget-remove-${a.id}`,E;e[20]!==s?(E=s("Remove widget"),e[20]=s,e[21]=E):E=e[21];let k;e[22]===Symbol.for("react.memo_cache_sentinel")?(k=(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=k):k=e[22];let O;e[23]!==h||e[24]!==F||e[25]!==T||e[26]!==E?(O=(0,P.jsxDEV)(dt,{"aria-label":F,"data-testid":T,onClick:h,size:"icon-xs",title:E,type:"button",variant:"ghost",children:k},void 0,!1),e[23]=h,e[24]=F,e[25]=T,e[26]=E,e[27]=O):O=e[27];let D;e[28]!==O||e[29]!==C?(D=(0,P.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,O]},void 0,!0),e[28]=O,e[29]=C,e[30]=D):D=e[30];let M;e[31]!==D||e[32]!==x?(M=(0,P.jsxDEV)(nu,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[x,D]},void 0,!0),e[31]=D,e[32]=x,e[33]=M):M=e[33];let L;e[34]!==i||e[35]!==a.id?(L=i!==void 0&&(0,P.jsxDEV)(vX,{className:"font-mono text-xs",testId:`dashboards-widget-error-${a.id}`,variant:"destructive",children:i},void 0,!1),e[34]=i,e[35]=a.id,e[36]=L):L=e[36];let U;e[37]!==i||e[38]!==c||e[39]!==d||e[40]!==s||e[41]!==a.id?(U=i===void 0&&c&&d===void 0&&(0,P.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${a.id}`,children:s("Running\u2026")},void 0,!1),e[37]=i,e[38]=c,e[39]=d,e[40]=s,e[41]=a.id,e[42]=U):U=e[42];let W;e[43]!==i||e[44]!==d?(W=i===void 0&&d!==void 0&&(0,P.jsxDEV)(gX,{result:d},void 0,!1),e[43]=i,e[44]=d,e[45]=W):W=e[45];let V;e[46]!==L||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(Xt,{className:"min-h-32 py-2",children:[L,U,W]},void 0,!0),e[46]=L,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;return e[50]!==M||e[51]!==V||e[52]!==v?(j=(0,P.jsxDEV)(Rt,{"data-testid":v,children:[M,V]},void 0,!0),e[50]=M,e[51]=V,e[52]=v,e[53]=j):j=e[53],j},"WidgetCard"),U1t=n(t=>{let e=(0,Yt.c)(58),{draft:o,editing:r,onCancel:a,onChange:s,onSubmit:i}=t,c=Ve(),d;e[0]!==o||e[1]!==s?(d=n(_=>{s({...o,title:_.target.value})},"t1"),e[0]=o,e[1]=s,e[2]=d):d=e[2];let f=d,p;e[3]!==o||e[4]!==s?(p=n(_=>{s({...o,sql:_.target.value})},"t2"),e[3]=o,e[4]=s,e[5]=p):p=e[5];let m=p,h;e[6]!==o||e[7]!==s?(h=n(_=>{s({...o,shardKey:_.target.value})},"t3"),e[6]=o,e[7]=s,e[8]=h):h=e[8];let v=h,x;e[9]!==i?(x=n(()=>{i()},"t4"),e[9]=i,e[10]=x):x=e[10];let y=x,b;e[11]!==o.sql||e[12]!==o.title?(b=o.title.trim()!==""&&o.sql.trim()!=="",e[11]=o.sql,e[12]=o.title,e[13]=b):b=e[13];let S=b,w;e[14]!==c?(w=c("Widget title"),e[14]=c,e[15]=w):w=e[15];let C;e[16]!==c?(C=c("Widget title"),e[16]=c,e[17]=C):C=e[17];let F;e[18]!==o.title||e[19]!==f||e[20]!==w||e[21]!==C?(F=(0,P.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:f,placeholder:C,type:"text",value:o.title},void 0,!1),e[18]=o.title,e[19]=f,e[20]=w,e[21]=C,e[22]=F):F=e[22];let T;e[23]!==c?(T=c("SQL query"),e[23]=c,e[24]=T):T=e[24];let E;e[25]!==o.sql||e[26]!==m||e[27]!==T?(E=(0,P.jsxDEV)("textarea",{"aria-label":T,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:m,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:o.sql},void 0,!1),e[25]=o.sql,e[26]=m,e[27]=T,e[28]=E):E=e[28];let k;e[29]!==c?(k=c("Shard key (optional)"),e[29]=c,e[30]=k):k=e[30];let O;e[31]!==c?(O=c("Shard key (optional)"),e[31]=c,e[32]=O):O=e[32];let D;e[33]!==o.shardKey||e[34]!==v||e[35]!==k||e[36]!==O?(D=(0,P.jsxDEV)("input",{"aria-label":k,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:v,placeholder:O,type:"text",value:o.shardKey},void 0,!1),e[33]=o.shardKey,e[34]=v,e[35]=k,e[36]=O,e[37]=D):D=e[37];let M;e[38]!==c?(M=c("Cancel"),e[38]=c,e[39]=M):M=e[39];let L;e[40]!==a||e[41]!==M?(L=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-cancel",onClick:a,size:"sm",type:"button",variant:"outline",children:M},void 0,!1),e[40]=a,e[41]=M,e[42]=L):L=e[42];let U=!S,W;e[43]!==r||e[44]!==c?(W=c(r?"Save widget":"Add widget"),e[43]=r,e[44]=c,e[45]=W):W=e[45];let V;e[46]!==y||e[47]!==U||e[48]!==W?(V=(0,P.jsxDEV)(dt,{"data-testid":"dashboards-form-save",disabled:U,onClick:y,size:"sm",type:"button",children:W},void 0,!1),e[46]=y,e[47]=U,e[48]=W,e[49]=V):V=e[49];let j;e[50]!==L||e[51]!==V?(j=(0,P.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L,V]},void 0,!0),e[50]=L,e[51]=V,e[52]=j):j=e[52];let N;return e[53]!==E||e[54]!==D||e[55]!==j||e[56]!==F?(N=(0,P.jsxDEV)(Rt,{"data-testid":"dashboards-form",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-3 py-4",children:[F,E,D,j]},void 0,!0)},void 0,!1),e[53]=E,e[54]=D,e[55]=j,e[56]=F,e[57]=N):N=e[57],N},"WidgetForm"),z1t=n(t=>{let e=(0,Yt.c)(39),{initialShardKey:o}=t,r=Ve(),[a,s]=rw(B1t),[i,c]=(0,st.useState)(qZ),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(!1),h;e[0]!==o?(h=n(()=>{f(null),c({...qZ,shardKey:o??""}),m(!0)},"t1"),e[0]=o,e[1]=h):h=e[1];let v=h,x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=n(()=>{m(!1),f(null),c(qZ)},"t2"),e[2]=x):x=e[2];let y=x,b;e[3]!==a?(b=n(W=>{let V=a.find(j=>j.id===W);V!==void 0&&(f(W),c({shardKey:V.shardKey??"",sql:V.sql,title:V.title}),m(!0))},"t3"),e[3]=a,e[4]=b):b=e[4];let S=b,w;e[5]!==s?(w=n(W=>{s(V=>V.filter(j=>j.id!==W))},"t4"),e[5]=s,e[6]=w):w=e[6];let C=w,F;e[7]!==i.shardKey||e[8]!==i.sql||e[9]!==i.title||e[10]!==d||e[11]!==s?(F=n(()=>{let W=i.title.trim(),V=i.sql.trim();if(W===""||V==="")return;let j=i.shardKey.trim();s(d===null?N=>[...N,{id:Y4("w"),shardKey:j,sql:V,title:W}]:N=>N.map(_=>_.id===d?{..._,shardKey:j,sql:V,title:W}:_)),y()},"t5"),e[7]=i.shardKey,e[8]=i.sql,e[9]=i.title,e[10]=d,e[11]=s,e[12]=F):F=e[12];let T=F,E;e[13]!==r?(E=r("Chart widgets backed by saved read-only SQL queries."),e[13]=r,e[14]=E):E=e[14];let k;e[15]!==E?(k=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:E},void 0,!1),e[15]=E,e[16]=k):k=e[16];let O;e[17]!==p||e[18]!==v||e[19]!==r?(O=!p&&(0,P.jsxDEV)(dt,{"data-testid":"dashboards-add",onClick:v,size:"sm",type:"button",children:r("Add widget")},void 0,!1),e[17]=p,e[18]=v,e[19]=r,e[20]=O):O=e[20];let D;e[21]!==k||e[22]!==O?(D=(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[k,O]},void 0,!0),e[21]=k,e[22]=O,e[23]=D):D=e[23];let M;e[24]!==i||e[25]!==d||e[26]!==p||e[27]!==T?(M=p&&(0,P.jsxDEV)(U1t,{draft:i,editing:d!==null,onCancel:y,onChange:c,onSubmit:T},void 0,!1),e[24]=i,e[25]=d,e[26]=p,e[27]=T,e[28]=M):M=e[28];let L;e[29]!==p||e[30]!==S||e[31]!==C||e[32]!==r||e[33]!==a?(L=a.length===0&&!p?(0,P.jsxDEV)(co,{description:r("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:r("No widgets yet")},void 0,!1):(0,P.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:a.map(W=>(0,P.jsxDEV)(V1t,{onEdit:S,onRemove:C,widget:W},W.id,!1))},void 0,!1),e[29]=p,e[30]=S,e[31]=C,e[32]=r,e[33]=a,e[34]=L):L=e[34];let U;return e[35]!==M||e[36]!==L||e[37]!==D?(U=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[D,M,L]},void 0,!0),e[35]=M,e[36]=L,e[37]=D,e[38]=U):U=e[38],U},"DashboardsPanel"),NOe=n(t=>`${t.toString()} ms`,"formatMs"),$1t=n(t=>t.totalConnections===0&&t.shapePoke.passes===0&&t.whisper.passes===0,"isFanoutIdle"),Ow=n(t=>{let e=(0,Yt.c)(8),{label:o,testId:r,value:a}=t,s;e[0]!==o?(s=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=s):s=e[1];let i;e[2]!==r||e[3]!==a?(i=(0,P.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":r,children:a},void 0,!1),e[2]=r,e[3]=a,e[4]=i):i=e[4];let c;return e[5]!==s||e[6]!==i?(c=(0,P.jsxDEV)(Rt,{className:"gap-0 py-0",children:(0,P.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[s,i]},void 0,!0)},void 0,!1),e[5]=s,e[6]=i,e[7]=c):c=e[7],c},"StatCard"),DOe=n(t=>{let e=(0,Yt.c)(48),{counters:o,includeTiming:r,prefix:a,t:s,title:i}=t,c=`${a}-section`,d;e[0]!==i?(d=(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:i},void 0,!1),e[0]=i,e[1]=d):d=e[1];let f=`${a}-stats`,p;e[2]!==s?(p=s("Passes"),e[2]=s,e[3]=p):p=e[3];let m=`${a}-passes`,h;e[4]!==o.passes||e[5]!==p||e[6]!==m?(h=(0,P.jsxDEV)(Ow,{label:p,testId:m,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=p,e[6]=m,e[7]=h):h=e[7];let v;e[8]!==s?(v=s("Sockets iterated"),e[8]=s,e[9]=v):v=e[9];let x=`${a}-iterated`,y;e[10]!==o.socketsIterated||e[11]!==v||e[12]!==x?(y=(0,P.jsxDEV)(Ow,{label:v,testId:x,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=v,e[12]=x,e[13]=y):y=e[13];let b;e[14]!==s?(b=s("Delivered"),e[14]=s,e[15]=b):b=e[15];let S=`${a}-delivered`,w;e[16]!==o.socketsDelivered||e[17]!==b||e[18]!==S?(w=(0,P.jsxDEV)(Ow,{label:b,testId:S,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=b,e[18]=S,e[19]=w):w=e[19];let C;e[20]!==s?(C=s("Peak width"),e[20]=s,e[21]=C):C=e[21];let F=`${a}-peak`,T;e[22]!==o.peakSocketsIterated||e[23]!==C||e[24]!==F?(T=(0,P.jsxDEV)(Ow,{label:C,testId:F,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=C,e[24]=F,e[25]=T):T=e[25];let E;e[26]!==o.totalMs||e[27]!==r||e[28]!==a||e[29]!==s?(E=r&&(0,P.jsxDEV)(Ow,{label:s("Total time"),testId:`${a}-total-ms`,value:NOe(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=r,e[28]=a,e[29]=s,e[30]=E):E=e[30];let k;e[31]!==o.maxMs||e[32]!==r||e[33]!==a||e[34]!==s?(k=r&&(0,P.jsxDEV)(Ow,{label:s("Max time"),testId:`${a}-max-ms`,value:NOe(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=r,e[33]=a,e[34]=s,e[35]=k):k=e[35];let O;e[36]!==w||e[37]!==T||e[38]!==E||e[39]!==k||e[40]!==f||e[41]!==h||e[42]!==y?(O=(0,P.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":f,children:[h,y,w,T,E,k]},void 0,!0),e[36]=w,e[37]=T,e[38]=E,e[39]=k,e[40]=f,e[41]=h,e[42]=y,e[43]=O):O=e[43];let D;return e[44]!==c||e[45]!==O||e[46]!==d?(D=(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":c,children:[d,O]},void 0,!0),e[44]=c,e[45]=O,e[46]=d,e[47]=D):D=e[47],D},"PathCounters"),H1t=n(t=>{let e=(0,Yt.c)(31),{initialShardKey:o}=t,r=Ve(),[a,s]=(0,st.useState)(o??""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=na(i,400),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let f;e[3]!==c?(f={keepPreviousData:!0,shardKey:c},e[3]=c,e[4]=f):f=e[4];let{data:p,error:m,refetch:h}=_o(vt.getFanoutMetrics,d,f);us(h,!0);let v;e[5]!==p?(v=p!==void 0&&$1t(p),e[5]=p,e[6]=v):v=e[6];let x=v,y;e[7]!==a?(y=(0,P.jsxDEV)(Qr,{onChange:s,testId:"fanout-shard-input",value:a},void 0,!1),e[7]=a,e[8]=y):y=e[8];let b;e[9]!==p||e[10]!==r?(b=p!==void 0&&(0,P.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[p.promoted&&(0,P.jsxDEV)(Pt,{"data-testid":"fanout-promoted",variant:p.relayCount>=p.maxRelays?"destructive":"default",children:p.relayCount>=p.maxRelays?r("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:p.maxRelays,relayCount:p.relayCount}):r("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:p.maxRelays,relayCount:p.relayCount})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("{count} connections",{count:p.totalConnections})},void 0,!1),(0,P.jsxDEV)(Pt,{variant:"secondary",children:r("peak {count} subscribers",{count:p.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=p,e[10]=r,e[11]=b):b=e[11];let S;e[12]!==y||e[13]!==b?(S=(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]},void 0,!0),e[12]=y,e[13]=b,e[14]=S):S=e[14];let w;e[15]!==m?(w=m!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"fanout-error",role:"alert",children:m},void 0,!1),e[15]=m,e[16]=w):w=e[16];let C;e[17]!==m||e[18]!==x||e[19]!==r?(C=m===null&&x&&(0,P.jsxDEV)(co,{description:r("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:r("No fan-out activity yet.")},void 0,!1),e[17]=m,e[18]=x,e[19]=r,e[20]=C):C=e[20];let F;e[21]!==m||e[22]!==x||e[23]!==p||e[24]!==r?(F=m===null&&p!==void 0&&!x&&(0,P.jsxDEV)(P.Fragment,{children:[p.topics.length>0&&(0,P.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:r("Hot topics")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"fanout-topics-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("Topic")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("Kind")},void 0,!1),(0,P.jsxDEV)(Le,{className:"text-right",children:r("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:p.topics.map(j1t)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,P.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:r("Fan-out cost since this instance woke")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:r,title:r("Shape pokes")},void 0,!1),(0,P.jsxDEV)(DOe,{counters:p.whisper,includeTiming:!1,prefix:"fanout-whisper",t:r,title:r("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[21]=m,e[22]=x,e[23]=p,e[24]=r,e[25]=F):F=e[25];let T;return e[26]!==F||e[27]!==S||e[28]!==w||e[29]!==C?(T=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[S,w,C,F]},void 0,!0),e[26]=F,e[27]=S,e[28]=w,e[29]=C,e[30]=T):T=e[30],T},"FanoutPanel");function j1t(t){return(0,P.jsxDEV)(It,{"data-testid":"fanout-topic-row",children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:t.topic},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"outline",children:t.kind},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right font-medium tabular-nums",children:t.subscribers},void 0,!1)]},`${t.kind}:${t.topic}`,!0)}n(j1t,"_temp$1");var q1t=n((t,e)=>({delete:t("Delete"),list:t("List"),read:t("Read"),write:t("Write")})[e],"operationLabel"),_Oe={delete:2,list:3,read:0,write:1},W1t=n(t=>[...t].toSorted((e,o)=>e.bucket.localeCompare(o.bucket)||_Oe[e.on]-_Oe[o.on]||(e.prefix??"").localeCompare(o.prefix??"")),"sortRules"),G1t=n(()=>{let t=(0,Yt.c)(12),e=Ve(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={},t[0]=o):o=t[0];let{data:r,error:a}=_o(vt.storageRules,o),s=r!==void 0,i;if(t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==e){let c=W1t(Array.isArray(r?.rules)?r.rules:[]),d;t[6]!==a?(d=a!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-rules-error",role:"alert",children:a},void 0,!1),t[6]=a,t[7]=d):d=t[7];let f;t[8]!==e?(f=e("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),t[8]=e,t[9]=f):f=t[9];let p;t[10]!==f?(p=(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:f},void 0,!1),t[10]=f,t[11]=p):p=t[11],i=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[d,p,s&&c.length===0?(0,P.jsxDEV)(co,{description:e("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:e("No storage rules defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"storage-rules-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Bucket")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Operation")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Key prefix")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(m=>(0,P.jsxDEV)(It,{"data-testid":`storage-rule-${m.bucket}-${m.on}-${m.prefix??""}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.bucket},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(Pt,{variant:"secondary",children:q1t(e,m.on)},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:m.prefix??(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:e("(whole bucket)")},void 0,!1)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:m.procedure},void 0,!1)]},`${m.bucket}:${m.on}:${m.prefix??""}:${m.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),t[1]=r,t[2]=a,t[3]=s,t[4]=e,t[5]=i}else i=t[5];return i},"StorageRulesPanel"),K1t=10,nV=n(t=>{let e=(0,Yt.c)(7),{label:o,value:r}=t,a;e[0]!==o?(a=(0,P.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:o},void 0,!1),e[0]=o,e[1]=a):a=e[1];let s=r??"\u2014",i;e[2]!==s?(i=(0,P.jsxDEV)("span",{className:"font-mono text-sm",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=(0,P.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[a,i]},void 0,!0),e[4]=a,e[5]=i,e[6]=c):c=e[6],c},"Detail"),Y1t=n(({loadIndexes:t,runQuery:e}={})=>{let o=Wt(),r=Ve(),[a,s]=(0,st.useState)(null),[i,c]=(0,st.useState)(null),[d,f]=(0,st.useState)(null),[p,m]=(0,st.useState)(""),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)(null),[b,S]=(0,st.useState)(!1);(0,st.useEffect)(()=>{let k={cancelled:!1};return ot((async()=>{try{let O=await(t??(()=>o.listVectorIndexes()))();k.cancelled||(s(O),c(null),f(D=>D??O[0]?.name??null))}catch(O){k.cancelled||(s(null),c(Jt(O)))}})()),()=>{k.cancelled=!0}},[o,t]);let w=a?.find(k=>k.name===d)??null,C=n(k=>{f(k.currentTarget.dataset.index??null),v(null),y(null)},"onSelect"),F=n(k=>{m(k.target.value)},"onQueryTextChange"),T=n(async()=>{let k=p.trim();if(!(d===null||k==="")){S(!0),y(null);try{let O=await(e??(D=>o.queryVectorIndex(D)))({name:d,text:k,topK:K1t});v(O)}catch(O){v(null),y(Jt(O))}finally{S(!1)}}},"search"),E=n(()=>{ot(T())},"onSearch");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[i!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:i},void 0,!1),a!==null&&a.length===0&&(0,P.jsxDEV)(co,{description:r("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,P.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:r("No vector indexes.")},void 0,!1),a!==null&&a.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("name")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("table")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("dimensions")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metric")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:a.map(k=>(0,P.jsxDEV)(It,{className:k.name===d?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":k.name,"data-testid":`vector-row-${k.name}`,onClick:C,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.table},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.dimensions??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{children:k.metric??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.vectorsCount??"\u2014"},void 0,!1)]},k.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),w!==null&&(0,P.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,P.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,P.jsxDEV)(nV,{label:r("field"),value:w.field},void 0,!1),(0,P.jsxDEV)(nV,{label:r("dimensions"),value:w.dimensions},void 0,!1),(0,P.jsxDEV)(nV,{label:r("metric"),value:w.metric},void 0,!1),(0,P.jsxDEV)(nV,{label:r("vectors"),value:w.vectorsCount},void 0,!1)]},void 0,!0),w.metadata!==void 0&&w.metadata.length>0&&(0,P.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[r("metadata"),": ",(0,P.jsxDEV)("span",{className:"font-mono",children:w.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)(mo,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:F,placeholder:r("Search by similarity\u2026"),value:p},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"vector-search",disabled:b||p.trim()==="",onClick:E,children:r(b?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),x!==null&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:x},void 0,!1),h!==null&&h.length===0&&(0,P.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:r("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,P.jsxDEV)(Rt,{className:"mt-3 overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"vector-matches",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:r("id")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("score")},void 0,!1),(0,P.jsxDEV)(Le,{children:r("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:h.map(k=>(0,P.jsxDEV)(It,{"data-testid":`vector-match-${k.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:k.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:k.score.toFixed(4)},void 0,!1),(0,P.jsxDEV)(Ne,{className:"max-w-md truncate font-mono text-xs",children:k.metadata===void 0?"\u2014":jr(k.metadata)},void 0,!1)]},k.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser"),X1t=["queued","running","paused","waiting","complete","errored","terminated"],Q1t=["pause","resume","terminate"],Z1t="WORKFLOWS_NOT_CONFIGURED",J1t=n(t=>typeof t=="object"&&t!==null&&t.code===Z1t,"isNotConfigured"),eSt=n(t=>{let e=t.error??t.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e)}catch{return"(unserializable)"}},"formatStepPayload"),tSt=n(({loadDetail:t,loadInstances:e,readOnly:o,runAction:r,workflowName:a})=>{let s=Wt(),i=Ve(),[c,d]=(0,st.useState)(null),[f,p]=(0,st.useState)(null),[m,h]=(0,st.useState)(""),[v,x]=(0,st.useState)(null),[y,b]=(0,st.useState)(!1),[S,w]=(0,st.useState)(null),C=t??(M=>s.getWorkflowInstance(M)),E=o?void 0:r??(e===void 0?M=>s.setWorkflowInstanceStatus(M):void 0),k=n(async()=>{x(null),b(!1);let M=m===""?void 0:m;try{if(e===void 0){let L=await s.listWorkflowInstances({name:a,status:M});if(L.configured===!1){d(null),b(!0);return}d(L.instances);return}d(await e({name:a,status:M}))}catch(L){d(null),J1t(L)?b(!0):x(Jt(L))}},"load");(0,st.useEffect)(()=>{p(null),ot(k())},[a,m]);let O=n(async M=>{x(null);try{p(await C({id:M,name:a}))}catch(L){x(Jt(L))}},"openDetail"),D=n(async(M,L)=>{if(E!==void 0){w(M),x(null);try{await E({action:L,id:M,name:a}),await k()}catch(U){x(Jt(U))}finally{w(null)}}},"act");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:i("Instance history")},void 0,!1),(0,P.jsxDEV)("select",{"aria-label":i("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(M=>{h(M.target.value)},"onChange"),value:m,children:[(0,P.jsxDEV)("option",{value:"",children:i("All statuses")},void 0,!1),X1t.map(M=>(0,P.jsxDEV)("option",{value:M,children:M},M,!1))]},void 0,!0)]},void 0,!0),v!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v},void 0,!1),y&&(0,P.jsxDEV)(co,{description:i("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:i("Workflow inspection not configured")},void 0,!1),!y&&c!==null&&c.length===0&&(0,P.jsxDEV)(co,{description:i("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:i("No instances")},void 0,!1),c!==null&&c.length>0&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Created")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Ended")},void 0,!1),(0,P.jsxDEV)(Le,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:c.map(M=>(0,P.jsxDEV)(It,{"data-testid":`workflow-instance-${M.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.createdOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.endedOn??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-right",children:(0,P.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-steps-${M.id}`,onClick:n(()=>{ot(O(M.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Steps")},void 0,!1),E!==void 0&&Q1t.map(L=>(0,P.jsxDEV)(dt,{"data-testid":`workflow-instance-${L}-${M.id}`,disabled:S===M.id,onClick:n(()=>{ot(D(M.id,L))},"onClick"),size:"sm",type:"button",variant:"ghost",children:i(L)},L,!1))]},void 0,!0)},void 0,!1)]},M.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),f!==null&&(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,P.jsxDEV)(Xt,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,P.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,P.jsxDEV)("span",{className:"font-mono text-xs",children:[i("Steps")," \xB7 ",f.id]},void 0,!0),(0,P.jsxDEV)(dt,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{p(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Close")},void 0,!1)]},void 0,!0),f.steps.length===0?(0,P.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:i("This instance has no recorded steps yet.")},void 0,!1):(0,P.jsxDEV)(Ao,{"data-testid":"workflow-instance-steps",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:i("Step")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Type")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Attempts")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Started")},void 0,!1),(0,P.jsxDEV)(Le,{children:i("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:f.steps.map((M,L)=>(0,P.jsxDEV)(It,{"data-testid":`workflow-step-${String(L)}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:M.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-xs text-muted-foreground",children:M.type??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"tabular-nums",children:M.attempts??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"text-muted-foreground tabular-nums",children:M.start??"\u2014"},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:eSt(M)},void 0,!1)]},`${M.name}:${String(L)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),oSt=ro(vt.createWorkflowInstance),rSt=ro(vt.getWorkflowInstanceStatus),nSt=n(t=>{if(t.error)return`${t.error.name}: ${t.error.message}`;if(t.output===void 0)return"\u2014";try{return JSON.stringify(t.output)}catch{return"(unserializable)"}},"formatPayload"),aSt=n(()=>{let t=Wt(),e=Ve(),{data:o,error:r}=_o(vt.listWorkflows,{}),[a,s]=(0,st.useState)(""),[i,c]=(0,st.useState)(""),[d,f]=(0,st.useState)(""),[p,m]=(0,st.useState)(!1),[h,v]=(0,st.useState)(null),[x,y]=(0,st.useState)([]),[b,S]=(0,st.useState)(null),w=o!==void 0,C=(0,st.useMemo)(()=>Array.isArray(o?.workflows)?[...o.workflows].toSorted((V,j)=>V.exportName.localeCompare(j.exportName)):[],[o]),F=(0,st.useMemo)(()=>C.some(V=>V.exportName===a)?a:C[0]?.exportName??"",[C,a]),T=(0,st.useMemo)(()=>C.find(V=>V.exportName===F),[C,F]),E=n(V=>{y(j=>{let N=j.filter(_=>!(_.exportName===V.exportName&&_.id===V.id));return[V,...N]})},"upsertInstance"),k=n(async()=>{let V=F;if(V==="")return;let j,N=d.trim();if(N!=="")try{j=JSON.parse(N)}catch{v(e("Params must be valid JSON"));return}m(!0),v(null);try{let _=i.trim(),B=await t.query(oSt,{exportName:V,id:_===""?void 0:_,params:j},lo(""));E({exportName:V,id:B.id,status:B.status}),c("")}catch(_){v(Jt(_))}finally{m(!1)}},"start"),O=n(()=>{ot(k())},"startInstance"),D=n(async(V,j)=>{S(j);try{let N=await t.query(rSt,{exportName:V,id:j},lo(""));E({error:N.error,exportName:V,id:N.id,output:N.output,status:N.status})}catch(N){v(Jt(N))}finally{S(null)}},"refreshInstance"),M=n(V=>{s(V.target.value)},"onSelectedExportChange"),L=n(V=>{c(V.target.value)},"onInstanceIdChange"),U=n(V=>{f(V.target.value)},"onParamsChange"),W=n(V=>{let{export:j,id:N}=V.currentTarget.dataset;j!==void 0&&N!==void 0&&ot(D(j,N))},"onRefreshClick");return(0,P.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[r!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:r},void 0,!1),(0,P.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),w&&C.length===0?(0,P.jsxDEV)(co,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")},void 0,!1):(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Export")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Name")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Class")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:C.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-row-${V.exportName}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.name},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.className},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.binding},void 0,!1)]},V.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),C.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Start instance")},void 0,!1),h!==null&&(0,P.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:h},void 0,!1),(0,P.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,P.jsxDEV)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:M,value:F,children:C.map(V=>(0,P.jsxDEV)("option",{value:V.exportName,children:V.exportName},V.exportName,!1))},void 0,!1),(0,P.jsxDEV)(mo,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:L,placeholder:e("Instance id (optional)"),value:i},void 0,!1),(0,P.jsxDEV)(dt,{"data-testid":"workflows-start-button",disabled:p||F==="",onClick:O,children:e(p?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Ff,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:U,placeholder:e("Params (JSON, optional)"),value:d},void 0,!1)]},void 0,!0),x.length>0&&(0,P.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,P.jsxDEV)("h3",{className:"text-sm font-medium",children:e("Instances")},void 0,!1),(0,P.jsxDEV)(Rt,{className:"overflow-hidden py-0",children:(0,P.jsxDEV)(Xt,{className:"px-0",children:(0,P.jsxDEV)(Ao,{"data-testid":"workflows-instances-table",children:[(0,P.jsxDEV)(No,{children:(0,P.jsxDEV)(It,{children:[(0,P.jsxDEV)(Le,{children:e("Workflow")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Instance id")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Status")},void 0,!1),(0,P.jsxDEV)(Le,{children:e("Output")},void 0,!1),(0,P.jsxDEV)(Le,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,P.jsxDEV)(To,{children:x.map(V=>(0,P.jsxDEV)(It,{"data-testid":`workflows-instance-${V.id}`,children:[(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.exportName},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:V.id},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs",children:V.status},void 0,!1),(0,P.jsxDEV)(Ne,{className:"font-mono text-xs text-muted-foreground",children:nSt(V)},void 0,!1),(0,P.jsxDEV)(Ne,{children:(0,P.jsxDEV)(dt,{"data-export":V.exportName,"data-id":V.id,"data-testid":`workflows-instance-refresh-${V.id}`,disabled:b===V.id,onClick:W,size:"xs",variant:"outline",children:b===V.id?e("Refreshing\u2026"):e("Refresh")},void 0,!1)},void 0,!1)]},`${V.exportName}:${V.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),T!==void 0&&(0,P.jsxDEV)(tSt,{workflowName:T.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel"),sSt=ro(vt.studioFeatures),eNe={flags:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},iSt=n(t=>{if(t===null||typeof t!="object")return eNe;let e=t,o=n(r=>typeof e[r]=="boolean"?e[r]:!0,"flag");return{flags:o("flags"),mail:o("mail"),payments:o("payments"),queues:o("queues"),scheduler:o("scheduler"),storage:o("storage"),vectors:o("vectors"),workflows:o("workflows")}},"coerceFeatures"),lSt=n(()=>{let t=(0,Yt.c)(3),e=Wt(),[o,r]=(0,st.useState)(eNe),a,s;return t[0]!==e?(a=n(()=>{ot((async()=>{try{r(iSt(await e.query(sSt,{},lo(""))))}catch{}})())},"t0"),s=[e],t[0]=e,t[1]=a,t[2]=s):(a=t[1],s=t[2]),(0,st.useEffect)(a,s),o},"useStudioFeatures"),tNe=(0,st.createContext)(null),cSt={analytics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),api:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4M13 5l-2 14"},void 0,!1),audit:(0,P.jsxDEV)("path",{d:"M7 4h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Zm6 0v5h5M9 13h6M9 16h6M9 10h2"},void 0,!1),authConfig:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6h-3.6l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),authSessions:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),dashboards:(0,P.jsxDEV)("path",{d:"M4 5h7v6H4V5Zm9 0h7v4h-7V5ZM4 14h7v5H4v-5Zm9-1h7v6h-7v-6Z"},void 0,!1),drains:(0,P.jsxDEV)("path",{d:"M5 5h14M7 5v6a5 5 0 0 0 10 0V5M10 16h4v3h-4zM12 19v2"},void 0,!1),data:(0,P.jsxDEV)("path",{d:"M5 6c0-1.4 3.1-2.5 7-2.5s7 1.1 7 2.5-3.1 2.5-7 2.5S5 7.4 5 6Zm0 0v12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5V6M5 12c0 1.4 3.1 2.5 7 2.5s7-1.1 7-2.5"},void 0,!1),export:(0,P.jsxDEV)("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"},void 0,!1),fanout:(0,P.jsxDEV)("path",{d:"M12 5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm-7 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm14 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM12 7v3.5M12 10.5 6 17m6-6.5 6 6.5"},void 0,!1),files:(0,P.jsxDEV)("path",{d:"M4 7a2 2 0 0 1 2-2h3l2 2.5h7a2 2 0 0 1 2 2V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7Z"},void 0,!1),flags:(0,P.jsxDEV)("path",{d:"M6 21V4m0 0h11l-2 3 2 3H6"},void 0,!1),functions:(0,P.jsxDEV)("path",{d:"m9 8-4 4 4 4m6-8 4 4-4 4"},void 0,!1),health:(0,P.jsxDEV)("path",{d:"M3 12h4l2 6 4-14 2 8h6"},void 0,!1),home:(0,P.jsxDEV)("path",{d:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9"},void 0,!1),insights:(0,P.jsxDEV)("path",{d:"M12 3a6 6 0 0 0-3.6 10.8c.5.4.8.9.9 1.5l.2 1.2h5l.2-1.2c.1-.6.4-1.1.9-1.5A6 6 0 0 0 12 3ZM9.5 20.5h5M10 18h4"},void 0,!1),logs:(0,P.jsxDEV)("path",{d:"M5 6h14M5 10h14M5 14h9M5 18h11"},void 0,!1),mail:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 1.5 8 6 8-6"},void 0,!1),payments:(0,P.jsxDEV)("path",{d:"M3 7h18v10H3V7Zm0 3h18M7 14h4"},void 0,!1),metrics:(0,P.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1),migrations:(0,P.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1),organizations:(0,P.jsxDEV)("path",{d:"M3 21V8l6-4 6 4v13M9 21v-5h2v5M15 11h6v10M18 14v.01M18 17v.01M6 9v.01M6 12v.01M6 15v.01"},void 0,!1),permissions:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-3 8 2.2 2.2L15 9.5M8.5 16h7"},void 0,!1),pitr:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0-9-9M12 7.5V12l3 2M3 12l-2-2m2 2 2-2"},void 0,!1),queues:(0,P.jsxDEV)("path",{d:"M4 6h16M4 10h16M4 14h10M4 18h10m4-2 3 2-3 2v-4Z"},void 0,!1),realtime:(0,P.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1),rls:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3ZM8.5 10h7M8.5 13h7"},void 0,!1),schedule:(0,P.jsxDEV)("path",{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l4 2"},void 0,!1),schema:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"},void 0,!1),sql:(0,P.jsxDEV)("path",{d:"M4 5h16v14H4V5Zm3 4 3 3-3 3m6 0h4"},void 0,!1),storageRules:(0,P.jsxDEV)("path",{d:"M7 10V7a5 5 0 0 1 10 0v3m-11 0h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1Zm6 4v2"},void 0,!1),security:(0,P.jsxDEV)("path",{d:"M12 3 5 6v5c0 4.5 3 7.8 7 9 4-1.2 7-4.5 7-9V6l-7-3Zm-2.5 8.5 2 2 4-4"},void 0,!1),settings:(0,P.jsxDEV)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm7.4-3a7.4 7.4 0 0 0-.1-1.2l2-1.6-2-3.4-2.4 1a7.3 7.3 0 0 0-2-1.2l-.4-2.6H10.5l-.4 2.6a7.3 7.3 0 0 0-2 1.2l-2.4-1-2 3.4 2 1.6a7.4 7.4 0 0 0 0 2.4l-2 1.6 2 3.4 2.4-1a7.3 7.3 0 0 0 2 1.2l.4 2.6h3.6l.4-2.6a7.3 7.3 0 0 0 2-1.2l2.4 1 2-3.4-2-1.6a7.4 7.4 0 0 0 .1-1.2Z"},void 0,!1),users:(0,P.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85M16 3.13A4 4 0 0 1 16 11"},void 0,!1),vectors:(0,P.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1),workflows:(0,P.jsxDEV)("path",{d:"M5 5h5v5H5V5Zm9 9h5v5h-5v-5ZM7.5 10v2a2 2 0 0 0 2 2H14m2.5-4V8a2 2 0 0 0-2-2H10"},void 0,!1)},LOe=[{key:"overview",tabs:["home","dashboards"]},{key:"database",tabs:["data","sql","schema","migrations","vectors","pitr","export"]},{key:"functions",tabs:["functions","api","workflows","queues"]},{key:"auth",tabs:["users","organizations","authSessions","authConfig"]},{key:"storage",tabs:["files","storageRules"]},{key:"observability",tabs:["logs","audit","realtime","fanout","metrics","analytics","health"]},{key:"advisors",tabs:["security","rls","permissions","insights"]},{key:"operations",tabs:["schedule","mail","drains","payments","flags"]},{key:"settings",tabs:["settings"]}],uSt={files:"storage",flags:"flags",mail:"mail",payments:"payments",queues:"queues",schedule:"scheduler",storageRules:"storage",vectors:"vectors",workflows:"workflows"},BOe=n((t,e)=>{let o=uSt[t];return o===void 0||e[o]},"isTabVisible"),WZ=n(t=>{let e=(0,Yt.c)(2),{tab:o}=t,r=cSt[o],a;return e[0]!==r?(a=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 shrink-0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r},void 0,!1),e[0]=r,e[1]=a):a=e[1],a},"TabIcon"),oNe=["home","data","sql","functions","api","workflows","queues","schema","migrations","vectors","export","pitr","users","organizations","authSessions","authConfig","files","storageRules","dashboards","metrics","analytics","health","security","rls","permissions","insights","logs","realtime","mail","payments","audit","schedule","drains","flags","settings"],dSt=new Set(["api","data","sql"]),fSt=n(t=>{let e=t.split("/").findLast(Boolean)??"";return oNe.includes(e)?e:"home"},"tabFromPathname"),pSt=n(t=>{let e=(0,Yt.c)(19),{chrome:o,connected:r}=t,a=Ve(),s;e[0]!==a?(s=a("admin token"),e[0]=a,e[1]=s):s=e[1];let i;e[2]!==s?(i=(0,P.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"dash-app-token",children:s},void 0,!1),e[2]=s,e[3]=i):i=e[3];let c;e[4]!==o.onTokenChange||e[5]!==o.token?(c=(0,P.jsxDEV)(mo,{className:"h-8","data-testid":"dash-app-token",id:"dash-app-token",onChange:o.onTokenChange,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:o.token},void 0,!1),e[4]=o.onTokenChange,e[5]=o.token,e[6]=c):c=e[6];let d;e[7]!==r||e[8]!==a?(d=r&&(0,P.jsxDEV)("p",{className:"flex items-start gap-1.5 text-[11px] text-muted-foreground","data-testid":"dash-app-token-warning",role:"note",children:[(0,P.jsxDEV)("span",{"aria-hidden":"true",className:"text-warning",children:"\u26A0"},void 0,!1),a("Token rides the WebSocket URL \u2014 it can surface in browser DevTools and server logs. Use a dev-only token.")]},void 0,!0),e[7]=r,e[8]=a,e[9]=d):d=e[9];let f;e[10]!==o.clearToken||e[11]!==r||e[12]!==a?(f=r&&(0,P.jsxDEV)("button",{className:"self-start rounded-md border border-border px-2.5 py-1 text-xs font-medium outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"dash-app-clear-token",onClick:o.clearToken,type:"button",children:a("Clear")},void 0,!1),e[10]=o.clearToken,e[11]=r,e[12]=a,e[13]=f):f=e[13];let p;return e[14]!==i||e[15]!==c||e[16]!==d||e[17]!==f?(p=(0,P.jsxDEV)("div",{className:"flex flex-col gap-2",children:[i,c,d,f]},void 0,!0),e[14]=i,e[15]=c,e[16]=d,e[17]=f,e[18]=p):p=e[18],p},"ConnectPopoverContent"),mSt=n(t=>{let e=(0,Yt.c)(25),{current:o,group:r,groupLabel:a,selectTab:s,tabDescription:i,tabLabel:c}=t,d=r.tabs.includes(o)?"page":void 0,f=a[r.key],p=r.tabs[0],m;e[0]!==p?(m=(0,P.jsxDEV)(WZ,{tab:p},void 0,!1),e[0]=p,e[1]=m):m=e[1];let h;e[2]!==d||e[3]!==f||e[4]!==m?(h=(0,P.jsxDEV)(KOe,{"aria-current":d,"aria-label":f,className:"mx-auto flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent data-[popup-open]:bg-sidebar-accent data-[popup-open]:text-sidebar-accent-foreground data-[popup-open]:shadow-xs aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground aria-[current=page]:shadow-xs",delay:120,openOnHover:!0,children:m},void 0,!1),e[2]=d,e[3]=f,e[4]=m,e[5]=h):h=e[5];let v=a[r.key],x;e[6]!==v?(x=(0,P.jsxDEV)("div",{className:"px-2 py-1.5 text-[11px] font-medium tracking-wider text-muted-foreground uppercase",children:v},void 0,!1),e[6]=v,e[7]=x):x=e[7];let y;if(e[8]!==o||e[9]!==r.tabs||e[10]!==s||e[11]!==i||e[12]!==c){let w;e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(w=n(C=>(0,P.jsxDEV)("button",{"aria-current":o===C?"page":void 0,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent aria-[current=page]:font-medium [&_svg]:opacity-70 aria-[current=page]:[&_svg]:opacity-100","data-tab":C,"data-testid":`dash-tab-${C}`,onClick:s,title:i[C],type:"button",children:[(0,P.jsxDEV)(WZ,{tab:C},void 0,!1),(0,P.jsxDEV)("span",{children:c[C]},void 0,!1)]},C,!0),"t92"),e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=w):w=e[18],y=r.tabs.map(w),e[8]=o,e[9]=r.tabs,e[10]=s,e[11]=i,e[12]=c,e[13]=y}else y=e[13];let b;e[19]!==x||e[20]!==y?(b=(0,P.jsxDEV)(YOe,{align:"start",className:"w-56 p-1",side:"right",sideOffset:8,children:[x,y]},void 0,!0),e[19]=x,e[20]=y,e[21]=b):b=e[21];let S;return e[22]!==h||e[23]!==b?(S=(0,P.jsxDEV)(GOe,{children:[h,b]},void 0,!0),e[22]=h,e[23]=b,e[24]=S):S=e[24],S},"CollapsedGroupNav"),hSt=n(t=>{let e=(0,Yt.c)(45),{chrome:o,collapsed:r,connected:a}=t,s=Ve();if(o===null){let C;e[0]!==s?(C=s("Admin"),e[0]=s,e[1]=C):C=e[1];let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=(0,P.jsxDEV)("span",{className:"flex size-8 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:"C"},void 0,!1),e[2]=F):F=e[2];let T;e[3]!==s?(T=s("Admin"),e[3]=s,e[4]=T):T=e[4];let E;e[5]!==T?(E=(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:T},void 0,!1),e[5]=T,e[6]=E):E=e[6];let k;e[7]!==s?(k=s("Studio"),e[7]=s,e[8]=k):k=e[8];let O;e[9]!==k?(O=(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:k},void 0,!1),e[9]=k,e[10]=O):O=e[10];let D;e[11]!==E||e[12]!==O?(D=(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[E,O]},void 0,!0),e[11]=E,e[12]=O,e[13]=D):D=e[13];let M;return e[14]!==C||e[15]!==D?(M=(0,P.jsxDEV)(QOe,{className:"data-active:bg-transparent",size:"lg",tooltip:C,children:[F,D]},void 0,!0),e[14]=C,e[15]=D,e[16]=M):M=e[16],M}let i=r?"mx-auto size-8 justify-center":"w-full p-2",c;e[17]!==i?(c=tt("flex items-center gap-2 rounded-md text-start outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",i),e[17]=i,e[18]=c):c=e[18];let d;e[19]!==a||e[20]!==s?(d=s(a?"Connected":"Not connected"),e[19]=a,e[20]=s,e[21]=d):d=e[21];let f=a?"bg-success":"bg-muted-foreground/50",p;e[22]!==f?(p=tt("absolute -end-0.5 -bottom-0.5 size-2.5 rounded-full border-2 border-sidebar",f),e[22]=f,e[23]=p):p=e[23];let m;e[24]!==p?(m=(0,P.jsxDEV)("span",{className:"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-sidebar-accent text-[11px] font-medium",children:["C",(0,P.jsxDEV)("span",{"aria-hidden":"true",className:p},void 0,!1)]},void 0,!0),e[24]=p,e[25]=m):m=e[25];let h;e[26]!==r||e[27]!==a||e[28]!==s?(h=!r&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 text-start leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-[13px] font-medium",children:s("Admin")},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:s(a?"Connected":"Not connected")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m8 9 4-4 4 4M8 15l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1)]},void 0,!0),e[26]=r,e[27]=a,e[28]=s,e[29]=h):h=e[29];let v;e[30]!==c||e[31]!==d||e[32]!==m||e[33]!==h?(v=(0,P.jsxDEV)(KOe,{className:c,"data-testid":"dash-app-connect",title:d,children:[m,h]},void 0,!0),e[30]=c,e[31]=d,e[32]=m,e[33]=h,e[34]=v):v=e[34];let x=r?"end":"start",y=r?"right":"top",b;e[35]!==o||e[36]!==a?(b=(0,P.jsxDEV)(pSt,{chrome:o,connected:a},void 0,!1),e[35]=o,e[36]=a,e[37]=b):b=e[37];let S;e[38]!==y||e[39]!==b||e[40]!==x?(S=(0,P.jsxDEV)(YOe,{align:x,keepMounted:!0,side:y,children:b},void 0,!1),e[38]=y,e[39]=b,e[40]=x,e[41]=S):S=e[41];let w;return e[42]!==S||e[43]!==v?(w=(0,P.jsxDEV)(GOe,{children:[v,S]},void 0,!0),e[42]=S,e[43]=v,e[44]=w):w=e[44],w},"SidebarFooterProfile"),gSt=n(t=>{let e=(0,Yt.c)(28),{chrome:o,connected:r,current:a,groupLabel:s,groups:i,selectTab:c,tabDescription:d,tabLabel:f}=t,p=Ve(),{state:m}=sV(),h=m==="collapsed",v=h&&"justify-center px-0",x;e[0]!==v?(x=tt("flex items-center gap-2.5 px-1.5 py-1",v),e[0]=v,e[1]=x):x=e[1];let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=(0,P.jsxDEV)(GZ,{className:"size-9 shrink-0 text-foreground"},void 0,!1),e[2]=y):y=e[2];let b;e[3]!==h||e[4]!==r||e[5]!==p?(b=!h&&(0,P.jsxDEV)(P.Fragment,{children:[(0,P.jsxDEV)("span",{className:"grid flex-1 leading-tight",children:[(0,P.jsxDEV)("span",{className:"truncate text-sm font-semibold text-foreground",children:"lunora"},void 0,!1),(0,P.jsxDEV)("span",{className:"truncate text-[11px] text-muted-foreground",children:p("Studio")},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Pt,{className:"px-1.5 text-[10px] tracking-wider uppercase",variant:"secondary",children:p(r?"Live":"Local")},void 0,!1)]},void 0,!0),e[3]=h,e[4]=r,e[5]=p,e[6]=b):b=e[6];let S;e[7]!==x||e[8]!==b?(S=(0,P.jsxDEV)(pbt,{children:(0,P.jsxDEV)("div",{className:x,children:[y,b]},void 0,!0)},void 0,!1),e[7]=x,e[8]=b,e[9]=S):S=e[9];let w;e[10]!==h||e[11]!==a||e[12]!==s||e[13]!==i||e[14]!==c||e[15]!==d||e[16]!==f?(w=h?i.map(E=>(0,P.jsxDEV)(mSt,{current:a,group:E,groupLabel:s,selectTab:c,tabDescription:d,tabLabel:f},E.key,!1)):i.map(E=>(0,P.jsxDEV)(gbt,{children:[(0,P.jsxDEV)(vbt,{className:"text-[11px] font-medium tracking-wider uppercase",children:s[E.key]},void 0,!1),(0,P.jsxDEV)(xbt,{children:(0,P.jsxDEV)(FOe,{children:E.tabs.map(k=>(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(QOe,{className:"data-active:text-foreground dark:data-active:text-royal-amethyst data-active:shadow-[inset_2px_0_0_0_var(--royal-amethyst)]","data-tab":k,"data-testid":`dash-tab-${k}`,isActive:a===k,onClick:c,title:d[k],tooltip:d[k],children:[(0,P.jsxDEV)(WZ,{tab:k},void 0,!1),(0,P.jsxDEV)("span",{children:f[k]},void 0,!1)]},void 0,!0)},k,!1))},void 0,!1)},void 0,!1)]},E.key,!0)),e[10]=h,e[11]=a,e[12]=s,e[13]=i,e[14]=c,e[15]=d,e[16]=f,e[17]=w):w=e[17];let C;e[18]!==w?(C=(0,P.jsxDEV)(hbt,{children:w},void 0,!1),e[18]=w,e[19]=C):C=e[19];let F;e[20]!==o||e[21]!==h||e[22]!==r?(F=(0,P.jsxDEV)(mbt,{children:(0,P.jsxDEV)(FOe,{children:(0,P.jsxDEV)(ROe,{children:(0,P.jsxDEV)(hSt,{chrome:o,collapsed:h,connected:r},void 0,!1)},void 0,!1)},void 0,!1)},void 0,!1),e[20]=o,e[21]=h,e[22]=r,e[23]=F):F=e[23];let T;return e[24]!==S||e[25]!==C||e[26]!==F?(T=(0,P.jsxDEV)(ubt,{collapsible:"icon",variant:"inset",children:[S,C,F]},void 0,!0),e[24]=S,e[25]=C,e[26]=F,e[27]=T):T=e[27],T},"StudioSidebar"),vSt=n(()=>{let t=(0,Yt.c)(282),e=Ve(),o=zs(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={select:wSt},t[0]=r):r=t[0];let a=J$(r),s,i;t[1]!==a?(s=fSt(a),i=dSt.has(s),t[1]=a,t[2]=s,t[3]=i):(s=t[2],i=t[3]);let c=i,d=lSt(),f;t[4]!==d?(f=n(al=>({...al,tabs:al.tabs.filter(tp=>BOe(tp,d))}),"t2"),t[4]=d,t[5]=f):f=t[5];let p=LOe.map(f).filter(CSt),m,h;t[6]!==s||t[7]!==d||t[8]!==o?(m=n(()=>{BOe(s,d)||ot(o({replace:!0,to:"/home"}))},"t3"),h=[s,d,o],t[6]=s,t[7]=d,t[8]=o,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,st.useEffect)(m,h);let v;t[11]!==e?(v=e("Analytics"),t[11]=e,t[12]=v):v=t[12];let x;t[13]!==e?(x=e("API"),t[13]=e,t[14]=x):x=t[14];let y;t[15]!==e?(y=e("Audit"),t[15]=e,t[16]=y):y=t[16];let b;t[17]!==e?(b=e("Configuration"),t[17]=e,t[18]=b):b=t[18];let S;t[19]!==e?(S=e("Sessions"),t[19]=e,t[20]=S):S=t[20];let w;t[21]!==e?(w=e("Dashboards"),t[21]=e,t[22]=w):w=t[22];let C;t[23]!==e?(C=e("Data"),t[23]=e,t[24]=C):C=t[24];let F;t[25]!==e?(F=e("Log drains"),t[25]=e,t[26]=F):F=t[26];let T;t[27]!==e?(T=e("Export / Import"),t[27]=e,t[28]=T):T=t[28];let E;t[29]!==e?(E=e("Fan-out"),t[29]=e,t[30]=E):E=t[30];let k;t[31]!==e?(k=e("Files"),t[31]=e,t[32]=k):k=t[32];let O;t[33]!==e?(O=e("Flags"),t[33]=e,t[34]=O):O=t[34];let D;t[35]!==e?(D=e("Functions"),t[35]=e,t[36]=D):D=t[36];let M;t[37]!==e?(M=e("Health"),t[37]=e,t[38]=M):M=t[38];let L;t[39]!==e?(L=e("Home"),t[39]=e,t[40]=L):L=t[40];let U;t[41]!==e?(U=e("Performance"),t[41]=e,t[42]=U):U=t[42];let W;t[43]!==e?(W=e("Logs"),t[43]=e,t[44]=W):W=t[44];let V;t[45]!==e?(V=e("Metrics"),t[45]=e,t[46]=V):V=t[46];let j;t[47]!==e?(j=e("Migrations"),t[47]=e,t[48]=j):j=t[48];let N;t[49]!==e?(N=e("Organizations"),t[49]=e,t[50]=N):N=t[50];let _;t[51]!==e?(_=e("Time Travel"),t[51]=e,t[52]=_):_=t[52];let B;t[53]!==e?(B=e("Mail"),t[53]=e,t[54]=B):B=t[54];let z;t[55]!==e?(z=e("Payments"),t[55]=e,t[56]=z):z=t[56];let q;t[57]!==e?(q=e("Permissions"),t[57]=e,t[58]=q):q=t[58];let $;t[59]!==e?($=e("Queues"),t[59]=e,t[60]=$):$=t[60];let Y;t[61]!==e?(Y=e("Realtime"),t[61]=e,t[62]=Y):Y=t[62];let Q;t[63]!==e?(Q=e("RLS Policies"),t[63]=e,t[64]=Q):Q=t[64];let X;t[65]!==e?(X=e("Scheduled"),t[65]=e,t[66]=X):X=t[66];let te;t[67]!==e?(te=e("Schema"),t[67]=e,t[68]=te):te=t[68];let ae;t[69]!==e?(ae=e("Security"),t[69]=e,t[70]=ae):ae=t[70];let se;t[71]!==e?(se=e("Settings"),t[71]=e,t[72]=se):se=t[72];let J;t[73]!==e?(J=e("SQL editor"),t[73]=e,t[74]=J):J=t[74];let ne;t[75]!==e?(ne=e("Access Rules"),t[75]=e,t[76]=ne):ne=t[76];let pe;t[77]!==e?(pe=e("Users"),t[77]=e,t[78]=pe):pe=t[78];let le;t[79]!==e?(le=e("Vectors"),t[79]=e,t[80]=le):le=t[80];let ie;t[81]!==e?(ie=e("Workflows"),t[81]=e,t[82]=ie):ie=t[82];let de;t[83]!==w||t[84]!==C||t[85]!==F||t[86]!==T||t[87]!==E||t[88]!==k||t[89]!==O||t[90]!==D||t[91]!==M||t[92]!==L||t[93]!==U||t[94]!==W||t[95]!==V||t[96]!==j||t[97]!==N||t[98]!==_||t[99]!==B||t[100]!==z||t[101]!==q||t[102]!==$||t[103]!==Y||t[104]!==Q||t[105]!==X||t[106]!==te||t[107]!==ae||t[108]!==se||t[109]!==J||t[110]!==ne||t[111]!==pe||t[112]!==le||t[113]!==ie||t[114]!==v||t[115]!==x||t[116]!==y||t[117]!==b||t[118]!==S?(de={analytics:v,api:x,audit:y,authConfig:b,authSessions:S,dashboards:w,data:C,drains:F,export:T,fanout:E,files:k,flags:O,functions:D,health:M,home:L,insights:U,logs:W,metrics:V,migrations:j,organizations:N,pitr:_,mail:B,payments:z,permissions:q,queues:$,realtime:Y,rls:Q,schedule:X,schema:te,security:ae,settings:se,sql:J,storageRules:ne,users:pe,vectors:le,workflows:ie},t[83]=w,t[84]=C,t[85]=F,t[86]=T,t[87]=E,t[88]=k,t[89]=O,t[90]=D,t[91]=M,t[92]=L,t[93]=U,t[94]=W,t[95]=V,t[96]=j,t[97]=N,t[98]=_,t[99]=B,t[100]=z,t[101]=q,t[102]=$,t[103]=Y,t[104]=Q,t[105]=X,t[106]=te,t[107]=ae,t[108]=se,t[109]=J,t[110]=ne,t[111]=pe,t[112]=le,t[113]=ie,t[114]=v,t[115]=x,t[116]=y,t[117]=b,t[118]=S,t[119]=de):de=t[119];let ue=de,he={advisors:e("Advisors"),auth:e("Auth"),database:e("Database"),functions:e("Functions"),observability:e("Observability"),operations:e("Operations"),overview:e("Overview"),settings:e("Settings"),storage:e("Storage")},Re;t[120]!==e?(Re=e("Usage and latency from Analytics Engine \u2014 request volume, p50/p95, and hot shards."),t[120]=e,t[121]=Re):Re=t[121];let Ae;t[122]!==e?(Ae=e("Interactive OpenAPI reference and copy-paste snippets for your functions."),t[122]=e,t[123]=Ae):Ae=t[123];let ye;t[124]!==e?(ye=e("A durable log of admin state-changing operations."),t[124]=e,t[125]=ye):ye=t[125];let ge;t[126]!==e?(ge=e("Enabled plugins and session config (read-only)."),t[126]=e,t[127]=ge):ge=t[127];let Te;t[128]!==e?(Te=e("Browse and revoke active sessions across all users."),t[128]=e,t[129]=Te):Te=t[129];let ze;t[130]!==e?(ze=e("Chart widgets backed by saved read-only SQL queries."),t[130]=e,t[131]=ze):ze=t[131];let Ze;t[132]!==e?(Ze=e("Browse and edit rows across your shard and global tables."),t[132]=e,t[133]=Ze):Ze=t[133];let _e;t[134]!==e?(_e=e("Forward logs to Logpush, Tail Workers, or a webhook collector."),t[134]=e,t[135]=_e):_e=t[135];let Ie;t[136]!==e?(Ie=e("Export a shard to NDJSON, or import rows from it."),t[136]=e,t[137]=Ie):Ie=t[137];let ke;t[138]!==e?(ke=e("Realtime fan-out cost and per-topic subscriber counts for this shard."),t[138]=e,t[139]=ke):ke=t[139];let Be;t[140]!==e?(Be=e("Browse objects in your R2 storage buckets."),t[140]=e,t[141]=Be):Be=t[141];let Me;t[142]!==e?(Me=e("Inspect feature flags and their live evaluation under a targeting context."),t[142]=e,t[143]=Me):Me=t[143];let je;t[144]!==e?(je=e("Run registered queries, mutations, and actions."),t[144]=e,t[145]=je):je=t[145];let mt;t[146]!==e?(mt=e("At-a-glance connection, error, and shard signals."),t[146]=e,t[147]=mt):mt=t[147];let ht;t[148]!==e?(ht=e("Connection, health, and advisor summary for your deployment."),t[148]=e,t[149]=ht):ht=t[149];let yt;t[150]!==e?(yt=e("Surface slow functions, error spikes, and cache problems."),t[150]=e,t[151]=yt):yt=t[151];let Et;t[152]!==e?(Et=e("A live stream of recent function logs."),t[152]=e,t[153]=Et):Et=t[153];let St;t[154]!==e?(St=e("Per-shard health and aggregate metrics."),t[154]=e,t[155]=St):St=t[155];let jt;t[156]!==e?(jt=e("Review migration status and run them."),t[156]=e,t[157]=jt):jt=t[157];let At;t[158]!==e?(At=e("Browse and manage organizations, members, and invitations."),t[158]=e,t[159]=At):At=t[159];let ee;t[160]!==e?(ee=e("Restore a shard to a point in the last 30 days."),t[160]=e,t[161]=ee):ee=t[161];let ce;t[162]!==e?(ce=e("Email your app sent, captured in dev."),t[162]=e,t[163]=ce):ce=t[163];let Ee;t[164]!==e?(Ee=e("Synced customers, subscriptions, and webhook events."),t[164]=e,t[165]=Ee):Ee=t[165];let Oe;t[166]!==e?(Oe=e("Inspect access policies per table, and probe a function as any identity."),t[166]=e,t[167]=Oe):Oe=t[167];let Ce;t[168]!==e?(Ce=e("Inspect declared Cloudflare Queues \u2014 their producer bindings, consumer mode, and dead-letter queue."),t[168]=e,t[169]=Ce):Ce=t[169];let Ye;t[170]!==e?(Ye=e("Active WebSocket subscriptions on this shard."),t[170]=e,t[171]=Ye):Ye=t[171];let it;t[172]!==e?(it=e("Inspect row-level-security policies and roles, per table."),t[172]=e,t[173]=it):it=t[173];let ft;t[174]!==e?(ft=e("Inspect and cancel scheduled jobs."),t[174]=e,t[175]=ft):ft=t[175];let ct;t[176]!==e?(ct=e("Inspect each table and its columns."),t[176]=e,t[177]=ct):ct=t[177];let Zt;t[178]!==e?(Zt=e("Review admin gates, credentials, and log redaction."),t[178]=e,t[179]=Zt):Zt=t[179];let ao;t[180]!==e?(ao=e("Read-only deployment config \u2014 vars, secrets, and bindings."),t[180]=e,t[181]=ao):ao=t[181];let Vt;t[182]!==e?(Vt=e("Run read-only SQL against a shard."),t[182]=e,t[183]=Vt):Vt=t[183];let Ko;t[184]!==e?(Ko=e("Inspect storage access rules \u2014 per bucket, operation, and key prefix."),t[184]=e,t[185]=Ko):Ko=t[185];let Po;t[186]!==e?(Po=e("Manage auth users \u2014 roles, bans, sessions, and identity."),t[186]=e,t[187]=Po):Po=t[187];let Ge;t[188]!==e?(Ge=e("Browse Vectorize indexes and run similarity searches."),t[188]=e,t[189]=Ge):Ge=t[189];let wt;t[190]!==e?(wt=e("Inspect declared Cloudflare Workflows and their bindings."),t[190]=e,t[191]=wt):wt=t[191];let Ut;t[192]!==Re||t[193]!==Ae||t[194]!==ye||t[195]!==ge||t[196]!==Te||t[197]!==ze||t[198]!==Ze||t[199]!==_e||t[200]!==Ie||t[201]!==ke||t[202]!==Be||t[203]!==Me||t[204]!==je||t[205]!==mt||t[206]!==ht||t[207]!==yt||t[208]!==Et||t[209]!==St||t[210]!==jt||t[211]!==At||t[212]!==ee||t[213]!==ce||t[214]!==Ee||t[215]!==Oe||t[216]!==Ce||t[217]!==Ye||t[218]!==it||t[219]!==ft||t[220]!==ct||t[221]!==Zt||t[222]!==ao||t[223]!==Vt||t[224]!==Ko||t[225]!==Po||t[226]!==Ge||t[227]!==wt?(Ut={analytics:Re,api:Ae,audit:ye,authConfig:ge,authSessions:Te,dashboards:ze,data:Ze,drains:_e,export:Ie,fanout:ke,files:Be,flags:Me,functions:je,health:mt,home:ht,insights:yt,logs:Et,metrics:St,migrations:jt,organizations:At,pitr:ee,mail:ce,payments:Ee,permissions:Oe,queues:Ce,realtime:Ye,rls:it,schedule:ft,schema:ct,security:Zt,settings:ao,sql:Vt,storageRules:Ko,users:Po,vectors:Ge,workflows:wt},t[192]=Re,t[193]=Ae,t[194]=ye,t[195]=ge,t[196]=Te,t[197]=ze,t[198]=Ze,t[199]=_e,t[200]=Ie,t[201]=ke,t[202]=Be,t[203]=Me,t[204]=je,t[205]=mt,t[206]=ht,t[207]=yt,t[208]=Et,t[209]=St,t[210]=jt,t[211]=At,t[212]=ee,t[213]=ce,t[214]=Ee,t[215]=Oe,t[216]=Ce,t[217]=Ye,t[218]=it,t[219]=ft,t[220]=ct,t[221]=Zt,t[222]=ao,t[223]=Vt,t[224]=Ko,t[225]=Po,t[226]=Ge,t[227]=wt,t[228]=Ut):Ut=t[228];let So=Ut,to;t[229]!==o?(to=n(al=>{ot(o({to:`/${al.currentTarget.dataset.tab??""}`}))},"t79"),t[229]=o,t[230]=to):to=t[230];let $o=to,Ho,gr;t[231]!==s||t[232]!==ue?(Ho=n(()=>{typeof document<"u"&&(document.title=`${ue[s]} \xB7 lunora`)},"t80"),gr=[s,ue],t[231]=s,t[232]=ue,t[233]=Ho,t[234]=gr):(Ho=t[233],gr=t[234]),(0,st.useEffect)(Ho,gr);let Ct=p.find(al=>al.tabs.includes(s))??LOe[0],so=p.flatMap(al=>al.tabs.map(tp=>({group:he[al.key],label:ue[tp],to:`/${tp}`}))),Uo=(0,st.use)(tNe),Wr=Uo!==null&&Uo.token!=="",Dr;t[235]!==so?(Dr=(0,P.jsxDEV)(wOe,{items:so},void 0,!1),t[235]=so,t[236]=Dr):Dr=t[236];let Ot;t[237]===Symbol.for("react.memo_cache_sentinel")?(Ot=(0,P.jsxDEV)(dbt,{className:"-ms-1"},void 0,!1),t[237]=Ot):Ot=t[237];let wo;t[238]!==e?(wo=e("Breadcrumb"),t[238]=e,t[239]=wo):wo=t[239];let _r=he[Ct.key],Co;t[240]!==_r?(Co=(0,P.jsxDEV)("span",{className:"text-muted-foreground",children:_r},void 0,!1),t[240]=_r,t[241]=Co):Co=t[241];let fr;t[242]===Symbol.for("react.memo_cache_sentinel")?(fr=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,P.jsxDEV)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1)},void 0,!1),t[242]=fr):fr=t[242];let Qs=ue[s],rl;t[243]!==Qs?(rl=(0,P.jsxDEV)("span",{className:"font-medium text-foreground",children:Qs},void 0,!1),t[243]=Qs,t[244]=rl):rl=t[244];let Ec;t[245]!==wo||t[246]!==Co||t[247]!==rl?(Ec=(0,P.jsxDEV)("nav",{"aria-label":wo,className:"flex items-center gap-1.5 text-[13px]",children:[Co,fr,rl]},void 0,!0),t[245]=wo,t[246]=Co,t[247]=rl,t[248]=Ec):Ec=t[248];let Qf;t[249]===Symbol.for("react.memo_cache_sentinel")?(Qf=(0,P.jsxDEV)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[(0,P.jsxDEV)("circle",{cx:"11",cy:"11",r:"7"},void 0,!1),(0,P.jsxDEV)("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"},void 0,!1)]},void 0,!0),t[249]=Qf):Qf=t[249];let ia;t[250]!==e?(ia=e("Search\u2026"),t[250]=e,t[251]=ia):ia=t[251];let Dl;t[252]===Symbol.for("react.memo_cache_sentinel")?(Dl=(0,P.jsxDEV)("kbd",{className:"ms-auto rounded border border-border bg-background px-1 font-sans text-[10px] text-muted-foreground",children:"\u2318K"},void 0,!1),t[252]=Dl):Dl=t[252];let Zs;t[253]!==ia?(Zs=(0,P.jsxDEV)("button",{className:"mx-auto hidden h-8 w-72 items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted md:flex","data-testid":"dash-app-search",onClick:SOe,type:"button",children:[Qf,ia,Dl]},void 0,!0),t[253]=ia,t[254]=Zs):Zs=t[254];let Zf;t[255]===Symbol.for("react.memo_cache_sentinel")?(Zf=(0,P.jsxDEV)("div",{className:"ms-auto flex items-center gap-1.5 md:ms-0",children:(0,P.jsxDEV)(KIt,{},void 0,!1)},void 0,!1),t[255]=Zf):Zf=t[255];let nl;t[256]!==Ec||t[257]!==Zs?(nl=(0,P.jsxDEV)("header",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border px-4","data-testid":"dash-app-header",children:[Ot,Ec,Zs,Zf]},void 0,!0),t[256]=Ec,t[257]=Zs,t[258]=nl):nl=t[258];let _l;t[259]!==Uo?.rulesInstalled?(_l=Uo?.rulesInstalled===!1&&(0,P.jsxDEV)($It,{},void 0,!1),t[259]=Uo?.rulesInstalled,t[260]=_l):_l=t[260];let Jf=`dash-tab-${s}`,Ac=c?"flex min-w-0 flex-1 flex-col overflow-hidden":"min-w-0 flex-1 overflow-auto p-6",Tc=ue[s],kc;t[261]!==e||t[262]!==Tc?(kc=e("{title} failed",{title:Tc}),t[261]=e,t[262]=Tc,t[263]=kc):kc=t[263];let L0=ue[s],gd;t[264]!==e?(gd=e("Try again"),t[264]=e,t[265]=gd):gd=t[265];let ep;t[266]===Symbol.for("react.memo_cache_sentinel")?(ep=(0,P.jsxDEV)(OF,{},void 0,!1),t[266]=ep):ep=t[266];let Mc;t[267]!==s||t[268]!==kc||t[269]!==L0||t[270]!==gd?(Mc=(0,P.jsxDEV)(tb,{fallbackTitle:kc,label:L0,retryLabel:gd,children:ep},s,!1),t[267]=s,t[268]=kc,t[269]=L0,t[270]=gd,t[271]=Mc):Mc=t[271];let Pc;t[272]!==Mc||t[273]!==Ac?(Pc=(0,P.jsxDEV)("div",{className:Ac,children:Mc},void 0,!1),t[272]=Mc,t[273]=Ac,t[274]=Pc):Pc=t[274];let ku;t[275]!==Pc||t[276]!==Jf?(ku=(0,P.jsxDEV)("div",{"aria-labelledby":Jf,className:"flex min-w-0 flex-1 flex-col overflow-hidden","data-testid":"dash-panel",id:"dash-panel",role:"tabpanel",children:Pc},void 0,!1),t[275]=Pc,t[276]=Jf,t[277]=ku):ku=t[277];let vd;return t[278]!==ku||t[279]!==nl||t[280]!==_l?(vd=(0,P.jsxDEV)(fbt,{className:"overflow-hidden md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",children:[nl,_l,ku]},void 0,!0),t[278]=ku,t[279]=nl,t[280]=_l,t[281]=vd):vd=t[281],(0,P.jsxDEV)(cbt,{className:"min-h-0 flex-1","data-testid":"lunora-studio",children:[Dr,(0,P.jsxDEV)(gSt,{chrome:Uo,connected:Wr,current:s,groupLabel:he,groups:p,selectTab:$o,tabDescription:So,tabLabel:ue},void 0,!1),vd]},void 0,!0)},"StudioLayout"),xSt=n(()=>{let t=(0,Yt.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,P.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"dash-pending",children:[(0,P.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,P.jsxDEV)(Rf,{className:"h-8 w-40"},void 0,!1),(0,P.jsxDEV)(Rf,{className:"h-8 w-24"},void 0,!1)]},void 0,!0),(0,P.jsxDEV)(Rf,{className:"h-72 w-full"},void 0,!1)]},void 0,!0),t[0]=e):e=t[0],e},"RoutePending"),ySt=n(t=>{let e=(0,Yt.c)(5),{initialShardKey:o,schemaEditable:r}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];let s=zh(a),{table:i}=s,c=typeof i=="string"?i:void 0,d;return e[1]!==o||e[2]!==c||e[3]!==r?(d=(0,P.jsxDEV)(cOe,{initialShardKey:o,initialTable:c,schemaEditable:r},void 0,!1),e[1]=o,e[2]=c,e[3]=r,e[4]=d):d=e[4],d},"SchemaRoutePanel"),ISt=n(()=>{let t=(0,Yt.c)(3),e=zs(),o,r;return t[0]!==e?(o=n(()=>{ot(e({replace:!0,to:"/home"}))},"t0"),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),(0,st.useEffect)(o,r),null},"NotFoundRedirect"),bSt=n(({basePath:t,dataEditable:e=!1,functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s,runAsIdentity:i=!1,schemaEditable:c=!1,scheduledCancel:d,scheduledCron:f,scheduledLoad:p})=>{let m=X$({component:vSt}),h={analytics:(0,P.jsxDEV)(Abt,{},void 0,!1),api:(0,P.jsxDEV)(Gge,{functions:o,initialShardKey:r,openApiSpec:a,openRpcSpec:s},void 0,!1),audit:(0,P.jsxDEV)(kAe,{initialShardKey:r},void 0,!1),authConfig:(0,P.jsxDEV)(Mbt,{},void 0,!1),authSessions:(0,P.jsxDEV)(Pbt,{},void 0,!1),dashboards:(0,P.jsxDEV)(z1t,{initialShardKey:r},void 0,!1),data:(0,P.jsxDEV)(zve,{editable:e,initialShardKey:r},void 0,!1),drains:(0,P.jsxDEV)(o1t,{},void 0,!1),export:(0,P.jsxDEV)($ve,{initialShardKey:r},void 0,!1),fanout:(0,P.jsxDEV)(H1t,{initialShardKey:r},void 0,!1),files:(0,P.jsxDEV)(yOe,{},void 0,!1),flags:(0,P.jsxDEV)(e1t,{initialShardKey:r},void 0,!1),functions:(0,P.jsxDEV)("div",{className:"flex flex-col gap-8",children:[(0,P.jsxDEV)(Xve,{functions:o,initialShardKey:r},void 0,!1),(0,P.jsxDEV)(Gve,{functions:o,runAsIdentity:i},void 0,!1)]},void 0,!0),health:(0,P.jsxDEV)(CTe,{initialShardKey:r},void 0,!1),home:(0,P.jsxDEV)(RAe,{initialShardKey:r},void 0,!1),insights:(0,P.jsxDEV)(Mge,{initialShardKey:r},void 0,!1),logs:(0,P.jsxDEV)(_Ae,{initialShardKey:r},void 0,!1),metrics:(0,P.jsxDEV)(nke,{initialShardKey:r},void 0,!1),migrations:(0,P.jsxDEV)(qve,{initialShardKey:r},void 0,!1),organizations:(0,P.jsxDEV)(Nbt,{},void 0,!1),permissions:(0,P.jsxDEV)(P1t,{functions:o,runAsIdentity:i,schemaEditable:c},void 0,!1),pitr:(0,P.jsxDEV)(Wve,{initialShardKey:r},void 0,!1),mail:(0,P.jsxDEV)(QAe,{},void 0,!1),payments:(0,P.jsxDEV)(x1t,{},void 0,!1),queues:(0,P.jsxDEV)(O1t,{},void 0,!1),realtime:(0,P.jsxDEV)(h1t,{initialShardKey:r},void 0,!1),rls:(0,P.jsxDEV)(Sbt,{},void 0,!1),schedule:(0,P.jsxDEV)(f1t,{loadCronJobs:f,scheduledCancel:d,scheduledLoad:p},void 0,!1),schema:(0,P.jsxDEV)(ySt,{initialShardKey:r,schemaEditable:c},void 0,!1),security:(0,P.jsxDEV)(Dge,{},void 0,!1),settings:(0,P.jsxDEV)(dOe,{initialShardKey:r},void 0,!1),sql:(0,P.jsxDEV)(cTe,{initialShardKey:r},void 0,!1),storageRules:(0,P.jsxDEV)(G1t,{},void 0,!1),users:(0,P.jsxDEV)(Xbt,{},void 0,!1),vectors:(0,P.jsxDEV)(Y1t,{},void 0,!1),workflows:(0,P.jsxDEV)(aSt,{},void 0,!1)},v=PF({component:n(()=>h.home,"component"),getParentRoute:n(()=>m,"getParentRoute"),path:"/"}),x=oNe.map(S=>S==="data"?PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`,validateSearch:Lve}):PF({component:n(()=>h[S],"component"),getParentRoute:n(()=>m,"getParentRoute"),path:`/${S}`})),y=m.addChildren([v,...x]),b="window"in globalThis?EF():F$({initialEntries:["/home"]});return Q$({...t===void 0||t==="/"?{}:{basepath:t},defaultNotFoundComponent:ISt,defaultPendingComponent:xSt,defaultPendingMinMs:0,defaultPendingMs:0,history:b,routeTree:y})},"buildRouter"),SSt=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}=t,x;e[0]!==o||e[1]!==a||e[2]!==s||e[3]!==i||e[4]!==c||e[5]!==d||e[6]!==f||e[7]!==m||e[8]!==h||e[9]!==v||e[10]!==p?(x=bSt({basePath:o,dataEditable:a,functions:s,initialShardKey:i,openApiSpec:c,openRpcSpec:d,runAsIdentity:f,schemaEditable:p,scheduledCancel:m,scheduledCron:h,scheduledLoad:v}),e[0]=o,e[1]=a,e[2]=s,e[3]=i,e[4]=c,e[5]=d,e[6]=f,e[7]=m,e[8]=h,e[9]=v,e[10]=p,e[11]=x):x=e[11];let y=x,b=r??null,S;e[12]!==y?(S=(0,P.jsxDEV)(Z$,{router:y},void 0,!1),e[12]=y,e[13]=S):S=e[13];let w;return e[14]!==b||e[15]!==S?(w=(0,P.jsxDEV)(tNe,{value:b,children:S},void 0,!1),e[14]=b,e[15]=S,e[16]=w):w=e[16],w},"StudioShell"),rNe=n(t=>{let e=(0,Yt.c)(17),{basePath:o,chrome:r,dataEditable:a,functions:s,i18n:i,initialShardKey:c,locale:d,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,schemaEditable:h,scheduledCancel:v,scheduledCron:x,scheduledLoad:y}=t,b;e[0]!==o||e[1]!==r||e[2]!==a||e[3]!==s||e[4]!==c||e[5]!==f||e[6]!==p||e[7]!==m||e[8]!==v||e[9]!==x||e[10]!==y||e[11]!==h?(b=(0,P.jsxDEV)(SSt,{basePath:o,chrome:r,dataEditable:a,functions:s,initialShardKey:c,openApiSpec:f,openRpcSpec:p,runAsIdentity:m,scheduledCancel:v,scheduledCron:x,scheduledLoad:y,schemaEditable:h},void 0,!1),e[0]=o,e[1]=r,e[2]=a,e[3]=s,e[4]=c,e[5]=f,e[6]=p,e[7]=m,e[8]=v,e[9]=x,e[10]=y,e[11]=h,e[12]=b):b=e[12];let S=b;if(i===void 0&&d===void 0)return S;let w;return e[13]!==i||e[14]!==d||e[15]!==S?(w=(0,P.jsxDEV)(YA,{i18n:i,locale:d,children:S},void 0,!1),e[13]=i,e[14]=d,e[15]=S,e[16]=w):w=e[16],w},"Studio");function wSt(t){return t.location.pathname}n(wSt,"_temp");function CSt(t){return t.tabs.length>0}n(CSt,"_temp2");var YZ="lunora-studio-root";var On=K(po(),1);var XZ="lunora-studio-admin-token",nNe=n(()=>{try{return globalThis.sessionStorage}catch{return}},"store"),FSt=n(()=>{try{return nNe()?.getItem(XZ)??""}catch{return""}},"loadToken"),RSt=n(t=>{let e=nNe();if(e!==void 0)try{t===""?e.removeItem(XZ):e.setItem(XZ,t)}catch{}},"saveToken"),ESt=n(t=>{let e=(0,Dw.c)(42),{onSubmit:o}=t,r=Ve(),[a,s]=(0,Nw.useState)(""),i;e[0]!==a?(i=a.trim(),e[0]=a,e[1]=i):i=e[1];let c=i,d;e[2]!==o||e[3]!==c?(d=n(L=>{L.preventDefault(),c!==""&&o(c)},"t2"),e[2]=o,e[3]=c,e[4]=d):d=e[4];let f=d,p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,On.jsxDEV)("div",{className:"h-10 w-10 text-foreground",children:(0,On.jsxDEV)(GZ,{},void 0,!1)},void 0,!1),e[5]=p):p=e[5];let m;e[6]!==r?(m=r("Connect to Lunora Studio"),e[6]=r,e[7]=m):m=e[7];let h;e[8]!==m?(h=(0,On.jsxDEV)("h1",{className:"text-base font-semibold text-foreground",children:m},void 0,!1),e[8]=m,e[9]=h):h=e[9];let v;e[10]!==r?(v=r("Enter your admin token to access the studio."),e[10]=r,e[11]=v):v=e[11];let x;e[12]!==v?(x=(0,On.jsxDEV)("p",{className:"text-[13px] text-muted-foreground",children:v},void 0,!1),e[12]=v,e[13]=x):x=e[13];let y;e[14]!==h||e[15]!==x?(y=(0,On.jsxDEV)("div",{className:"flex flex-col items-center gap-3 text-center",children:[p,(0,On.jsxDEV)("div",{className:"flex flex-col gap-1",children:[h,x]},void 0,!0)]},void 0,!0),e[14]=h,e[15]=x,e[16]=y):y=e[16];let b;e[17]!==r?(b=r("admin token"),e[17]=r,e[18]=b):b=e[18];let S;e[19]!==b?(S=(0,On.jsxDEV)("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:b},void 0,!1),e[19]=b,e[20]=S):S=e[20];let w;e[21]===Symbol.for("react.memo_cache_sentinel")?(w=n(L=>{s(L.target.value)},"t11"),e[21]=w):w=e[21];let C;e[22]!==a?(C=(0,On.jsxDEV)(mo,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:w,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:a},void 0,!1),e[22]=a,e[23]=C):C=e[23];let F;e[24]!==r?(F=r("From your worker's LUNORA_ADMIN_TOKEN \u2014 your project's .dev.vars in dev, or a deployment secret in production."),e[24]=r,e[25]=F):F=e[25];let T;e[26]!==F?(T=(0,On.jsxDEV)("p",{className:"text-[11px] text-muted-foreground",children:F},void 0,!1),e[26]=F,e[27]=T):T=e[27];let E;e[28]!==S||e[29]!==C||e[30]!==T?(E=(0,On.jsxDEV)("div",{className:"flex flex-col gap-1.5",children:[S,C,T]},void 0,!0),e[28]=S,e[29]=C,e[30]=T,e[31]=E):E=e[31];let k=c==="",O;e[32]!==r?(O=r("Connect"),e[32]=r,e[33]=O):O=e[33];let D;e[34]!==k||e[35]!==O?(D=(0,On.jsxDEV)(dt,{"data-testid":"lunora-studio-login-submit",disabled:k,type:"submit",children:O},void 0,!1),e[34]=k,e[35]=O,e[36]=D):D=e[36];let M;return e[37]!==f||e[38]!==E||e[39]!==D||e[40]!==y?(M=(0,On.jsxDEV)("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:f,children:[y,E,D]},void 0,!0),e[37]=f,e[38]=E,e[39]=D,e[40]=y,e[41]=M):M=e[41],M},"StudioLoginForm"),ASt=n(t=>{let e=(0,Dw.c)(10),{i18n:o,onSubmit:r}=t,{resolvedTheme:a}=aV(),s=a==="dark"&&"dark",i;e[0]!==s?(i=tt(YZ,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==r?(c=(0,On.jsxDEV)(ESt,{onSubmit:r},void 0,!1),e[2]=r,e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==c?(d=(0,On.jsxDEV)(YA,{i18n:o,children:c},void 0,!1),e[4]=o,e[5]=c,e[6]=d):d=e[6];let f;return e[7]!==i||e[8]!==d?(f=(0,On.jsxDEV)("div",{className:i,"data-testid":"lunora-studio-login-root",children:d},void 0,!1),e[7]=i,e[8]=d,e[9]=f):f=e[9],f},"StudioLogin"),TSt=n(t=>{if(t!==void 0&&t!=="")return t;let e=globalThis.location;return e?.origin!==void 0&&e.origin!==""?e.origin:"http://localhost:5173"},"resolveBaseUrl"),kSt=n(t=>{let e=(0,Dw.c)(23),{basePath:o,chrome:r,studio:a}=t,s=Ve(),i;e[0]!==s?(i=s("Studio failed"),e[0]=s,e[1]=i):i=e[1];let c;e[2]!==s?(c=s("Studio"),e[2]=s,e[3]=c):c=e[3];let d;e[4]!==s?(d=s("Try again"),e[4]=s,e[5]=d):d=e[5];let f=a?.dataEditable,p=a?.functions,m=a?.initialShardKey,h=a?.openApiSpec,v=a?.openRpcSpec,x=a?.runAsIdentity,y=a?.scheduledCancel,b=a?.scheduledLoad,S=a?.schemaEditable,w;e[6]!==o||e[7]!==r||e[8]!==y||e[9]!==b||e[10]!==S||e[11]!==f||e[12]!==p||e[13]!==m||e[14]!==h||e[15]!==v||e[16]!==x?(w=(0,On.jsxDEV)(rNe,{basePath:o,chrome:r,dataEditable:f,functions:p,initialShardKey:m,openApiSpec:h,openRpcSpec:v,runAsIdentity:x,scheduledCancel:y,scheduledLoad:b,schemaEditable:S},void 0,!1),e[6]=o,e[7]=r,e[8]=y,e[9]=b,e[10]=S,e[11]=f,e[12]=p,e[13]=m,e[14]=h,e[15]=v,e[16]=x,e[17]=w):w=e[17];let C;return e[18]!==i||e[19]!==w||e[20]!==c||e[21]!==d?(C=(0,On.jsxDEV)(tb,{fallbackTitle:i,label:c,retryLabel:d,children:w},void 0,!1),e[18]=i,e[19]=w,e[20]=c,e[21]=d,e[22]=C):C=e[22],C},"StudioAppBody"),MSt=n(t=>{let e=(0,Dw.c)(20),{basePath:o,clearToken:r,client:a,i18n:s,onTokenChange:i,rulesInstalled:c,studio:d,token:f}=t,{resolvedTheme:p}=aV(),m;e[0]!==r||e[1]!==i||e[2]!==c||e[3]!==f?(m={clearToken:r,onTokenChange:i,rulesInstalled:c,token:f},e[0]=r,e[1]=i,e[2]=c,e[3]=f,e[4]=m):m=e[4];let h=m,v=p==="dark"&&"dark",x;e[5]!==v?(x=tt(YZ,v,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=v,e[6]=x):x=e[6];let y;e[7]!==o||e[8]!==h||e[9]!==d?(y=(0,On.jsxDEV)(qOe,{children:(0,On.jsxDEV)(kSt,{basePath:o,chrome:h,studio:d},void 0,!1)},void 0,!1),e[7]=o,e[8]=h,e[9]=d,e[10]=y):y=e[10];let b;e[11]!==s||e[12]!==y?(b=(0,On.jsxDEV)(YA,{i18n:s,children:y},void 0,!1),e[11]=s,e[12]=y,e[13]=b):b=e[13];let S;e[14]!==a||e[15]!==b?(S=(0,On.jsxDEV)(r$,{client:a,children:b},void 0,!1),e[14]=a,e[15]=b,e[16]=S):S=e[16];let w;return e[17]!==x||e[18]!==S?(w=(0,On.jsxDEV)("div",{className:x,"data-testid":"lunora-studio-app",children:S},void 0,!1),e[17]=x,e[18]=S,e[19]=w):w=e[19],w},"StudioShell"),aNe=n(t=>{let e=(0,Dw.c)(25),o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];let{adminToken:r,basePath:a,baseUrl:s,client:i,rulesInstalled:c,studio:d,locale:f}=o,p;e[2]!==r?(p=n(()=>r??FSt(),"t2"),e[2]=r,e[3]=p):p=e[3];let[m,h]=(0,Nw.useState)(p),v,x;e[4]!==m?(v=n(()=>{RSt(m)},"t3"),x=[m],e[4]=m,e[5]=v,e[6]=x):(v=e[5],x=e[6]),(0,Nw.useEffect)(v,x);let y=na(m,300),b;e:{if(i!==void 0){b=i;break e}let L;e[7]!==s||e[8]!==y?(L=new hF({url:TSt(s),...y===""?{}:{wsToken:y}}),y!==""&&L.setAuthToken(y),e[7]=s,e[8]=y,e[9]=L):L=e[9],b=L}let S=b,w,C;e[10]!==S||e[11]!==i?(w=n(()=>()=>{i===void 0&&S.close()},"t6"),C=[S,i],e[10]=S,e[11]=i,e[12]=w,e[13]=C):(w=e[12],C=e[13]),(0,Nw.useEffect)(w,C);let F;e[14]===Symbol.for("react.memo_cache_sentinel")?(F=n(L=>{h(L.target.value)},"t8"),e[14]=F):F=e[14];let T=F,E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=n(()=>{h("")},"t9"),e[15]=E):E=e[15];let k=E,O;e[16]!==f?(O=BF(f),e[16]=f,e[17]=O):O=e[17];let D=O,M;return e[18]!==a||e[19]!==S||e[20]!==D||e[21]!==c||e[22]!==d||e[23]!==m?(M=(0,On.jsxDEV)(jOe,{children:m===""?(0,On.jsxDEV)(ASt,{i18n:D,onSubmit:h},void 0,!1):(0,On.jsxDEV)(MSt,{basePath:a,clearToken:k,client:S,i18n:D,onTokenChange:T,rulesInstalled:c,studio:d,token:m},void 0,!1)},void 0,!1),e[18]=a,e[19]=S,e[20]=D,e[21]=c,e[22]=d,e[23]=m,e[24]=M):M=e[24],M},"StudioApp");var iNe=K(po(),1);var lNe=n((t={})=>{let{container:e="#root",...o}=t,r=typeof e=="string"?document.querySelector(e):e;if(r===null)throw new Error(`mountStudio: container ${typeof e=="string"?e:"element"} not found`);let a=(0,sNe.createRoot)(r);return a.render((0,iNe.jsxDEV)(aNe,{adminToken:o.adminToken,basePath:o.basePath,baseUrl:o.baseUrl,locale:o.locale,rulesInstalled:o.rulesInstalled,studio:o.studio},void 0,!1)),a},"mountStudio");var zm=globalThis;lNe({basePath:typeof zm.__LUNORA_BASE_PATH__=="string"?zm.__LUNORA_BASE_PATH__:"/",adminToken:typeof zm.__LUNORA_ADMIN_TOKEN__=="string"&&zm.__LUNORA_ADMIN_TOKEN__!==""?zm.__LUNORA_ADMIN_TOKEN__:void 0,studio:{dataEditable:zm.__LUNORA_DATA_EDITABLE__===!0,runAsIdentity:zm.__LUNORA_RUN_AS_IDENTITY__===!0,schemaEditable:zm.__LUNORA_SCHEMA_EDITABLE__===!0},rulesInstalled:zm.__LUNORA_RULES_INSTALLED__!==!1});