UNPKG

mongoku

Version:

[![CI](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml/badge.svg)](https://github.com/huggingface/Mongoku/actions/workflows/ci.yml)

2 lines (1 loc) 8.91 kB
import{o as A}from"./C6P2UOyZ.js";import{e as w,aa as q,b as f,g as d,d as h}from"./IwGwbOe7.js";const p=[];function T(e,t=w){let r=null;const n=new Set;function s(a){if(q(e,a)&&(e=a,r)){const i=!p.length;for(const c of n)c[1](),p.push(c,e);if(i){for(let c=0;c<p.length;c+=2)p[c][0](p[c+1]);p.length=0}}}function l(a){s(a(e))}function o(a,i=w){const c=[a,i];return n.add(c),n.size===1&&(r=t(s,l)||w),a(e),()=>{n.delete(c),n.size===0&&r&&(r(),r=null)}}return{set:s,update:l,subscribe:o}}new URL("sveltekit-internal://");function ee(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function te(e){return e.split("%25").map(decodeURI).join("%25")}function ne(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function re({href:e}){return e.split("#")[0]}function se(e,t,r,n=!1){const s=new URL(e);Object.defineProperty(s,"searchParams",{value:new Proxy(s.searchParams,{get(o,a){if(a==="get"||a==="getAll"||a==="has")return(c,...u)=>(r(c),o[a](c,...u));t();const i=Reflect.get(o,a);return typeof i=="function"?i.bind(o):i}}),enumerable:!0,configurable:!0});const l=["href","pathname","search","toString","toJSON"];n&&l.push("hash");for(const o of l)Object.defineProperty(s,o,{get(){return t(),e[o]},enumerable:!0,configurable:!0});return s}function W(){}function G(...e){let t=5381;for(const r of e)if(typeof r=="string"){let n=r.length;for(;n;)t=t*33^r.charCodeAt(--n)}else if(ArrayBuffer.isView(r)){const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let s=n.length;for(;s;)t=t*33^n[--s]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}const ae=new TextEncoder;function oe(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function V(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}const z=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&b.delete(R(e)),z(e,t));const b=new Map;function ie(e,t){const r=R(e,t),n=document.querySelector(r);if(n?.textContent){n.remove();let{body:s,...l}=JSON.parse(n.textContent);const o=n.getAttribute("data-ttl");return o&&b.set(r,{body:s,init:l,ttl:1e3*Number(o)}),n.getAttribute("data-b64")!==null&&(s=V(s)),Promise.resolve(new Response(s,l))}return window.fetch(e,t)}function ce(e,t,r){if(b.size>0){const n=R(e,r),s=b.get(n);if(s){if(performance.now()<s.ttl&&["default","force-cache","only-if-cached",void 0].includes(r?.cache))return new Response(s.body,s.init);b.delete(n)}}return window.fetch(t,r)}function R(e,t){let n=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const s=[];t.headers&&s.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&s.push(t.body),n+=`[data-hash="${G(...s)}"]`}return n}const Y=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function le(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${U(e).map(n=>{const s=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(n);if(s)return t.push({name:s[1],matcher:s[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const l=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(n);if(l)return t.push({name:l[1],matcher:l[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!n)return;const o=n.split(/\[(.+?)\](?!\])/);return"/"+o.map((i,c)=>{if(c%2){if(i.startsWith("x+"))return v(String.fromCharCode(parseInt(i.slice(2),16)));if(i.startsWith("u+"))return v(String.fromCharCode(...i.slice(2).split("-").map(P=>parseInt(P,16))));const u=Y.exec(i),[,_,m,j,L]=u;return t.push({name:j,matcher:L,optional:!!_,rest:!!m,chained:m?c===1&&o[0]==="":!1}),m?"([^]*?)":_?"([^/]*)?":"([^/]+?)"}return v(i)}).join("")}).join("")}/?$`),params:t}}function B(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function U(e){return e.slice(1).split("/").filter(B)}function ue(e,t,r){const n={},s=e.slice(1),l=s.filter(a=>a!==void 0);let o=0;for(let a=0;a<t.length;a+=1){const i=t[a];let c=s[a-o];if(i.chained&&i.rest&&o&&(c=s.slice(a-o,a+1).filter(u=>u).join("/"),o=0),c===void 0)if(i.rest)c="";else continue;if(!i.matcher||r[i.matcher](c)){n[i.name]=c;const u=t[a+1],_=s[a+1];u&&!u.rest&&u.optional&&_&&i.chained&&(o=0),!u&&!_&&Object.keys(n).length===l.length&&(o=0);continue}if(i.optional&&i.chained){o++;continue}return}if(!o)return n}function v(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const D=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function fe(e,t){const r=U(e),n=e!="/"&&e.endsWith("/");return"/"+r.map(s=>s.replace(D,(l,o,a,i)=>{const c=t[i];if(!c){if(o||a&&c!==void 0)return"";throw new Error(`Missing parameter '${i}' in route ${e}`)}if(c.startsWith("/")||c.endsWith("/"))throw new Error(`Parameter '${i}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return c})).filter(Boolean).join("/")+(n?"/":"")}const H=globalThis.__sveltekit_ohx1vj?.base??"",K=globalThis.__sveltekit_ohx1vj?.assets??H??"",de="_app",F="1780063932090",he="sveltekit:snapshot",pe="sveltekit:scroll",ge="sveltekit:states",_e="sveltekit:pageurl",be="sveltekit:history",me="sveltekit:navigation",$={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},O=location.origin;function we(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const r=document.getElementsByTagName("base");t=r.length?r[0].href:document.URL}return new URL(e,t)}function ve(){return{x:pageXOffset,y:pageYOffset}}function g(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const x={...$,"":$.hover};function I(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function ye(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=I(e)}}function Se(e,t,r){let n;try{if(n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),r&&n.hash.match(/^#[^/]/)){const a=location.hash.split("#")[1]||"/";n.hash=`#${a}${n.hash}`}}catch{}const s=e instanceof SVGAElement?e.target.baseVal:e.target,l=!n||!!s||J(n,t,r)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),o=n?.origin===O&&e.hasAttribute("download");return{url:n,external:l,target:s,download:o}}function Re(e){let t=null,r=null,n=null,s=null,l=null,o=null,a=e;for(;a&&a!==document.documentElement;)n===null&&(n=g(a,"preload-code")),s===null&&(s=g(a,"preload-data")),t===null&&(t=g(a,"keepfocus")),r===null&&(r=g(a,"noscroll")),l===null&&(l=g(a,"reload")),o===null&&(o=g(a,"replacestate")),a=I(a);function i(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:x[n??"off"],preload_data:x[s??"off"],keepfocus:i(t),noscroll:i(r),reload:i(l),replace_state:i(o)}}function Ae(e){const t=T(e);let r=!0;function n(){r=!0,t.update(o=>o)}function s(o){r=!1,t.set(o)}function l(o){let a;return t.subscribe(i=>{(a===void 0||r&&i!==a)&&o(a=i)})}return{notify:n,set:s,subscribe:l}}const C={v:W};function $e(){const{set:e,subscribe:t}=T(!1);let r;async function n(){clearTimeout(r);try{const s=await fetch(`${K}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!s.ok)return!1;const o=(await s.json()).version!==F;return o&&(e(!0),C.v(),clearTimeout(r)),o}catch{return!1}}return{subscribe:t,check:n}}function J(e,t,r){return e.origin!==O||!e.pathname.startsWith(t)?!0:r?e.pathname!==location.pathname:!1}function xe(e){}const N=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...N];const M=new Set([...N]);[...M];let S,E,y;const X=A.toString().includes("$$")||/function \w+\(\) \{\}/.test(A.toString()),k="a:";X?(S={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(k)},E={current:null},y={current:!1}):(S=new class{#e=f({});get data(){return d(this.#e)}set data(t){h(this.#e,t)}#t=f(null);get form(){return d(this.#t)}set form(t){h(this.#t,t)}#n=f(null);get error(){return d(this.#n)}set error(t){h(this.#n,t)}#r=f({});get params(){return d(this.#r)}set params(t){h(this.#r,t)}#s=f({id:null});get route(){return d(this.#s)}set route(t){h(this.#s,t)}#a=f({});get state(){return d(this.#a)}set state(t){h(this.#a,t)}#o=f(-1);get status(){return d(this.#o)}set status(t){h(this.#o,t)}#i=f(new URL(k));get url(){return d(this.#i)}set url(t){h(this.#i,t)}},E=new class{#e=f(null);get current(){return d(this.#e)}set current(t){h(this.#e,t)}},y=new class{#e=f(!1);get current(){return d(this.#e)}set current(t){h(this.#e,t)}},C.v=()=>y.current=!0);function Ue(e){Object.assign(S,e)}export{$ as A,te as B,he as C,ce as D,ie as E,pe as F,xe as G,be as H,me as N,_e as P,ge as S,E as a,H as b,de as c,le as d,ue as e,oe as f,$e as g,we as h,J as i,ye as j,Se as k,Re as l,re as m,W as n,Ae as o,S as p,ne as q,fe as r,ve as s,ae as t,se as u,F as v,T as w,ee as x,O as y,Ue as z};