@reddb-io/ui 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/build/404.html +10 -10
  2. package/build/_app/immutable/chunks/BT_NlJ9b.js +9 -0
  3. package/build/_app/immutable/chunks/{C7CNScGY.js → BdKYr7lO.js} +1 -1
  4. package/build/_app/immutable/chunks/Br0XzNbS.js +1 -0
  5. package/build/_app/immutable/chunks/{B3FG5fhF.js → BspwW-rP.js} +1 -1
  6. package/build/_app/immutable/chunks/{wBgvmJJD.js → DD7_KB97.js} +1 -1
  7. package/build/_app/immutable/chunks/{BlQXYusA.js → xVmvYz1F.js} +3 -3
  8. package/build/_app/immutable/entry/{app.D8Jp8K7E.js → app.BwQs72pA.js} +2 -2
  9. package/build/_app/immutable/entry/start.Dokw79m9.js +1 -0
  10. package/build/_app/immutable/nodes/{0.BUmcOGPK.js → 0.Bn0HCj5G.js} +1 -1
  11. package/build/_app/immutable/nodes/{1.BY28ghvY.js → 1.C2fTzfSV.js} +1 -1
  12. package/build/_app/immutable/nodes/{10.B0M25chV.js → 10.C6p9_zpN.js} +1 -1
  13. package/build/_app/immutable/nodes/{15.CcKAFOhX.js → 15.CZkgDcbY.js} +1 -1
  14. package/build/_app/version.json +1 -1
  15. package/build/analytics.html +10 -10
  16. package/build/appearance.html +10 -10
  17. package/build/ask.html +10 -10
  18. package/build/cluster.html +10 -10
  19. package/build/collections.html +10 -10
  20. package/build/graph.html +11 -11
  21. package/build/index.html +10 -10
  22. package/build/query.html +10 -10
  23. package/build/redwire-ws-spike.html +10 -10
  24. package/build/security.html +10 -10
  25. package/build/settings.html +10 -10
  26. package/build/shadow-dom-spike.html +11 -11
  27. package/dist/embed/{AnalyticsView-DxVm8C96.js → AnalyticsView-Bq4u563e.js} +4 -4
  28. package/dist/embed/{AnalyticsView-DxVm8C96.js.map → AnalyticsView-Bq4u563e.js.map} +1 -1
  29. package/dist/embed/{RedUiEmbedRoot-kDChueQB.js → RedUiEmbedRoot-C29ndra1.js} +8061 -8051
  30. package/dist/embed/RedUiEmbedRoot-C29ndra1.js.map +1 -0
  31. package/dist/embed/{index-DoXUF64H.js → index-BAYmeM5z.js} +125 -125
  32. package/dist/embed/{index-DoXUF64H.js.map → index-BAYmeM5z.js.map} +1 -1
  33. package/dist/embed/{index-client-BSNcPP6j.js → index-client-Duv8Z53P.js} +2 -2
  34. package/dist/embed/{index-client-BSNcPP6j.js.map → index-client-Duv8Z53P.js.map} +1 -1
  35. package/dist/embed/index.js +1 -1
  36. package/dist/embed/{sigma.esm-DVyBdcK2.js → sigma.esm-Daj5mOac.js} +2 -2
  37. package/dist/embed/{sigma.esm-DVyBdcK2.js.map → sigma.esm-Daj5mOac.js.map} +1 -1
  38. package/package.json +3 -3
  39. package/src/lib/ConnectDropdown.svelte +3 -1
  40. package/src/lib/reddb/client.ts +4 -1
  41. package/build/_app/immutable/chunks/CA0FBK2E.js +0 -1
  42. package/build/_app/immutable/chunks/DUYiW17f.js +0 -9
  43. package/build/_app/immutable/entry/start.D-Hfyjh7.js +0 -1
  44. package/dist/embed/RedUiEmbedRoot-kDChueQB.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reddb-io/ui",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "private": false,
5
5
  "description": "RedDB UI components and standalone web application.",
6
6
  "type": "module",
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@aflsolutions/graphology-communities-leiden": "^1.1.1",
50
- "@reddb-io/ui-kit": "0.4.5",
51
- "@reddb-io/ui-mcp": "0.4.5",
50
+ "@reddb-io/ui-kit": "0.4.6",
51
+ "@reddb-io/ui-mcp": "0.4.6",
52
52
  "@sigma/edge-curve": "^3.1.0",
53
53
  "@sigma/node-border": "^3.0.0",
54
54
  "@tauri-apps/api": "^2.5.0",
@@ -27,6 +27,7 @@
27
27
  }
28
28
 
29
29
  let open = $state(false)
30
+ let signInOpen = $state(false)
30
31
  let url = $state(pickDefaultUrl())
31
32
  let username = $state('')
32
33
  let password = $state('')
@@ -143,6 +144,7 @@
143
144
  error = connection.probe.error
144
145
  status = 'error'
145
146
  open = true
147
+ if (error.includes('HTTP 401')) signInOpen = true
146
148
  }
147
149
  })
148
150
 
@@ -225,7 +227,7 @@
225
227
 
226
228
  <div class="mb-2 text-[10px] font-mono text-fg-3">URL or Base64-encoded URL · reachable here: {supportedHint}</div>
227
229
 
228
- <details class="mb-3">
230
+ <details class="mb-3" bind:open={signInOpen}>
229
231
  <summary class="cursor-pointer text-xs text-fg-2">Sign in to the database</summary>
230
232
  <div class="grid gap-2 mt-2">
231
233
  <label class="text-xs text-fg-2" for="connect-username">Username</label>
@@ -430,7 +430,10 @@ export class RedClient {
430
430
 
431
431
  if (!res.ok) {
432
432
  const body = await res.text().catch(() => "");
433
- const message = `${verb} ${path} → ${res.status} ${body.slice(0, 200)}`;
433
+ const message =
434
+ res.status === 401
435
+ ? "Database credentials required (HTTP 401). Sign in with a database username and password."
436
+ : `${verb} ${path} → ${res.status} ${body.slice(0, 200)}`;
434
437
  devConsole.record({
435
438
  kind: "http",
436
439
  verb,
@@ -1 +0,0 @@
1
- var tt=e=>{throw TypeError(e)};var Dt=(e,t,n)=>t.has(e)||tt("Cannot "+n);var y=(e,t,n)=>(Dt(e,t,"read from private field"),n?n.call(e):t.get(e)),A=(e,t,n)=>t.has(e)?tt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);import{bR as qe,bz as T,at as I,bm as P,bH as _e,bt as Vt}from"./CGFL56WJ.js";import{a as nt}from"./Btd6PFkC.js";class Be{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ke{constructor(t,n){try{new Headers({location:n})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(n)}: this string contains characters that cannot be used in HTTP headers`)}this.status=t,this.location=n}}class Me extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function qt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function Bt(e){return e.split("%25").map(decodeURI).join("%25")}function Kt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function Pe({href:e}){return e.split("#")[0]}function j(){}function Mt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;function Ht(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const Ft=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:(t==null?void 0:t.method)||"GET")!=="GET"&&Y.delete(He(e)),Ft(e,t));const Y=new Map;function Gt(e,t){const n=He(e,t),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:a,...o}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&Y.set(n,{body:a,init:o,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=Ht(a)),Promise.resolve(new Response(a,o))}return window.fetch(e,t)}function Wt(e,t,n){if(Y.size>0){const r=He(e,n),a=Y.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n==null?void 0:n.cache))return new Response(a.body,a.init);Y.delete(r)}}return window.fetch(t,n)}function He(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t!=null&&t.headers||t!=null&&t.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Mt(...a)}"]`}return r}const zt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,Jt=/^\/\((?:[^)]+)\)$/;function Yt(e){const t=[];return{pattern:e==="/"||Jt.test(e)?/^\/$/:new RegExp(`^${Qt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return t.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return Oe(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return Oe(String.fromCharCode(...l.slice(2).split("-").map(m=>parseInt(m,16))));const u=zt.exec(l),[,h,_,p,f]=u;return t.push({name:p,matcher:f,optional:!!h,rest:!!_,chained:_?c===1&&s[0]==="":!1}),_?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return Oe(l)}).join("")}).join("")}/?$`),params:t}}function Xt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Qt(e){return e.slice(1).split("/").filter(Xt)}function Zt(e,t,n){const r={},a=e.slice(1),o=a.filter(i=>i!==void 0);let s=0;for(let i=0;i<t.length;i+=1){const l=t[i];let c=a[i-s];if(l.chained&&l.rest&&s&&(c=a.slice(i-s,i+1).filter(u=>u).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const u=t[i+1],h=a[i+1];u&&!u.rest&&u.optional&&h&&l.chained&&(s=0),!u&&!h&&Object.keys(r).length===o.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function Oe(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function en({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([i,[l,c,u]])=>{const{pattern:h,params:_}=Yt(i),p={id:i,exec:f=>{const m=h.exec(f);if(m)return Zt(m,_,r)},errors:[1,...u||[]].map(f=>e[f]),layouts:[0,...c||[]].map(s),leaf:o(l)};return p.errors.length=p.layouts.length=Math.max(p.errors.length,p.layouts.length),p});function o(i){const l=i<0;return l&&(i=~i),[l,e[i]]}function s(i){return i===void 0?i:[a.has(i),e[i]]}}function mt(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function rt(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}var ut;const U=((ut=globalThis.__sveltekit_1koaveh)==null?void 0:ut.base)??"";var dt;const tn=((dt=globalThis.__sveltekit_1koaveh)==null?void 0:dt.assets)??U??"",nn="1792730156968",_t="sveltekit:snapshot",wt="sveltekit:scroll",vt="sveltekit:states",rn="sveltekit:pageurl",H="sveltekit:history",Q="sveltekit:navigation",q={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Le=location.origin;function Fe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function B(){return{x:pageXOffset,y:pageYOffset}}function M(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const at={...q,"":q.hover};function yt(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function bt(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=yt(e)}}function je(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const i=location.hash.split("#")[1]||"/";r.hash=`#${i}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,o=!r||!!a||Ue(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=(r==null?void 0:r.origin)===Le&&e.hasAttribute("download");return{url:r,external:o,target:a,download:s}}function we(e){let t=null,n=null,r=null,a=null,o=null,s=null,i=e;for(;i&&i!==document.documentElement;)r===null&&(r=M(i,"preload-code")),a===null&&(a=M(i,"preload-data")),t===null&&(t=M(i,"keepfocus")),n===null&&(n=M(i,"noscroll")),o===null&&(o=M(i,"reload")),s===null&&(s=M(i,"replacestate")),i=yt(i);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:at[r??"off"],preload_data:at[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(o),replace_state:l(s)}}function ot(e){const t=qe(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function o(s){let i;return t.subscribe(l=>{(i===void 0||n&&l!==i)&&s(i=l)})}return{notify:r,set:a,subscribe:o}}const kt={v:j};function an(){const{set:e,subscribe:t}=qe(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${tn}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==nn;return s&&(e(!0),kt.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function Ue(e,t,n){return e.origin!==Le||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function Pn(e){}const Et=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Et];const on=new Set([...Et]);[...on];function sn(e){return e.filter(t=>t!=null)}function ge(e,t){return e+"/"+t}function Ge(e){return e instanceof Be||e instanceof Me?e.status:500}function ln(e){return e instanceof Me?e.text:"Internal Error"}let x,Z,$e;const cn=nt.toString().includes("$$")||/function \w+\(\) \{\}/.test(nt.toString()),st="a:";var ae,oe,se,ie,le,ce,fe,ue,ht,de,pt,he,gt;cn?(x={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(st)},Z={current:null},$e={current:!1}):(x=new(ht=class{constructor(){A(this,ae,T({}));A(this,oe,T(null));A(this,se,T(null));A(this,ie,T({}));A(this,le,T({id:null}));A(this,ce,T({}));A(this,fe,T(-1));A(this,ue,T(new URL(st)))}get data(){return I(y(this,ae))}set data(t){P(y(this,ae),t)}get form(){return I(y(this,oe))}set form(t){P(y(this,oe),t)}get error(){return I(y(this,se))}set error(t){P(y(this,se),t)}get params(){return I(y(this,ie))}set params(t){P(y(this,ie),t)}get route(){return I(y(this,le))}set route(t){P(y(this,le),t)}get state(){return I(y(this,ce))}set state(t){P(y(this,ce),t)}get status(){return I(y(this,fe))}set status(t){P(y(this,fe),t)}get url(){return I(y(this,ue))}set url(t){P(y(this,ue),t)}},ae=new WeakMap,oe=new WeakMap,se=new WeakMap,ie=new WeakMap,le=new WeakMap,ce=new WeakMap,fe=new WeakMap,ue=new WeakMap,ht),Z=new(pt=class{constructor(){A(this,de,T(null))}get current(){return I(y(this,de))}set current(t){P(y(this,de),t)}},de=new WeakMap,pt),$e=new(gt=class{constructor(){A(this,he,T(!1))}get current(){return I(y(this,he))}set current(t){P(y(this,he),t)}},he=new WeakMap,gt),kt.v=()=>$e.current=!0);function St(e){Object.assign(x,e)}const fn=new Set(["icon","shortcut icon","apple-touch-icon"]);let z=null;const D=mt(wt)??{},ee=mt(_t)??{},N={url:ot({}),page:ot({}),navigating:qe(null),updated:an()};function We(e){D[e]=B()}function un(e,t){let n=e+1;for(;D[n];)delete D[n],n+=1;for(n=t+1;ee[n];)delete ee[n],n+=1}function te(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(j)}async function Rt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(U||"/");e&&await e.update()}}let ze,Ne,ve,O,De,E;const ye=[],be=[];let v=null;function ke(){var e;(e=v==null?void 0:v.fork)==null||e.then(t=>t==null?void 0:t.discard()),v=null}const me=new Map,xt=new Set,dn=new Set,X=new Set;let w={branch:[],error:null,url:null},Lt=!1,Ee=!1,it=!0,ne=!1,J=!1,Ut=!1,Je=!1,At,k,L,C;const Se=new Set,lt=new Map,ct=new Map;async function jn(e,t,n){var o,s,i,l;globalThis.__sveltekit_1koaveh&&(globalThis.__sveltekit_1koaveh.query,globalThis.__sveltekit_1koaveh.prerender),document.URL!==location.href&&(location.href=location.href),E=e,await((s=(o=e.hooks).init)==null?void 0:s.call(o)),ze=en(e),O=document.documentElement,De=t,Ne=e.nodes[0],ve=e.nodes[1],Ne(),ve(),k=(i=history.state)==null?void 0:i[H],L=(l=history.state)==null?void 0:l[Q],k||(k=L=Date.now(),history.replaceState({...history.state,[H]:k,[Q]:L},""));const r=D[k];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Rn(De,n)):(await F({type:"enter",url:Fe(E.hash?Un(new URL(location.href)):location.href),replace_state:!0}),a()),Sn()}function hn(){ye.length=0,Je=!1}function Tt(e){be.some(t=>t==null?void 0:t.snapshot)&&(ee[e]=be.map(t=>{var n;return(n=t==null?void 0:t.snapshot)==null?void 0:n.capture()}))}function It(e){var t;(t=ee[e])==null||t.forEach((n,r)=>{var a,o;(o=(a=be[r])==null?void 0:a.snapshot)==null||o.restore(n)})}function ft(){We(k),rt(wt,D),Tt(L),rt(_t,ee)}async function Pt(e,t,n,r){let a,o;t.invalidateAll&&ke(),await F({type:"goto",url:Fe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{if(t.invalidateAll){Je=!0,a=new Set;for(const[s,i]of lt)for(const l of i.keys())a.add(ge(s,l));o=new Set;for(const[s,i]of ct)for(const l of i.keys())o.add(ge(s,l))}t.invalidate&&t.invalidate.forEach(En)}}),t.invalidateAll&&_e().then(_e).then(()=>{for(const[s,i]of lt)for(const[l,{resource:c}]of i)a!=null&&a.has(ge(s,l))&&c.refresh();for(const[s,i]of ct)for(const[l,{resource:c}]of i)o!=null&&o.has(ge(s,l))&&c.reconnect()})}async function pn(e){if(e.id!==(v==null?void 0:v.id)){ke();const t={};Se.add(t),v={id:e.id,token:t,promise:$t({...e,preload:t}).then(n=>(Se.delete(t),n.type==="loaded"&&n.state.error&&ke(),n)),fork:null}}return v.promise}async function Ce(e){var n;const t=(n=await Ae(e,!1))==null?void 0:n.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(r=>r[1]()))}async function Ot(e,t,n){var a;const r={params:w.params,route:{id:((a=w.route)==null?void 0:a.id)??null},url:new URL(location.href)};if(w={...e.state,nav:r},St(e.props.page),At=new E.root({target:t,props:{...e.props,stores:N,components:be},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),It(L),n){const o={from:null,to:{...r,scroll:D[k]??B()},willUnload:!1,type:"enter",complete:Promise.resolve()};X.forEach(s=>s(o))}Ee=!0}async function Re({url:e,params:t,branch:n,errors:r,status:a,error:o,route:s,form:i}){let l="never";if(U&&(e.pathname===U||e.pathname===U+"/"))l="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(l=f.slash);e.pathname=qt(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:o,route:s},props:{constructors:sn(n).map(f=>f.node.component),page:et(x)}};i!==void 0&&(c.props.form=i);let u={},h=!x,_=0;for(let f=0;f<Math.max(n.length,w.branch.length);f+=1){const m=n[f],d=w.branch[f];(m==null?void 0:m.data)!==(d==null?void 0:d.data)&&(h=!0),m&&(u={...u,...m.data},h&&(c.props[`data_${_}`]=u),_+=1)}return(!w.url||e.href!==w.url.href||w.error!==o||i!==void 0&&i!==x.form||h)&&(c.props.page={error:o,params:t,route:{id:(s==null?void 0:s.id)??null},state:{},status:a,url:new URL(e),form:i??null,data:h?u:x.data}),c}async function Ye({loader:e,parent:t,url:n,params:r,route:a,server_data_node:o}){var c,u;let s=null;const i={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:o,universal:(c=l.universal)!=null&&c.load?{type:"data",data:s,uses:i}:null,data:s??(o==null?void 0:o.data)??null,slash:((u=l.universal)==null?void 0:u.trailingSlash)??(o==null?void 0:o.slash)}}function gn(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const o=Ee?Wt(r,a.href,t):Gt(r,t);return{resolved:a,promise:o}}function mn(e,t,n,r,a,o){if(Je)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(o[s]!==w.params[s])return!0;for(const s of a.dependencies)if(ye.some(i=>i(new URL(s))))return!0;return!1}function Xe(e,t){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?t??null:null}function _n(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),o=t.searchParams.getAll(r);a.every(s=>o.includes(s))&&o.every(s=>a.includes(s))&&n.delete(r)}return n}function wn({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:et(x),constructors:[]}}}async function $t({id:e,invalidating:t,url:n,params:r,route:a,preload:o}){if((v==null?void 0:v.id)===e)return Se.delete(v.token),v.promise;const{errors:s,layouts:i,leaf:l}=a,c=[...i,l];s.forEach(d=>d==null?void 0:d().catch(j)),c.forEach(d=>d==null?void 0:d[1]().catch(j));const u=w.url?e!==xe(w.url):!1,h=w.route?a.id!==w.route.id:!1,_=_n(w.url,n);let p=!1;const f=c.map(async(d,g)=>{var $;if(!d)return;const b=w.branch[g];return d[1]===(b==null?void 0:b.loader)&&!mn(p,h,u,_,($=b.universal)==null?void 0:$.uses,r)?b:(p=!0,Ye({loader:d[1],url:n,params:r,route:a,parent:async()=>{var pe;const V={};for(let K=0;K<g;K+=1)Object.assign(V,(pe=await f[K])==null?void 0:pe.data);return V},server_data_node:Xe(d[0]?{type:"skip"}:null,d[0]?b==null?void 0:b.server:void 0)}))});for(const d of f)d.catch(j);const m=[];for(let d=0;d<c.length;d+=1)if(c[d])try{m.push(await f[d])}catch(g){if(g instanceof Ke)return{type:"redirect",location:g.location};if(Se.has(o))return wn({error:await re(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let b=Ge(g),R;if(g instanceof Be)R=g.body;else{if(await N.updated.check())return await Rt(),await te(n);R=await re(g,{params:r,url:n,route:{id:a.id}})}const $=await vn(d,m,s);return $?Re({url:n,params:r,branch:m.slice(0,$.idx).concat($.node),errors:s,status:b,error:R,route:a}):await jt(n,{id:a.id},R,b)}else m.push(void 0);return Re({url:n,params:r,branch:m,errors:s,status:200,error:null,route:a,form:t?void 0:null})}async function vn(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Qe({status:e,error:t,url:n,route:r}){const a={};let o=null;try{const s=await Ye({loader:Ne,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Xe(o)}),i={node:await ve(),loader:ve,universal:null,server:null,data:null};return Re({url:n,params:a,branch:[s,i],status:e,error:t,errors:[],route:null})}catch(s){if(s instanceof Ke)return Pt(new URL(s.location,location.href),{},0);throw s}}async function yn(e){const t=e.href;if(me.has(t))return me.get(t);let n;try{const r=(async()=>{let a=await E.hooks.reroute({url:new URL(e),fetch:async(o,s)=>gn(o,s,e).promise})??e;if(typeof a=="string"){const o=new URL(e);E.hash?o.hash=a:o.pathname=a,a=o}return a})();me.set(t,r),n=await r}catch{me.delete(t);return}return n}async function Ae(e,t){if(e&&!Ue(e,U,E.hash)){const n=await yn(e);if(!n)return;const r=bn(n);for(const a of ze){const o=a.exec(r);if(o)return{id:xe(e),invalidating:t,route:a,params:Kt(o),url:e}}}}function bn(e){return Bt(E.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(U.length))||"/"}function xe(e){return(E.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function Ct({url:e,type:t,intent:n,delta:r,event:a,scroll:o}){let s=!1;const i=Ze(w,n,e,t,o??null);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const l={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return ne||xt.forEach(c=>c(l)),s?null:i}async function F({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:o,state:s={},redirect_count:i=0,nav_token:l={},accept:c=j,block:u=j,event:h}){var K;const _=C;C=l;const p=await Ae(t,!1),f=e==="enter"?Ze(w,p,t,e):Ct({url:t,type:e,delta:n==null?void 0:n.delta,intent:p,scroll:n==null?void 0:n.scroll,event:h});if(!f){u(),C===l&&(C=_);return}const m=k,d=L;c(),ne=!0,Ee&&f.navigation.type!=="enter"&&N.navigating.set(Z.current=f.navigation);let g=p&&await $t(p);if(!g){if(Ue(t,U,E.hash))return await te(t,o);g=await jt(t,{id:null},await re(new Me(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,o)}if(t=(p==null?void 0:p.url)||t,C!==l)return f.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(i<20){await F({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:o,state:s,redirect_count:i+1,nav_token:l}),f.fulfil(void 0);return}g=await Qe({status:500,error:await re(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await N.updated.check()&&(await Rt(),await te(t,o));if(hn(),We(m),Tt(d),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const S=o?0:1,G={[H]:k+=S,[Q]:L+=S,[vt]:s};(o?history.replaceState:history.pushState).call(history,G,"",t),o||un(k,L)}const b=p&&(v==null?void 0:v.id)===p.id?v.fork:null;v!=null&&v.fork&&!b&&ke(),v=null,g.props.page.state=s;let R;if(Ee){const S=(await Promise.all(Array.from(dn,W=>W(f.navigation)))).filter(W=>typeof W=="function");if(S.length>0){let W=function(){S.forEach(Ie=>{X.delete(Ie)})};S.push(W),S.forEach(Ie=>{X.add(Ie)})}const G=f.navigation.to;w={...g.state,nav:{params:G.params,route:G.route,url:G.url}},g.props.page&&(g.props.page.url=t);const Te=b&&await b;Te?R=Te.commit():(z=null,At.$set(g.props),z&&Object.assign(g.props.page,z),St(g.props.page),R=(K=Vt)==null?void 0:K()),Ut=!0}else await Ot(g,De,!1);const{activeElement:$}=document;if(await R,await _e(),await _e(),C!==l)return f.reject(new Error("navigation aborted")),!1;g.props.page&&z&&Object.assign(g.props.page,z);let V=null;if(it){const S=n?n.scroll:a?B():null;S?scrollTo(S.x,S.y):(V=t.hash&&document.getElementById(Nt(t)))?V.scrollIntoView():scrollTo(0,0)}const pe=document.activeElement!==$&&document.activeElement!==document.body;!r&&!pe&&Ln(t,!V),it=!0,ne=!1,e==="popstate"&&It(L),f.fulfil(void 0),f.navigation.to&&(f.navigation.to.scroll=B()),X.forEach(S=>S(f.navigation)),N.navigating.set(Z.current=null)}async function jt(e,t,n,r,a){return e.origin===Le&&e.pathname===location.pathname&&!Lt?await Qe({status:r,error:n,url:e,route:t}):await te(e,a)}function kn(){let e,t={element:void 0,href:void 0},n;O.addEventListener("mousemove",i=>{const l=i.target;clearTimeout(e),e=setTimeout(()=>{o(l,q.hover)},20)});function r(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}O.addEventListener("mousedown",r),O.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(i=>{for(const l of i)l.isIntersecting&&(Ce(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function o(i,l){const c=bt(i,O),u=c===t.element&&(c==null?void 0:c.href)===t.href&&l>=n;if(!c||u)return;const{url:h,external:_,download:p}=je(c,U,E.hash);if(_||p)return;const f=we(c),m=h&&xe(w.url)===xe(h);if(!(f.reload||m))if(l<=f.preload_data){t={element:c,href:c.href},n=q.tap;const d=await Ae(h,!1);if(!d)return;pn(d)}else l<=f.preload_code&&(t={element:c,href:c.href},n=l,Ce(h))}function s(){a.disconnect();for(const i of O.querySelectorAll("a")){const{url:l,external:c,download:u}=je(i,U,E.hash);if(c||u)continue;const h=we(i);h.reload||(h.preload_code===q.viewport&&a.observe(i),h.preload_code===q.eager&&Ce(l))}}X.add(s),s()}function re(e,t){if(e instanceof Be)return e.body;const n=Ge(e),r=ln(e);return E.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Nn(e,t={}){return e=new URL(Fe(e)),e.origin!==Le?Promise.reject(new Error("goto: invalid URL")):Pt(e,t,0)}function En(e){if(typeof e=="function")ye.push(e);else{const{href:t}=new URL(e,location.href);ye.push(n=>n.href===t)}}function Sn(){var t,n;history.scrollRestoration="manual",addEventListener("beforeunload",r=>{let a=!1;if(ft(),!ne){const o=Ze(w,void 0,null,"leave"),s={...o.navigation,cancel:()=>{a=!0,o.reject(new Error("navigation cancelled"))}};xt.forEach(i=>i(s))}a?(r.preventDefault(),r.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&ft()}),!((t=navigator.connection)!=null&&t.saveData)&&!/2g/.test((n=navigator.connection)==null?void 0:n.effectiveType)&&kn(),O.addEventListener("click",async r=>{if(r.button||r.which!==1||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.defaultPrevented)return;const a=bt(r.composedPath()[0],O);if(!a)return;const{url:o,external:s,target:i,download:l}=je(a,U,E.hash);if(!o)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=we(a);if(!(a instanceof SVGAElement)&&o.protocol!==location.protocol&&!(o.protocol==="https:"||o.protocol==="http:")||l)return;const[h,_]=(E.hash?o.hash.replace(/^#/,""):o.href).split("#"),p=h===Pe(location);if(s||c.reload&&(!p||!_)){Ct({url:o,type:"link",event:r})?ne=!0:r.preventDefault();return}if(_!==void 0&&p){const[,f]=w.url.href.split("#");if(f===_){if(r.preventDefault(),_===""||_==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const m=a.ownerDocument.getElementById(decodeURIComponent(_));m&&(m.scrollIntoView(),m.focus())}return}if(J=!0,We(k),e(o),!c.replace_state)return;J=!1}r.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await F({type:"link",url:o,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??o.href===location.href,event:r})}),O.addEventListener("submit",r=>{if(r.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(r.target),o=r.submitter;if(((o==null?void 0:o.formTarget)||a.target)==="_blank"||((o==null?void 0:o.formMethod)||a.method)!=="get")return;const l=new URL((o==null?void 0:o.hasAttribute("formaction"))&&(o==null?void 0:o.formAction)||a.action);if(Ue(l,U,!1))return;const c=r.target,u=we(c);if(u.reload)return;r.preventDefault(),r.stopPropagation();const h=new FormData(c,o);l.search=new URLSearchParams(h).toString(),F({type:"form",url:l,keepfocus:u.keepfocus,noscroll:u.noscroll,replace_state:u.replace_state??l.href===location.href,event:r})}),addEventListener("popstate",async r=>{var a;if(!Ve){if((a=r.state)!=null&&a[H]){const o=r.state[H];if(C={},o===k)return;const s=D[o],i=r.state[vt]??{},l=new URL(r.state[rn]??location.href),c=r.state[Q],u=w.url?Pe(location)===Pe(w.url):!1;if(c===L&&(Ut||u)){i!==x.state&&(x.state=i),e(l),D[k]=B(),s&&scrollTo(s.x,s.y),k=o;return}const _=o-k;await F({type:"popstate",url:l,popped:{state:i,scroll:s,delta:_},accept:()=>{k=o,L=c},block:()=>{history.go(-_)},nav_token:C,event:r})}else if(!J){const o=new URL(location.href);e(o),E.hash&&location.reload()}}}),addEventListener("hashchange",()=>{J&&(J=!1,history.replaceState({...history.state,[H]:++k,[Q]:L},"",location.href))});for(const r of document.querySelectorAll("link"))fn.has(r.rel)&&(r.href=r.href);addEventListener("pageshow",r=>{r.persisted&&N.navigating.set(Z.current=null)});function e(r){w.url=x.url=r,N.page.set(et(x)),N.page.notify()}}async function Rn(e,{status:t=200,error:n,node_ids:r,params:a,route:o,server_route:s,data:i,form:l}){Lt=!0;const c=new URL(location.href);let u;({params:a={},route:o={id:null}}=await Ae(c,!1)||{}),u=ze.find(({id:p})=>p===o.id);let h,_=!0;try{const p=r.map(async(m,d)=>{const g=i[d];return g!=null&&g.uses&&(g.uses=xn(g.uses)),Ye({loader:E.nodes[m],url:c,params:a,route:o,parent:async()=>{const b={};for(let R=0;R<d;R+=1)Object.assign(b,(await p[R]).data);return b},server_data_node:Xe(g)})}),f=await Promise.all(p);if(u){const m=u.layouts;for(let d=0;d<m.length;d++)m[d]||f.splice(d,0,void 0)}h=await Re({url:c,params:a,branch:f,status:t,error:n,errors:u==null?void 0:u.errors,form:l,route:u??null})}catch(p){if(p instanceof Ke){await te(new URL(p.location,location.href));return}h=await Qe({status:Ge(p),error:await re(p,{url:c,params:a,route:o}),url:c,route:o}),e.textContent="",_=!1}finally{}h.props.page&&(h.props.page.state={}),await Ot(h,e,_)}function xn(e){return{dependencies:new Set((e==null?void 0:e.dependencies)??[]),params:new Set((e==null?void 0:e.params)??[]),parent:!!(e!=null&&e.parent),route:!!(e!=null&&e.route),url:!!(e!=null&&e.url),search_params:new Set((e==null?void 0:e.search_params)??[])}}let Ve=!1;function Ln(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=Nt(e);if(r&&document.getElementById(r)){const{x:o,y:s}=B();setTimeout(()=>{const i=history.state;Ve=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(i,"",e),t&&scrollTo(o,s),Ve=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const o=[];for(let s=0;s<a.rangeCount;s+=1)o.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===o.length){for(let s=0;s<a.rangeCount;s+=1){const i=o[s],l=a.getRangeAt(s);if(i.commonAncestorContainer!==l.commonAncestorContainer||i.startContainer!==l.startContainer||i.endContainer!==l.endContainer||i.startOffset!==l.startOffset||i.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ze(e,t,n,r,a=null){var c,u;let o,s;const i=new Promise((h,_)=>{o=h,s=_});return i.catch(j),{navigation:{from:{params:e.params,route:{id:((c=e.route)==null?void 0:c.id)??null},url:e.url,scroll:B()},to:n&&{params:(t==null?void 0:t.params)??null,route:{id:((u=t==null?void 0:t.route)==null?void 0:u.id)??null},url:n,scroll:a},willUnload:!t,type:r,complete:i},fulfil:o,reject:s}}function et(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Un(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Nt(e){let t;if(E.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{N as a,U as b,Nn as g,Pn as l,x as p,jn as s};