Auto-indexing service and GraphQL API for AT Protocol Records
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

use window origin instead of hardcoding localhost, oops

+20 -9
+8
client/src/quickslice_client.ffi.mjs
··· 1 1 /// JavaScript FFI for quickslice_client 2 2 3 3 /** 4 + * Get the window origin (protocol + host + port) 5 + * @returns {string} The window origin (e.g., "http://localhost:8000") 6 + */ 7 + export function getWindowOrigin() { 8 + return window.location.origin; 9 + } 10 + 11 + /** 4 12 * Set a timeout to call a callback after a delay 5 13 * @param {function} callback - The function to call 6 14 * @param {number} milliseconds - The delay in milliseconds
+5 -2
client/src/quickslice_client.gleam
··· 12 12 /// } 13 13 /// } 14 14 /// ``` 15 + @external(javascript, "./quickslice_client.ffi.mjs", "getWindowOrigin") 16 + fn window_origin() -> String 17 + 15 18 import components/layout 16 19 import file_upload 17 20 import generated/queries ··· 72 75 } 73 76 74 77 fn init(_flags) -> #(Model, Effect(Msg)) { 75 - // Create cache 76 - let cache = squall_cache.new("http://localhost:8000/admin/graphql") 78 + let api_url = window_origin() <> "/admin/graphql" 79 + let cache = squall_cache.new(api_url) 77 80 78 81 // Initialize registry with all extracted queries 79 82 let reg = queries.init_registry()
+7 -7
server/priv/static/quickslice_client.js
··· 1 - class z{withFields(Z){let W=Object.keys(this).map((J)=>(J in Z)?Z[J]:this[J]);return new this.constructor(...W)}}class gZ{static fromArray(Z,W){let J=W||new O;for(let K=Z.length-1;K>=0;--K)J=new tZ(Z[K],J);return J}[Symbol.iterator](){return new LK(this)}toArray(){return[...this]}atLeastLength(Z){let W=this;while(Z-- >0&&W)W=W.tail;return W!==void 0}hasLength(Z){let W=this;while(Z-- >0&&W)W=W.tail;return Z===-1&&W instanceof O}countLength(){let Z=this,W=0;while(Z)Z=Z.tail,W++;return W-1}}function P(Z,W){return new tZ(Z,W)}function Y(Z,W){return gZ.fromArray(Z,W)}class LK{#Z;constructor(Z){this.#Z=Z}next(){if(this.#Z instanceof O)return{done:!0};else{let{head:Z,tail:W}=this.#Z;return this.#Z=W,{value:Z,done:!1}}}}class O extends gZ{}class tZ extends gZ{constructor(Z,W){super();this.head=Z,this.tail=W}}var EK=(Z)=>Z instanceof tZ,xK=(Z)=>Z.head,kK=(Z)=>Z.tail;class TJ{bitSize;byteSize;bitOffset;rawBuffer;constructor(Z,W,J){if(!(Z instanceof Uint8Array))throw globalThis.Error("BitArray can only be constructed from a Uint8Array");if(this.bitSize=W??Z.length*8,this.byteSize=Math.trunc((this.bitSize+7)/8),this.bitOffset=J??0,this.bitSize<0)throw globalThis.Error(`BitArray bit size is invalid: ${this.bitSize}`);if(this.bitOffset<0||this.bitOffset>7)throw globalThis.Error(`BitArray bit offset is invalid: ${this.bitOffset}`);if(Z.length!==Math.trunc((this.bitOffset+this.bitSize+7)/8))throw globalThis.Error("BitArray buffer length is invalid");this.rawBuffer=Z}byteAt(Z){if(Z<0||Z>=this.byteSize)return;return jJ(this.rawBuffer,this.bitOffset,Z)}equals(Z){if(this.bitSize!==Z.bitSize)return!1;let W=Math.trunc(this.bitSize/8);if(this.bitOffset===0&&Z.bitOffset===0){for(let K=0;K<W;K++)if(this.rawBuffer[K]!==Z.rawBuffer[K])return!1;let J=this.bitSize%8;if(J){let K=8-J;if(this.rawBuffer[W]>>K!==Z.rawBuffer[W]>>K)return!1}}else{for(let K=0;K<W;K++){let X=jJ(this.rawBuffer,this.bitOffset,K),V=jJ(Z.rawBuffer,Z.bitOffset,K);if(X!==V)return!1}let J=this.bitSize%8;if(J){let K=jJ(this.rawBuffer,this.bitOffset,W),X=jJ(Z.rawBuffer,Z.bitOffset,W),V=8-J;if(K>>V!==X>>V)return!1}}return!0}get buffer(){if(qK("buffer","Use BitArray.byteAt() or BitArray.rawBuffer instead"),this.bitOffset!==0||this.bitSize%8!==0)throw new globalThis.Error("BitArray.buffer does not support unaligned bit arrays");return this.rawBuffer}get length(){if(qK("length","Use BitArray.bitSize or BitArray.byteSize instead"),this.bitOffset!==0||this.bitSize%8!==0)throw new globalThis.Error("BitArray.length does not support unaligned bit arrays");return this.rawBuffer.length}}function jJ(Z,W,J){if(W===0)return Z[J]??0;else{let K=Z[J]<<W&255,X=Z[J+1]>>8-W;return K|X}}class Q0{constructor(Z){this.value=Z}}var CK={};function qK(Z,W){if(CK[Z])return;console.warn(`Deprecated BitArray.${Z} property used in JavaScript FFI code. ${W}.`),CK[Z]=!0}class r8 extends z{static isResult(Z){return Z instanceof r8}}class H extends r8{constructor(Z){super();this[0]=Z}isOk(){return!0}}var fK=(Z)=>new H(Z);class q extends r8{constructor(Z){super();this[0]=Z}isOk(){return!1}}var yK=(Z)=>new q(Z);function GZ(Z,W){let J=[Z,W];while(J.length){let K=J.pop(),X=J.pop();if(K===X)continue;if(!wK(K)||!wK(X))return!1;if(!pQ(K,X)||vQ(K,X)||_Q(K,X)||$Q(K,X)||mQ(K,X)||uQ(K,X)||cQ(K,X))return!1;let Q=Object.getPrototypeOf(K);if(Q!==null&&typeof Q.equals==="function")try{if(K.equals(X))continue;else return!1}catch{}let[G,F]=hQ(K),M=G(K),U=G(X);if(M.length!==U.length)return!1;for(let I of M)J.push(F(K,I),F(X,I))}return!0}function hQ(Z){if(Z instanceof Map)return[(W)=>W.keys(),(W,J)=>W.get(J)];else{let W=Z instanceof globalThis.Error?["message"]:[];return[(J)=>[...W,...Object.keys(J)],(J,K)=>J[K]]}}function vQ(Z,W){return Z instanceof Date&&(Z>W||Z<W)}function _Q(Z,W){return!(Z instanceof TJ)&&Z.buffer instanceof ArrayBuffer&&Z.BYTES_PER_ELEMENT&&!(Z.byteLength===W.byteLength&&Z.every((J,K)=>J===W[K]))}function $Q(Z,W){return Array.isArray(Z)&&Z.length!==W.length}function mQ(Z,W){return Z instanceof Map&&Z.size!==W.size}function uQ(Z,W){return Z instanceof Set&&(Z.size!=W.size||[...Z].some((J)=>!W.has(J)))}function cQ(Z,W){return Z instanceof RegExp&&(Z.source!==W.source||Z.flags!==W.flags)}function wK(Z){return typeof Z==="object"&&Z!==null}function pQ(Z,W){if(typeof Z!=="object"&&typeof W!=="object"&&(!Z||!W))return!1;if([Promise,WeakSet,WeakMap,Function].some((K)=>Z instanceof K))return!1;return Z.constructor===W.constructor}function W9(Z,W){if(W===0)return 0;else return Z/W}function F8(Z,W,J,K,X,V,Q){let G=new globalThis.Error(V);G.gleam_error=Z,G.file=W,G.module=J,G.line=K,G.function=X,G.fn=X;for(let F in Q)G[F]=Q[F];return G}class OZ extends z{}class AZ extends z{}class cW extends z{}class L extends z{constructor(Z){super();this[0]=Z}}class g extends z{}function Y0(Z,W){if(Z instanceof L){let J=Z[0];return new H(J)}else return new q(W)}function bK(Z,W){if(Z instanceof L)return Z[0];else return W}function G0(Z,W){if(Z instanceof L){let J=Z[0];return W(J)}else return Z}var gK=new WeakMap,F0=new DataView(new ArrayBuffer(8)),M0=0;function U0(Z){let W=gK.get(Z);if(W!==void 0)return W;let J=M0++;if(M0===2147483647)M0=0;return gK.set(Z,J),J}function I0(Z,W){return Z^W+2654435769+(Z<<6)+(Z>>2)|0}function H0(Z){let W=0,J=Z.length;for(let K=0;K<J;K++)W=Math.imul(31,W)+Z.charCodeAt(K)|0;return W}function vK(Z){F0.setFloat64(0,Z);let W=F0.getInt32(0),J=F0.getInt32(4);return Math.imul(73244475,W>>16^W)^J}function dQ(Z){return H0(Z.toString())}function sQ(Z){let W=Object.getPrototypeOf(Z);if(W!==null&&typeof W.hashCode==="function")try{let K=Z.hashCode(Z);if(typeof K==="number")return K}catch{}if(Z instanceof Promise||Z instanceof WeakSet||Z instanceof WeakMap)return U0(Z);if(Z instanceof Date)return vK(Z.getTime());let J=0;if(Z instanceof ArrayBuffer)Z=new Uint8Array(Z);if(Array.isArray(Z)||Z instanceof Uint8Array)for(let K=0;K<Z.length;K++)J=Math.imul(31,J)+VW(Z[K])|0;else if(Z instanceof Set)Z.forEach((K)=>{J=J+VW(K)|0});else if(Z instanceof Map)Z.forEach((K,X)=>{J=J+I0(VW(K),VW(X))|0});else{let K=Object.keys(Z);for(let X=0;X<K.length;X++){let V=K[X],Q=Z[V];J=J+I0(VW(Q),H0(V))|0}}return J}function VW(Z){if(Z===null)return 1108378658;if(Z===void 0)return 1108378659;if(Z===!0)return 1108378657;if(Z===!1)return 1108378656;switch(typeof Z){case"number":return vK(Z);case"string":return H0(Z);case"bigint":return dQ(Z);case"object":return sQ(Z);case"symbol":return U0(Z);case"function":return U0(Z);default:return 0}}var EW=5,N0=Math.pow(2,EW),rQ=N0-1,nQ=N0/2,lQ=N0/4,_Z=0,LW=1,eZ=2,A8=3,D0={type:eZ,bitmap:0,array:[]};function OJ(Z,W){return Z>>>W&rQ}function K9(Z,W){return 1<<OJ(Z,W)}function iQ(Z){return Z-=Z>>1&1431655765,Z=(Z&858993459)+(Z>>2&858993459),Z=Z+(Z>>4)&252645135,Z+=Z>>8,Z+=Z>>16,Z&127}function B0(Z,W){return iQ(Z&W-1)}function QW(Z,W,J){let K=Z.length,X=Array(K);for(let V=0;V<K;++V)X[V]=Z[V];return X[W]=J,X}function aQ(Z,W,J){let K=Z.length,X=Array(K+1),V=0,Q=0;while(V<W)X[Q++]=Z[V++];X[Q++]=J;while(V<K)X[Q++]=Z[V++];return X}function z0(Z,W){let J=Z.length,K=Array(J-1),X=0,V=0;while(X<W)K[V++]=Z[X++];++X;while(X<J)K[V++]=Z[X++];return K}function _K(Z,W,J,K,X,V){let Q=VW(W);if(Q===K)return{type:A8,hash:Q,array:[{type:_Z,k:W,v:J},{type:_Z,k:X,v:V}]};let G={val:!1};return AJ(P0(D0,Z,Q,W,J,G),Z,K,X,V,G)}function AJ(Z,W,J,K,X,V){switch(Z.type){case LW:return oQ(Z,W,J,K,X,V);case eZ:return P0(Z,W,J,K,X,V);case A8:return tQ(Z,W,J,K,X,V)}}function oQ(Z,W,J,K,X,V){let Q=OJ(J,W),G=Z.array[Q];if(G===void 0)return V.val=!0,{type:LW,size:Z.size+1,array:QW(Z.array,Q,{type:_Z,k:K,v:X})};if(G.type===_Z){if(GZ(K,G.k)){if(X===G.v)return Z;return{type:LW,size:Z.size,array:QW(Z.array,Q,{type:_Z,k:K,v:X})}}return V.val=!0,{type:LW,size:Z.size,array:QW(Z.array,Q,_K(W+EW,G.k,G.v,J,K,X))}}let F=AJ(G,W+EW,J,K,X,V);if(F===G)return Z;return{type:LW,size:Z.size,array:QW(Z.array,Q,F)}}function P0(Z,W,J,K,X,V){let Q=K9(J,W),G=B0(Z.bitmap,Q);if((Z.bitmap&Q)!==0){let F=Z.array[G];if(F.type!==_Z){let U=AJ(F,W+EW,J,K,X,V);if(U===F)return Z;return{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,G,U)}}let M=F.k;if(GZ(K,M)){if(X===F.v)return Z;return{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,G,{type:_Z,k:K,v:X})}}return V.val=!0,{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,G,_K(W+EW,M,F.v,J,K,X))}}else{let F=Z.array.length;if(F>=nQ){let M=Array(32),U=OJ(J,W);M[U]=P0(D0,W+EW,J,K,X,V);let I=0,D=Z.bitmap;for(let T=0;T<32;T++){if((D&1)!==0){let R=Z.array[I++];M[T]=R}D=D>>>1}return{type:LW,size:F+1,array:M}}else{let M=aQ(Z.array,G,{type:_Z,k:K,v:X});return V.val=!0,{type:eZ,bitmap:Z.bitmap|Q,array:M}}}}function tQ(Z,W,J,K,X,V){if(J===Z.hash){let Q=R0(Z,K);if(Q!==-1){if(Z.array[Q].v===X)return Z;return{type:A8,hash:J,array:QW(Z.array,Q,{type:_Z,k:K,v:X})}}let G=Z.array.length;return V.val=!0,{type:A8,hash:J,array:QW(Z.array,G,{type:_Z,k:K,v:X})}}return AJ({type:eZ,bitmap:K9(Z.hash,W),array:[Z]},W,J,K,X,V)}function R0(Z,W){let J=Z.array.length;for(let K=0;K<J;K++)if(GZ(W,Z.array[K].k))return K;return-1}function J9(Z,W,J,K){switch(Z.type){case LW:return eQ(Z,W,J,K);case eZ:return ZY(Z,W,J,K);case A8:return WY(Z,K)}}function eQ(Z,W,J,K){let X=OJ(J,W),V=Z.array[X];if(V===void 0)return;if(V.type!==_Z)return J9(V,W+EW,J,K);if(GZ(K,V.k))return V;return}function ZY(Z,W,J,K){let X=K9(J,W);if((Z.bitmap&X)===0)return;let V=B0(Z.bitmap,X),Q=Z.array[V];if(Q.type!==_Z)return J9(Q,W+EW,J,K);if(GZ(K,Q.k))return Q;return}function WY(Z,W){let J=R0(Z,W);if(J<0)return;return Z.array[J]}function j0(Z,W,J,K){switch(Z.type){case LW:return JY(Z,W,J,K);case eZ:return KY(Z,W,J,K);case A8:return XY(Z,K)}}function JY(Z,W,J,K){let X=OJ(J,W),V=Z.array[X];if(V===void 0)return Z;let Q=void 0;if(V.type===_Z){if(!GZ(V.k,K))return Z}else if(Q=j0(V,W+EW,J,K),Q===V)return Z;if(Q===void 0){if(Z.size<=lQ){let G=Z.array,F=Array(Z.size-1),M=0,U=0,I=0;while(M<X){let D=G[M];if(D!==void 0)F[U]=D,I|=1<<M,++U;++M}++M;while(M<G.length){let D=G[M];if(D!==void 0)F[U]=D,I|=1<<M,++U;++M}return{type:eZ,bitmap:I,array:F}}return{type:LW,size:Z.size-1,array:QW(Z.array,X,Q)}}return{type:LW,size:Z.size,array:QW(Z.array,X,Q)}}function KY(Z,W,J,K){let X=K9(J,W);if((Z.bitmap&X)===0)return Z;let V=B0(Z.bitmap,X),Q=Z.array[V];if(Q.type!==_Z){let G=j0(Q,W+EW,J,K);if(G===Q)return Z;if(G!==void 0)return{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,V,G)};if(Z.bitmap===X)return;return{type:eZ,bitmap:Z.bitmap^X,array:z0(Z.array,V)}}if(GZ(K,Q.k)){if(Z.bitmap===X)return;return{type:eZ,bitmap:Z.bitmap^X,array:z0(Z.array,V)}}return Z}function XY(Z,W){let J=R0(Z,W);if(J<0)return Z;if(Z.array.length===1)return;return{type:A8,hash:Z.hash,array:z0(Z.array,J)}}function $K(Z,W){if(Z===void 0)return;let J=Z.array,K=J.length;for(let X=0;X<K;X++){let V=J[X];if(V===void 0)continue;if(V.type===_Z){W(V.v,V.k);continue}$K(V,W)}}class CZ{static fromObject(Z){let W=Object.keys(Z),J=CZ.new();for(let K=0;K<W.length;K++){let X=W[K];J=J.set(X,Z[X])}return J}static fromMap(Z){let W=CZ.new();return Z.forEach((J,K)=>{W=W.set(K,J)}),W}static new(){return new CZ(void 0,0)}constructor(Z,W){this.root=Z,this.size=W}get(Z,W){if(this.root===void 0)return W;let J=J9(this.root,0,VW(Z),Z);if(J===void 0)return W;return J.v}set(Z,W){let J={val:!1},K=this.root===void 0?D0:this.root,X=AJ(K,0,VW(Z),Z,W,J);if(X===this.root)return this;return new CZ(X,J.val?this.size+1:this.size)}delete(Z){if(this.root===void 0)return this;let W=j0(this.root,0,VW(Z),Z);if(W===this.root)return this;if(W===void 0)return CZ.new();return new CZ(W,this.size-1)}has(Z){if(this.root===void 0)return!1;return J9(this.root,0,VW(Z),Z)!==void 0}entries(){if(this.root===void 0)return[];let Z=[];return this.forEach((W,J)=>Z.push([J,W])),Z}forEach(Z){$K(this.root,Z)}hashCode(){let Z=0;return this.forEach((W,J)=>{Z=Z+I0(VW(W),VW(J))|0}),Z}equals(Z){if(!(Z instanceof CZ)||this.size!==Z.size)return!1;try{return this.forEach((W,J)=>{if(!GZ(Z.get(J,!W),W))throw hK}),!0}catch(W){if(W===hK)return!1;throw W}}}var hK=Symbol();function T0(Z){return X9(Z)===0}function VY(Z,W){return!GZ(r(W,Z),new q(void 0))}function mK(Z,W){return VY(W,Z)}function TZ(Z,W,J){return cK(W,J,Z)}function QY(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return K;else{let X=J.head;Z=J.tail,W=P(X,K)}}}function YY(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return QY(K,Y([]));else{let X=J.tail,V=J.head[0];Z=X,W=P(V,K)}}}function pW(Z){return YY(U8(Z),Y([]))}function dW(Z,W){return uK(W,Z)}function GY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return X;else{let Q=K.tail,G=K.head[0],F=K.head[1];Z=Q,W=V(X,G,F),J=V}}}function n8(Z,W,J){return GY(U8(Z),W,J)}class LZ extends z{}class l8 extends z{}function MY(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return K;else Z=J.tail,W=K+1}}function SJ(Z){return MY(Z,0)}function S8(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return K;else{let X=J.head;Z=J.tail,W=P(X,K)}}}function i(Z){return S8(Z,Y([]))}function UY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return i(V);else{let{head:Q,tail:G}=K,F,M=X(Q);if(M instanceof H){let I=M[0];F=P(I,V)}else F=V;let U=F;Z=G,W=X,J=U}}}function i8(Z,W){return UY(Z,W,Y([]))}function IY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return i(V);else{let Q=K.head;Z=K.tail,W=X,J=P(X(Q),V)}}}function HZ(Z,W){return IY(Z,W,Y([]))}function zY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof O)return i(G);else{let{head:F,tail:M}=X,U=P(V(F,Q),G);Z=M,W=V,J=Q+1,K=U}}}function pK(Z,W){return zY(Z,W,0,Y([]))}function HY(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return K;else{let X=J.head;Z=J.tail,W=P(X,K)}}}function SZ(Z,W){return HY(i(Z),W)}function V9(Z,W){return P(W,Z)}function NY(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return i(K);else{let X=J.head;Z=J.tail,W=S8(X,K)}}}function dK(Z){return NY(Z,Y([]))}function UZ(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return X;else{let Q=K.head;Z=K.tail,W=V(X,Q),J=V}}}function O0(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return new q(void 0);else{let{head:X,tail:V}=J,Q=K(X);if(Q instanceof H)return Q;else Z=V,W=K}}}function DY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return i(V);else{let{head:Q,tail:G}=K;if(mK(X,Q))Z=G,W=X,J=V;else Z=G,W=TZ(X,Q,void 0),J=P(Q,V)}}}function sK(Z){return DY(Z,MZ(),Y([]))}function BY(Z,W,J,K,X,V){while(!0){let Q=Z,G=W,F=J,M=K,U=X,I=V,D=P(U,F);if(Q instanceof O)if(M instanceof LZ)return P(i(D),I);else return P(D,I);else{let{head:T,tail:R}=Q,C=G(U,T);if(M instanceof LZ)if(C instanceof OZ)Z=R,W=G,J=D,K=M,X=T,V=I;else if(C instanceof AZ)Z=R,W=G,J=D,K=M,X=T,V=I;else{let j;if(M instanceof LZ)j=P(i(D),I);else j=P(D,I);let E=j;if(R instanceof O)return P(Y([T]),E);else{let{head:A,tail:k}=R,b,B=G(T,A);if(B instanceof OZ)b=new LZ;else if(B instanceof AZ)b=new LZ;else b=new l8;let S=b;Z=k,W=G,J=Y([T]),K=S,X=A,V=E}}else if(C instanceof OZ){let j;if(M instanceof LZ)j=P(i(D),I);else j=P(D,I);let E=j;if(R instanceof O)return P(Y([T]),E);else{let{head:A,tail:k}=R,b,B=G(T,A);if(B instanceof OZ)b=new LZ;else if(B instanceof AZ)b=new LZ;else b=new l8;let S=b;Z=k,W=G,J=Y([T]),K=S,X=A,V=E}}else if(C instanceof AZ){let j;if(M instanceof LZ)j=P(i(D),I);else j=P(D,I);let E=j;if(R instanceof O)return P(Y([T]),E);else{let{head:A,tail:k}=R,b,B=G(T,A);if(B instanceof OZ)b=new LZ;else if(B instanceof AZ)b=new LZ;else b=new l8;let S=b;Z=k,W=G,J=Y([T]),K=S,X=A,V=E}}else Z=R,W=G,J=D,K=M,X=T,V=I}}}function PY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof O)return S8(V,G);else if(V instanceof O)return S8(X,G);else{let{head:F,tail:M}=X,U=V.head,I=V.tail,D=Q(F,U);if(D instanceof OZ)Z=M,W=V,J=Q,K=P(F,G);else if(D instanceof AZ)Z=X,W=I,J=Q,K=P(U,G);else Z=X,W=I,J=Q,K=P(U,G)}}}function RY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return i(V);else{let Q=K.tail;if(Q instanceof O){let G=K.head;return i(P(i(G),V))}else{let G=K.head,F=Q.head,M=Q.tail,U=PY(G,F,X,Y([]));Z=M,W=X,J=P(U,V)}}}}function jY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof O)return S8(V,G);else if(V instanceof O)return S8(X,G);else{let{head:F,tail:M}=X,U=V.head,I=V.tail,D=Q(F,U);if(D instanceof OZ)Z=X,W=I,J=Q,K=P(U,G);else if(D instanceof AZ)Z=M,W=V,J=Q,K=P(F,G);else Z=M,W=V,J=Q,K=P(F,G)}}}function TY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return i(V);else{let Q=K.tail;if(Q instanceof O){let G=K.head;return i(P(i(G),V))}else{let G=K.head,F=Q.head,M=Q.tail,U=jY(G,F,X,Y([]));Z=M,W=X,J=P(U,V)}}}}function OY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return K;else if(X instanceof LZ)if(K.tail instanceof O)return K.head;else Z=RY(K,V,Y([])),W=new l8,J=V;else if(K.tail instanceof O){let G=K.head;return i(G)}else Z=TY(K,V,Y([])),W=new LZ,J=V}}function A0(Z,W){if(Z instanceof O)return Z;else{let J=Z.tail;if(J instanceof O)return Z;else{let K=Z.head,X=J.head,V=J.tail,Q,G=W(K,X);if(G instanceof OZ)Q=new LZ;else if(G instanceof AZ)Q=new LZ;else Q=new l8;let F=Q,M=BY(V,W,Y([K]),F,X,Y([]));return OY(M,new LZ,W)}}}function AY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof O)return i(P([V,Q],G));else{let F=X.head[0];if(GZ(F,V)){let M=X.tail;return S8(G,P([F,Q],M))}else{let M=X.head;Z=X.tail,W=V,J=Q,K=P(M,G)}}}}function S0(Z,W,J){return AY(Z,W,J,Y([]))}function rK(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return;else{let{head:X,tail:V}=J;K(X),Z=V,W=K}}}function nK(Z,W){if(Z instanceof O)return new q(void 0);else{let{head:J,tail:K}=Z;return new H(UZ(K,J,W))}}class z8 extends z{constructor(Z,W,J){super();this.expected=Z,this.found=W,this.path=J}}class ZW extends z{constructor(Z){super();this.function=Z}}function s(Z,W){let J=W.function(Z),K,X;if(K=J[0],X=J[1],X instanceof O)return new H(K);else return new q(X)}function t(Z){return new ZW((W)=>{return[Z,Y([])]})}function qY(Z){return[Z,Y([])]}function CJ(Z,W){return new ZW((J)=>{let K=Z.function(J),X,V;return X=K[0],V=K[1],[W(X),V]})}function wY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(V instanceof O)return X;else{let{head:Q,tail:G}=V,F=Q.function(K),M,U;if(M=F,U=F[1],U instanceof O)return M;else Z=K,W=X,J=G}}}function aK(Z,W){return new ZW((J)=>{let K=Z.function(J),X,V;if(X=K,V=K[1],V instanceof O)return X;else return wY(J,X,W)})}function sW(Z){return new ZW((W)=>{if(VX(W))return[new g,Y([])];else{let K=Z.function(W),X,V;return X=K[0],V=K[1],[new L(X),V]}})}var NZ=new ZW(qY);function oK(Z,W){return Y([new z8(Z,I8(W),Y([]))])}function q0(Z,W,J){let K=J(Z);if(K instanceof H)return[K[0],Y([])];else return[K[0],Y([new z8(W,I8(Z),Y([]))])]}function LY(Z){if(GZ(n(!0),Z))return[!0,Y([])];else if(GZ(n(!1),Z))return[!1,Y([])];else return[!1,oK("Bool",Z)]}function EY(Z){return q0(Z,"Int",KX)}function xY(Z){return q0(Z,"Float",JX)}var BW=new ZW(LY),$Z=new ZW(EY),tK=new ZW(xY);function kY(Z){return q0(Z,"String",XX)}var c=new ZW(kY);function fY(Z,W,J,K,X){let V=K(W),Q=V[1];if(Q instanceof O){let G=V[0],F=X(J),M=F[1];if(M instanceof O){let U=F[0];return[TZ(Z[0],G,U),Z[1]]}else{let U=M;return a8([MZ(),U],Y(["values"]))}}else{let G=Q;return a8([MZ(),G],Y(["keys"]))}}function rW(Z,W){return new ZW((J)=>{let K=WX(J);if(K instanceof H){let X=K[0];return n8(X,[MZ(),Y([])],(V,Q,G)=>{if(V[1]instanceof O)return fY(V,Q,G,Z.function,W.function);else return V})}else return[MZ(),oK("Dict",J)]})}function PW(Z){return new ZW((W)=>{return ZX(W,Z.function,(J,K)=>{return a8(J,Y([K]))},0,Y([]))})}function a8(Z,W){let J=aK(c,Y([(()=>{return CJ($Z,qZ)})()])),K=HZ(W,(V)=>{let Q=n(V),G=s(Q,J);if(G instanceof H)return G[0];else return"<"+I8(Q)+">"}),X=HZ(Z[1],(V)=>{return new z8(V.expected,V.found,SZ(K,V.path))});return[Z[0],X]}function yY(Z,W,J,K,X){while(!0){let V=Z,Q=W,G=J,F=K,M=X;if(V instanceof O){let I=G(F);return a8(I,i(Q))}else{let{head:U,tail:I}=V,D=eK(F,U);if(D instanceof H){let T=D[0];if(T instanceof L){let R=T[0];Z=I,W=P(U,Q),J=G,K=R,X=M}else return M(F,P(U,Q))}else{let T=D[0],R=G(F),C;C=R[0];let j=[C,Y([new z8(T,I8(F),Y([]))])];return a8(j,i(Q))}}}}function w0(Z,W,J){return new ZW((K)=>{let X=yY(Z,Y([]),W.function,K,(U,I)=>{let D=W.function(U),T;T=D[0];let R=[T,Y([new z8("Field","Nothing",Y([]))])];return a8(R,i(I))}),V,Q;V=X[0],Q=X[1];let G=J(V).function(K),F,M;return F=G[0],M=G[1],[F,SZ(Q,M)]})}function $(Z,W,J){return w0(Y([Z]),W,J)}var E0=void 0,QX={};function n(Z){return Z}function qZ(Z){return Z.toString()}function Q9(Z){if(Z==="")return 0;let W=x0(Z);if(W){let J=0;for(let K of W)J++;return J}else return Z.match(/./gsu).length}var YX=void 0;function x0(Z){if(globalThis.Intl&&Intl.Segmenter)return YX||=new Intl.Segmenter,YX.segment(Z)[Symbol.iterator]()}function Y9(Z){let W,J=x0(Z);if(J)W=J.next().value?.segment;else W=Z.match(/./su)?.[0];if(W)return new H([W,Z.slice(W.length)]);else return new q(E0)}function C8(Z){return[Z.charCodeAt(0)|0,Z.slice(1)]}function GW(Z){return Z.toLowerCase()}function G9(Z){return Z.toUpperCase()}function k0(Z,W,J){if(J<=0||W>=Z.length)return"";let K=x0(Z);if(K){while(W-- >0)K.next();let X="";while(J-- >0){let V=K.next().value;if(V===void 0)break;X+=V.segment}return X}else return Z.match(/./gsu).slice(W,W+J).join("")}function EZ(Z,W,J){return Z.slice(W,W+J)}function o8(Z,W){return Z.startsWith(W)}function F9(Z,W){return Z.endsWith(W)}function M9(Z,W){let J=Z.indexOf(W);if(J>=0){let K=Z.slice(0,J),X=Z.slice(J+W.length);return new H([K,X])}else return new q(E0)}var MX=[" ","\t",` 2 - `,"\v","\f","\r","…","\u2028","\u2029"].join(""),VF=new RegExp(`^[${MX}]*`),QF=new RegExp(`[${MX}]*$`);function q8(Z){console.log(Z)}function MZ(){return CZ.new()}function X9(Z){return Z.size}function U8(Z){return gZ.fromArray(Z.entries())}function uK(Z,W){return W.delete(Z)}function r(Z,W){let J=Z.get(W,QX);if(J===QX)return new q(E0);return new H(J)}function cK(Z,W,J){return J.set(Z,W)}function I8(Z){if(typeof Z==="string")return"String";else if(typeof Z==="boolean")return"Bool";else if(Z instanceof r8)return"Result";else if(Z instanceof gZ)return"List";else if(Z instanceof TJ)return"BitArray";else if(Z instanceof CZ)return"Dict";else if(Number.isInteger(Z))return"Int";else if(Array.isArray(Z))return"Array";else if(typeof Z==="number")return"Float";else if(Z===null)return"Nil";else if(Z===void 0)return"Nil";else{let W=typeof Z;return W.charAt(0).toUpperCase()+W.slice(1)}}function UX(Z){return new IX().inspect(Z)}function BZ(Z){let W=Z.toString().replace("+","");if(W.indexOf(".")>=0)return W;else{let J=W.indexOf("e");if(J>=0)return W.slice(0,J)+".0"+W.slice(J);else return W+".0"}}class IX{#Z=new Set;inspect(Z){let W=typeof Z;if(Z===!0)return"True";if(Z===!1)return"False";if(Z===null)return"//js(null)";if(Z===void 0)return"Nil";if(W==="string")return this.#V(Z);if(W==="bigint"||Number.isInteger(Z))return Z.toString();if(W==="number")return BZ(Z);if(Z instanceof Q0)return this.#Q(Z);if(Z instanceof TJ)return this.#G(Z);if(Z instanceof RegExp)return`//js(${Z})`;if(Z instanceof Date)return`//js(Date("${Z.toISOString()}"))`;if(Z instanceof globalThis.Error)return`//js(${Z.toString()})`;if(Z instanceof Function){let K=[];for(let X of Array(Z.length).keys())K.push(String.fromCharCode(X+97));return`//fn(${K.join(", ")}) { ... }`}if(this.#Z.size===this.#Z.add(Z).size)return"//js(circular reference)";let J;if(Array.isArray(Z))J=`#(${Z.map((K)=>this.inspect(K)).join(", ")})`;else if(Z instanceof gZ)J=this.#W(Z);else if(Z instanceof z)J=this.#K(Z);else if(Z instanceof CZ)J=this.#J(Z);else if(Z instanceof Set)return`//js(Set(${[...Z].map((K)=>this.inspect(K)).join(", ")}))`;else J=this.#X(Z);return this.#Z.delete(Z),J}#X(Z){let W=Object.getPrototypeOf(Z)?.constructor?.name||"Object",J=[];for(let V of Object.keys(Z))J.push(`${this.inspect(V)}: ${this.inspect(Z[V])}`);let K=J.length?" "+J.join(", ")+" ":"";return`//js(${W==="Object"?"":W+" "}{${K}})`}#J(Z){let W="dict.from_list([",J=!0;return Z.forEach((K,X)=>{if(!J)W=W+", ";W=W+"#("+this.inspect(X)+", "+this.inspect(K)+")",J=!1}),W+"])"}#K(Z){let W=Object.keys(Z).map((J)=>{let K=this.inspect(Z[J]);return isNaN(parseInt(J))?`${J}: ${K}`:K}).join(", ");return W?`${Z.constructor.name}(${W})`:Z.constructor.name}#W(Z){if(Z instanceof O)return"[]";let W='charlist.from_string("',J="[",K=Z;while(K instanceof tZ){let X=K.head;if(K=K.tail,J!=="[")J+=", ";if(J+=this.inspect(X),W)if(Number.isInteger(X)&&X>=32&&X<=126)W+=String.fromCharCode(X);else W=null}if(W)return W+'")';else return J+"]"}#V(Z){let W='"';for(let J=0;J<Z.length;J++){let K=Z[J];switch(K){case` 3 - `:W+="\\n";break;case"\r":W+="\\r";break;case"\t":W+="\\t";break;case"\f":W+="\\f";break;case"\\":W+="\\\\";break;case'"':W+="\\\"";break;default:if(K<" "||K>"~"&&K<" ")W+="\\u{"+K.charCodeAt(0).toString(16).toUpperCase().padStart(4,"0")+"}";else W+=K}}return W+='"',W}#Q(Z){return`//utfcodepoint(${String.fromCodePoint(Z.value)})`}#G(Z){if(Z.bitSize===0)return"<<>>";let W="<<";for(let J=0;J<Z.byteSize-1;J++)W+=Z.byteAt(J).toString(),W+=", ";if(Z.byteSize*8===Z.bitSize)W+=Z.byteAt(Z.byteSize-1).toString();else{let J=Z.bitSize%8;W+=Z.byteAt(Z.byteSize-1)>>8-J,W+=`:size(${J})`}return W+=">>",W}}function eK(Z,W){if(Z instanceof CZ||Z instanceof WeakMap||Z instanceof Map){let K={},X=Z.get(W,K);if(X===K)return new H(new g);return new H(new L(X))}let J=Number.isInteger(W);if(J&&W>=0&&W<8&&Z instanceof gZ){let K=0;for(let X of Z){if(K===W)return new H(new L(X));K++}return new q("Indexable")}if(J&&Array.isArray(Z)||Z&&typeof Z==="object"||Z&&Object.getPrototypeOf(Z)===Object.prototype){if(W in Z)return new H(new L(Z[W]));return new H(new g)}return new q(J?"Indexable":"Dict")}function ZX(Z,W,J,K,X){if(!(Z instanceof gZ||Array.isArray(Z))){let Q=new z8("List",I8(Z),X);return[X,gZ.fromArray([Q])]}let V=[];for(let Q of Z){let G=W(Q),[F,M]=G;if(M instanceof tZ){let[U,I]=J(G,K.toString());return[X,I]}V.push(F),K++}return[gZ.fromArray(V),X]}function WX(Z){if(Z instanceof CZ)return new H(Z);if(Z instanceof Map||Z instanceof WeakMap)return new H(CZ.fromMap(Z));if(Z==null)return new q("Dict");if(typeof Z!=="object")return new q("Dict");let W=Object.getPrototypeOf(Z);if(W===Object.prototype||W===null)return new H(CZ.fromObject(Z));return new q("Dict")}function JX(Z){if(typeof Z==="number")return new H(Z);return new q(0)}function KX(Z){if(Number.isInteger(Z))return new H(Z);return new q(0)}function XX(Z){if(typeof Z==="string")return new H(Z);return new q("")}function VX(Z){return Z===null||Z===void 0}function U9(Z,W){if(Z>W)return Z;else return W}function HX(Z,W,J){if(J<=0)return"";else if(W<0){let V=Q9(Z)+W;if(V<0)return"";else return k0(Z,V,J)}else return k0(Z,W,J)}function pY(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return K;else{let X=J.head;Z=J.tail,W=K+X}}}function qJ(Z){return pY(Z,"")}function dY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return V;else{let Q=K.head;Z=K.tail,W=X,J=V+X+Q}}}function e8(Z,W){if(Z instanceof O)return"";else{let{head:J,tail:K}=Z;return dY(K,W,J)}}function NX(Z){let J=UX(Z);return n(J)}function PX(Z){if(Z instanceof H)return!0;else return!1}function ZJ(Z,W){if(Z instanceof H)return Z;else{let J=Z[0];return new q(W(J))}}function rZ(Z,W){if(Z instanceof H){let J=Z[0];return W(J)}else return Z}function WJ(Z,W){if(Z instanceof H)return Z[0];else return W}function f0(Z){return JSON.stringify(Z)}function RX(Z){return Object.fromEntries(Z)}function H8(Z){return Z}function jX(Z){let W=[];while(EK(Z))W.push(xK(Z)),Z=kK(Z);return W}function TX(){return null}function OX(Z){try{let W=JSON.parse(Z);return fK(W)}catch(W){return yK(iY(W,Z))}}function iY(Z,W){if(aY(Z))return AX();return oY(Z,W)}function aY(Z){return/((unexpected (end|eof))|(end of data)|(unterminated string)|(json( parse error|\.parse)\: expected '(\:|\}|\])'))/i.test(Z.message)}function oY(Z,W){let J=[tY,eY,WG,ZG];for(let K of J){let X=K(Z,W);if(X)return X}return JJ("")}function tY(Z){let J=/unexpected token '(.)', ".+" is not valid JSON/i.exec(Z.message);if(!J)return null;let K=z9(J[1]);return JJ(K)}function eY(Z){let J=/unexpected token (.) in JSON at position (\d+)/i.exec(Z.message);if(!J)return null;let K=z9(J[1]);return JJ(K)}function ZG(Z,W){let K=/(unexpected character|expected .*) at line (\d+) column (\d+)/i.exec(Z.message);if(!K)return null;let X=Number(K[2]),V=Number(K[3]),Q=JG(X,V,W),G=z9(W[Q]);return JJ(G)}function WG(Z){let J=/unexpected (identifier|token) "(.)"/i.exec(Z.message);if(!J)return null;let K=z9(J[2]);return JJ(K)}function z9(Z){return"0x"+Z.charCodeAt(0).toString(16).toUpperCase()}function JG(Z,W,J){if(Z===1)return W-1;let K=1,X=0;return J.split("").find((V,Q)=>{if(V===` 4 - `)K+=1;if(K===Z)return X=Q+W,!0;return!1}),X}class SX extends z{}var AX=()=>new SX;class CX extends z{constructor(Z){super();this[0]=Z}}var JJ=(Z)=>new CX(Z);class qX extends z{constructor(Z){super();this[0]=Z}}function KG(Z,W){return rZ(OX(Z),(J)=>{let K=s(J,W);return ZJ(K,(X)=>{return new qX(X)})})}function xW(Z,W){return KG(Z,W)}function nW(Z){return f0(Z)}function a(Z){return H8(Z)}function lW(Z){return H8(Z)}function WW(Z){return H8(Z)}function wX(Z){return H8(Z)}function H9(){return TX()}function KJ(Z,W){if(Z instanceof L){let J=Z[0];return W(J)}else return H9()}function h(Z){return RX(Z)}function LX(Z){return jX(Z)}function kW(Z,W){let K=HZ(Z,W);return LX(K)}class d extends z{constructor(Z,W,J,K,X,V,Q){super();this.scheme=Z,this.userinfo=W,this.host=J,this.port=K,this.path=X,this.query=V,this.fragment=Q}}function YG(Z){return 48>=Z&&Z<=57||65>=Z&&Z<=90||97>=Z&&Z<=122||Z===58||Z===46}function RW(Z,W){return new H(new d(W.scheme,W.userinfo,W.host,W.port,W.path,W.query,new L(Z)))}function GG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("#"))if(G===0){let F=V.slice(1);return RW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,Q.host,Q.port,Q.path,new L(M),Q.fragment);return RW(F,U)}else if(V==="")return new H(new d(Q.scheme,Q.userinfo,Q.host,Q.port,Q.path,new L(X),Q.fragment));else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function iW(Z,W){return GG(Z,Z,W,0)}function FG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("?")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,Q.host,Q.port,M,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,Q.host,Q.port,M,Q.query,Q.fragment);return RW(F,U)}else if(V==="")return new H(new d(Q.scheme,Q.userinfo,Q.host,Q.port,X,Q.query,Q.fragment));else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function w8(Z,W){return FG(Z,Z,W,0)}function fW(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K.startsWith("0"))Z=K.slice(1),W=X,J=V*10;else if(K.startsWith("1"))Z=K.slice(1),W=X,J=V*10+1;else if(K.startsWith("2"))Z=K.slice(1),W=X,J=V*10+2;else if(K.startsWith("3"))Z=K.slice(1),W=X,J=V*10+3;else if(K.startsWith("4"))Z=K.slice(1),W=X,J=V*10+4;else if(K.startsWith("5"))Z=K.slice(1),W=X,J=V*10+5;else if(K.startsWith("6"))Z=K.slice(1),W=X,J=V*10+6;else if(K.startsWith("7"))Z=K.slice(1),W=X,J=V*10+7;else if(K.startsWith("8"))Z=K.slice(1),W=X,J=V*10+8;else if(K.startsWith("9"))Z=K.slice(1),W=X,J=V*10+9;else if(K.startsWith("?")){let Q=K.slice(1),G=new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment);return iW(Q,G)}else if(K.startsWith("#")){let Q=K.slice(1),G=new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment);return RW(Q,G)}else if(K.startsWith("/")){let Q=new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment);return w8(K,Q)}else if(K==="")return new H(new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment));else return new q(void 0)}}function N9(Z,W){if(Z.startsWith(":0")){let J=Z.slice(2);return fW(J,W,0)}else if(Z.startsWith(":1")){let J=Z.slice(2);return fW(J,W,1)}else if(Z.startsWith(":2")){let J=Z.slice(2);return fW(J,W,2)}else if(Z.startsWith(":3")){let J=Z.slice(2);return fW(J,W,3)}else if(Z.startsWith(":4")){let J=Z.slice(2);return fW(J,W,4)}else if(Z.startsWith(":5")){let J=Z.slice(2);return fW(J,W,5)}else if(Z.startsWith(":6")){let J=Z.slice(2);return fW(J,W,6)}else if(Z.startsWith(":7")){let J=Z.slice(2);return fW(J,W,7)}else if(Z.startsWith(":8")){let J=Z.slice(2);return fW(J,W,8)}else if(Z.startsWith(":9")){let J=Z.slice(2);return fW(J,W,9)}else if(Z===":")return new H(W);else if(Z==="")return new H(W);else if(Z.startsWith("?")){let J=Z.slice(1);return iW(J,W)}else if(Z.startsWith(":?")){let J=Z.slice(2);return iW(J,W)}else if(Z.startsWith("#")){let J=Z.slice(1);return RW(J,W)}else if(Z.startsWith(":#")){let J=Z.slice(2);return RW(J,W)}else if(Z.startsWith("/"))return w8(Z,W);else if(Z.startsWith(":")){let J=Z.slice(1);if(J.startsWith("/"))return w8(J,W);else return new q(void 0)}else return new q(void 0)}function xX(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V==="")return new H(new d(Q.scheme,Q.userinfo,new L(X),Q.port,Q.path,Q.query,Q.fragment));else if(V.startsWith(":")){let F=EZ(X,0,G),M=new d(Q.scheme,Q.userinfo,new L(F),Q.port,Q.path,Q.query,Q.fragment);return N9(V,M)}else if(V.startsWith("/")){let F=EZ(X,0,G),M=new d(Q.scheme,Q.userinfo,new L(F),Q.port,Q.path,Q.query,Q.fragment);return w8(V,M)}else if(V.startsWith("?")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return RW(F,U)}else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function MG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V==="")return new H(new d(Q.scheme,Q.userinfo,new L(V),Q.port,Q.path,Q.query,Q.fragment));else if(V.startsWith("]"))if(G===0){let F=V.slice(1);return N9(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G+1),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return N9(F,U)}else if(V.startsWith("/"))if(G===0)return w8(V,Q);else{let F=EZ(X,0,G),M=new d(Q.scheme,Q.userinfo,new L(F),Q.port,Q.path,Q.query,Q.fragment);return w8(V,M)}else if(V.startsWith("?"))if(G===0){let F=V.slice(1);return iW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#"))if(G===0){let F=V.slice(1);return RW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return RW(F,U)}else{let F=C8(V),M,U;if(M=F[0],U=F[1],YG(M))Z=X,W=U,J=Q,K=G+1;else return xX(X,X,Q,0)}}}function UG(Z,W){return MG(Z,Z,W,0)}function IG(Z,W){return xX(Z,Z,W,0)}function XJ(Z,W){if(Z.startsWith("["))return UG(Z,W);else if(Z.startsWith(":")){let J=new d(W.scheme,W.userinfo,new L(""),W.port,W.path,W.query,W.fragment);return N9(Z,J)}else if(Z==="")return new H(new d(W.scheme,W.userinfo,new L(""),W.port,W.path,W.query,W.fragment));else return IG(Z,W)}function zG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("@"))if(G===0){let F=V.slice(1);return XJ(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,new L(M),Q.host,Q.port,Q.path,Q.query,Q.fragment);return XJ(F,U)}else if(V==="")return XJ(X,Q);else if(V.startsWith("/"))return XJ(X,Q);else if(V.startsWith("?"))return XJ(X,Q);else if(V.startsWith("#"))return XJ(X,Q);else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function HG(Z,W){return zG(Z,Z,W,0)}function y0(Z,W){if(Z==="//")return new H(new d(W.scheme,W.userinfo,new L(""),W.port,W.path,W.query,W.fragment));else if(Z.startsWith("//")){let J=Z.slice(2);return HG(J,W)}else return w8(Z,W)}function NG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("/"))if(G===0)return y0(V,Q);else{let F=EZ(X,0,G),M=new d(new L(GW(F)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return y0(V,M)}else if(V.startsWith("?"))if(G===0){let F=V.slice(1);return iW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(new L(GW(M)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#"))if(G===0){let F=V.slice(1);return RW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(new L(GW(M)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return RW(F,U)}else if(V.startsWith(":"))if(G===0)return new q(void 0);else{let F=V.slice(1),M=EZ(X,0,G),U=new d(new L(GW(M)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return y0(F,U)}else if(V==="")return new H(new d(Q.scheme,Q.userinfo,Q.host,Q.port,X,Q.query,Q.fragment));else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function D9(Z){let W,J=Z.fragment;if(J instanceof L){let B=J[0];W=Y(["#",B])}else W=Y([]);let K=W,X,V=Z.query;if(V instanceof L){let B=V[0];X=P("?",P(B,K))}else X=K;let Q=X,G=P(Z.path,Q),F,M=Z.host,U=o8(Z.path,"/");if(M instanceof L&&!U)if(M[0]!=="")F=P("/",G);else F=G;else F=G;let I=F,D,T=Z.host,R=Z.port;if(T instanceof L&&R instanceof L){let B=R[0];D=P(":",P(qZ(B),I))}else D=I;let C=D,j,E=Z.scheme,A=Z.userinfo,k=Z.host;if(E instanceof L)if(A instanceof L)if(k instanceof L){let B=E[0],S=A[0],y=k[0];j=P(B,P("://",P(S,P("@",P(y,C)))))}else{let B=E[0];j=P(B,P(":",C))}else if(k instanceof L){let B=E[0],S=k[0];j=P(B,P("://",P(S,C)))}else{let B=E[0];j=P(B,P(":",C))}else if(A instanceof g&&k instanceof L){let B=k[0];j=P("//",P(B,C))}else j=C;return qJ(j)}var DG=new d(new g,new g,new g,new g,"",new g,new g);function b0(Z){return NG(Z,Z,DG,0)}function VJ(Z,W,J){if(Z)return W;else return J()}function o(Z){return Z}class v0 extends z{constructor(Z){super();this.dict=Z}}function wJ(){return new v0(MZ())}function bX(Z,W){let J=Z.dict,K=r(J,W);return PX(K)}function gX(Z){return pW(Z.dict)}var jG=void 0;function _0(Z,W){return new v0(TZ(Z.dict,W,jG))}var FW=()=>globalThis?.document,P9="http://www.w3.org/1999/xhtml",R9=1,m0=3;var hX=!!globalThis.HTMLElement?.prototype?.moveBefore;var m=Y([]),j9=new g;var TG=new cW,OG=new OZ,AG=new AZ;function T9(Z,W){if(Z.name===W.name)return AG;else if(Z.name<W.name)return OG;else return TG}class MW extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class LJ extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class nZ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.kind=Z,this.name=W,this.handler=J,this.include=K,this.prevent_default=X,this.stop_propagation=V,this.debounce=Q,this.throttle=G}}class EJ extends z{constructor(Z,W,J){super();this.prevent_default=Z,this.stop_propagation=W,this.message=J}}class uX extends z{constructor(Z){super();this.kind=Z}}function EG(Z,W){while(!0){let J=Z,K=W;if(J instanceof O)return K;else{let X=J.head;if(X instanceof MW){let V=X.name;if(V==="")Z=J.tail,W=K;else if(V==="class"){let Q=X.value;if(Q==="")Z=J.tail,W=K;else{let G=J.tail;if(G instanceof O){let F=X;Z=G,W=P(F,K)}else{let F=G.head;if(F instanceof MW)if(F.name==="class"){let U=X.kind,I=Q,D=G.tail,T=F.value,R=I+" "+T,C=new MW(U,"class",R);Z=P(C,D),W=K}else{let U=X;Z=G,W=P(U,K)}else{let M=X;Z=G,W=P(M,K)}}}}else if(V==="style"){let Q=X.value;if(Q==="")Z=J.tail,W=K;else{let G=J.tail;if(G instanceof O){let F=X;Z=G,W=P(F,K)}else{let F=G.head;if(F instanceof MW)if(F.name==="style"){let U=X.kind,I=Q,D=G.tail,T=F.value,R=I+";"+T,C=new MW(U,"style",R);Z=P(C,D),W=K}else{let U=X;Z=G,W=P(U,K)}else{let M=X;Z=G,W=P(M,K)}}}}else{let Q=X;Z=J.tail,W=P(Q,K)}}else{let V=X;Z=J.tail,W=P(V,K)}}}}function cX(Z){if(Z instanceof O)return Z;else if(Z.tail instanceof O)return Z;else{let K=A0(Z,(X,V)=>{return T9(V,X)});return EG(K,m)}}var c0=0;function pX(Z,W){return new MW(c0,Z,W)}var p0=1;function dX(Z,W){return new LJ(p0,Z,W)}var d0=2;function sX(Z,W,J,K,X,V,Q){return new nZ(d0,Z,W,J,K,X,V,Q)}var s0=0;var r0=new uX(s0);var n0=2;function w(Z,W){return pX(Z,W)}function rX(Z,W){return dX(Z,W)}function nX(Z,W){if(W)return w(Z,"");else return rX(Z,lW(!1))}function N(Z){return w("class",Z)}function xJ(Z){return w("id",Z)}function L8(Z){return w("href",Z)}function l0(Z){return w("action",Z)}function i0(Z){return w("method",Z)}function lX(Z){return w("accept",e8(Z,","))}function kJ(Z){return nX("disabled",Z)}function iX(Z){return w("name",Z)}function fJ(Z){return w("placeholder",Z)}function aX(Z){return nX("required",Z)}function bW(Z){return w("type",Z)}function a0(Z){return w("value",Z)}class A9 extends z{constructor(Z,W,J){super();this.synchronous=Z,this.before_paint=W,this.after_paint=J}}class oX extends z{constructor(Z,W,J,K,X){super();this.dispatch=Z,this.emit=W,this.select=J,this.root=K,this.provide=X}}function tX(Z,W,J,K,X,V){let Q=new oX(W,J,K,X,V);return rK(Z.synchronous,(G)=>{return G(Q)})}var O9=new A9(Y([]),Y([]),Y([]));function lZ(){return O9}function aW(Z){return new A9(Y([(J)=>{let K=J.dispatch;return Z(K)}]),O9.before_paint,O9.after_paint)}function jW(Z){return UZ(Z,O9,(W,J)=>{return new A9(UZ(J.synchronous,W.synchronous,V9),UZ(J.before_paint,W.before_paint,V9),UZ(J.after_paint,W.after_paint,V9))})}function iZ(){return null}function yJ(Z,W){let J=Z?.get(W);if(J!=null)return new H(J);else return new q(void 0)}function bJ(Z,W){return Z&&Z.has(W)}function E8(Z,W,J){return Z??=new Map,Z.set(W,J),Z}function o0(Z,W){return Z?.delete(W),Z}class t0 extends z{}class e0 extends z{constructor(Z,W){super();this.key=Z,this.parent=W}}class eX extends z{constructor(Z,W){super();this.index=Z,this.parent=W}}function xG(Z,W){while(!0){let J=Z,K=W;if(K instanceof O)return!1;else{let{head:X,tail:V}=K,Q=o8(J,X);if(Q)return Q;else Z=J,W=V}}}function UW(Z,W,J){if(J==="")return new eX(W,Z);else return new e0(J,Z)}var YJ=new t0,hJ="\t";function Z7(Z,W){while(!0){let J=Z,K=W;if(J instanceof t0)if(K instanceof O)return"";else{let X=K.tail;return qJ(X)}else if(J instanceof e0){let X=J.key;Z=J.parent,W=P(hJ,P(X,K))}else{let X=J.index;Z=J.parent,W=P(hJ,P(qZ(X),K))}}}function W7(Z){return Z7(Z,Y([]))}function J7(Z,W){if(W instanceof O)return!1;else return xG(W7(Z),W)}var Z6=` 5 - `;function W6(Z,W){return Z7(Z,Y([Z6,W]))}class aZ extends z{constructor(Z,W,J,K,X){super();this.kind=Z,this.key=W,this.mapper=J,this.children=K,this.keyed_children=X}}class uZ extends z{constructor(Z,W,J,K,X,V,Q,G,F,M){super();this.kind=Z,this.key=W,this.mapper=J,this.namespace=K,this.tag=X,this.attributes=V,this.children=Q,this.keyed_children=G,this.self_closing=F,this.void=M}}class JW extends z{constructor(Z,W,J,K){super();this.kind=Z,this.key=W,this.mapper=J,this.content=K}}class D8 extends z{constructor(Z,W,J,K,X,V,Q){super();this.kind=Z,this.key=W,this.mapper=J,this.namespace=K,this.tag=X,this.attributes=V,this.inner_html=Q}}function GJ(Z,W){if(W==="")if(Z==="area")return!0;else if(Z==="base")return!0;else if(Z==="br")return!0;else if(Z==="col")return!0;else if(Z==="embed")return!0;else if(Z==="hr")return!0;else if(Z==="img")return!0;else if(Z==="input")return!0;else if(Z==="link")return!0;else if(Z==="meta")return!0;else if(Z==="param")return!0;else if(Z==="source")return!0;else if(Z==="track")return!0;else if(Z==="wbr")return!0;else return!1;else return!1}function K7(Z,W){if(W instanceof aZ)return new aZ(W.kind,Z,W.mapper,W.children,W.keyed_children);else if(W instanceof uZ)return new uZ(W.kind,Z,W.mapper,W.namespace,W.tag,W.attributes,W.children,W.keyed_children,W.self_closing,W.void);else if(W instanceof JW)return new JW(W.kind,Z,W.mapper,W.content);else return new D8(W.kind,Z,W.mapper,W.namespace,W.tag,W.attributes,W.inner_html)}var TW=0;function J6(Z,W,J,K){return new aZ(TW,Z,W,J,K)}var x8=1;function FJ(Z,W,J,K,X,V,Q,G,F){return new uZ(x8,Z,W,J,K,cX(X),V,Q,G,F)}var MJ=2;function K6(Z,W,J){return new JW(MJ,Z,W,J)}var X7=3;var X6=(Z,W)=>Z===W,OW=(Z,W)=>{if(Z===W)return!0;if(Z==null||W==null)return!1;let J=typeof Z;if(J!==typeof W)return!1;if(J!=="object")return!1;if(Z.constructor!==W.constructor)return!1;if(Array.isArray(Z))return yG(Z,W);return bG(Z,W)},yG=(Z,W)=>{let J=Z.length;if(J!==W.length)return!1;while(J--)if(!OW(Z[J],W[J]))return!1;return!0},bG=(Z,W)=>{let J=Object.keys(Z),K=J.length;if(Object.keys(W).length!==K)return!1;while(K--){let X=J[K];if(!Object.hasOwn(W,X))return!1;if(!OW(Z[X],W[X]))return!1}return!0};class Z8 extends z{constructor(Z,W,J){super();this.handlers=Z,this.dispatched_paths=W,this.next_dispatched_paths=J}}class Y6 extends z{constructor(Z,W){super();this.path=Z,this.handler=W}}class V6 extends z{constructor(Z){super();this.path=Z}}function G6(){return new Z8(iZ(),m,m)}function G7(Z){return new Z8(Z.handlers,Z.next_dispatched_paths,m)}function F7(Z,W,J){return o0(Z,W6(W,J))}function C9(Z,W,J){let K=F7(Z.handlers,W,J);return new Z8(K,Z.dispatched_paths,Z.next_dispatched_paths)}function V7(Z,W,J){return UZ(J,Z,(K,X)=>{if(X instanceof nZ){let V=X.name;return F7(K,W,V)}else return K})}function F6(Z,W,J,K){let X=yJ(Z.handlers,W+Z6+J);if(X instanceof H){let V=X[0],Q=s(K,V);if(Q instanceof H){let G=Q[0];return new Y6(W,G)}else return new V6(W)}else return new V6(W)}function M6(Z,W){let J=P(W.path,Z.next_dispatched_paths),K=new Z8(Z.handlers,Z.dispatched_paths,J);if(W instanceof Y6){let X=W.handler;return[K,new H(X)]}else return[K,new q(void 0)]}function q9(Z,W,J,K){let X=F6(Z,W,J,K);return((V)=>{return M6(Z,V)})(X)}function w9(Z,W){return J7(W,Z.dispatched_paths)}function M7(Z,W,J,K,X){return E8(Z,W6(J,K),CJ(X,(V)=>{return new EJ(V.prevent_default,V.stop_propagation,o(W)(V.message))}))}function UJ(Z,W,J,K,X){let V=M7(Z.handlers,W,J,K,X);return new Z8(V,Z.dispatched_paths,Z.next_dispatched_paths)}function Q7(Z,W,J,K){return UZ(K,Z,(X,V)=>{if(V instanceof nZ){let{name:Q,handler:G}=V;return M7(X,W,J,Q,G)}else return X})}function eW(Z,W){let J=X6(Z,o);if(X6(W,o))return Z;else if(J)return W;else return(X)=>{return Z(W(X))}}function Y7(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(G instanceof O)return X;else{let{head:F,tail:M}=G;Z=U7(X,V,Q,F),W=V,J=Q+1,K=M}}}function U7(Z,W,J,K){if(K instanceof aZ){let X=K.children,V=UW(W,J,K.key);return Y7(Z,V,0,X)}else if(K instanceof uZ){let{attributes:X,children:V}=K,Q=UW(W,J,K.key),F=V7(Z,Q,X);return Y7(F,Q,0,V)}else if(K instanceof JW)return Z;else{let X=K.attributes,V=UW(W,J,K.key);return V7(Z,V,X)}}function W8(Z,W,J,K){let X=U7(Z.handlers,W,J,K);return new Z8(X,Z.dispatched_paths,Z.next_dispatched_paths)}function Q6(Z,W,J,K,X){while(!0){let V=Z,Q=W,G=J,F=K,M=X;if(M instanceof O)return V;else{let{head:U,tail:I}=M;Z=I7(V,Q,G,F,U),W=Q,J=G,K=F+1,X=I}}}function I7(Z,W,J,K,X){if(X instanceof aZ){let V=X.children,Q=UW(J,K,X.key),G=eW(W,X.mapper);return Q6(Z,G,Q,0,V)}else if(X instanceof uZ){let{attributes:V,children:Q}=X,G=UW(J,K,X.key),F=eW(W,X.mapper),U=Q7(Z,F,G,V);return Q6(U,F,G,0,Q)}else if(X instanceof JW)return Z;else{let V=X.attributes,Q=UW(J,K,X.key),G=eW(W,X.mapper);return Q7(Z,G,Q,V)}}function J8(Z,W,J,K,X){let V=I7(Z.handlers,W,J,K,X);return new Z8(V,Z.dispatched_paths,Z.next_dispatched_paths)}function U6(Z){return J8(G6(),o,YJ,0,Z)}function z7(Z,W,J,K,X){let V=Q6(Z.handlers,W,J,K,X);return new Z8(V,Z.dispatched_paths,Z.next_dispatched_paths)}function fZ(Z,W,J){return FJ("",o,"",Z,W,J,iZ(),!1,GJ(Z,""))}function K8(Z,W,J,K){return FJ("",o,Z,W,J,K,iZ(),!1,GJ(W,Z))}function x(Z){return K6("",o,Z)}function cZ(){return K6("",o,"")}function I6(Z,W){let J=o(eW(o(W),Z.mapper));if(Z instanceof aZ){let{children:K,keyed_children:X}=Z;return new aZ(Z.kind,Z.key,J,o(K),o(X))}else if(Z instanceof uZ){let{attributes:K,children:X,keyed_children:V}=Z;return new uZ(Z.kind,Z.key,J,Z.namespace,Z.tag,o(K),o(X),o(V),Z.self_closing,Z.void)}else if(Z instanceof JW)return o(Z);else{let K=Z.attributes;return new D8(Z.kind,Z.key,J,Z.namespace,Z.tag,o(K),Z.inner_html)}}function gW(Z){return x(Z)}function f8(Z,W){return fZ("h1",Z,W)}function vJ(Z,W){return fZ("h2",Z,W)}function f(Z,W){return fZ("div",Z,W)}function IJ(Z,W){return fZ("li",Z,W)}function pZ(Z,W){return fZ("p",Z,W)}function H7(Z,W){return fZ("pre",Z,W)}function N7(Z,W){return fZ("ul",Z,W)}function y8(Z,W){return fZ("a",Z,W)}function IZ(Z,W){return fZ("span",Z,W)}function dZ(Z,W){return fZ("button",Z,W)}function z6(Z,W){return fZ("form",Z,W)}function zJ(Z){return fZ("input",Z,m)}function L9(Z,W){return fZ("label",Z,W)}class _J extends z{constructor(Z,W,J,K){super();this.index=Z,this.removed=W,this.changes=J,this.children=K}}class D7 extends z{constructor(Z,W){super();this.kind=Z,this.content=W}}class B7 extends z{constructor(Z,W){super();this.kind=Z,this.inner_html=W}}class P7 extends z{constructor(Z,W,J){super();this.kind=Z,this.added=W,this.removed=J}}class R7 extends z{constructor(Z,W,J){super();this.kind=Z,this.key=W,this.before=J}}class j7 extends z{constructor(Z,W,J){super();this.kind=Z,this.index=W,this.with=J}}class T7 extends z{constructor(Z,W){super();this.kind=Z,this.index=W}}class O7 extends z{constructor(Z,W,J){super();this.kind=Z,this.children=W,this.before=J}}function H6(Z,W,J,K){return new _J(Z,W,J,K)}var N6=0;function A7(Z){return new D7(N6,Z)}var D6=1;function S7(Z){return new B7(D6,Z)}var B6=2;function P6(Z,W){return new P7(B6,Z,W)}var R6=3;function C7(Z,W){return new R7(R6,Z,W)}var j6=4;function q7(Z){return new T7(j6,Z)}var T6=5;function b8(Z,W){return new j7(T6,Z,W)}var O6=6;function A6(Z,W){return new O7(O6,Z,W)}class L7 extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.kind=Z,this.open_shadow_root=W,this.will_adopt_styles=J,this.observed_attributes=K,this.observed_properties=X,this.requested_contexts=V,this.provided_contexts=Q,this.vdom=G}}class E7 extends z{constructor(Z,W){super();this.kind=Z,this.patch=W}}class x7 extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.data=J}}class k7 extends z{constructor(Z,W,J){super();this.kind=Z,this.key=W,this.value=J}}class E9 extends z{constructor(Z,W){super();this.kind=Z,this.messages=W}}class x9 extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class k9 extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class f9 extends z{constructor(Z,W,J,K){super();this.kind=Z,this.path=W,this.name=J,this.event=K}}class S6 extends z{constructor(Z,W,J){super();this.kind=Z,this.key=W,this.value=J}}var vG=0;function f7(Z,W,J,K,X,V,Q){return new L7(vG,Z,W,J,K,X,V,Q)}var _G=1;function C6(Z){return new E7(_G,Z)}var $G=2;function y7(Z,W){return new x7($G,Z,W)}var mG=3;function b7(Z,W){return new k7(mG,Z,W)}class y9 extends z{constructor(Z,W){super();this.patch=Z,this.events=W}}class v7 extends z{constructor(Z,W,J){super();this.added=Z,this.removed=W,this.events=J}}function uG(Z,W,J,K){if(J==="input"&&W==="")return w9(Z,K);else if(J==="select"&&W==="")return w9(Z,K);else if(J==="textarea"&&W==="")return w9(Z,K);else return!1}function h7(Z,W,J,K,X,V,Q,G){while(!0){let F=Z,M=W,U=J,I=K,D=X,T=V,R=Q,C=G;if(D instanceof O)if(T instanceof O)return new v7(R,C,I);else{let j=T.head;if(j instanceof nZ){let E=j,A=T.tail,k=j.name,b=j.handler,B=P(E,R),S=UJ(I,U,M,k,b);Z=F,W=M,J=U,K=S,X=D,V=A,Q=B,G=C}else{let E=j,A=T.tail,k=P(E,R);Z=F,W=M,J=U,K=I,X=D,V=A,Q=k,G=C}}else if(T instanceof O){let j=D.head;if(j instanceof nZ){let E=j,A=D.tail,k=j.name,b=P(E,C),B=C9(I,M,k);Z=F,W=M,J=U,K=B,X=A,V=T,Q=R,G=b}else{let E=j,A=D.tail,k=P(E,C);Z=F,W=M,J=U,K=I,X=A,V=T,Q=R,G=k}}else{let{head:j,tail:E}=D,A=T.head,k=T.tail,b=T9(j,A);if(b instanceof OZ)if(j instanceof nZ){let B=j.name,S=P(j,C),y=C9(I,M,B);Z=F,W=M,J=U,K=y,X=E,V=T,Q=R,G=S}else{let B=P(j,C);Z=F,W=M,J=U,K=I,X=E,V=T,Q=R,G=B}else if(b instanceof AZ)if(j instanceof MW)if(A instanceof MW){let B,S=A.name;if(S==="value")B=F||j.value!==A.value;else if(S==="checked")B=F||j.value!==A.value;else if(S==="selected")B=F||j.value!==A.value;else B=j.value!==A.value;let y=B,v;if(y)v=P(A,R);else v=R;let _=v;Z=F,W=M,J=U,K=I,X=E,V=k,Q=_,G=C}else if(A instanceof nZ){let{name:B,handler:S}=A,y=P(A,R),v=P(j,C),_=UJ(I,U,M,B,S);Z=F,W=M,J=U,K=_,X=E,V=k,Q=y,G=v}else{let B=P(A,R),S=P(j,C);Z=F,W=M,J=U,K=I,X=E,V=k,Q=B,G=S}else if(j instanceof LJ)if(A instanceof LJ){let B,S=A.name;if(S==="scrollLeft")B=!0;else if(S==="scrollRight")B=!0;else if(S==="value")B=F||!OW(j.value,A.value);else if(S==="checked")B=F||!OW(j.value,A.value);else if(S==="selected")B=F||!OW(j.value,A.value);else B=!OW(j.value,A.value);let y=B,v;if(y)v=P(A,R);else v=R;let _=v;Z=F,W=M,J=U,K=I,X=E,V=k,Q=_,G=C}else if(A instanceof nZ){let{name:B,handler:S}=A,y=P(A,R),v=P(j,C),_=UJ(I,U,M,B,S);Z=F,W=M,J=U,K=_,X=E,V=k,Q=y,G=v}else{let B=P(A,R),S=P(j,C);Z=F,W=M,J=U,K=I,X=E,V=k,Q=B,G=S}else if(A instanceof nZ){let{name:B,handler:S}=A,y=j.prevent_default.kind!==A.prevent_default.kind||j.stop_propagation.kind!==A.stop_propagation.kind||j.debounce!==A.debounce||j.throttle!==A.throttle,v;if(y)v=P(A,R);else v=R;let _=v,u=UJ(I,U,M,B,S);Z=F,W=M,J=U,K=u,X=E,V=k,Q=_,G=C}else{let B=j.name,S=P(A,R),y=P(j,C),v=C9(I,M,B);Z=F,W=M,J=U,K=v,X=E,V=k,Q=S,G=y}else if(A instanceof nZ){let{name:B,handler:S}=A,y=P(A,R),v=UJ(I,U,M,B,S);Z=F,W=M,J=U,K=v,X=D,V=k,Q=y,G=C}else{let B=P(A,R);Z=F,W=M,J=U,K=I,X=D,V=k,Q=B,G=C}}}}function q6(Z,W,J,K,X,V,Q,G,F,M,U,I,D,T){while(!0){let R=Z,C=W,j=J,E=K,A=X,k=V,b=Q,B=G,S=F,y=M,v=U,_=I,u=D,YZ=T;if(R instanceof O)if(j instanceof O)return new y9(new _J(S,b,v,_),YZ);else{let sZ=z7(YZ,u,y,B,j),vZ=A6(j,B-k),FZ=P(vZ,v);return new y9(new _J(S,b,FZ,_),sZ)}else if(j instanceof O){let{head:sZ,tail:vZ}=R,FZ;if(sZ.key===""||!bJ(A,sZ.key))FZ=b+1;else FZ=b;let ZZ=FZ,XZ=W8(YZ,y,B,sZ);Z=vZ,W=C,J=j,K=E,X=A,V=k,Q=ZZ,G=B,F=S,M=y,U=v,I=_,D=u,T=XZ}else{let sZ=R.head,vZ=j.head;if(sZ.key!==vZ.key){let FZ=R.tail,zZ=j.tail,ZZ=yJ(C,vZ.key);if(bJ(E,sZ.key))if(ZZ instanceof H){let p=ZZ[0];if(bJ(A,sZ.key))Z=FZ,W=C,J=j,K=E,X=A,V=k-1,Q=b,G=B,F=S,M=y,U=v,I=_,D=u,T=YZ;else{let VZ=B-k,l=P(C7(vZ.key,VZ),v),PZ=E8(A,vZ.key,void 0),QZ=k+1;Z=P(p,R),W=C,J=j,K=E,X=PZ,V=QZ,Q=b,G=B,F=S,M=y,U=l,I=_,D=u,T=YZ}}else{let p=B-k,KZ=J8(YZ,u,y,B,vZ),VZ=A6(Y([vZ]),p),l=P(VZ,v);Z=R,W=C,J=zZ,K=E,X=A,V=k+1,Q=b,G=B+1,F=S,M=y,U=l,I=_,D=u,T=KZ}else if(ZZ instanceof H){let p=B-k,KZ=P(q7(p),v),VZ=W8(YZ,y,B,sZ),l=k-1;Z=FZ,W=C,J=j,K=E,X=A,V=l,Q=b,G=B,F=S,M=y,U=KZ,I=_,D=u,T=VZ}else{let p=b8(B-k,vZ),KZ,l=W8(YZ,y,B,sZ);KZ=J8(l,u,y,B,vZ);let PZ=KZ;Z=FZ,W=C,J=zZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=P(p,v),I=_,D=u,T=PZ}}else{let FZ=R.head;if(FZ instanceof aZ){let zZ=j.head;if(zZ instanceof aZ){let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=eW(u,p.mapper),l=UW(y,B,p.key),PZ=q6(ZZ.children,ZZ.keyed_children,p.children,p.keyed_children,iZ(),0,0,0,B,l,m,m,VZ,YZ),QZ,jZ=PZ.patch;if(jZ.changes instanceof O)if(jZ.children instanceof O)if(jZ.removed===0)QZ=_;else QZ=P(PZ.patch,_);else QZ=P(PZ.patch,_);else QZ=P(PZ.patch,_);let wW=QZ;Z=XZ,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=v,I=wW,D=u,T=PZ.events}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(B-k,p),l,QZ=W8(YZ,y,B,ZZ);l=J8(QZ,u,y,B,p);let jZ=l;Z=XZ,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=P(VZ,v),I=_,D=u,T=jZ}}else if(FZ instanceof uZ){let zZ=j.head;if(zZ instanceof uZ){let ZZ=FZ,XZ=zZ;if(ZZ.namespace===XZ.namespace&&ZZ.tag===XZ.tag){let p=R.tail,KZ=j.tail,VZ=eW(u,XZ.mapper),l=UW(y,B,XZ.key),PZ=uG(YZ,XZ.namespace,XZ.tag,l),QZ=h7(PZ,l,VZ,YZ,ZZ.attributes,XZ.attributes,m,m),jZ,uW,wW;jZ=QZ.added,uW=QZ.removed,wW=QZ.events;let T8;if(jZ instanceof O&&uW instanceof O)T8=m;else T8=Y([P6(jZ,uW)]);let d8=T8,s8=q6(ZZ.children,ZZ.keyed_children,XZ.children,XZ.keyed_children,iZ(),0,0,0,B,l,d8,m,VZ,wW),G8,O8=s8.patch;if(O8.changes instanceof O)if(O8.children instanceof O)if(O8.removed===0)G8=_;else G8=P(s8.patch,_);else G8=P(s8.patch,_);else G8=P(s8.patch,_);let gQ=G8;Z=p,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=v,I=gQ,D=u,T=s8.events}else{let p=FZ,KZ=R.tail,VZ=zZ,l=j.tail,PZ=b8(B-k,VZ),QZ,uW=W8(YZ,y,B,p);QZ=J8(uW,u,y,B,VZ);let wW=QZ;Z=KZ,W=C,J=l,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=P(PZ,v),I=_,D=u,T=wW}}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(B-k,p),l,QZ=W8(YZ,y,B,ZZ);l=J8(QZ,u,y,B,p);let jZ=l;Z=XZ,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=P(VZ,v),I=_,D=u,T=jZ}}else if(FZ instanceof JW){let zZ=j.head;if(zZ instanceof JW){let ZZ=FZ,XZ=zZ;if(ZZ.content===XZ.content){let p=R.tail,KZ=j.tail;Z=p,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=v,I=_,D=u,T=YZ}else{let p=R.tail,KZ=zZ,VZ=j.tail,l=H6(B,0,Y([A7(KZ.content)]),m);Z=p,W=C,J=VZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=v,I=P(l,_),D=u,T=YZ}}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(B-k,p),l,QZ=W8(YZ,y,B,ZZ);l=J8(QZ,u,y,B,p);let jZ=l;Z=XZ,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=P(VZ,v),I=_,D=u,T=jZ}}else{let zZ=j.head;if(zZ instanceof D8){let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=eW(u,p.mapper),l=UW(y,B,p.key),PZ=h7(!1,l,VZ,YZ,ZZ.attributes,p.attributes,m,m),QZ,jZ,uW;QZ=PZ.added,jZ=PZ.removed,uW=PZ.events;let wW;if(QZ instanceof O&&jZ instanceof O)wW=m;else wW=Y([P6(QZ,jZ)]);let T8=wW,d8;if(ZZ.inner_html===p.inner_html)d8=T8;else d8=P(S7(p.inner_html),T8);let G8=d8,O8;if(G8 instanceof O)O8=_;else O8=P(H6(B,0,G8,Y([])),_);let SK=O8;Z=XZ,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=v,I=SK,D=u,T=uW}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(B-k,p),l,QZ=W8(YZ,y,B,ZZ);l=J8(QZ,u,y,B,p);let jZ=l;Z=XZ,W=C,J=KZ,K=E,X=A,V=k,Q=b,G=B+1,F=S,M=y,U=P(VZ,v),I=_,D=u,T=jZ}}}}}}function HJ(Z,W,J){return q6(Y([W]),iZ(),Y([J]),iZ(),iZ(),0,0,0,0,YJ,m,m,o,G7(Z))}var{setTimeout:cG,clearTimeout:w6}=globalThis,pG=(Z,W)=>FW().createElementNS(Z,W),dG=(Z)=>FW().createTextNode(Z),sG=()=>FW().createDocumentFragment(),NJ=(Z,W,J)=>Z.insertBefore(W,J),$7=hX?(Z,W,J)=>Z.moveBefore(W,J):NJ,rG=(Z,W)=>Z.removeChild(W),nG=(Z,W)=>Z.getAttribute(W),m7=(Z,W,J)=>Z.setAttribute(W,J),lG=(Z,W)=>Z.removeAttribute(W),iG=(Z,W,J,K)=>Z.addEventListener(W,J,K),u7=(Z,W,J)=>Z.removeEventListener(W,J),aG=(Z,W)=>Z.innerHTML=W,oG=(Z,W)=>Z.data=W,X8=Symbol("lustre");class d7{constructor(Z,W,J,K){this.kind=Z,this.key=K,this.parent=W,this.children=[],this.node=J,this.handlers=new Map,this.throttles=new Map,this.debouncers=new Map}get parentNode(){return this.kind===TW?this.node.parentNode:this.node}}var V8=(Z,W,J,K,X)=>{let V=new d7(Z,W,J,X);return J[X8]=V,W?.children.splice(K,0,V),V},tG=(Z)=>{let W="";for(let J=Z[X8];J.parent;J=J.parent)if(J.key)W=`${hJ}${J.key}${W}`;else{let K=J.parent.children.indexOf(J);W=`${hJ}${K}${W}`}return W.slice(1)};class E6{#Z=null;#X;#J;#K=!1;constructor(Z,W,J,{exposeKeys:K=!1}={}){this.#Z=Z,this.#X=W,this.#J=J,this.#K=K}mount(Z){V8(x8,null,this.#Z,0,null),this.#P(this.#Z,null,this.#Z[X8],0,Z)}push(Z){this.#W.push({node:this.#Z[X8],patch:Z}),this.#V()}#W=[];#V(){let Z=this.#W;while(Z.length){let{node:W,patch:J}=Z.pop(),{children:K}=W,{changes:X,removed:V,children:Q}=J;if(g8(X,(G)=>this.#Q(W,G)),V)this.#I(W,K.length-V,V);g8(Q,(G)=>{let F=K[G.index|0];this.#W.push({node:F,patch:G})})}}#Q(Z,W){switch(W.kind){case N6:this.#A(Z,W);break;case D6:this.#R(Z,W);break;case B6:this.#H(Z,W);break;case R6:this.#M(Z,W);break;case j6:this.#D(Z,W);break;case T6:this.#U(Z,W);break;case O6:this.#G(Z,W);break}}#G(Z,{children:W,before:J}){let K=sG(),X=this.#F(Z,J);this.#B(K,null,Z,J|0,W),NJ(Z.parentNode,K,X)}#U(Z,{index:W,with:J}){this.#I(Z,W|0,1);let K=this.#F(Z,W);this.#P(Z.parentNode,K,Z,W|0,J)}#F(Z,W){W=W|0;let{children:J}=Z,K=J.length;if(W<K)return J[W].node;let X=J[K-1];if(!X&&Z.kind!==TW)return null;if(!X)X=Z;while(X.kind===TW&&X.children.length)X=X.children[X.children.length-1];return X.node.nextSibling}#M(Z,{key:W,before:J}){J=J|0;let{children:K,parentNode:X}=Z,V=K[J].node,Q=K[J];for(let U=J+1;U<K.length;++U){let I=K[U];if(K[U]=Q,Q=I,I.key===W){K[J]=I;break}}let{kind:G,node:F,children:M}=Q;if($7(X,F,V),G===TW)this.#Y(X,M,V)}#Y(Z,W,J){for(let K=0;K<W.length;++K){let{kind:X,node:V,children:Q}=W[K];if($7(Z,V,J),X===TW)this.#Y(Z,Q,J)}}#D(Z,{index:W}){this.#I(Z,W,1)}#I(Z,W,J){let{children:K,parentNode:X}=Z,V=K.splice(W,J);for(let Q=0;Q<V.length;++Q){let{kind:G,node:F,children:M}=V[Q];if(rG(X,F),this.#z(V[Q]),G===TW)V.push(...M)}}#z(Z){let{debouncers:W,children:J}=Z;for(let{timeout:K}of W.values())if(K)w6(K);W.clear(),g8(J,(K)=>this.#z(K))}#H({node:Z,handlers:W,throttles:J,debouncers:K},{added:X,removed:V}){g8(V,({name:Q})=>{if(W.delete(Q))u7(Z,Q,L6),this.#N(J,Q,0),this.#N(K,Q,0);else lG(Z,Q),p7[Q]?.removed?.(Z,Q)}),g8(X,(Q)=>this.#O(Z,Q))}#A({node:Z},{content:W}){oG(Z,W??"")}#R({node:Z},{inner_html:W}){aG(Z,W??"")}#B(Z,W,J,K,X){g8(X,(V)=>this.#P(Z,W,J,K++,V))}#P(Z,W,J,K,X){switch(X.kind){case x8:{let V=this.#j(J,K,X);this.#B(V,null,V[X8],0,X.children),NJ(Z,V,W);break}case MJ:{let V=this.#T(J,K,X);NJ(Z,V,W);break}case TW:{let V=this.#T(J,K,X);NJ(Z,V,W),this.#B(Z,W,V[X8],0,X.children);break}case X7:{let V=this.#j(J,K,X);this.#R({node:V},X),NJ(Z,V,W);break}}}#j(Z,W,{kind:J,key:K,tag:X,namespace:V,attributes:Q}){let G=pG(V||P9,X);if(V8(J,Z,G,W,K),this.#K&&K)m7(G,"data-lustre-key",K);return g8(Q,(F)=>this.#O(G,F)),G}#T(Z,W,{kind:J,key:K,content:X}){let V=dG(X??"");return V8(J,Z,V,W,K),V}#O(Z,W){let{debouncers:J,handlers:K,throttles:X}=Z[X8],{kind:V,name:Q,value:G,prevent_default:F,debounce:M,throttle:U}=W;switch(V){case c0:{let I=G??"";if(Q==="virtual:defaultValue"){Z.defaultValue=I;return}else if(Q==="virtual:defaultChecked"){Z.defaultChecked=!0;return}else if(Q==="virtual:defaultSelected"){Z.defaultSelected=!0;return}if(I!==nG(Z,Q))m7(Z,Q,I);p7[Q]?.added?.(Z,I);break}case p0:Z[Q]=G;break;case d0:{if(K.has(Q))u7(Z,Q,L6);let I=F.kind===s0;iG(Z,Q,L6,{passive:I}),this.#N(X,Q,U),this.#N(J,Q,M),K.set(Q,(D)=>this.#S(W,D));break}}}#N(Z,W,J){let K=Z.get(W);if(J>0)if(K)K.delay=J;else Z.set(W,{delay:J});else if(K){let{timeout:X}=K;if(X)w6(X);Z.delete(W)}}#S(Z,W){let{currentTarget:J,type:K}=W,{debouncers:X,throttles:V}=J[X8],Q=tG(J),{prevent_default:G,stop_propagation:F,include:M}=Z;if(G.kind===n0)W.preventDefault();if(F.kind===n0)W.stopPropagation();if(K==="submit")W.detail??={},W.detail.formData=[...new FormData(W.target,W.submitter).entries()];let U=this.#X(W,Q,K,M),I=V.get(K);if(I){let T=Date.now(),R=I.last||0;if(T>R+I.delay)I.last=T,I.lastEvent=W,this.#J(W,U)}let D=X.get(K);if(D)w6(D.timeout),D.timeout=cG(()=>{if(W===V.get(K)?.lastEvent)return;this.#J(W,U)},D.delay);if(!I&&!D)this.#J(W,U)}}var g8=(Z,W)=>{if(Array.isArray(Z))for(let J=0;J<Z.length;J++)W(Z[J]);else if(Z)for(Z;Z.head;Z=Z.tail)W(Z.head)},L6=(Z)=>{let{currentTarget:W,type:J}=Z;W[X8].handlers.get(J)(Z)},c7=(Z)=>{return{added(W){W[Z]=!0},removed(W){W[Z]=!1}}},eG=(Z)=>{return{added(W,J){W[Z]=J}}},p7={checked:c7("checked"),selected:c7("selected"),value:eG("value"),autofocus:{added(Z){queueMicrotask(()=>{Z.focus?.()})}},autoplay:{added(Z){try{Z.play?.()}catch(W){console.error(W)}}}};function Z5(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof O)return[X,i(V)];else{let Q=K.tail,G=K.head[0],F=K.head[1],M=K7(G,F),U;if(G==="")U=X;else U=E8(X,G,M);let I=U,D=P(M,V);Z=Q,W=I,J=D}}}function x6(Z){return Z5(Z,iZ(),m)}function s7(Z,W,J){let K=x6(J),X,V;return X=K[0],V=K[1],FJ("",o,"",Z,W,V,X,!1,GJ(Z,""))}function r7(Z,W,J,K){let X=x6(K),V,Q;return V=X[0],Q=X[1],FJ("",o,Z,W,J,Q,V,!1,GJ(W,Z))}function n7(Z){let W=x6(Z),J,K;return J=W[0],K=W[1],J6("",o,K,J)}var l7=(Z)=>{let W=V8(x8,null,Z,0,null),J=0;for(let Q=Z.firstChild;Q;Q=Q.nextSibling)if(i7(Q))J+=1;if(J===0){let Q=FW().createTextNode("");return V8(MJ,W,Q,0,null),Z.replaceChildren(Q),cZ()}if(J===1)return k6(W,Z).head[1];let K=FW().createTextNode(""),X=V8(TW,W,K,0,null),V=k6(X,Z);return Z.insertBefore(K,Z.firstChild),n7(V)},i7=(Z)=>{switch(Z.nodeType){case R9:return!0;case m0:return!!Z.data;default:return!1}},W5=(Z,W,J,K)=>{if(!i7(W))return null;switch(W.nodeType){case R9:{let X=V8(x8,Z,W,K,J),V=W.localName,Q=W.namespaceURI,G=!Q||Q===P9;if(G&&J5.includes(V))K5(V,W);let F=X5(W),M=k6(X,W);return G?s7(V,F,M):r7(Q,V,F,M)}case m0:return V8(MJ,Z,W,K,null),x(W.data);default:return null}},J5=["input","select","textarea"],K5=(Z,W)=>{let{value:J,checked:K}=W;if(Z==="input"&&W.type==="checkbox"&&!K)return;if(Z==="input"&&W.type==="radio"&&!K)return;if(W.type!=="checkbox"&&W.type!=="radio"&&!J)return;queueMicrotask(()=>{if(W.value=J,W.checked=K,W.dispatchEvent(new Event("input",{bubbles:!0})),W.dispatchEvent(new Event("change",{bubbles:!0})),FW().activeElement!==W)W.dispatchEvent(new Event("blur",{bubbles:!0}))})},k6=(Z,W)=>{let J=null,K=W.firstChild,X=null,V=0;while(K){let Q=K.nodeType===R9?K.getAttribute("data-lustre-key"):null;if(Q!=null)K.removeAttribute("data-lustre-key");let G=W5(Z,K,Q,V),F=K.nextSibling;if(G){let M=new tZ([Q??"",G],null);if(X)X=X.tail=M;else X=J=M;V+=1}else W.removeChild(K);K=F}if(!X)return m;return X.tail=m,J},X5=(Z)=>{let W=Z.attributes.length,J=m;while(W-- >0){let K=Z.attributes[W];if(K.name==="xmlns")continue;J=new tZ(V5(K),J)}return J},V5=(Z)=>{let{localName:W,value:J}=Z;return w(W,J)};var B8=()=>!!FW();class b9{constructor(Z,[W,J],K,X){this.root=Z,this.#Z=W,this.#X=K,this.#J=X,this.root.addEventListener("context-request",(G)=>{if(!(G.context&&G.callback))return;if(!this.#Q.has(G.context))return;G.stopImmediatePropagation();let F=this.#Q.get(G.context);if(G.subscribe){let M=()=>{F.subscribers=F.subscribers.filter((U)=>U!==G.callback)};F.subscribers.push([G.callback,M]),G.callback(F.value,M)}else G.callback(F.value)});let V=(G,F,M)=>F6(this.#W,F,M,G),Q=(G,F)=>{let[M,U]=M6(this.#W,F);if(this.#W=M,U.isOk()){let I=U[0];if(I.stop_propagation)G.stopPropagation();if(I.prevent_default)G.preventDefault();this.dispatch(I.message,!1)}};this.#V=new E6(this.root,V,Q),this.#K=l7(this.root),this.#W=G6(),this.#z(J),this.#H()}root=null;dispatch(Z,W=!1){if(this.#G)this.#U.push(Z);else{let[J,K]=this.#J(this.#Z,Z);this.#Z=J,this.#I(K,W)}}emit(Z,W){(this.root.host??this.root).dispatchEvent(new CustomEvent(Z,{detail:W,bubbles:!0,composed:!0}))}provide(Z,W){if(!this.#Q.has(Z))this.#Q.set(Z,{value:W,subscribers:[]});else{let J=this.#Q.get(Z);if(OW(J.value,W))return;J.value=W;for(let K=J.subscribers.length-1;K>=0;K--){let[X,V]=J.subscribers[K];if(!X){J.subscribers.splice(K,1);continue}X(W,V)}}}#Z;#X;#J;#K;#W;#V;#Q=new Map;#G=!1;#U=[];#F=m;#M=m;#Y=null;#D={dispatch:(Z)=>this.dispatch(Z),emit:(Z,W)=>this.emit(Z,W),select:()=>{},root:()=>this.root,provide:(Z,W)=>this.provide(Z,W)};#I(Z,W=!1){if(this.#z(Z),!this.#Y)if(W)this.#Y="sync",queueMicrotask(()=>this.#H());else this.#Y=requestAnimationFrame(()=>this.#H())}#z(Z){this.#G=!0;while(!0){for(let J=Z.synchronous;J.tail;J=J.tail)J.head(this.#D);if(this.#F=o7(this.#F,Z.before_paint),this.#M=o7(this.#M,Z.after_paint),!this.#U.length)break;let W=this.#U.shift();[this.#Z,Z]=this.#J(this.#Z,W)}this.#G=!1}#H(){this.#Y=null;let Z=this.#X(this.#Z),{patch:W,events:J}=HJ(this.#W,this.#K,Z);if(this.#W=J,this.#K=Z,this.#V.push(W),this.#F instanceof tZ){let K=a7(this.#F);this.#F=m,queueMicrotask(()=>{this.#I(K,!0)})}if(this.#M instanceof tZ){let K=a7(this.#M);this.#M=m,requestAnimationFrame(()=>{this.#I(K,!0)})}}}function a7(Z){return{synchronous:Z,after_paint:m,before_paint:m}}function o7(Z,W){if(Z instanceof O)return W;else if(W instanceof O)return Z;else return SZ(Z,W)}class y6 extends z{constructor(Z){super();this.message=Z}}class b6 extends z{constructor(Z){super();this.callback=Z}}class g6 extends z{constructor(Z){super();this.callback=Z}}class P8 extends z{constructor(Z){super();this.message=Z}}class h8 extends z{constructor(Z,W){super();this.name=Z,this.data=W}}class g9 extends z{constructor(Z,W){super();this.key=Z,this.value=W}}class v8 extends z{}class ZV extends z{constructor(Z,W,J,K,X,V,Q,G,F,M){super();this.open_shadow_root=Z,this.adopt_styles=W,this.delegates_focus=J,this.attributes=K,this.properties=X,this.contexts=V,this.is_form_associated=Q,this.on_form_autofill=G,this.on_form_reset=F,this.on_form_restore=M}}function WV(Z){let W=new ZV(!0,!0,!1,m,m,m,!1,j9,j9,j9);return UZ(Z,W,(J,K)=>{return K.apply(J)})}class KV{#Z;constructor(Z,[W,J],K,X){this.#Z=new b9(Z,[W,J],X,K)}send(Z){switch(Z.constructor){case P8:{this.dispatch(Z.message,!1);break}case h8:{this.emit(Z.name,Z.data);break}case v8:break}}dispatch(Z){this.#Z.dispatch(Z)}emit(Z,W){this.#Z.emit(Z,W)}}var XV=({init:Z,update:W,view:J},K,X)=>{if(!B8())return new q(new $J);let V=K instanceof HTMLElement?K:FW().querySelector(K);if(!V)return new q(new h6(K));return new H(new KV(V,Z(X),W,J))};class Q5{#Z;#X;#J;#K;#W;#V;#Q=MZ();#G=new Set;constructor([Z,W],J,K,X){this.#Z=Z,this.#X=J,this.#J=K,this.#K=X,this.#W=this.#J(this.#Z),this.#V=U6(this.#W),this.#Y(W)}send(Z){switch(Z.constructor){case y6:{let{message:W}=Z,J=this.#U(W),K=HJ(this.#V,this.#W,J);this.#W=J,this.#V=K.events,this.broadcast(C6(K.patch));return}case b6:{let{callback:W}=Z;this.#G.add(W),W(f7(this.#K.open_shadow_root,this.#K.adopt_styles,pW(this.#K.attributes),pW(this.#K.properties),pW(this.#K.contexts),this.#Q,this.#W));return}case g6:{let{callback:W}=Z;this.#G.delete(W);return}case P8:{let{message:W}=Z,[J,K]=this.#X(this.#Z,W),X=this.#J(J),V=HJ(this.#V,this.#W,X);this.#Y(K),this.#Z=J,this.#W=X,this.#V=V.events,this.broadcast(C6(V.patch));return}case h8:{let{name:W,data:J}=Z;this.broadcast(y7(W,J));return}case g9:{let{key:W,value:J}=Z,K=r(this.#Q,W);if(K.isOk()&&OW(K[0],J))return;this.#Q=TZ(this.#Q,W,J),this.broadcast(b7(W,J));return}case v8:{this.#Z=null,this.#X=null,this.#J=null,this.#K=null,this.#W=null,this.#V=null,this.#Q=null,this.#G.clear();return}default:return}}broadcast(Z){for(let W of this.#G)W(Z)}#U(Z){switch(Z.constructor){case E9:{let{messages:W}=Z,J=this.#Z,K=lZ();for(let X=W;X.head;X=X.tail){let V=this.#U(X.head);if(V instanceof H){J=V[0][0],K=jW(gZ.fromArray([K,V[0][1]]));break}}return this.#Y(K),this.#Z=J,this.#J(this.#Z)}case x9:{let{name:W,value:J}=Z,K=this.#F(W,J);if(K instanceof q)return this.#W;else{let[X,V]=this.#X(this.#Z,K[0]);return this.#Y(V),this.#Z=X,this.#J(this.#Z)}}case k9:{let{name:W,value:J}=Z,K=this.#M(W,J);if(K instanceof q)return this.#W;else{let[X,V]=this.#X(this.#Z,K[0]);return this.#Y(V),this.#Z=X,this.#J(this.#Z)}}case f9:{let{path:W,name:J,event:K}=Z,[X,V]=q9(this.#V,W,J,K);if(this.#V=X,V instanceof q)return this.#W;else{let[Q,G]=this.#X(this.#Z,V[0].message);return this.#Y(G),this.#Z=Q,this.#J(this.#Z)}}case S6:{let{key:W,value:J}=Z,K=r(this.#K.contexts,W);if(K instanceof q)return this.#W;if(K=s(J,K[0]),K instanceof q)return this.#W;let[X,V]=this.#X(this.#Z,K[0]);return this.#Y(V),this.#Z=X,this.#J(this.#Z)}}}#F(Z,W){let J=r(this.#K.attributes,Z);switch(J.constructor){case H:return J[0](W);case q:return new q(void 0)}}#M(Z,W){let J=r(this.#K.properties,Z);switch(J.constructor){case H:return J[0](W);case q:return new q(void 0)}}#Y(Z){let W=(Q)=>this.send(new P8(Q)),J=(Q,G)=>this.send(new h8(Q,G)),K=()=>{return},X=()=>{return},V=(Q,G)=>this.send(new g9(Q,G));globalThis.queueMicrotask(()=>{tX(Z,W,J,K,X,V)})}}class VV extends z{constructor(Z,W,J,K){super();this.init=Z,this.update=W,this.view=J,this.config=K}}class h6 extends z{constructor(Z){super();this.selector=Z}}class $J extends z{}function QV(Z,W,J){return new VV(Z,W,J,WV(m))}function YV(Z,W,J){return VJ(!B8(),new q(new $J),()=>{return XV(Z,W,J)})}var F5={handle_external_links:!1,handle_internal_links:!0},UV=globalThis?.window?.location?.href,$6=()=>{if(!UV)return new q(void 0);else return new H(_6(new URL(UV)))},m6=(Z,W=F5)=>{document.addEventListener("click",(J)=>{let K=zV(J.target);if(!K)return;try{let X=new URL(K.href),V=_6(X),Q=X.host!==window.location.host||K.target==="_blank";if(!W.handle_external_links&&Q)return;if(!W.handle_internal_links&&!Q)return;if(J.preventDefault(),!Q)window.history.pushState({},"",K.href),window.requestAnimationFrame(()=>{if(X.hash)document.getElementById(X.hash.slice(1))?.scrollIntoView();else window.scrollTo(0,0)});return Z(V)}catch{return}}),window.addEventListener("popstate",(J)=>{J.preventDefault();let K=new URL(window.location.href),X=_6(K);window.requestAnimationFrame(()=>{if(K.hash)document.getElementById(K.hash.slice(1))?.scrollIntoView();else window.scrollTo(0,0)}),Z(X)}),window.addEventListener("modem-push",({detail:J})=>{Z(J)}),window.addEventListener("modem-replace",({detail:J})=>{Z(J)})},IV=(Z)=>{window.history.pushState({},"",D9(Z)),window.requestAnimationFrame(()=>{if(Z.fragment[0])document.getElementById(Z.fragment[0])?.scrollIntoView()}),window.dispatchEvent(new CustomEvent("modem-push",{detail:Z}))};var zV=(Z)=>{if(!Z||Z.tagName==="BODY")return null;else if(Z.tagName==="A")return Z;else return zV(Z.parentElement)},_6=(Z)=>{return new d(Z.protocol?new L(Z.protocol.slice(0,-1)):new g,new g,Z.hostname?new L(Z.hostname):new g,Z.port?new L(Number(Z.port)):new g,Z.pathname,Z.search?new L(Z.search.slice(1)):new g,Z.hash?new L(Z.hash.slice(1)):new g)};function NV(Z){return aW((W)=>{return VJ(!B8(),void 0,()=>{return m6((J)=>{let X=Z(J);return W(X)})})})}function HV(Z){if(Z==="")return new g;else return new L(Z)}var h9=new d(new g,new g,new g,new g,"",new g,new g);function v9(Z,W,J){return aW((K)=>{return VJ(!B8(),void 0,()=>{return IV(new d(h9.scheme,h9.userinfo,h9.host,h9.port,Z,G0(W,HV),G0(J,HV)))})})}class DV extends z{constructor(Z,W){super();this.query=Z,this.module_path=W}}class u6 extends z{constructor(Z){super();this.queries=Z}}function BV(){return new u6(MZ())}function vW(Z,W,J,K){let X=new DV(J,K);return new u6(TZ(Z.queries,W,X))}function c6(Z,W){return r(Z.queries,W)}class _9 extends z{}class $9 extends z{}class PV extends z{}class RV extends z{}class jV extends z{}class TV extends z{}class OV extends z{}class AV extends z{}class SV extends z{}class d6 extends z{}class m9 extends z{}function CV(Z){if(Z instanceof _9)return"GET";else if(Z instanceof $9)return"POST";else if(Z instanceof PV)return"HEAD";else if(Z instanceof RV)return"PUT";else if(Z instanceof jV)return"DELETE";else if(Z instanceof TV)return"TRACE";else if(Z instanceof OV)return"CONNECT";else if(Z instanceof AV)return"OPTIONS";else if(Z instanceof SV)return"PATCH";else return Z[0]}function qV(Z){if(Z instanceof d6)return"http";else return"https"}function wV(Z){let W=GW(Z);if(W==="http")return new H(new d6);else if(W==="https")return new H(new m9);else return new q(void 0)}class mJ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.method=Z,this.headers=W,this.body=J,this.scheme=K,this.host=X,this.port=V,this.path=Q,this.query=G}}function EV(Z){return new d(new L(qV(Z.scheme)),new g,new L(Z.host),Z.port,Z.path,Z.query,new g)}function H5(Z){return rZ((()=>{let W=Z.scheme,J=bK(W,"");return wV(J)})(),(W)=>{return rZ((()=>{let J=Z.host;return Y0(J,void 0)})(),(J)=>{let K=new mJ(new _9,Y([]),"",W,J,Z.port,Z.path,Z.query);return new H(K)})})}function s6(Z,W,J){let K=S0(Z.headers,GW(W),J);return new mJ(Z.method,K,Z.body,Z.scheme,Z.host,Z.port,Z.path,Z.query)}function xV(Z,W){return new mJ(Z.method,Z.headers,W,Z.scheme,Z.host,Z.port,Z.path,Z.query)}function kV(Z,W){return new mJ(W,Z.headers,Z.body,Z.scheme,Z.host,Z.port,Z.path,Z.query)}function fV(Z){let J=b0(Z);return rZ(J,H5)}class r6 extends z{constructor(Z,W,J){super();this.status=Z,this.headers=W,this.body=J}}class _8{constructor(Z){this.promise=Z}static wrap(Z){return Z instanceof Promise?new _8(Z):Z}static unwrap(Z){return Z instanceof _8?Z.promise:Z}}function _W(Z){return Promise.resolve(_8.wrap(Z))}function c9(Z,W){return Z.then((J)=>W(_8.unwrap(J)))}function p9(Z,W){return Z.then((J)=>_8.wrap(W(_8.unwrap(J))))}function l6(Z){return new r6(Z.status,gZ.fromArray([...Z.headers]),Z)}function P5(Z){let W=D9(EV(Z)),J=CV(Z.method).toUpperCase(),K={headers:R5(Z.headers),method:J};return[W,K]}function i6(Z){let[W,J]=P5(Z);if(J.method!=="GET"&&J.method!=="HEAD")J.body=Z.body;return new globalThis.Request(W,J)}function R5(Z){let W=new globalThis.Headers;for(let[J,K]of Z)W.append(J.toLowerCase(),K);return W}async function d9(Z){let W;try{W=await Z.body.text()}catch(J){return new q(new a6)}return new H(Z.withFields({body:W}))}class s9 extends z{constructor(Z){super();this[0]=Z}}class a6 extends z{}class bV extends z{constructor(Z,W){super();this.endpoint=Z,this.headers=W}}function o6(Z,W){return new bV(Z,W)}function zW(Z,W,J){let K=h(Y([["query",a(W)],["variables",J]]));return rZ((()=>{let X=fV(Z.endpoint);return ZJ(X,(V)=>{return"Invalid endpoint URL"})})(),(X)=>{let V,G=kV(X,new $9),F=xV(G,nW(K));V=s6(F,"content-type","application/json");let M=V,U=UZ(Z.headers,M,(I,D)=>{return s6(I,D[0],D[1])});return new H(U)})}function wZ(Z,W){return rZ((()=>{let J=xW(Z,NZ);return ZJ(J,(K)=>{return"Failed to decode JSON response"})})(),(J)=>{let K=$("data",W,(V)=>{return t(V)}),X=s(J,K);return ZJ(X,(V)=>{return"Failed to decode response data: "+NX(V)+". Response body: "+Z})})}async function t6(Z){try{let W=i6(Z),J=new Request(W,{credentials:"include"}),K=await fetch(J),X=l6(K);return new H(X)}catch(W){return new q(new s9(W.toString()))}}var $V="src/squall_cache.gleam";class AW extends z{}class SW extends z{constructor(Z){super();this[0]=Z}}class CW extends z{constructor(Z){super();this[0]=Z}}class r9 extends z{}class mV extends z{}class e6 extends z{}class cJ extends z{constructor(Z,W,J){super();this.data=Z,this.timestamp=W,this.status=J}}class oZ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.entities=Z,this.optimistic_entities=W,this.optimistic_mutations=J,this.queries=K,this.pending_fetches=X,this.get_headers=V,this.mutation_counter=Q,this.endpoint=G}}function uV(Z){return new oZ(MZ(),MZ(),MZ(),MZ(),wJ(),()=>{return Y([])},0,Z)}function n9(Z,W){return Z+":"+nW(W)}function gV(Z){let W=Y9(Z);if(W instanceof H){let J=W[0][0],K=W[0][1];return G9(J)+K}else return Z}function ZK(Z){let J=i(Z),K=O0(J,(X)=>{if(X==="data")return new q(void 0);else if(X==="results")return new q(void 0);else if(X==="edges")return new q(void 0);else if(X==="node")return new q(void 0);else if(F9(X,"s")){let Q=Q9(X),G=HX(X,0,Q-1);return new H(gV(G))}else return new H(gV(X))});return WJ(K,"Entity")}function O5(Z){if(r(Z,"node")instanceof H)return!0;else return!1}function A5(Z){let W=s(Z,PW(NZ));if(W instanceof H){let J=W[0];if(J instanceof O)return!1;else{let K=J.head,X=s(K,rW(c,NZ));if(X instanceof H){let V=X[0];return O5(V)}else return!1}}else return!1}function S5(Z,W,J){let K=n9(W,J),X=r(Z.queries,K);if(X instanceof H){let V=X[0],Q=new cJ(V.data,V.timestamp,new e6),G=TZ(Z.queries,K,Q);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,G,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else{let V=new cJ("",0,new e6),Q=TZ(Z.queries,K,V);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,Q,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}}function R8(Z,W,J){let K=n9(W,J),X=dW(Z.queries,K);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,X,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}function C5(Z,W,J,K){let X,V=r(Z.optimistic_entities,J);if(V instanceof H){let F=V[0];X=new L(F)}else{let F=r(Z.entities,J);if(F instanceof H){let M=F[0];X=new L(M)}else X=new g}let G=K(X);return new oZ(Z.entities,TZ(Z.optimistic_entities,J,G),TZ(Z.optimistic_mutations,W,J),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}function cV(Z,W){let J=r(Z.optimistic_mutations,W);if(J instanceof H){let K=J[0];return new oZ(Z.entities,dW(Z.optimistic_entities,K),dW(Z.optimistic_mutations,W),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else return Z}function pV(Z){return!T0(Z.optimistic_mutations)}function DJ(Z){let W=s(Z,rW(c,NZ));if(W instanceof H){let K=W[0],X=U8(K),V=HZ(X,(Q)=>{let G,F;return G=Q[0],F=Q[1],[G,DJ(F)]});return h(V)}else{let J=s(Z,PW(NZ));if(J instanceof H){let K=J[0];return kW(K,DJ)}else{let K=s(Z,c);if(K instanceof H){let X=K[0];return a(X)}else{let X=s(Z,$Z);if(X instanceof H){let V=X[0];return WW(V)}else{let V=s(Z,tK);if(V instanceof H){let Q=V[0];return wX(Q)}else{let Q=s(Z,BW);if(Q instanceof H){let G=Q[0];return lW(G)}else return H9()}}}}}}function q5(Z,W){let J=nW(Z),K=nW(W),X=xW(J,NZ),V=xW(K,NZ);if(X instanceof H&&V instanceof H){let Q=X[0],G=V[0],F=s(Q,rW(c,NZ)),M=s(G,rW(c,NZ));if(F instanceof H&&M instanceof H){let U=F[0],I=M[0],D,T=SZ(pW(U),pW(I));D=sK(T);let C=i8(D,(j)=>{let E,A=r(I,j);if(A instanceof H)E=A;else E=r(U,j);let k=E;if(k instanceof H){let b=k[0];return new H([j,DJ(b)])}else return new q(void 0)});return h(C)}else return W}else return W}function Q8(Z,W){return n8(W,Z,(J,K,X)=>{let V=r(J,K);if(V instanceof H){let Q=V[0],G=q5(Q,X);return TZ(J,K,G)}else return TZ(J,K,X)})}function hV(Z){let W=M9(Z,":");if(W instanceof H){let J=W[0][0],K=W[0][1],X=xW(K,NZ);if(X instanceof H){let V=X[0];return new H([J,DJ(V)])}else return new H([J,H9()])}else return new q(void 0)}function w5(Z,W,J,K,X,V,Q){let G=c6(W,J);if(G instanceof H){let F=G[0];return aW((M)=>{let U=Z.get_headers(),I=o6(Z.endpoint,U),D=zW(I,F.query,K),T;if(D instanceof H)T=D[0];else throw F8("let_assert",$V,"squall_cache",767,"create_mutation_effect","Pattern match failed, no pattern matched the value.",{value:D,start:24617,end:24701,pattern_start:24628,pattern_end:24635});let R,C=t6(T);R=p9(C,(E)=>{if(E instanceof H){let A=E[0],k=d9(A);return c9(k,(b)=>{if(b instanceof H){let B=b[0],S=V(B.body);if(S instanceof H){let y=S[0];return M(Q(X,new H(y),B.body)),_W(void 0)}else{let y=S[0];return M(Q(X,new q("Parse error: "+y),B.body)),_W(void 0)}}else return M(Q(X,new q("Failed to read response"),"")),_W(void 0)})}else return M(Q(X,new q("Failed to fetch"),"")),_W(void 0)});let j=R;return})}else return aW((F)=>{F(Q(X,new q("Query not found in registry"),""));return})}function dV(Z,W,J,K,X,V,Q,G){let F="mutation-"+qZ(Z.mutation_counter),M=C5(Z,F,X,V),U=new oZ(M.entities,M.optimistic_entities,M.optimistic_mutations,M.queries,M.pending_fetches,M.get_headers,Z.mutation_counter+1,M.endpoint),I=w5(U,W,J,K,F,Q,G);return[U,F,I]}function L5(Z,W,J,K,X){return aW((V)=>{let Q=Z.get_headers(),G=o6(Z.endpoint,Q),F=zW(G,W,K),M;if(F instanceof H)M=F[0];else throw F8("let_assert",$V,"squall_cache",1073,"create_fetch_effect","Pattern match failed, no pattern matched the value.",{value:F,start:34411,end:34480,pattern_start:34422,pattern_end:34429});let U,I=t6(M);U=p9(I,(T)=>{if(T instanceof H){let R=T[0],C=d9(R);return c9(C,(j)=>{if(j instanceof H){let E=j[0];return V(X(J,K,new H(E.body))),_W(void 0)}else return V(X(J,K,new q("Failed to read response"))),_W(void 0)})}else return V(X(J,K,new q("Failed to fetch"))),_W(void 0)});let D=U;return})}function qW(Z,W,J,K){let X=gX(Z.pending_fetches),V=i8(X,(F)=>{let M=hV(F);if(M instanceof H){let U=M[0][0],I=M[0][1],D=c6(W,U);if(D instanceof H){let T=D[0];return new H(L5(Z,T.query,U,I,J))}else return new q(void 0)}else return new q(void 0)}),Q=UZ(X,Z,(F,M)=>{let U=hV(M);if(U instanceof H){let I=U[0][0],D=U[0][1];return S5(F,I,D)}else return F});return[new oZ(Q.entities,Q.optimistic_entities,Q.optimistic_mutations,Q.queries,wJ(),Q.get_headers,Q.mutation_counter,Q.endpoint),V]}function vV(Z,W,J){let K=U8(Z),X=HZ(K,(V)=>{let Q,G;return Q=V[0],G=V[1],[Q,WK(G,W,J)]});return h(X)}function WK(Z,W,J){let K=s(Z,rW(c,NZ));if(K instanceof H){let X=K[0],V=r(X,"__ref");if(V instanceof H){let Q=V[0],G=s(Q,c);if(G instanceof H){let F=G[0],M=r(W,F);if(M instanceof H)return M[0];else{let U=r(J,F);if(U instanceof H)return U[0];else return h(Y([["__ref",a(F)]]))}}else return vV(X,W,J)}else return vV(X,W,J)}else{let X=s(Z,PW(NZ));if(X instanceof H){let V=X[0];return kW(V,(Q)=>{return WK(Q,W,J)})}else return DJ(Z)}}function _V(Z,W,J){let K=xW(Z,NZ);if(K instanceof H){let X=K[0],V=WK(X,W,J);return nW(V)}else return Z}function e(Z,W,J,K){let X=n9(W,J),V=r(Z.queries,X);if(V instanceof H){let Q=V[0],G=Q.status;if(G instanceof r9){let F=_V(Q.data,Z.optimistic_entities,Z.entities),M=K(F);if(M instanceof H){let U=M[0];return[Z,new CW(U)]}else{let U=M[0];return[Z,new SW("Parse error: "+U)]}}else if(G instanceof mV){let F=_V(Q.data,Z.optimistic_entities,Z.entities),M=K(F);if(M instanceof H){let U=M[0];return[Z,new CW(U)]}else{let U=M[0];return[Z,new SW("Parse error: "+U)]}}else return[Z,new AW]}else return[new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,Z.queries,_0(Z.pending_fetches,X),Z.get_headers,Z.mutation_counter,Z.endpoint),new AW]}function E5(Z,W){let J=UZ(Z,[MZ(),Y([]),wJ()],(V,Q)=>{let G,F,M;G=V[0],F=V[1],M=V[2];let U=s(Q,rW(c,NZ));if(U instanceof H){let I=U[0],D=r(I,"node");if(D instanceof H){let T=D[0],R,C=s(T,rW(c,NZ));if(C instanceof H){let E=C[0],A=r(E,"id");if(A instanceof H){let k=A[0],b=s(k,c);if(b instanceof H){let B=b[0],S,y=r(E,"__typename");if(y instanceof H){let _=y[0],u=s(_,c);if(u instanceof H)S=u[0];else S="Node"}else S=ZK(SZ(W,Y(["node"])));R=new L(S+":"+B)}else R=new g}else R=new g}else R=new g;let j=R;if(j instanceof L){let E=j[0];if(bX(M,E))return V;else{let k=uJ(I,W),b,B;return b=k[0],B=k[1],[Q8(G,b),SZ(F,Y([B])),_0(M,E)]}}else{let E=uJ(I,W),A,k;return A=E[0],k=E[1],[Q8(G,A),SZ(F,Y([k])),M]}}else{let T=uJ(I,W),R,C;return R=T[0],C=T[1],[Q8(G,R),SZ(F,Y([C])),M]}}else{let I=pJ(Q,W),D,T;return D=I[0],T=I[1],[Q8(G,D),SZ(F,Y([T])),M]}}),K,X;return K=J[0],X=J[1],[K,kW(X,(V)=>{return V})]}function pJ(Z,W){let J=s(Z,rW(c,NZ));if(J instanceof H){let K=J[0],X=r(K,"id");if(X instanceof H){let V=X[0],Q=s(V,c);if(Q instanceof H){let G=Q[0],F,M=r(K,"__typename");if(M instanceof H){let b=M[0],B=s(b,c);if(B instanceof H)F=B[0];else F=ZK(W)}else F=ZK(W);let I=F+":"+G,D,T=U8(K);D=HZ(T,(b)=>{let B,S;B=b[0],S=b[1];let y=SZ(W,Y([B])),v=pJ(S,y),_,u;return _=v[0],u=v[1],[B,_,u]});let R=D,C=UZ(R,MZ(),(b,B)=>{let S;return S=B[1],Q8(b,S)}),j,E=HZ(R,(b)=>{let B,S;return B=b[0],S=b[2],[B,S]});return j=h(E),[TZ(C,I,j),h(Y([["__ref",a(I)]]))]}else return uJ(K,W)}else return uJ(K,W)}else{let K=s(Z,PW(NZ));if(K instanceof H){let X=K[0];if(A5(Z))return E5(X,W);else{let Q=HZ(X,(M)=>{return pJ(M,W)}),G=UZ(Q,MZ(),(M,U)=>{let I;return I=U[0],Q8(M,I)}),F=HZ(Q,(M)=>{let U;return U=M[1],U});return[G,kW(F,(M)=>{return M})]}}else return[MZ(),DJ(Z)]}}function sV(Z){return pJ(Z,Y([]))}function rV(Z,W,J,K,X){let V=n9(W,J),Q=xW(K,NZ);if(Q instanceof H){let G=Q[0],F=sV(G),M,U;M=F[0],U=F[1];let I=Q8(Z.entities,M),D=nW(U),T=new cJ(D,X,new r9),R=TZ(Z.queries,V,T);return new oZ(I,Z.optimistic_entities,Z.optimistic_mutations,R,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else{let G=new cJ(K,X,new r9),F=TZ(Z.queries,V,G);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,F,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}}function uJ(Z,W){let J,K=U8(Z);J=HZ(K,(M)=>{let U,I;U=M[0],I=M[1];let D=SZ(W,Y([U])),T=pJ(I,D),R,C;return R=T[0],C=T[1],[U,R,C]});let X=J,V=UZ(X,MZ(),(M,U)=>{let I;return I=U[1],Q8(M,I)}),Q,G=HZ(X,(M)=>{let U,I;return U=M[0],I=M[2],[U,I]});return Q=h(G),[V,Q]}function nV(Z,W,J){let K=r(Z.optimistic_mutations,W);if(K instanceof H){let X=K[0],V=xW(J,NZ);if(V instanceof H){let Q=V[0],G=sV(Q),F;F=G[0];let M=Q8(Z.entities,F);return new oZ(M,dW(Z.optimistic_entities,X),dW(Z.optimistic_mutations,W),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else return new oZ(Z.entities,dW(Z.optimistic_entities,X),dW(Z.optimistic_mutations,W),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else return Z}var $8="http://www.w3.org/2000/svg";function l9(Z){return K8($8,"ellipse",Z,m)}function dJ(Z){return K8($8,"rect",Z,m)}function lV(Z,W){return K8($8,"defs",Z,W)}function sJ(Z,W){return K8($8,"g",Z,W)}function i9(Z,W){return K8($8,"svg",Z,W)}function JK(Z,W){return K8($8,"linearGradient",Z,W)}function rJ(Z){return K8($8,"stop",Z,m)}function aV(Z){return i9(Y([w("viewBox","0 0 60 60"),w("xmlns","http://www.w3.org/2000/svg"),N(Z)]),Y([lV(Y([]),Y([JK(Y([xJ("board1"),w("x1","0%"),w("y1","0%"),w("x2","100%"),w("y2","100%")]),Y([rJ(Y([w("offset","0%"),w("stop-color","#FF6347"),w("stop-opacity","1")])),rJ(Y([w("offset","100%"),w("stop-color","#FF4500"),w("stop-opacity","1")]))])),JK(Y([xJ("board2"),w("x1","0%"),w("y1","0%"),w("x2","100%"),w("y2","100%")]),Y([rJ(Y([w("offset","0%"),w("stop-color","#00CED1"),w("stop-opacity","1")])),rJ(Y([w("offset","100%"),w("stop-color","#4682B4"),w("stop-opacity","1")]))]))])),sJ(Y([w("transform","translate(30, 30)")]),Y([l9(Y([w("cx","0"),w("cy","-8"),w("rx","15"),w("ry","6"),w("fill","url(#board1)")])),l9(Y([w("cx","0"),w("cy","0"),w("rx","18"),w("ry","6"),w("fill","url(#board2)")])),l9(Y([w("cx","0"),w("cy","8"),w("rx","12"),w("ry","6"),w("fill","#32CD32")]))]))]))}function oV(Z){return f(Y([N("border-b border-zinc-800 pb-4 mb-8")]),Y([f(Y([N("flex items-end justify-between")]),Y([y8(Y([L8("/"),N("flex items-center gap-3 hover:opacity-80 transition-opacity")]),Y([aV("w-10 h-10"),f(Y([]),Y([f8(Y([N("text-xs font-medium uppercase tracking-wider text-zinc-500")]),Y([x("quickslice")]))]))])),f(Y([N("flex gap-4 text-xs items-center")]),(()=>{if(Z instanceof L){let W=Z[0][0],J=Z[0][1],K=Y([y8(Y([L8("/"),N("px-3 py-1 text-zinc-400 hover:text-zinc-300 transition-colors")]),Y([x("Home")]))]),X;if(J)X=SZ(K,Y([y8(Y([L8("/settings"),N("px-3 py-1 text-zinc-400 hover:text-zinc-300 transition-colors")]),Y([x("Settings")]))]));else X=K;return SZ(X,Y([IZ(Y([N("px-3 py-1 text-zinc-400")]),Y([x(W)])),z6(Y([i0("POST"),l0("/logout")]),Y([dZ(Y([bW("submit"),N("px-3 py-1 text-zinc-400 hover:text-zinc-300 transition-colors cursor-pointer")]),Y([x("Logout")]))]))]))}else return Y([z6(Y([i0("POST"),l0("/oauth/authorize"),N("flex gap-2 items-center")]),Y([zJ(Y([bW("text"),iX("login_hint"),fJ("handle.bsky.social"),N("bg-zinc-900 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-300 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none w-48"),aX(!0)])),dZ(Y([bW("submit"),N("bg-zinc-800 hover:bg-zinc-700 text-zinc-300 px-3 py-1 rounded transition-colors")]),Y([x("Login")]))]))])})())]))]))}function KK(Z,W){console.log("[readFileAsBase64] Called with fileInputId:",Z);let J=document.getElementById(Z);if(!J){console.log("[readFileAsBase64] File input not found"),W(new q("File input not found"));return}console.log("[readFileAsBase64] Input element:",J),console.log("[readFileAsBase64] Input files:",J.files);let K=J.files?.[0];if(!K){console.log("[readFileAsBase64] No file selected"),W(new q("No file selected"));return}console.log("[readFileAsBase64] Reading file:",K.name);let X=new FileReader;X.onload=(V)=>{try{let Q=V.target.result.split(",")[1];W(new H(Q))}catch(Q){W(new q(`Failed to encode file: ${Q.message}`))}},X.onerror=()=>{W(new q("Failed to read file"))},X.readAsDataURL(K)}function XK(Z){let W=document.getElementById(Z);if(W)W.value=""}function tV(){let Z=BV(),W=vW(Z,"TriggerBackfill",`mutation TriggerBackfill { 1 + class z{withFields(Z){let W=Object.keys(this).map((J)=>(J in Z)?Z[J]:this[J]);return new this.constructor(...W)}}class hZ{static fromArray(Z,W){let J=W||new A;for(let K=Z.length-1;K>=0;--K)J=new tZ(Z[K],J);return J}[Symbol.iterator](){return new LK(this)}toArray(){return[...this]}atLeastLength(Z){let W=this;while(Z-- >0&&W)W=W.tail;return W!==void 0}hasLength(Z){let W=this;while(Z-- >0&&W)W=W.tail;return Z===-1&&W instanceof A}countLength(){let Z=this,W=0;while(Z)Z=Z.tail,W++;return W-1}}function B(Z,W){return new tZ(Z,W)}function Y(Z,W){return hZ.fromArray(Z,W)}class LK{#Z;constructor(Z){this.#Z=Z}next(){if(this.#Z instanceof A)return{done:!0};else{let{head:Z,tail:W}=this.#Z;return this.#Z=W,{value:Z,done:!1}}}}class A extends hZ{}class tZ extends hZ{constructor(Z,W){super();this.head=Z,this.tail=W}}var EK=(Z)=>Z instanceof tZ,xK=(Z)=>Z.head,kK=(Z)=>Z.tail;class TJ{bitSize;byteSize;bitOffset;rawBuffer;constructor(Z,W,J){if(!(Z instanceof Uint8Array))throw globalThis.Error("BitArray can only be constructed from a Uint8Array");if(this.bitSize=W??Z.length*8,this.byteSize=Math.trunc((this.bitSize+7)/8),this.bitOffset=J??0,this.bitSize<0)throw globalThis.Error(`BitArray bit size is invalid: ${this.bitSize}`);if(this.bitOffset<0||this.bitOffset>7)throw globalThis.Error(`BitArray bit offset is invalid: ${this.bitOffset}`);if(Z.length!==Math.trunc((this.bitOffset+this.bitSize+7)/8))throw globalThis.Error("BitArray buffer length is invalid");this.rawBuffer=Z}byteAt(Z){if(Z<0||Z>=this.byteSize)return;return jJ(this.rawBuffer,this.bitOffset,Z)}equals(Z){if(this.bitSize!==Z.bitSize)return!1;let W=Math.trunc(this.bitSize/8);if(this.bitOffset===0&&Z.bitOffset===0){for(let K=0;K<W;K++)if(this.rawBuffer[K]!==Z.rawBuffer[K])return!1;let J=this.bitSize%8;if(J){let K=8-J;if(this.rawBuffer[W]>>K!==Z.rawBuffer[W]>>K)return!1}}else{for(let K=0;K<W;K++){let X=jJ(this.rawBuffer,this.bitOffset,K),V=jJ(Z.rawBuffer,Z.bitOffset,K);if(X!==V)return!1}let J=this.bitSize%8;if(J){let K=jJ(this.rawBuffer,this.bitOffset,W),X=jJ(Z.rawBuffer,Z.bitOffset,W),V=8-J;if(K>>V!==X>>V)return!1}}return!0}get buffer(){if(qK("buffer","Use BitArray.byteAt() or BitArray.rawBuffer instead"),this.bitOffset!==0||this.bitSize%8!==0)throw new globalThis.Error("BitArray.buffer does not support unaligned bit arrays");return this.rawBuffer}get length(){if(qK("length","Use BitArray.bitSize or BitArray.byteSize instead"),this.bitOffset!==0||this.bitSize%8!==0)throw new globalThis.Error("BitArray.length does not support unaligned bit arrays");return this.rawBuffer.length}}function jJ(Z,W,J){if(W===0)return Z[J]??0;else{let K=Z[J]<<W&255,X=Z[J+1]>>8-W;return K|X}}class Q0{constructor(Z){this.value=Z}}var CK={};function qK(Z,W){if(CK[Z])return;console.warn(`Deprecated BitArray.${Z} property used in JavaScript FFI code. ${W}.`),CK[Z]=!0}class r8 extends z{static isResult(Z){return Z instanceof r8}}class H extends r8{constructor(Z){super();this[0]=Z}isOk(){return!0}}var fK=(Z)=>new H(Z);class q extends r8{constructor(Z){super();this[0]=Z}isOk(){return!1}}var yK=(Z)=>new q(Z);function GZ(Z,W){let J=[Z,W];while(J.length){let K=J.pop(),X=J.pop();if(K===X)continue;if(!wK(K)||!wK(X))return!1;if(!dQ(K,X)||_Q(K,X)||$Q(K,X)||mQ(K,X)||uQ(K,X)||cQ(K,X)||pQ(K,X))return!1;let Q=Object.getPrototypeOf(K);if(Q!==null&&typeof Q.equals==="function")try{if(K.equals(X))continue;else return!1}catch{}let[G,F]=vQ(K),M=G(K),U=G(X);if(M.length!==U.length)return!1;for(let I of M)J.push(F(K,I),F(X,I))}return!0}function vQ(Z){if(Z instanceof Map)return[(W)=>W.keys(),(W,J)=>W.get(J)];else{let W=Z instanceof globalThis.Error?["message"]:[];return[(J)=>[...W,...Object.keys(J)],(J,K)=>J[K]]}}function _Q(Z,W){return Z instanceof Date&&(Z>W||Z<W)}function $Q(Z,W){return!(Z instanceof TJ)&&Z.buffer instanceof ArrayBuffer&&Z.BYTES_PER_ELEMENT&&!(Z.byteLength===W.byteLength&&Z.every((J,K)=>J===W[K]))}function mQ(Z,W){return Array.isArray(Z)&&Z.length!==W.length}function uQ(Z,W){return Z instanceof Map&&Z.size!==W.size}function cQ(Z,W){return Z instanceof Set&&(Z.size!=W.size||[...Z].some((J)=>!W.has(J)))}function pQ(Z,W){return Z instanceof RegExp&&(Z.source!==W.source||Z.flags!==W.flags)}function wK(Z){return typeof Z==="object"&&Z!==null}function dQ(Z,W){if(typeof Z!=="object"&&typeof W!=="object"&&(!Z||!W))return!1;if([Promise,WeakSet,WeakMap,Function].some((K)=>Z instanceof K))return!1;return Z.constructor===W.constructor}function W9(Z,W){if(W===0)return 0;else return Z/W}function F8(Z,W,J,K,X,V,Q){let G=new globalThis.Error(V);G.gleam_error=Z,G.file=W,G.module=J,G.line=K,G.function=X,G.fn=X;for(let F in Q)G[F]=Q[F];return G}class OZ extends z{}class AZ extends z{}class cW extends z{}class L extends z{constructor(Z){super();this[0]=Z}}class g extends z{}function Y0(Z,W){if(Z instanceof L){let J=Z[0];return new H(J)}else return new q(W)}function bK(Z,W){if(Z instanceof L)return Z[0];else return W}function G0(Z,W){if(Z instanceof L){let J=Z[0];return W(J)}else return Z}var gK=new WeakMap,F0=new DataView(new ArrayBuffer(8)),M0=0;function U0(Z){let W=gK.get(Z);if(W!==void 0)return W;let J=M0++;if(M0===2147483647)M0=0;return gK.set(Z,J),J}function I0(Z,W){return Z^W+2654435769+(Z<<6)+(Z>>2)|0}function H0(Z){let W=0,J=Z.length;for(let K=0;K<J;K++)W=Math.imul(31,W)+Z.charCodeAt(K)|0;return W}function vK(Z){F0.setFloat64(0,Z);let W=F0.getInt32(0),J=F0.getInt32(4);return Math.imul(73244475,W>>16^W)^J}function sQ(Z){return H0(Z.toString())}function rQ(Z){let W=Object.getPrototypeOf(Z);if(W!==null&&typeof W.hashCode==="function")try{let K=Z.hashCode(Z);if(typeof K==="number")return K}catch{}if(Z instanceof Promise||Z instanceof WeakSet||Z instanceof WeakMap)return U0(Z);if(Z instanceof Date)return vK(Z.getTime());let J=0;if(Z instanceof ArrayBuffer)Z=new Uint8Array(Z);if(Array.isArray(Z)||Z instanceof Uint8Array)for(let K=0;K<Z.length;K++)J=Math.imul(31,J)+VW(Z[K])|0;else if(Z instanceof Set)Z.forEach((K)=>{J=J+VW(K)|0});else if(Z instanceof Map)Z.forEach((K,X)=>{J=J+I0(VW(K),VW(X))|0});else{let K=Object.keys(Z);for(let X=0;X<K.length;X++){let V=K[X],Q=Z[V];J=J+I0(VW(Q),H0(V))|0}}return J}function VW(Z){if(Z===null)return 1108378658;if(Z===void 0)return 1108378659;if(Z===!0)return 1108378657;if(Z===!1)return 1108378656;switch(typeof Z){case"number":return vK(Z);case"string":return H0(Z);case"bigint":return sQ(Z);case"object":return rQ(Z);case"symbol":return U0(Z);case"function":return U0(Z);default:return 0}}var EW=5,N0=Math.pow(2,EW),nQ=N0-1,lQ=N0/2,iQ=N0/4,$Z=0,LW=1,eZ=2,A8=3,D0={type:eZ,bitmap:0,array:[]};function OJ(Z,W){return Z>>>W&nQ}function K9(Z,W){return 1<<OJ(Z,W)}function aQ(Z){return Z-=Z>>1&1431655765,Z=(Z&858993459)+(Z>>2&858993459),Z=Z+(Z>>4)&252645135,Z+=Z>>8,Z+=Z>>16,Z&127}function B0(Z,W){return aQ(Z&W-1)}function QW(Z,W,J){let K=Z.length,X=Array(K);for(let V=0;V<K;++V)X[V]=Z[V];return X[W]=J,X}function oQ(Z,W,J){let K=Z.length,X=Array(K+1),V=0,Q=0;while(V<W)X[Q++]=Z[V++];X[Q++]=J;while(V<K)X[Q++]=Z[V++];return X}function z0(Z,W){let J=Z.length,K=Array(J-1),X=0,V=0;while(X<W)K[V++]=Z[X++];++X;while(X<J)K[V++]=Z[X++];return K}function _K(Z,W,J,K,X,V){let Q=VW(W);if(Q===K)return{type:A8,hash:Q,array:[{type:$Z,k:W,v:J},{type:$Z,k:X,v:V}]};let G={val:!1};return AJ(P0(D0,Z,Q,W,J,G),Z,K,X,V,G)}function AJ(Z,W,J,K,X,V){switch(Z.type){case LW:return tQ(Z,W,J,K,X,V);case eZ:return P0(Z,W,J,K,X,V);case A8:return eQ(Z,W,J,K,X,V)}}function tQ(Z,W,J,K,X,V){let Q=OJ(J,W),G=Z.array[Q];if(G===void 0)return V.val=!0,{type:LW,size:Z.size+1,array:QW(Z.array,Q,{type:$Z,k:K,v:X})};if(G.type===$Z){if(GZ(K,G.k)){if(X===G.v)return Z;return{type:LW,size:Z.size,array:QW(Z.array,Q,{type:$Z,k:K,v:X})}}return V.val=!0,{type:LW,size:Z.size,array:QW(Z.array,Q,_K(W+EW,G.k,G.v,J,K,X))}}let F=AJ(G,W+EW,J,K,X,V);if(F===G)return Z;return{type:LW,size:Z.size,array:QW(Z.array,Q,F)}}function P0(Z,W,J,K,X,V){let Q=K9(J,W),G=B0(Z.bitmap,Q);if((Z.bitmap&Q)!==0){let F=Z.array[G];if(F.type!==$Z){let U=AJ(F,W+EW,J,K,X,V);if(U===F)return Z;return{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,G,U)}}let M=F.k;if(GZ(K,M)){if(X===F.v)return Z;return{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,G,{type:$Z,k:K,v:X})}}return V.val=!0,{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,G,_K(W+EW,M,F.v,J,K,X))}}else{let F=Z.array.length;if(F>=lQ){let M=Array(32),U=OJ(J,W);M[U]=P0(D0,W+EW,J,K,X,V);let I=0,N=Z.bitmap;for(let T=0;T<32;T++){if((N&1)!==0){let R=Z.array[I++];M[T]=R}N=N>>>1}return{type:LW,size:F+1,array:M}}else{let M=oQ(Z.array,G,{type:$Z,k:K,v:X});return V.val=!0,{type:eZ,bitmap:Z.bitmap|Q,array:M}}}}function eQ(Z,W,J,K,X,V){if(J===Z.hash){let Q=R0(Z,K);if(Q!==-1){if(Z.array[Q].v===X)return Z;return{type:A8,hash:J,array:QW(Z.array,Q,{type:$Z,k:K,v:X})}}let G=Z.array.length;return V.val=!0,{type:A8,hash:J,array:QW(Z.array,G,{type:$Z,k:K,v:X})}}return AJ({type:eZ,bitmap:K9(Z.hash,W),array:[Z]},W,J,K,X,V)}function R0(Z,W){let J=Z.array.length;for(let K=0;K<J;K++)if(GZ(W,Z.array[K].k))return K;return-1}function J9(Z,W,J,K){switch(Z.type){case LW:return ZY(Z,W,J,K);case eZ:return WY(Z,W,J,K);case A8:return JY(Z,K)}}function ZY(Z,W,J,K){let X=OJ(J,W),V=Z.array[X];if(V===void 0)return;if(V.type!==$Z)return J9(V,W+EW,J,K);if(GZ(K,V.k))return V;return}function WY(Z,W,J,K){let X=K9(J,W);if((Z.bitmap&X)===0)return;let V=B0(Z.bitmap,X),Q=Z.array[V];if(Q.type!==$Z)return J9(Q,W+EW,J,K);if(GZ(K,Q.k))return Q;return}function JY(Z,W){let J=R0(Z,W);if(J<0)return;return Z.array[J]}function j0(Z,W,J,K){switch(Z.type){case LW:return KY(Z,W,J,K);case eZ:return XY(Z,W,J,K);case A8:return VY(Z,K)}}function KY(Z,W,J,K){let X=OJ(J,W),V=Z.array[X];if(V===void 0)return Z;let Q=void 0;if(V.type===$Z){if(!GZ(V.k,K))return Z}else if(Q=j0(V,W+EW,J,K),Q===V)return Z;if(Q===void 0){if(Z.size<=iQ){let G=Z.array,F=Array(Z.size-1),M=0,U=0,I=0;while(M<X){let N=G[M];if(N!==void 0)F[U]=N,I|=1<<M,++U;++M}++M;while(M<G.length){let N=G[M];if(N!==void 0)F[U]=N,I|=1<<M,++U;++M}return{type:eZ,bitmap:I,array:F}}return{type:LW,size:Z.size-1,array:QW(Z.array,X,Q)}}return{type:LW,size:Z.size,array:QW(Z.array,X,Q)}}function XY(Z,W,J,K){let X=K9(J,W);if((Z.bitmap&X)===0)return Z;let V=B0(Z.bitmap,X),Q=Z.array[V];if(Q.type!==$Z){let G=j0(Q,W+EW,J,K);if(G===Q)return Z;if(G!==void 0)return{type:eZ,bitmap:Z.bitmap,array:QW(Z.array,V,G)};if(Z.bitmap===X)return;return{type:eZ,bitmap:Z.bitmap^X,array:z0(Z.array,V)}}if(GZ(K,Q.k)){if(Z.bitmap===X)return;return{type:eZ,bitmap:Z.bitmap^X,array:z0(Z.array,V)}}return Z}function VY(Z,W){let J=R0(Z,W);if(J<0)return Z;if(Z.array.length===1)return;return{type:A8,hash:Z.hash,array:z0(Z.array,J)}}function $K(Z,W){if(Z===void 0)return;let J=Z.array,K=J.length;for(let X=0;X<K;X++){let V=J[X];if(V===void 0)continue;if(V.type===$Z){W(V.v,V.k);continue}$K(V,W)}}class CZ{static fromObject(Z){let W=Object.keys(Z),J=CZ.new();for(let K=0;K<W.length;K++){let X=W[K];J=J.set(X,Z[X])}return J}static fromMap(Z){let W=CZ.new();return Z.forEach((J,K)=>{W=W.set(K,J)}),W}static new(){return new CZ(void 0,0)}constructor(Z,W){this.root=Z,this.size=W}get(Z,W){if(this.root===void 0)return W;let J=J9(this.root,0,VW(Z),Z);if(J===void 0)return W;return J.v}set(Z,W){let J={val:!1},K=this.root===void 0?D0:this.root,X=AJ(K,0,VW(Z),Z,W,J);if(X===this.root)return this;return new CZ(X,J.val?this.size+1:this.size)}delete(Z){if(this.root===void 0)return this;let W=j0(this.root,0,VW(Z),Z);if(W===this.root)return this;if(W===void 0)return CZ.new();return new CZ(W,this.size-1)}has(Z){if(this.root===void 0)return!1;return J9(this.root,0,VW(Z),Z)!==void 0}entries(){if(this.root===void 0)return[];let Z=[];return this.forEach((W,J)=>Z.push([J,W])),Z}forEach(Z){$K(this.root,Z)}hashCode(){let Z=0;return this.forEach((W,J)=>{Z=Z+I0(VW(W),VW(J))|0}),Z}equals(Z){if(!(Z instanceof CZ)||this.size!==Z.size)return!1;try{return this.forEach((W,J)=>{if(!GZ(Z.get(J,!W),W))throw hK}),!0}catch(W){if(W===hK)return!1;throw W}}}var hK=Symbol();function T0(Z){return X9(Z)===0}function QY(Z,W){return!GZ(r(W,Z),new q(void 0))}function mK(Z,W){return QY(W,Z)}function TZ(Z,W,J){return cK(W,J,Z)}function YY(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return K;else{let X=J.head;Z=J.tail,W=B(X,K)}}}function GY(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return YY(K,Y([]));else{let X=J.tail,V=J.head[0];Z=X,W=B(V,K)}}}function pW(Z){return GY(U8(Z),Y([]))}function dW(Z,W){return uK(W,Z)}function FY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return X;else{let Q=K.tail,G=K.head[0],F=K.head[1];Z=Q,W=V(X,G,F),J=V}}}function n8(Z,W,J){return FY(U8(Z),W,J)}class LZ extends z{}class l8 extends z{}function UY(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return K;else Z=J.tail,W=K+1}}function SJ(Z){return UY(Z,0)}function S8(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return K;else{let X=J.head;Z=J.tail,W=B(X,K)}}}function i(Z){return S8(Z,Y([]))}function IY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return i(V);else{let{head:Q,tail:G}=K,F,M=X(Q);if(M instanceof H){let I=M[0];F=B(I,V)}else F=V;let U=F;Z=G,W=X,J=U}}}function i8(Z,W){return IY(Z,W,Y([]))}function zY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return i(V);else{let Q=K.head;Z=K.tail,W=X,J=B(X(Q),V)}}}function HZ(Z,W){return zY(Z,W,Y([]))}function HY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof A)return i(G);else{let{head:F,tail:M}=X,U=B(V(F,Q),G);Z=M,W=V,J=Q+1,K=U}}}function pK(Z,W){return HY(Z,W,0,Y([]))}function NY(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return K;else{let X=J.head;Z=J.tail,W=B(X,K)}}}function SZ(Z,W){return NY(i(Z),W)}function V9(Z,W){return B(W,Z)}function DY(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return i(K);else{let X=J.head;Z=J.tail,W=S8(X,K)}}}function dK(Z){return DY(Z,Y([]))}function UZ(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return X;else{let Q=K.head;Z=K.tail,W=V(X,Q),J=V}}}function O0(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return new q(void 0);else{let{head:X,tail:V}=J,Q=K(X);if(Q instanceof H)return Q;else Z=V,W=K}}}function BY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return i(V);else{let{head:Q,tail:G}=K;if(mK(X,Q))Z=G,W=X,J=V;else Z=G,W=TZ(X,Q,void 0),J=B(Q,V)}}}function sK(Z){return BY(Z,MZ(),Y([]))}function PY(Z,W,J,K,X,V){while(!0){let Q=Z,G=W,F=J,M=K,U=X,I=V,N=B(U,F);if(Q instanceof A)if(M instanceof LZ)return B(i(N),I);else return B(N,I);else{let{head:T,tail:R}=Q,C=G(U,T);if(M instanceof LZ)if(C instanceof OZ)Z=R,W=G,J=N,K=M,X=T,V=I;else if(C instanceof AZ)Z=R,W=G,J=N,K=M,X=T,V=I;else{let j;if(M instanceof LZ)j=B(i(N),I);else j=B(N,I);let x=j;if(R instanceof A)return B(Y([T]),x);else{let{head:O,tail:k}=R,b,P=G(T,O);if(P instanceof OZ)b=new LZ;else if(P instanceof AZ)b=new LZ;else b=new l8;let S=b;Z=k,W=G,J=Y([T]),K=S,X=O,V=x}}else if(C instanceof OZ){let j;if(M instanceof LZ)j=B(i(N),I);else j=B(N,I);let x=j;if(R instanceof A)return B(Y([T]),x);else{let{head:O,tail:k}=R,b,P=G(T,O);if(P instanceof OZ)b=new LZ;else if(P instanceof AZ)b=new LZ;else b=new l8;let S=b;Z=k,W=G,J=Y([T]),K=S,X=O,V=x}}else if(C instanceof AZ){let j;if(M instanceof LZ)j=B(i(N),I);else j=B(N,I);let x=j;if(R instanceof A)return B(Y([T]),x);else{let{head:O,tail:k}=R,b,P=G(T,O);if(P instanceof OZ)b=new LZ;else if(P instanceof AZ)b=new LZ;else b=new l8;let S=b;Z=k,W=G,J=Y([T]),K=S,X=O,V=x}}else Z=R,W=G,J=N,K=M,X=T,V=I}}}function RY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof A)return S8(V,G);else if(V instanceof A)return S8(X,G);else{let{head:F,tail:M}=X,U=V.head,I=V.tail,N=Q(F,U);if(N instanceof OZ)Z=M,W=V,J=Q,K=B(F,G);else if(N instanceof AZ)Z=X,W=I,J=Q,K=B(U,G);else Z=X,W=I,J=Q,K=B(U,G)}}}function jY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return i(V);else{let Q=K.tail;if(Q instanceof A){let G=K.head;return i(B(i(G),V))}else{let G=K.head,F=Q.head,M=Q.tail,U=RY(G,F,X,Y([]));Z=M,W=X,J=B(U,V)}}}}function TY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof A)return S8(V,G);else if(V instanceof A)return S8(X,G);else{let{head:F,tail:M}=X,U=V.head,I=V.tail,N=Q(F,U);if(N instanceof OZ)Z=X,W=I,J=Q,K=B(U,G);else if(N instanceof AZ)Z=M,W=V,J=Q,K=B(F,G);else Z=M,W=V,J=Q,K=B(F,G)}}}function OY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return i(V);else{let Q=K.tail;if(Q instanceof A){let G=K.head;return i(B(i(G),V))}else{let G=K.head,F=Q.head,M=Q.tail,U=TY(G,F,X,Y([]));Z=M,W=X,J=B(U,V)}}}}function AY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return K;else if(X instanceof LZ)if(K.tail instanceof A)return K.head;else Z=jY(K,V,Y([])),W=new l8,J=V;else if(K.tail instanceof A){let G=K.head;return i(G)}else Z=OY(K,V,Y([])),W=new LZ,J=V}}function A0(Z,W){if(Z instanceof A)return Z;else{let J=Z.tail;if(J instanceof A)return Z;else{let K=Z.head,X=J.head,V=J.tail,Q,G=W(K,X);if(G instanceof OZ)Q=new LZ;else if(G instanceof AZ)Q=new LZ;else Q=new l8;let F=Q,M=PY(V,W,Y([K]),F,X,Y([]));return AY(M,new LZ,W)}}}function SY(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(X instanceof A)return i(B([V,Q],G));else{let F=X.head[0];if(GZ(F,V)){let M=X.tail;return S8(G,B([F,Q],M))}else{let M=X.head;Z=X.tail,W=V,J=Q,K=B(M,G)}}}}function S0(Z,W,J){return SY(Z,W,J,Y([]))}function rK(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return;else{let{head:X,tail:V}=J;K(X),Z=V,W=K}}}function nK(Z,W){if(Z instanceof A)return new q(void 0);else{let{head:J,tail:K}=Z;return new H(UZ(K,J,W))}}class z8 extends z{constructor(Z,W,J){super();this.expected=Z,this.found=W,this.path=J}}class ZW extends z{constructor(Z){super();this.function=Z}}function s(Z,W){let J=W.function(Z),K,X;if(K=J[0],X=J[1],X instanceof A)return new H(K);else return new q(X)}function t(Z){return new ZW((W)=>{return[Z,Y([])]})}function wY(Z){return[Z,Y([])]}function CJ(Z,W){return new ZW((J)=>{let K=Z.function(J),X,V;return X=K[0],V=K[1],[W(X),V]})}function LY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(V instanceof A)return X;else{let{head:Q,tail:G}=V,F=Q.function(K),M,U;if(M=F,U=F[1],U instanceof A)return M;else Z=K,W=X,J=G}}}function aK(Z,W){return new ZW((J)=>{let K=Z.function(J),X,V;if(X=K,V=K[1],V instanceof A)return X;else return LY(J,X,W)})}function sW(Z){return new ZW((W)=>{if(VX(W))return[new g,Y([])];else{let K=Z.function(W),X,V;return X=K[0],V=K[1],[new L(X),V]}})}var NZ=new ZW(wY);function oK(Z,W){return Y([new z8(Z,I8(W),Y([]))])}function q0(Z,W,J){let K=J(Z);if(K instanceof H)return[K[0],Y([])];else return[K[0],Y([new z8(W,I8(Z),Y([]))])]}function EY(Z){if(GZ(n(!0),Z))return[!0,Y([])];else if(GZ(n(!1),Z))return[!1,Y([])];else return[!1,oK("Bool",Z)]}function xY(Z){return q0(Z,"Int",KX)}function kY(Z){return q0(Z,"Float",JX)}var BW=new ZW(EY),mZ=new ZW(xY),tK=new ZW(kY);function fY(Z){return q0(Z,"String",XX)}var c=new ZW(fY);function yY(Z,W,J,K,X){let V=K(W),Q=V[1];if(Q instanceof A){let G=V[0],F=X(J),M=F[1];if(M instanceof A){let U=F[0];return[TZ(Z[0],G,U),Z[1]]}else{let U=M;return a8([MZ(),U],Y(["values"]))}}else{let G=Q;return a8([MZ(),G],Y(["keys"]))}}function rW(Z,W){return new ZW((J)=>{let K=WX(J);if(K instanceof H){let X=K[0];return n8(X,[MZ(),Y([])],(V,Q,G)=>{if(V[1]instanceof A)return yY(V,Q,G,Z.function,W.function);else return V})}else return[MZ(),oK("Dict",J)]})}function PW(Z){return new ZW((W)=>{return ZX(W,Z.function,(J,K)=>{return a8(J,Y([K]))},0,Y([]))})}function a8(Z,W){let J=aK(c,Y([(()=>{return CJ(mZ,qZ)})()])),K=HZ(W,(V)=>{let Q=n(V),G=s(Q,J);if(G instanceof H)return G[0];else return"<"+I8(Q)+">"}),X=HZ(Z[1],(V)=>{return new z8(V.expected,V.found,SZ(K,V.path))});return[Z[0],X]}function bY(Z,W,J,K,X){while(!0){let V=Z,Q=W,G=J,F=K,M=X;if(V instanceof A){let I=G(F);return a8(I,i(Q))}else{let{head:U,tail:I}=V,N=eK(F,U);if(N instanceof H){let T=N[0];if(T instanceof L){let R=T[0];Z=I,W=B(U,Q),J=G,K=R,X=M}else return M(F,B(U,Q))}else{let T=N[0],R=G(F),C;C=R[0];let j=[C,Y([new z8(T,I8(F),Y([]))])];return a8(j,i(Q))}}}}function w0(Z,W,J){return new ZW((K)=>{let X=bY(Z,Y([]),W.function,K,(U,I)=>{let N=W.function(U),T;T=N[0];let R=[T,Y([new z8("Field","Nothing",Y([]))])];return a8(R,i(I))}),V,Q;V=X[0],Q=X[1];let G=J(V).function(K),F,M;return F=G[0],M=G[1],[F,SZ(Q,M)]})}function $(Z,W,J){return w0(Y([Z]),W,J)}var E0=void 0,QX={};function n(Z){return Z}function qZ(Z){return Z.toString()}function Q9(Z){if(Z==="")return 0;let W=x0(Z);if(W){let J=0;for(let K of W)J++;return J}else return Z.match(/./gsu).length}var YX=void 0;function x0(Z){if(globalThis.Intl&&Intl.Segmenter)return YX||=new Intl.Segmenter,YX.segment(Z)[Symbol.iterator]()}function Y9(Z){let W,J=x0(Z);if(J)W=J.next().value?.segment;else W=Z.match(/./su)?.[0];if(W)return new H([W,Z.slice(W.length)]);else return new q(E0)}function C8(Z){return[Z.charCodeAt(0)|0,Z.slice(1)]}function GW(Z){return Z.toLowerCase()}function G9(Z){return Z.toUpperCase()}function k0(Z,W,J){if(J<=0||W>=Z.length)return"";let K=x0(Z);if(K){while(W-- >0)K.next();let X="";while(J-- >0){let V=K.next().value;if(V===void 0)break;X+=V.segment}return X}else return Z.match(/./gsu).slice(W,W+J).join("")}function EZ(Z,W,J){return Z.slice(W,W+J)}function o8(Z,W){return Z.startsWith(W)}function F9(Z,W){return Z.endsWith(W)}function M9(Z,W){let J=Z.indexOf(W);if(J>=0){let K=Z.slice(0,J),X=Z.slice(J+W.length);return new H([K,X])}else return new q(E0)}var MX=[" ","\t",` 2 + `,"\v","\f","\r","…","\u2028","\u2029"].join(""),QF=new RegExp(`^[${MX}]*`),YF=new RegExp(`[${MX}]*$`);function q8(Z){console.log(Z)}function MZ(){return CZ.new()}function X9(Z){return Z.size}function U8(Z){return hZ.fromArray(Z.entries())}function uK(Z,W){return W.delete(Z)}function r(Z,W){let J=Z.get(W,QX);if(J===QX)return new q(E0);return new H(J)}function cK(Z,W,J){return J.set(Z,W)}function I8(Z){if(typeof Z==="string")return"String";else if(typeof Z==="boolean")return"Bool";else if(Z instanceof r8)return"Result";else if(Z instanceof hZ)return"List";else if(Z instanceof TJ)return"BitArray";else if(Z instanceof CZ)return"Dict";else if(Number.isInteger(Z))return"Int";else if(Array.isArray(Z))return"Array";else if(typeof Z==="number")return"Float";else if(Z===null)return"Nil";else if(Z===void 0)return"Nil";else{let W=typeof Z;return W.charAt(0).toUpperCase()+W.slice(1)}}function UX(Z){return new IX().inspect(Z)}function BZ(Z){let W=Z.toString().replace("+","");if(W.indexOf(".")>=0)return W;else{let J=W.indexOf("e");if(J>=0)return W.slice(0,J)+".0"+W.slice(J);else return W+".0"}}class IX{#Z=new Set;inspect(Z){let W=typeof Z;if(Z===!0)return"True";if(Z===!1)return"False";if(Z===null)return"//js(null)";if(Z===void 0)return"Nil";if(W==="string")return this.#V(Z);if(W==="bigint"||Number.isInteger(Z))return Z.toString();if(W==="number")return BZ(Z);if(Z instanceof Q0)return this.#Q(Z);if(Z instanceof TJ)return this.#G(Z);if(Z instanceof RegExp)return`//js(${Z})`;if(Z instanceof Date)return`//js(Date("${Z.toISOString()}"))`;if(Z instanceof globalThis.Error)return`//js(${Z.toString()})`;if(Z instanceof Function){let K=[];for(let X of Array(Z.length).keys())K.push(String.fromCharCode(X+97));return`//fn(${K.join(", ")}) { ... }`}if(this.#Z.size===this.#Z.add(Z).size)return"//js(circular reference)";let J;if(Array.isArray(Z))J=`#(${Z.map((K)=>this.inspect(K)).join(", ")})`;else if(Z instanceof hZ)J=this.#W(Z);else if(Z instanceof z)J=this.#K(Z);else if(Z instanceof CZ)J=this.#J(Z);else if(Z instanceof Set)return`//js(Set(${[...Z].map((K)=>this.inspect(K)).join(", ")}))`;else J=this.#X(Z);return this.#Z.delete(Z),J}#X(Z){let W=Object.getPrototypeOf(Z)?.constructor?.name||"Object",J=[];for(let V of Object.keys(Z))J.push(`${this.inspect(V)}: ${this.inspect(Z[V])}`);let K=J.length?" "+J.join(", ")+" ":"";return`//js(${W==="Object"?"":W+" "}{${K}})`}#J(Z){let W="dict.from_list([",J=!0;return Z.forEach((K,X)=>{if(!J)W=W+", ";W=W+"#("+this.inspect(X)+", "+this.inspect(K)+")",J=!1}),W+"])"}#K(Z){let W=Object.keys(Z).map((J)=>{let K=this.inspect(Z[J]);return isNaN(parseInt(J))?`${J}: ${K}`:K}).join(", ");return W?`${Z.constructor.name}(${W})`:Z.constructor.name}#W(Z){if(Z instanceof A)return"[]";let W='charlist.from_string("',J="[",K=Z;while(K instanceof tZ){let X=K.head;if(K=K.tail,J!=="[")J+=", ";if(J+=this.inspect(X),W)if(Number.isInteger(X)&&X>=32&&X<=126)W+=String.fromCharCode(X);else W=null}if(W)return W+'")';else return J+"]"}#V(Z){let W='"';for(let J=0;J<Z.length;J++){let K=Z[J];switch(K){case` 3 + `:W+="\\n";break;case"\r":W+="\\r";break;case"\t":W+="\\t";break;case"\f":W+="\\f";break;case"\\":W+="\\\\";break;case'"':W+="\\\"";break;default:if(K<" "||K>"~"&&K<" ")W+="\\u{"+K.charCodeAt(0).toString(16).toUpperCase().padStart(4,"0")+"}";else W+=K}}return W+='"',W}#Q(Z){return`//utfcodepoint(${String.fromCodePoint(Z.value)})`}#G(Z){if(Z.bitSize===0)return"<<>>";let W="<<";for(let J=0;J<Z.byteSize-1;J++)W+=Z.byteAt(J).toString(),W+=", ";if(Z.byteSize*8===Z.bitSize)W+=Z.byteAt(Z.byteSize-1).toString();else{let J=Z.bitSize%8;W+=Z.byteAt(Z.byteSize-1)>>8-J,W+=`:size(${J})`}return W+=">>",W}}function eK(Z,W){if(Z instanceof CZ||Z instanceof WeakMap||Z instanceof Map){let K={},X=Z.get(W,K);if(X===K)return new H(new g);return new H(new L(X))}let J=Number.isInteger(W);if(J&&W>=0&&W<8&&Z instanceof hZ){let K=0;for(let X of Z){if(K===W)return new H(new L(X));K++}return new q("Indexable")}if(J&&Array.isArray(Z)||Z&&typeof Z==="object"||Z&&Object.getPrototypeOf(Z)===Object.prototype){if(W in Z)return new H(new L(Z[W]));return new H(new g)}return new q(J?"Indexable":"Dict")}function ZX(Z,W,J,K,X){if(!(Z instanceof hZ||Array.isArray(Z))){let Q=new z8("List",I8(Z),X);return[X,hZ.fromArray([Q])]}let V=[];for(let Q of Z){let G=W(Q),[F,M]=G;if(M instanceof tZ){let[U,I]=J(G,K.toString());return[X,I]}V.push(F),K++}return[hZ.fromArray(V),X]}function WX(Z){if(Z instanceof CZ)return new H(Z);if(Z instanceof Map||Z instanceof WeakMap)return new H(CZ.fromMap(Z));if(Z==null)return new q("Dict");if(typeof Z!=="object")return new q("Dict");let W=Object.getPrototypeOf(Z);if(W===Object.prototype||W===null)return new H(CZ.fromObject(Z));return new q("Dict")}function JX(Z){if(typeof Z==="number")return new H(Z);return new q(0)}function KX(Z){if(Number.isInteger(Z))return new H(Z);return new q(0)}function XX(Z){if(typeof Z==="string")return new H(Z);return new q("")}function VX(Z){return Z===null||Z===void 0}function U9(Z,W){if(Z>W)return Z;else return W}function HX(Z,W,J){if(J<=0)return"";else if(W<0){let V=Q9(Z)+W;if(V<0)return"";else return k0(Z,V,J)}else return k0(Z,W,J)}function dY(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return K;else{let X=J.head;Z=J.tail,W=K+X}}}function qJ(Z){return dY(Z,"")}function sY(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return V;else{let Q=K.head;Z=K.tail,W=X,J=V+X+Q}}}function e8(Z,W){if(Z instanceof A)return"";else{let{head:J,tail:K}=Z;return sY(K,W,J)}}function NX(Z){let J=UX(Z);return n(J)}function PX(Z){if(Z instanceof H)return!0;else return!1}function ZJ(Z,W){if(Z instanceof H)return Z;else{let J=Z[0];return new q(W(J))}}function rZ(Z,W){if(Z instanceof H){let J=Z[0];return W(J)}else return Z}function WJ(Z,W){if(Z instanceof H)return Z[0];else return W}function f0(Z){return JSON.stringify(Z)}function RX(Z){return Object.fromEntries(Z)}function H8(Z){return Z}function jX(Z){let W=[];while(EK(Z))W.push(xK(Z)),Z=kK(Z);return W}function TX(){return null}function OX(Z){try{let W=JSON.parse(Z);return fK(W)}catch(W){return yK(aY(W,Z))}}function aY(Z,W){if(oY(Z))return AX();return tY(Z,W)}function oY(Z){return/((unexpected (end|eof))|(end of data)|(unterminated string)|(json( parse error|\.parse)\: expected '(\:|\}|\])'))/i.test(Z.message)}function tY(Z,W){let J=[eY,ZG,JG,WG];for(let K of J){let X=K(Z,W);if(X)return X}return JJ("")}function eY(Z){let J=/unexpected token '(.)', ".+" is not valid JSON/i.exec(Z.message);if(!J)return null;let K=z9(J[1]);return JJ(K)}function ZG(Z){let J=/unexpected token (.) in JSON at position (\d+)/i.exec(Z.message);if(!J)return null;let K=z9(J[1]);return JJ(K)}function WG(Z,W){let K=/(unexpected character|expected .*) at line (\d+) column (\d+)/i.exec(Z.message);if(!K)return null;let X=Number(K[2]),V=Number(K[3]),Q=KG(X,V,W),G=z9(W[Q]);return JJ(G)}function JG(Z){let J=/unexpected (identifier|token) "(.)"/i.exec(Z.message);if(!J)return null;let K=z9(J[2]);return JJ(K)}function z9(Z){return"0x"+Z.charCodeAt(0).toString(16).toUpperCase()}function KG(Z,W,J){if(Z===1)return W-1;let K=1,X=0;return J.split("").find((V,Q)=>{if(V===` 4 + `)K+=1;if(K===Z)return X=Q+W,!0;return!1}),X}class SX extends z{}var AX=()=>new SX;class CX extends z{constructor(Z){super();this[0]=Z}}var JJ=(Z)=>new CX(Z);class qX extends z{constructor(Z){super();this[0]=Z}}function XG(Z,W){return rZ(OX(Z),(J)=>{let K=s(J,W);return ZJ(K,(X)=>{return new qX(X)})})}function xW(Z,W){return XG(Z,W)}function nW(Z){return f0(Z)}function a(Z){return H8(Z)}function lW(Z){return H8(Z)}function WW(Z){return H8(Z)}function wX(Z){return H8(Z)}function H9(){return TX()}function KJ(Z,W){if(Z instanceof L){let J=Z[0];return W(J)}else return H9()}function h(Z){return RX(Z)}function LX(Z){return jX(Z)}function kW(Z,W){let K=HZ(Z,W);return LX(K)}class d extends z{constructor(Z,W,J,K,X,V,Q){super();this.scheme=Z,this.userinfo=W,this.host=J,this.port=K,this.path=X,this.query=V,this.fragment=Q}}function GG(Z){return 48>=Z&&Z<=57||65>=Z&&Z<=90||97>=Z&&Z<=122||Z===58||Z===46}function RW(Z,W){return new H(new d(W.scheme,W.userinfo,W.host,W.port,W.path,W.query,new L(Z)))}function FG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("#"))if(G===0){let F=V.slice(1);return RW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,Q.host,Q.port,Q.path,new L(M),Q.fragment);return RW(F,U)}else if(V==="")return new H(new d(Q.scheme,Q.userinfo,Q.host,Q.port,Q.path,new L(X),Q.fragment));else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function iW(Z,W){return FG(Z,Z,W,0)}function MG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("?")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,Q.host,Q.port,M,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,Q.host,Q.port,M,Q.query,Q.fragment);return RW(F,U)}else if(V==="")return new H(new d(Q.scheme,Q.userinfo,Q.host,Q.port,X,Q.query,Q.fragment));else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function w8(Z,W){return MG(Z,Z,W,0)}function fW(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K.startsWith("0"))Z=K.slice(1),W=X,J=V*10;else if(K.startsWith("1"))Z=K.slice(1),W=X,J=V*10+1;else if(K.startsWith("2"))Z=K.slice(1),W=X,J=V*10+2;else if(K.startsWith("3"))Z=K.slice(1),W=X,J=V*10+3;else if(K.startsWith("4"))Z=K.slice(1),W=X,J=V*10+4;else if(K.startsWith("5"))Z=K.slice(1),W=X,J=V*10+5;else if(K.startsWith("6"))Z=K.slice(1),W=X,J=V*10+6;else if(K.startsWith("7"))Z=K.slice(1),W=X,J=V*10+7;else if(K.startsWith("8"))Z=K.slice(1),W=X,J=V*10+8;else if(K.startsWith("9"))Z=K.slice(1),W=X,J=V*10+9;else if(K.startsWith("?")){let Q=K.slice(1),G=new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment);return iW(Q,G)}else if(K.startsWith("#")){let Q=K.slice(1),G=new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment);return RW(Q,G)}else if(K.startsWith("/")){let Q=new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment);return w8(K,Q)}else if(K==="")return new H(new d(X.scheme,X.userinfo,X.host,new L(V),X.path,X.query,X.fragment));else return new q(void 0)}}function N9(Z,W){if(Z.startsWith(":0")){let J=Z.slice(2);return fW(J,W,0)}else if(Z.startsWith(":1")){let J=Z.slice(2);return fW(J,W,1)}else if(Z.startsWith(":2")){let J=Z.slice(2);return fW(J,W,2)}else if(Z.startsWith(":3")){let J=Z.slice(2);return fW(J,W,3)}else if(Z.startsWith(":4")){let J=Z.slice(2);return fW(J,W,4)}else if(Z.startsWith(":5")){let J=Z.slice(2);return fW(J,W,5)}else if(Z.startsWith(":6")){let J=Z.slice(2);return fW(J,W,6)}else if(Z.startsWith(":7")){let J=Z.slice(2);return fW(J,W,7)}else if(Z.startsWith(":8")){let J=Z.slice(2);return fW(J,W,8)}else if(Z.startsWith(":9")){let J=Z.slice(2);return fW(J,W,9)}else if(Z===":")return new H(W);else if(Z==="")return new H(W);else if(Z.startsWith("?")){let J=Z.slice(1);return iW(J,W)}else if(Z.startsWith(":?")){let J=Z.slice(2);return iW(J,W)}else if(Z.startsWith("#")){let J=Z.slice(1);return RW(J,W)}else if(Z.startsWith(":#")){let J=Z.slice(2);return RW(J,W)}else if(Z.startsWith("/"))return w8(Z,W);else if(Z.startsWith(":")){let J=Z.slice(1);if(J.startsWith("/"))return w8(J,W);else return new q(void 0)}else return new q(void 0)}function xX(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V==="")return new H(new d(Q.scheme,Q.userinfo,new L(X),Q.port,Q.path,Q.query,Q.fragment));else if(V.startsWith(":")){let F=EZ(X,0,G),M=new d(Q.scheme,Q.userinfo,new L(F),Q.port,Q.path,Q.query,Q.fragment);return N9(V,M)}else if(V.startsWith("/")){let F=EZ(X,0,G),M=new d(Q.scheme,Q.userinfo,new L(F),Q.port,Q.path,Q.query,Q.fragment);return w8(V,M)}else if(V.startsWith("?")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#")){let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return RW(F,U)}else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function UG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V==="")return new H(new d(Q.scheme,Q.userinfo,new L(V),Q.port,Q.path,Q.query,Q.fragment));else if(V.startsWith("]"))if(G===0){let F=V.slice(1);return N9(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G+1),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return N9(F,U)}else if(V.startsWith("/"))if(G===0)return w8(V,Q);else{let F=EZ(X,0,G),M=new d(Q.scheme,Q.userinfo,new L(F),Q.port,Q.path,Q.query,Q.fragment);return w8(V,M)}else if(V.startsWith("?"))if(G===0){let F=V.slice(1);return iW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#"))if(G===0){let F=V.slice(1);return RW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,Q.userinfo,new L(M),Q.port,Q.path,Q.query,Q.fragment);return RW(F,U)}else{let F=C8(V),M,U;if(M=F[0],U=F[1],GG(M))Z=X,W=U,J=Q,K=G+1;else return xX(X,X,Q,0)}}}function IG(Z,W){return UG(Z,Z,W,0)}function zG(Z,W){return xX(Z,Z,W,0)}function XJ(Z,W){if(Z.startsWith("["))return IG(Z,W);else if(Z.startsWith(":")){let J=new d(W.scheme,W.userinfo,new L(""),W.port,W.path,W.query,W.fragment);return N9(Z,J)}else if(Z==="")return new H(new d(W.scheme,W.userinfo,new L(""),W.port,W.path,W.query,W.fragment));else return zG(Z,W)}function HG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("@"))if(G===0){let F=V.slice(1);return XJ(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(Q.scheme,new L(M),Q.host,Q.port,Q.path,Q.query,Q.fragment);return XJ(F,U)}else if(V==="")return XJ(X,Q);else if(V.startsWith("/"))return XJ(X,Q);else if(V.startsWith("?"))return XJ(X,Q);else if(V.startsWith("#"))return XJ(X,Q);else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function NG(Z,W){return HG(Z,Z,W,0)}function y0(Z,W){if(Z==="//")return new H(new d(W.scheme,W.userinfo,new L(""),W.port,W.path,W.query,W.fragment));else if(Z.startsWith("//")){let J=Z.slice(2);return NG(J,W)}else return w8(Z,W)}function DG(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(V.startsWith("/"))if(G===0)return y0(V,Q);else{let F=EZ(X,0,G),M=new d(new L(GW(F)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return y0(V,M)}else if(V.startsWith("?"))if(G===0){let F=V.slice(1);return iW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(new L(GW(M)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return iW(F,U)}else if(V.startsWith("#"))if(G===0){let F=V.slice(1);return RW(F,Q)}else{let F=V.slice(1),M=EZ(X,0,G),U=new d(new L(GW(M)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return RW(F,U)}else if(V.startsWith(":"))if(G===0)return new q(void 0);else{let F=V.slice(1),M=EZ(X,0,G),U=new d(new L(GW(M)),Q.userinfo,Q.host,Q.port,Q.path,Q.query,Q.fragment);return y0(F,U)}else if(V==="")return new H(new d(Q.scheme,Q.userinfo,Q.host,Q.port,X,Q.query,Q.fragment));else{let F=C8(V),M;M=F[1],Z=X,W=M,J=Q,K=G+1}}}function D9(Z){let W,J=Z.fragment;if(J instanceof L){let P=J[0];W=Y(["#",P])}else W=Y([]);let K=W,X,V=Z.query;if(V instanceof L){let P=V[0];X=B("?",B(P,K))}else X=K;let Q=X,G=B(Z.path,Q),F,M=Z.host,U=o8(Z.path,"/");if(M instanceof L&&!U)if(M[0]!=="")F=B("/",G);else F=G;else F=G;let I=F,N,T=Z.host,R=Z.port;if(T instanceof L&&R instanceof L){let P=R[0];N=B(":",B(qZ(P),I))}else N=I;let C=N,j,x=Z.scheme,O=Z.userinfo,k=Z.host;if(x instanceof L)if(O instanceof L)if(k instanceof L){let P=x[0],S=O[0],y=k[0];j=B(P,B("://",B(S,B("@",B(y,C)))))}else{let P=x[0];j=B(P,B(":",C))}else if(k instanceof L){let P=x[0],S=k[0];j=B(P,B("://",B(S,C)))}else{let P=x[0];j=B(P,B(":",C))}else if(O instanceof g&&k instanceof L){let P=k[0];j=B("//",B(P,C))}else j=C;return qJ(j)}var BG=new d(new g,new g,new g,new g,"",new g,new g);function b0(Z){return DG(Z,Z,BG,0)}function VJ(Z,W,J){if(Z)return W;else return J()}function o(Z){return Z}class v0 extends z{constructor(Z){super();this.dict=Z}}function wJ(){return new v0(MZ())}function bX(Z,W){let J=Z.dict,K=r(J,W);return PX(K)}function gX(Z){return pW(Z.dict)}var TG=void 0;function _0(Z,W){return new v0(TZ(Z.dict,W,TG))}var FW=()=>globalThis?.document,P9="http://www.w3.org/1999/xhtml",R9=1,m0=3;var hX=!!globalThis.HTMLElement?.prototype?.moveBefore;var m=Y([]),j9=new g;var OG=new cW,AG=new OZ,SG=new AZ;function T9(Z,W){if(Z.name===W.name)return SG;else if(Z.name<W.name)return AG;else return OG}class MW extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class LJ extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class nZ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.kind=Z,this.name=W,this.handler=J,this.include=K,this.prevent_default=X,this.stop_propagation=V,this.debounce=Q,this.throttle=G}}class EJ extends z{constructor(Z,W,J){super();this.prevent_default=Z,this.stop_propagation=W,this.message=J}}class uX extends z{constructor(Z){super();this.kind=Z}}function xG(Z,W){while(!0){let J=Z,K=W;if(J instanceof A)return K;else{let X=J.head;if(X instanceof MW){let V=X.name;if(V==="")Z=J.tail,W=K;else if(V==="class"){let Q=X.value;if(Q==="")Z=J.tail,W=K;else{let G=J.tail;if(G instanceof A){let F=X;Z=G,W=B(F,K)}else{let F=G.head;if(F instanceof MW)if(F.name==="class"){let U=X.kind,I=Q,N=G.tail,T=F.value,R=I+" "+T,C=new MW(U,"class",R);Z=B(C,N),W=K}else{let U=X;Z=G,W=B(U,K)}else{let M=X;Z=G,W=B(M,K)}}}}else if(V==="style"){let Q=X.value;if(Q==="")Z=J.tail,W=K;else{let G=J.tail;if(G instanceof A){let F=X;Z=G,W=B(F,K)}else{let F=G.head;if(F instanceof MW)if(F.name==="style"){let U=X.kind,I=Q,N=G.tail,T=F.value,R=I+";"+T,C=new MW(U,"style",R);Z=B(C,N),W=K}else{let U=X;Z=G,W=B(U,K)}else{let M=X;Z=G,W=B(M,K)}}}}else{let Q=X;Z=J.tail,W=B(Q,K)}}else{let V=X;Z=J.tail,W=B(V,K)}}}}function cX(Z){if(Z instanceof A)return Z;else if(Z.tail instanceof A)return Z;else{let K=A0(Z,(X,V)=>{return T9(V,X)});return xG(K,m)}}var c0=0;function pX(Z,W){return new MW(c0,Z,W)}var p0=1;function dX(Z,W){return new LJ(p0,Z,W)}var d0=2;function sX(Z,W,J,K,X,V,Q){return new nZ(d0,Z,W,J,K,X,V,Q)}var s0=0;var r0=new uX(s0);var n0=2;function w(Z,W){return pX(Z,W)}function rX(Z,W){return dX(Z,W)}function nX(Z,W){if(W)return w(Z,"");else return rX(Z,lW(!1))}function D(Z){return w("class",Z)}function xJ(Z){return w("id",Z)}function L8(Z){return w("href",Z)}function l0(Z){return w("action",Z)}function i0(Z){return w("method",Z)}function lX(Z){return w("accept",e8(Z,","))}function kJ(Z){return nX("disabled",Z)}function iX(Z){return w("name",Z)}function fJ(Z){return w("placeholder",Z)}function aX(Z){return nX("required",Z)}function bW(Z){return w("type",Z)}function a0(Z){return w("value",Z)}class A9 extends z{constructor(Z,W,J){super();this.synchronous=Z,this.before_paint=W,this.after_paint=J}}class oX extends z{constructor(Z,W,J,K,X){super();this.dispatch=Z,this.emit=W,this.select=J,this.root=K,this.provide=X}}function tX(Z,W,J,K,X,V){let Q=new oX(W,J,K,X,V);return rK(Z.synchronous,(G)=>{return G(Q)})}var O9=new A9(Y([]),Y([]),Y([]));function lZ(){return O9}function aW(Z){return new A9(Y([(J)=>{let K=J.dispatch;return Z(K)}]),O9.before_paint,O9.after_paint)}function jW(Z){return UZ(Z,O9,(W,J)=>{return new A9(UZ(J.synchronous,W.synchronous,V9),UZ(J.before_paint,W.before_paint,V9),UZ(J.after_paint,W.after_paint,V9))})}function iZ(){return null}function yJ(Z,W){let J=Z?.get(W);if(J!=null)return new H(J);else return new q(void 0)}function bJ(Z,W){return Z&&Z.has(W)}function E8(Z,W,J){return Z??=new Map,Z.set(W,J),Z}function o0(Z,W){return Z?.delete(W),Z}class t0 extends z{}class e0 extends z{constructor(Z,W){super();this.key=Z,this.parent=W}}class eX extends z{constructor(Z,W){super();this.index=Z,this.parent=W}}function kG(Z,W){while(!0){let J=Z,K=W;if(K instanceof A)return!1;else{let{head:X,tail:V}=K,Q=o8(J,X);if(Q)return Q;else Z=J,W=V}}}function UW(Z,W,J){if(J==="")return new eX(W,Z);else return new e0(J,Z)}var YJ=new t0,hJ="\t";function Z7(Z,W){while(!0){let J=Z,K=W;if(J instanceof t0)if(K instanceof A)return"";else{let X=K.tail;return qJ(X)}else if(J instanceof e0){let X=J.key;Z=J.parent,W=B(hJ,B(X,K))}else{let X=J.index;Z=J.parent,W=B(hJ,B(qZ(X),K))}}}function W7(Z){return Z7(Z,Y([]))}function J7(Z,W){if(W instanceof A)return!1;else return kG(W7(Z),W)}var Z6=` 5 + `;function W6(Z,W){return Z7(Z,Y([Z6,W]))}class aZ extends z{constructor(Z,W,J,K,X){super();this.kind=Z,this.key=W,this.mapper=J,this.children=K,this.keyed_children=X}}class cZ extends z{constructor(Z,W,J,K,X,V,Q,G,F,M){super();this.kind=Z,this.key=W,this.mapper=J,this.namespace=K,this.tag=X,this.attributes=V,this.children=Q,this.keyed_children=G,this.self_closing=F,this.void=M}}class JW extends z{constructor(Z,W,J,K){super();this.kind=Z,this.key=W,this.mapper=J,this.content=K}}class D8 extends z{constructor(Z,W,J,K,X,V,Q){super();this.kind=Z,this.key=W,this.mapper=J,this.namespace=K,this.tag=X,this.attributes=V,this.inner_html=Q}}function GJ(Z,W){if(W==="")if(Z==="area")return!0;else if(Z==="base")return!0;else if(Z==="br")return!0;else if(Z==="col")return!0;else if(Z==="embed")return!0;else if(Z==="hr")return!0;else if(Z==="img")return!0;else if(Z==="input")return!0;else if(Z==="link")return!0;else if(Z==="meta")return!0;else if(Z==="param")return!0;else if(Z==="source")return!0;else if(Z==="track")return!0;else if(Z==="wbr")return!0;else return!1;else return!1}function K7(Z,W){if(W instanceof aZ)return new aZ(W.kind,Z,W.mapper,W.children,W.keyed_children);else if(W instanceof cZ)return new cZ(W.kind,Z,W.mapper,W.namespace,W.tag,W.attributes,W.children,W.keyed_children,W.self_closing,W.void);else if(W instanceof JW)return new JW(W.kind,Z,W.mapper,W.content);else return new D8(W.kind,Z,W.mapper,W.namespace,W.tag,W.attributes,W.inner_html)}var TW=0;function J6(Z,W,J,K){return new aZ(TW,Z,W,J,K)}var x8=1;function FJ(Z,W,J,K,X,V,Q,G,F){return new cZ(x8,Z,W,J,K,cX(X),V,Q,G,F)}var MJ=2;function K6(Z,W,J){return new JW(MJ,Z,W,J)}var X7=3;var X6=(Z,W)=>Z===W,OW=(Z,W)=>{if(Z===W)return!0;if(Z==null||W==null)return!1;let J=typeof Z;if(J!==typeof W)return!1;if(J!=="object")return!1;if(Z.constructor!==W.constructor)return!1;if(Array.isArray(Z))return bG(Z,W);return gG(Z,W)},bG=(Z,W)=>{let J=Z.length;if(J!==W.length)return!1;while(J--)if(!OW(Z[J],W[J]))return!1;return!0},gG=(Z,W)=>{let J=Object.keys(Z),K=J.length;if(Object.keys(W).length!==K)return!1;while(K--){let X=J[K];if(!Object.hasOwn(W,X))return!1;if(!OW(Z[X],W[X]))return!1}return!0};class Z8 extends z{constructor(Z,W,J){super();this.handlers=Z,this.dispatched_paths=W,this.next_dispatched_paths=J}}class Y6 extends z{constructor(Z,W){super();this.path=Z,this.handler=W}}class V6 extends z{constructor(Z){super();this.path=Z}}function G6(){return new Z8(iZ(),m,m)}function G7(Z){return new Z8(Z.handlers,Z.next_dispatched_paths,m)}function F7(Z,W,J){return o0(Z,W6(W,J))}function C9(Z,W,J){let K=F7(Z.handlers,W,J);return new Z8(K,Z.dispatched_paths,Z.next_dispatched_paths)}function V7(Z,W,J){return UZ(J,Z,(K,X)=>{if(X instanceof nZ){let V=X.name;return F7(K,W,V)}else return K})}function F6(Z,W,J,K){let X=yJ(Z.handlers,W+Z6+J);if(X instanceof H){let V=X[0],Q=s(K,V);if(Q instanceof H){let G=Q[0];return new Y6(W,G)}else return new V6(W)}else return new V6(W)}function M6(Z,W){let J=B(W.path,Z.next_dispatched_paths),K=new Z8(Z.handlers,Z.dispatched_paths,J);if(W instanceof Y6){let X=W.handler;return[K,new H(X)]}else return[K,new q(void 0)]}function q9(Z,W,J,K){let X=F6(Z,W,J,K);return((V)=>{return M6(Z,V)})(X)}function w9(Z,W){return J7(W,Z.dispatched_paths)}function M7(Z,W,J,K,X){return E8(Z,W6(J,K),CJ(X,(V)=>{return new EJ(V.prevent_default,V.stop_propagation,o(W)(V.message))}))}function UJ(Z,W,J,K,X){let V=M7(Z.handlers,W,J,K,X);return new Z8(V,Z.dispatched_paths,Z.next_dispatched_paths)}function Q7(Z,W,J,K){return UZ(K,Z,(X,V)=>{if(V instanceof nZ){let{name:Q,handler:G}=V;return M7(X,W,J,Q,G)}else return X})}function eW(Z,W){let J=X6(Z,o);if(X6(W,o))return Z;else if(J)return W;else return(X)=>{return Z(W(X))}}function Y7(Z,W,J,K){while(!0){let X=Z,V=W,Q=J,G=K;if(G instanceof A)return X;else{let{head:F,tail:M}=G;Z=U7(X,V,Q,F),W=V,J=Q+1,K=M}}}function U7(Z,W,J,K){if(K instanceof aZ){let X=K.children,V=UW(W,J,K.key);return Y7(Z,V,0,X)}else if(K instanceof cZ){let{attributes:X,children:V}=K,Q=UW(W,J,K.key),F=V7(Z,Q,X);return Y7(F,Q,0,V)}else if(K instanceof JW)return Z;else{let X=K.attributes,V=UW(W,J,K.key);return V7(Z,V,X)}}function W8(Z,W,J,K){let X=U7(Z.handlers,W,J,K);return new Z8(X,Z.dispatched_paths,Z.next_dispatched_paths)}function Q6(Z,W,J,K,X){while(!0){let V=Z,Q=W,G=J,F=K,M=X;if(M instanceof A)return V;else{let{head:U,tail:I}=M;Z=I7(V,Q,G,F,U),W=Q,J=G,K=F+1,X=I}}}function I7(Z,W,J,K,X){if(X instanceof aZ){let V=X.children,Q=UW(J,K,X.key),G=eW(W,X.mapper);return Q6(Z,G,Q,0,V)}else if(X instanceof cZ){let{attributes:V,children:Q}=X,G=UW(J,K,X.key),F=eW(W,X.mapper),U=Q7(Z,F,G,V);return Q6(U,F,G,0,Q)}else if(X instanceof JW)return Z;else{let V=X.attributes,Q=UW(J,K,X.key),G=eW(W,X.mapper);return Q7(Z,G,Q,V)}}function J8(Z,W,J,K,X){let V=I7(Z.handlers,W,J,K,X);return new Z8(V,Z.dispatched_paths,Z.next_dispatched_paths)}function U6(Z){return J8(G6(),o,YJ,0,Z)}function z7(Z,W,J,K,X){let V=Q6(Z.handlers,W,J,K,X);return new Z8(V,Z.dispatched_paths,Z.next_dispatched_paths)}function fZ(Z,W,J){return FJ("",o,"",Z,W,J,iZ(),!1,GJ(Z,""))}function K8(Z,W,J,K){return FJ("",o,Z,W,J,K,iZ(),!1,GJ(W,Z))}function E(Z){return K6("",o,Z)}function pZ(){return K6("",o,"")}function I6(Z,W){let J=o(eW(o(W),Z.mapper));if(Z instanceof aZ){let{children:K,keyed_children:X}=Z;return new aZ(Z.kind,Z.key,J,o(K),o(X))}else if(Z instanceof cZ){let{attributes:K,children:X,keyed_children:V}=Z;return new cZ(Z.kind,Z.key,J,Z.namespace,Z.tag,o(K),o(X),o(V),Z.self_closing,Z.void)}else if(Z instanceof JW)return o(Z);else{let K=Z.attributes;return new D8(Z.kind,Z.key,J,Z.namespace,Z.tag,o(K),Z.inner_html)}}function gW(Z){return E(Z)}function f8(Z,W){return fZ("h1",Z,W)}function vJ(Z,W){return fZ("h2",Z,W)}function f(Z,W){return fZ("div",Z,W)}function IJ(Z,W){return fZ("li",Z,W)}function dZ(Z,W){return fZ("p",Z,W)}function H7(Z,W){return fZ("pre",Z,W)}function N7(Z,W){return fZ("ul",Z,W)}function y8(Z,W){return fZ("a",Z,W)}function IZ(Z,W){return fZ("span",Z,W)}function sZ(Z,W){return fZ("button",Z,W)}function z6(Z,W){return fZ("form",Z,W)}function zJ(Z){return fZ("input",Z,m)}function L9(Z,W){return fZ("label",Z,W)}class _J extends z{constructor(Z,W,J,K){super();this.index=Z,this.removed=W,this.changes=J,this.children=K}}class D7 extends z{constructor(Z,W){super();this.kind=Z,this.content=W}}class B7 extends z{constructor(Z,W){super();this.kind=Z,this.inner_html=W}}class P7 extends z{constructor(Z,W,J){super();this.kind=Z,this.added=W,this.removed=J}}class R7 extends z{constructor(Z,W,J){super();this.kind=Z,this.key=W,this.before=J}}class j7 extends z{constructor(Z,W,J){super();this.kind=Z,this.index=W,this.with=J}}class T7 extends z{constructor(Z,W){super();this.kind=Z,this.index=W}}class O7 extends z{constructor(Z,W,J){super();this.kind=Z,this.children=W,this.before=J}}function H6(Z,W,J,K){return new _J(Z,W,J,K)}var N6=0;function A7(Z){return new D7(N6,Z)}var D6=1;function S7(Z){return new B7(D6,Z)}var B6=2;function P6(Z,W){return new P7(B6,Z,W)}var R6=3;function C7(Z,W){return new R7(R6,Z,W)}var j6=4;function q7(Z){return new T7(j6,Z)}var T6=5;function b8(Z,W){return new j7(T6,Z,W)}var O6=6;function A6(Z,W){return new O7(O6,Z,W)}class L7 extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.kind=Z,this.open_shadow_root=W,this.will_adopt_styles=J,this.observed_attributes=K,this.observed_properties=X,this.requested_contexts=V,this.provided_contexts=Q,this.vdom=G}}class E7 extends z{constructor(Z,W){super();this.kind=Z,this.patch=W}}class x7 extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.data=J}}class k7 extends z{constructor(Z,W,J){super();this.kind=Z,this.key=W,this.value=J}}class E9 extends z{constructor(Z,W){super();this.kind=Z,this.messages=W}}class x9 extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class k9 extends z{constructor(Z,W,J){super();this.kind=Z,this.name=W,this.value=J}}class f9 extends z{constructor(Z,W,J,K){super();this.kind=Z,this.path=W,this.name=J,this.event=K}}class S6 extends z{constructor(Z,W,J){super();this.kind=Z,this.key=W,this.value=J}}var _G=0;function f7(Z,W,J,K,X,V,Q){return new L7(_G,Z,W,J,K,X,V,Q)}var $G=1;function C6(Z){return new E7($G,Z)}var mG=2;function y7(Z,W){return new x7(mG,Z,W)}var uG=3;function b7(Z,W){return new k7(uG,Z,W)}class y9 extends z{constructor(Z,W){super();this.patch=Z,this.events=W}}class v7 extends z{constructor(Z,W,J){super();this.added=Z,this.removed=W,this.events=J}}function cG(Z,W,J,K){if(J==="input"&&W==="")return w9(Z,K);else if(J==="select"&&W==="")return w9(Z,K);else if(J==="textarea"&&W==="")return w9(Z,K);else return!1}function h7(Z,W,J,K,X,V,Q,G){while(!0){let F=Z,M=W,U=J,I=K,N=X,T=V,R=Q,C=G;if(N instanceof A)if(T instanceof A)return new v7(R,C,I);else{let j=T.head;if(j instanceof nZ){let x=j,O=T.tail,k=j.name,b=j.handler,P=B(x,R),S=UJ(I,U,M,k,b);Z=F,W=M,J=U,K=S,X=N,V=O,Q=P,G=C}else{let x=j,O=T.tail,k=B(x,R);Z=F,W=M,J=U,K=I,X=N,V=O,Q=k,G=C}}else if(T instanceof A){let j=N.head;if(j instanceof nZ){let x=j,O=N.tail,k=j.name,b=B(x,C),P=C9(I,M,k);Z=F,W=M,J=U,K=P,X=O,V=T,Q=R,G=b}else{let x=j,O=N.tail,k=B(x,C);Z=F,W=M,J=U,K=I,X=O,V=T,Q=R,G=k}}else{let{head:j,tail:x}=N,O=T.head,k=T.tail,b=T9(j,O);if(b instanceof OZ)if(j instanceof nZ){let P=j.name,S=B(j,C),y=C9(I,M,P);Z=F,W=M,J=U,K=y,X=x,V=T,Q=R,G=S}else{let P=B(j,C);Z=F,W=M,J=U,K=I,X=x,V=T,Q=R,G=P}else if(b instanceof AZ)if(j instanceof MW)if(O instanceof MW){let P,S=O.name;if(S==="value")P=F||j.value!==O.value;else if(S==="checked")P=F||j.value!==O.value;else if(S==="selected")P=F||j.value!==O.value;else P=j.value!==O.value;let y=P,v;if(y)v=B(O,R);else v=R;let _=v;Z=F,W=M,J=U,K=I,X=x,V=k,Q=_,G=C}else if(O instanceof nZ){let{name:P,handler:S}=O,y=B(O,R),v=B(j,C),_=UJ(I,U,M,P,S);Z=F,W=M,J=U,K=_,X=x,V=k,Q=y,G=v}else{let P=B(O,R),S=B(j,C);Z=F,W=M,J=U,K=I,X=x,V=k,Q=P,G=S}else if(j instanceof LJ)if(O instanceof LJ){let P,S=O.name;if(S==="scrollLeft")P=!0;else if(S==="scrollRight")P=!0;else if(S==="value")P=F||!OW(j.value,O.value);else if(S==="checked")P=F||!OW(j.value,O.value);else if(S==="selected")P=F||!OW(j.value,O.value);else P=!OW(j.value,O.value);let y=P,v;if(y)v=B(O,R);else v=R;let _=v;Z=F,W=M,J=U,K=I,X=x,V=k,Q=_,G=C}else if(O instanceof nZ){let{name:P,handler:S}=O,y=B(O,R),v=B(j,C),_=UJ(I,U,M,P,S);Z=F,W=M,J=U,K=_,X=x,V=k,Q=y,G=v}else{let P=B(O,R),S=B(j,C);Z=F,W=M,J=U,K=I,X=x,V=k,Q=P,G=S}else if(O instanceof nZ){let{name:P,handler:S}=O,y=j.prevent_default.kind!==O.prevent_default.kind||j.stop_propagation.kind!==O.stop_propagation.kind||j.debounce!==O.debounce||j.throttle!==O.throttle,v;if(y)v=B(O,R);else v=R;let _=v,u=UJ(I,U,M,P,S);Z=F,W=M,J=U,K=u,X=x,V=k,Q=_,G=C}else{let P=j.name,S=B(O,R),y=B(j,C),v=C9(I,M,P);Z=F,W=M,J=U,K=v,X=x,V=k,Q=S,G=y}else if(O instanceof nZ){let{name:P,handler:S}=O,y=B(O,R),v=UJ(I,U,M,P,S);Z=F,W=M,J=U,K=v,X=N,V=k,Q=y,G=C}else{let P=B(O,R);Z=F,W=M,J=U,K=I,X=N,V=k,Q=P,G=C}}}}function q6(Z,W,J,K,X,V,Q,G,F,M,U,I,N,T){while(!0){let R=Z,C=W,j=J,x=K,O=X,k=V,b=Q,P=G,S=F,y=M,v=U,_=I,u=N,YZ=T;if(R instanceof A)if(j instanceof A)return new y9(new _J(S,b,v,_),YZ);else{let gZ=z7(YZ,u,y,P,j),_Z=A6(j,P-k),FZ=B(_Z,v);return new y9(new _J(S,b,FZ,_),gZ)}else if(j instanceof A){let{head:gZ,tail:_Z}=R,FZ;if(gZ.key===""||!bJ(O,gZ.key))FZ=b+1;else FZ=b;let ZZ=FZ,XZ=W8(YZ,y,P,gZ);Z=_Z,W=C,J=j,K=x,X=O,V=k,Q=ZZ,G=P,F=S,M=y,U=v,I=_,N=u,T=XZ}else{let gZ=R.head,_Z=j.head;if(gZ.key!==_Z.key){let FZ=R.tail,zZ=j.tail,ZZ=yJ(C,_Z.key);if(bJ(x,gZ.key))if(ZZ instanceof H){let p=ZZ[0];if(bJ(O,gZ.key))Z=FZ,W=C,J=j,K=x,X=O,V=k-1,Q=b,G=P,F=S,M=y,U=v,I=_,N=u,T=YZ;else{let VZ=P-k,l=B(C7(_Z.key,VZ),v),PZ=E8(O,_Z.key,void 0),QZ=k+1;Z=B(p,R),W=C,J=j,K=x,X=PZ,V=QZ,Q=b,G=P,F=S,M=y,U=l,I=_,N=u,T=YZ}}else{let p=P-k,KZ=J8(YZ,u,y,P,_Z),VZ=A6(Y([_Z]),p),l=B(VZ,v);Z=R,W=C,J=zZ,K=x,X=O,V=k+1,Q=b,G=P+1,F=S,M=y,U=l,I=_,N=u,T=KZ}else if(ZZ instanceof H){let p=P-k,KZ=B(q7(p),v),VZ=W8(YZ,y,P,gZ),l=k-1;Z=FZ,W=C,J=j,K=x,X=O,V=l,Q=b,G=P,F=S,M=y,U=KZ,I=_,N=u,T=VZ}else{let p=b8(P-k,_Z),KZ,l=W8(YZ,y,P,gZ);KZ=J8(l,u,y,P,_Z);let PZ=KZ;Z=FZ,W=C,J=zZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=B(p,v),I=_,N=u,T=PZ}}else{let FZ=R.head;if(FZ instanceof aZ){let zZ=j.head;if(zZ instanceof aZ){let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=eW(u,p.mapper),l=UW(y,P,p.key),PZ=q6(ZZ.children,ZZ.keyed_children,p.children,p.keyed_children,iZ(),0,0,0,P,l,m,m,VZ,YZ),QZ,jZ=PZ.patch;if(jZ.changes instanceof A)if(jZ.children instanceof A)if(jZ.removed===0)QZ=_;else QZ=B(PZ.patch,_);else QZ=B(PZ.patch,_);else QZ=B(PZ.patch,_);let wW=QZ;Z=XZ,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=v,I=wW,N=u,T=PZ.events}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(P-k,p),l,QZ=W8(YZ,y,P,ZZ);l=J8(QZ,u,y,P,p);let jZ=l;Z=XZ,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=B(VZ,v),I=_,N=u,T=jZ}}else if(FZ instanceof cZ){let zZ=j.head;if(zZ instanceof cZ){let ZZ=FZ,XZ=zZ;if(ZZ.namespace===XZ.namespace&&ZZ.tag===XZ.tag){let p=R.tail,KZ=j.tail,VZ=eW(u,XZ.mapper),l=UW(y,P,XZ.key),PZ=cG(YZ,XZ.namespace,XZ.tag,l),QZ=h7(PZ,l,VZ,YZ,ZZ.attributes,XZ.attributes,m,m),jZ,uW,wW;jZ=QZ.added,uW=QZ.removed,wW=QZ.events;let T8;if(jZ instanceof A&&uW instanceof A)T8=m;else T8=Y([P6(jZ,uW)]);let d8=T8,s8=q6(ZZ.children,ZZ.keyed_children,XZ.children,XZ.keyed_children,iZ(),0,0,0,P,l,d8,m,VZ,wW),G8,O8=s8.patch;if(O8.changes instanceof A)if(O8.children instanceof A)if(O8.removed===0)G8=_;else G8=B(s8.patch,_);else G8=B(s8.patch,_);else G8=B(s8.patch,_);let hQ=G8;Z=p,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=v,I=hQ,N=u,T=s8.events}else{let p=FZ,KZ=R.tail,VZ=zZ,l=j.tail,PZ=b8(P-k,VZ),QZ,uW=W8(YZ,y,P,p);QZ=J8(uW,u,y,P,VZ);let wW=QZ;Z=KZ,W=C,J=l,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=B(PZ,v),I=_,N=u,T=wW}}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(P-k,p),l,QZ=W8(YZ,y,P,ZZ);l=J8(QZ,u,y,P,p);let jZ=l;Z=XZ,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=B(VZ,v),I=_,N=u,T=jZ}}else if(FZ instanceof JW){let zZ=j.head;if(zZ instanceof JW){let ZZ=FZ,XZ=zZ;if(ZZ.content===XZ.content){let p=R.tail,KZ=j.tail;Z=p,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=v,I=_,N=u,T=YZ}else{let p=R.tail,KZ=zZ,VZ=j.tail,l=H6(P,0,Y([A7(KZ.content)]),m);Z=p,W=C,J=VZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=v,I=B(l,_),N=u,T=YZ}}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(P-k,p),l,QZ=W8(YZ,y,P,ZZ);l=J8(QZ,u,y,P,p);let jZ=l;Z=XZ,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=B(VZ,v),I=_,N=u,T=jZ}}else{let zZ=j.head;if(zZ instanceof D8){let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=eW(u,p.mapper),l=UW(y,P,p.key),PZ=h7(!1,l,VZ,YZ,ZZ.attributes,p.attributes,m,m),QZ,jZ,uW;QZ=PZ.added,jZ=PZ.removed,uW=PZ.events;let wW;if(QZ instanceof A&&jZ instanceof A)wW=m;else wW=Y([P6(QZ,jZ)]);let T8=wW,d8;if(ZZ.inner_html===p.inner_html)d8=T8;else d8=B(S7(p.inner_html),T8);let G8=d8,O8;if(G8 instanceof A)O8=_;else O8=B(H6(P,0,G8,Y([])),_);let SK=O8;Z=XZ,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=v,I=SK,N=u,T=uW}else{let ZZ=FZ,XZ=R.tail,p=zZ,KZ=j.tail,VZ=b8(P-k,p),l,QZ=W8(YZ,y,P,ZZ);l=J8(QZ,u,y,P,p);let jZ=l;Z=XZ,W=C,J=KZ,K=x,X=O,V=k,Q=b,G=P+1,F=S,M=y,U=B(VZ,v),I=_,N=u,T=jZ}}}}}}function HJ(Z,W,J){return q6(Y([W]),iZ(),Y([J]),iZ(),iZ(),0,0,0,0,YJ,m,m,o,G7(Z))}var{setTimeout:pG,clearTimeout:w6}=globalThis,dG=(Z,W)=>FW().createElementNS(Z,W),sG=(Z)=>FW().createTextNode(Z),rG=()=>FW().createDocumentFragment(),NJ=(Z,W,J)=>Z.insertBefore(W,J),$7=hX?(Z,W,J)=>Z.moveBefore(W,J):NJ,nG=(Z,W)=>Z.removeChild(W),lG=(Z,W)=>Z.getAttribute(W),m7=(Z,W,J)=>Z.setAttribute(W,J),iG=(Z,W)=>Z.removeAttribute(W),aG=(Z,W,J,K)=>Z.addEventListener(W,J,K),u7=(Z,W,J)=>Z.removeEventListener(W,J),oG=(Z,W)=>Z.innerHTML=W,tG=(Z,W)=>Z.data=W,X8=Symbol("lustre");class d7{constructor(Z,W,J,K){this.kind=Z,this.key=K,this.parent=W,this.children=[],this.node=J,this.handlers=new Map,this.throttles=new Map,this.debouncers=new Map}get parentNode(){return this.kind===TW?this.node.parentNode:this.node}}var V8=(Z,W,J,K,X)=>{let V=new d7(Z,W,J,X);return J[X8]=V,W?.children.splice(K,0,V),V},eG=(Z)=>{let W="";for(let J=Z[X8];J.parent;J=J.parent)if(J.key)W=`${hJ}${J.key}${W}`;else{let K=J.parent.children.indexOf(J);W=`${hJ}${K}${W}`}return W.slice(1)};class E6{#Z=null;#X;#J;#K=!1;constructor(Z,W,J,{exposeKeys:K=!1}={}){this.#Z=Z,this.#X=W,this.#J=J,this.#K=K}mount(Z){V8(x8,null,this.#Z,0,null),this.#P(this.#Z,null,this.#Z[X8],0,Z)}push(Z){this.#W.push({node:this.#Z[X8],patch:Z}),this.#V()}#W=[];#V(){let Z=this.#W;while(Z.length){let{node:W,patch:J}=Z.pop(),{children:K}=W,{changes:X,removed:V,children:Q}=J;if(g8(X,(G)=>this.#Q(W,G)),V)this.#I(W,K.length-V,V);g8(Q,(G)=>{let F=K[G.index|0];this.#W.push({node:F,patch:G})})}}#Q(Z,W){switch(W.kind){case N6:this.#A(Z,W);break;case D6:this.#R(Z,W);break;case B6:this.#H(Z,W);break;case R6:this.#M(Z,W);break;case j6:this.#D(Z,W);break;case T6:this.#U(Z,W);break;case O6:this.#G(Z,W);break}}#G(Z,{children:W,before:J}){let K=rG(),X=this.#F(Z,J);this.#B(K,null,Z,J|0,W),NJ(Z.parentNode,K,X)}#U(Z,{index:W,with:J}){this.#I(Z,W|0,1);let K=this.#F(Z,W);this.#P(Z.parentNode,K,Z,W|0,J)}#F(Z,W){W=W|0;let{children:J}=Z,K=J.length;if(W<K)return J[W].node;let X=J[K-1];if(!X&&Z.kind!==TW)return null;if(!X)X=Z;while(X.kind===TW&&X.children.length)X=X.children[X.children.length-1];return X.node.nextSibling}#M(Z,{key:W,before:J}){J=J|0;let{children:K,parentNode:X}=Z,V=K[J].node,Q=K[J];for(let U=J+1;U<K.length;++U){let I=K[U];if(K[U]=Q,Q=I,I.key===W){K[J]=I;break}}let{kind:G,node:F,children:M}=Q;if($7(X,F,V),G===TW)this.#Y(X,M,V)}#Y(Z,W,J){for(let K=0;K<W.length;++K){let{kind:X,node:V,children:Q}=W[K];if($7(Z,V,J),X===TW)this.#Y(Z,Q,J)}}#D(Z,{index:W}){this.#I(Z,W,1)}#I(Z,W,J){let{children:K,parentNode:X}=Z,V=K.splice(W,J);for(let Q=0;Q<V.length;++Q){let{kind:G,node:F,children:M}=V[Q];if(nG(X,F),this.#z(V[Q]),G===TW)V.push(...M)}}#z(Z){let{debouncers:W,children:J}=Z;for(let{timeout:K}of W.values())if(K)w6(K);W.clear(),g8(J,(K)=>this.#z(K))}#H({node:Z,handlers:W,throttles:J,debouncers:K},{added:X,removed:V}){g8(V,({name:Q})=>{if(W.delete(Q))u7(Z,Q,L6),this.#N(J,Q,0),this.#N(K,Q,0);else iG(Z,Q),p7[Q]?.removed?.(Z,Q)}),g8(X,(Q)=>this.#O(Z,Q))}#A({node:Z},{content:W}){tG(Z,W??"")}#R({node:Z},{inner_html:W}){oG(Z,W??"")}#B(Z,W,J,K,X){g8(X,(V)=>this.#P(Z,W,J,K++,V))}#P(Z,W,J,K,X){switch(X.kind){case x8:{let V=this.#j(J,K,X);this.#B(V,null,V[X8],0,X.children),NJ(Z,V,W);break}case MJ:{let V=this.#T(J,K,X);NJ(Z,V,W);break}case TW:{let V=this.#T(J,K,X);NJ(Z,V,W),this.#B(Z,W,V[X8],0,X.children);break}case X7:{let V=this.#j(J,K,X);this.#R({node:V},X),NJ(Z,V,W);break}}}#j(Z,W,{kind:J,key:K,tag:X,namespace:V,attributes:Q}){let G=dG(V||P9,X);if(V8(J,Z,G,W,K),this.#K&&K)m7(G,"data-lustre-key",K);return g8(Q,(F)=>this.#O(G,F)),G}#T(Z,W,{kind:J,key:K,content:X}){let V=sG(X??"");return V8(J,Z,V,W,K),V}#O(Z,W){let{debouncers:J,handlers:K,throttles:X}=Z[X8],{kind:V,name:Q,value:G,prevent_default:F,debounce:M,throttle:U}=W;switch(V){case c0:{let I=G??"";if(Q==="virtual:defaultValue"){Z.defaultValue=I;return}else if(Q==="virtual:defaultChecked"){Z.defaultChecked=!0;return}else if(Q==="virtual:defaultSelected"){Z.defaultSelected=!0;return}if(I!==lG(Z,Q))m7(Z,Q,I);p7[Q]?.added?.(Z,I);break}case p0:Z[Q]=G;break;case d0:{if(K.has(Q))u7(Z,Q,L6);let I=F.kind===s0;aG(Z,Q,L6,{passive:I}),this.#N(X,Q,U),this.#N(J,Q,M),K.set(Q,(N)=>this.#S(W,N));break}}}#N(Z,W,J){let K=Z.get(W);if(J>0)if(K)K.delay=J;else Z.set(W,{delay:J});else if(K){let{timeout:X}=K;if(X)w6(X);Z.delete(W)}}#S(Z,W){let{currentTarget:J,type:K}=W,{debouncers:X,throttles:V}=J[X8],Q=eG(J),{prevent_default:G,stop_propagation:F,include:M}=Z;if(G.kind===n0)W.preventDefault();if(F.kind===n0)W.stopPropagation();if(K==="submit")W.detail??={},W.detail.formData=[...new FormData(W.target,W.submitter).entries()];let U=this.#X(W,Q,K,M),I=V.get(K);if(I){let T=Date.now(),R=I.last||0;if(T>R+I.delay)I.last=T,I.lastEvent=W,this.#J(W,U)}let N=X.get(K);if(N)w6(N.timeout),N.timeout=pG(()=>{if(W===V.get(K)?.lastEvent)return;this.#J(W,U)},N.delay);if(!I&&!N)this.#J(W,U)}}var g8=(Z,W)=>{if(Array.isArray(Z))for(let J=0;J<Z.length;J++)W(Z[J]);else if(Z)for(Z;Z.head;Z=Z.tail)W(Z.head)},L6=(Z)=>{let{currentTarget:W,type:J}=Z;W[X8].handlers.get(J)(Z)},c7=(Z)=>{return{added(W){W[Z]=!0},removed(W){W[Z]=!1}}},Z5=(Z)=>{return{added(W,J){W[Z]=J}}},p7={checked:c7("checked"),selected:c7("selected"),value:Z5("value"),autofocus:{added(Z){queueMicrotask(()=>{Z.focus?.()})}},autoplay:{added(Z){try{Z.play?.()}catch(W){console.error(W)}}}};function W5(Z,W,J){while(!0){let K=Z,X=W,V=J;if(K instanceof A)return[X,i(V)];else{let Q=K.tail,G=K.head[0],F=K.head[1],M=K7(G,F),U;if(G==="")U=X;else U=E8(X,G,M);let I=U,N=B(M,V);Z=Q,W=I,J=N}}}function x6(Z){return W5(Z,iZ(),m)}function s7(Z,W,J){let K=x6(J),X,V;return X=K[0],V=K[1],FJ("",o,"",Z,W,V,X,!1,GJ(Z,""))}function r7(Z,W,J,K){let X=x6(K),V,Q;return V=X[0],Q=X[1],FJ("",o,Z,W,J,Q,V,!1,GJ(W,Z))}function n7(Z){let W=x6(Z),J,K;return J=W[0],K=W[1],J6("",o,K,J)}var l7=(Z)=>{let W=V8(x8,null,Z,0,null),J=0;for(let Q=Z.firstChild;Q;Q=Q.nextSibling)if(i7(Q))J+=1;if(J===0){let Q=FW().createTextNode("");return V8(MJ,W,Q,0,null),Z.replaceChildren(Q),pZ()}if(J===1)return k6(W,Z).head[1];let K=FW().createTextNode(""),X=V8(TW,W,K,0,null),V=k6(X,Z);return Z.insertBefore(K,Z.firstChild),n7(V)},i7=(Z)=>{switch(Z.nodeType){case R9:return!0;case m0:return!!Z.data;default:return!1}},J5=(Z,W,J,K)=>{if(!i7(W))return null;switch(W.nodeType){case R9:{let X=V8(x8,Z,W,K,J),V=W.localName,Q=W.namespaceURI,G=!Q||Q===P9;if(G&&K5.includes(V))X5(V,W);let F=V5(W),M=k6(X,W);return G?s7(V,F,M):r7(Q,V,F,M)}case m0:return V8(MJ,Z,W,K,null),E(W.data);default:return null}},K5=["input","select","textarea"],X5=(Z,W)=>{let{value:J,checked:K}=W;if(Z==="input"&&W.type==="checkbox"&&!K)return;if(Z==="input"&&W.type==="radio"&&!K)return;if(W.type!=="checkbox"&&W.type!=="radio"&&!J)return;queueMicrotask(()=>{if(W.value=J,W.checked=K,W.dispatchEvent(new Event("input",{bubbles:!0})),W.dispatchEvent(new Event("change",{bubbles:!0})),FW().activeElement!==W)W.dispatchEvent(new Event("blur",{bubbles:!0}))})},k6=(Z,W)=>{let J=null,K=W.firstChild,X=null,V=0;while(K){let Q=K.nodeType===R9?K.getAttribute("data-lustre-key"):null;if(Q!=null)K.removeAttribute("data-lustre-key");let G=J5(Z,K,Q,V),F=K.nextSibling;if(G){let M=new tZ([Q??"",G],null);if(X)X=X.tail=M;else X=J=M;V+=1}else W.removeChild(K);K=F}if(!X)return m;return X.tail=m,J},V5=(Z)=>{let W=Z.attributes.length,J=m;while(W-- >0){let K=Z.attributes[W];if(K.name==="xmlns")continue;J=new tZ(Q5(K),J)}return J},Q5=(Z)=>{let{localName:W,value:J}=Z;return w(W,J)};var B8=()=>!!FW();class b9{constructor(Z,[W,J],K,X){this.root=Z,this.#Z=W,this.#X=K,this.#J=X,this.root.addEventListener("context-request",(G)=>{if(!(G.context&&G.callback))return;if(!this.#Q.has(G.context))return;G.stopImmediatePropagation();let F=this.#Q.get(G.context);if(G.subscribe){let M=()=>{F.subscribers=F.subscribers.filter((U)=>U!==G.callback)};F.subscribers.push([G.callback,M]),G.callback(F.value,M)}else G.callback(F.value)});let V=(G,F,M)=>F6(this.#W,F,M,G),Q=(G,F)=>{let[M,U]=M6(this.#W,F);if(this.#W=M,U.isOk()){let I=U[0];if(I.stop_propagation)G.stopPropagation();if(I.prevent_default)G.preventDefault();this.dispatch(I.message,!1)}};this.#V=new E6(this.root,V,Q),this.#K=l7(this.root),this.#W=G6(),this.#z(J),this.#H()}root=null;dispatch(Z,W=!1){if(this.#G)this.#U.push(Z);else{let[J,K]=this.#J(this.#Z,Z);this.#Z=J,this.#I(K,W)}}emit(Z,W){(this.root.host??this.root).dispatchEvent(new CustomEvent(Z,{detail:W,bubbles:!0,composed:!0}))}provide(Z,W){if(!this.#Q.has(Z))this.#Q.set(Z,{value:W,subscribers:[]});else{let J=this.#Q.get(Z);if(OW(J.value,W))return;J.value=W;for(let K=J.subscribers.length-1;K>=0;K--){let[X,V]=J.subscribers[K];if(!X){J.subscribers.splice(K,1);continue}X(W,V)}}}#Z;#X;#J;#K;#W;#V;#Q=new Map;#G=!1;#U=[];#F=m;#M=m;#Y=null;#D={dispatch:(Z)=>this.dispatch(Z),emit:(Z,W)=>this.emit(Z,W),select:()=>{},root:()=>this.root,provide:(Z,W)=>this.provide(Z,W)};#I(Z,W=!1){if(this.#z(Z),!this.#Y)if(W)this.#Y="sync",queueMicrotask(()=>this.#H());else this.#Y=requestAnimationFrame(()=>this.#H())}#z(Z){this.#G=!0;while(!0){for(let J=Z.synchronous;J.tail;J=J.tail)J.head(this.#D);if(this.#F=o7(this.#F,Z.before_paint),this.#M=o7(this.#M,Z.after_paint),!this.#U.length)break;let W=this.#U.shift();[this.#Z,Z]=this.#J(this.#Z,W)}this.#G=!1}#H(){this.#Y=null;let Z=this.#X(this.#Z),{patch:W,events:J}=HJ(this.#W,this.#K,Z);if(this.#W=J,this.#K=Z,this.#V.push(W),this.#F instanceof tZ){let K=a7(this.#F);this.#F=m,queueMicrotask(()=>{this.#I(K,!0)})}if(this.#M instanceof tZ){let K=a7(this.#M);this.#M=m,requestAnimationFrame(()=>{this.#I(K,!0)})}}}function a7(Z){return{synchronous:Z,after_paint:m,before_paint:m}}function o7(Z,W){if(Z instanceof A)return W;else if(W instanceof A)return Z;else return SZ(Z,W)}class y6 extends z{constructor(Z){super();this.message=Z}}class b6 extends z{constructor(Z){super();this.callback=Z}}class g6 extends z{constructor(Z){super();this.callback=Z}}class P8 extends z{constructor(Z){super();this.message=Z}}class h8 extends z{constructor(Z,W){super();this.name=Z,this.data=W}}class g9 extends z{constructor(Z,W){super();this.key=Z,this.value=W}}class v8 extends z{}class ZV extends z{constructor(Z,W,J,K,X,V,Q,G,F,M){super();this.open_shadow_root=Z,this.adopt_styles=W,this.delegates_focus=J,this.attributes=K,this.properties=X,this.contexts=V,this.is_form_associated=Q,this.on_form_autofill=G,this.on_form_reset=F,this.on_form_restore=M}}function WV(Z){let W=new ZV(!0,!0,!1,m,m,m,!1,j9,j9,j9);return UZ(Z,W,(J,K)=>{return K.apply(J)})}class KV{#Z;constructor(Z,[W,J],K,X){this.#Z=new b9(Z,[W,J],X,K)}send(Z){switch(Z.constructor){case P8:{this.dispatch(Z.message,!1);break}case h8:{this.emit(Z.name,Z.data);break}case v8:break}}dispatch(Z){this.#Z.dispatch(Z)}emit(Z,W){this.#Z.emit(Z,W)}}var XV=({init:Z,update:W,view:J},K,X)=>{if(!B8())return new q(new $J);let V=K instanceof HTMLElement?K:FW().querySelector(K);if(!V)return new q(new h6(K));return new H(new KV(V,Z(X),W,J))};class Y5{#Z;#X;#J;#K;#W;#V;#Q=MZ();#G=new Set;constructor([Z,W],J,K,X){this.#Z=Z,this.#X=J,this.#J=K,this.#K=X,this.#W=this.#J(this.#Z),this.#V=U6(this.#W),this.#Y(W)}send(Z){switch(Z.constructor){case y6:{let{message:W}=Z,J=this.#U(W),K=HJ(this.#V,this.#W,J);this.#W=J,this.#V=K.events,this.broadcast(C6(K.patch));return}case b6:{let{callback:W}=Z;this.#G.add(W),W(f7(this.#K.open_shadow_root,this.#K.adopt_styles,pW(this.#K.attributes),pW(this.#K.properties),pW(this.#K.contexts),this.#Q,this.#W));return}case g6:{let{callback:W}=Z;this.#G.delete(W);return}case P8:{let{message:W}=Z,[J,K]=this.#X(this.#Z,W),X=this.#J(J),V=HJ(this.#V,this.#W,X);this.#Y(K),this.#Z=J,this.#W=X,this.#V=V.events,this.broadcast(C6(V.patch));return}case h8:{let{name:W,data:J}=Z;this.broadcast(y7(W,J));return}case g9:{let{key:W,value:J}=Z,K=r(this.#Q,W);if(K.isOk()&&OW(K[0],J))return;this.#Q=TZ(this.#Q,W,J),this.broadcast(b7(W,J));return}case v8:{this.#Z=null,this.#X=null,this.#J=null,this.#K=null,this.#W=null,this.#V=null,this.#Q=null,this.#G.clear();return}default:return}}broadcast(Z){for(let W of this.#G)W(Z)}#U(Z){switch(Z.constructor){case E9:{let{messages:W}=Z,J=this.#Z,K=lZ();for(let X=W;X.head;X=X.tail){let V=this.#U(X.head);if(V instanceof H){J=V[0][0],K=jW(hZ.fromArray([K,V[0][1]]));break}}return this.#Y(K),this.#Z=J,this.#J(this.#Z)}case x9:{let{name:W,value:J}=Z,K=this.#F(W,J);if(K instanceof q)return this.#W;else{let[X,V]=this.#X(this.#Z,K[0]);return this.#Y(V),this.#Z=X,this.#J(this.#Z)}}case k9:{let{name:W,value:J}=Z,K=this.#M(W,J);if(K instanceof q)return this.#W;else{let[X,V]=this.#X(this.#Z,K[0]);return this.#Y(V),this.#Z=X,this.#J(this.#Z)}}case f9:{let{path:W,name:J,event:K}=Z,[X,V]=q9(this.#V,W,J,K);if(this.#V=X,V instanceof q)return this.#W;else{let[Q,G]=this.#X(this.#Z,V[0].message);return this.#Y(G),this.#Z=Q,this.#J(this.#Z)}}case S6:{let{key:W,value:J}=Z,K=r(this.#K.contexts,W);if(K instanceof q)return this.#W;if(K=s(J,K[0]),K instanceof q)return this.#W;let[X,V]=this.#X(this.#Z,K[0]);return this.#Y(V),this.#Z=X,this.#J(this.#Z)}}}#F(Z,W){let J=r(this.#K.attributes,Z);switch(J.constructor){case H:return J[0](W);case q:return new q(void 0)}}#M(Z,W){let J=r(this.#K.properties,Z);switch(J.constructor){case H:return J[0](W);case q:return new q(void 0)}}#Y(Z){let W=(Q)=>this.send(new P8(Q)),J=(Q,G)=>this.send(new h8(Q,G)),K=()=>{return},X=()=>{return},V=(Q,G)=>this.send(new g9(Q,G));globalThis.queueMicrotask(()=>{tX(Z,W,J,K,X,V)})}}class VV extends z{constructor(Z,W,J,K){super();this.init=Z,this.update=W,this.view=J,this.config=K}}class h6 extends z{constructor(Z){super();this.selector=Z}}class $J extends z{}function QV(Z,W,J){return new VV(Z,W,J,WV(m))}function YV(Z,W,J){return VJ(!B8(),new q(new $J),()=>{return XV(Z,W,J)})}var M5={handle_external_links:!1,handle_internal_links:!0},UV=globalThis?.window?.location?.href,$6=()=>{if(!UV)return new q(void 0);else return new H(_6(new URL(UV)))},m6=(Z,W=M5)=>{document.addEventListener("click",(J)=>{let K=zV(J.target);if(!K)return;try{let X=new URL(K.href),V=_6(X),Q=X.host!==window.location.host||K.target==="_blank";if(!W.handle_external_links&&Q)return;if(!W.handle_internal_links&&!Q)return;if(J.preventDefault(),!Q)window.history.pushState({},"",K.href),window.requestAnimationFrame(()=>{if(X.hash)document.getElementById(X.hash.slice(1))?.scrollIntoView();else window.scrollTo(0,0)});return Z(V)}catch{return}}),window.addEventListener("popstate",(J)=>{J.preventDefault();let K=new URL(window.location.href),X=_6(K);window.requestAnimationFrame(()=>{if(K.hash)document.getElementById(K.hash.slice(1))?.scrollIntoView();else window.scrollTo(0,0)}),Z(X)}),window.addEventListener("modem-push",({detail:J})=>{Z(J)}),window.addEventListener("modem-replace",({detail:J})=>{Z(J)})},IV=(Z)=>{window.history.pushState({},"",D9(Z)),window.requestAnimationFrame(()=>{if(Z.fragment[0])document.getElementById(Z.fragment[0])?.scrollIntoView()}),window.dispatchEvent(new CustomEvent("modem-push",{detail:Z}))};var zV=(Z)=>{if(!Z||Z.tagName==="BODY")return null;else if(Z.tagName==="A")return Z;else return zV(Z.parentElement)},_6=(Z)=>{return new d(Z.protocol?new L(Z.protocol.slice(0,-1)):new g,new g,Z.hostname?new L(Z.hostname):new g,Z.port?new L(Number(Z.port)):new g,Z.pathname,Z.search?new L(Z.search.slice(1)):new g,Z.hash?new L(Z.hash.slice(1)):new g)};function NV(Z){return aW((W)=>{return VJ(!B8(),void 0,()=>{return m6((J)=>{let X=Z(J);return W(X)})})})}function HV(Z){if(Z==="")return new g;else return new L(Z)}var h9=new d(new g,new g,new g,new g,"",new g,new g);function v9(Z,W,J){return aW((K)=>{return VJ(!B8(),void 0,()=>{return IV(new d(h9.scheme,h9.userinfo,h9.host,h9.port,Z,G0(W,HV),G0(J,HV)))})})}class DV extends z{constructor(Z,W){super();this.query=Z,this.module_path=W}}class u6 extends z{constructor(Z){super();this.queries=Z}}function BV(){return new u6(MZ())}function vW(Z,W,J,K){let X=new DV(J,K);return new u6(TZ(Z.queries,W,X))}function c6(Z,W){return r(Z.queries,W)}class _9 extends z{}class $9 extends z{}class PV extends z{}class RV extends z{}class jV extends z{}class TV extends z{}class OV extends z{}class AV extends z{}class SV extends z{}class d6 extends z{}class m9 extends z{}function CV(Z){if(Z instanceof _9)return"GET";else if(Z instanceof $9)return"POST";else if(Z instanceof PV)return"HEAD";else if(Z instanceof RV)return"PUT";else if(Z instanceof jV)return"DELETE";else if(Z instanceof TV)return"TRACE";else if(Z instanceof OV)return"CONNECT";else if(Z instanceof AV)return"OPTIONS";else if(Z instanceof SV)return"PATCH";else return Z[0]}function qV(Z){if(Z instanceof d6)return"http";else return"https"}function wV(Z){let W=GW(Z);if(W==="http")return new H(new d6);else if(W==="https")return new H(new m9);else return new q(void 0)}class mJ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.method=Z,this.headers=W,this.body=J,this.scheme=K,this.host=X,this.port=V,this.path=Q,this.query=G}}function EV(Z){return new d(new L(qV(Z.scheme)),new g,new L(Z.host),Z.port,Z.path,Z.query,new g)}function N5(Z){return rZ((()=>{let W=Z.scheme,J=bK(W,"");return wV(J)})(),(W)=>{return rZ((()=>{let J=Z.host;return Y0(J,void 0)})(),(J)=>{let K=new mJ(new _9,Y([]),"",W,J,Z.port,Z.path,Z.query);return new H(K)})})}function s6(Z,W,J){let K=S0(Z.headers,GW(W),J);return new mJ(Z.method,K,Z.body,Z.scheme,Z.host,Z.port,Z.path,Z.query)}function xV(Z,W){return new mJ(Z.method,Z.headers,W,Z.scheme,Z.host,Z.port,Z.path,Z.query)}function kV(Z,W){return new mJ(W,Z.headers,Z.body,Z.scheme,Z.host,Z.port,Z.path,Z.query)}function fV(Z){let J=b0(Z);return rZ(J,N5)}class r6 extends z{constructor(Z,W,J){super();this.status=Z,this.headers=W,this.body=J}}class _8{constructor(Z){this.promise=Z}static wrap(Z){return Z instanceof Promise?new _8(Z):Z}static unwrap(Z){return Z instanceof _8?Z.promise:Z}}function _W(Z){return Promise.resolve(_8.wrap(Z))}function c9(Z,W){return Z.then((J)=>W(_8.unwrap(J)))}function p9(Z,W){return Z.then((J)=>_8.wrap(W(_8.unwrap(J))))}function l6(Z){return new r6(Z.status,hZ.fromArray([...Z.headers]),Z)}function R5(Z){let W=D9(EV(Z)),J=CV(Z.method).toUpperCase(),K={headers:j5(Z.headers),method:J};return[W,K]}function i6(Z){let[W,J]=R5(Z);if(J.method!=="GET"&&J.method!=="HEAD")J.body=Z.body;return new globalThis.Request(W,J)}function j5(Z){let W=new globalThis.Headers;for(let[J,K]of Z)W.append(J.toLowerCase(),K);return W}async function d9(Z){let W;try{W=await Z.body.text()}catch(J){return new q(new a6)}return new H(Z.withFields({body:W}))}class s9 extends z{constructor(Z){super();this[0]=Z}}class a6 extends z{}class bV extends z{constructor(Z,W){super();this.endpoint=Z,this.headers=W}}function o6(Z,W){return new bV(Z,W)}function zW(Z,W,J){let K=h(Y([["query",a(W)],["variables",J]]));return rZ((()=>{let X=fV(Z.endpoint);return ZJ(X,(V)=>{return"Invalid endpoint URL"})})(),(X)=>{let V,G=kV(X,new $9),F=xV(G,nW(K));V=s6(F,"content-type","application/json");let M=V,U=UZ(Z.headers,M,(I,N)=>{return s6(I,N[0],N[1])});return new H(U)})}function wZ(Z,W){return rZ((()=>{let J=xW(Z,NZ);return ZJ(J,(K)=>{return"Failed to decode JSON response"})})(),(J)=>{let K=$("data",W,(V)=>{return t(V)}),X=s(J,K);return ZJ(X,(V)=>{return"Failed to decode response data: "+NX(V)+". Response body: "+Z})})}async function t6(Z){try{let W=i6(Z),J=new Request(W,{credentials:"include"}),K=await fetch(J),X=l6(K);return new H(X)}catch(W){return new q(new s9(W.toString()))}}var $V="src/squall_cache.gleam";class AW extends z{}class SW extends z{constructor(Z){super();this[0]=Z}}class CW extends z{constructor(Z){super();this[0]=Z}}class r9 extends z{}class mV extends z{}class e6 extends z{}class cJ extends z{constructor(Z,W,J){super();this.data=Z,this.timestamp=W,this.status=J}}class oZ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.entities=Z,this.optimistic_entities=W,this.optimistic_mutations=J,this.queries=K,this.pending_fetches=X,this.get_headers=V,this.mutation_counter=Q,this.endpoint=G}}function uV(Z){return new oZ(MZ(),MZ(),MZ(),MZ(),wJ(),()=>{return Y([])},0,Z)}function n9(Z,W){return Z+":"+nW(W)}function gV(Z){let W=Y9(Z);if(W instanceof H){let J=W[0][0],K=W[0][1];return G9(J)+K}else return Z}function ZK(Z){let J=i(Z),K=O0(J,(X)=>{if(X==="data")return new q(void 0);else if(X==="results")return new q(void 0);else if(X==="edges")return new q(void 0);else if(X==="node")return new q(void 0);else if(F9(X,"s")){let Q=Q9(X),G=HX(X,0,Q-1);return new H(gV(G))}else return new H(gV(X))});return WJ(K,"Entity")}function A5(Z){if(r(Z,"node")instanceof H)return!0;else return!1}function S5(Z){let W=s(Z,PW(NZ));if(W instanceof H){let J=W[0];if(J instanceof A)return!1;else{let K=J.head,X=s(K,rW(c,NZ));if(X instanceof H){let V=X[0];return A5(V)}else return!1}}else return!1}function C5(Z,W,J){let K=n9(W,J),X=r(Z.queries,K);if(X instanceof H){let V=X[0],Q=new cJ(V.data,V.timestamp,new e6),G=TZ(Z.queries,K,Q);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,G,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else{let V=new cJ("",0,new e6),Q=TZ(Z.queries,K,V);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,Q,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}}function R8(Z,W,J){let K=n9(W,J),X=dW(Z.queries,K);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,X,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}function q5(Z,W,J,K){let X,V=r(Z.optimistic_entities,J);if(V instanceof H){let F=V[0];X=new L(F)}else{let F=r(Z.entities,J);if(F instanceof H){let M=F[0];X=new L(M)}else X=new g}let G=K(X);return new oZ(Z.entities,TZ(Z.optimistic_entities,J,G),TZ(Z.optimistic_mutations,W,J),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}function cV(Z,W){let J=r(Z.optimistic_mutations,W);if(J instanceof H){let K=J[0];return new oZ(Z.entities,dW(Z.optimistic_entities,K),dW(Z.optimistic_mutations,W),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else return Z}function pV(Z){return!T0(Z.optimistic_mutations)}function DJ(Z){let W=s(Z,rW(c,NZ));if(W instanceof H){let K=W[0],X=U8(K),V=HZ(X,(Q)=>{let G,F;return G=Q[0],F=Q[1],[G,DJ(F)]});return h(V)}else{let J=s(Z,PW(NZ));if(J instanceof H){let K=J[0];return kW(K,DJ)}else{let K=s(Z,c);if(K instanceof H){let X=K[0];return a(X)}else{let X=s(Z,mZ);if(X instanceof H){let V=X[0];return WW(V)}else{let V=s(Z,tK);if(V instanceof H){let Q=V[0];return wX(Q)}else{let Q=s(Z,BW);if(Q instanceof H){let G=Q[0];return lW(G)}else return H9()}}}}}}function w5(Z,W){let J=nW(Z),K=nW(W),X=xW(J,NZ),V=xW(K,NZ);if(X instanceof H&&V instanceof H){let Q=X[0],G=V[0],F=s(Q,rW(c,NZ)),M=s(G,rW(c,NZ));if(F instanceof H&&M instanceof H){let U=F[0],I=M[0],N,T=SZ(pW(U),pW(I));N=sK(T);let C=i8(N,(j)=>{let x,O=r(I,j);if(O instanceof H)x=O;else x=r(U,j);let k=x;if(k instanceof H){let b=k[0];return new H([j,DJ(b)])}else return new q(void 0)});return h(C)}else return W}else return W}function Q8(Z,W){return n8(W,Z,(J,K,X)=>{let V=r(J,K);if(V instanceof H){let Q=V[0],G=w5(Q,X);return TZ(J,K,G)}else return TZ(J,K,X)})}function hV(Z){let W=M9(Z,":");if(W instanceof H){let J=W[0][0],K=W[0][1],X=xW(K,NZ);if(X instanceof H){let V=X[0];return new H([J,DJ(V)])}else return new H([J,H9()])}else return new q(void 0)}function L5(Z,W,J,K,X,V,Q){let G=c6(W,J);if(G instanceof H){let F=G[0];return aW((M)=>{let U=Z.get_headers(),I=o6(Z.endpoint,U),N=zW(I,F.query,K),T;if(N instanceof H)T=N[0];else throw F8("let_assert",$V,"squall_cache",767,"create_mutation_effect","Pattern match failed, no pattern matched the value.",{value:N,start:24617,end:24701,pattern_start:24628,pattern_end:24635});let R,C=t6(T);R=p9(C,(x)=>{if(x instanceof H){let O=x[0],k=d9(O);return c9(k,(b)=>{if(b instanceof H){let P=b[0],S=V(P.body);if(S instanceof H){let y=S[0];return M(Q(X,new H(y),P.body)),_W(void 0)}else{let y=S[0];return M(Q(X,new q("Parse error: "+y),P.body)),_W(void 0)}}else return M(Q(X,new q("Failed to read response"),"")),_W(void 0)})}else return M(Q(X,new q("Failed to fetch"),"")),_W(void 0)});let j=R;return})}else return aW((F)=>{F(Q(X,new q("Query not found in registry"),""));return})}function dV(Z,W,J,K,X,V,Q,G){let F="mutation-"+qZ(Z.mutation_counter),M=q5(Z,F,X,V),U=new oZ(M.entities,M.optimistic_entities,M.optimistic_mutations,M.queries,M.pending_fetches,M.get_headers,Z.mutation_counter+1,M.endpoint),I=L5(U,W,J,K,F,Q,G);return[U,F,I]}function E5(Z,W,J,K,X){return aW((V)=>{let Q=Z.get_headers(),G=o6(Z.endpoint,Q),F=zW(G,W,K),M;if(F instanceof H)M=F[0];else throw F8("let_assert",$V,"squall_cache",1073,"create_fetch_effect","Pattern match failed, no pattern matched the value.",{value:F,start:34411,end:34480,pattern_start:34422,pattern_end:34429});let U,I=t6(M);U=p9(I,(T)=>{if(T instanceof H){let R=T[0],C=d9(R);return c9(C,(j)=>{if(j instanceof H){let x=j[0];return V(X(J,K,new H(x.body))),_W(void 0)}else return V(X(J,K,new q("Failed to read response"))),_W(void 0)})}else return V(X(J,K,new q("Failed to fetch"))),_W(void 0)});let N=U;return})}function qW(Z,W,J,K){let X=gX(Z.pending_fetches),V=i8(X,(F)=>{let M=hV(F);if(M instanceof H){let U=M[0][0],I=M[0][1],N=c6(W,U);if(N instanceof H){let T=N[0];return new H(E5(Z,T.query,U,I,J))}else return new q(void 0)}else return new q(void 0)}),Q=UZ(X,Z,(F,M)=>{let U=hV(M);if(U instanceof H){let I=U[0][0],N=U[0][1];return C5(F,I,N)}else return F});return[new oZ(Q.entities,Q.optimistic_entities,Q.optimistic_mutations,Q.queries,wJ(),Q.get_headers,Q.mutation_counter,Q.endpoint),V]}function vV(Z,W,J){let K=U8(Z),X=HZ(K,(V)=>{let Q,G;return Q=V[0],G=V[1],[Q,WK(G,W,J)]});return h(X)}function WK(Z,W,J){let K=s(Z,rW(c,NZ));if(K instanceof H){let X=K[0],V=r(X,"__ref");if(V instanceof H){let Q=V[0],G=s(Q,c);if(G instanceof H){let F=G[0],M=r(W,F);if(M instanceof H)return M[0];else{let U=r(J,F);if(U instanceof H)return U[0];else return h(Y([["__ref",a(F)]]))}}else return vV(X,W,J)}else return vV(X,W,J)}else{let X=s(Z,PW(NZ));if(X instanceof H){let V=X[0];return kW(V,(Q)=>{return WK(Q,W,J)})}else return DJ(Z)}}function _V(Z,W,J){let K=xW(Z,NZ);if(K instanceof H){let X=K[0],V=WK(X,W,J);return nW(V)}else return Z}function e(Z,W,J,K){let X=n9(W,J),V=r(Z.queries,X);if(V instanceof H){let Q=V[0],G=Q.status;if(G instanceof r9){let F=_V(Q.data,Z.optimistic_entities,Z.entities),M=K(F);if(M instanceof H){let U=M[0];return[Z,new CW(U)]}else{let U=M[0];return[Z,new SW("Parse error: "+U)]}}else if(G instanceof mV){let F=_V(Q.data,Z.optimistic_entities,Z.entities),M=K(F);if(M instanceof H){let U=M[0];return[Z,new CW(U)]}else{let U=M[0];return[Z,new SW("Parse error: "+U)]}}else return[Z,new AW]}else return[new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,Z.queries,_0(Z.pending_fetches,X),Z.get_headers,Z.mutation_counter,Z.endpoint),new AW]}function x5(Z,W){let J=UZ(Z,[MZ(),Y([]),wJ()],(V,Q)=>{let G,F,M;G=V[0],F=V[1],M=V[2];let U=s(Q,rW(c,NZ));if(U instanceof H){let I=U[0],N=r(I,"node");if(N instanceof H){let T=N[0],R,C=s(T,rW(c,NZ));if(C instanceof H){let x=C[0],O=r(x,"id");if(O instanceof H){let k=O[0],b=s(k,c);if(b instanceof H){let P=b[0],S,y=r(x,"__typename");if(y instanceof H){let _=y[0],u=s(_,c);if(u instanceof H)S=u[0];else S="Node"}else S=ZK(SZ(W,Y(["node"])));R=new L(S+":"+P)}else R=new g}else R=new g}else R=new g;let j=R;if(j instanceof L){let x=j[0];if(bX(M,x))return V;else{let k=uJ(I,W),b,P;return b=k[0],P=k[1],[Q8(G,b),SZ(F,Y([P])),_0(M,x)]}}else{let x=uJ(I,W),O,k;return O=x[0],k=x[1],[Q8(G,O),SZ(F,Y([k])),M]}}else{let T=uJ(I,W),R,C;return R=T[0],C=T[1],[Q8(G,R),SZ(F,Y([C])),M]}}else{let I=pJ(Q,W),N,T;return N=I[0],T=I[1],[Q8(G,N),SZ(F,Y([T])),M]}}),K,X;return K=J[0],X=J[1],[K,kW(X,(V)=>{return V})]}function pJ(Z,W){let J=s(Z,rW(c,NZ));if(J instanceof H){let K=J[0],X=r(K,"id");if(X instanceof H){let V=X[0],Q=s(V,c);if(Q instanceof H){let G=Q[0],F,M=r(K,"__typename");if(M instanceof H){let b=M[0],P=s(b,c);if(P instanceof H)F=P[0];else F=ZK(W)}else F=ZK(W);let I=F+":"+G,N,T=U8(K);N=HZ(T,(b)=>{let P,S;P=b[0],S=b[1];let y=SZ(W,Y([P])),v=pJ(S,y),_,u;return _=v[0],u=v[1],[P,_,u]});let R=N,C=UZ(R,MZ(),(b,P)=>{let S;return S=P[1],Q8(b,S)}),j,x=HZ(R,(b)=>{let P,S;return P=b[0],S=b[2],[P,S]});return j=h(x),[TZ(C,I,j),h(Y([["__ref",a(I)]]))]}else return uJ(K,W)}else return uJ(K,W)}else{let K=s(Z,PW(NZ));if(K instanceof H){let X=K[0];if(S5(Z))return x5(X,W);else{let Q=HZ(X,(M)=>{return pJ(M,W)}),G=UZ(Q,MZ(),(M,U)=>{let I;return I=U[0],Q8(M,I)}),F=HZ(Q,(M)=>{let U;return U=M[1],U});return[G,kW(F,(M)=>{return M})]}}else return[MZ(),DJ(Z)]}}function sV(Z){return pJ(Z,Y([]))}function rV(Z,W,J,K,X){let V=n9(W,J),Q=xW(K,NZ);if(Q instanceof H){let G=Q[0],F=sV(G),M,U;M=F[0],U=F[1];let I=Q8(Z.entities,M),N=nW(U),T=new cJ(N,X,new r9),R=TZ(Z.queries,V,T);return new oZ(I,Z.optimistic_entities,Z.optimistic_mutations,R,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else{let G=new cJ(K,X,new r9),F=TZ(Z.queries,V,G);return new oZ(Z.entities,Z.optimistic_entities,Z.optimistic_mutations,F,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}}function uJ(Z,W){let J,K=U8(Z);J=HZ(K,(M)=>{let U,I;U=M[0],I=M[1];let N=SZ(W,Y([U])),T=pJ(I,N),R,C;return R=T[0],C=T[1],[U,R,C]});let X=J,V=UZ(X,MZ(),(M,U)=>{let I;return I=U[1],Q8(M,I)}),Q,G=HZ(X,(M)=>{let U,I;return U=M[0],I=M[2],[U,I]});return Q=h(G),[V,Q]}function nV(Z,W,J){let K=r(Z.optimistic_mutations,W);if(K instanceof H){let X=K[0],V=xW(J,NZ);if(V instanceof H){let Q=V[0],G=sV(Q),F;F=G[0];let M=Q8(Z.entities,F);return new oZ(M,dW(Z.optimistic_entities,X),dW(Z.optimistic_mutations,W),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else return new oZ(Z.entities,dW(Z.optimistic_entities,X),dW(Z.optimistic_mutations,W),Z.queries,Z.pending_fetches,Z.get_headers,Z.mutation_counter,Z.endpoint)}else return Z}var $8="http://www.w3.org/2000/svg";function l9(Z){return K8($8,"ellipse",Z,m)}function dJ(Z){return K8($8,"rect",Z,m)}function lV(Z,W){return K8($8,"defs",Z,W)}function sJ(Z,W){return K8($8,"g",Z,W)}function i9(Z,W){return K8($8,"svg",Z,W)}function JK(Z,W){return K8($8,"linearGradient",Z,W)}function rJ(Z){return K8($8,"stop",Z,m)}function aV(Z){return i9(Y([w("viewBox","0 0 60 60"),w("xmlns","http://www.w3.org/2000/svg"),D(Z)]),Y([lV(Y([]),Y([JK(Y([xJ("board1"),w("x1","0%"),w("y1","0%"),w("x2","100%"),w("y2","100%")]),Y([rJ(Y([w("offset","0%"),w("stop-color","#FF6347"),w("stop-opacity","1")])),rJ(Y([w("offset","100%"),w("stop-color","#FF4500"),w("stop-opacity","1")]))])),JK(Y([xJ("board2"),w("x1","0%"),w("y1","0%"),w("x2","100%"),w("y2","100%")]),Y([rJ(Y([w("offset","0%"),w("stop-color","#00CED1"),w("stop-opacity","1")])),rJ(Y([w("offset","100%"),w("stop-color","#4682B4"),w("stop-opacity","1")]))]))])),sJ(Y([w("transform","translate(30, 30)")]),Y([l9(Y([w("cx","0"),w("cy","-8"),w("rx","15"),w("ry","6"),w("fill","url(#board1)")])),l9(Y([w("cx","0"),w("cy","0"),w("rx","18"),w("ry","6"),w("fill","url(#board2)")])),l9(Y([w("cx","0"),w("cy","8"),w("rx","12"),w("ry","6"),w("fill","#32CD32")]))]))]))}function oV(Z){return f(Y([D("border-b border-zinc-800 pb-4 mb-8")]),Y([f(Y([D("flex items-end justify-between")]),Y([y8(Y([L8("/"),D("flex items-center gap-3 hover:opacity-80 transition-opacity")]),Y([aV("w-10 h-10"),f(Y([]),Y([f8(Y([D("text-xs font-medium uppercase tracking-wider text-zinc-500")]),Y([E("quickslice")]))]))])),f(Y([D("flex gap-4 text-xs items-center")]),(()=>{if(Z instanceof L){let W=Z[0][0],J=Z[0][1],K=Y([y8(Y([L8("/"),D("px-3 py-1 text-zinc-400 hover:text-zinc-300 transition-colors")]),Y([E("Home")]))]),X;if(J)X=SZ(K,Y([y8(Y([L8("/settings"),D("px-3 py-1 text-zinc-400 hover:text-zinc-300 transition-colors")]),Y([E("Settings")]))]));else X=K;return SZ(X,Y([IZ(Y([D("px-3 py-1 text-zinc-400")]),Y([E(W)])),z6(Y([i0("POST"),l0("/logout")]),Y([sZ(Y([bW("submit"),D("px-3 py-1 text-zinc-400 hover:text-zinc-300 transition-colors cursor-pointer")]),Y([E("Logout")]))]))]))}else return Y([z6(Y([i0("POST"),l0("/oauth/authorize"),D("flex gap-2 items-center")]),Y([zJ(Y([bW("text"),iX("login_hint"),fJ("handle.bsky.social"),D("bg-zinc-900 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-300 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none w-48"),aX(!0)])),sZ(Y([bW("submit"),D("bg-zinc-800 hover:bg-zinc-700 text-zinc-300 px-3 py-1 rounded transition-colors")]),Y([E("Login")]))]))])})())]))]))}function KK(Z,W){console.log("[readFileAsBase64] Called with fileInputId:",Z);let J=document.getElementById(Z);if(!J){console.log("[readFileAsBase64] File input not found"),W(new q("File input not found"));return}console.log("[readFileAsBase64] Input element:",J),console.log("[readFileAsBase64] Input files:",J.files);let K=J.files?.[0];if(!K){console.log("[readFileAsBase64] No file selected"),W(new q("No file selected"));return}console.log("[readFileAsBase64] Reading file:",K.name);let X=new FileReader;X.onload=(V)=>{try{let Q=V.target.result.split(",")[1];W(new H(Q))}catch(Q){W(new q(`Failed to encode file: ${Q.message}`))}},X.onerror=()=>{W(new q("Failed to read file"))},X.readAsDataURL(K)}function XK(Z){let W=document.getElementById(Z);if(W)W.value=""}function tV(){let Z=BV(),W=vW(Z,"TriggerBackfill",`mutation TriggerBackfill { 6 6 triggerBackfill 7 7 }`,"generated/queries/trigger_backfill"),J=vW(W,"GetCurrentSession",`query GetCurrentSession { 8 8 currentSession { ··· 57 57 uploadLexicons(zipBase64: $zipBase64) 58 58 }`,"generated/queries/upload_lexicons");return vW(F,"ResetAll",`mutation ResetAll($confirm: String!) { 59 59 resetAll(confirm: $confirm) 60 - }`,"generated/queries/reset_all")}class nJ extends z{}class lJ extends z{}class iJ extends z{}class m8 extends z{}class aJ extends z{}class eV extends z{constructor(Z,W,J,K,X){super();this.timestamp=Z,this.total=W,this.creates=J,this.updates=K,this.deletes=X}}class ZQ extends z{constructor(Z){super();this.activity_buckets=Z}}function PJ(Z){if(Z instanceof nJ)return"ONE_HOUR";else if(Z instanceof lJ)return"THREE_HOURS";else if(Z instanceof iJ)return"SIX_HOURS";else if(Z instanceof m8)return"ONE_DAY";else return"SEVEN_DAYS"}function b5(){return $("timestamp",c,(Z)=>{return $("total",$Z,(W)=>{return $("creates",$Z,(J)=>{return $("updates",$Z,(K)=>{return $("deletes",$Z,(X)=>{return t(new eV(Z,W,J,K,X))})})})})})}function g5(){return $("activityBuckets",PW(b5()),(Z)=>{return t(new ZQ(Z))})}function RJ(Z){return wZ(Z,g5())}class WQ extends z{constructor(Z,W,J){super();this.did=Z,this.handle=W,this.is_admin=J}}class JQ extends z{constructor(Z){super();this.current_session=Z}}function h5(){return $("did",c,(Z)=>{return $("handle",c,(W)=>{return $("isAdmin",BW,(J)=>{return t(new WQ(Z,W,J))})})})}function v5(){return $("currentSession",sW(h5()),(Z)=>{return t(new JQ(Z))})}function QK(Z){return wZ(Z,v5())}class KQ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.id=Z,this.timestamp=W,this.operation=J,this.collection=K,this.did=X,this.status=V,this.error_message=Q,this.event_json=G}}class XQ extends z{constructor(Z){super();this.recent_activity=Z}}function $5(){return $("id",$Z,(Z)=>{return $("timestamp",c,(W)=>{return $("operation",c,(J)=>{return $("collection",c,(K)=>{return $("did",c,(X)=>{return $("status",c,(V)=>{return $("errorMessage",sW(c),(Q)=>{return $("eventJson",sW(c),(G)=>{return t(new KQ(Z,W,J,K,X,V,Q,G))})})})})})})})})}function m5(){return $("recentActivity",PW($5()),(Z)=>{return t(new XQ(Z))})}function oJ(Z){return wZ(Z,m5())}class QQ extends z{constructor(Z,W,J){super();this.id=Z,this.domain_authority=W,this.oauth_client_id=J}}class YQ extends z{constructor(Z){super();this.settings=Z}}function u5(){return $("id",c,(Z)=>{return $("domainAuthority",c,(W)=>{return $("oauthClientId",sW(c),(J)=>{return t(new QQ(Z,W,J))})})})}function c5(){return $("settings",u5(),(Z)=>{return t(new YQ(Z))})}function KW(Z){return wZ(Z,c5())}class GQ extends z{constructor(Z,W,J){super();this.record_count=Z,this.actor_count=W,this.lexicon_count=J}}class FQ extends z{constructor(Z){super();this.statistics=Z}}function p5(){return $("recordCount",$Z,(Z)=>{return $("actorCount",$Z,(W)=>{return $("lexiconCount",$Z,(J)=>{return t(new GQ(Z,W,J))})})})}function d5(){return $("statistics",p5(),(Z)=>{return t(new FQ(Z))})}function u8(Z){return wZ(Z,d5())}class MQ extends z{constructor(Z){super();this.reset_all=Z}}function s5(){return $("resetAll",BW,(Z)=>{return t(new MQ(Z))})}function UQ(Z){return wZ(Z,s5())}class IQ extends z{constructor(Z){super();this.trigger_backfill=Z}}function n5(){return $("triggerBackfill",BW,(Z)=>{return t(new IQ(Z))})}function zQ(Z){return wZ(Z,n5())}class HQ extends z{constructor(Z,W,J){super();this.id=Z,this.domain_authority=W,this.oauth_client_id=J}}class NQ extends z{constructor(Z){super();this.update_domain_authority=Z}}function i5(){return $("id",c,(Z)=>{return $("domainAuthority",c,(W)=>{return $("oauthClientId",sW(c),(J)=>{return t(new HQ(Z,W,J))})})})}function a5(){return $("updateDomainAuthority",i5(),(Z)=>{return t(new NQ(Z))})}function DQ(Z){return wZ(Z,a5())}class BQ extends z{constructor(Z){super();this.upload_lexicons=Z}}function t5(){return $("uploadLexicons",BW,(Z)=>{return t(new BQ(Z))})}function PQ(Z){return wZ(Z,t5())}function FK(Z){globalThis.location.href=Z}function RQ(Z,W){return sX(Z,CJ(W,(J)=>{return new EJ(!1,!1,J)}),m,r0,r0,0,0)}function HW(Z){return RQ("click",t(Z))}function a9(Z){return RQ("input",w0(Y(["target","value"]),c,(W)=>{return t(Z(W))}))}function W4(Z,W){let J=(K)=>{let X="px-3 py-1 text-xs rounded transition-colors cursor-pointer";if(GZ(K,Z))return X+" bg-zinc-700 text-zinc-100";else return X+" bg-zinc-800/50 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-300"};return f(Y([N("flex gap-2 mb-4")]),Y([dZ(Y([N(J(new nJ)),HW(W(new nJ))]),Y([x("1hr")])),dZ(Y([N(J(new lJ)),HW(W(new lJ))]),Y([x("3hr")])),dZ(Y([N(J(new iJ)),HW(W(new iJ))]),Y([x("6hr")])),dZ(Y([N(J(new m8)),HW(W(new m8))]),Y([x("1 day")])),dZ(Y([N(J(new aJ)),HW(W(new aJ))]),Y([x("7 day")]))]))}function J4(Z){let J=HZ(Z,(X)=>{return X.creates+X.updates+X.deletes}),K=nK(J,U9);return WJ(K,1)}function K4(Z,W,J,K,X,V){let Q=n(W)*(J+K);if(Z.creates+Z.updates+Z.deletes===0){let F=4,M=X-F;return sJ(Y([]),Y([dJ(Y([w("x",BZ(Q)),w("y",BZ(M)),w("width",BZ(J)),w("height",BZ(F)),w("style","fill: #3f3f46 !important; stroke: none; display: inline")]))]))}else{let F=W9(X,n(V)),M=n(Z.deletes)*F,U=n(Z.updates)*F,I=n(Z.creates)*F,D=X-M,T=D-U,R=T-I;return sJ(Y([N("group")]),Y([(()=>{if(Z.deletes>0)return dJ(Y([w("x",BZ(Q)),w("y",BZ(D)),w("width",BZ(J)),w("height",BZ(M)),w("style","fill: #ef4444 !important; stroke: none; display: inline; cursor: pointer; transition: opacity 0.2s"),N("group-hover:opacity-80")]));else return cZ()})(),(()=>{if(Z.updates>0)return dJ(Y([w("x",BZ(Q)),w("y",BZ(T)),w("width",BZ(J)),w("height",BZ(U)),w("style","fill: #60a5fa !important; stroke: none; display: inline; cursor: pointer; transition: opacity 0.2s"),N("group-hover:opacity-80")]));else return cZ()})(),(()=>{if(Z.creates>0)return dJ(Y([w("x",BZ(Q)),w("y",BZ(R)),w("width",BZ(J)),w("height",BZ(I)),w("style","fill: #22c55e !important; stroke: none; display: inline; cursor: pointer; transition: opacity 0.2s"),N("group-hover:opacity-80")]));else return cZ()})()]))}}function X4(Z,W){let J=J4(Z),K;if(W instanceof aJ)K=[160,12];else K=[30,4];let X=K,V,Q;V=X[0],Q=X[1];let G=SJ(Z),F=n(G)*V+n(G-1)*Q,M=120;return f(Y([N("w-full")]),Y([i9(Y([w("viewBox","0 0 "+BZ(F)+" "+BZ(M)),w("width","100%"),w("height",BZ(M)),w("style","min-height: 120px"),w("preserveAspectRatio","none")]),pK(Z,(U,I)=>{return K4(U,I,V,Q,M,J)}))]))}function V4(Z,W){let J=h(Y([["range",a(PJ(W))]])),K=e(Z,"GetActivityBuckets",J,RJ),X;if(X=K[1],X instanceof AW)return f(Y([N("py-8 text-center text-zinc-600 text-xs")]),Y([x("Loading activity data...")]));else if(X instanceof SW){let V=X[0];return f(Y([N("py-8 text-center text-red-400 text-xs")]),Y([x("Error: "+V)]))}else{let Q=X[0].activity_buckets;if(Q instanceof O)return f(Y([N("py-8 text-center text-zinc-600 text-xs")]),Y([x("No activity data available")]));else return X4(Q,W)}}function jQ(Z,W,J){return f(Y([N("bg-zinc-800/50 rounded p-4 font-mono mb-8")]),Y([W4(W,J),V4(Z,W)]))}function UK(Z){try{return new Date(Z).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch(W){return Z}}function IK(Z){try{return new Date(Z).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch(W){return Z}}function o9(Z){if(typeof Z==="string")try{let W=JSON.parse(Z);return o9(W)}catch(W){return Z}else if(Array.isArray(Z))return Z.map(o9);else if(Z!==null&&typeof Z==="object"){let W={};for(let[J,K]of Object.entries(Z))W[J]=o9(K);return W}return Z}function zK(Z){try{let W=JSON.parse(Z),J=o9(W);return JSON.stringify(J,null,2)}catch(W){return Z}}function F4(Z){return f(Y([]),HZ(Z,(W)=>{let J,K=W.status;if(K==="success")J="text-green-500";else if(K==="validation_error")J="text-yellow-500";else if(K==="error")J="text-red-500";else if(K==="processing")J="text-blue-500";else J="text-zinc-500";let X=J,V,Q=W.status;if(Q==="success")V="✓";else if(Q==="validation_error")V="⚠";else if(Q==="error")V="✗";else if(Q==="processing")V="⋯";else V="•";let G=V,F,M=W.operation;if(M==="create")F="text-green-400";else if(M==="update")F="text-blue-400";else if(M==="delete")F="text-red-400";else F="text-zinc-400";let U=F,I="activity-"+qZ(W.id);return f(Y([N("border-l-2 border-zinc-700/50 hover:border-zinc-600 transition-colors"),w("data-entry-id",I)]),Y([f(Y([N("flex items-start gap-2 py-1 text-xs font-mono hover:bg-zinc-900/30 cursor-pointer group"),w("onclick","this.parentElement.classList.toggle('expanded')")]),Y([IZ(Y([N("text-zinc-600 group-hover:text-zinc-400 shrink-0 select-none transition-transform caret"),w("data-caret","")]),Y([x("›")])),IZ(Y([N("text-zinc-600 shrink-0 w-16"),w("data-timestamp",W.timestamp)]),Y([x(UK(W.timestamp))])),IZ(Y([N(X+" shrink-0 w-4")]),Y([x(G)])),IZ(Y([N(U+" shrink-0 w-12")]),Y([x(W.operation)])),IZ(Y([N("text-purple-400 shrink-0")]),Y([x(W.collection)])),IZ(Y([N("text-zinc-500 truncate")]),Y([x(W.did)]))])),f(Y([N("px-6 py-2 text-xs bg-zinc-900/50 border-t border-zinc-800 hidden space-y-1"),w("data-details","")]),Y([f(Y([N("flex gap-2")]),Y([IZ(Y([N("text-zinc-600 w-20")]),Y([x("Timestamp:")])),IZ(Y([N("text-zinc-400")]),Y([x(IK(W.timestamp))]))])),f(Y([N("flex gap-2")]),Y([IZ(Y([N("text-zinc-600 w-20")]),Y([x("DID:")])),IZ(Y([N("text-zinc-400 font-mono break-all")]),Y([x(W.did)]))])),f(Y([N("flex gap-2")]),Y([IZ(Y([N("text-zinc-600 w-20")]),Y([x("Status:")])),IZ(Y([N((()=>{let D=W.status;if(D==="success")return"text-green-400";else if(D==="validation_error")return"text-yellow-400";else if(D==="error")return"text-red-400";else return"text-zinc-400"})())]),Y([x(W.status)]))])),(()=>{let D=W.error_message;if(D instanceof L){let T=D[0];return f(Y([N("flex gap-2")]),Y([IZ(Y([N("text-zinc-600 w-20")]),Y([x("Error:")])),IZ(Y([N("text-red-400")]),Y([x(T)]))]))}else return cZ()})(),(()=>{let D=W.event_json;if(D instanceof L){let T=D[0],R=zK(T);return f(Y([N("mt-2")]),Y([f(Y([N("text-zinc-600 mb-1")]),Y([x("Event JSON:")])),H7(Y([N("text-zinc-400 bg-black/40 p-2 rounded text-[10px] whitespace-pre-wrap block"),w("data-json",T)]),Y([x(R)]))]))}else return cZ()})()]))]))}))}function TQ(Z,W){let J=h(Y([["hours",WW(W)]])),K=e(Z,"GetRecentActivity",J,oJ),X;return X=K[1],f(Y([N("font-mono mb-8")]),Y([fZ("style",Y([]),Y([x(`[data-entry-id].expanded [data-caret] { transform: rotate(90deg); } 61 - [data-entry-id].expanded [data-details] { display: block !important; }`)])),f(Y([N("bg-zinc-800/50 rounded p-4")]),Y([f(Y([N("flex items-center justify-between mb-3")]),Y([f(Y([N("text-sm text-zinc-500")]),Y([x("JetStream Activity")])),(()=>{if(X instanceof CW){let V=X[0];return IZ(Y([N("text-xs text-zinc-600")]),Y([x(qZ(SJ(V.recent_activity))+" events ("+qZ(W)+"h)")]))}else return IZ(Y([N("text-xs text-zinc-600")]),Y([x("("+qZ(W)+"h)")]))})()])),f(Y([N("max-h-80 overflow-y-auto")]),Y([(()=>{if(X instanceof AW)return f(Y([N("py-8 text-center text-zinc-600 text-xs")]),Y([x("Loading activity...")]));else if(X instanceof SW){let V=X[0];return f(Y([N("py-8 text-center text-red-400 text-xs")]),Y([x("Error: "+V)]))}else{let Q=X[0].recent_activity;if(Q instanceof O)return f(Y([N("py-8 text-center text-zinc-600 text-xs")]),Y([x("No activity in the last "+qZ(W)+" hours")]));else return F4(Q)}})()]))]))]))}class tJ extends z{}class eJ extends z{}class c8 extends z{}class HK extends z{}function OQ(Z,W){let J;if(Z instanceof tJ)J=["bg-green-900/30","border-green-800","text-green-300","✓"];else if(Z instanceof eJ)J=["bg-red-900/30","border-red-800","text-red-300","✗"];else if(Z instanceof c8)J=["bg-blue-900/30","border-blue-800","text-blue-300","ℹ"];else J=["bg-yellow-900/30","border-yellow-800","text-yellow-300","⚠"];let K=J,X,V,Q,G;return X=K[0],V=K[1],Q=K[2],G=K[3],f(Y([N("mb-6 p-4 rounded border "+X+" "+V)]),Y([f(Y([N("flex items-center gap-3")]),Y([IZ(Y([N("text-lg "+Q)]),Y([x(G)])),IZ(Y([N("text-sm "+Q)]),Y([x(W)]))]))]))}function NK(Z,W,J,K){let X;if(Z instanceof tJ)X=["bg-green-900/30","border-green-800","text-green-300","✓"];else if(Z instanceof eJ)X=["bg-red-900/30","border-red-800","text-red-300","✗"];else if(Z instanceof c8)X=["bg-blue-900/30","border-blue-800","text-blue-300","ℹ"];else X=["bg-yellow-900/30","border-yellow-800","text-yellow-300","⚠"];let V=X,Q,G,F,M;return Q=V[0],G=V[1],F=V[2],M=V[3],f(Y([N("mb-6 p-4 rounded border "+Q+" "+G)]),Y([f(Y([N("flex items-center gap-3")]),Y([IZ(Y([N("text-lg "+F)]),Y([x(M)])),IZ(Y([N("text-sm "+F)]),Y([x(W+" "),y8(Y([L8(K),N("underline hover:no-underline")]),Y([x(J)]))]))]))]))}var U4="font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-800 hover:bg-zinc-700 rounded transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-zinc-800";function t9(Z,W,J){return dZ(Y([bW("button"),N(U4),kJ(Z),HW(W)]),Y([gW(J)]))}function Z9(Z){return new Intl.NumberFormat("en-US").format(Z)}function DK(Z,W){return f(Y([N("bg-zinc-800/50 rounded p-4")]),Y([f(Y([N("text-sm text-zinc-500 mb-1")]),Y([gW(Z)])),f(Y([N("text-2xl font-semibold text-zinc-200")]),Y([gW(W)]))]))}function BK(Z){return f(Y([N("bg-zinc-800/50 rounded p-4 animate-pulse")]),Y([f(Y([N("text-sm text-zinc-500 mb-1")]),Y([gW(Z)])),f(Y([N("h-8 bg-zinc-700 rounded w-24")]),Y([]))]))}function SQ(Z){let W=e(Z,"GetStatistics",h(Y([])),u8),J;if(J=W[1],J instanceof AW)return f(Y([N("mb-8 grid grid-cols-3 gap-4")]),Y([BK("Total Records"),BK("Total Actors"),BK("Total Lexicons")]));else if(J instanceof SW){let K=J[0];return f(Y([N("mb-8")]),Y([f(Y([N("bg-red-800/50 rounded p-4 text-red-200")]),Y([gW("Error loading statistics: "+K)]))]))}else{let X=J[0].statistics;return f(Y([N("mb-8 grid grid-cols-3 gap-4")]),Y([DK("Total Records",Z9(X.record_count)),DK("Total Actors",Z9(X.actor_count)),DK("Total Lexicons",Z9(X.lexicon_count))]))}}class e9 extends z{constructor(Z){super();this[0]=Z}}class Z0 extends z{}class PK extends z{}function N4(Z,W){let J;if(Z==="")J=NK(new HK,"No domain authority configured.","Settings","/settings");else J=cZ();let K=J,X;if(W===0)X=NK(new c8,"No lexicons loaded.","Settings","/settings");else X=cZ();let V=X;return f(Y([]),Y([K,V]))}function CQ(Z,W,J,K){let X=e(Z,"GetStatistics",h(Y([])),u8),V;V=X[1];let Q=e(Z,"GetSettings",h(Y([])),KW),G;G=Q[1];let F;if(V instanceof CW&&G instanceof CW){let U=V[0],I=G[0];F=N4(I.settings.domain_authority,U.statistics.lexicon_count)}else F=cZ();let M=F;return f(Y([]),Y([M,f(Y([N("mb-8 flex gap-3")]),(()=>{if(K)return Y([t9(!1,new PK,"Open GraphiQL"),t9(J,new Z0,(()=>{if(J)return"Backfilling...";else return"Trigger Backfill"})())]);else return Y([t9(!1,new PK,"Open GraphiQL")])})()),SQ(Z),jQ(Z,W,(U)=>{return new e9(U)}),TQ(Z,24)]))}class W0 extends z{constructor(Z){super();this[0]=Z}}class J0 extends z{}class K0 extends z{}class X0 extends z{}class V0 extends z{constructor(Z){super();this[0]=Z}}class qQ extends z{}class XW extends z{constructor(Z,W,J,K){super();this.domain_authority_input=Z,this.reset_confirmation=W,this.selected_file=J,this.alert=K}}function mW(Z,W,J){return new XW(Z.domain_authority_input,Z.reset_confirmation,Z.selected_file,new L([W,J]))}function wQ(Z){return new XW(Z.domain_authority_input,Z.reset_confirmation,Z.selected_file,new g)}function LQ(){return new XW("","",new g,new g)}function B4(Z){return pV(Z)}function P4(Z,W,J){return f(Y([N("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([N("text-xl font-semibold text-zinc-300 mb-4")]),Y([x("Domain Authority")])),f(Y([N("space-y-4")]),Y([f(Y([N("mb-4")]),Y([L9(Y([N("block text-sm text-zinc-400 mb-2")]),Y([x("Domain Authority")])),zJ(Y([bW("text"),N("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-900 border border-zinc-800 rounded focus:outline-none focus:border-zinc-700 w-full"),fJ("e.g. com.example"),a0(W.domain_authority_input),a9((K)=>{return new W0(K)})]))])),pZ(Y([N("text-sm text-zinc-500 mb-4")]),Y([x('The domain authority is used to determine which collections are considered "primary" vs "external" when backfilling records. For example, if the authority is "xyz.statusphere", then "xyz.statusphere.status" is treated as primary and "app.bsky.actor.profile" is external.')])),f(Y([N("flex gap-3")]),Y([dZ(Y([N((()=>{if(J)return"font-mono px-4 py-2 text-sm text-zinc-500 bg-zinc-800 rounded cursor-not-allowed";else return"font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-800 hover:bg-zinc-700 rounded transition-colors cursor-pointer"})()),kJ(J),HW(new J0)]),Y([x((()=>{if(J)return"Saving...";else return"Save"})())]))]))]))]))}function R4(Z){return f(Y([N("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([N("text-xl font-semibold text-zinc-300 mb-4")]),Y([x("OAuth Configuration")])),(()=>{let W=Z.oauth_client_id;if(W instanceof L){let J=W[0];return f(Y([N("space-y-3")]),Y([f(Y([N("flex items-center gap-2")]),Y([f(Y([N("w-2 h-2 bg-green-500 rounded-full")]),Y([])),pZ(Y([N("text-sm text-zinc-300")]),Y([x("OAuth client registered")]))])),f(Y([N("bg-zinc-900/50 rounded p-3")]),Y([pZ(Y([N("text-xs text-zinc-500 mb-1")]),Y([x("Client ID:")])),pZ(Y([N("text-sm text-zinc-300 font-mono")]),Y([x(J)]))])),pZ(Y([N("text-sm text-zinc-500")]),Y([x('OAuth client credentials are stored in the database. Use "Reset Everything" to clear and trigger re-registration.')]))]))}else return f(Y([N("space-y-3")]),Y([f(Y([N("flex items-center gap-2")]),Y([f(Y([N("w-2 h-2 bg-zinc-500 rounded-full")]),Y([])),pZ(Y([N("text-sm text-zinc-400")]),Y([x("OAuth client not registered")]))])),pZ(Y([N("text-sm text-zinc-500")]),Y([x("Set ENABLE_OAUTH_AUTO_REGISTER=true in your .env file to enable automatic OAuth client registration. The server will automatically register with your configured AIP server on startup.")]))]))})()]))}function j4(Z){return f(Y([N("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([N("text-xl font-semibold text-zinc-300 mb-4")]),Y([x("Lexicons")])),f(Y([N("space-y-4")]),Y([f(Y([N("mb-4")]),Y([L9(Y([N("block text-sm text-zinc-400 mb-2")]),Y([x("Upload Lexicons (ZIP)")])),zJ(Y([bW("file"),lX(Y([".zip"])),N("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-900 border border-zinc-800 rounded focus:outline-none focus:border-zinc-700 w-full"),xJ("lexicon-file-input"),a9((W)=>{return new K0})]))])),pZ(Y([N("text-sm text-zinc-500 mb-4")]),Y([x("Upload a ZIP file containing lexicon JSON files. The ZIP file will be extracted and all .json files will be imported into the database. This replaces the need to manually place lexicons in the priv/lexicons directory.")])),f(Y([N("flex gap-3")]),Y([dZ(Y([N("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-800 hover:bg-zinc-700 rounded transition-colors cursor-pointer"),HW(new X0)]),Y([x("Upload")]))]))]))]))}function T4(Z){return f(Y([N("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([N("text-xl font-semibold text-zinc-300 mb-4")]),Y([x("Danger Zone")])),pZ(Y([N("text-sm text-zinc-400 mb-4")]),Y([x("This will clear all indexed data:")])),N7(Y([N("text-sm text-zinc-400 mb-4 ml-4 list-disc")]),Y([IJ(Y([]),Y([x("Domain authority configuration")])),IJ(Y([]),Y([x("OAuth client credentials")])),IJ(Y([]),Y([x("All lexicon definitions")])),IJ(Y([]),Y([x("All indexed records")])),IJ(Y([]),Y([x("All actors")]))])),pZ(Y([N("text-sm text-zinc-400 mb-4")]),Y([x("Records can be re-indexed via backfill.")])),f(Y([N("space-y-4")]),Y([f(Y([N("mb-4")]),Y([L9(Y([N("block text-sm text-zinc-400 mb-2")]),Y([x("Type RESET to confirm")])),zJ(Y([bW("text"),N("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-900 border border-zinc-800 rounded focus:outline-none focus:border-zinc-700 w-full"),fJ("RESET"),a0(Z.reset_confirmation),a9((W)=>{return new V0(W)})]))])),f(Y([N("flex gap-3")]),Y([dZ(Y([N("font-mono px-4 py-2 text-sm text-red-400 border border-red-900 hover:bg-red-900/30 rounded transition-colors cursor-pointer"),kJ(Z.reset_confirmation!=="RESET"),HW(new qQ)]),Y([x("Reset Everything")]))]))]))]))}function EQ(Z,W,J){if(J){let K=h(Y([])),X=e(Z,"GetSettings",K,KW),V;V=X[1];let Q=B4(Z);return f(Y([N("max-w-2xl space-y-6")]),Y([f8(Y([N("text-2xl font-semibold text-zinc-300 mb-8")]),Y([x("Settings")])),(()=>{let G=W.alert;if(G instanceof L){let F=G[0][0],M=G[0][1],U;if(F==="success")U=new tJ;else if(F==="error")U=new eJ;else U=new c8;return OQ(U,M)}else return cZ()})(),(()=>{if(V instanceof AW)return f(Y([N("py-8 text-center text-zinc-600 text-sm")]),Y([x("Loading settings...")]));else if(V instanceof SW){let G=V[0];return f(Y([N("py-8 text-center text-red-400 text-sm")]),Y([x("Error: "+G)]))}else{let G=V[0];return f(Y([N("space-y-6")]),Y([P4(G.settings,W,Q),j4(W),R4(G.settings),T4(W)]))}})()]))}else return f(Y([N("max-w-2xl space-y-6")]),Y([f8(Y([N("text-2xl font-semibold text-zinc-300 mb-8")]),Y([x("Settings")])),f(Y([N("bg-zinc-800/50 rounded p-8 text-center border border-zinc-700")]),Y([pZ(Y([N("text-zinc-400 mb-4")]),Y([x("Access Denied")])),pZ(Y([N("text-sm text-zinc-500")]),Y([x("You must be an administrator to access the settings page.")]))]))]))}var A4="src/quickslice_client.gleam";class p8 extends z{}class j8 extends z{}class xQ extends z{}class Y8 extends z{}class kQ extends z{constructor(Z,W,J){super();this.did=Z,this.handle=W,this.is_admin=J}}class bZ extends z{constructor(Z,W,J,K,X,V,Q){super();this.cache=Z,this.registry=W,this.route=J,this.time_range=K,this.settings_page_model=X,this.is_backfilling=V,this.auth_state=Q}}class NW extends z{constructor(Z,W,J){super();this[0]=Z,this[1]=W,this[2]=J}}class RK extends z{constructor(Z,W){super();this[0]=Z,this[1]=W}}class jK extends z{constructor(Z,W){super();this[0]=Z,this[1]=W}}class TK extends z{constructor(Z){super();this[0]=Z}}class OK extends z{constructor(Z){super();this[0]=Z}}class AK extends z{constructor(Z){super();this[0]=Z}}class fQ extends z{constructor(Z){super();this[0]=Z}}function S4(Z,W){if(W instanceof NW){let J=W[2];if(J instanceof H){let K=W[0],X=W[1],V=J[0],Q=rV(Z.cache,K,X,V,0),G=qW(Q,Z.registry,(S,y,v)=>{return new NW(S,y,v)},()=>{return 0}),F,M;F=G[0],M=G[1];let U;if(K==="TriggerBackfill")U=!1;else U=Z.is_backfilling;let I=U,D;if(K==="GetCurrentSession"){let S=QK(V);if(S instanceof H){let v=S[0].current_session;if(v instanceof L){let _=v[0];D=new kQ(_.did,_.handle,_.is_admin)}else D=new Y8}else D=new Y8}else D=Z.auth_state;let T=D,R;if(K==="UpdateDomainAuthority")R=mW(Z.settings_page_model,"success","Domain authority updated successfully");else if(K==="UploadLexicons")XK("lexicon-file-input"),R=mW(Z.settings_page_model,"success","Lexicons uploaded successfully");else if(K==="ResetAll"){let S,y=Z.settings_page_model;S=new XW("",y.reset_confirmation,y.selected_file,y.alert),R=mW(S,"success","All data has been reset")}else if(K==="GetSettings"){let S=KW(V);if(S instanceof H){let y=S[0],v=Z.settings_page_model;R=new XW(y.settings.domain_authority,v.reset_confirmation,v.selected_file,v.alert)}else R=Z.settings_page_model}else R=Z.settings_page_model;let C=R,j;if(K==="ResetAll"){let S=R8(F,"GetStatistics",h(Y([]))),y=R8(S,"GetActivityBuckets",h(Y([["range",a(PJ(Z.time_range))]]))),v=R8(y,"GetRecentActivity",h(Y([["hours",WW(24)]]))),_=e(v,"GetSettings",h(Y([])),KW),u;u=_[0];let YZ=qW(u,Z.registry,(FZ,zZ,ZZ)=>{return new NW(FZ,zZ,ZZ)},()=>{return 0}),sZ,vZ;sZ=YZ[0],vZ=YZ[1],j=[sZ,vZ]}else if(K==="UploadLexicons")j=[R8(F,"GetStatistics",h(Y([]))),Y([])];else j=[F,Y([])];let E=j,A,k;A=E[0],k=E[1];let b;if(K==="GetCurrentSession"){let S=Z.route;if(T instanceof Y8)if(S instanceof j8)b=Y([v9("/",new g,new g)]);else b=Y([]);else if(!T.is_admin&&S instanceof j8)b=Y([v9("/",new g,new g)]);else b=Y([])}else b=Y([]);let B=b;return[new bZ(A,Z.registry,Z.route,Z.time_range,C,I,T),jW((()=>{let S=Y([M,k,B]);return dK(S)})())]}else{let K=W[0],X=J[0],V;if(K==="TriggerBackfill")V=!1;else V=Z.is_backfilling;let Q=V,G;if(K==="UpdateDomainAuthority")G=mW(Z.settings_page_model,"error","Error: "+X);else if(K==="UploadLexicons")G=mW(Z.settings_page_model,"error","Error: "+X);else if(K==="ResetAll")G=mW(Z.settings_page_model,"error","Error: "+X);else if(K==="TriggerBackfill")G=mW(Z.settings_page_model,"error","Error: "+X);else G=Z.settings_page_model;let F=G;return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,F,Q,Z.auth_state),lZ()]}}else if(W instanceof RK){let J=W[0],K=W[1],X=nV(Z.cache,J,K),V=mW(Z.settings_page_model,"success","Domain authority updated successfully");return[new bZ(X,Z.registry,Z.route,Z.time_range,V,Z.is_backfilling,Z.auth_state),lZ()]}else if(W instanceof jK){let J=W[0],K=W[1],X=cV(Z.cache,J),V,G=e(X,"GetSettings",h(Y([])),KW)[1];if(G instanceof CW)V=G[0].settings.domain_authority;else V=Z.settings_page_model.domain_authority_input;let F=V,M,U=Z.settings_page_model;M=new XW(F,U.reset_confirmation,U.selected_file,new L(["error","Error: "+K]));let I=M;return[new bZ(X,Z.registry,Z.route,Z.time_range,I,Z.is_backfilling,Z.auth_state),lZ()]}else if(W instanceof TK){let J=W[0],K;if(Z.route instanceof j8)K=wQ(Z.settings_page_model);else K=Z.settings_page_model;let V=K;if(J instanceof p8){let Q=e(Z.cache,"GetStatistics",h(Y([])),u8),G;G=Q[0];let F=e(G,"GetSettings",h(Y([])),KW),M;M=F[0];let U=e(M,"GetActivityBuckets",h(Y([["range",a(PJ(Z.time_range))]])),RJ),I;I=U[0];let D=e(I,"GetRecentActivity",h(Y([["hours",WW(24)]])),oJ),T;T=D[0];let R=qW(T,Z.registry,(E,A,k)=>{return new NW(E,A,k)},()=>{return 0}),C,j;return C=R[0],j=R[1],[new bZ(C,Z.registry,J,Z.time_range,V,Z.is_backfilling,Z.auth_state),jW(j)]}else if(J instanceof j8){let Q,G=Z.auth_state;if(G instanceof Y8)Q=!1;else Q=G.is_admin;if(Q){let M=e(Z.cache,"GetSettings",h(Y([])),KW),U;U=M[0];let I=qW(U,Z.registry,(R,C,j)=>{return new NW(R,C,j)},()=>{return 0}),D,T;return D=I[0],T=I[1],[new bZ(D,Z.registry,J,Z.time_range,V,Z.is_backfilling,Z.auth_state),jW(T)]}else return[Z,v9("/",new g,new g)]}else return[new bZ(Z.cache,Z.registry,J,Z.time_range,V,Z.is_backfilling,Z.auth_state),lZ()]}else if(W instanceof OK){let J=W[0];if(J instanceof e9){let K=J[0],X=h(Y([["range",a(PJ(K))]])),V=e(Z.cache,"GetActivityBuckets",X,RJ),Q;Q=V[0];let G=qW(Q,Z.registry,(U,I,D)=>{return new NW(U,I,D)},()=>{return 0}),F,M;return F=G[0],M=G[1],[new bZ(F,Z.registry,Z.route,K,Z.settings_page_model,Z.is_backfilling,Z.auth_state),jW(M)]}else if(J instanceof Z0){let K=h(Y([])),X=R8(Z.cache,"TriggerBackfill",K),V=e(X,"TriggerBackfill",K,zQ),Q;Q=V[0];let G=qW(Q,Z.registry,(U,I,D)=>{return new NW(U,I,D)},()=>{return 0}),F,M;return F=G[0],M=G[1],[new bZ(F,Z.registry,Z.route,Z.time_range,Z.settings_page_model,!0,Z.auth_state),jW(M)]}else return FK("/graphiql"),[Z,lZ()]}else if(W instanceof AK){let J=W[0];if(J instanceof W0){let K=J[0],X,V=Z.settings_page_model;X=new XW(K,V.reset_confirmation,V.selected_file,new g);let Q=X;return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,Q,Z.is_backfilling,Z.auth_state),lZ()]}else if(J instanceof J0){let K,X=Z.settings_page_model;K=new XW(X.domain_authority_input,X.reset_confirmation,X.selected_file,new g);let V=K,Q=h(Y([["domainAuthority",a(Z.settings_page_model.domain_authority_input)]])),G,M=e(Z.cache,"GetSettings",h(Y([])),KW)[1];if(M instanceof CW)G=M[0].settings.oauth_client_id;else G=new g;let U=G,I=h(Y([["id",a("Settings:singleton")],["domainAuthority",a(Z.settings_page_model.domain_authority_input)],["oauthClientId",KJ(U,a)]])),D=dV(Z.cache,Z.registry,"UpdateDomainAuthority",Q,"Settings:singleton",(C)=>{return I},DQ,(C,j,E)=>{if(j instanceof H)return new RK(C,E);else{let A=j[0];return new jK(C,A)}}),T,R;return T=D[0],R=D[2],[new bZ(T,Z.registry,Z.route,Z.time_range,V,Z.is_backfilling,Z.auth_state),R]}else if(J instanceof K0)return[Z,lZ()];else if(J instanceof X0){q8("[UploadLexicons] Button clicked, creating file effect");let K=aW((X)=>{return q8("[UploadLexicons] Effect running, calling read_file_as_base64"),KK("lexicon-file-input",(V)=>{return q8("[UploadLexicons] Callback received result"),X(new fQ(V))})});return[Z,K]}else if(J instanceof V0){let K=J[0],X,V=Z.settings_page_model;X=new XW(V.domain_authority_input,K,V.selected_file,new g);let Q=X;return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,Q,Z.is_backfilling,Z.auth_state),lZ()]}else{let K=h(Y([["confirm",a(Z.settings_page_model.reset_confirmation)]])),X=R8(Z.cache,"ResetAll",K),V=e(X,"ResetAll",K,UQ),Q;Q=V[0];let G=qW(Q,Z.registry,(T,R,C)=>{return new NW(T,R,C)},()=>{return 0}),F,M;F=G[0],M=G[1];let U,I=Z.settings_page_model;U=new XW(I.domain_authority_input,"",I.selected_file,new g);let D=U;return[new bZ(F,Z.registry,Z.route,Z.time_range,D,Z.is_backfilling,Z.auth_state),jW(M)]}}else{let J=W[0];if(J instanceof H){let K=J[0];q8("[FileRead] Successfully read file, uploading...");let X=h(Y([["zipBase64",a(K)]])),V=R8(Z.cache,"UploadLexicons",X),Q=e(V,"UploadLexicons",X,PQ),G;G=Q[0];let F=qW(G,Z.registry,(R,C,j)=>{return new NW(R,C,j)},()=>{return 0}),M,U;M=F[0],U=F[1];let I,D=Z.settings_page_model;I=new XW(D.domain_authority_input,D.reset_confirmation,new g,D.alert);let T=I;return[new bZ(M,Z.registry,Z.route,Z.time_range,T,Z.is_backfilling,Z.auth_state),jW(U)]}else{let K=J[0];q8("[FileRead] Error reading file: "+K);let X=mW(Z.settings_page_model,"error",K);return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,X,Z.is_backfilling,Z.auth_state),lZ()]}}}function C4(Z){let W,J=Z.auth_state;if(J instanceof Y8)W=!1;else W=J.is_admin;let K=W;return I6(CQ(Z.cache,Z.time_range,Z.is_backfilling,K),(X)=>{return new OK(X)})}function q4(Z){let W,J=Z.auth_state;if(J instanceof Y8)W=!1;else W=J.is_admin;let K=W;return I6(EQ(Z.cache,Z.settings_page_model,K),(X)=>{return new AK(X)})}function w4(Z){return f(Y([]),Y([f8(Y([N("text-xl font-bold text-zinc-100 mb-4")]),Y([gW("Upload")])),pZ(Y([N("text-zinc-400")]),Y([gW("Upload and manage data")]))]))}function L4(Z){let W,J=Z.auth_state;if(J instanceof Y8)W=new g;else{let{handle:X,is_admin:V}=J;W=new L([X,V])}let K=W;return f(Y([N("bg-zinc-950 text-zinc-300 font-mono min-h-screen")]),Y([f(Y([N("max-w-4xl mx-auto px-6 py-12")]),Y([oV(K),(()=>{let X=Z.route;if(X instanceof p8)return C4(Z);else if(X instanceof j8)return q4(Z);else return w4(Z)})()]))]))}function yQ(Z){let W=Z.path;if(W==="/")return new p8;else if(W==="/settings")return new j8;else if(W==="/upload")return new xQ;else return new p8}function E4(Z){return new TK(yQ(Z))}function x4(Z){let W=uV("http://localhost:8000/admin/graphql"),J=tV(),K,X=$6();if(X instanceof H){let R=X[0];K=yQ(R)}else K=new p8;let V=K,Q=e(W,"GetCurrentSession",h(Y([])),QK),G;G=Q[0];let F;if(V instanceof p8){let R=e(G,"GetStatistics",h(Y([])),u8),C;C=R[0];let j=e(C,"GetSettings",h(Y([])),KW),E;E=j[0];let A=e(E,"GetActivityBuckets",h(Y([["range",a("ONE_DAY")]])),RJ),k;k=A[0];let b=e(k,"GetRecentActivity",h(Y([["hours",WW(24)]])),oJ),B;B=b[0];let S=qW(B,J,(_,u,YZ)=>{return new NW(_,u,YZ)},()=>{return 0}),y,v;y=S[0],v=S[1],F=[y,v]}else if(V instanceof j8){let R=e(G,"GetSettings",h(Y([])),KW),C;C=R[0];let j=qW(C,J,(k,b,B)=>{return new NW(k,b,B)},()=>{return 0}),E,A;E=j[0],A=j[1],F=[E,A]}else F=[G,Y([])];let M=F,U,I;U=M[0],I=M[1];let D=NV(E4),T=jW(P(D,I));return[new bZ(U,J,V,new m8,LQ(),!1,new Y8),T]}function bQ(){let Z=QV(x4,S4,L4),W=YV(Z,"#app",void 0);if(!(W instanceof H))throw F8("let_assert",A4,"quickslice_client",46,"main","Pattern match failed, no pattern matched the value.",{value:W,start:1124,end:1173,pattern_start:1135,pattern_end:1140});return W}bQ(); 60 + }`,"generated/queries/reset_all")}class nJ extends z{}class lJ extends z{}class iJ extends z{}class m8 extends z{}class aJ extends z{}class eV extends z{constructor(Z,W,J,K,X){super();this.timestamp=Z,this.total=W,this.creates=J,this.updates=K,this.deletes=X}}class ZQ extends z{constructor(Z){super();this.activity_buckets=Z}}function PJ(Z){if(Z instanceof nJ)return"ONE_HOUR";else if(Z instanceof lJ)return"THREE_HOURS";else if(Z instanceof iJ)return"SIX_HOURS";else if(Z instanceof m8)return"ONE_DAY";else return"SEVEN_DAYS"}function g5(){return $("timestamp",c,(Z)=>{return $("total",mZ,(W)=>{return $("creates",mZ,(J)=>{return $("updates",mZ,(K)=>{return $("deletes",mZ,(X)=>{return t(new eV(Z,W,J,K,X))})})})})})}function h5(){return $("activityBuckets",PW(g5()),(Z)=>{return t(new ZQ(Z))})}function RJ(Z){return wZ(Z,h5())}class WQ extends z{constructor(Z,W,J){super();this.did=Z,this.handle=W,this.is_admin=J}}class JQ extends z{constructor(Z){super();this.current_session=Z}}function v5(){return $("did",c,(Z)=>{return $("handle",c,(W)=>{return $("isAdmin",BW,(J)=>{return t(new WQ(Z,W,J))})})})}function _5(){return $("currentSession",sW(v5()),(Z)=>{return t(new JQ(Z))})}function QK(Z){return wZ(Z,_5())}class KQ extends z{constructor(Z,W,J,K,X,V,Q,G){super();this.id=Z,this.timestamp=W,this.operation=J,this.collection=K,this.did=X,this.status=V,this.error_message=Q,this.event_json=G}}class XQ extends z{constructor(Z){super();this.recent_activity=Z}}function m5(){return $("id",mZ,(Z)=>{return $("timestamp",c,(W)=>{return $("operation",c,(J)=>{return $("collection",c,(K)=>{return $("did",c,(X)=>{return $("status",c,(V)=>{return $("errorMessage",sW(c),(Q)=>{return $("eventJson",sW(c),(G)=>{return t(new KQ(Z,W,J,K,X,V,Q,G))})})})})})})})})}function u5(){return $("recentActivity",PW(m5()),(Z)=>{return t(new XQ(Z))})}function oJ(Z){return wZ(Z,u5())}class QQ extends z{constructor(Z,W,J){super();this.id=Z,this.domain_authority=W,this.oauth_client_id=J}}class YQ extends z{constructor(Z){super();this.settings=Z}}function c5(){return $("id",c,(Z)=>{return $("domainAuthority",c,(W)=>{return $("oauthClientId",sW(c),(J)=>{return t(new QQ(Z,W,J))})})})}function p5(){return $("settings",c5(),(Z)=>{return t(new YQ(Z))})}function KW(Z){return wZ(Z,p5())}class GQ extends z{constructor(Z,W,J){super();this.record_count=Z,this.actor_count=W,this.lexicon_count=J}}class FQ extends z{constructor(Z){super();this.statistics=Z}}function d5(){return $("recordCount",mZ,(Z)=>{return $("actorCount",mZ,(W)=>{return $("lexiconCount",mZ,(J)=>{return t(new GQ(Z,W,J))})})})}function s5(){return $("statistics",d5(),(Z)=>{return t(new FQ(Z))})}function u8(Z){return wZ(Z,s5())}class MQ extends z{constructor(Z){super();this.reset_all=Z}}function r5(){return $("resetAll",BW,(Z)=>{return t(new MQ(Z))})}function UQ(Z){return wZ(Z,r5())}class IQ extends z{constructor(Z){super();this.trigger_backfill=Z}}function l5(){return $("triggerBackfill",BW,(Z)=>{return t(new IQ(Z))})}function zQ(Z){return wZ(Z,l5())}class HQ extends z{constructor(Z,W,J){super();this.id=Z,this.domain_authority=W,this.oauth_client_id=J}}class NQ extends z{constructor(Z){super();this.update_domain_authority=Z}}function a5(){return $("id",c,(Z)=>{return $("domainAuthority",c,(W)=>{return $("oauthClientId",sW(c),(J)=>{return t(new HQ(Z,W,J))})})})}function o5(){return $("updateDomainAuthority",a5(),(Z)=>{return t(new NQ(Z))})}function DQ(Z){return wZ(Z,o5())}class BQ extends z{constructor(Z){super();this.upload_lexicons=Z}}function e5(){return $("uploadLexicons",BW,(Z)=>{return t(new BQ(Z))})}function PQ(Z){return wZ(Z,e5())}function FK(Z){globalThis.location.href=Z}function RQ(Z,W){return sX(Z,CJ(W,(J)=>{return new EJ(!1,!1,J)}),m,r0,r0,0,0)}function HW(Z){return RQ("click",t(Z))}function a9(Z){return RQ("input",w0(Y(["target","value"]),c,(W)=>{return t(Z(W))}))}function J4(Z,W){let J=(K)=>{let X="px-3 py-1 text-xs rounded transition-colors cursor-pointer";if(GZ(K,Z))return X+" bg-zinc-700 text-zinc-100";else return X+" bg-zinc-800/50 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-300"};return f(Y([D("flex gap-2 mb-4")]),Y([sZ(Y([D(J(new nJ)),HW(W(new nJ))]),Y([E("1hr")])),sZ(Y([D(J(new lJ)),HW(W(new lJ))]),Y([E("3hr")])),sZ(Y([D(J(new iJ)),HW(W(new iJ))]),Y([E("6hr")])),sZ(Y([D(J(new m8)),HW(W(new m8))]),Y([E("1 day")])),sZ(Y([D(J(new aJ)),HW(W(new aJ))]),Y([E("7 day")]))]))}function K4(Z){let J=HZ(Z,(X)=>{return X.creates+X.updates+X.deletes}),K=nK(J,U9);return WJ(K,1)}function X4(Z,W,J,K,X,V){let Q=n(W)*(J+K);if(Z.creates+Z.updates+Z.deletes===0){let F=4,M=X-F;return sJ(Y([]),Y([dJ(Y([w("x",BZ(Q)),w("y",BZ(M)),w("width",BZ(J)),w("height",BZ(F)),w("style","fill: #3f3f46 !important; stroke: none; display: inline")]))]))}else{let F=W9(X,n(V)),M=n(Z.deletes)*F,U=n(Z.updates)*F,I=n(Z.creates)*F,N=X-M,T=N-U,R=T-I;return sJ(Y([D("group")]),Y([(()=>{if(Z.deletes>0)return dJ(Y([w("x",BZ(Q)),w("y",BZ(N)),w("width",BZ(J)),w("height",BZ(M)),w("style","fill: #ef4444 !important; stroke: none; display: inline; cursor: pointer; transition: opacity 0.2s"),D("group-hover:opacity-80")]));else return pZ()})(),(()=>{if(Z.updates>0)return dJ(Y([w("x",BZ(Q)),w("y",BZ(T)),w("width",BZ(J)),w("height",BZ(U)),w("style","fill: #60a5fa !important; stroke: none; display: inline; cursor: pointer; transition: opacity 0.2s"),D("group-hover:opacity-80")]));else return pZ()})(),(()=>{if(Z.creates>0)return dJ(Y([w("x",BZ(Q)),w("y",BZ(R)),w("width",BZ(J)),w("height",BZ(I)),w("style","fill: #22c55e !important; stroke: none; display: inline; cursor: pointer; transition: opacity 0.2s"),D("group-hover:opacity-80")]));else return pZ()})()]))}}function V4(Z,W){let J=K4(Z),K;if(W instanceof aJ)K=[160,12];else K=[30,4];let X=K,V,Q;V=X[0],Q=X[1];let G=SJ(Z),F=n(G)*V+n(G-1)*Q,M=120;return f(Y([D("w-full")]),Y([i9(Y([w("viewBox","0 0 "+BZ(F)+" "+BZ(M)),w("width","100%"),w("height",BZ(M)),w("style","min-height: 120px"),w("preserveAspectRatio","none")]),pK(Z,(U,I)=>{return X4(U,I,V,Q,M,J)}))]))}function Q4(Z,W){let J=h(Y([["range",a(PJ(W))]])),K=e(Z,"GetActivityBuckets",J,RJ),X;if(X=K[1],X instanceof AW)return f(Y([D("py-8 text-center text-zinc-600 text-xs")]),Y([E("Loading activity data...")]));else if(X instanceof SW){let V=X[0];return f(Y([D("py-8 text-center text-red-400 text-xs")]),Y([E("Error: "+V)]))}else{let Q=X[0].activity_buckets;if(Q instanceof A)return f(Y([D("py-8 text-center text-zinc-600 text-xs")]),Y([E("No activity data available")]));else return V4(Q,W)}}function jQ(Z,W,J){return f(Y([D("bg-zinc-800/50 rounded p-4 font-mono mb-8")]),Y([J4(W,J),Q4(Z,W)]))}function UK(Z){try{return new Date(Z).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch(W){return Z}}function IK(Z){try{return new Date(Z).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch(W){return Z}}function o9(Z){if(typeof Z==="string")try{let W=JSON.parse(Z);return o9(W)}catch(W){return Z}else if(Array.isArray(Z))return Z.map(o9);else if(Z!==null&&typeof Z==="object"){let W={};for(let[J,K]of Object.entries(Z))W[J]=o9(K);return W}return Z}function zK(Z){try{let W=JSON.parse(Z),J=o9(W);return JSON.stringify(J,null,2)}catch(W){return Z}}function M4(Z){return f(Y([]),HZ(Z,(W)=>{let J,K=W.status;if(K==="success")J="text-green-500";else if(K==="validation_error")J="text-yellow-500";else if(K==="error")J="text-red-500";else if(K==="processing")J="text-blue-500";else J="text-zinc-500";let X=J,V,Q=W.status;if(Q==="success")V="✓";else if(Q==="validation_error")V="⚠";else if(Q==="error")V="✗";else if(Q==="processing")V="⋯";else V="•";let G=V,F,M=W.operation;if(M==="create")F="text-green-400";else if(M==="update")F="text-blue-400";else if(M==="delete")F="text-red-400";else F="text-zinc-400";let U=F,I="activity-"+qZ(W.id);return f(Y([D("border-l-2 border-zinc-700/50 hover:border-zinc-600 transition-colors"),w("data-entry-id",I)]),Y([f(Y([D("flex items-start gap-2 py-1 text-xs font-mono hover:bg-zinc-900/30 cursor-pointer group"),w("onclick","this.parentElement.classList.toggle('expanded')")]),Y([IZ(Y([D("text-zinc-600 group-hover:text-zinc-400 shrink-0 select-none transition-transform caret"),w("data-caret","")]),Y([E("›")])),IZ(Y([D("text-zinc-600 shrink-0 w-16"),w("data-timestamp",W.timestamp)]),Y([E(UK(W.timestamp))])),IZ(Y([D(X+" shrink-0 w-4")]),Y([E(G)])),IZ(Y([D(U+" shrink-0 w-12")]),Y([E(W.operation)])),IZ(Y([D("text-purple-400 shrink-0")]),Y([E(W.collection)])),IZ(Y([D("text-zinc-500 truncate")]),Y([E(W.did)]))])),f(Y([D("px-6 py-2 text-xs bg-zinc-900/50 border-t border-zinc-800 hidden space-y-1"),w("data-details","")]),Y([f(Y([D("flex gap-2")]),Y([IZ(Y([D("text-zinc-600 w-20")]),Y([E("Timestamp:")])),IZ(Y([D("text-zinc-400")]),Y([E(IK(W.timestamp))]))])),f(Y([D("flex gap-2")]),Y([IZ(Y([D("text-zinc-600 w-20")]),Y([E("DID:")])),IZ(Y([D("text-zinc-400 font-mono break-all")]),Y([E(W.did)]))])),f(Y([D("flex gap-2")]),Y([IZ(Y([D("text-zinc-600 w-20")]),Y([E("Status:")])),IZ(Y([D((()=>{let N=W.status;if(N==="success")return"text-green-400";else if(N==="validation_error")return"text-yellow-400";else if(N==="error")return"text-red-400";else return"text-zinc-400"})())]),Y([E(W.status)]))])),(()=>{let N=W.error_message;if(N instanceof L){let T=N[0];return f(Y([D("flex gap-2")]),Y([IZ(Y([D("text-zinc-600 w-20")]),Y([E("Error:")])),IZ(Y([D("text-red-400")]),Y([E(T)]))]))}else return pZ()})(),(()=>{let N=W.event_json;if(N instanceof L){let T=N[0],R=zK(T);return f(Y([D("mt-2")]),Y([f(Y([D("text-zinc-600 mb-1")]),Y([E("Event JSON:")])),H7(Y([D("text-zinc-400 bg-black/40 p-2 rounded text-[10px] whitespace-pre-wrap block"),w("data-json",T)]),Y([E(R)]))]))}else return pZ()})()]))]))}))}function TQ(Z,W){let J=h(Y([["hours",WW(W)]])),K=e(Z,"GetRecentActivity",J,oJ),X;return X=K[1],f(Y([D("font-mono mb-8")]),Y([fZ("style",Y([]),Y([E(`[data-entry-id].expanded [data-caret] { transform: rotate(90deg); } 61 + [data-entry-id].expanded [data-details] { display: block !important; }`)])),f(Y([D("bg-zinc-800/50 rounded p-4")]),Y([f(Y([D("flex items-center justify-between mb-3")]),Y([f(Y([D("text-sm text-zinc-500")]),Y([E("JetStream Activity")])),(()=>{if(X instanceof CW){let V=X[0];return IZ(Y([D("text-xs text-zinc-600")]),Y([E(qZ(SJ(V.recent_activity))+" events ("+qZ(W)+"h)")]))}else return IZ(Y([D("text-xs text-zinc-600")]),Y([E("("+qZ(W)+"h)")]))})()])),f(Y([D("max-h-80 overflow-y-auto")]),Y([(()=>{if(X instanceof AW)return f(Y([D("py-8 text-center text-zinc-600 text-xs")]),Y([E("Loading activity...")]));else if(X instanceof SW){let V=X[0];return f(Y([D("py-8 text-center text-red-400 text-xs")]),Y([E("Error: "+V)]))}else{let Q=X[0].recent_activity;if(Q instanceof A)return f(Y([D("py-8 text-center text-zinc-600 text-xs")]),Y([E("No activity in the last "+qZ(W)+" hours")]));else return M4(Q)}})()]))]))]))}class tJ extends z{}class eJ extends z{}class c8 extends z{}class HK extends z{}function OQ(Z,W){let J;if(Z instanceof tJ)J=["bg-green-900/30","border-green-800","text-green-300","✓"];else if(Z instanceof eJ)J=["bg-red-900/30","border-red-800","text-red-300","✗"];else if(Z instanceof c8)J=["bg-blue-900/30","border-blue-800","text-blue-300","ℹ"];else J=["bg-yellow-900/30","border-yellow-800","text-yellow-300","⚠"];let K=J,X,V,Q,G;return X=K[0],V=K[1],Q=K[2],G=K[3],f(Y([D("mb-6 p-4 rounded border "+X+" "+V)]),Y([f(Y([D("flex items-center gap-3")]),Y([IZ(Y([D("text-lg "+Q)]),Y([E(G)])),IZ(Y([D("text-sm "+Q)]),Y([E(W)]))]))]))}function NK(Z,W,J,K){let X;if(Z instanceof tJ)X=["bg-green-900/30","border-green-800","text-green-300","✓"];else if(Z instanceof eJ)X=["bg-red-900/30","border-red-800","text-red-300","✗"];else if(Z instanceof c8)X=["bg-blue-900/30","border-blue-800","text-blue-300","ℹ"];else X=["bg-yellow-900/30","border-yellow-800","text-yellow-300","⚠"];let V=X,Q,G,F,M;return Q=V[0],G=V[1],F=V[2],M=V[3],f(Y([D("mb-6 p-4 rounded border "+Q+" "+G)]),Y([f(Y([D("flex items-center gap-3")]),Y([IZ(Y([D("text-lg "+F)]),Y([E(M)])),IZ(Y([D("text-sm "+F)]),Y([E(W+" "),y8(Y([L8(K),D("underline hover:no-underline")]),Y([E(J)]))]))]))]))}var I4="font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-800 hover:bg-zinc-700 rounded transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-zinc-800";function t9(Z,W,J){return sZ(Y([bW("button"),D(I4),kJ(Z),HW(W)]),Y([gW(J)]))}function Z9(Z){return new Intl.NumberFormat("en-US").format(Z)}function DK(Z,W){return f(Y([D("bg-zinc-800/50 rounded p-4")]),Y([f(Y([D("text-sm text-zinc-500 mb-1")]),Y([gW(Z)])),f(Y([D("text-2xl font-semibold text-zinc-200")]),Y([gW(W)]))]))}function BK(Z){return f(Y([D("bg-zinc-800/50 rounded p-4 animate-pulse")]),Y([f(Y([D("text-sm text-zinc-500 mb-1")]),Y([gW(Z)])),f(Y([D("h-8 bg-zinc-700 rounded w-24")]),Y([]))]))}function SQ(Z){let W=e(Z,"GetStatistics",h(Y([])),u8),J;if(J=W[1],J instanceof AW)return f(Y([D("mb-8 grid grid-cols-3 gap-4")]),Y([BK("Total Records"),BK("Total Actors"),BK("Total Lexicons")]));else if(J instanceof SW){let K=J[0];return f(Y([D("mb-8")]),Y([f(Y([D("bg-red-800/50 rounded p-4 text-red-200")]),Y([gW("Error loading statistics: "+K)]))]))}else{let X=J[0].statistics;return f(Y([D("mb-8 grid grid-cols-3 gap-4")]),Y([DK("Total Records",Z9(X.record_count)),DK("Total Actors",Z9(X.actor_count)),DK("Total Lexicons",Z9(X.lexicon_count))]))}}class e9 extends z{constructor(Z){super();this[0]=Z}}class Z0 extends z{}class PK extends z{}function D4(Z,W){let J;if(Z==="")J=NK(new HK,"No domain authority configured.","Settings","/settings");else J=pZ();let K=J,X;if(W===0)X=NK(new c8,"No lexicons loaded.","Settings","/settings");else X=pZ();let V=X;return f(Y([]),Y([K,V]))}function CQ(Z,W,J,K){let X=e(Z,"GetStatistics",h(Y([])),u8),V;V=X[1];let Q=e(Z,"GetSettings",h(Y([])),KW),G;G=Q[1];let F;if(V instanceof CW&&G instanceof CW){let U=V[0],I=G[0];F=D4(I.settings.domain_authority,U.statistics.lexicon_count)}else F=pZ();let M=F;return f(Y([]),Y([M,f(Y([D("mb-8 flex gap-3")]),(()=>{if(K)return Y([t9(!1,new PK,"Open GraphiQL"),t9(J,new Z0,(()=>{if(J)return"Backfilling...";else return"Trigger Backfill"})())]);else return Y([t9(!1,new PK,"Open GraphiQL")])})()),SQ(Z),jQ(Z,W,(U)=>{return new e9(U)}),TQ(Z,24)]))}class W0 extends z{constructor(Z){super();this[0]=Z}}class J0 extends z{}class K0 extends z{}class X0 extends z{}class V0 extends z{constructor(Z){super();this[0]=Z}}class qQ extends z{}class XW extends z{constructor(Z,W,J,K){super();this.domain_authority_input=Z,this.reset_confirmation=W,this.selected_file=J,this.alert=K}}function mW(Z,W,J){return new XW(Z.domain_authority_input,Z.reset_confirmation,Z.selected_file,new L([W,J]))}function wQ(Z){return new XW(Z.domain_authority_input,Z.reset_confirmation,Z.selected_file,new g)}function LQ(){return new XW("","",new g,new g)}function P4(Z){return pV(Z)}function R4(Z,W,J){return f(Y([D("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([D("text-xl font-semibold text-zinc-300 mb-4")]),Y([E("Domain Authority")])),f(Y([D("space-y-4")]),Y([f(Y([D("mb-4")]),Y([L9(Y([D("block text-sm text-zinc-400 mb-2")]),Y([E("Domain Authority")])),zJ(Y([bW("text"),D("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-900 border border-zinc-800 rounded focus:outline-none focus:border-zinc-700 w-full"),fJ("e.g. com.example"),a0(W.domain_authority_input),a9((K)=>{return new W0(K)})]))])),dZ(Y([D("text-sm text-zinc-500 mb-4")]),Y([E('The domain authority is used to determine which collections are considered "primary" vs "external" when backfilling records. For example, if the authority is "xyz.statusphere", then "xyz.statusphere.status" is treated as primary and "app.bsky.actor.profile" is external.')])),f(Y([D("flex gap-3")]),Y([sZ(Y([D((()=>{if(J)return"font-mono px-4 py-2 text-sm text-zinc-500 bg-zinc-800 rounded cursor-not-allowed";else return"font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-800 hover:bg-zinc-700 rounded transition-colors cursor-pointer"})()),kJ(J),HW(new J0)]),Y([E((()=>{if(J)return"Saving...";else return"Save"})())]))]))]))]))}function j4(Z){return f(Y([D("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([D("text-xl font-semibold text-zinc-300 mb-4")]),Y([E("OAuth Configuration")])),(()=>{let W=Z.oauth_client_id;if(W instanceof L){let J=W[0];return f(Y([D("space-y-3")]),Y([f(Y([D("flex items-center gap-2")]),Y([f(Y([D("w-2 h-2 bg-green-500 rounded-full")]),Y([])),dZ(Y([D("text-sm text-zinc-300")]),Y([E("OAuth client registered")]))])),f(Y([D("bg-zinc-900/50 rounded p-3")]),Y([dZ(Y([D("text-xs text-zinc-500 mb-1")]),Y([E("Client ID:")])),dZ(Y([D("text-sm text-zinc-300 font-mono")]),Y([E(J)]))])),dZ(Y([D("text-sm text-zinc-500")]),Y([E('OAuth client credentials are stored in the database. Use "Reset Everything" to clear and trigger re-registration.')]))]))}else return f(Y([D("space-y-3")]),Y([f(Y([D("flex items-center gap-2")]),Y([f(Y([D("w-2 h-2 bg-zinc-500 rounded-full")]),Y([])),dZ(Y([D("text-sm text-zinc-400")]),Y([E("OAuth client not registered")]))])),dZ(Y([D("text-sm text-zinc-500")]),Y([E("Set ENABLE_OAUTH_AUTO_REGISTER=true in your .env file to enable automatic OAuth client registration. The server will automatically register with your configured AIP server on startup.")]))]))})()]))}function T4(Z){return f(Y([D("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([D("text-xl font-semibold text-zinc-300 mb-4")]),Y([E("Lexicons")])),f(Y([D("space-y-4")]),Y([f(Y([D("mb-4")]),Y([L9(Y([D("block text-sm text-zinc-400 mb-2")]),Y([E("Upload Lexicons (ZIP)")])),zJ(Y([bW("file"),lX(Y([".zip"])),D("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-900 border border-zinc-800 rounded focus:outline-none focus:border-zinc-700 w-full"),xJ("lexicon-file-input"),a9((W)=>{return new K0})]))])),dZ(Y([D("text-sm text-zinc-500 mb-4")]),Y([E("Upload a ZIP file containing lexicon JSON files. The ZIP file will be extracted and all .json files will be imported into the database. This replaces the need to manually place lexicons in the priv/lexicons directory.")])),f(Y([D("flex gap-3")]),Y([sZ(Y([D("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-800 hover:bg-zinc-700 rounded transition-colors cursor-pointer"),HW(new X0)]),Y([E("Upload")]))]))]))]))}function O4(Z){return f(Y([D("bg-zinc-800/50 rounded p-6")]),Y([vJ(Y([D("text-xl font-semibold text-zinc-300 mb-4")]),Y([E("Danger Zone")])),dZ(Y([D("text-sm text-zinc-400 mb-4")]),Y([E("This will clear all indexed data:")])),N7(Y([D("text-sm text-zinc-400 mb-4 ml-4 list-disc")]),Y([IJ(Y([]),Y([E("Domain authority configuration")])),IJ(Y([]),Y([E("OAuth client credentials")])),IJ(Y([]),Y([E("All lexicon definitions")])),IJ(Y([]),Y([E("All indexed records")])),IJ(Y([]),Y([E("All actors")]))])),dZ(Y([D("text-sm text-zinc-400 mb-4")]),Y([E("Records can be re-indexed via backfill.")])),f(Y([D("space-y-4")]),Y([f(Y([D("mb-4")]),Y([L9(Y([D("block text-sm text-zinc-400 mb-2")]),Y([E("Type RESET to confirm")])),zJ(Y([bW("text"),D("font-mono px-4 py-2 text-sm text-zinc-300 bg-zinc-900 border border-zinc-800 rounded focus:outline-none focus:border-zinc-700 w-full"),fJ("RESET"),a0(Z.reset_confirmation),a9((W)=>{return new V0(W)})]))])),f(Y([D("flex gap-3")]),Y([sZ(Y([D("font-mono px-4 py-2 text-sm text-red-400 border border-red-900 hover:bg-red-900/30 rounded transition-colors cursor-pointer"),kJ(Z.reset_confirmation!=="RESET"),HW(new qQ)]),Y([E("Reset Everything")]))]))]))]))}function EQ(Z,W,J){if(J){let K=h(Y([])),X=e(Z,"GetSettings",K,KW),V;V=X[1];let Q=P4(Z);return f(Y([D("max-w-2xl space-y-6")]),Y([f8(Y([D("text-2xl font-semibold text-zinc-300 mb-8")]),Y([E("Settings")])),(()=>{let G=W.alert;if(G instanceof L){let F=G[0][0],M=G[0][1],U;if(F==="success")U=new tJ;else if(F==="error")U=new eJ;else U=new c8;return OQ(U,M)}else return pZ()})(),(()=>{if(V instanceof AW)return f(Y([D("py-8 text-center text-zinc-600 text-sm")]),Y([E("Loading settings...")]));else if(V instanceof SW){let G=V[0];return f(Y([D("py-8 text-center text-red-400 text-sm")]),Y([E("Error: "+G)]))}else{let G=V[0];return f(Y([D("space-y-6")]),Y([R4(G.settings,W,Q),T4(W),j4(G.settings),O4(W)]))}})()]))}else return f(Y([D("max-w-2xl space-y-6")]),Y([f8(Y([D("text-2xl font-semibold text-zinc-300 mb-8")]),Y([E("Settings")])),f(Y([D("bg-zinc-800/50 rounded p-8 text-center border border-zinc-700")]),Y([dZ(Y([D("text-zinc-400 mb-4")]),Y([E("Access Denied")])),dZ(Y([D("text-sm text-zinc-500")]),Y([E("You must be an administrator to access the settings page.")]))]))]))}function xQ(){return window.location.origin}var S4="src/quickslice_client.gleam";class p8 extends z{}class j8 extends z{}class kQ extends z{}class Y8 extends z{}class fQ extends z{constructor(Z,W,J){super();this.did=Z,this.handle=W,this.is_admin=J}}class bZ extends z{constructor(Z,W,J,K,X,V,Q){super();this.cache=Z,this.registry=W,this.route=J,this.time_range=K,this.settings_page_model=X,this.is_backfilling=V,this.auth_state=Q}}class NW extends z{constructor(Z,W,J){super();this[0]=Z,this[1]=W,this[2]=J}}class RK extends z{constructor(Z,W){super();this[0]=Z,this[1]=W}}class jK extends z{constructor(Z,W){super();this[0]=Z,this[1]=W}}class TK extends z{constructor(Z){super();this[0]=Z}}class OK extends z{constructor(Z){super();this[0]=Z}}class AK extends z{constructor(Z){super();this[0]=Z}}class yQ extends z{constructor(Z){super();this[0]=Z}}function C4(Z,W){if(W instanceof NW){let J=W[2];if(J instanceof H){let K=W[0],X=W[1],V=J[0],Q=rV(Z.cache,K,X,V,0),G=qW(Q,Z.registry,(S,y,v)=>{return new NW(S,y,v)},()=>{return 0}),F,M;F=G[0],M=G[1];let U;if(K==="TriggerBackfill")U=!1;else U=Z.is_backfilling;let I=U,N;if(K==="GetCurrentSession"){let S=QK(V);if(S instanceof H){let v=S[0].current_session;if(v instanceof L){let _=v[0];N=new fQ(_.did,_.handle,_.is_admin)}else N=new Y8}else N=new Y8}else N=Z.auth_state;let T=N,R;if(K==="UpdateDomainAuthority")R=mW(Z.settings_page_model,"success","Domain authority updated successfully");else if(K==="UploadLexicons")XK("lexicon-file-input"),R=mW(Z.settings_page_model,"success","Lexicons uploaded successfully");else if(K==="ResetAll"){let S,y=Z.settings_page_model;S=new XW("",y.reset_confirmation,y.selected_file,y.alert),R=mW(S,"success","All data has been reset")}else if(K==="GetSettings"){let S=KW(V);if(S instanceof H){let y=S[0],v=Z.settings_page_model;R=new XW(y.settings.domain_authority,v.reset_confirmation,v.selected_file,v.alert)}else R=Z.settings_page_model}else R=Z.settings_page_model;let C=R,j;if(K==="ResetAll"){let S=R8(F,"GetStatistics",h(Y([]))),y=R8(S,"GetActivityBuckets",h(Y([["range",a(PJ(Z.time_range))]]))),v=R8(y,"GetRecentActivity",h(Y([["hours",WW(24)]]))),_=e(v,"GetSettings",h(Y([])),KW),u;u=_[0];let YZ=qW(u,Z.registry,(FZ,zZ,ZZ)=>{return new NW(FZ,zZ,ZZ)},()=>{return 0}),gZ,_Z;gZ=YZ[0],_Z=YZ[1],j=[gZ,_Z]}else if(K==="UploadLexicons")j=[R8(F,"GetStatistics",h(Y([]))),Y([])];else j=[F,Y([])];let x=j,O,k;O=x[0],k=x[1];let b;if(K==="GetCurrentSession"){let S=Z.route;if(T instanceof Y8)if(S instanceof j8)b=Y([v9("/",new g,new g)]);else b=Y([]);else if(!T.is_admin&&S instanceof j8)b=Y([v9("/",new g,new g)]);else b=Y([])}else b=Y([]);let P=b;return[new bZ(O,Z.registry,Z.route,Z.time_range,C,I,T),jW((()=>{let S=Y([M,k,P]);return dK(S)})())]}else{let K=W[0],X=J[0],V;if(K==="TriggerBackfill")V=!1;else V=Z.is_backfilling;let Q=V,G;if(K==="UpdateDomainAuthority")G=mW(Z.settings_page_model,"error","Error: "+X);else if(K==="UploadLexicons")G=mW(Z.settings_page_model,"error","Error: "+X);else if(K==="ResetAll")G=mW(Z.settings_page_model,"error","Error: "+X);else if(K==="TriggerBackfill")G=mW(Z.settings_page_model,"error","Error: "+X);else G=Z.settings_page_model;let F=G;return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,F,Q,Z.auth_state),lZ()]}}else if(W instanceof RK){let J=W[0],K=W[1],X=nV(Z.cache,J,K),V=mW(Z.settings_page_model,"success","Domain authority updated successfully");return[new bZ(X,Z.registry,Z.route,Z.time_range,V,Z.is_backfilling,Z.auth_state),lZ()]}else if(W instanceof jK){let J=W[0],K=W[1],X=cV(Z.cache,J),V,G=e(X,"GetSettings",h(Y([])),KW)[1];if(G instanceof CW)V=G[0].settings.domain_authority;else V=Z.settings_page_model.domain_authority_input;let F=V,M,U=Z.settings_page_model;M=new XW(F,U.reset_confirmation,U.selected_file,new L(["error","Error: "+K]));let I=M;return[new bZ(X,Z.registry,Z.route,Z.time_range,I,Z.is_backfilling,Z.auth_state),lZ()]}else if(W instanceof TK){let J=W[0],K;if(Z.route instanceof j8)K=wQ(Z.settings_page_model);else K=Z.settings_page_model;let V=K;if(J instanceof p8){let Q=e(Z.cache,"GetStatistics",h(Y([])),u8),G;G=Q[0];let F=e(G,"GetSettings",h(Y([])),KW),M;M=F[0];let U=e(M,"GetActivityBuckets",h(Y([["range",a(PJ(Z.time_range))]])),RJ),I;I=U[0];let N=e(I,"GetRecentActivity",h(Y([["hours",WW(24)]])),oJ),T;T=N[0];let R=qW(T,Z.registry,(x,O,k)=>{return new NW(x,O,k)},()=>{return 0}),C,j;return C=R[0],j=R[1],[new bZ(C,Z.registry,J,Z.time_range,V,Z.is_backfilling,Z.auth_state),jW(j)]}else if(J instanceof j8){let Q,G=Z.auth_state;if(G instanceof Y8)Q=!1;else Q=G.is_admin;if(Q){let M=e(Z.cache,"GetSettings",h(Y([])),KW),U;U=M[0];let I=qW(U,Z.registry,(R,C,j)=>{return new NW(R,C,j)},()=>{return 0}),N,T;return N=I[0],T=I[1],[new bZ(N,Z.registry,J,Z.time_range,V,Z.is_backfilling,Z.auth_state),jW(T)]}else return[Z,v9("/",new g,new g)]}else return[new bZ(Z.cache,Z.registry,J,Z.time_range,V,Z.is_backfilling,Z.auth_state),lZ()]}else if(W instanceof OK){let J=W[0];if(J instanceof e9){let K=J[0],X=h(Y([["range",a(PJ(K))]])),V=e(Z.cache,"GetActivityBuckets",X,RJ),Q;Q=V[0];let G=qW(Q,Z.registry,(U,I,N)=>{return new NW(U,I,N)},()=>{return 0}),F,M;return F=G[0],M=G[1],[new bZ(F,Z.registry,Z.route,K,Z.settings_page_model,Z.is_backfilling,Z.auth_state),jW(M)]}else if(J instanceof Z0){let K=h(Y([])),X=R8(Z.cache,"TriggerBackfill",K),V=e(X,"TriggerBackfill",K,zQ),Q;Q=V[0];let G=qW(Q,Z.registry,(U,I,N)=>{return new NW(U,I,N)},()=>{return 0}),F,M;return F=G[0],M=G[1],[new bZ(F,Z.registry,Z.route,Z.time_range,Z.settings_page_model,!0,Z.auth_state),jW(M)]}else return FK("/graphiql"),[Z,lZ()]}else if(W instanceof AK){let J=W[0];if(J instanceof W0){let K=J[0],X,V=Z.settings_page_model;X=new XW(K,V.reset_confirmation,V.selected_file,new g);let Q=X;return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,Q,Z.is_backfilling,Z.auth_state),lZ()]}else if(J instanceof J0){let K,X=Z.settings_page_model;K=new XW(X.domain_authority_input,X.reset_confirmation,X.selected_file,new g);let V=K,Q=h(Y([["domainAuthority",a(Z.settings_page_model.domain_authority_input)]])),G,M=e(Z.cache,"GetSettings",h(Y([])),KW)[1];if(M instanceof CW)G=M[0].settings.oauth_client_id;else G=new g;let U=G,I=h(Y([["id",a("Settings:singleton")],["domainAuthority",a(Z.settings_page_model.domain_authority_input)],["oauthClientId",KJ(U,a)]])),N=dV(Z.cache,Z.registry,"UpdateDomainAuthority",Q,"Settings:singleton",(C)=>{return I},DQ,(C,j,x)=>{if(j instanceof H)return new RK(C,x);else{let O=j[0];return new jK(C,O)}}),T,R;return T=N[0],R=N[2],[new bZ(T,Z.registry,Z.route,Z.time_range,V,Z.is_backfilling,Z.auth_state),R]}else if(J instanceof K0)return[Z,lZ()];else if(J instanceof X0){q8("[UploadLexicons] Button clicked, creating file effect");let K=aW((X)=>{return q8("[UploadLexicons] Effect running, calling read_file_as_base64"),KK("lexicon-file-input",(V)=>{return q8("[UploadLexicons] Callback received result"),X(new yQ(V))})});return[Z,K]}else if(J instanceof V0){let K=J[0],X,V=Z.settings_page_model;X=new XW(V.domain_authority_input,K,V.selected_file,new g);let Q=X;return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,Q,Z.is_backfilling,Z.auth_state),lZ()]}else{let K=h(Y([["confirm",a(Z.settings_page_model.reset_confirmation)]])),X=R8(Z.cache,"ResetAll",K),V=e(X,"ResetAll",K,UQ),Q;Q=V[0];let G=qW(Q,Z.registry,(T,R,C)=>{return new NW(T,R,C)},()=>{return 0}),F,M;F=G[0],M=G[1];let U,I=Z.settings_page_model;U=new XW(I.domain_authority_input,"",I.selected_file,new g);let N=U;return[new bZ(F,Z.registry,Z.route,Z.time_range,N,Z.is_backfilling,Z.auth_state),jW(M)]}}else{let J=W[0];if(J instanceof H){let K=J[0];q8("[FileRead] Successfully read file, uploading...");let X=h(Y([["zipBase64",a(K)]])),V=R8(Z.cache,"UploadLexicons",X),Q=e(V,"UploadLexicons",X,PQ),G;G=Q[0];let F=qW(G,Z.registry,(R,C,j)=>{return new NW(R,C,j)},()=>{return 0}),M,U;M=F[0],U=F[1];let I,N=Z.settings_page_model;I=new XW(N.domain_authority_input,N.reset_confirmation,new g,N.alert);let T=I;return[new bZ(M,Z.registry,Z.route,Z.time_range,T,Z.is_backfilling,Z.auth_state),jW(U)]}else{let K=J[0];q8("[FileRead] Error reading file: "+K);let X=mW(Z.settings_page_model,"error",K);return[new bZ(Z.cache,Z.registry,Z.route,Z.time_range,X,Z.is_backfilling,Z.auth_state),lZ()]}}}function q4(Z){let W,J=Z.auth_state;if(J instanceof Y8)W=!1;else W=J.is_admin;let K=W;return I6(CQ(Z.cache,Z.time_range,Z.is_backfilling,K),(X)=>{return new OK(X)})}function w4(Z){let W,J=Z.auth_state;if(J instanceof Y8)W=!1;else W=J.is_admin;let K=W;return I6(EQ(Z.cache,Z.settings_page_model,K),(X)=>{return new AK(X)})}function L4(Z){return f(Y([]),Y([f8(Y([D("text-xl font-bold text-zinc-100 mb-4")]),Y([gW("Upload")])),dZ(Y([D("text-zinc-400")]),Y([gW("Upload and manage data")]))]))}function E4(Z){let W,J=Z.auth_state;if(J instanceof Y8)W=new g;else{let{handle:X,is_admin:V}=J;W=new L([X,V])}let K=W;return f(Y([D("bg-zinc-950 text-zinc-300 font-mono min-h-screen")]),Y([f(Y([D("max-w-4xl mx-auto px-6 py-12")]),Y([oV(K),(()=>{let X=Z.route;if(X instanceof p8)return q4(Z);else if(X instanceof j8)return w4(Z);else return L4(Z)})()]))]))}function bQ(Z){let W=Z.path;if(W==="/")return new p8;else if(W==="/settings")return new j8;else if(W==="/upload")return new kQ;else return new p8}function x4(Z){return new TK(bQ(Z))}function k4(Z){let W=xQ()+"/admin/graphql",J=uV(W),K=tV(),X,V=$6();if(V instanceof H){let C=V[0];X=bQ(C)}else X=new p8;let Q=X,G=e(J,"GetCurrentSession",h(Y([])),QK),F;F=G[0];let M;if(Q instanceof p8){let C=e(F,"GetStatistics",h(Y([])),u8),j;j=C[0];let x=e(j,"GetSettings",h(Y([])),KW),O;O=x[0];let k=e(O,"GetActivityBuckets",h(Y([["range",a("ONE_DAY")]])),RJ),b;b=k[0];let P=e(b,"GetRecentActivity",h(Y([["hours",WW(24)]])),oJ),S;S=P[0];let y=qW(S,K,(u,YZ,gZ)=>{return new NW(u,YZ,gZ)},()=>{return 0}),v,_;v=y[0],_=y[1],M=[v,_]}else if(Q instanceof j8){let C=e(F,"GetSettings",h(Y([])),KW),j;j=C[0];let x=qW(j,K,(b,P,S)=>{return new NW(b,P,S)},()=>{return 0}),O,k;O=x[0],k=x[1],M=[O,k]}else M=[F,Y([])];let U=M,I,N;I=U[0],N=U[1];let T=NV(x4),R=jW(B(T,N));return[new bZ(I,K,Q,new m8,LQ(),!1,new Y8),R]}function gQ(){let Z=QV(k4,C4,E4),W=YV(Z,"#app",void 0);if(!(W instanceof H))throw F8("let_assert",S4,"quickslice_client",49,"main","Pattern match failed, no pattern matched the value.",{value:W,start:1226,end:1275,pattern_start:1237,pattern_end:1242});return W}gQ();