@bquery/bquery 1.9.0 → 1.10.0
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.
- package/README.md +181 -25
- package/dist/{a11y-_9X-kt-_.js → a11y-DG2i4iZN.js} +3 -3
- package/dist/{a11y-_9X-kt-_.js.map → a11y-DG2i4iZN.js.map} +1 -1
- package/dist/a11y.es.mjs +1 -1
- package/dist/{component-L3-JfOFz.js → component-DRotf1hl.js} +19 -18
- package/dist/{component-L3-JfOFz.js.map → component-DRotf1hl.js.map} +1 -1
- package/dist/component.es.mjs +1 -1
- package/dist/concurrency/errors.d.ts +29 -0
- package/dist/concurrency/errors.d.ts.map +1 -0
- package/dist/concurrency/high-level.d.ts +85 -0
- package/dist/concurrency/high-level.d.ts.map +1 -0
- package/dist/concurrency/index.d.ts +19 -0
- package/dist/concurrency/index.d.ts.map +1 -0
- package/dist/concurrency/internal.d.ts +26 -0
- package/dist/concurrency/internal.d.ts.map +1 -0
- package/dist/concurrency/pipeline.d.ts +30 -0
- package/dist/concurrency/pipeline.d.ts.map +1 -0
- package/dist/concurrency/pool.d.ts +48 -0
- package/dist/concurrency/pool.d.ts.map +1 -0
- package/dist/concurrency/reactive.d.ts +107 -0
- package/dist/concurrency/reactive.d.ts.map +1 -0
- package/dist/concurrency/rpc.d.ts +46 -0
- package/dist/concurrency/rpc.d.ts.map +1 -0
- package/dist/concurrency/support.d.ts +23 -0
- package/dist/concurrency/support.d.ts.map +1 -0
- package/dist/concurrency/task.d.ts +31 -0
- package/dist/concurrency/task.d.ts.map +1 -0
- package/dist/concurrency/types.d.ts +343 -0
- package/dist/concurrency/types.d.ts.map +1 -0
- package/dist/concurrency-BU1wPEsZ.js +826 -0
- package/dist/concurrency-BU1wPEsZ.js.map +1 -0
- package/dist/concurrency.es.mjs +29 -0
- package/dist/{constraints-D5RHQLmP.js → constraints-CqjhmpZC.js} +1 -1
- package/dist/{constraints-D5RHQLmP.js.map → constraints-CqjhmpZC.js.map} +1 -1
- package/dist/core-CongXJuo.js +87 -0
- package/dist/core-CongXJuo.js.map +1 -0
- package/dist/{custom-directives-Dr4C5lVV.js → custom-directives-BjFzFhuf.js} +1 -1
- package/dist/{custom-directives-Dr4C5lVV.js.map → custom-directives-BjFzFhuf.js.map} +1 -1
- package/dist/{devtools-BhB2iDPT.js → devtools-C5FExMwv.js} +2 -2
- package/dist/{devtools-BhB2iDPT.js.map → devtools-C5FExMwv.js.map} +1 -1
- package/dist/devtools.es.mjs +1 -1
- package/dist/{dnd-NwZBYh4l.js → dnd-BAqzPlSo.js} +1 -1
- package/dist/{dnd-NwZBYh4l.js.map → dnd-BAqzPlSo.js.map} +1 -1
- package/dist/dnd.es.mjs +1 -1
- package/dist/effect-Cc51IH91.js +87 -0
- package/dist/effect-Cc51IH91.js.map +1 -0
- package/dist/{env-CTdvLaH2.js → env-PvwYHnJq.js} +1 -1
- package/dist/{env-CTdvLaH2.js.map → env-PvwYHnJq.js.map} +1 -1
- package/dist/{forms-UhAeJEoO.js → forms-Dx1Scvh0.js} +41 -40
- package/dist/{forms-UhAeJEoO.js.map → forms-Dx1Scvh0.js.map} +1 -1
- package/dist/forms.es.mjs +1 -1
- package/dist/full.d.ts +2 -0
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +243 -214
- package/dist/full.iife.js +117 -33
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +117 -33
- package/dist/full.umd.js.map +1 -1
- package/dist/{i18n-kuF6Ekj6.js → i18n-Cazyk9RD.js} +3 -3
- package/dist/{i18n-kuF6Ekj6.js.map → i18n-Cazyk9RD.js.map} +1 -1
- package/dist/i18n.es.mjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.mjs +270 -241
- package/dist/media/observers.d.ts.map +1 -1
- package/dist/{media-D4zLj9t-.js → media-dAKIGPk3.js} +3 -3
- package/dist/{media-D4zLj9t-.js.map → media-dAKIGPk3.js.map} +1 -1
- package/dist/media.es.mjs +1 -1
- package/dist/{motion-BJsAuULb.js → motion-BBMso9Ir.js} +1 -1
- package/dist/{motion-BJsAuULb.js.map → motion-BBMso9Ir.js.map} +1 -1
- package/dist/motion.es.mjs +1 -1
- package/dist/{mount-B-JvH6Y0.js → mount-C8O2vXkQ.js} +10 -9
- package/dist/{mount-B-JvH6Y0.js.map → mount-C8O2vXkQ.js.map} +1 -1
- package/dist/{platform-Dw2gE3zI.js → platform-BPHIXbw8.js} +17 -16
- package/dist/{platform-Dw2gE3zI.js.map → platform-BPHIXbw8.js.map} +1 -1
- package/dist/platform.es.mjs +1 -1
- package/dist/{plugin-C2WuC8SF.js → plugin-DjTqWg-P.js} +2 -2
- package/dist/{plugin-C2WuC8SF.js.map → plugin-DjTqWg-P.js.map} +1 -1
- package/dist/plugin.es.mjs +1 -1
- package/dist/reactive/watch.d.ts.map +1 -1
- package/dist/reactive/websocket.d.ts +6 -3
- package/dist/reactive/websocket.d.ts.map +1 -1
- package/dist/{reactive-BjpLkclt.js → reactive-BAd2hfl8.js} +436 -449
- package/dist/reactive-BAd2hfl8.js.map +1 -0
- package/dist/reactive.es.mjs +42 -40
- package/dist/readonly-C0ZwS1Tf.js +35 -0
- package/dist/readonly-C0ZwS1Tf.js.map +1 -0
- package/dist/{registry-B08iilIh.js → registry-Cr6VH8CR.js} +1 -1
- package/dist/{registry-B08iilIh.js.map → registry-Cr6VH8CR.js.map} +1 -1
- package/dist/{router-BieVwgci.js → router-CCepRMpC.js} +29 -28
- package/dist/{router-BieVwgci.js.map → router-CCepRMpC.js.map} +1 -1
- package/dist/router.es.mjs +1 -1
- package/dist/{ssr-CrGSJySz.js → ssr-D-1IPcfw.js} +4 -4
- package/dist/{ssr-CrGSJySz.js.map → ssr-D-1IPcfw.js.map} +1 -1
- package/dist/ssr.es.mjs +1 -1
- package/dist/{store-CY6sjTW3.js → store-CjmEeX9-.js} +6 -6
- package/dist/{store-CY6sjTW3.js.map → store-CjmEeX9-.js.map} +1 -1
- package/dist/store.es.mjs +2 -2
- package/dist/{testing-UjAtu9aQ.js → testing-TdfaL7VE.js} +7 -7
- package/dist/{testing-UjAtu9aQ.js.map → testing-TdfaL7VE.js.map} +1 -1
- package/dist/testing.es.mjs +1 -1
- package/dist/{untrack-D0fnO5k2.js → untrack-bjWDNdyE.js} +11 -10
- package/dist/{untrack-D0fnO5k2.js.map → untrack-bjWDNdyE.js.map} +1 -1
- package/dist/view.es.mjs +12 -11
- package/package.json +17 -13
- package/src/concurrency/errors.ts +57 -0
- package/src/concurrency/high-level.ts +387 -0
- package/src/concurrency/index.ts +63 -0
- package/src/concurrency/internal.ts +100 -0
- package/src/concurrency/pipeline.ts +133 -0
- package/src/concurrency/pool.ts +450 -0
- package/src/concurrency/reactive.ts +339 -0
- package/src/concurrency/rpc.ts +380 -0
- package/src/concurrency/support.ts +44 -0
- package/src/concurrency/task.ts +318 -0
- package/src/concurrency/types.ts +431 -0
- package/src/full.ts +65 -0
- package/src/index.ts +3 -0
- package/src/media/observers.ts +5 -8
- package/src/reactive/watch.ts +10 -9
- package/src/reactive/websocket.ts +31 -8
- package/dist/core-DdtZHzsS.js +0 -168
- package/dist/core-DdtZHzsS.js.map +0 -1
- package/dist/reactive-BjpLkclt.js.map +0 -1
package/dist/full.iife.js
CHANGED
|
@@ -1,10 +1,94 @@
|
|
|
1
|
-
var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Module"});var Vt="bquery-sanitizer",is=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),Wt=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),as=new Set(["document","window","location","top","self","parent","frames","history","navigator","screen","alert","confirm","prompt","eval","function","cookie","domain","referrer","body","head","forms","images","links","scripts","children","parentnode","firstchild","lastchild","innerhtml","outerhtml","textcontent"]),ls=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),cs=["on","formaction","xlink:","xmlns:"],Kt=["javascript:","data:","vbscript:","file:"],us=(e,t,r)=>{const n=e.toLowerCase();for(const s of cs)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},fs=e=>{const t=e.toLowerCase().trim();return!as.has(t)},ds=e=>e.replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Yt=e=>{const t=ds(e);for(const r of Kt)if(t.startsWith(r))return!1;return!0},hs=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!Yt(n))return!1}return!0},ms=e=>{try{const t=e.trim();if(t.startsWith("//"))return!0;const r=t.toLowerCase();return/^[a-z][a-z0-9+.-]*:/i.test(t)&&!r.startsWith("http://")&&!r.startsWith("https://")?!0:!r.startsWith("http://")&&!r.startsWith("https://")?!1:typeof window>"u"||!window.location?!0:new URL(t,window.location.href).origin!==window.location.origin}catch{return!0}},ps=e=>new DOMParser().parseFromString(e,"text/html"),Gt=e=>{const t=(typeof e=="string"?e:String(e??"")).trim(),r=document.createDocumentFragment();if(t.length===0)return r;if(!(t.includes("<")||t.includes(">")))return r.appendChild(document.createTextNode(t)),r;const n=ps(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},Ke=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:o=!1}=t,i=new Set([...is,...r.map(f=>f.toLowerCase())].filter(f=>!Wt.has(f))),a=new Set([...ls,...n.map(f=>f.toLowerCase())]),l=Gt(e);if(o)return l.textContent??"";const c=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),u=[];for(;c.nextNode();){const f=c.currentNode,m=f.tagName.toLowerCase();if(Wt.has(m)){u.push(f);continue}if(!i.has(m)){u.push(f);continue}const g=[];for(const b of Array.from(f.attributes)){const v=b.name.toLowerCase();if(!us(v,a,s)){g.push(b.name);continue}if((v==="id"||v==="name")&&!fs(b.value)){g.push(b.name);continue}if((v==="href"||v==="src"||v==="action")&&!Yt(b.value)){g.push(b.name);continue}v==="srcset"&&!hs(b.value)&&g.push(b.name)}for(const b of g)f.removeAttribute(b);if(m==="a"){const b=f.getAttribute("href"),v=f.getAttribute("target")?.toLowerCase()==="_blank",w=b&&ms(b);if(v||w){const E=f.getAttribute("rel"),T=new Set(E?E.split(/\s+/).filter(Boolean):[]);T.add("noopener"),T.add("noreferrer"),f.setAttribute("rel",Array.from(T).join(" "))}}}for(const f of u)f.remove();const h=f=>{const m=document.createElement("div");return m.appendChild(f.cloneNode(!0)),m.innerHTML},d=h(l),p=h(Gt(d));return d!==p?l.textContent??"":p},Jt=Symbol("bquery.trusted-html.brand"),ft=Symbol("bquery.trusted-html"),Xt=e=>e,vs=e=>{const t=String(e);return Object.freeze({[Jt]:!0,[ft]:t,toString:()=>t})},ys=e=>typeof e=="object"&&e!==null&&Jt in e&&ft in e,gs=e=>e[ft],Zt=1024,er=8192,bs=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>Zt)throw new RangeError(`generateNonce length must not exceed ${Zt}`);if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function")throw new Error("generateNonce requires crypto.getRandomValues (not available in this environment)");if(typeof globalThis.btoa!="function")throw new Error("generateNonce requires btoa (not available in this environment)");const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let r="";for(let n=0;n<t.length;n+=er){const s=t.subarray(n,Math.min(n+er,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ws=e=>{if(typeof document>"u")return!1;const t=document.querySelector('meta[http-equiv="Content-Security-Policy"]');return t?(t.getAttribute("content")??"").includes(e):!1},Ye=null,tr=!1,Es=()=>typeof window<"u"&&typeof window.trustedTypes<"u",rr=()=>{if(Ye)return Ye;if(tr||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;tr=!0;try{return Ye=e.trustedTypes.createPolicy(Vt,{createHTML:t=>Ke(t)}),Ye}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${Vt}": ${r}`),null}},Ss=e=>{const t=rr();return t?t.createHTML(e):Ke(e)},J=(e,t={})=>Xt(Ke(e,t)),nr=e=>{const t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return e.replace(/[&<>"'`]/g,r=>t[r])},As=e=>Ke(e,{stripAllTags:!0}),sr=e=>Array.isArray(e)?e:[e],q=(e,t)=>{for(const r of e)t(r)},de=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},Ge=(e,t)=>de(e)?t==="width"?e.clientWidth:e.clientHeight:0,Je=(e,t,r)=>{if(!de(e))return 0;const n=t==="width"?e.offsetWidth:e.offsetHeight;if(!r)return n;const s=e.ownerDocument?.defaultView;if(!s||typeof s.getComputedStyle!="function")return n;const o=s.getComputedStyle(e),i=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(i)?0:i,c=Number.isNaN(a)?0:a;return n+l+c},or=e=>J(e),Cs=(e,t)=>{e.innerHTML=J(t)},ir=e=>{const t=document.createElement("template");return t.innerHTML=J(e),t.content.firstElementChild??document.createElement("div")},ar=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,J(t));return}const n=sr(t);q(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function he(e){return Object.prototype.toString.call(e)==="[object Object]"}function x(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ks(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function me(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))x(n)||(he(s)&&he(t[n])?t[n]=me(t[n],s):t[n]=s);return t}function Os(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function Ts(e,t){const r={...e};for(const n of t)delete r[n];return r}function Ls(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var $s=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},lr=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!$s(n))continue;const s=n.name;if(!(!s||n.disabled||x(s))){if(n.tagName.toLowerCase()==="input"){const o=n,i=o.type.toLowerCase();if(i==="checkbox"||i==="radio"){o.checked&&t.push([s,o.value]);continue}if(i==="file"||i==="submit"||i==="button"||i==="reset"||i==="image")continue;t.push([s,o.value]);continue}if(n.tagName.toLowerCase()==="select"){const o=n;if(o.multiple)for(const i of Array.from(o.selectedOptions))t.push([s,i.value]);else t.push([s,o.value]);continue}t.push([s,n.value])}}return t},cr=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())x(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:lr(e)}catch{}return lr(e)},pe=class Qt{constructor(t){this.element=t,this.delegatedHandlers=new Map}get raw(){return this.element}get node(){return this.element}addClass(...t){return this.element.classList.add(...t),this}removeClass(...t){return this.element.classList.remove(...t),this}toggleClass(t,r){return this.element.classList.toggle(t,r),this}attr(t,r){return r===void 0?this.element.getAttribute(t)??"":(this.element.setAttribute(t,r),this)}removeAttr(t){return this.element.removeAttribute(t),this}toggleAttr(t,r){const n=this.element.hasAttribute(t);return r??!n?this.element.setAttribute(t,""):this.element.removeAttribute(t),this}prop(t,r){return r===void 0?this.element[t]:(this.element[t]=r,this)}data(t,r){const n=t.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`);return r===void 0?this.element.getAttribute(`data-${n}`)??"":(this.element.setAttribute(`data-${n}`,r),this)}text(t){return t===void 0?this.element.textContent??"":(this.element.textContent=t,this)}html(t){return Cs(this.element,t),this}htmlUnsafe(t){return this.element.innerHTML=t,this}css(t,r){if(typeof t=="string"){if(r!==void 0)return this.element.style.setProperty(t,r),this;const n=this.element.ownerDocument?.defaultView;return!n||typeof n.getComputedStyle!="function"?"":n.getComputedStyle(this.element).getPropertyValue(t)}for(const[n,s]of Object.entries(t))this.element.style.setProperty(n,s);return this}append(t){return this.insertContent(t,"beforeend"),this}prepend(t){return this.insertContent(t,"afterbegin"),this}before(t){return this.insertContent(t,"beforebegin"),this}after(t){return this.insertContent(t,"afterend"),this}wrap(t){const r=typeof t=="string"?document.createElement(t):t;return this.element.parentNode?.insertBefore(r,this.element),r.appendChild(this.element),this}unwrap(){const t=this.element.parentElement;return t&&t.parentNode&&(t.parentNode.insertBefore(this.element,t),t.remove()),this}replaceWith(t){const r=typeof t=="string"?ir(t):t;return this.element.replaceWith(r),new Qt(r)}detach(){return this.remove()}index(){const t=this.element.parentElement;return t?Array.from(t.children).indexOf(this.element):-1}contents(){return Array.from(this.element.childNodes)}offsetParent(){return de(this.element)?this.element.offsetParent:null}position(){if(!de(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}innerWidth(){return Ge(this.element,"width")}innerHeight(){return Ge(this.element,"height")}outerWidth(t=!1){return Je(this.element,"width",t)}outerHeight(t=!1){return Je(this.element,"height",t)}scrollTo(t={behavior:"smooth"}){return this.element.scrollIntoView(t),this}remove(){return this.element.remove(),this}empty(){return this.element.innerHTML="",this}clone(t=!0){return new Qt(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(r=>r!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,r){return this.element.addEventListener(t,r),this}once(t,r){return this.element.addEventListener(t,r,{once:!0}),this}off(t,r){return this.element.removeEventListener(t,r),this}trigger(t,r){return this.element.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0})),this}delegate(t,r,n){const s=`${t}:${r}`,o=i=>{const a=i.target.closest(r);a&&this.element.contains(a)&&n(i,a)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,o),this.element.addEventListener(t,o),this}undelegate(t,r,n){const s=`${t}:${r}`,o=this.delegatedHandlers.get(s);if(o){const i=o.get(n);i&&(this.element.removeEventListener(t,i),o.delete(n),o.size===0&&this.delegatedHandlers.delete(s))}return this}matches(t){return this.element.matches(t)}is(t){return this.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const r=this.element.style.display==="none";return t??r?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const r=this.element;return t===void 0?r.value??"":(r.value=t,this)}serialize(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return{};const r=Object.create(null);for(const[n,s]of cr(t))if(Object.prototype.hasOwnProperty.call(r,n)){const o=r[n];Array.isArray(o)?o.push(s):r[n]=[o,s]}else r[n]=s;return r}serializeString(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return"";const r=new URLSearchParams;for(const[n,s]of cr(t))r.append(n,s);return r.toString()}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,r){ar(this.element,t,r)}},Xe=class G{constructor(t){this.elements=t,this.delegatedHandlers=new WeakMap}get length(){return this.elements.length}first(){return this.elements[0]}eq(t){const r=this.elements[t];return r?new pe(r):void 0}firstEl(){return this.eq(0)}lastEl(){return this.eq(this.elements.length-1)}each(t){return this.elements.forEach((r,n)=>{t(new pe(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new G(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new pe(t))}addClass(...t){return q(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return q(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return q(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(q(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return q(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return q(this.elements,n=>{const s=n.hasAttribute(t);r??!s?n.setAttribute(t,""):n.removeAttribute(t)}),this}text(t){return t===void 0?this.first()?.textContent??"":(q(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=or(t);return q(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return q(this.elements,r=>{r.innerHTML=t}),this}append(t){return this.insertAll(t,"beforeend"),this}prepend(t){return this.insertAll(t,"afterbegin"),this}before(t){return this.insertAll(t,"beforebegin"),this}after(t){return this.insertAll(t,"afterend"),this}css(t,r){if(typeof t=="string"){if(r!==void 0)return q(this.elements,o=>{o.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return q(this.elements,n=>{for(const[s,o]of Object.entries(t))n.style.setProperty(s,o)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const o=typeof t=="string"?ir(t):s===0?t:t.cloneNode(!0);n.replaceWith(o),r.push(o)}),new G(r)}detach(){return this.remove()}index(){const t=this.first();return t?.parentElement?Array.from(t.parentElement.children).indexOf(t):-1}contents(){return Array.from(this.first()?.childNodes??[])}offsetParent(){const t=this.first();return de(t)?t.offsetParent:null}position(){const t=this.first();return de(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return Ge(this.first(),"width")}innerHeight(){return Ge(this.first(),"height")}outerWidth(t=!1){return Je(this.first(),"width",t)}outerHeight(t=!1){return Je(this.first(),"height",t)}show(t=""){return q(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return q(this.elements,t=>{t.style.display="none"}),this}on(t,r){return q(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return q(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return q(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return q(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return q(this.elements,o=>{const i=l=>{const c=l.target.closest(r);c&&o.contains(c)&&n(l,c)};this.delegatedHandlers.has(o)||this.delegatedHandlers.set(o,new Map);const a=this.delegatedHandlers.get(o);a.has(s)||a.set(s,new Map),a.get(s).set(n,i),o.addEventListener(t,i)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return q(this.elements,o=>{const i=this.delegatedHandlers.get(o);if(!i)return;const a=i.get(s);if(!a)return;const l=a.get(n);l&&(o.removeEventListener(t,l),a.delete(n),a.size===0&&i.delete(s),i.size===0&&this.delegatedHandlers.delete(o))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const o=s.querySelectorAll(t);for(let i=0;i<o.length;i++)r.has(o[i])||(r.add(o[i]),n.push(o[i]))}return new G(n)}closest(t){const r=new Set,n=[];for(const s of this.elements){const o=s.closest(t);o&&!r.has(o)&&(r.add(o),n.push(o))}return new G(n)}parent(){const t=new Set,r=[];for(const n of this.elements){const s=n.parentElement;s&&!t.has(s)&&(t.add(s),r.push(s))}return new G(r)}children(){const t=new Set,r=[];for(const n of this.elements)for(const s of Array.from(n.children))t.has(s)||(t.add(s),r.push(s));return new G(r)}siblings(){const t=new Set(this.elements),r=new Set,n=[];for(const s of this.elements){const o=s.parentElement;if(o)for(const i of Array.from(o.children))!t.has(i)&&!r.has(i)&&(r.add(i),n.push(i))}return new G(n)}next(){const t=new Set,r=[];for(const n of this.elements){const s=n.nextElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new G(r)}prev(){const t=new Set,r=[];for(const n of this.elements){const s=n.previousElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new G(r)}remove(){return q(this.elements,t=>t.remove()),this}empty(){return q(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=or(t);q(this.elements,o=>{o.insertAdjacentHTML(r,s)});return}const n=sr(t);this.elements.forEach((s,o)=>{ar(s,o===0?n:n.map(i=>i.cloneNode(!0)),r)})}},Rs=e=>{if(typeof e!="string")return new pe(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new pe(t)},Ms=e=>Array.isArray(e)?new Xe(e):e instanceof NodeList?new Xe(Array.from(e)):new Xe(Array.from(document.querySelectorAll(e)));function Ds(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ns(e){return Array.from(new Set(e))}function Ps(e,t){if(t<=0)return[];const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Is(e){return e.filter(Boolean)}function _s(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function dt(e,t){let r;return Object.assign((...n)=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e(...n)},t)},{cancel:()=>{r!==void 0&&(clearTimeout(r),r=void 0)}})}function ur(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function qs(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function xs(){}function zs(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function js(e){return new Promise(t=>setTimeout(t,e))}function Fs(e,t){try{return JSON.parse(e)}catch{return t}}function Bs(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function Hs(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Us(e,t,r){return Math.min(Math.max(e,t),r)}function Qs(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function Vs(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function Ws(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Ks(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Ys(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function Gs(e,t,r="…"){if(t<=0)return"";if(e.length<=t)return e;const n=Math.max(0,t-r.length);return`${e.slice(0,n)}${r}`}function Js(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function Xs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zs(e){return typeof Element<"u"&&e instanceof Element}function eo(e){return!!(e&&typeof e=="object"&&"elements"in e)}function to(e){return typeof e=="function"}function ro(e){return typeof e=="string"}function no(e){return typeof e=="number"&&!Number.isNaN(e)}function so(e){return typeof e=="boolean"}function oo(e){return Array.isArray(e)}function io(e){return e instanceof Date}function ke(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function ao(e){return typeof e=="object"&&e!==null}var lo={clone:ks,merge:me,pick:Os,omit:Ts,hasOwn:Ls,debounce:dt,throttle:ur,once:qs,noop:xs,uid:zs,isElement:Zs,isCollection:eo,isEmpty:Bs,isPlainObject:he,isFunction:to,isString:ro,isNumber:no,isBoolean:so,isArray:oo,isDate:io,isPromise:ke,isObject:ao,parseJson:Fs,sleep:js,randomInt:Hs,clamp:Us,inRange:Qs,toNumber:Vs,capitalize:Ws,toKebabCase:Ks,toCamelCase:Ys,truncate:Gs,slugify:Js,escapeRegExp:Xs,ensureArray:Ds,unique:Ns,chunk:Ps,compact:Is,flatten:_s},ve=[],Oe=0,ht=new Set,Ze=new WeakMap,mt=(e,t)=>{ve.push(e);try{return t()}finally{ve.pop()}},fr=()=>ve[ve.length-1],pt=e=>{ve.push(void 0);try{return e()}finally{ve.pop()}},dr=e=>{if(Oe>0){ht.add(e);return}e()},co=()=>{for(const e of Array.from(ht)){ht.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},uo=()=>{Oe+=1},fo=()=>{Oe<=0||(Oe-=1,Oe===0&&co())},hr=(e,t)=>{let r=Ze.get(e);r||(r=new Set,Ze.set(e,r)),r.add(t)},ho=(e,t)=>{const r=Ze.get(e);r&&r.delete(t)},Te=e=>{const t=Ze.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},Le=e=>{uo();try{e()}finally{fo()}},mr={fetch:{headers:{},parseAs:"json"},cookies:{path:"/",sameSite:"Lax",secure:!1},announcer:{politeness:"polite",atomic:!0,delay:16,clearDelay:1e3},pageMeta:{},transitions:{skipOnReducedMotion:!1,classes:[],types:[]},components:{prefix:"bq"}},$e=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>$e(t));if(he(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=$e(n);return t}return e},vt=$e(mr),mo=e=>(vt=$e(me(mr,vt,e)),X()),X=()=>$e(vt),Re=[],et=e=>typeof e=="object"&&e!==null&&"_addDisposer"in e,po=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",vo=e=>{const t=typeof e.constructor=="function"?e.constructor.name:void 0;return typeof e=="function"&&(Symbol.toStringTag in e&&e[Symbol.toStringTag]==="AsyncFunction"||t==="AsyncFunction")},Me=()=>{for(let e=Re.length-1;e>=0;e--)if(Re[e].active)return Re[e]},yo=class{constructor(){this.disposers=[],this._active=!0}get active(){return this._active}_addDisposer(e){this._active&&this.disposers.push(e)}run(e){if(!this._active)throw new Error("bQuery reactive: Cannot run in a stopped effectScope");if(vo(e))throw new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");Re.push(this);try{const t=e();if(po(t))throw this.stop(),new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");return t}finally{Re.pop()}}stop(){if(this._active){this._active=!1;for(let e=this.disposers.length-1;e>=0;e--)try{this.disposers[e]()}catch(t){console.error("bQuery reactive: Error in scope cleanup",t)}this.disposers.length=0}}},go=()=>{const e=new yo,t=Me();return et(t)&&t._addDisposer(()=>e.stop()),e},pr=()=>Me(),vr=e=>{const t=Me();if(!t||!t.active||!et(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},De=class{constructor(e){this.compute=e,this.hasCachedValue=!1,this.dirty=!0,this.disposed=!1,this.subscribers=new Set,this.markDirty=()=>{if(this.disposed)return;this.dirty=!0;const t=Array.from(this.subscribers);for(const r of t)dr(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=pt(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=fr();return e&&(this.subscribers.add(e),hr(e,this)),this.dirty&&(this.dirty=!1,Te(this.markDirty),this.cachedValue=mt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=pt(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,Te(this.markDirty),this.cachedValue=mt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue)}unsubscribe(e){this.subscribers.delete(e)}dispose(){this.disposed=!0,this.dirty&&(this.hasCachedValue=!1),this.dirty=!1,Te(this.markDirty),this.subscribers.clear()}},P=e=>{const t=new De(e),r=Me();return et(r)&&r._addDisposer(()=>t.dispose()),t},z=e=>{let t,r=!1;const n=Me(),s=()=>{if(t){try{t()}catch(l){console.error("bQuery reactive: Error in effect cleanup",l)}t=void 0}},o=()=>{s(),Te(a)},i=()=>{r||(r=!0,o())};et(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),Te(a);try{t=mt(a,e)}catch(l){console.error("bQuery reactive: Error in effect",l)}r&&o()}};return a(),i},Ne=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=fr();return e&&(this.subscribers.add(e),hr(e,this)),this._value}set value(e){if(Object.is(this._value,e))return;this._value=e;const t=Array.from(this.subscribers);for(const r of t)dr(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)ho(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},M=e=>new Ne(e),ae=e=>pt(e),bo=e=>{if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}},wo=e=>typeof e=="function"?e():e.value,yr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Eo=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),So=(e,t)=>e==null||Eo(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),Ao=e=>typeof e=="function"?e():e,Co=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},ko=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return e instanceof URL?new URL(e.toString(),n):new URL(e,n)},Oo=async(e,t)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const r=await e.text();if(r)try{return JSON.parse(r)}catch(n){const s=e.url?` for ${e.url}`:"";throw new Error(`Failed to parse JSON response${s} (status ${e.status}): ${n instanceof Error?n.message:String(n)}`)}},yt=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},To=(e,t,r)=>{const n=t instanceof Request?yt(t.method):void 0;return e??n??(r?"POST":void 0)},Lo=(e,t,r)=>e||(t instanceof Request?void 0:r),$o=e=>{const t=yt(e.method);let r;if(t!=="GET"&&t!=="HEAD"&&!e.bodyUsed)try{r=e.clone().body??void 0}catch{r=void 0}return{method:t,headers:e.headers,body:r,cache:e.cache,credentials:e.credentials,integrity:e.integrity,keepalive:e.keepalive,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,signal:e.signal}},gr=(e,t={})=>{const r=t.immediate??!0,n=M(t.defaultValue),s=M(null),o=M("idle"),i=P(()=>o.value==="pending");let a=0,l=!1,c=()=>{};const u=()=>{a+=1,n.value=t.defaultValue,s.value=null,o.value="idle"},h=()=>{l||(l=!0,a+=1,c())},d=async()=>{if(l)return n.peek();const p=++a;o.value="pending",s.value=null;try{const f=await e(),m=t.transform?t.transform(f):f;return l||p!==a?n.peek():(n.value=m,o.value="success",t.onSuccess?.(m),m)}catch(f){const m=bo(f);return l||p!==a||(s.value=m,o.value="error",t.onError?.(m)),n.peek()}};if(t.watch?.length){let p=!1;c=z(()=>{for(const f of t.watch??[])wo(f);if(!p){p=!0,r&&ae(()=>d());return}ae(()=>d())})}else r&&d();return{data:n,error:s,status:o,pending:i,execute:d,refresh:d,abort:()=>{},clear:u,dispose:h}},Ro=e=>e>=200&&e<300,br=(e,t)=>e instanceof DOMException&&e.name===t,tt=e=>br(e,"TimeoutError"),wr=e=>br(e,"AbortError"),Mo=e=>{if(wr(e)||tt(e)||e.code==="ABORT"||e.code==="TIMEOUT")return!1;const t=e.status;return t===void 0||t>=500},Do=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},No=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),Po=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s=!1,o;const i=()=>{s||(s=!0,clearTimeout(o),t?.removeEventListener("abort",i),n(t?.reason??new DOMException("The operation was aborted.","AbortError")))};o=setTimeout(()=>{s||(s=!0,t?.removeEventListener("abort",i),r())},e),t?.addEventListener("abort",i,{once:!0})}),W=(e,t={})=>{const r=X().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch,o=t.validateStatus??Ro;let i=null;const a=(c,u)=>{const h=u||tt(c)||tt(i?.signal.reason);return Object.assign(new Error(h?`Request timeout of ${t.timeout}ms exceeded`:"Request aborted"),{code:h?"TIMEOUT":"ABORT"})},l=gr(async()=>{const c=Ao(e),u=typeof c=="string"||c instanceof URL?ko(c,t.baseUrl??r?.baseUrl):c instanceof Request&&t.query?new URL(c.url):null;u&&t.query&&Co(u,t.query);const h=yr(r?.headers,c instanceof Request?c.headers:void 0,t.headers),d=t.body!=null,p=yt(t.method),f=To(p,c,d),m=f==="GET"||f==="HEAD"?f:null;if(d&&m)throw new Error(`Cannot send a request body with ${m} requests`);const g=Lo(p,c,f),b=Do(t.retry),v=(b?.count??0)+1,w=new AbortController;i=w;let E,T=!1,A;t.signal&&(t.signal.aborted?w.abort(t.signal.reason):(A=()=>w.abort(t.signal?.reason),t.signal.addEventListener("abort",A,{once:!0}))),t.timeout&&t.timeout>0&&(E=setTimeout(()=>{T=!0,w.abort(new DOMException("Request timeout","TimeoutError"))},t.timeout));const S={...t,method:g,headers:h};delete S.baseUrl,delete S.query,delete S.parseAs,delete S.fetcher,delete S.defaultValue,delete S.immediate,delete S.watch,delete S.transform,delete S.onSuccess,delete S.onError,delete S.timeout,delete S.retry,delete S.validateStatus;let C=u??c;c instanceof Request&&u&&u.toString()!==c.url&&(C=new Request(u.toString(),$o(c)));const R=()=>{const L=new Headers(h);return{...S,headers:L,body:So(t.body,L),signal:w.signal}};if(v>1&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream)throw new Error("Cannot retry requests with ReadableStream bodies");if(v>1&&typeof Request<"u"&&C instanceof Request&&C.body!==null)throw new Error("Cannot retry requests with non-replayable Request bodies");let O;try{for(let L=0;L<v;L++)try{const k=await s(C,R());if(!o(k.status))throw Object.assign(new Error(`Request failed with status ${k.status}`),{response:k,status:k.status,statusText:k.statusText});return await Oo(k,n)}catch(k){const $=k instanceof Error?k:new Error(String(k));if(w.signal.aborted||wr($)||tt($))throw a(w.signal.aborted?w.signal.reason:$,T);if(O=$,!(b&&(b.retryOn??Mo)($,L))||L>=v-1)throw $;await Po(No(b.delay,L),w.signal)}throw O}finally{E!==void 0&&clearTimeout(E),t.signal&&A&&t.signal.removeEventListener("abort",A),i===w&&(i=null)}},t);return l.abort=()=>{i&&i.abort(new DOMException("Request aborted","AbortError"))},l};function Io(e={}){return(t,r={})=>{const n=e,s=me({},n.query??{},r.query??{});return W(t,{...n,...r,headers:yr(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var oe=class extends Error{constructor(e,t,r,n){super(e),this.name="HttpError",this.config=t,this.code=r,this.response=n}};function Er(){const e=[];let t=0;return{use(r,n){const s=t++;return e.push({id:s,fulfilled:r,rejected:n}),s},eject(r){const n=e.findIndex(s=>s?.id===r);n!==-1&&(e[n]=null)},clear(){e.length=0},forEach(r){for(const n of e)n&&r(n)}}}var _o=e=>e>=200&&e<300,qo=e=>{if(e.code==="PARSE")return!1;if(e.code==="TIMEOUT"||e.code==="NETWORK")return!0;const t=e.response?.status;return t!==void 0&&t>=500},xo=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},zo=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),jo=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s;const o=()=>{clearTimeout(s),t?.removeEventListener("abort",o),n(t?.reason??new DOMException("The operation was aborted.","AbortError"))};s=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),t&&t.addEventListener("abort",o,{once:!0})}),Sr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Fo=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),Bo=(e,t)=>e==null||Fo(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),Ho=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},Uo=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return new URL(e,n)},Qo=async(e,t,r)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const n=await e.text();if(n)try{return JSON.parse(n)}catch(s){throw new oe(`Failed to parse JSON response${e.url?` for ${e.url}`:""} (status ${e.status}): ${s instanceof Error?s.message:String(s)}`,r,"PARSE",{data:n,status:e.status,statusText:e.statusText,headers:e.headers,config:r})}},Vo=(e,t)=>{const r=e.body;if(!r)return e;const n=parseInt(e.headers.get("content-length")??"0",10)||0;let s=0;const o=r.getReader(),i=new ReadableStream({async pull(a){const{done:l,value:c}=await o.read();if(l){a.close();return}s+=c.byteLength,t({loaded:s,total:n,percent:n>0?Math.round(s/n*100):void 0}),a.enqueue(c)},cancel(a){o.cancel(a)}});return new Response(i,{status:e.status,statusText:e.statusText,headers:e.headers})},Wo=async e=>{const t=X().fetch,r=e.parseAs??t?.parseAs??"json",n=e.fetcher??fetch,s=e.validateStatus??_o,o=Uo(e.url??"/",e.baseUrl??t?.baseUrl);e.query&&Ho(o,e.query);const i=Sr(t?.headers,e.headers),a=Bo(e.body,i),l={};e.method&&(l.method=e.method.toUpperCase()),l.headers=i,a!=null&&(l.body=a),e.cache&&(l.cache=e.cache),e.credentials&&(l.credentials=e.credentials),e.integrity&&(l.integrity=e.integrity),e.keepalive!==void 0&&(l.keepalive=e.keepalive),e.mode&&(l.mode=e.mode),e.redirect&&(l.redirect=e.redirect),e.referrer&&(l.referrer=e.referrer),e.referrerPolicy&&(l.referrerPolicy=e.referrerPolicy);let c,u=e.signal,h;if(e.timeout&&e.timeout>0){const d=new AbortController;e.signal&&(h=()=>d.abort(e.signal?.reason),e.signal.addEventListener("abort",h,{once:!0})),c=setTimeout(()=>{d.abort(new DOMException("Request timeout","TimeoutError"))},e.timeout),u=d.signal}u&&(l.signal=u);try{let d=await n(o.toString(),l);if(e.onDownloadProgress&&(d=Vo(d,e.onDownloadProgress)),!s(d.status))throw new oe(`Request failed with status ${d.status}`,e,"ERR_BAD_RESPONSE",{data:void 0,status:d.status,statusText:d.statusText,headers:d.headers,config:e});return{data:await Qo(d,r,e),status:d.status,statusText:d.statusText,headers:d.headers,config:e}}catch(d){if(d instanceof oe)throw d;if(d instanceof DOMException&&(d.name==="AbortError"||d.name==="TimeoutError")){const p=d.name==="TimeoutError"||d.message==="Request timeout";throw new oe(p?`Request timeout of ${e.timeout}ms exceeded`:"Request aborted",e,p?"TIMEOUT":"ABORT")}throw new oe(d instanceof Error?d.message:String(d),e,"NETWORK")}finally{c!==void 0&&clearTimeout(c),e.signal&&h&&e.signal.removeEventListener("abort",h)}};function gt(e={}){const t=Er(),r=Er(),n=i=>{const a=me({},e.query??{},i.query??{});return{...e,...i,headers:Sr(e.headers,i.headers),query:Object.keys(a).length>0?a:void 0}},s=async i=>{let a=i;const l=[];t.forEach(d=>l.push(d));for(const{fulfilled:d,rejected:p}of l)try{d&&(a=await d(a))}catch(f){if(p){const m=await p(f);if(he(m))a=m;else throw f}else throw f}const c=xo(a.retry);let u;const h=(c?.count??0)+1;for(let d=0;d<h;d++)try{let p=await Wo(a);const f=[];r.forEach(m=>f.push(m));for(const{fulfilled:m,rejected:g}of f)try{m&&(p=await m(p))}catch(b){if(g){const v=await g(b);if(v&&typeof v=="object"&&"data"in v)p=v;else throw b}else throw b}return p}catch(p){const f=p instanceof oe?p:new oe(p instanceof Error?p.message:String(p),a,"NETWORK");if(u=f,!(c&&(c.retryOn??qo)(f,d))||d>=h-1){const g=[];r.forEach(v=>g.push(v));let b=f;for(const{rejected:v}of g)if(v)try{const w=await v(b);if(w&&typeof w=="object"&&"data"in w)return w;w!=null&&(b=w)}catch(w){w!=null&&(b=w)}throw b instanceof Error||(b=f),b}const m=c?zo(c.delay,d):0;c?.onRetry?.(f,d+1),await jo(m,a.signal)}throw u},o=i=>s(n(i));return{request:o,get:(i,a={})=>o({...a,url:i,method:"GET"}),post:(i,a,l={})=>o({...l,url:i,method:"POST",body:a}),put:(i,a,l={})=>o({...l,url:i,method:"PUT",body:a}),patch:(i,a,l={})=>o({...l,url:i,method:"PATCH",body:a}),delete:(i,a={})=>o({...a,url:i,method:"DELETE"}),head:(i,a={})=>o({...a,url:i,method:"HEAD"}),options:(i,a={})=>o({...a,url:i,method:"OPTIONS"}),interceptors:{request:t,response:r},defaults:e}}var Ko=gt();function Yo(e={}){const{concurrency:t=6}=e;if(!Number.isInteger(t)||t<1)throw new Error("Request queue concurrency must be a positive integer");const r=[];let n=0;const s=()=>{for(;n<t&&r.length>0;){const o=r.shift();n++,Promise.resolve().then(o.execute).then(o.resolve,o.reject).finally(()=>{n--,s()})}};return{add(o){return new Promise((i,a)=>{r.push({execute:o,resolve:i,reject:a}),s()})},get pending(){return n},get size(){return r.length},clear(){const o=r.splice(0);for(const i of o)i.reject(new Error("Request queue cleared"))}}}var Go=(e,t)=>{const r=P(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},Jo=(e,t={})=>{const{initialPage:r=1,...n}=t,s=M(r),o=W(()=>e(s.value),{...n,watch:n.watch});return{...o,page:s,next:async()=>(s.value=s.peek()+1,o.execute()),prev:async()=>{const c=s.peek();return c>1&&(s.value=c-1),o.execute()},goTo:async c=>(s.value=Math.max(1,c),o.execute())}},Xo=(e,t)=>{const{getNextCursor:r,transform:n,initialCursor:s,immediate:o=!0,onSuccess:i,onError:a,...l}=t,c=M([]),u=M(t.defaultValue),h=M(null),d=M("idle"),p=P(()=>d.value==="pending"),f=M(s),m=P(()=>c.value.length===0||f.value!==void 0);let g=!1,b=0;const v=S=>n?n(S):S,w=async()=>{if(g)return u.peek();const S=++b;d.value="pending",h.value=null;try{const C=W(e(f.peek()),{...l,immediate:!1,watch:void 0}),R=await C.execute(),O=C.error.peek();if(C.dispose(),g||S!==b)return u.peek();if(O)return h.value=O,d.value="error",a?.(O),u.peek();if(R!==void 0){const L=R,k=[...c.peek(),L];c.value=k,f.value=r(L,k);const $=v(k);return u.value=$,d.value="success",i?.($),$}return d.value="success",u.peek()}catch(C){if(g||S!==b)return u.peek();const R=C instanceof Error?C:new Error(String(C));return h.value=R,d.value="error",a?.(R),u.peek()}},E=async()=>(c.value=[],f.value=s,u.value=t.defaultValue,h.value=null,d.value="idle",b+=1,w()),T=()=>{b+=1,c.value=[],f.value=s,u.value=t.defaultValue,h.value=null,d.value="idle"},A=()=>{g||(g=!0,b+=1)};return o&&w(),{data:u,pages:c,error:h,status:d,pending:p,hasMore:m,fetchNextPage:w,refresh:E,clear:T,dispose:A}},Zo=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const i=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,a="__test__";try{n.setItem(i,a),n.getItem(i),r=!0}finally{try{n.removeItem(i)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const i=n.getItem(e);i!==null&&(s=JSON.parse(i))}catch{}const o=M(s);return r&&n&&z(()=>{try{n.setItem(e,JSON.stringify(o.value))}catch{}}),o},ei=(e,t)=>{const{interval:r,enabled:n=!0,pauseOnHidden:s=!0,pauseOnOffline:o=!0,immediate:i=!0,...a}=t;if(!Number.isFinite(r)||r<1)throw new Error("Polling interval must be a finite number of at least 1");const l=M(!1),c=M(!1),u=M(!1),h=typeof n=="function"?n:()=>n,d=P(()=>h()&&!l.value&&!(s&&c.value)&&!(o&&u.value)),p=W(e,{...a,immediate:i&&h()});let f,m=[];const g=()=>{b(),f=setInterval(()=>{p.execute()},r)},b=()=>{f!==void 0&&(clearInterval(f),f=void 0)},v=z(()=>{const T=d.value;ae(()=>{T?g():b()})});if(s&&typeof document<"u"){c.value=document.hidden;const T=()=>{c.value=document.hidden};document.addEventListener("visibilitychange",T),m.push(()=>document.removeEventListener("visibilitychange",T))}if(o&&typeof window<"u"){const T=()=>{u.value=!1},A=()=>{u.value=!0};window.addEventListener("online",T),window.addEventListener("offline",A),m.push(()=>{window.removeEventListener("online",T),window.removeEventListener("offline",A)}),u.value=typeof navigator<"u"&&navigator.onLine!==void 0?!navigator.onLine:!1}const w=p.dispose;return{...p,pause:()=>{l.value=!0},resume:()=>{l.value=!1},isActive:d,dispose:()=>{b(),v();for(const T of m)T();m=[],w()}}},Ar=Symbol("bquery.readonlySignal"),Cr=e=>typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,Ar),H=e=>Object.defineProperties({},{value:{get(){return e.value},enumerable:!0},peek:{value(){return e.peek()},enumerable:!0},[Ar]:{value:!0,enumerable:!1,configurable:!1,writable:!1}}),ti=(e,t={})=>{const{optimistic:r=!1,onMutationSuccess:n,onMutationError:s,...o}=t,i=W(e,{...o}),a=M(!1),l=P(()=>a.value);let c=!1;const u=()=>{const g=typeof e=="function"?e():e;return g instanceof URL?g.toString():g},h=()=>{const{defaultValue:g,transform:b,onSuccess:v,onError:w,...E}=o;return E},d=async(g,b,v,w)=>{if(c)return i.data.peek();const E=i.data.peek();r&&w!==void 0&&(i.data.value=w),a.value=!0,i.error.value=null;try{const T=W(u(),{...h(),method:b,body:v??void 0,immediate:!1,watch:void 0}),A=await T.execute(),S=T.error.peek();return T.dispose(),c?i.data.peek():S?(r&&w!==void 0&&(i.data.value=E),i.error.value=S,i.status.value="error",a.value=!1,s?.(S,g),i.data.peek()):(b!=="DELETE"&&A!==void 0&&(i.data.value=A),a.value=!1,i.status.value="success",n?.(A,g),A)}catch(T){if(c)return i.data.peek();r&&w!==void 0&&(i.data.value=E);const A=T instanceof Error?T:new Error(String(T));return i.error.value=A,i.status.value="error",a.value=!1,s?.(A,g),i.data.peek()}},p={fetch:()=>i.execute(),create:g=>d("create","POST",g),update:g=>{const b=i.data.peek();return d("update","PUT",g,r&&b!==void 0?{...b,...g}:void 0)},patch:g=>{const b=i.data.peek();return d("patch","PATCH",g,r&&b!==void 0?{...b,...g}:void 0)},remove:async()=>{await d("remove","DELETE"),!c&&i.error.peek()==null&&(i.data.value=void 0)}},f=i.dispose,m=()=>{c||(c=!0,f())};return{data:i.data,error:i.error,status:i.status,pending:i.pending,isMutating:l,actions:p,refresh:i.execute,clear:i.clear,dispose:m}},ri=(e,t={})=>{const{method:r="POST",...n}=t,s=M(void 0),o=M(null),i=M("idle"),a=P(()=>i.value==="pending");return{data:s,error:o,status:i,pending:a,submit:async u=>{i.value="pending",o.value=null;try{const h=W(e,{...n,method:r,body:u,immediate:!1,watch:void 0}),d=await h.execute(),p=h.error.peek();if(h.dispose(),p){o.value=p,i.value="error";return}return s.value=d,i.value="success",d}catch(h){o.value=h instanceof Error?h:new Error(String(h)),i.value="error";return}},clear:()=>{s.value=void 0,o.value=null,i.value="idle"}}},ni=(e,t={})=>{const r=gt({...t});let n=e;for(;n.endsWith("/");)n=n.slice(0,-1);return{list:s=>r.get(n,s),get:(s,o)=>r.get(`${n}/${encodeURIComponent(String(s))}`,o),create:(s,o)=>r.post(n,s,o),update:(s,o,i)=>r.put(`${n}/${encodeURIComponent(String(s))}`,o,i),patch:(s,o,i)=>r.patch(`${n}/${encodeURIComponent(String(s))}`,o,i),remove:(s,o)=>r.delete(`${n}/${encodeURIComponent(String(s))}`,o),http:r}},si=(e,t={})=>{const{getId:r=v=>v.id,optimistic:n=!1,onMutationSuccess:s,onMutationError:o,...i}=t,a=W(e,{...i}),l=M(!1),c=P(()=>l.value);let u=!1;const h=()=>{const v=typeof e=="function"?e():e;return v instanceof URL?v.toString():v},d=()=>{let v=h();for(;v.endsWith("/");)v=v.slice(0,-1);return v},p=()=>{const{defaultValue:v,transform:w,onSuccess:E,onError:T,...A}=i;return A},f=async(v,w,E,T,A,S)=>{if(!u){n&&A&&A(),l.value=!0,a.error.value=null;try{const C=W(`${d()}${E}`,{...p(),method:w,body:T??void 0,immediate:!1,watch:void 0}),R=await C.execute(),O=C.error.peek();if(C.dispose(),u)return;if(O){n&&S&&S(),a.error.value=O,a.status.value="error",l.value=!1,o?.(O,v);return}return l.value=!1,a.status.value="success",s?.(v),R}catch(C){if(u)return;n&&S&&S();const R=C instanceof Error?C:new Error(String(C));a.error.value=R,a.status.value="error",l.value=!1,o?.(R,v);return}}},m={fetch:()=>a.execute(),add:async v=>{const w=a.data.peek(),E=v,T=w?.length??0,A=await f("add","POST","",v,n?()=>{a.data.value=[...w??[],E]}:void 0,n?()=>{a.data.value=w}:void 0);if(A!==void 0&&!u){const S=a.data.peek()??[];if(n){const C=[...S];T<C.length&&C[T]===E?C[T]=A:C.push(A),a.data.value=C}else a.data.value=[...S,A]}return A},update:async(v,w)=>{const E=a.data.peek(),T=await f("update","PUT",`/${encodeURIComponent(String(v))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===v?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(T!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===v?T:S)}return T},patch:async(v,w)=>{const E=a.data.peek(),T=await f("patch","PATCH",`/${encodeURIComponent(String(v))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===v?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(T!==void 0&&!u){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===v?T:S)}return T},remove:async v=>{const w=a.data.peek();if(await f("remove","DELETE",`/${encodeURIComponent(String(v))}`,void 0,n&&w?()=>{a.data.value=w.filter(E=>r(E)!==v)}:void 0,n?()=>{a.data.value=w}:void 0),!n&&!u&&a.error.peek()==null){const E=a.data.peek()??[];a.data.value=E.filter(T=>r(T)!==v)}}},g=a.dispose,b=()=>{u||(u=!0,g())};return{data:a.data,error:a.error,status:a.status,pending:a.pending,isMutating:c,actions:m,refresh:a.execute,clear:a.clear,dispose:b}},bt=new Map;function oi(e,t){const r=bt.get(e);if(r)return r;const n=t().finally(()=>{bt.delete(e)});return bt.set(e,n),n}var le=e=>e instanceof Ne,Pe=e=>e instanceof De,ii=e=>e instanceof Ne||e instanceof De||Cr(e)?e.value:e,wt=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let o,i=!0;return z(()=>{const a=e.value;if(i){i=!1,o=a,n&&t(a,void 0);return}s(a,o)||(t(a,o),o=a)})},ai=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Number.isFinite(r)?Math.max(0,r):0;let a=!1,l,c;const u=()=>{h.cancel(),a=!1,c=void 0},h=dt(()=>{if(a){try{t(l,c)}catch(p){console.error("bQuery reactive: Error in watchDebounce callback",p)}a=!1,c=void 0}},i);s&&t(e.peek(),void 0);const d=wt(e,(p,f)=>{a||(c=f),l=p,a=!0,h()},{equals:o});return pr()&&vr(u),()=>{d(),u()}},li=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=ur((l,c)=>{t(l,c)},Number.isFinite(r)?Math.max(0,r):0);s&&i(e.peek(),void 0);const a=wt(e,(l,c)=>{i(l,c)},{equals:o});return()=>{a(),i.cancel()}};function kr(e){return e===!1?!1:e===!0||e===void 0?{}:e}var ci=e=>e?e===!0?{}:e:!1,Or=(e,t)=>{const r=t.delay??1e3,n=t.factor??2,s=t.maxDelay??3e4;return Math.min(r*n**e,s)},Tr=(e,t={})=>{const{protocols:r,immediate:n=!0,historySize:s=0,onOpen:o,onMessage:i,onClose:a,onError:l,onReconnect:c}=t,u=t.serialize??(N=>JSON.stringify(N)),h=t.deserialize??(N=>{const B=N.data;if(typeof B=="string")try{return JSON.parse(B)}catch{return B}return B}),d=M("CLOSED"),p=M(void 0),f=M(null),m=M([]),g=M(0),b=M(0),v=M(0),w=P(()=>d.value==="OPEN");let E=null,T=!1,A=!1,S,C,R,O=0,L=!1,k=0;const $=[],D=kr(t.autoReconnect),I=ci(t.heartbeat),j=()=>{if(!I)return;_();const N=I.interval??3e4,B=I.pongTimeout??1e4,V=I.message??"ping";C=setInterval(()=>{E?.readyState===WebSocket.OPEN&&(k=Date.now(),E.send(V),R!==void 0&&clearTimeout(R),R=setTimeout(()=>{E?.close(4e3,"Heartbeat timeout")},B))},N)},_=()=>{C!==void 0&&(clearInterval(C),C=void 0),R!==void 0&&(clearTimeout(R),R=void 0)},Q=()=>{R!==void 0&&(clearTimeout(R),R=void 0),k>0&&(b.value=Date.now()-k,k=0)},se=N=>{if(T||A||!D)return;const B=D.maxAttempts??1/0;if(O>=B||D.shouldReconnect&&!D.shouldReconnect(N,O))return;const V=Or(O,D);S=setTimeout(()=>{O++,g.value=O,L=!0,Ut()},V)},Ce=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},Ht=()=>{if(!E||E.readyState!==WebSocket.OPEN)return;let N=0;for(;N<$.length&&E.readyState===WebSocket.OPEN;N++)E.send($[N]);N>0&&$.splice(0,N)},We=()=>{const N=typeof e=="function"?e():e;return N instanceof URL?N.toString():N},Ut=()=>{if(!T){Ce(),E&&(_(),k=0,E.onopen=null,E.onmessage=null,E.onclose=null,E.onerror=null,(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&E.close(),E=null),A=!1,d.value="CONNECTING",f.value=null;try{E=new WebSocket(We(),r)}catch{d.value="CLOSED";return}E.onopen=N=>{d.value="OPEN";const B=L,V=O;O=0,g.value=0,L=!1,Ht(),j(),o?.(N),B&&c?.(V)},E.onmessage=N=>{if(I){const V=I.responseMessage;(V===void 0||N.data===V)&&Q()}const B=h(N);if(p.value=B,s>0){const V=[...m.peek(),B];m.value=V.length>s?V.slice(-s):V}i?.(B,N)},E.onclose=N=>{d.value="CLOSED",_(),A||(v.value=Date.now()),a?.(N),!A&&!T&&se(N)},E.onerror=N=>{f.value=N,l?.(N)}}},ss=(N,B)=>{A=!0,Ce(),_(),E&&(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&(d.value="CLOSING",E.close(N,B))},$u=N=>{T||os(u(N))},os=N=>{T||(E?.readyState===WebSocket.OPEN?E.send(N):$.push(N))},Ru=()=>{T||(T=!0,ss(),$.length=0,E=null)};return n&&Ut(),{status:d,data:p,error:f,history:m,isConnected:w,reconnectAttempts:g,latency:b,lastDisconnectedAt:v,send:$u,sendRaw:os,open:Ut,close:ss,dispose:Ru}},ui=(e,t={},r={})=>{const n=r.getChannel??(u=>u.channel),s=r.wrap??((u,h)=>({channel:u,data:h})),o=new Map,i=new Map,a=Tr(e,{...t,onMessage:(u,h)=>{const d=n(u);if(d!==void 0){const p=o.get(d);p&&(p.value=u)}t.onMessage?.(u,h)}});return{subscribe:u=>{let h=o.get(u);h||(h=M(void 0),o.set(u,h)),i.set(u,(i.get(u)??0)+1);let d=!1;return{data:h,unsubscribe:()=>{if(d)return;d=!0;const p=(i.get(u)??1)-1;p<=0?(i.delete(u),o.delete(u)):i.set(u,p)}}},publish:(u,h)=>{a.send(s(u,h))},ws:a}},fi=(e,t={})=>{const{immediate:r=!0,events:n=[],eventSourceInit:s,onOpen:o,onMessage:i,onError:a}=t,l=t.deserialize??(L=>{try{return JSON.parse(L)}catch{return L}}),c=M("CLOSED"),u=M(void 0),h=M(void 0),d=M(null),p=P(()=>c.value==="OPEN"),f=kr(t.autoReconnect);let m=null,g=!1,b=!1,v,w=0;const E=()=>{const L=typeof e=="function"?e():e;return L instanceof URL?L.toString():L},T=L=>k=>{const $=l(k.data);u.value=$,h.value=L,i?.($,k)},A=()=>{v!==void 0&&(clearTimeout(v),v=void 0)},S=()=>{if(g||b||!f)return;const L=f.maxAttempts??1/0;if(w>=L)return;const k=Or(w,f);v=setTimeout(()=>{w++,C()},k)},C=()=>{if(!g){A(),m&&(m.close(),m=null),b=!1,c.value="CONNECTING",d.value=null;try{m=new EventSource(E(),s)}catch{c.value="CLOSED";return}m.onopen=L=>{c.value="OPEN",w=0,o?.(L)},m.onerror=L=>{d.value=L,a?.(L),m?.readyState===EventSource.CLOSED&&(c.value="CLOSED",!b&&!g&&S())},m.addEventListener("message",T("message"));for(const L of n)m.addEventListener(L,T(L))}},R=()=>{b=!0,A(),m&&(m.close(),m=null),c.value="CLOSED"},O=()=>{g||(g=!0,R())};return r&&C(),{status:c,data:u,eventName:h,error:d,isConnected:p,open:C,close:R,dispose:O}},di=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const o=r.prototype!==void 0&&r.prototype!==null,i=(o?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=o&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(i||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const c=n(e);if(c===void 0&&o)try{return Reflect.construct(s,[e])}catch{return c}return c}catch(c){if(c instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(c.message))return Reflect.construct(s,[e]);throw c}}return e},Et=()=>{try{const e=globalThis;if(typeof e.__BQUERY_DEV__=="boolean")return e.__BQUERY_DEV__;const t=e.process?.env?.NODE_ENV;if(typeof t=="string")return t!=="production";const r=e.process?.versions?.node;if(typeof r=="string"&&r.length>0)return!0;const n=e.process?.release?.name;return n==="node"||n==="io.js"}catch{return!1}},Ie;function ie(e){const t=Ie;return Ie=e,t}function Lr(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){Et()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function hi(e){const t=Ie;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=M(e);return t.addDisposer(()=>r.dispose()),r}function mi(e){const t=Ie;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=P(e);return t.addDisposer(()=>r.dispose()),r}function pi(e){const t=Ie;if(!t)throw new Error("bQuery component: useEffect() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=z(e);return t.addDisposer(r),r}var vi=["slot"],yi=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],$r=(e,t)=>{const r=[...vi,...t.sanitize?.allowTags??[]],n=[...yi,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),i=(c=>c===!1?!1:c==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class l extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,i!==!1?this.renderRootNode=this.attachShadow({mode:i}):this.renderRootNode=this,this.syncProps()}static get observedAttributes(){return a}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){this.scope=Lr();const u=ie(this.scope);try{t.connected?.call(this)}catch(h){this.handleError(h)}finally{ie(u)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(u){this.handleError(u)}}mount(){if(this.hasMounted)return;const u=ie(this.ensureScope());let h=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(d){h=!0,this.handleError(d)}finally{ie(u)}if(h){this.scope?.dispose(),this.scope=void 0;return}this.render(),this.setupSignalSubscriptions(),this.hasMounted=!0}disconnectedCallback(){try{this.signalEffectCleanup?.(),this.signalEffectCleanup=void 0,this.scope?.dispose(),this.scope=void 0,t.disconnected?.call(this)}catch(u){this.handleError(u)}}attributeChangedCallback(u,h,d){try{const p=this.cloneProps();if(this.syncProps(),t.onAttributeChanged){const f=ie(this.ensureScope());try{t.onAttributeChanged.call(this,u,h,d)}finally{ie(f)}}this.hasMounted?this.render(!0,p,{name:u,oldValue:h,newValue:d}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(p){this.handleError(p)}}adoptedCallback(){if(!t.onAdopted)return;const u=ie(this.ensureScope());try{t.onAdopted.call(this)}catch(h){this.handleError(h)}finally{ie(u)}}handleError(u){t.onError?t.onError.call(this,u):console.error(`bQuery component error in <${e}>:`,u)}ensureScope(){return this.scope??(this.scope=Lr())}setState(u,h){this.state[u]=h,this.render(!0,this.cloneProps(),void 0,!1)}getState(u){return this.state[u]}setupSignalSubscriptions(u=!1){if(this.signalEffectCleanup||s.length===0)return;let h=!0;this.signalEffectCleanup=z(()=>{try{for(const p of s)p.value;if(h){if(h=!1,u&&this.hasMounted&&this.isConnected){const p=this.cloneProps();ae(()=>{this.render(!0,p,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const d=this.cloneProps();ae(()=>{this.render(!0,d,void 0,!1)})}catch(d){this.handleError(d)}})}syncProps(){const u=t.props??{};for(const[h,d]of Object.entries(u)){const p=this.getAttribute(h);let f;if(p==null?d.required&&d.default===void 0?(this.missingRequiredProps.add(h),f=void 0):f=d.default??void 0:(this.missingRequiredProps.has(h)&&this.missingRequiredProps.delete(h),f=di(p,d)),d.validator&&f!==void 0&&!d.validator(f))throw new Error(`bQuery component: validation failed for prop "${h}" with value ${JSON.stringify(f)}`);this.props[h]=f}}cloneProps(){return{...this.props}}render(u=!1,h,d,p=!0){try{if(u&&p&&t.beforeUpdate){if(!h)throw new Error("bQuery component: previous props are required for update renders");if(t.beforeUpdate.call(this,this.props,h)===!1)return}const f=(v,w)=>{this.dispatchEvent(new CustomEvent(v,{detail:w,bubbles:!0,composed:!0}))},m=this.renderRootNode,g=J(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:f}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=m.querySelector("style[data-bquery-component-style]")),m.innerHTML=g,t.styles){const v=b??document.createElement("style");b||v.setAttribute("data-bquery-component-style",""),v.textContent=t.styles,m.prepend(v)}u&&t.updated?.call(this,d)}catch(f){this.handleError(f)}}}return l};function gi(e,t){return $r(e,t)}function ye(e,t){const r=$r(e,t);customElements.get(e)||customElements.define(e,r)}var Rr=Symbol("bquery.booleanAttribute"),bi=/^[^\0-\x20"'/>=]+$/,Mr=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[Rr]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},Dr=e=>Mr(e)?e.enabled?e.name:"":String(e??""),wi={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ei=e=>Mr(e)?e.enabled?e.name:"":Dr(e).replace(/[&<>"'`]/g,t=>wi[t]),Si=(e,t)=>{if(!bi.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[Rr]:!0,enabled:!!t,name:e})},ge=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${Dr(t[s])}`,""),Ai=(e,...t)=>{const r=n=>ys(n)?gs(n):Ei(n);return Xt(e.reduce((n,s,o)=>`${n}${s}${o<t.length?r(t[o]):""}`,""))},rt=`
|
|
1
|
+
var bQuery=(function(g){Object.defineProperty(g,Symbol.toStringTag,{value:"Module"});var lr="bquery-sanitizer",Vs=new Set(["a","abbr","address","article","aside","b","bdi","bdo","blockquote","br","button","caption","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","input","ins","kbd","label","legend","li","main","mark","nav","ol","optgroup","option","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","wbr"]),cr=new Set(["script","iframe","frame","frameset","object","embed","applet","link","meta","style","base","template","math","svg","foreignobject","noscript"]),Ks=new Set(["document","window","location","top","self","parent","frames","history","navigator","screen","alert","confirm","prompt","eval","function","cookie","domain","referrer","body","head","forms","images","links","scripts","children","parentnode","firstchild","lastchild","innerhtml","outerhtml","textcontent"]),Ys=new Set(["alt","class","dir","height","hidden","href","id","lang","loading","name","rel","role","src","srcset","tabindex","target","title","type","width","aria-*"]),Gs=["on","formaction","xlink:","xmlns:"],ur=["javascript:","data:","vbscript:","file:"],Js=(e,t,r)=>{const n=e.toLowerCase();for(const s of Gs)if(n.startsWith(s))return!1;return r&&n.startsWith("data-")||n.startsWith("aria-")?!0:t.has(n)},Xs=e=>{const t=e.toLowerCase().trim();return!Ks.has(t)},Zs=e=>e.replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),fr=e=>{const t=Zs(e);for(const r of ur)if(t.startsWith(r))return!1;return!0},eo=e=>{const t=e.split(",");for(const r of t){const n=r.trim().split(/\s+/)[0];if(n&&!fr(n))return!1}return!0},to=e=>{try{const t=e.trim();if(t.startsWith("//"))return!0;const r=t.toLowerCase();return/^[a-z][a-z0-9+.-]*:/i.test(t)&&!r.startsWith("http://")&&!r.startsWith("https://")?!0:!r.startsWith("http://")&&!r.startsWith("https://")?!1:typeof window>"u"||!window.location?!0:new URL(t,window.location.href).origin!==window.location.origin}catch{return!0}},ro=e=>new DOMParser().parseFromString(e,"text/html"),dr=e=>{const t=(typeof e=="string"?e:String(e??"")).trim(),r=document.createDocumentFragment();if(t.length===0)return r;if(!(t.includes("<")||t.includes(">")))return r.appendChild(document.createTextNode(t)),r;const n=ro(t).body;if(!n)return r;for(;n.firstChild;)r.appendChild(n.firstChild);return r},et=(e,t={})=>{const{allowTags:r=[],allowAttributes:n=[],allowDataAttributes:s=!0,stripAllTags:o=!1}=t,i=new Set([...Vs,...r.map(u=>u.toLowerCase())].filter(u=>!cr.has(u))),a=new Set([...Ys,...n.map(u=>u.toLowerCase())]),l=dr(e);if(o)return l.textContent??"";const c=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT),f=[];for(;c.nextNode();){const u=c.currentNode,h=u.tagName.toLowerCase();if(cr.has(h)){f.push(u);continue}if(!i.has(h)){f.push(u);continue}const v=[];for(const b of Array.from(u.attributes)){const y=b.name.toLowerCase();if(!Js(y,a,s)){v.push(b.name);continue}if((y==="id"||y==="name")&&!Xs(b.value)){v.push(b.name);continue}if((y==="href"||y==="src"||y==="action")&&!fr(b.value)){v.push(b.name);continue}y==="srcset"&&!eo(b.value)&&v.push(b.name)}for(const b of v)u.removeAttribute(b);if(h==="a"){const b=u.getAttribute("href"),y=u.getAttribute("target")?.toLowerCase()==="_blank",w=b&&to(b);if(y||w){const E=u.getAttribute("rel"),k=new Set(E?E.split(/\s+/).filter(Boolean):[]);k.add("noopener"),k.add("noreferrer"),u.setAttribute("rel",Array.from(k).join(" "))}}}for(const u of f)u.remove();const m=u=>{const h=document.createElement("div");return h.appendChild(u.cloneNode(!0)),h.innerHTML},d=m(l),p=m(dr(d));return d!==p?l.textContent??"":p},hr=Symbol("bquery.trusted-html.brand"),kt=Symbol("bquery.trusted-html"),mr=e=>e,no=e=>{const t=String(e);return Object.freeze({[hr]:!0,[kt]:t,toString:()=>t})},so=e=>typeof e=="object"&&e!==null&&hr in e&&kt in e,oo=e=>e[kt],pr=1024,vr=8192,io=(e=16)=>{if(!Number.isInteger(e)||e<1)throw new RangeError("generateNonce length must be a positive integer");if(e>pr)throw new RangeError(`generateNonce length must not exceed ${pr}`);if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function")throw new Error("generateNonce requires crypto.getRandomValues (not available in this environment)");if(typeof globalThis.btoa!="function")throw new Error("generateNonce requires btoa (not available in this environment)");const t=new Uint8Array(e);globalThis.crypto.getRandomValues(t);let r="";for(let n=0;n<t.length;n+=vr){const s=t.subarray(n,Math.min(n+vr,t.length));r+=String.fromCharCode(...s)}return globalThis.btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ao=e=>{if(typeof document>"u")return!1;const t=document.querySelector('meta[http-equiv="Content-Security-Policy"]');return t?(t.getAttribute("content")??"").includes(e):!1},tt=null,yr=!1,lo=()=>typeof window<"u"&&typeof window.trustedTypes<"u",gr=()=>{if(tt)return tt;if(yr||typeof window>"u")return null;const e=window;if(!e.trustedTypes)return null;yr=!0;try{return tt=e.trustedTypes.createPolicy(lr,{createHTML:t=>et(t)}),tt}catch(t){const r=t instanceof Error?t.message:String(t);return console.warn(`bQuery: Could not create Trusted Types policy "${lr}": ${r}`),null}},co=e=>{const t=gr();return t?t.createHTML(e):et(e)},X=(e,t={})=>mr(et(e,t)),br=e=>{const t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return e.replace(/[&<>"'`]/g,r=>t[r])},uo=e=>et(e,{stripAllTags:!0}),wr=e=>Array.isArray(e)?e:[e],z=(e,t)=>{for(const r of e)t(r)},ve=e=>{if(!e)return!1;const t=e.ownerDocument?.defaultView?.HTMLElement??globalThis.HTMLElement;return typeof t=="function"&&e instanceof t},rt=(e,t)=>ve(e)?t==="width"?e.clientWidth:e.clientHeight:0,nt=(e,t,r)=>{if(!ve(e))return 0;const n=t==="width"?e.offsetWidth:e.offsetHeight;if(!r)return n;const s=e.ownerDocument?.defaultView;if(!s||typeof s.getComputedStyle!="function")return n;const o=s.getComputedStyle(e),i=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-left":"margin-top")),a=Number.parseFloat(o.getPropertyValue(t==="width"?"margin-right":"margin-bottom")),l=Number.isNaN(i)?0:i,c=Number.isNaN(a)?0:a;return n+l+c},Er=e=>X(e),fo=(e,t)=>{e.innerHTML=X(t)},Sr=e=>{const t=document.createElement("template");return t.innerHTML=X(e),t.content.firstElementChild??document.createElement("div")},Ar=(e,t,r)=>{if(typeof t=="string"){e.insertAdjacentHTML(r,X(t));return}const n=wr(t);z(r==="afterbegin"||r==="afterend"?n.slice().reverse():n,s=>{e.insertAdjacentElement(r,s)})};function ye(e){return Object.prototype.toString.call(e)==="[object Object]"}function x(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function ho(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function ge(...e){const t={};for(const r of e)for(const[n,s]of Object.entries(r))x(n)||(ye(s)&&ye(t[n])?t[n]=ge(t[n],s):t[n]=s);return t}function mo(e,t){const r={};for(const n of t)n in e&&(r[n]=e[n]);return r}function po(e,t){const r={...e};for(const n of t)delete r[n];return r}function vo(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var yo=e=>{const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"},kr=e=>{const t=[],r=e.ownerDocument.defaultView?.Element??Element;for(const n of Array.from(e.elements)){if(!(n instanceof r)||!yo(n))continue;const s=n.name;if(!(!s||n.disabled||x(s))){if(n.tagName.toLowerCase()==="input"){const o=n,i=o.type.toLowerCase();if(i==="checkbox"||i==="radio"){o.checked&&t.push([s,o.value]);continue}if(i==="file"||i==="submit"||i==="button"||i==="reset"||i==="image")continue;t.push([s,o.value]);continue}if(n.tagName.toLowerCase()==="select"){const o=n;if(o.multiple)for(const i of Array.from(o.selectedOptions))t.push([s,i.value]);else t.push([s,o.value]);continue}t.push([s,n.value])}}return t},Tr=e=>{if(typeof FormData=="function")try{const t=[];for(const[r,n]of new FormData(e).entries())x(r)||typeof n!="string"||t.push([r,n]);return t.length>0?t:kr(e)}catch{}return kr(e)},be=class ar{constructor(t){this.element=t,this.delegatedHandlers=new Map}get raw(){return this.element}get node(){return this.element}addClass(...t){return this.element.classList.add(...t),this}removeClass(...t){return this.element.classList.remove(...t),this}toggleClass(t,r){return this.element.classList.toggle(t,r),this}attr(t,r){return r===void 0?this.element.getAttribute(t)??"":(this.element.setAttribute(t,r),this)}removeAttr(t){return this.element.removeAttribute(t),this}toggleAttr(t,r){const n=this.element.hasAttribute(t);return r??!n?this.element.setAttribute(t,""):this.element.removeAttribute(t),this}prop(t,r){return r===void 0?this.element[t]:(this.element[t]=r,this)}data(t,r){const n=t.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`);return r===void 0?this.element.getAttribute(`data-${n}`)??"":(this.element.setAttribute(`data-${n}`,r),this)}text(t){return t===void 0?this.element.textContent??"":(this.element.textContent=t,this)}html(t){return fo(this.element,t),this}htmlUnsafe(t){return this.element.innerHTML=t,this}css(t,r){if(typeof t=="string"){if(r!==void 0)return this.element.style.setProperty(t,r),this;const n=this.element.ownerDocument?.defaultView;return!n||typeof n.getComputedStyle!="function"?"":n.getComputedStyle(this.element).getPropertyValue(t)}for(const[n,s]of Object.entries(t))this.element.style.setProperty(n,s);return this}append(t){return this.insertContent(t,"beforeend"),this}prepend(t){return this.insertContent(t,"afterbegin"),this}before(t){return this.insertContent(t,"beforebegin"),this}after(t){return this.insertContent(t,"afterend"),this}wrap(t){const r=typeof t=="string"?document.createElement(t):t;return this.element.parentNode?.insertBefore(r,this.element),r.appendChild(this.element),this}unwrap(){const t=this.element.parentElement;return t&&t.parentNode&&(t.parentNode.insertBefore(this.element,t),t.remove()),this}replaceWith(t){const r=typeof t=="string"?Sr(t):t;return this.element.replaceWith(r),new ar(r)}detach(){return this.remove()}index(){const t=this.element.parentElement;return t?Array.from(t.children).indexOf(this.element):-1}contents(){return Array.from(this.element.childNodes)}offsetParent(){return ve(this.element)?this.element.offsetParent:null}position(){if(!ve(this.element))return{top:0,left:0};const t=this.element;return{top:t.offsetTop,left:t.offsetLeft}}innerWidth(){return rt(this.element,"width")}innerHeight(){return rt(this.element,"height")}outerWidth(t=!1){return nt(this.element,"width",t)}outerHeight(t=!1){return nt(this.element,"height",t)}scrollTo(t={behavior:"smooth"}){return this.element.scrollIntoView(t),this}remove(){return this.element.remove(),this}empty(){return this.element.innerHTML="",this}clone(t=!0){return new ar(this.element.cloneNode(t))}find(t){return Array.from(this.element.querySelectorAll(t))}findOne(t){return this.element.querySelector(t)}closest(t){return this.element.closest(t)}parent(){return this.element.parentElement}children(){return Array.from(this.element.children)}siblings(){const t=this.element.parentElement;return t?Array.from(t.children).filter(r=>r!==this.element):[]}next(){return this.element.nextElementSibling}prev(){return this.element.previousElementSibling}on(t,r){return this.element.addEventListener(t,r),this}once(t,r){return this.element.addEventListener(t,r,{once:!0}),this}off(t,r){return this.element.removeEventListener(t,r),this}trigger(t,r){return this.element.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0})),this}delegate(t,r,n){const s=`${t}:${r}`,o=i=>{const a=i.target.closest(r);a&&this.element.contains(a)&&n(i,a)};return this.delegatedHandlers.has(s)||this.delegatedHandlers.set(s,new Map),this.delegatedHandlers.get(s).set(n,o),this.element.addEventListener(t,o),this}undelegate(t,r,n){const s=`${t}:${r}`,o=this.delegatedHandlers.get(s);if(o){const i=o.get(n);i&&(this.element.removeEventListener(t,i),o.delete(n),o.size===0&&this.delegatedHandlers.delete(s))}return this}matches(t){return this.element.matches(t)}is(t){return this.matches(t)}hasClass(t){return this.element.classList.contains(t)}show(t=""){return this.element.removeAttribute("hidden"),this.element.style.display=t,this}hide(){return this.element.style.display="none",this}toggle(t){const r=this.element.style.display==="none";return t??r?this.show():this.hide()}focus(){return this.element.focus(),this}blur(){return this.element.blur(),this}val(t){const r=this.element;return t===void 0?r.value??"":(r.value=t,this)}serialize(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return{};const r=Object.create(null);for(const[n,s]of Tr(t))if(Object.prototype.hasOwnProperty.call(r,n)){const o=r[n];Array.isArray(o)?o.push(s):r[n]=[o,s]}else r[n]=s;return r}serializeString(){const t=this.element;if(t.tagName.toLowerCase()!=="form")return"";const r=new URLSearchParams;for(const[n,s]of Tr(t))r.append(n,s);return r.toString()}rect(){return this.element.getBoundingClientRect()}offset(){const t=this.element;return{width:t.offsetWidth,height:t.offsetHeight,top:t.offsetTop,left:t.offsetLeft}}insertContent(t,r){Ar(this.element,t,r)}},st=class J{constructor(t){this.elements=t,this.delegatedHandlers=new WeakMap}get length(){return this.elements.length}first(){return this.elements[0]}eq(t){const r=this.elements[t];return r?new be(r):void 0}firstEl(){return this.eq(0)}lastEl(){return this.eq(this.elements.length-1)}each(t){return this.elements.forEach((r,n)=>{t(new be(r),n)}),this}map(t){return this.elements.map(t)}filter(t){return new J(this.elements.filter(t))}reduce(t,r){return this.elements.reduce(t,r)}toArray(){return this.elements.map(t=>new be(t))}addClass(...t){return z(this.elements,r=>r.classList.add(...t)),this}removeClass(...t){return z(this.elements,r=>r.classList.remove(...t)),this}toggleClass(t,r){return z(this.elements,n=>n.classList.toggle(t,r)),this}attr(t,r){return r===void 0?this.first()?.getAttribute(t)??"":(z(this.elements,n=>n.setAttribute(t,r)),this)}removeAttr(t){return z(this.elements,r=>r.removeAttribute(t)),this}toggleAttr(t,r){return z(this.elements,n=>{const s=n.hasAttribute(t);r??!s?n.setAttribute(t,""):n.removeAttribute(t)}),this}text(t){return t===void 0?this.first()?.textContent??"":(z(this.elements,r=>{r.textContent=t}),this)}html(t){if(t===void 0)return this.first()?.innerHTML??"";const r=Er(t);return z(this.elements,n=>{n.innerHTML=r}),this}htmlUnsafe(t){return z(this.elements,r=>{r.innerHTML=t}),this}append(t){return this.insertAll(t,"beforeend"),this}prepend(t){return this.insertAll(t,"afterbegin"),this}before(t){return this.insertAll(t,"beforebegin"),this}after(t){return this.insertAll(t,"afterend"),this}css(t,r){if(typeof t=="string"){if(r!==void 0)return z(this.elements,o=>{o.style.setProperty(t,r)}),this;const n=this.first();if(!n)return"";const s=n.ownerDocument?.defaultView;return!s||typeof s.getComputedStyle!="function"?"":s.getComputedStyle(n).getPropertyValue(t)}return z(this.elements,n=>{for(const[s,o]of Object.entries(t))n.style.setProperty(s,o)}),this}wrap(t){return this.elements.forEach((r,n)=>{const s=typeof t=="string"?document.createElement(t):n===0?t:t.cloneNode(!0);r.parentNode?.insertBefore(s,r),s.appendChild(r)}),this}unwrap(){const t=new Set;for(const r of this.elements)r.parentElement&&t.add(r.parentElement);return t.forEach(r=>{const n=r.parentNode;if(n){for(;r.firstChild;)n.insertBefore(r.firstChild,r);r.remove()}}),this}replaceWith(t){const r=[];return this.elements.forEach((n,s)=>{const o=typeof t=="string"?Sr(t):s===0?t:t.cloneNode(!0);n.replaceWith(o),r.push(o)}),new J(r)}detach(){return this.remove()}index(){const t=this.first();return t?.parentElement?Array.from(t.parentElement.children).indexOf(t):-1}contents(){return Array.from(this.first()?.childNodes??[])}offsetParent(){const t=this.first();return ve(t)?t.offsetParent:null}position(){const t=this.first();return ve(t)?{top:t.offsetTop,left:t.offsetLeft}:{top:0,left:0}}innerWidth(){return rt(this.first(),"width")}innerHeight(){return rt(this.first(),"height")}outerWidth(t=!1){return nt(this.first(),"width",t)}outerHeight(t=!1){return nt(this.first(),"height",t)}show(t=""){return z(this.elements,r=>{r.removeAttribute("hidden"),r.style.display=t}),this}hide(){return z(this.elements,t=>{t.style.display="none"}),this}on(t,r){return z(this.elements,n=>n.addEventListener(t,r)),this}once(t,r){return z(this.elements,n=>n.addEventListener(t,r,{once:!0})),this}off(t,r){return z(this.elements,n=>n.removeEventListener(t,r)),this}trigger(t,r){return z(this.elements,n=>{n.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}),this}delegate(t,r,n){const s=`${t}:${r}`;return z(this.elements,o=>{const i=l=>{const c=l.target.closest(r);c&&o.contains(c)&&n(l,c)};this.delegatedHandlers.has(o)||this.delegatedHandlers.set(o,new Map);const a=this.delegatedHandlers.get(o);a.has(s)||a.set(s,new Map),a.get(s).set(n,i),o.addEventListener(t,i)}),this}undelegate(t,r,n){const s=`${t}:${r}`;return z(this.elements,o=>{const i=this.delegatedHandlers.get(o);if(!i)return;const a=i.get(s);if(!a)return;const l=a.get(n);l&&(o.removeEventListener(t,l),a.delete(n),a.size===0&&i.delete(s),i.size===0&&this.delegatedHandlers.delete(o))}),this}find(t){const r=new Set,n=[];for(const s of this.elements){const o=s.querySelectorAll(t);for(let i=0;i<o.length;i++)r.has(o[i])||(r.add(o[i]),n.push(o[i]))}return new J(n)}closest(t){const r=new Set,n=[];for(const s of this.elements){const o=s.closest(t);o&&!r.has(o)&&(r.add(o),n.push(o))}return new J(n)}parent(){const t=new Set,r=[];for(const n of this.elements){const s=n.parentElement;s&&!t.has(s)&&(t.add(s),r.push(s))}return new J(r)}children(){const t=new Set,r=[];for(const n of this.elements)for(const s of Array.from(n.children))t.has(s)||(t.add(s),r.push(s));return new J(r)}siblings(){const t=new Set(this.elements),r=new Set,n=[];for(const s of this.elements){const o=s.parentElement;if(o)for(const i of Array.from(o.children))!t.has(i)&&!r.has(i)&&(r.add(i),n.push(i))}return new J(n)}next(){const t=new Set,r=[];for(const n of this.elements){const s=n.nextElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new J(r)}prev(){const t=new Set,r=[];for(const n of this.elements){const s=n.previousElementSibling;s&&!t.has(s)&&(t.add(s),r.push(s))}return new J(r)}remove(){return z(this.elements,t=>t.remove()),this}empty(){return z(this.elements,t=>{t.innerHTML=""}),this}insertAll(t,r){if(typeof t=="string"){const s=Er(t);z(this.elements,o=>{o.insertAdjacentHTML(r,s)});return}const n=wr(t);this.elements.forEach((s,o)=>{Ar(s,o===0?n:n.map(i=>i.cloneNode(!0)),r)})}},go=e=>{if(typeof e!="string")return new be(e);const t=document.querySelector(e);if(!t)throw new Error(`bQuery: element not found for selector "${e}"`);return new be(t)},bo=e=>Array.isArray(e)?new st(e):e instanceof NodeList?new st(Array.from(e)):new st(Array.from(document.querySelectorAll(e)));function wo(e){return e==null?[]:Array.isArray(e)?e:[e]}function Eo(e){return Array.from(new Set(e))}function So(e,t){if(t<=0)return[];const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Ao(e){return e.filter(Boolean)}function ko(e){const t=[];for(const r of e)Array.isArray(r)?t.push(...r):t.push(r);return t}function Tt(e,t){let r;return Object.assign((...n)=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e(...n)},t)},{cancel:()=>{r!==void 0&&(clearTimeout(r),r=void 0)}})}function Cr(e,t){let r=0;return Object.assign((...n)=>{const s=Date.now();s-r>=t&&(r=s,e(...n))},{cancel:()=>{r=0}})}function To(e){let t=!1,r;return(...n)=>(t||(r=e(...n),t=!0),r)}function Co(){}function Ro(e="bQuery"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function Oo(e){return new Promise(t=>setTimeout(t,e))}function Lo(e,t){try{return JSON.parse(e)}catch{return t}}function $o(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}function Po(e,t){return Math.floor(Math.random()*(t-e+1))+e}function Mo(e,t,r){return Math.min(Math.max(e,t),r)}function No(e,t,r,n=!0){return n?e>=t&&e<=r:e>t&&e<r}function Do(e,t=0){const r=typeof e=="number"?e:Number(e);return Number.isNaN(r)?t:r}function Io(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function _o(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function qo(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function zo(e,t,r="…"){if(t<=0)return"";if(e.length<=t)return e;const n=Math.max(0,t-r.length);return`${e.slice(0,n)}${r}`}function xo(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\w\s-]/g,"").trim().replace(/[\s_-]+/g,"-").toLowerCase()}function jo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fo(e){return typeof Element<"u"&&e instanceof Element}function Uo(e){return!!(e&&typeof e=="object"&&"elements"in e)}function Bo(e){return typeof e=="function"}function Wo(e){return typeof e=="string"}function Ho(e){return typeof e=="number"&&!Number.isNaN(e)}function Qo(e){return typeof e=="boolean"}function Vo(e){return Array.isArray(e)}function Ko(e){return e instanceof Date}function Le(e){return!!(e&&(e instanceof Promise||typeof e=="object"&&"then"in e&&typeof e.then=="function"))}function Yo(e){return typeof e=="object"&&e!==null}var Go={clone:ho,merge:ge,pick:mo,omit:po,hasOwn:vo,debounce:Tt,throttle:Cr,once:To,noop:Co,uid:Ro,isElement:Fo,isCollection:Uo,isEmpty:$o,isPlainObject:ye,isFunction:Bo,isString:Wo,isNumber:Ho,isBoolean:Qo,isArray:Vo,isDate:Ko,isPromise:Le,isObject:Yo,parseJson:Lo,sleep:Oo,randomInt:Po,clamp:Mo,inRange:No,toNumber:Do,capitalize:Io,toKebabCase:_o,toCamelCase:qo,truncate:zo,slugify:xo,escapeRegExp:jo,ensureArray:wo,unique:Eo,chunk:So,compact:Ao,flatten:ko},we=[],$e=0,Ct=new Set,ot=new WeakMap,Rt=(e,t)=>{we.push(e);try{return t()}finally{we.pop()}},Rr=()=>we[we.length-1],Ot=e=>{we.push(void 0);try{return e()}finally{we.pop()}},Or=e=>{if($e>0){Ct.add(e);return}e()},Jo=()=>{for(const e of Array.from(Ct)){Ct.delete(e);try{e()}catch(t){console.error("bQuery reactive: Error in observer during batch flush",t)}}},Xo=()=>{$e+=1},Zo=()=>{$e<=0||($e-=1,$e===0&&Jo())},Lr=(e,t)=>{let r=ot.get(e);r||(r=new Set,ot.set(e,r)),r.add(t)},ei=(e,t)=>{const r=ot.get(e);r&&r.delete(t)},Pe=e=>{const t=ot.get(e);if(t){for(const r of t)r.unsubscribe(e);t.clear()}},ce=e=>{Xo();try{e()}finally{Zo()}},$r={fetch:{headers:{},parseAs:"json"},cookies:{path:"/",sameSite:"Lax",secure:!1},announcer:{politeness:"polite",atomic:!0,delay:16,clearDelay:1e3},pageMeta:{},transitions:{skipOnReducedMotion:!1,classes:[],types:[]},components:{prefix:"bq"}},Me=e=>{if(typeof Headers<"u"&&e instanceof Headers)return new Headers(e);if(Array.isArray(e))return e.map(t=>Me(t));if(ye(e)){const t={};for(const[r,n]of Object.entries(e))t[r]=Me(n);return t}return e},Lt=Me($r),ti=e=>(Lt=Me(ge($r,Lt,e)),Z()),Z=()=>Me(Lt),Ne=[],it=e=>typeof e=="object"&&e!==null&&"_addDisposer"in e,ri=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",ni=e=>{const t=typeof e.constructor=="function"?e.constructor.name:void 0;return typeof e=="function"&&(Symbol.toStringTag in e&&e[Symbol.toStringTag]==="AsyncFunction"||t==="AsyncFunction")},De=()=>{for(let e=Ne.length-1;e>=0;e--)if(Ne[e].active)return Ne[e]},si=class{constructor(){this.disposers=[],this._active=!0}get active(){return this._active}_addDisposer(e){this._active&&this.disposers.push(e)}run(e){if(!this._active)throw new Error("bQuery reactive: Cannot run in a stopped effectScope");if(ni(e))throw new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");Ne.push(this);try{const t=e();if(ri(t))throw this.stop(),new Error("bQuery reactive: effectScope.run() only supports synchronous callbacks");return t}finally{Ne.pop()}}stop(){if(this._active){this._active=!1;for(let e=this.disposers.length-1;e>=0;e--)try{this.disposers[e]()}catch(t){console.error("bQuery reactive: Error in scope cleanup",t)}this.disposers.length=0}}},oi=()=>{const e=new si,t=De();return it(t)&&t._addDisposer(()=>e.stop()),e},Pr=()=>De(),Mr=e=>{const t=De();if(!t||!t.active||!it(t))throw new Error("bQuery reactive: onScopeDispose() must be called inside an active effectScope");t._addDisposer(e)},Ie=class{constructor(e){this.compute=e,this.hasCachedValue=!1,this.dirty=!0,this.disposed=!1,this.subscribers=new Set,this.markDirty=()=>{if(this.disposed)return;this.dirty=!0;const t=Array.from(this.subscribers);for(const r of t)Or(r)}}get value(){if(this.disposed)return this.hasCachedValue||(this.cachedValue=Ot(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue;const e=Rr();return e&&(this.subscribers.add(e),Lr(e,this)),this.dirty&&(this.dirty=!1,Pe(this.markDirty),this.cachedValue=Rt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue}peek(){return this.disposed?(this.hasCachedValue||(this.cachedValue=Ot(()=>this.compute()),this.hasCachedValue=!0),this.cachedValue):(this.dirty&&(this.dirty=!1,Pe(this.markDirty),this.cachedValue=Rt(this.markDirty,this.compute),this.hasCachedValue=!0),this.cachedValue)}unsubscribe(e){this.subscribers.delete(e)}dispose(){this.disposed=!0,this.dirty&&(this.hasCachedValue=!1),this.dirty=!1,Pe(this.markDirty),this.subscribers.clear()}},D=e=>{const t=new Ie(e),r=De();return it(r)&&r._addDisposer(()=>t.dispose()),t},j=e=>{let t,r=!1;const n=De(),s=()=>{if(t){try{t()}catch(l){console.error("bQuery reactive: Error in effect cleanup",l)}t=void 0}},o=()=>{s(),Pe(a)},i=()=>{r||(r=!0,o())};it(n)&&n._addDisposer(i);const a=()=>{if(!r){s(),Pe(a);try{t=Rt(a,e)}catch(l){console.error("bQuery reactive: Error in effect",l)}r&&o()}};return a(),i},_e=class{constructor(e){this._value=e,this.subscribers=new Set}get value(){const e=Rr();return e&&(this.subscribers.add(e),Lr(e,this)),this._value}set value(e){if(Object.is(this._value,e))return;this._value=e;const t=Array.from(this.subscribers);for(const r of t)Or(r)}peek(){return this._value}update(e){this.value=e(this._value)}dispose(){for(const e of this.subscribers)ei(e,this);this.subscribers.clear()}unsubscribe(e){this.subscribers.delete(e)}},$=e=>new _e(e),ue=e=>Ot(e),ii=e=>{if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}},ai=e=>typeof e=="function"?e():e.value,Nr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},li=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),ci=(e,t)=>e==null||li(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),ui=e=>typeof e=="function"?e():e,fi=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},di=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return e instanceof URL?new URL(e.toString(),n):new URL(e,n)},hi=async(e,t)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const r=await e.text();if(r)try{return JSON.parse(r)}catch(n){const s=e.url?` for ${e.url}`:"";throw new Error(`Failed to parse JSON response${s} (status ${e.status}): ${n instanceof Error?n.message:String(n)}`)}},$t=e=>{const t=e?.trim();return t?t.toUpperCase():void 0},mi=(e,t,r)=>{const n=t instanceof Request?$t(t.method):void 0;return e??n??(r?"POST":void 0)},pi=(e,t,r)=>e||(t instanceof Request?void 0:r),vi=e=>{const t=$t(e.method);let r;if(t!=="GET"&&t!=="HEAD"&&!e.bodyUsed)try{r=e.clone().body??void 0}catch{r=void 0}return{method:t,headers:e.headers,body:r,cache:e.cache,credentials:e.credentials,integrity:e.integrity,keepalive:e.keepalive,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,signal:e.signal}},Dr=(e,t={})=>{const r=t.immediate??!0,n=$(t.defaultValue),s=$(null),o=$("idle"),i=D(()=>o.value==="pending");let a=0,l=!1,c=()=>{};const f=()=>{a+=1,n.value=t.defaultValue,s.value=null,o.value="idle"},m=()=>{l||(l=!0,a+=1,c())},d=async()=>{if(l)return n.peek();const p=++a;o.value="pending",s.value=null;try{const u=await e(),h=t.transform?t.transform(u):u;return l||p!==a?n.peek():(n.value=h,o.value="success",t.onSuccess?.(h),h)}catch(u){const h=ii(u);return l||p!==a||(s.value=h,o.value="error",t.onError?.(h)),n.peek()}};if(t.watch?.length){let p=!1;c=j(()=>{for(const u of t.watch??[])ai(u);if(!p){p=!0,r&&ue(()=>d());return}ue(()=>d())})}else r&&d();return{data:n,error:s,status:o,pending:i,execute:d,refresh:d,abort:()=>{},clear:f,dispose:m}},yi=e=>e>=200&&e<300,Ir=(e,t)=>e instanceof DOMException&&e.name===t,at=e=>Ir(e,"TimeoutError"),_r=e=>Ir(e,"AbortError"),gi=e=>{if(_r(e)||at(e)||e.code==="ABORT"||e.code==="TIMEOUT")return!1;const t=e.status;return t===void 0||t>=500},bi=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},wi=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),Ei=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s=!1,o;const i=()=>{s||(s=!0,clearTimeout(o),t?.removeEventListener("abort",i),n(t?.reason??new DOMException("The operation was aborted.","AbortError")))};o=setTimeout(()=>{s||(s=!0,t?.removeEventListener("abort",i),r())},e),t?.addEventListener("abort",i,{once:!0})}),K=(e,t={})=>{const r=Z().fetch,n=t.parseAs??r?.parseAs??"json",s=t.fetcher??fetch,o=t.validateStatus??yi;let i=null;const a=(c,f)=>{const m=f||at(c)||at(i?.signal.reason);return Object.assign(new Error(m?`Request timeout of ${t.timeout}ms exceeded`:"Request aborted"),{code:m?"TIMEOUT":"ABORT"})},l=Dr(async()=>{const c=ui(e),f=typeof c=="string"||c instanceof URL?di(c,t.baseUrl??r?.baseUrl):c instanceof Request&&t.query?new URL(c.url):null;f&&t.query&&fi(f,t.query);const m=Nr(r?.headers,c instanceof Request?c.headers:void 0,t.headers),d=t.body!=null,p=$t(t.method),u=mi(p,c,d),h=u==="GET"||u==="HEAD"?u:null;if(d&&h)throw new Error(`Cannot send a request body with ${h} requests`);const v=pi(p,c,u),b=bi(t.retry),y=(b?.count??0)+1,w=new AbortController;i=w;let E,k=!1,A;t.signal&&(t.signal.aborted?w.abort(t.signal.reason):(A=()=>w.abort(t.signal?.reason),t.signal.addEventListener("abort",A,{once:!0}))),t.timeout&&t.timeout>0&&(E=setTimeout(()=>{k=!0,w.abort(new DOMException("Request timeout","TimeoutError"))},t.timeout));const S={...t,method:v,headers:m};delete S.baseUrl,delete S.query,delete S.parseAs,delete S.fetcher,delete S.defaultValue,delete S.immediate,delete S.watch,delete S.transform,delete S.onSuccess,delete S.onError,delete S.timeout,delete S.retry,delete S.validateStatus;let T=f??c;c instanceof Request&&f&&f.toString()!==c.url&&(T=new Request(f.toString(),vi(c)));const P=()=>{const O=new Headers(m);return{...S,headers:O,body:ci(t.body,O),signal:w.signal}};if(y>1&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream)throw new Error("Cannot retry requests with ReadableStream bodies");if(y>1&&typeof Request<"u"&&T instanceof Request&&T.body!==null)throw new Error("Cannot retry requests with non-replayable Request bodies");let R;try{for(let O=0;O<y;O++)try{const C=await s(T,P());if(!o(C.status))throw Object.assign(new Error(`Request failed with status ${C.status}`),{response:C,status:C.status,statusText:C.statusText});return await hi(C,n)}catch(C){const L=C instanceof Error?C:new Error(String(C));if(w.signal.aborted||_r(L)||at(L))throw a(w.signal.aborted?w.signal.reason:L,k);if(R=L,!(b&&(b.retryOn??gi)(L,O))||O>=y-1)throw L;await Ei(wi(b.delay,O),w.signal)}throw R}finally{E!==void 0&&clearTimeout(E),t.signal&&A&&t.signal.removeEventListener("abort",A),i===w&&(i=null)}},t);return l.abort=()=>{i&&i.abort(new DOMException("Request aborted","AbortError"))},l};function Si(e={}){return(t,r={})=>{const n=e,s=ge({},n.query??{},r.query??{});return K(t,{...n,...r,headers:Nr(n.headers,r.headers),query:Object.keys(s).length>0?s:void 0})}}var ie=class extends Error{constructor(e,t,r,n){super(e),this.name="HttpError",this.config=t,this.code=r,this.response=n}};function qr(){const e=[];let t=0;return{use(r,n){const s=t++;return e.push({id:s,fulfilled:r,rejected:n}),s},eject(r){const n=e.findIndex(s=>s?.id===r);n!==-1&&(e[n]=null)},clear(){e.length=0},forEach(r){for(const n of e)n&&r(n)}}}var Ai=e=>e>=200&&e<300,ki=e=>{if(e.code==="PARSE")return!1;if(e.code==="TIMEOUT"||e.code==="NETWORK")return!0;const t=e.response?.status;return t!==void 0&&t>=500},Ti=e=>{if(e!=null)return typeof e=="number"?{count:e}:e},Ci=(e,t)=>e==null?Math.min(1e3*2**t,3e4):typeof e=="number"?e:e(t),Ri=(e,t)=>new Promise((r,n)=>{if(t?.aborted){n(t.reason??new DOMException("The operation was aborted.","AbortError"));return}let s;const o=()=>{clearTimeout(s),t?.removeEventListener("abort",o),n(t?.reason??new DOMException("The operation was aborted.","AbortError"))};s=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),t&&t.addEventListener("abort",o,{once:!0})}),zr=(...e)=>{const t=new Headers;for(const r of e)r&&new Headers(r).forEach((n,s)=>{t.set(s,n)});return t},Oi=e=>typeof e=="string"||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer||typeof ReadableStream<"u"&&e instanceof ReadableStream?!0:typeof e=="object"&&e!==null&&ArrayBuffer.isView(e),Li=(e,t)=>e==null||Oi(e)?e:(t.has("content-type")||t.set("content-type","application/json"),JSON.stringify(e)),$i=(e,t)=>{for(const[r,n]of Object.entries(t))if(n!=null){if(Array.isArray(n)){for(const s of n)s!=null&&e.searchParams.append(r,String(s));continue}e.searchParams.set(r,String(n))}},Pi=(e,t)=>{const r=typeof window<"u"&&/^https?:/i.test(window.location.href)?window.location.href:"http://localhost",n=t?new URL(t,r).toString():r;return new URL(e,n)},Mi=async(e,t,r)=>{if(t==="response")return e;if(t==="text")return await e.text();if(t==="blob")return await e.blob();if(t==="arrayBuffer")return await e.arrayBuffer();if(t==="formData")return await e.formData();const n=await e.text();if(n)try{return JSON.parse(n)}catch(s){throw new ie(`Failed to parse JSON response${e.url?` for ${e.url}`:""} (status ${e.status}): ${s instanceof Error?s.message:String(s)}`,r,"PARSE",{data:n,status:e.status,statusText:e.statusText,headers:e.headers,config:r})}},Ni=(e,t)=>{const r=e.body;if(!r)return e;const n=parseInt(e.headers.get("content-length")??"0",10)||0;let s=0;const o=r.getReader(),i=new ReadableStream({async pull(a){const{done:l,value:c}=await o.read();if(l){a.close();return}s+=c.byteLength,t({loaded:s,total:n,percent:n>0?Math.round(s/n*100):void 0}),a.enqueue(c)},cancel(a){o.cancel(a)}});return new Response(i,{status:e.status,statusText:e.statusText,headers:e.headers})},Di=async e=>{const t=Z().fetch,r=e.parseAs??t?.parseAs??"json",n=e.fetcher??fetch,s=e.validateStatus??Ai,o=Pi(e.url??"/",e.baseUrl??t?.baseUrl);e.query&&$i(o,e.query);const i=zr(t?.headers,e.headers),a=Li(e.body,i),l={};e.method&&(l.method=e.method.toUpperCase()),l.headers=i,a!=null&&(l.body=a),e.cache&&(l.cache=e.cache),e.credentials&&(l.credentials=e.credentials),e.integrity&&(l.integrity=e.integrity),e.keepalive!==void 0&&(l.keepalive=e.keepalive),e.mode&&(l.mode=e.mode),e.redirect&&(l.redirect=e.redirect),e.referrer&&(l.referrer=e.referrer),e.referrerPolicy&&(l.referrerPolicy=e.referrerPolicy);let c,f=e.signal,m;if(e.timeout&&e.timeout>0){const d=new AbortController;e.signal&&(m=()=>d.abort(e.signal?.reason),e.signal.addEventListener("abort",m,{once:!0})),c=setTimeout(()=>{d.abort(new DOMException("Request timeout","TimeoutError"))},e.timeout),f=d.signal}f&&(l.signal=f);try{let d=await n(o.toString(),l);if(e.onDownloadProgress&&(d=Ni(d,e.onDownloadProgress)),!s(d.status))throw new ie(`Request failed with status ${d.status}`,e,"ERR_BAD_RESPONSE",{data:void 0,status:d.status,statusText:d.statusText,headers:d.headers,config:e});return{data:await Mi(d,r,e),status:d.status,statusText:d.statusText,headers:d.headers,config:e}}catch(d){if(d instanceof ie)throw d;if(d instanceof DOMException&&(d.name==="AbortError"||d.name==="TimeoutError")){const p=d.name==="TimeoutError"||d.message==="Request timeout";throw new ie(p?`Request timeout of ${e.timeout}ms exceeded`:"Request aborted",e,p?"TIMEOUT":"ABORT")}throw new ie(d instanceof Error?d.message:String(d),e,"NETWORK")}finally{c!==void 0&&clearTimeout(c),e.signal&&m&&e.signal.removeEventListener("abort",m)}};function Pt(e={}){const t=qr(),r=qr(),n=i=>{const a=ge({},e.query??{},i.query??{});return{...e,...i,headers:zr(e.headers,i.headers),query:Object.keys(a).length>0?a:void 0}},s=async i=>{let a=i;const l=[];t.forEach(d=>l.push(d));for(const{fulfilled:d,rejected:p}of l)try{d&&(a=await d(a))}catch(u){if(p){const h=await p(u);if(ye(h))a=h;else throw u}else throw u}const c=Ti(a.retry);let f;const m=(c?.count??0)+1;for(let d=0;d<m;d++)try{let p=await Di(a);const u=[];r.forEach(h=>u.push(h));for(const{fulfilled:h,rejected:v}of u)try{h&&(p=await h(p))}catch(b){if(v){const y=await v(b);if(y&&typeof y=="object"&&"data"in y)p=y;else throw b}else throw b}return p}catch(p){const u=p instanceof ie?p:new ie(p instanceof Error?p.message:String(p),a,"NETWORK");if(f=u,!(c&&(c.retryOn??ki)(u,d))||d>=m-1){const v=[];r.forEach(y=>v.push(y));let b=u;for(const{rejected:y}of v)if(y)try{const w=await y(b);if(w&&typeof w=="object"&&"data"in w)return w;w!=null&&(b=w)}catch(w){w!=null&&(b=w)}throw b instanceof Error||(b=u),b}const h=c?Ci(c.delay,d):0;c?.onRetry?.(u,d+1),await Ri(h,a.signal)}throw f},o=i=>s(n(i));return{request:o,get:(i,a={})=>o({...a,url:i,method:"GET"}),post:(i,a,l={})=>o({...l,url:i,method:"POST",body:a}),put:(i,a,l={})=>o({...l,url:i,method:"PUT",body:a}),patch:(i,a,l={})=>o({...l,url:i,method:"PATCH",body:a}),delete:(i,a={})=>o({...a,url:i,method:"DELETE"}),head:(i,a={})=>o({...a,url:i,method:"HEAD"}),options:(i,a={})=>o({...a,url:i,method:"OPTIONS"}),interceptors:{request:t,response:r},defaults:e}}var Ii=Pt();function _i(e={}){const{concurrency:t=6}=e;if(!Number.isInteger(t)||t<1)throw new Error("Request queue concurrency must be a positive integer");const r=[];let n=0;const s=()=>{for(;n<t&&r.length>0;){const o=r.shift();n++,Promise.resolve().then(o.execute).then(o.resolve,o.reject).finally(()=>{n--,s()})}};return{add(o){return new Promise((i,a)=>{r.push({execute:o,resolve:i,reject:a}),s()})},get pending(){return n},get size(){return r.length},clear(){const o=r.splice(0);for(const i of o)i.reject(new Error("Request queue cleared"))}}}var qi=(e,t)=>{const r=D(e);return{get value(){return r.value},set value(n){t(n)},peek(){return r.peek()}}},zi=(e,t={})=>{const{initialPage:r=1,...n}=t,s=$(r),o=K(()=>e(s.value),{...n,watch:n.watch});return{...o,page:s,next:async()=>(s.value=s.peek()+1,o.execute()),prev:async()=>{const c=s.peek();return c>1&&(s.value=c-1),o.execute()},goTo:async c=>(s.value=Math.max(1,c),o.execute())}},xi=(e,t)=>{const{getNextCursor:r,transform:n,initialCursor:s,immediate:o=!0,onSuccess:i,onError:a,...l}=t,c=$([]),f=$(t.defaultValue),m=$(null),d=$("idle"),p=D(()=>d.value==="pending"),u=$(s),h=D(()=>c.value.length===0||u.value!==void 0);let v=!1,b=0;const y=S=>n?n(S):S,w=async()=>{if(v)return f.peek();const S=++b;d.value="pending",m.value=null;try{const T=K(e(u.peek()),{...l,immediate:!1,watch:void 0}),P=await T.execute(),R=T.error.peek();if(T.dispose(),v||S!==b)return f.peek();if(R)return m.value=R,d.value="error",a?.(R),f.peek();if(P!==void 0){const O=P,C=[...c.peek(),O];c.value=C,u.value=r(O,C);const L=y(C);return f.value=L,d.value="success",i?.(L),L}return d.value="success",f.peek()}catch(T){if(v||S!==b)return f.peek();const P=T instanceof Error?T:new Error(String(T));return m.value=P,d.value="error",a?.(P),f.peek()}},E=async()=>(c.value=[],u.value=s,f.value=t.defaultValue,m.value=null,d.value="idle",b+=1,w()),k=()=>{b+=1,c.value=[],u.value=s,f.value=t.defaultValue,m.value=null,d.value="idle"},A=()=>{v||(v=!0,b+=1)};return o&&w(),{data:f,pages:c,error:m,status:d,pending:p,hasMore:h,fetchNextPage:w,refresh:E,clear:k,dispose:A}},ji=(e,t)=>{let r=!1,n=null;try{if(n=globalThis.localStorage,n){const i=`__bquery_test_${Math.random().toString(36).slice(2,9)}__`,a="__test__";try{n.setItem(i,a),n.getItem(i),r=!0}finally{try{n.removeItem(i)}catch{}}}}catch{r=!1}let s=t;if(r&&n)try{const i=n.getItem(e);i!==null&&(s=JSON.parse(i))}catch{}const o=$(s);return r&&n&&j(()=>{try{n.setItem(e,JSON.stringify(o.value))}catch{}}),o},Fi=(e,t)=>{const{interval:r,enabled:n=!0,pauseOnHidden:s=!0,pauseOnOffline:o=!0,immediate:i=!0,...a}=t;if(!Number.isFinite(r)||r<1)throw new Error("Polling interval must be a finite number of at least 1");const l=$(!1),c=$(!1),f=$(!1),m=typeof n=="function"?n:()=>n,d=D(()=>m()&&!l.value&&!(s&&c.value)&&!(o&&f.value)),p=K(e,{...a,immediate:i&&m()});let u,h=[];const v=()=>{b(),u=setInterval(()=>{p.execute()},r)},b=()=>{u!==void 0&&(clearInterval(u),u=void 0)},y=j(()=>{const k=d.value;ue(()=>{k?v():b()})});if(s&&typeof document<"u"){c.value=document.hidden;const k=()=>{c.value=document.hidden};document.addEventListener("visibilitychange",k),h.push(()=>document.removeEventListener("visibilitychange",k))}if(o&&typeof window<"u"){const k=()=>{f.value=!1},A=()=>{f.value=!0};window.addEventListener("online",k),window.addEventListener("offline",A),h.push(()=>{window.removeEventListener("online",k),window.removeEventListener("offline",A)}),f.value=typeof navigator<"u"&&navigator.onLine!==void 0?!navigator.onLine:!1}const w=p.dispose;return{...p,pause:()=>{l.value=!0},resume:()=>{l.value=!1},isActive:d,dispose:()=>{b(),y();for(const k of h)k();h=[],w()}}},xr=Symbol("bquery.readonlySignal"),jr=e=>typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,xr),I=e=>Object.defineProperties({},{value:{get(){return e.value},enumerable:!0},peek:{value(){return e.peek()},enumerable:!0},[xr]:{value:!0,enumerable:!1,configurable:!1,writable:!1}}),Ui=(e,t={})=>{const{optimistic:r=!1,onMutationSuccess:n,onMutationError:s,...o}=t,i=K(e,{...o}),a=$(!1),l=D(()=>a.value);let c=!1;const f=()=>{const v=typeof e=="function"?e():e;return v instanceof URL?v.toString():v},m=()=>{const{defaultValue:v,transform:b,onSuccess:y,onError:w,...E}=o;return E},d=async(v,b,y,w)=>{if(c)return i.data.peek();const E=i.data.peek();r&&w!==void 0&&(i.data.value=w),a.value=!0,i.error.value=null;try{const k=K(f(),{...m(),method:b,body:y??void 0,immediate:!1,watch:void 0}),A=await k.execute(),S=k.error.peek();return k.dispose(),c?i.data.peek():S?(r&&w!==void 0&&(i.data.value=E),i.error.value=S,i.status.value="error",a.value=!1,s?.(S,v),i.data.peek()):(b!=="DELETE"&&A!==void 0&&(i.data.value=A),a.value=!1,i.status.value="success",n?.(A,v),A)}catch(k){if(c)return i.data.peek();r&&w!==void 0&&(i.data.value=E);const A=k instanceof Error?k:new Error(String(k));return i.error.value=A,i.status.value="error",a.value=!1,s?.(A,v),i.data.peek()}},p={fetch:()=>i.execute(),create:v=>d("create","POST",v),update:v=>{const b=i.data.peek();return d("update","PUT",v,r&&b!==void 0?{...b,...v}:void 0)},patch:v=>{const b=i.data.peek();return d("patch","PATCH",v,r&&b!==void 0?{...b,...v}:void 0)},remove:async()=>{await d("remove","DELETE"),!c&&i.error.peek()==null&&(i.data.value=void 0)}},u=i.dispose,h=()=>{c||(c=!0,u())};return{data:i.data,error:i.error,status:i.status,pending:i.pending,isMutating:l,actions:p,refresh:i.execute,clear:i.clear,dispose:h}},Bi=(e,t={})=>{const{method:r="POST",...n}=t,s=$(void 0),o=$(null),i=$("idle"),a=D(()=>i.value==="pending");return{data:s,error:o,status:i,pending:a,submit:async f=>{i.value="pending",o.value=null;try{const m=K(e,{...n,method:r,body:f,immediate:!1,watch:void 0}),d=await m.execute(),p=m.error.peek();if(m.dispose(),p){o.value=p,i.value="error";return}return s.value=d,i.value="success",d}catch(m){o.value=m instanceof Error?m:new Error(String(m)),i.value="error";return}},clear:()=>{s.value=void 0,o.value=null,i.value="idle"}}},Wi=(e,t={})=>{const r=Pt({...t});let n=e;for(;n.endsWith("/");)n=n.slice(0,-1);return{list:s=>r.get(n,s),get:(s,o)=>r.get(`${n}/${encodeURIComponent(String(s))}`,o),create:(s,o)=>r.post(n,s,o),update:(s,o,i)=>r.put(`${n}/${encodeURIComponent(String(s))}`,o,i),patch:(s,o,i)=>r.patch(`${n}/${encodeURIComponent(String(s))}`,o,i),remove:(s,o)=>r.delete(`${n}/${encodeURIComponent(String(s))}`,o),http:r}},Hi=(e,t={})=>{const{getId:r=y=>y.id,optimistic:n=!1,onMutationSuccess:s,onMutationError:o,...i}=t,a=K(e,{...i}),l=$(!1),c=D(()=>l.value);let f=!1;const m=()=>{const y=typeof e=="function"?e():e;return y instanceof URL?y.toString():y},d=()=>{let y=m();for(;y.endsWith("/");)y=y.slice(0,-1);return y},p=()=>{const{defaultValue:y,transform:w,onSuccess:E,onError:k,...A}=i;return A},u=async(y,w,E,k,A,S)=>{if(!f){n&&A&&A(),l.value=!0,a.error.value=null;try{const T=K(`${d()}${E}`,{...p(),method:w,body:k??void 0,immediate:!1,watch:void 0}),P=await T.execute(),R=T.error.peek();if(T.dispose(),f)return;if(R){n&&S&&S(),a.error.value=R,a.status.value="error",l.value=!1,o?.(R,y);return}return l.value=!1,a.status.value="success",s?.(y),P}catch(T){if(f)return;n&&S&&S();const P=T instanceof Error?T:new Error(String(T));a.error.value=P,a.status.value="error",l.value=!1,o?.(P,y);return}}},h={fetch:()=>a.execute(),add:async y=>{const w=a.data.peek(),E=y,k=w?.length??0,A=await u("add","POST","",y,n?()=>{a.data.value=[...w??[],E]}:void 0,n?()=>{a.data.value=w}:void 0);if(A!==void 0&&!f){const S=a.data.peek()??[];if(n){const T=[...S];k<T.length&&T[k]===E?T[k]=A:T.push(A),a.data.value=T}else a.data.value=[...S,A]}return A},update:async(y,w)=>{const E=a.data.peek(),k=await u("update","PUT",`/${encodeURIComponent(String(y))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===y?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(k!==void 0&&!f){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===y?k:S)}return k},patch:async(y,w)=>{const E=a.data.peek(),k=await u("patch","PATCH",`/${encodeURIComponent(String(y))}`,w,n&&E?()=>{a.data.value=E.map(A=>r(A)===y?{...A,...w}:A)}:void 0,n?()=>{a.data.value=E}:void 0);if(k!==void 0&&!f){const A=a.data.peek()??[];a.data.value=A.map(S=>r(S)===y?k:S)}return k},remove:async y=>{const w=a.data.peek();if(await u("remove","DELETE",`/${encodeURIComponent(String(y))}`,void 0,n&&w?()=>{a.data.value=w.filter(E=>r(E)!==y)}:void 0,n?()=>{a.data.value=w}:void 0),!n&&!f&&a.error.peek()==null){const E=a.data.peek()??[];a.data.value=E.filter(k=>r(k)!==y)}}},v=a.dispose,b=()=>{f||(f=!0,v())};return{data:a.data,error:a.error,status:a.status,pending:a.pending,isMutating:c,actions:h,refresh:a.execute,clear:a.clear,dispose:b}},Mt=new Map;function Qi(e,t){const r=Mt.get(e);if(r)return r;const n=t().finally(()=>{Mt.delete(e)});return Mt.set(e,n),n}var fe=e=>e instanceof _e,qe=e=>e instanceof Ie,Vi=e=>e instanceof _e||e instanceof Ie||jr(e)?e.value:e,Nt=(e,t,r={})=>{const{immediate:n=!1,equals:s=Object.is}=r;let o,i=!0;return j(()=>{const a=e.value;if(i){i=!1,o=a,n&&t(a,void 0);return}s(a,o)||(t(a,o),o=a)})},Ki=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Number.isFinite(r)?Math.max(0,r):0;let a=!1,l,c;const f=()=>{m.cancel(),a=!1,c=void 0},m=Tt(()=>{if(a){try{t(l,c)}catch(p){console.error("bQuery reactive: Error in watchDebounce callback",p)}a=!1,c=void 0}},i);s&&t(e.peek(),void 0);const d=Nt(e,(p,u)=>{a||(c=u),l=p,a=!0,m()},{equals:o});return Pr()&&Mr(f),()=>{d(),f()}},Yi=(e,t,r,n={})=>{const{immediate:s=!1,equals:o=Object.is}=n,i=Cr((l,c)=>{t(l,c)},Number.isFinite(r)?Math.max(0,r):0);s&&i(e.peek(),void 0);const a=Nt(e,(l,c)=>{i(l,c)},{equals:o});return()=>{a(),i.cancel()}};function Fr(e){return e===!1?!1:e===!0||e===void 0?{}:e}var Gi=e=>e?e===!0?{}:e:!1,Ur=(e,t)=>{const r=t.delay??1e3,n=t.factor??2,s=t.maxDelay??3e4;return Math.min(r*n**e,s)},Dt=(e,t)=>{if(typeof t=="string"||t instanceof Blob||t instanceof ArrayBuffer){e.send(t);return}if(ArrayBuffer.isView(t)){e.send(t);return}if(typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer){e.send(t);return}throw new TypeError("Unsupported WebSocket payload type.")},Br=(e,t={})=>{const{protocols:r,immediate:n=!0,historySize:s=0,onOpen:o,onMessage:i,onClose:a,onError:l,onReconnect:c}=t,f=t.serialize??(N=>JSON.stringify(N)),m=t.deserialize??(N=>{const W=N.data;if(typeof W=="string")try{return JSON.parse(W)}catch{return W}return W}),d=$("CLOSED"),p=$(void 0),u=$(null),h=$([]),v=$(0),b=$(0),y=$(0),w=D(()=>d.value==="OPEN");let E=null,k=!1,A=!1,S,T,P,R=0,O=!1,C=0;const L=[],M=Fr(t.autoReconnect),_=Gi(t.heartbeat),U=()=>{if(!_)return;q();const N=_.interval??3e4,W=_.pongTimeout??1e4,V=_.message??"ping";T=setInterval(()=>{E?.readyState===WebSocket.OPEN&&(C=Date.now(),Dt(E,V),P!==void 0&&clearTimeout(P),P=setTimeout(()=>{E?.close(4e3,"Heartbeat timeout")},W))},N)},q=()=>{T!==void 0&&(clearInterval(T),T=void 0),P!==void 0&&(clearTimeout(P),P=void 0)},Q=()=>{P!==void 0&&(clearTimeout(P),P=void 0),C>0&&(b.value=Date.now()-C,C=0)},oe=N=>{if(k||A||!M)return;const W=M.maxAttempts??1/0;if(R>=W||M.shouldReconnect&&!M.shouldReconnect(N,R))return;const V=Ur(R,M);S=setTimeout(()=>{R++,v.value=R,O=!0,ir()},V)},Oe=()=>{S!==void 0&&(clearTimeout(S),S=void 0)},or=()=>{if(!E||E.readyState!==WebSocket.OPEN)return;let N=0;for(;N<L.length&&E.readyState===WebSocket.OPEN;N++)Dt(E,L[N]);N>0&&L.splice(0,N)},Ze=()=>{const N=typeof e=="function"?e():e;return N instanceof URL?N.toString():N},ir=()=>{if(!k){Oe(),E&&(q(),C=0,E.onopen=null,E.onmessage=null,E.onclose=null,E.onerror=null,(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&E.close(),E=null),A=!1,d.value="CONNECTING",u.value=null;try{E=new WebSocket(Ze(),r)}catch{d.value="CLOSED";return}E.onopen=N=>{d.value="OPEN";const W=O,V=R;R=0,v.value=0,O=!1,or(),U(),o?.(N),W&&c?.(V)},E.onmessage=N=>{if(_){const V=_.responseMessage;(V===void 0||N.data===V)&&Q()}const W=m(N);if(p.value=W,s>0){const V=[...h.peek(),W];h.value=V.length>s?V.slice(-s):V}i?.(W,N)},E.onclose=N=>{d.value="CLOSED",q(),A||(y.value=Date.now()),a?.(N),!A&&!k&&oe(N)},E.onerror=N=>{u.value=N,l?.(N)}}},Ws=(N,W)=>{A=!0,Oe(),q(),E&&(E.readyState===WebSocket.OPEN||E.readyState===WebSocket.CONNECTING)&&(d.value="CLOSING",E.close(N,W))},qf=N=>{k||Hs(f(N))},Hs=N=>{k||(E?.readyState===WebSocket.OPEN?Dt(E,N):L.push(N))},zf=()=>{k||(k=!0,Ws(),L.length=0,E=null)};return n&&ir(),{status:d,data:p,error:u,history:h,isConnected:w,reconnectAttempts:v,latency:b,lastDisconnectedAt:y,send:qf,sendRaw:Hs,open:ir,close:Ws,dispose:zf}},Ji=(e,t={},r={})=>{const n=r.getChannel??(f=>f.channel),s=r.wrap??((f,m)=>({channel:f,data:m})),o=new Map,i=new Map,a=Br(e,{...t,onMessage:(f,m)=>{const d=n(f);if(d!==void 0){const p=o.get(d);p&&(p.value=f)}t.onMessage?.(f,m)}});return{subscribe:f=>{let m=o.get(f);m||(m=$(void 0),o.set(f,m)),i.set(f,(i.get(f)??0)+1);let d=!1;return{data:m,unsubscribe:()=>{if(d)return;d=!0;const p=(i.get(f)??1)-1;p<=0?(i.delete(f),o.delete(f)):i.set(f,p)}}},publish:(f,m)=>{a.send(s(f,m))},ws:a}},Xi=(e,t={})=>{const{immediate:r=!0,events:n=[],eventSourceInit:s,onOpen:o,onMessage:i,onError:a}=t,l=t.deserialize??(O=>{try{return JSON.parse(O)}catch{return O}}),c=$("CLOSED"),f=$(void 0),m=$(void 0),d=$(null),p=D(()=>c.value==="OPEN"),u=Fr(t.autoReconnect);let h=null,v=!1,b=!1,y,w=0;const E=()=>{const O=typeof e=="function"?e():e;return O instanceof URL?O.toString():O},k=O=>C=>{const L=l(C.data);f.value=L,m.value=O,i?.(L,C)},A=()=>{y!==void 0&&(clearTimeout(y),y=void 0)},S=()=>{if(v||b||!u)return;const O=u.maxAttempts??1/0;if(w>=O)return;const C=Ur(w,u);y=setTimeout(()=>{w++,T()},C)},T=()=>{if(!v){A(),h&&(h.close(),h=null),b=!1,c.value="CONNECTING",d.value=null;try{h=new EventSource(E(),s)}catch{c.value="CLOSED";return}h.onopen=O=>{c.value="OPEN",w=0,o?.(O)},h.onerror=O=>{d.value=O,a?.(O),h?.readyState===EventSource.CLOSED&&(c.value="CLOSED",!b&&!v&&S())},h.addEventListener("message",k("message"));for(const O of n)h.addEventListener(O,k(O))}},P=()=>{b=!0,A(),h&&(h.close(),h=null),c.value="CLOSED"},R=()=>{v||(v=!0,P())};return r&&T(),{status:c,data:f,eventName:m,error:d,isConnected:p,open:T,close:P,dispose:R}},F=class extends Error{constructor(e,t,r){super(e),this.name="TaskWorkerError",this.code=t,r!==void 0&&(this.cause=r)}},It=class extends F{constructor(e="Concurrency tasks are not supported in this environment.",t){super(e,"UNSUPPORTED",t),this.name="TaskWorkerUnsupportedError"}},de=class extends F{constructor(e,t){super(e,"SERIALIZATION",t),this.name="TaskWorkerSerializationError"}},lt=class extends F{constructor(e,t){super(e,"TIMEOUT",t),this.name="TaskWorkerTimeoutError"}},ae=class extends F{constructor(e="The worker task was aborted.",t){super(e,"ABORT",t),this.name="TaskWorkerAbortError"}},Zi=new Set(["ABORT","BUSY","METHOD_NOT_FOUND","QUEUE_CLEARED","QUEUE_FULL","SERIALIZATION","TERMINATED","TIMEOUT","UNSUPPORTED","WORKER"]),ea=/\{\s*\[native code\]\s*\}$/u,ta=e=>typeof e=="string"&&Zi.has(e),ct=e=>{if(!(typeof e!="number"||!Number.isFinite(e)||e<=0))return e},ze=e=>{const t=Function.prototype.toString.call(e).trim();if(!t||ea.test(t))throw new de("Task handlers must be standalone user-defined functions or arrow functions.");try{if(typeof new Function(`return (${t});`)()!="function")throw new TypeError("Task handler did not revive as a function.")}catch(r){throw new de("Task handlers must be standalone functions that can be reconstructed in a worker context.",r)}return t},Wr=(e,t)=>{const r=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(r);try{return new Worker(n,t?{name:t}:void 0)}finally{URL.revokeObjectURL(n)}},Hr=e=>{const t=e?.message||"Worker task failed.",r=ta(e?.code)?e.code:"WORKER",n=r==="TIMEOUT"?new lt(t):new F(t,r);return n.name=e?.name||n.name,e?.stack&&(n.stack=e.stack),n};function Qr(){const e=typeof globalThis.Worker=="function",t=typeof globalThis.Blob=="function",r=typeof globalThis.URL<"u"&&globalThis.URL!==null&&typeof globalThis.URL.createObjectURL=="function"&&typeof globalThis.URL.revokeObjectURL=="function";return{worker:e,blob:t,objectUrl:r,abortController:typeof globalThis.AbortController=="function",supported:e&&t&&r}}function _t(){return Qr().supported}var Vr="bq:rpc",ra=e=>{const t=Object.keys(e);if(t.length===0)throw new de("RPC workers require at least one standalone method handler.");return t.map(r=>{const n=e[r];if(typeof n!="function")throw new de(`RPC handler "${r}" must be a standalone function.`);return[r,ze(n)]})},na=e=>`'use strict';
|
|
2
|
+
const serializeError = (error) => {
|
|
3
|
+
if (error && typeof error === 'object') {
|
|
4
|
+
return {
|
|
5
|
+
code: typeof error.code === 'string' ? error.code : undefined,
|
|
6
|
+
message: typeof error.message === 'string' ? error.message : 'Worker RPC call failed.',
|
|
7
|
+
name: typeof error.name === 'string' ? error.name : 'Error',
|
|
8
|
+
stack: typeof error.stack === 'string' ? error.stack : undefined,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
message: typeof error === 'string' ? error : 'Worker RPC call failed.',
|
|
14
|
+
name: 'Error',
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const handlers = Object.create(null);
|
|
19
|
+
${e.map(([t,r])=>`handlers[${JSON.stringify(t)}] = (${r});`).join(`
|
|
20
|
+
`)}
|
|
21
|
+
|
|
22
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
23
|
+
|
|
24
|
+
self.onmessage = async (event) => {
|
|
25
|
+
const message = event.data;
|
|
26
|
+
if (!message || message.type !== '${Vr}') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const method = typeof message.method === 'string' ? message.method : '';
|
|
31
|
+
if (!hasOwn.call(handlers, method)) {
|
|
32
|
+
self.postMessage({
|
|
33
|
+
error: {
|
|
34
|
+
code: 'METHOD_NOT_FOUND',
|
|
35
|
+
message: 'Unknown RPC method "' + String(method) + '".',
|
|
36
|
+
name: 'TaskWorkerError',
|
|
37
|
+
},
|
|
38
|
+
id: message.id,
|
|
39
|
+
type: 'bq:error',
|
|
40
|
+
});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const result = await handlers[method](message.payload);
|
|
46
|
+
self.postMessage({ id: message.id, result, type: 'bq:result' });
|
|
47
|
+
} catch (error) {
|
|
48
|
+
self.postMessage({ error: serializeError(error), id: message.id, type: 'bq:error' });
|
|
49
|
+
}
|
|
50
|
+
};`;function ut(e,t={}){if(!_t())throw new It;const r=na(ra(e)),n=ct(t.timeout);let s=!1,o=null,i=null,a=0,l;const c=()=>{i&&(i.timeoutId!==void 0&&clearTimeout(i.timeoutId),i.abortHandler&&l?.removeEventListener("abort",i.abortHandler),i=null,l=void 0)},f=()=>{o&&(o.onmessage=null,o.onerror=null,o.terminate(),o=null)},m=u=>{if(!i)return;const h=i;c(),h.reject(u)},d=()=>{if(s)throw new F("The RPC worker has already been terminated.","TERMINATED");if(o)return o;const u=Wr(r,t.name);return u.onmessage=h=>{const v=i;if(!v)return;const b=h.data;if(!(!b||b.id!==v.id)){if(c(),b.type==="bq:error"){v.reject(Hr(b.error));return}v.resolve(b.result)}},u.onerror=h=>{const v=new F(h.message||"Worker RPC execution failed.","WORKER");f(),m(v)},o=u,u},p=u=>{f(),m(u)};return{get busy(){return i!==null},get state(){return s?"terminated":i?"running":"idle"},call(u,h,v={}){if(s)return Promise.reject(new F("The RPC worker has already been terminated.","TERMINATED"));if(i)return Promise.reject(new F("This RPC worker is already processing a request. Wait for the current call to finish or create another worker.","BUSY"));if(v.signal?.aborted)return Promise.reject(new ae);const b=d(),y=ct(v.timeout)??n,w=a++;return new Promise((E,k)=>{const A={id:w,reject:k,resolve:E};v.signal&&(A.abortHandler=()=>{p(new ae)},l=v.signal,v.signal.addEventListener("abort",A.abortHandler,{once:!0})),y!==void 0&&(A.timeoutId=setTimeout(()=>{p(new lt(`Worker RPC call exceeded the timeout of ${y}ms.`))},y)),i=A;try{b.postMessage({id:w,method:u,payload:h,type:Vr},v.transfer??[])}catch(S){f(),m(new de("Failed to serialize the RPC payload or transfer list for worker execution.",S))}})},terminate(){s||(s=!0,f(),m(new F("The RPC worker was terminated.","TERMINATED")))}}}async function sa(e,t,r,n={}){const s=ut(e,n);try{return await s.call(t,r,n)}finally{s.terminate()}}var Kr="bq:run",oa=e=>`'use strict';
|
|
51
|
+
const serializeError = (error) => {
|
|
52
|
+
if (error && typeof error === 'object') {
|
|
53
|
+
return {
|
|
54
|
+
code: typeof error.code === 'string' ? error.code : undefined,
|
|
55
|
+
message: typeof error.message === 'string' ? error.message : 'Worker task failed.',
|
|
56
|
+
name: typeof error.name === 'string' ? error.name : 'Error',
|
|
57
|
+
stack: typeof error.stack === 'string' ? error.stack : undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
message: typeof error === 'string' ? error : 'Worker task failed.',
|
|
63
|
+
name: 'Error',
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handler = (${e});
|
|
68
|
+
|
|
69
|
+
if (typeof handler !== 'function') {
|
|
70
|
+
throw new TypeError('The worker task handler must evaluate to a function.');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
self.onmessage = async (event) => {
|
|
74
|
+
const message = event.data;
|
|
75
|
+
if (!message || message.type !== '${Kr}') {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const result = await handler(message.payload);
|
|
81
|
+
self.postMessage({ id: message.id, result, type: 'bq:result' });
|
|
82
|
+
} catch (error) {
|
|
83
|
+
self.postMessage({ error: serializeError(error), id: message.id, type: 'bq:error' });
|
|
84
|
+
}
|
|
85
|
+
};`;function ft(e,t={}){if(!_t())throw new It;const r=oa(ze(e)),n=ct(t.timeout);let s=!1,o=null,i=null,a=0;const l=()=>{i&&(i.timeoutId!==void 0&&clearTimeout(i.timeoutId),i.abortHandler&&c?.removeEventListener("abort",i.abortHandler),i=null,c=void 0)};let c;const f=()=>{o&&(o.onmessage=null,o.onerror=null,o.terminate(),o=null)},m=u=>{if(!i)return;const h=i;l(),h.reject(u)},d=()=>{if(s)throw new F("The task worker has already been terminated.","TERMINATED");if(o)return o;const u=Wr(r,t.name);return u.onmessage=h=>{const v=i;if(!v)return;const b=h.data;if(!(!b||b.id!==v.id)){if(l(),b.type==="bq:error"){v.reject(Hr(b.error));return}v.resolve(b.result)}},u.onerror=h=>{const v=new F(h.message||"Worker execution failed.","WORKER");f(),m(v)},o=u,u},p=u=>{f(),m(u)};return{get busy(){return i!==null},get state(){return s?"terminated":i?"running":"idle"},run(u,h={}){if(s)return Promise.reject(new F("The task worker has already been terminated.","TERMINATED"));if(i)return Promise.reject(new F("This task worker is already running a task. Create another worker or wait for the current task to finish.","BUSY"));if(h.signal?.aborted)return Promise.reject(new ae);const v=d(),b=ct(h.timeout)??n,y=a++;return new Promise((w,E)=>{const k={id:y,reject:E,resolve:w};h.signal&&(k.abortHandler=()=>{p(new ae)},c=h.signal,h.signal.addEventListener("abort",k.abortHandler,{once:!0})),b!==void 0&&(k.timeoutId=setTimeout(()=>{p(new lt(`Worker task exceeded the timeout of ${b}ms.`))},b)),i=k;try{v.postMessage({id:y,payload:u,type:Kr},h.transfer??[])}catch(A){f(),m(new de("Failed to serialize the task input or transfer list for worker execution.",A))}})},terminate(){s||(s=!0,f(),m(new F("The task worker was terminated.","TERMINATED")))}}}async function Yr(e,t,r={}){const n=ft(e,r);try{return await n.run(t,r)}finally{n.terminate()}}var ia=4,Gr=(e,t)=>{if(e===void 0)return ia;if(!Number.isInteger(e)||e<1)throw new RangeError(`${t} concurrency must be a positive integer.`);return e},Jr=(e,t)=>{if(e===void 0)return Number.POSITIVE_INFINITY;if(e===Number.POSITIVE_INFINITY)return e;if(!Number.isInteger(e)||e<0)throw new RangeError(`${t} maxQueue must be a non-negative integer or Infinity.`);return e},dt=e=>{e.abortHandler&&e.signal&&e.signal.removeEventListener("abort",e.abortHandler),e.abortHandler=void 0,e.signal=void 0},Xr=({abortedWhileQueuedMessage:e,clearMessage:t,concurrency:r,createWorkers:n,queueFullMessage:s,terminatedMessage:o,workerTerminatedMessage:i,runWorker:a,maxQueue:l})=>{const c=[],f=n(r);let m=!1,d=0;const p=()=>{if(!(m||c.length===0))for(const h of f){if(c.length===0)return;if(h.busy)continue;const v=c.shift();if(v.signal?.aborted){dt(v),v.reject(new ae(e));continue}dt(v),d++,a(h,v.job,v.options).then(v.resolve,v.reject).finally(()=>{d--,p()})}},u=h=>{const v=c.splice(0);for(const b of v)dt(b),b.reject(h)};return{get state(){return m?"terminated":d>0||c.length>0?"running":"idle"},get busy(){return d>0||c.length>0},concurrency:r,get pending(){return d},get size(){return c.length},enqueue(h,v={}){return m?Promise.reject(new F(i,"TERMINATED")):v.signal?.aborted?Promise.reject(new ae):new Promise((b,y)=>{const w={job:h,options:v,reject:y,resolve:b},E=f.find(k=>!k.busy);if(E){d++,a(E,h,v).then(b,y).finally(()=>{d--,p()});return}if(c.length>=l){y(new F(s,"QUEUE_FULL"));return}v.signal&&(w.signal=v.signal,w.abortHandler=()=>{const k=c.indexOf(w);k!==-1&&(c.splice(k,1),dt(w),y(new ae(e)))},v.signal.addEventListener("abort",w.abortHandler,{once:!0})),c.push(w)})},clear(){m||c.length===0||u(new F(t,"QUEUE_CLEARED"))},terminate(){if(!m){m=!0,u(new F(o,"TERMINATED"));for(const h of f)"terminate"in h&&typeof h.terminate=="function"&&h.terminate()}}}},Zr=(e,t)=>e?t===1?[e]:Array.from({length:t},(r,n)=>`${e}-${n+1}`):Array.from({length:t},()=>{});function ht(e,t={}){const{concurrency:r,maxQueue:n,...s}=t,o=Xr({abortedWhileQueuedMessage:"The queued task was aborted before execution started.",clearMessage:"The task pool queue was cleared.",concurrency:Gr(r,"Task pool"),createWorkers(i){const a=[],l=Zr(s.name,i);try{for(let c=0;c<i;c++)a.push(ft(e,{...s,name:l[c]}))}catch(c){for(const f of a)f.terminate();throw c}return a},queueFullMessage:"The task pool queue is full. Increase maxQueue, wait for pending tasks, or raise pool concurrency.",terminatedMessage:"The task pool was terminated.",workerTerminatedMessage:"The task pool has already been terminated.",runWorker(i,a,l){return i.run(a,l)},maxQueue:Jr(n,"Task pool")});return{get state(){return o.state},get busy(){return o.busy},get concurrency(){return o.concurrency},get pending(){return o.pending},get size(){return o.size},run(i,a){return o.enqueue(i,a)},clear(){o.clear()},terminate(){o.terminate()}}}function en(e,t={}){const{concurrency:r,maxQueue:n,...s}=t,o=Xr({abortedWhileQueuedMessage:"The queued RPC call was aborted before execution started.",clearMessage:"The RPC pool queue was cleared.",concurrency:Gr(r,"RPC pool"),createWorkers(i){const a=[],l=Zr(s.name,i);try{for(let c=0;c<i;c++)a.push(ut(e,{...s,name:l[c]}))}catch(c){for(const f of a)f.terminate();throw c}return a},queueFullMessage:"The RPC pool queue is full. Increase maxQueue, wait for pending calls, or raise pool concurrency.",terminatedMessage:"The RPC pool was terminated.",workerTerminatedMessage:"The RPC pool has already been terminated.",runWorker(i,a,l){return i.call(a.method,a.input,l)},maxQueue:Jr(n,"RPC pool")});return{get state(){return o.state},get busy(){return o.busy},get concurrency(){return o.concurrency},get pending(){return o.pending},get size(){return o.size},call(i,a,l){return o.enqueue({input:a,method:i},l)},clear(){o.clear()},terminate(){o.terminate()}}}var aa=async e=>{const t=new Function(`return (${e.handlerSource});`)();if(typeof t!="function")throw new TypeError("The serialized task handler did not revive as a function.");return await t(e.input)},la=async e=>{const t=new Function(`return (${e.handlerSource});`)();if(typeof t!="function")throw new TypeError("The serialized collection handler did not revive as a function.");const r=[];for(const n of e.items)r.push({index:n.index,value:await t(n.value,n.index)});return r},ca=async e=>{const t=new Function(`return (${e.reducerSource});`)();if(typeof t!="function")throw new TypeError("The serialized reducer did not revive as a function.");let r=e.initialValue;for(let n=0;n<e.values.length;n++)r=await t(r,e.values[n],n);return r},tn=(e,t)=>{if(e===void 0)return 1;if(!Number.isInteger(e)||e<1)throw new RangeError(`${t} batchSize must be a positive integer.`);return e},rn=e=>ht(aa,e),nn=e=>({handlerSource:ze(e.handler),input:e.input}),xe=async(e,t,r={},n)=>{if(e.length===0)return[];const s=ze(t),{batchSize:o,signal:i,...a}=r,l=tn(o,n),c=ht(la,a),f=[];for(let m=0;m<e.length;m+=l){const d=Math.min(m+l,e.length),p=[];for(let u=m;u<d;u+=1)p.push({index:u,value:e[u]});f.push({items:p,handlerSource:s})}try{const m=await Promise.all(f.map(p=>c.run(p,i?{signal:i}:void 0))),d=new Array(e.length);for(const p of m)for(const u of p)d[u.index]=u.value;return d}finally{c.terminate()}};async function ua(e,t={}){if(e.length===0)return[];const r=rn(t);try{return await Promise.all(e.map(n=>r.run(nn(n),n.options)))}finally{r.terminate()}}async function fa(e,t,r={}){if(e.length===0)return[];const n=tn(t,"batchTasks"),s=rn(r),o=[];try{for(let i=0;i<e.length;i+=n){const a=e.slice(i,i+n),l=await Promise.all(a.map(c=>s.run(nn(c),c.options)));o.push(...l)}return o}finally{s.terminate()}}async function sn(e,t,r={}){return xe(e,t,r,"map")}async function on(e,t,r={}){const n=await xe(e,t,r,"filter"),s=[];for(let o=0;o<e.length;o+=1)n[o]&&(o in e?s.push(e[o]):s.length+=1);return s}async function an(e,t,r={}){return e.length===0?!1:(await xe(e,t,r,"some")).some(Boolean)}async function ln(e,t,r={}){return e.length===0?!0:(await xe(e,t,r,"every")).every(Boolean)}async function cn(e,t,r={}){if(e.length===0)return;const n=(await xe(e,t,r,"find")).findIndex(Boolean);return n===-1?void 0:e[n]}async function un(e,t,r,n={}){return e.length===0?r:Yr(ca,{initialValue:r,reducerSource:ze(t),values:e},n)}var je=(e,t={})=>({...e,...t}),da=(e,t={})=>({signal:"signal"in t?t.signal:e.signal,timeout:"timeout"in t?t.timeout:e.timeout,transfer:t.transfer}),ha=class Qs{constructor(t,r){this.valuesPromise=t,this.defaults=r}createNext(t){return new Qs(this.valuesPromise.then(r=>t(r)),this.defaults)}map(t,r){const n=je(this.defaults,r);return this.createNext(s=>sn(s,t,n))}filter(t,r){const n=je(this.defaults,r);return this.createNext(s=>on(s,t,n))}toArray(){return this.valuesPromise.then(t=>t.slice())}some(t,r){const n=je(this.defaults,r);return this.valuesPromise.then(s=>an(s,t,n))}every(t,r){const n=je(this.defaults,r);return this.valuesPromise.then(s=>ln(s,t,n))}find(t,r){const n=je(this.defaults,r);return this.valuesPromise.then(s=>cn(s,t,n))}reduce(t,r,n){const s=da(this.defaults,n);return this.valuesPromise.then(o=>un(o,t,r,s))}};function ma(e,t={}){return new ha(Promise.resolve(e.slice()),t)}var fn=(e,t)=>{ce(()=>{t.state.value=e.state,t.busy.value=e.busy})},dn=(e,t)=>{ce(()=>{t.state.value=e.state,t.busy.value=e.busy,t.concurrency.value=e.concurrency,t.pending.value=e.pending,t.size.value=e.size})},hn=e=>({busy:$(e.busy),state:$(e.state)}),mn=e=>({busy:$(e.busy),concurrency:$(e.concurrency),pending:$(e.pending),size:$(e.size),state:$(e.state)}),mt=(e,t)=>(t(),e.finally(()=>{t(),queueMicrotask(t)}));function pa(e,t={}){const r=ft(e,t),n=hn(r),s=()=>{fn(r,n)};return{get busy(){return r.busy},get state(){return r.state},busy$:I(n.busy),state$:I(n.state),run(o,i={}){return mt(r.run(o,i),s)},terminate(){r.terminate(),s()}}}function va(e,t={}){const r=ut(e,t),n=hn(r),s=()=>{fn(r,n)};return{get busy(){return r.busy},get state(){return r.state},busy$:I(n.busy),state$:I(n.state),call(o,i,a={}){return mt(r.call(o,i,a),s)},terminate(){r.terminate(),s()}}}function ya(e,t={}){const r=ht(e,t),n=mn(r),s=()=>{dn(r,n)};return{get busy(){return r.busy},get concurrency(){return r.concurrency},get pending(){return r.pending},get size(){return r.size},get state(){return r.state},busy$:I(n.busy),concurrency$:I(n.concurrency),pending$:I(n.pending),size$:I(n.size),state$:I(n.state),run(o,i={}){return mt(r.run(o,i),s)},clear(){r.clear(),s()},terminate(){r.terminate(),s()}}}function ga(e,t={}){const r=en(e,t),n=mn(r),s=()=>{dn(r,n)};return{get busy(){return r.busy},get concurrency(){return r.concurrency},get pending(){return r.pending},get size(){return r.size},get state(){return r.state},busy$:I(n.busy),concurrency$:I(n.concurrency),pending$:I(n.pending),size$:I(n.size),state$:I(n.state),call(o,i,a={}){return mt(r.call(o,i,a),s)},clear(){r.clear(),s()},terminate(){r.terminate(),s()}}}var ba=(e,t)=>{const{type:r}=t;if(r===String)return e;if(r===Number)return Number(e);if(r===Boolean){const n=e.trim().toLowerCase();return n===""||n==="true"||n==="1"?!0:n==="false"||n==="0"?!1:!!e}if(r===Object||r===Array)try{return JSON.parse(e)}catch{return e}if(typeof r=="function"){const n=r,s=r;if(t.construct===!0)return Reflect.construct(s,[e]);if(t.construct===!1)return n(e);const o=r.prototype!==void 0&&r.prototype!==null,i=(o?Object.getOwnPropertyNames(r.prototype):[]).length>1,a=o&&r.prototype.constructor!==r,l=/^class\s/.test(Function.prototype.toString.call(r));if(i||a||l)try{return Reflect.construct(s,[e])}catch{return n(e)}try{const c=n(e);if(c===void 0&&o)try{return Reflect.construct(s,[e])}catch{return c}return c}catch(c){if(c instanceof TypeError&&/cannot be invoked without 'new'|is not a function/i.test(c.message))return Reflect.construct(s,[e]);throw c}}return e},qt=()=>{try{const e=globalThis;if(typeof e.__BQUERY_DEV__=="boolean")return e.__BQUERY_DEV__;const t=e.process?.env?.NODE_ENV;if(typeof t=="string")return t!=="production";const r=e.process?.versions?.node;if(typeof r=="string"&&r.length>0)return!0;const n=e.process?.release?.name;return n==="node"||n==="io.js"}catch{return!1}},Fe;function le(e){const t=Fe;return Fe=e,t}function pn(){const e=[];return{addDisposer(t){e.push(t)},dispose(){for(const t of e)try{t()}catch(r){qt()&&typeof console<"u"&&typeof console.error=="function"&&console.error("bQuery component: Error disposing scoped resource",r)}e.length=0}}}function wa(e){const t=Fe;if(!t)throw new Error("bQuery component: useSignal() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=$(e);return t.addDisposer(()=>r.dispose()),r}function Ea(e){const t=Fe;if(!t)throw new Error("bQuery component: useComputed() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=D(e);return t.addDisposer(()=>r.dispose()),r}function Sa(e){const t=Fe;if(!t)throw new Error("bQuery component: useEffect() must be called inside a component lifecycle hook. Avoid calling it directly from render()");const r=j(e);return t.addDisposer(r),r}var Aa=["slot"],ka=["part","disabled","checked","placeholder","value","rows","cols","readonly","required","maxlength","minlength","max","min","step","pattern","autocomplete","autofocus","for","multiple","selected","wrap"],vn=(e,t)=>{const r=[...Aa,...t.sanitize?.allowTags??[]],n=[...ka,...t.sanitize?.allowAttributes??[]],s=Object.values(t.signals??{}),i=(c=>c===!1?!1:c==="closed"?"closed":"open")(t.shadow),a=Array.from(new Set([...Object.keys(t.props??{}),...t.observeAttributes??[]]));class l extends HTMLElement{constructor(){super(),this.state={...t.state??{}},this.props={},this.missingRequiredProps=new Set,this.hasMounted=!1,i!==!1?this.renderRootNode=this.attachShadow({mode:i}):this.renderRootNode=this,this.syncProps()}static get observedAttributes(){return a}connectedCallback(){try{if(!this.hasMounted&&this.missingRequiredProps.size>0)return;if(this.hasMounted){this.scope=pn();const f=le(this.scope);try{t.connected?.call(this)}catch(m){this.handleError(m)}finally{le(f)}this.setupSignalSubscriptions(!0);return}this.mount()}catch(f){this.handleError(f)}}mount(){if(this.hasMounted)return;const f=le(this.ensureScope());let m=!1;try{t.beforeMount?.call(this),t.connected?.call(this)}catch(d){m=!0,this.handleError(d)}finally{le(f)}if(m){this.scope?.dispose(),this.scope=void 0;return}this.render(),this.setupSignalSubscriptions(),this.hasMounted=!0}disconnectedCallback(){try{this.signalEffectCleanup?.(),this.signalEffectCleanup=void 0,this.scope?.dispose(),this.scope=void 0,t.disconnected?.call(this)}catch(f){this.handleError(f)}}attributeChangedCallback(f,m,d){try{const p=this.cloneProps();if(this.syncProps(),t.onAttributeChanged){const u=le(this.ensureScope());try{t.onAttributeChanged.call(this,f,m,d)}finally{le(u)}}this.hasMounted?this.render(!0,p,{name:f,oldValue:m,newValue:d}):this.isConnected&&this.missingRequiredProps.size===0&&this.mount()}catch(p){this.handleError(p)}}adoptedCallback(){if(!t.onAdopted)return;const f=le(this.ensureScope());try{t.onAdopted.call(this)}catch(m){this.handleError(m)}finally{le(f)}}handleError(f){t.onError?t.onError.call(this,f):console.error(`bQuery component error in <${e}>:`,f)}ensureScope(){return this.scope??(this.scope=pn())}setState(f,m){this.state[f]=m,this.render(!0,this.cloneProps(),void 0,!1)}getState(f){return this.state[f]}setupSignalSubscriptions(f=!1){if(this.signalEffectCleanup||s.length===0)return;let m=!0;this.signalEffectCleanup=j(()=>{try{for(const p of s)p.value;if(m){if(m=!1,f&&this.hasMounted&&this.isConnected){const p=this.cloneProps();ue(()=>{this.render(!0,p,void 0,!1)})}return}if(!this.hasMounted||!this.isConnected)return;const d=this.cloneProps();ue(()=>{this.render(!0,d,void 0,!1)})}catch(d){this.handleError(d)}})}syncProps(){const f=t.props??{};for(const[m,d]of Object.entries(f)){const p=this.getAttribute(m);let u;if(p==null?d.required&&d.default===void 0?(this.missingRequiredProps.add(m),u=void 0):u=d.default??void 0:(this.missingRequiredProps.has(m)&&this.missingRequiredProps.delete(m),u=ba(p,d)),d.validator&&u!==void 0&&!d.validator(u))throw new Error(`bQuery component: validation failed for prop "${m}" with value ${JSON.stringify(u)}`);this.props[m]=u}}cloneProps(){return{...this.props}}render(f=!1,m,d,p=!0){try{if(f&&p&&t.beforeUpdate){if(!m)throw new Error("bQuery component: previous props are required for update renders");if(t.beforeUpdate.call(this,this.props,m)===!1)return}const u=(y,w)=>{this.dispatchEvent(new CustomEvent(y,{detail:w,bubbles:!0,composed:!0}))},h=this.renderRootNode,v=X(t.render({props:this.props,state:this.state,signals:t.signals??{},emit:u}),{allowTags:r,allowAttributes:n});let b=null;if(t.styles&&(b=h.querySelector("style[data-bquery-component-style]")),h.innerHTML=v,t.styles){const y=b??document.createElement("style");b||y.setAttribute("data-bquery-component-style",""),y.textContent=t.styles,h.prepend(y)}f&&t.updated?.call(this,d)}catch(u){this.handleError(u)}}}return l};function Ta(e,t){return vn(e,t)}function Ee(e,t){const r=vn(e,t);customElements.get(e)||customElements.define(e,r)}var yn=Symbol("bquery.booleanAttribute"),Ca=/^[^\0-\x20"'/>=]+$/,gn=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return t[yn]===!0&&typeof t.enabled=="boolean"&&typeof t.name=="string"},bn=e=>gn(e)?e.enabled?e.name:"":String(e??""),Ra={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Oa=e=>gn(e)?e.enabled?e.name:"":bn(e).replace(/[&<>"'`]/g,t=>Ra[t]),La=(e,t)=>{if(!Ca.test(e))throw new TypeError(`Invalid boolean attribute name: ${e}`);return Object.freeze({[yn]:!0,enabled:!!t,name:e})},Se=(e,...t)=>e.reduce((r,n,s)=>`${r}${n}${bn(t[s])}`,""),$a=(e,...t)=>{const r=n=>so(n)?oo(n):Oa(n);return mr(e.reduce((n,s,o)=>`${n}${s}${o<t.length?r(t[o]):""}`,""))},pt=`
|
|
2
86
|
:host {
|
|
3
87
|
color: inherit;
|
|
4
88
|
font: inherit;
|
|
5
89
|
}
|
|
6
|
-
`,
|
|
7
|
-
${
|
|
90
|
+
`,wn=`
|
|
91
|
+
${pt}
|
|
8
92
|
.field {
|
|
9
93
|
display: inline-flex;
|
|
10
94
|
flex-direction: column;
|
|
@@ -38,8 +122,8 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
|
|
|
38
122
|
color: #94a3b8;
|
|
39
123
|
cursor: not-allowed;
|
|
40
124
|
}
|
|
41
|
-
`,
|
|
42
|
-
${
|
|
125
|
+
`,B=e=>br(e),zt=new WeakMap,xt=(e,t)=>zt.get(e)?.[t],jt=(e,t,r)=>{const n=zt.get(e)??{};n[t]=r,zt.set(e,n)},Pa=(e,t,r)=>{if(r.label!==t.label||r.type!==t.type||r.placeholder!==t.placeholder||r.name!==t.name||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("input.control");return!s||s.type!==t.type||s.placeholder!==t.placeholder||s.name!==t.name||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},Ma=(e,t,r)=>{if(r.label!==t.label||r.placeholder!==t.placeholder||r.name!==t.name||r.rows!==t.rows||r.disabled!==t.disabled)return!1;const n=e.shadowRoot;if(!n||(n.querySelector(".label")?.textContent??"")!==t.label)return!1;const s=n.querySelector("textarea.control");return!s||s.placeholder!==t.placeholder||s.name!==t.name||Number(s.rows)!==t.rows||s.disabled!==t.disabled?!1:(s.value!==t.value&&(s.value=t.value),!0)},Na=e=>["<textarea",' part="control"',' class="control"',` placeholder="${B(e.placeholder)}"`,` name="${B(e.name)}"`,` rows="${e.rows}"`,e.disabled?" disabled":"",`>${B(e.value)}</textarea>`].join(""),Da=(e={})=>{const t=e.prefix??Z().components?.prefix??"bq",r={button:`${t}-button`,card:`${t}-card`,input:`${t}-input`,textarea:`${t}-textarea`,checkbox:`${t}-checkbox`};return Ee(r.button,{props:{label:{type:String,default:""},variant:{type:String,default:"primary"},size:{type:String,default:"md"},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1}},styles:`
|
|
126
|
+
${pt}
|
|
43
127
|
button {
|
|
44
128
|
appearance: none;
|
|
45
129
|
border: 0;
|
|
@@ -76,18 +160,18 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
|
|
|
76
160
|
cursor: not-allowed;
|
|
77
161
|
opacity: 0.6;
|
|
78
162
|
}
|
|
79
|
-
`,render:({props:n})=>
|
|
163
|
+
`,render:({props:n})=>Se`
|
|
80
164
|
<button
|
|
81
165
|
part="button"
|
|
82
|
-
type="${
|
|
83
|
-
data-variant="${
|
|
84
|
-
data-size="${
|
|
166
|
+
type="${B(n.type)}"
|
|
167
|
+
data-variant="${B(n.variant)}"
|
|
168
|
+
data-size="${B(n.size)}"
|
|
85
169
|
${n.disabled?"disabled":""}
|
|
86
170
|
>
|
|
87
|
-
<slot>${
|
|
171
|
+
<slot>${B(n.label)}</slot>
|
|
88
172
|
</button>
|
|
89
|
-
`}),
|
|
90
|
-
${
|
|
173
|
+
`}),Ee(r.card,{props:{title:{type:String,default:""},footer:{type:String,default:""},elevated:{type:Boolean,default:!0}},styles:`
|
|
174
|
+
${pt}
|
|
91
175
|
article {
|
|
92
176
|
background: #fff;
|
|
93
177
|
border: 1px solid #e2e8f0;
|
|
@@ -111,37 +195,37 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
|
|
|
111
195
|
footer {
|
|
112
196
|
margin-top: 0.75rem;
|
|
113
197
|
}
|
|
114
|
-
`,render:({props:n})=>
|
|
198
|
+
`,render:({props:n})=>Se`
|
|
115
199
|
<article part="card" data-elevated="${String(n.elevated)}">
|
|
116
|
-
${n.title?`<header part="header">${
|
|
200
|
+
${n.title?`<header part="header">${B(n.title)}</header>`:""}
|
|
117
201
|
<section part="body"><slot></slot></section>
|
|
118
|
-
${n.footer?`<footer part="footer">${
|
|
202
|
+
${n.footer?`<footer part="footer">${B(n.footer)}</footer>`:""}
|
|
119
203
|
</article>
|
|
120
|
-
`}),
|
|
204
|
+
`}),Ee(r.input,{props:{label:{type:String,default:""},type:{type:String,default:"text"},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},disabled:{type:Boolean,default:!1}},styles:wn,beforeUpdate(n,s){return!Pa(this,n,s)},connected(){const n=s=>{const o=s.target;o?.matches("input")&&(s.stopPropagation(),this.setAttribute("value",o.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:o.value},bubbles:!0,composed:!0})))};jt(this,"__bqueryInputHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=xt(this,"__bqueryInputHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>Se`
|
|
121
205
|
<label part="field" class="field">
|
|
122
|
-
${n.label?`<span part="label" class="label">${
|
|
206
|
+
${n.label?`<span part="label" class="label">${B(n.label)}</span>`:""}
|
|
123
207
|
<input
|
|
124
208
|
part="control"
|
|
125
209
|
class="control"
|
|
126
|
-
type="${
|
|
127
|
-
value="${
|
|
128
|
-
placeholder="${
|
|
129
|
-
name="${
|
|
210
|
+
type="${B(n.type)}"
|
|
211
|
+
value="${B(n.value)}"
|
|
212
|
+
placeholder="${B(n.placeholder)}"
|
|
213
|
+
name="${B(n.name)}"
|
|
130
214
|
${n.disabled?"disabled":""}
|
|
131
215
|
/>
|
|
132
216
|
</label>
|
|
133
|
-
`}),
|
|
217
|
+
`}),Ee(r.textarea,{props:{label:{type:String,default:""},value:{type:String,default:""},placeholder:{type:String,default:""},name:{type:String,default:""},rows:{type:Number,default:4},disabled:{type:Boolean,default:!1}},styles:`${wn}
|
|
134
218
|
textarea.control {
|
|
135
219
|
min-height: 6rem;
|
|
136
220
|
resize: vertical;
|
|
137
221
|
}
|
|
138
|
-
`,beforeUpdate(n,s){return!
|
|
222
|
+
`,beforeUpdate(n,s){return!Ma(this,n,s)},connected(){const n=s=>{const o=s.target;o?.matches("textarea")&&(s.stopPropagation(),this.setAttribute("value",o.value),this.dispatchEvent(new CustomEvent("input",{detail:{value:o.value},bubbles:!0,composed:!0})))};jt(this,"__bqueryTextareaHandler",n),this.shadowRoot?.addEventListener("input",n)},disconnected(){const n=xt(this,"__bqueryTextareaHandler");n&&this.shadowRoot?.removeEventListener("input",n)},render:({props:n})=>Se`
|
|
139
223
|
<label part="field" class="field">
|
|
140
|
-
${n.label?`<span part="label" class="label">${
|
|
141
|
-
${
|
|
224
|
+
${n.label?`<span part="label" class="label">${B(n.label)}</span>`:""}
|
|
225
|
+
${Na(n)}
|
|
142
226
|
</label>
|
|
143
|
-
`}),
|
|
144
|
-
${
|
|
227
|
+
`}),Ee(r.checkbox,{props:{label:{type:String,default:""},checked:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},styles:`
|
|
228
|
+
${pt}
|
|
145
229
|
label {
|
|
146
230
|
align-items: center;
|
|
147
231
|
color: #0f172a;
|
|
@@ -157,7 +241,7 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
|
|
|
157
241
|
input:disabled {
|
|
158
242
|
cursor: not-allowed;
|
|
159
243
|
}
|
|
160
|
-
`,connected(){const n=s=>{const o=s.target;o?.matches('input[type="checkbox"]')&&(s.stopPropagation(),o.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:o.checked},bubbles:!0,composed:!0})))};
|
|
244
|
+
`,connected(){const n=s=>{const o=s.target;o?.matches('input[type="checkbox"]')&&(s.stopPropagation(),o.checked?this.setAttribute("checked","true"):this.removeAttribute("checked"),this.dispatchEvent(new CustomEvent("change",{detail:{checked:o.checked},bubbles:!0,composed:!0})))};jt(this,"__bqueryCheckboxHandler",n),this.shadowRoot?.addEventListener("change",n)},disconnected(){const n=xt(this,"__bqueryCheckboxHandler");n&&this.shadowRoot?.removeEventListener("change",n)},render:({props:n})=>Se`
|
|
161
245
|
<label part="label">
|
|
162
246
|
<input
|
|
163
247
|
part="control"
|
|
@@ -165,14 +249,14 @@ var bQuery=(function(y){Object.defineProperty(y,Symbol.toStringTag,{value:"Modul
|
|
|
165
249
|
${n.checked?"checked":""}
|
|
166
250
|
${n.disabled?"disabled":""}
|
|
167
251
|
/>
|
|
168
|
-
<span part="text"><slot>${
|
|
252
|
+
<span part="text"><slot>${B(n.label)}</slot></span>
|
|
169
253
|
</label>
|
|
170
|
-
`}),r},kt=null,Z=()=>kt!==null?kt:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,Li=e=>{kt=e},Pr=e=>typeof e=="string"||typeof e=="number",Ir=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),be=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,o]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&Pr(o)){const i=s.startsWith("--")?s:Ir(s);r.setProperty(i,String(o))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const o=Array.isArray(s)?s[s.length-1]:s;if(Pr(o)){const i=n.startsWith("--")?n:Ir(n);r.setProperty(i,String(o))}}},nt=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&Z())return s&&be(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&be(e,r),i?.(),Promise.resolve()):new Promise(l=>{const c=a.animate(r,n);let u=!1;const h=()=>{u||(u=!0,s&&(typeof c.commitStyles=="function"?c.commitStyles():be(e,r)),c.cancel(),i?.(),l())};c.onfinish=h,c.finished&&c.finished.then(h).catch(h)})},ee=e=>Math.min(1,Math.max(0,e)),_r=e=>ee(e),qr=e=>ee(e*e),xr=e=>ee(1-(1-e)*(1-e)),zr=e=>ee(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),jr=e=>ee(e*e*e),Fr=e=>ee(1-Math.pow(1-e,3)),Br=e=>ee(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),Hr=e=>ee(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),Ur=e=>ee(e===1?1:1-Math.pow(2,-10*e)),$i={linear:_r,easeInQuad:qr,easeOutQuad:xr,easeInOutQuad:zr,easeInCubic:jr,easeOutCubic:Fr,easeInOutCubic:Br,easeOutBack:Hr,easeOutExpo:Ur},Ot=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},Tt=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:o}=r,i=Ot(e);if(i.width===0||i.height===0)return o?.(),Promise.resolve();const a=t.left-i.left,l=t.top-i.top,c=t.width/i.width,u=t.height/i.height;if(a===0&&l===0&&c===1&&u===1)return o?.(),Promise.resolve();const h=e;return typeof h.animate!="function"?(o?.(),Promise.resolve()):(h.style.transform=`translate(${a}px, ${l}px) scale(${c}, ${u})`,h.style.transformOrigin="top left",h.offsetHeight,new Promise(d=>{const p=h.animate([{transform:`translate(${a}px, ${l}px) scale(${c}, ${u})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let f=!1;const m=()=>{f||(f=!0,h.style.transform="",h.style.transformOrigin="",o?.(),d())};p.onfinish=m,p.finished&&p.finished.then(m).catch(m)}))},Ri=async(e,t,r={})=>{await Qr(e,t,r)},Qr=async(e,t,r={})=>{const{stagger:n,...s}=r,o=new Map;for(const l of e)o.set(l,Ot(l));t();const i=e.length,a=e.map((l,c)=>{const u=o.get(l);if(!u)return Promise.resolve();const h=n?n(c,i):0;return h>0?new Promise(d=>setTimeout(d,h)).then(()=>Tt(l,u,s)):Tt(l,u,s)});await Promise.all(a)},Mi={fadeIn:(e=0,t=1)=>[{opacity:e},{opacity:t}],fadeOut:(e=1,t=0)=>[{opacity:e},{opacity:t}],slideInUp:(e=16)=>[{opacity:0,transform:`translateY(${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInDown:(e=16)=>[{opacity:0,transform:`translateY(-${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInLeft:(e=16)=>[{opacity:0,transform:`translateX(${e}px)`},{opacity:1,transform:"translateX(0)"}],slideInRight:(e=16)=>[{opacity:0,transform:`translateX(-${e}px)`},{opacity:1,transform:"translateX(0)"}],scaleIn:(e=.95,t=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`}],scaleOut:(e=1,t=.95)=>[{opacity:1,transform:`scale(${e})`},{opacity:0,transform:`scale(${t})`}],pop:(e=.9,t=1.02,r=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`,offset:.6},{opacity:1,transform:`scale(${r})`}],rotateIn:(e=6)=>[{opacity:0,transform:`rotate(${e}deg) scale(0.98)`},{opacity:1,transform:"rotate(0deg) scale(1)"}]},Di=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:o=!0,onComplete:i}=r,a=e,l=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof l.getBoundingClientRect!="function"||typeof a.style>"u"||typeof l.style>"u")return i?.(),Promise.resolve();const c=e.getBoundingClientRect(),u=l.style.display,h=l.style.visibility,d=l.style.transform,p=l.style.opacity,f=typeof getComputedStyle=="function"?getComputedStyle(l).display:u||"block",m=f==="none"?"block":u||f||"block",g=()=>{l.style.transform=d,l.style.opacity=p};l.style.visibility="hidden",l.style.display=m;const b=t.getBoundingClientRect();if(l.style.visibility=h,a.style.display="none",f==="none"?l.style.display=m:u==="none"?l.style.display="":l.style.display=u,o&&Z())return g(),i?.(),Promise.resolve();const v=c.left-b.left,w=c.top-b.top,E=c.width/(b.width||1),T=c.height/(b.height||1);if(v===0&&w===0&&E===1&&T===1)return g(),i?.(),Promise.resolve();const A=[{transform:`translate(${v}px, ${w}px) scale(${E}, ${T})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof l.animate!="function"?(g(),i?.(),Promise.resolve()):new Promise(S=>{const C=l.animate(A,{duration:n,easing:s,fill:"forwards"});let R=!1;const O=()=>{R||(R=!0,g(),C.cancel(),i?.(),S())};C.onfinish=O,C.finished&&C.finished.then(O).catch(O)})},Ni=(e,t={})=>{if(typeof window>"u"||typeof window.addEventListener!="function"||typeof window.removeEventListener!="function"||typeof requestAnimationFrame!="function"||typeof cancelAnimationFrame!="function")return()=>{};const{speed:r=.5,direction:n="vertical",respectReducedMotion:s=!0}=t,o=e,i=o.style.transform;if(s&&Z())return()=>{};let a=!1,l=!1,c=null;const u=()=>{l||(l=!0,window.removeEventListener("scroll",d),c!==null&&(cancelAnimationFrame(c),c=null),a=!1,o.style.transform=i)},h=()=>{if(l)return;if(s&&Z()){u();return}const p=window.scrollY,f=window.scrollX;let m=0,g=0;(n==="vertical"||n==="both")&&(g=p*r),(n==="horizontal"||n==="both")&&(m=f*r);const b=`translate3d(${m}px, ${g}px, 0)`;o.style.transform=i?`${i} ${b}`:b},d=()=>{if(!l){if(s&&Z()){u();return}a||(a=!0,c=requestAnimationFrame(()=>{c=null,h(),a=!1}))}};return h(),window.addEventListener("scroll",d,{passive:!0}),u},Pi=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),Ii=(e,t)=>{const r=Pi(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:o,once:i=!0,onEnter:a,...l}=t;if(typeof IntersectionObserver>"u")return r.forEach(u=>{a?.(u),nt(u,l)}),()=>{};const c=new IntersectionObserver(u=>{u.forEach(h=>{if(!h.isIntersecting)return;const d=h.target;a?.(d),nt(d,l),i&&c.unobserve(d)})},{root:n,rootMargin:s,threshold:o});return r.forEach(u=>c.observe(u)),()=>c.disconnect()},_i={stiffness:100,damping:10,mass:1,precision:.01},qi=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:o}={..._i,...t};let i=e,a=0,l=e,c=null,u=null,h=null;const d=new Set,p=()=>{for(const m of d)m(i)},f=m=>{const g=h!==null?(m-h)/1e3:.016666666666666666,b=Math.min(g,1/30);h=m;const v=i-l,w=(-r*v+-n*a)/s;if(a+=w*b,i+=a*b,p(),Math.abs(a)<o&&Math.abs(v)<o){i=l,a=0,c=null,p(),u?.(),u=null;return}c=requestAnimationFrame(f)};return{to(m){return l=m,c!==null&&cancelAnimationFrame(c),u?.(),h=null,new Promise(g=>{u=g,c=requestAnimationFrame(f)})},current(){return i},stop(){c!==null&&(cancelAnimationFrame(c),c=null),a=0,h=null,u?.(),u=null},onChange(m){return d.add(m),()=>d.delete(m)}}},xi={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},zi=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(o,i=0)=>{const a=typeof n=="number"?n:n==="center"?(i-1)/2:n==="end"?i-1:0,l=Math.abs(o-a),c=i>1?Math.max(a,i-1-a):1,u=c===0?0:l/c;return r+(s?s(u)*c:l)*e}},Lt=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("ms")){const n=Number.parseFloat(t.slice(0,-2));return Number.isFinite(n)?n:0}if(t.endsWith("s")){const n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?n*1e3:0}const r=Number.parseFloat(t);return Number.isFinite(r)?r:0}return 0},ji=(e,t)=>{if(typeof e=="number")return e;if(typeof e=="string"){const r=/^([+-])=(\d+(?:\.\d+)?)$/.exec(e);if(r){const n=Number.parseFloat(r[2]);return Number.isFinite(n)?r[1]==="+"?t+n:t-n:t}}return t},Fi=e=>{const t=Lt(e?.duration),r=Lt(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},Vr=e=>{let t=0;return e.map(r=>{const n=ji(r.at,t),s=Lt(r.options?.delay),o=Math.max(0,n+s),i=Fi(r.options),a=o+i;return t=Math.max(t,a),{step:r,start:o,end:a,duration:i}})},Bi=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let o=0;o<e.length;o+=1){const i=e[o],a=r?r(o,s):0;a>0&&await new Promise(l=>setTimeout(l,a)),await nt(i.target,i)}n?.()},Hi=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],o=0,i=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:c=!0,onFinish:u}=t,h=()=>{if(!a){if(a=!0,l)for(const p of s){const{animation:f,step:m}=p;typeof f.commitStyles=="function"?f.commitStyles():be(m.target,m.keyframes),f.cancel()}n.forEach(p=>p()),u?.()}},d=()=>{s.forEach(({animation:f})=>f.cancel()),s=[],a=!1;const p=Vr(r);if(o=p.length?Math.max(...p.map(f=>f.end)):0,c&&Z()){l&&p.forEach(({step:f})=>be(f.target,f.keyframes)),i=!0;return}if(p.some(({step:f})=>typeof f.target.animate!="function")){l&&p.forEach(({step:f})=>be(f.target,f.keyframes)),i=!0;return}i=!1,s=p.map(({step:f,start:m})=>{const{delay:g,...b}=f.options??{};return{animation:f.target.animate(f.keyframes,{...b,delay:m,fill:b.fill??"both"}),step:f,start:m}})};return{add(p){r.push(p)},duration(){if(!r.length)return 0;if(!s.length){const p=Vr(r);return Math.max(...p.map(f=>f.end))}return o},async play(){if(d(),i||s.length===0){h();return}const p=s.map(f=>f.animation.finished.catch(()=>{}));await Promise.all(p),h()},pause(){i||s.forEach(({animation:p})=>p.pause())},resume(){i||s.forEach(({animation:p})=>p.play())},stop(){s.forEach(({animation:p})=>p.cancel()),s=[],i=!1},seek(p){i||s.forEach(({animation:f})=>{f.currentTime=p})},onFinish(p){return n.add(p),()=>n.delete(p)}}},Wr=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Ui=async e=>{const t=X().transitions,r=typeof e=="function"?{update:e,classes:t?.classes,types:t?.types,skipOnReducedMotion:t?.skipOnReducedMotion}:{...e,classes:e.classes??t?.classes,types:e.types??t?.types,skipOnReducedMotion:e.skipOnReducedMotion??t?.skipOnReducedMotion},n=r.update;if(typeof document>"u"){await n();return}const s=document,o=document.documentElement,i=Wr(r.classes),a=Wr(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&Z()){await n(),r.onFinish?.();return}i.forEach(l=>o.classList.add(l));try{const l=s.startViewTransition(()=>n()),c=l.types;if(c)for(const u of a)c.add(u);await l.ready,r.onReady?.(),await l.finished,r.onFinish?.()}finally{i.forEach(l=>o.classList.remove(l))}},Qi=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:o=!1,cursorChar:i="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:c=!0,onComplete:u}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const h=e;let d=!1,p=null,f=null,m=null,g=null;const b=()=>{if(!o)return;f=document.createElement("span"),f.setAttribute("aria-hidden","true"),f.textContent=i,h.appendChild(f);let E=!0;m=setInterval(()=>{f&&(E=!E,f.style.opacity=E?"1":"0")},530)},v=()=>{m!==null&&(clearInterval(m),m=null),f&&f.parentNode&&(f.parentNode.removeChild(f),f=null)},w=()=>{d||(d=!0,p!==null&&(clearTimeout(p),p=null),v(),g?.(),g=null)};return c&&Z()?(h.textContent=t,u?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(E=>{g=E;const T=()=>{let A=0;h.textContent="",b();const S=document.createTextNode("");f?h.insertBefore(S,f):h.appendChild(S);const C=()=>{d||(A<t.length?(S.data=t.slice(0,A+1),A++,p=setTimeout(C,n)):(u?.(),a&&!d?p=setTimeout(()=>{d||(v(),T())},l):(v(),E(),g=null)))};p=setTimeout(C,s)};T()})}},Vi=class{constructor(e){this.bucketName=e,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const e=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)},n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error)}),this.dbPromise}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.storeName,e).objectStore(this.storeName));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async put(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},Wi={async open(e){return new Vi(e)}},Ki=class{constructor(e){this.cache=e}async add(e){await this.cache.add(e)}async addAll(e){await this.cache.addAll(e)}async put(e,t){await this.cache.put(e,t)}async match(e){return this.cache.match(e)}async remove(e){return this.cache.delete(e)}async keys(){return(await this.cache.keys()).map(e=>e.url)}},Yi={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new Ki(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},Gi=e=>{if(typeof document>"u")return null;const t=`${encodeURIComponent(e)}=`,r=document.cookie?document.cookie.split(";"):[];for(const n of r){const s=n.trim();if(s.startsWith(t)){const o=s.slice(t.length);try{return decodeURIComponent(o)}catch{return o}}}return null},Ji=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},Xi=(e,t)=>{if(typeof document>"u")return;const r=[`${encodeURIComponent(e)}=`,"Expires=Thu, 01 Jan 1970 00:00:00 GMT"];t.path&&r.push(`Path=${t.path}`),t.domain&&r.push(`Domain=${t.domain}`),t.sameSite&&r.push(`SameSite=${t.sameSite}`),t.secure&&r.push("Secure"),document.cookie=r.join("; ")},Zi=(e,t,r)=>{if(typeof document>"u")return;const n=r.serialize?r.serialize(t):typeof t=="string"?t:JSON.stringify(t),s=[`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];r.path&&s.push(`Path=${r.path}`),r.domain&&s.push(`Domain=${r.domain}`),typeof r.maxAge=="number"&&s.push(`Max-Age=${r.maxAge}`),r.expires&&s.push(`Expires=${r.expires.toUTCString()}`),r.sameSite&&s.push(`SameSite=${r.sameSite}`),r.secure&&s.push("Secure"),document.cookie=s.join("; ")},ea=(e,t={})=>{const r=X().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=Gi(e);let o=n.defaultValue??null;if(s!==null)try{o=n.deserialize?n.deserialize(s):Ji(s)?JSON.parse(s):s??o}catch(l){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,l),o=s??o}const i=M(o);if(typeof document>"u"||n.watch===!1)return i;let a=!1;return z(()=>{const l=i.value;if(!a){a=!0;return}if(l==null){Xi(e,n);return}Zi(e,l,n)}),i},ta={isSupported(){return"Notification"in window},getPermission(){return this.isSupported()?Notification.permission:"denied"},async requestPermission(){return this.isSupported()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"},send(e,t){return this.isSupported()?Notification.permission!=="granted"?(console.warn("bQuery: Notification permission not granted"),null):new Notification(e,t):(console.warn("bQuery: Notifications not supported in this browser"),null)}},ra=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),na=(e={})=>{const t=X().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=M("");if(typeof document>"u")return{element:null,message:n,announce(m){n.value=m},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,o=s??document.createElement("div"),i=!s;if(r.id&&(o.id=r.id),r.className&&(o.className=r.className),o.setAttribute("aria-live",r.politeness),o.setAttribute("aria-atomic",String(r.atomic)),o.setAttribute("role",r.politeness==="assertive"?"alert":"status"),o.setAttribute("data-bquery-announcer","true"),o.getAttribute("style")||o.setAttribute("style",ra),i){const m=r.container??document.body??document.documentElement;if(!m)return{element:null,message:n,announce(g){n.value=g},clear(){n.value=""},destroy(){n.value=""}};m.appendChild(o)}const a=z(()=>{o.textContent=n.value});let l,c,u=!1;const h=()=>{l&&(clearTimeout(l),l=void 0),c&&(clearTimeout(c),c=void 0)};return{element:o,message:n,announce:(m,g={})=>{if(u)return;const b=g.politeness??r.politeness,v=g.delay??r.delay,w=g.clearDelay??r.clearDelay;h(),o.setAttribute("aria-live",b),o.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",l=setTimeout(()=>{u||(n.value=m,w>0&&(c=setTimeout(()=>{u||(n.value="")},w)))},v)},clear:()=>{u||(h(),n.value="")},destroy:()=>{u||(u=!0,h(),n.value="",a(),i&&o.remove())}}},Kr=(e,t)=>{const r=new Map;for(const[n,s]of Object.entries(t))r.set(n,e.getAttribute(n)),e.setAttribute(n,s);return()=>{for(const[n,s]of r.entries())s==null?e.removeAttribute(n):e.setAttribute(n,s)}},Yr=(e,t)=>{const r=document.createElement(e);r.setAttribute("data-bquery-page-meta","true");for(const[n,s]of Object.entries(t))s!==void 0&&r.setAttribute(n,s);return r},sa=e=>{if(typeof document>"u")return()=>{};const t=X().pageMeta,r=e.title?t?.titleTemplate?t.titleTemplate(e.title):e.title:void 0,n=[],s=[],o=document.title;r!==void 0&&(document.title=r);const i=[...e.meta??[]];e.description&&i.unshift({name:"description",content:e.description});for(const a of i){const l=Yr("meta",{name:a.name,property:a.property,"http-equiv":a.httpEquiv,content:a.content});document.head.appendChild(l),n.push(l)}for(const a of e.link??[]){const l=Yr("link",{rel:a.rel,href:a.href,type:a.type,media:a.media,crossorigin:a.crossOrigin});document.head.appendChild(l),n.push(l)}return e.htmlAttributes&&s.push(Kr(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(Kr(document.body,e.bodyAttributes)),()=>{document.title=o;for(const a of s.reverse())a();for(const a of n)a.remove()}},Gr=class{constructor(e){this.storage=e}async get(e){const t=this.storage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}}async set(e,t){const r=typeof t=="string"?t:JSON.stringify(t);this.storage.setItem(e,r)}async remove(e){this.storage.removeItem(e)}async clear(){this.storage.clear()}async keys(){const e=[];for(let t=0;t<this.storage.length;t++){const r=this.storage.key(t);r!==null&&e.push(r)}return e}},oa=class extends Gr{constructor(){super(localStorage)}},ia=class extends Gr{constructor(){super(sessionStorage)}},aa=class{constructor(e){this.options=e,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((e,t)=>{const r=indexedDB.open(this.options.name,this.options.version??1);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),this.dbPromise)}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.options.store,e).objectStore(this.options.store));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async set(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async clear(){await this.withStore("readwrite",e=>e.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},la={local(){return new oa},session(){return new ia},indexedDB(e){return new aa(e)}},Jr=null,te=M({path:"",params:{},query:{},matched:null,hash:""}),Xr=P(()=>te.value),_e=M(0),st=M(!1),ca=H(st),Zr=()=>{_e.value===0&&(st.value=!0),_e.value+=1},en=()=>{const e=Math.max(0,_e.value-1);_e.value=e,e===0&&(st.value=!1)},ua=()=>{_e.value=0,st.value=!1},ce=()=>Jr,tn=e=>{Jr=e},qe=async(e,t={})=>{const r=ce();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},fa=()=>{const e=ce();e?e.back():history.back()},da=()=>{const e=ce();e?e.forward():history.forward()},ha="active",ma=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),pa=typeof HTMLElement<"u"?HTMLElement:class{},rn=class extends pa{constructor(...e){super(...e),this._cleanup=null,this._trackedActiveClasses=new Map,this._handleClick=t=>{t instanceof MouseEvent&&(t.defaultPrevented||t.button===0&&(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),this._navigate())))},this._handleKeydown=t=>{t instanceof KeyboardEvent&&t.key==="Enter"&&(t.preventDefault(),this._navigate())}}static get observedAttributes(){return["to","replace","exact","active-class"]}get to(){const e=this.getAttribute("to");return e==null||e.trim()===""?"/":e}set to(e){this.setAttribute("to",e)}get replace(){return this.hasAttribute("replace")}set replace(e){e?this.setAttribute("replace",""):this.removeAttribute("replace")}get exact(){return this.hasAttribute("exact")}set exact(e){e?this.setAttribute("exact",""):this.removeAttribute("exact")}get activeClass(){return this.getAttribute("active-class")??ha}set activeClass(e){this.setAttribute("active-class",e)}connectedCallback(){this.getAttribute("role")||this.setAttribute("role","link"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this._handleClick),this.addEventListener("keydown",this._handleKeydown),this._setupActiveTracking()}disconnectedCallback(){this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeydown),this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses()}attributeChangedCallback(e,t,r){(e==="to"||e==="exact"||e==="active-class")&&this.isConnected&&this._setupActiveTracking()}_setupActiveTracking(){this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses();const e=this.to,t=this.exact,r=ma(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=z(()=>{const n=te.value.path,s=t?n===e:e==="/"?n==="/":n===e||n.startsWith(e.endsWith("/")?e:e+"/");for(const o of r){const i=this._trackedActiveClasses.get(o)??!1;this.classList.toggle(o,s||i)}s?this.setAttribute("aria-current","page"):this.removeAttribute("aria-current")})}_clearTrackedActiveClasses(){for(const[e,t]of this._trackedActiveClasses)this.classList.toggle(e,t);this._trackedActiveClasses.clear()}_navigate(){const e=this.to;e&&ce()&&qe(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},va=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",rn)},ya=(e,t={})=>r=>{r.preventDefault(),qe(e,t).catch(n=>{console.error("Navigation failed:",n)})},ga=e=>{const t=e??(typeof document<"u"?document.body:null);if(!t)return()=>{};const r=n=>{if(!(n instanceof MouseEvent)||n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey||typeof Element>"u"||!(n.target instanceof Element))return;const s=n.target.closest("a");if(!s||!(s instanceof(s.ownerDocument.defaultView?.HTMLAnchorElement??HTMLAnchorElement))||s.target||s.hasAttribute("download")||typeof window>"u"||s.origin!==window.location.origin)return;const o=ce();if(!o){n.preventDefault(),qe(s.pathname+s.search+s.hash).catch(c=>{console.error("Navigation failed:",c)});return}const i=o.base,a=o.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let c=s.pathname;i&&i!=="/"&&c.startsWith(i)&&(c=c.slice(i.length)||"/"),l=c+s.search+s.hash}n.preventDefault(),qe(l).catch(c=>{console.error("Navigation failed:",c)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},ba=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(x(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},wa=128,nn=new Map,sn=new Map,on=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=wa)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},Ea=e=>{const t=[];let r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){n++;continue}if(s==="["&&!r){r=!0;continue}if(s==="]"&&r){r=!1;continue}if(!r){if(s==="("){t.push(!1);continue}if(s===")"){const o=t.pop()??!1,i=e[n+1];if(o&&(i==="+"||i==="*"||i==="?"||i==="{"))return!0;o&&t.length>0&&(t[t.length-1]=!0);continue}if(t.length>0){if(s==="?"&&n>0&&e[n-1]==="(")continue;(s==="+"||s==="*"||s==="?"||s==="{")&&(t[t.length-1]=!0)}}}return!1},Sa=e=>{let t="",r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){if(!r&&e[n+1]>="1"&&e[n+1]<="9")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);if(!r&&e[n+1]==="k"&&e[n+2]==="<")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);t+=s+e[n+1],n++;continue}if(s==="["&&!r){r=!0,t+=s;continue}if(s==="]"&&r){r=!1,t+=s;continue}if(!r&&s==="("){if(n+1<e.length&&e[n+1]==="?"){if(e[n+2]==="<"){if(e[n+3]==="="||e[n+3]==="!"){t+="(";continue}const o=e.indexOf(">",n+3);if(o===-1)throw new Error(`bQuery router: Invalid route constraint named capture group: "${e}".`);t+="(?:",n=o;continue}t+="(";continue}t+="(?:";continue}t+=s}return t},$t=e=>{const t=nn.get(e);if(t!==void 0)return t;const r=Sa(e);return on(nn,e,r),r},an=e=>{const t=$t(e),r=sn.get(t);if(r)return r;if(Ea(t))throw new Error(`bQuery router: Route constraint contains a potentially catastrophic (ReDoS) pattern. Nested quantifiers are not allowed: "${e}".`);try{const n=new RegExp(`^(?:${t})$`);return on(sn,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},xe=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),ln=e=>xe(e)||e!==void 0&&e>="0"&&e<="9",cn=(e,t)=>{let r=1,n="",s=t+1,o=!1;for(;s<e.length;){const i=e[s];if(i==="\\"&&s+1<e.length){n+=i+e[s+1],s+=2;continue}if(i==="["&&!o)o=!0;else if(i==="]"&&o)o=!1;else if(!o&&i==="(")r++;else if(!o&&i===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=i,s++}return null},Aa=(e,t)=>{const r=cn(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},un=new Set,fn=(e,t)=>{if(e[t]!==":"||!xe(e[t+1]))return null;let r=t+2;for(;r<e.length&&ln(e[r]);)r++;let n=r,s;if(e[r]==="("){const o=Aa(e,r);s=o.constraint,n=o.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},Ca=e=>{if(!un.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&xe(e[t+1])){const r=fn(e,t);r?.constraint&&$t(r.constraint),t=r?.nextIndex??t+1;continue}t++}un.add(e)}},ka=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},dn=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&xe(e[r+1]));)r++;return e.slice(t,r)},hn=(e,t,r,n)=>{const s=[];let o=t;for(;o<=r;){const i=e.indexOf(n,o);if(i===-1||i>r)break;s.push(i),o=i+1}return s.reverse()},Oa=(e,t)=>{const r=new Map,n=(s,o)=>{const i=`${s}:${o}`;if(r.has(i))return r.get(i)??null;if(s===e.length){const u=o===t.length?{}:null;return r.set(i,u),u}const a=e[s];if(a==="*"){if(s===e.length-1){const p={};return r.set(i,p),p}const u=dn(e,s+1),h=u.length>0?hn(t,o,t.length,u):null,d=(h?p=>{for(const f of h){const m=p(f);if(m)return m}return null}:p=>{for(let f=t.length;f>=o;f--){const m=p(f);if(m)return m}return null})(p=>{const f=n(s+1,p);return f?(r.set(i,f),f):null});return d||(r.set(i,null),null)}const l=fn(e,s);if(l){const u=l.constraint?an(l.constraint):void 0,h=l.constraint?t.length:ka(t,o),d=dn(e,l.nextIndex),p=d.length>0?hn(t,o,h,d):null,f=(p?m=>{for(const g of p){if(g<=o)continue;const b=m(g);if(b)return b}return null}:m=>{for(let g=h;g>o;g--){const b=m(g);if(b)return b}return null})(m=>{const g=t.slice(o,m);if(u&&!u.test(g))return null;const b=n(l.nextIndex,m);if(b){const v={[l.name]:g,...b};return r.set(i,v),v}return null});return f||(r.set(i,null),null)}if(o>=t.length||a!==t[o])return r.set(i,null),null;const c=n(s+1,o+1);return r.set(i,c),c};return n(0,0)},Ta=(e,t)=>{for(const r of t){Ca(r.path);const n=Oa(r.path,e);if(n)return{matched:r,params:n}}return null},ot=(e,t,r,n)=>{const s=Ta(e,n);return{path:e,params:s?.params??{},query:ba(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},mn=(e,t="")=>{const r=[];for(const n of e){const s=n.path==="*"?"*":`${t}${n.path}`.replace(/\/+/g,"/");r.push({...n,path:s}),n.children&&r.push(...mn(n.children,s))}return r},La=(e,t={})=>{const r=ce();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(o=>o.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s="";for(let o=0;o<n.path.length;){if(n.path[o]===":"&&xe(n.path[o+1])){let i=o+2;for(;i<n.path.length&&ln(n.path[i]);)i++;let a=i,l=null;if(n.path[i]==="("){const h=cn(n.path,i);if(!h)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);l=h.constraint,a=h.endIndex}const c=n.path.slice(o+1,i),u=t[c];if(u===void 0)throw new Error(`bQuery router: Missing required param "${c}" for route "${e}".`);if(l&&!an(l).test(u))throw new Error(`bQuery router: Param "${c}" with value "${u}" does not satisfy the route constraint "${l}" for route "${e}".`);s+=encodeURIComponent(u),o=a;continue}s+=n.path[o],o++}return s},$a=(e,t=!1)=>{const r=te.value.path;return t?r===e:r.startsWith(e)},Ra=(e,t=!1)=>P(()=>{const r=te.value.path;return t?r===e:r.startsWith(e)}),Ma=100,Da=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},Na=e=>{const t=ce();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:o=!1}=e,i=[],a=[],l=mn(r),c=new Map;let u="0",h=0,d=null;if(o&&typeof history<"u"&&"scrollRestoration"in history){d=history.scrollRestoration,history.scrollRestoration!=="manual"&&(history.scrollRestoration="manual");const S=history.state&&typeof history.state=="object"?history.state:{};if(typeof S.__bqScrollKey!="string"){const C=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...S,__bqScrollKey:u},"",C)}}const p=()=>history.state&&history.state.__bqScrollKey||u,f=()=>`${Date.now()}-${h++}`,m=(S=p())=>{if(o)for(c.has(S)&&c.delete(S),c.set(S,{x:window.scrollX,y:window.scrollY});c.size>Ma;){const C=c.keys().next().value;if(C===void 0)break;c.delete(C)}},g=(S=p())=>{if(!o)return;const C=c.get(S);C?window.scrollTo(C.x,C.y):window.scrollTo(0,0)},b=()=>{const S=history.state&&typeof history.state=="object"?{...history.state}:{};return o&&(S.__bqScrollKey=u),S},v=()=>{if(s){const[C,R=""]=(window.location.hash.slice(1)||"/").split("#"),[O,L=""]=C.split("?");return{pathname:O,search:L?`?${L}`:"",hash:R?`#${R}`:""}}let S=window.location.pathname;return n&&(S===n||S.startsWith(n+"/"))&&(S=S.slice(n.length)||"/"),{pathname:S,search:window.location.search,hash:window.location.hash}},w=()=>{const{pathname:S,search:C,hash:R}=v();te.value=ot(S,C,R,l)},E=async(S,C,R=new Set)=>{Zr();try{const{pathname:O,search:L,hash:k}=v(),$=ot(O,L,k,l),D=new URL(S,window.location.origin),I=`${D.pathname}${D.search}${D.hash}`;if(R.has(I))throw new Error(`bQuery router: redirect loop detected for path "${I}"`);R.add(I);const j=ot(D.pathname,D.search,D.hash,l);if(j.matched?.redirectTo){await E(j.matched.redirectTo,C,R);return}if(j.matched?.beforeEnter&&await j.matched.beforeEnter(j,$)===!1)return;for(const We of i)if(await We(j,$)===!1)return;m();const _=o?p():void 0,Q=C==="replaceState"&&_?_:f(),se=s?`#${S}`:`${n}${S}`,Ce=o&&history.state&&typeof history.state=="object"?Da(history.state):{},Ht=o?{...Ce,__bqScrollKey:Q}:{};history[C](Ht,"",se),u=Q,w(),o&&C==="pushState"&&window.scrollTo(0,0);for(const We of a)We(te.value,$)}finally{en()}},T=async S=>{Zr();try{const{pathname:C,search:R,hash:O}=v(),L=te.value,k=ot(C,R,O,l);if(k.matched?.redirectTo){await E(k.matched.redirectTo,"replaceState");return}if(k.matched?.beforeEnter&&await k.matched.beforeEnter(k,L)===!1){const $=new URLSearchParams(Object.entries(L.query).flatMap(([_,Q])=>Array.isArray(Q)?Q.map(se=>[_,se]):[[_,Q]])).toString(),D=$?`?${$}`:"",I=L.hash?`#${L.hash}`:"",j=s?`#${L.path}${D}${I}`:`${n}${L.path}${D}${I}`;history.replaceState(b(),"",j);return}for(const $ of i)if(await $(k,L)===!1){const D=new URLSearchParams(Object.entries(L.query).flatMap(([Q,se])=>Array.isArray(se)?se.map(Ce=>[Q,Ce]):[[Q,se]])).toString(),I=D?`?${D}`:"",j=L.hash?`#${L.hash}`:"",_=s?`#${L.path}${I}${j}`:`${n}${L.path}${I}${j}`;history.replaceState(b(),"",_);return}m(u),u=S.state?.__bqScrollKey??p(),w(),g(u);for(const $ of a)$(te.value,L)}finally{en()}};window.addEventListener("popstate",T),w();const A={push:S=>E(S,"pushState"),replace:S=>E(S,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:S=>history.go(S),beforeEach:S=>(i.push(S),()=>{const C=i.indexOf(S);C>-1&&i.splice(C,1)}),afterEach:S=>(a.push(S),()=>{const C=a.indexOf(S);C>-1&&a.splice(C,1)}),currentRoute:Xr,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",T),i.length=0,a.length=0,c.clear(),d!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=d),ua(),tn(null)}};return tn(A),A},we=P(()=>te.value),Pa={route:we,path:P(()=>we.value.path),params:P(()=>we.value.params),query:P(()=>we.value.query),hash:P(()=>we.value.hash),matched:P(()=>we.value.matched)},Ia=()=>Pa,_a=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},qa=(e,t)=>{const r=_a();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},xa=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},za=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},pn=[],ja=e=>{pn.push(e)},Fa=(e,t)=>{for(const r of pn){const n=r({store:e,options:t});n&&Object.assign(e,n)}},ze=new Map,vn=e=>ze.has(e),Ba=(e,t)=>{ze.set(e,t)},Ee=e=>ze.get(e),Rt=()=>Array.from(ze.keys()),Ha=e=>{ze.delete(e),xa(e)},yn=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,ue=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ue);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,ue(n)]));if(e instanceof Set)return new Set(Array.from(e).map(ue));const t={};for(const r of Object.keys(e))t[r]=ue(e[r]);return t},Se=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e.entries())if(!t.has(s)||!Se(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.values()){let o=!1;for(const i of t.values())if(Se(s,i)){o=!0;break}if(!o)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>Se(s,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(s=>Se(e[s],t[s]))},Ua=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const o=e[s],i=t[s];r.get(s)===i&&yn(o)&&yn(i)&&!Se(o,i)&&n.push(s)}return n},je=()=>Et(),Mt=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(vn(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),Ee(t);const o=r(),i=new Map;for(const v of Object.keys(o))i.set(v,M(o[v]));const a=[],l=[],c=(v,w,E)=>{!je()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${v} for action "${w}"`,E)},u=new WeakSet,h=(v,w)=>{!je()||typeof console>"u"||typeof console.warn!="function"||u.has(v)||(u.add(v),console.warn(`[bQuery store "${t}"] Async $onAction listener detected for action "${w}". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`))},d=(v,w,E,T)=>{try{const A=E();ke(A)&&(v==="listener"&&T&&h(T,w),A.catch(S=>{c(v,w,S)}))}catch(A){c(v,w,A)}},p=()=>ae(()=>({...m})),f=()=>{const v=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!v)return;const w=p();for(const E of a)E(w);za(t,w)},m=new Proxy({},{get:(v,w)=>{const E=w;if(i.has(E))return i.get(E).value},ownKeys:()=>Array.from(i.keys()),getOwnPropertyDescriptor:(v,w)=>{if(i.has(w))return{enumerable:!0,configurable:!0}},has:(v,w)=>i.has(w)}),g=new Map,b={};for(const v of Object.keys(o))Object.defineProperty(b,v,{get:()=>i.get(v).value,set:w=>{i.get(v).value=w,f()},enumerable:!0,configurable:!1});for(const v of Object.keys(n)){const w=n[v],E=P(()=>w(m,new Proxy({},{get:(T,A)=>{const S=A;if(g.has(S))return g.get(S).value}})));g.set(v,E),Object.defineProperty(b,v,{get:()=>E.value,enumerable:!0,configurable:!1})}for(const v of Object.keys(s)){const w=s[v],E=v;b[E]=function(...T){const A=new Proxy(b,{get:(k,$)=>typeof $=="string"&&i.has($)?i.get($).value:k[$],set:(k,$,D)=>typeof $=="string"&&i.has($)?(i.get($).value=D,f(),!0):Reflect.set(k,$,D)});if(l.length===0)return w.apply(A,T);const S=[],C=[],R=[...l],O={name:E,store:b,args:T,after:k=>{S.push($=>k($))},onError:k=>{C.push(k)}};for(const k of R)d("listener",E,()=>k(O),k);let L;try{L=w.apply(A,T)}catch(k){for(const $ of C)d("onError",E,()=>$(k));throw k}if(ke(L))return L.then(k=>{for(const $ of S)d("after",E,()=>$(k));return k},k=>{for(const $ of C)d("onError",E,()=>$(k));throw k});for(const k of S)d("after",E,()=>k(L));return L}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const v=r();Le(()=>{for(const[w,E]of i)E.value=v[w]}),f()},writable:!1,enumerable:!1},$subscribe:{value:v=>(a.push(v),()=>{const w=a.indexOf(v);w>-1&&a.splice(w,1)}),writable:!1,enumerable:!1},$onAction:{value:v=>(l.push(v),()=>{const w=l.indexOf(v);w>-1&&l.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:v=>{Le(()=>{if(typeof v=="function"){const w=je(),E=w?ue(p()):null,T=w?new Map(Array.from(i.entries()).map(([S,C])=>[S,C.value])):null,A=p();if(v(A),w&&E&&T){const S=Ua(E,A,T);S.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${S.map(String).join(", ")}.
|
|
254
|
+
`}),r},Ft=null,ee=()=>Ft!==null?Ft:typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ia=e=>{Ft=e},En=e=>typeof e=="string"||typeof e=="number",Sn=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ae=(e,t)=>{const r=e.style;if(Array.isArray(t)){const n=t[t.length-1];if(!n)return;for(const[s,o]of Object.entries(n))if(!(s==="offset"||s==="easing"||s==="composite")&&En(o)){const i=s.startsWith("--")?s:Sn(s);r.setProperty(i,String(o))}return}for(const[n,s]of Object.entries(t)){if(n==="offset"||n==="easing"||n==="composite")continue;const o=Array.isArray(s)?s[s.length-1]:s;if(En(o)){const i=n.startsWith("--")?n:Sn(n);r.setProperty(i,String(o))}}},vt=(e,t)=>{const{keyframes:r,options:n,commitStyles:s=!0,respectReducedMotion:o=!0,onFinish:i}=t;if(o&&ee())return s&&Ae(e,r),i?.(),Promise.resolve();const a=e;return typeof a.animate!="function"?(s&&Ae(e,r),i?.(),Promise.resolve()):new Promise(l=>{const c=a.animate(r,n);let f=!1;const m=()=>{f||(f=!0,s&&(typeof c.commitStyles=="function"?c.commitStyles():Ae(e,r)),c.cancel(),i?.(),l())};c.onfinish=m,c.finished&&c.finished.then(m).catch(m)})},te=e=>Math.min(1,Math.max(0,e)),An=e=>te(e),kn=e=>te(e*e),Tn=e=>te(1-(1-e)*(1-e)),Cn=e=>te(e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2),Rn=e=>te(e*e*e),On=e=>te(1-Math.pow(1-e,3)),Ln=e=>te(e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2),$n=e=>te(1+(1.70158+1)*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2)),Pn=e=>te(e===1?1:1-Math.pow(2,-10*e)),_a={linear:An,easeInQuad:kn,easeOutQuad:Tn,easeInOutQuad:Cn,easeInCubic:Rn,easeOutCubic:On,easeInOutCubic:Ln,easeOutBack:$n,easeOutExpo:Pn},Ut=e=>{const t=e.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}},Bt=(e,t,r={})=>{const{duration:n=300,easing:s="ease-out",onComplete:o}=r,i=Ut(e);if(i.width===0||i.height===0)return o?.(),Promise.resolve();const a=t.left-i.left,l=t.top-i.top,c=t.width/i.width,f=t.height/i.height;if(a===0&&l===0&&c===1&&f===1)return o?.(),Promise.resolve();const m=e;return typeof m.animate!="function"?(o?.(),Promise.resolve()):(m.style.transform=`translate(${a}px, ${l}px) scale(${c}, ${f})`,m.style.transformOrigin="top left",m.offsetHeight,new Promise(d=>{const p=m.animate([{transform:`translate(${a}px, ${l}px) scale(${c}, ${f})`},{transform:"translate(0, 0) scale(1, 1)"}],{duration:n,easing:s,fill:"forwards"});let u=!1;const h=()=>{u||(u=!0,m.style.transform="",m.style.transformOrigin="",o?.(),d())};p.onfinish=h,p.finished&&p.finished.then(h).catch(h)}))},qa=async(e,t,r={})=>{await Mn(e,t,r)},Mn=async(e,t,r={})=>{const{stagger:n,...s}=r,o=new Map;for(const l of e)o.set(l,Ut(l));t();const i=e.length,a=e.map((l,c)=>{const f=o.get(l);if(!f)return Promise.resolve();const m=n?n(c,i):0;return m>0?new Promise(d=>setTimeout(d,m)).then(()=>Bt(l,f,s)):Bt(l,f,s)});await Promise.all(a)},za={fadeIn:(e=0,t=1)=>[{opacity:e},{opacity:t}],fadeOut:(e=1,t=0)=>[{opacity:e},{opacity:t}],slideInUp:(e=16)=>[{opacity:0,transform:`translateY(${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInDown:(e=16)=>[{opacity:0,transform:`translateY(-${e}px)`},{opacity:1,transform:"translateY(0)"}],slideInLeft:(e=16)=>[{opacity:0,transform:`translateX(${e}px)`},{opacity:1,transform:"translateX(0)"}],slideInRight:(e=16)=>[{opacity:0,transform:`translateX(-${e}px)`},{opacity:1,transform:"translateX(0)"}],scaleIn:(e=.95,t=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`}],scaleOut:(e=1,t=.95)=>[{opacity:1,transform:`scale(${e})`},{opacity:0,transform:`scale(${t})`}],pop:(e=.9,t=1.02,r=1)=>[{opacity:0,transform:`scale(${e})`},{opacity:1,transform:`scale(${t})`,offset:.6},{opacity:1,transform:`scale(${r})`}],rotateIn:(e=6)=>[{opacity:0,transform:`rotate(${e}deg) scale(0.98)`},{opacity:1,transform:"rotate(0deg) scale(1)"}]},xa=(e,t,r={})=>{const{duration:n=300,easing:s="ease",respectReducedMotion:o=!0,onComplete:i}=r,a=e,l=t;if(typeof window>"u"||typeof document>"u"||typeof a.getBoundingClientRect!="function"||typeof l.getBoundingClientRect!="function"||typeof a.style>"u"||typeof l.style>"u")return i?.(),Promise.resolve();const c=e.getBoundingClientRect(),f=l.style.display,m=l.style.visibility,d=l.style.transform,p=l.style.opacity,u=typeof getComputedStyle=="function"?getComputedStyle(l).display:f||"block",h=u==="none"?"block":f||u||"block",v=()=>{l.style.transform=d,l.style.opacity=p};l.style.visibility="hidden",l.style.display=h;const b=t.getBoundingClientRect();if(l.style.visibility=m,a.style.display="none",u==="none"?l.style.display=h:f==="none"?l.style.display="":l.style.display=f,o&&ee())return v(),i?.(),Promise.resolve();const y=c.left-b.left,w=c.top-b.top,E=c.width/(b.width||1),k=c.height/(b.height||1);if(y===0&&w===0&&E===1&&k===1)return v(),i?.(),Promise.resolve();const A=[{transform:`translate(${y}px, ${w}px) scale(${E}, ${k})`,opacity:"0.5"},{transform:"translate(0, 0) scale(1, 1)",opacity:"1"}];return typeof l.animate!="function"?(v(),i?.(),Promise.resolve()):new Promise(S=>{const T=l.animate(A,{duration:n,easing:s,fill:"forwards"});let P=!1;const R=()=>{P||(P=!0,v(),T.cancel(),i?.(),S())};T.onfinish=R,T.finished&&T.finished.then(R).catch(R)})},ja=(e,t={})=>{if(typeof window>"u"||typeof window.addEventListener!="function"||typeof window.removeEventListener!="function"||typeof requestAnimationFrame!="function"||typeof cancelAnimationFrame!="function")return()=>{};const{speed:r=.5,direction:n="vertical",respectReducedMotion:s=!0}=t,o=e,i=o.style.transform;if(s&&ee())return()=>{};let a=!1,l=!1,c=null;const f=()=>{l||(l=!0,window.removeEventListener("scroll",d),c!==null&&(cancelAnimationFrame(c),c=null),a=!1,o.style.transform=i)},m=()=>{if(l)return;if(s&&ee()){f();return}const p=window.scrollY,u=window.scrollX;let h=0,v=0;(n==="vertical"||n==="both")&&(v=p*r),(n==="horizontal"||n==="both")&&(h=u*r);const b=`translate3d(${h}px, ${v}px, 0)`;o.style.transform=i?`${i} ${b}`:b},d=()=>{if(!l){if(s&&ee()){f();return}a||(a=!0,c=requestAnimationFrame(()=>{c=null,m(),a=!1}))}};return m(),window.addEventListener("scroll",d,{passive:!0}),f},Fa=e=>typeof Element<"u"&&e instanceof Element?[e]:Array.from(e),Ua=(e,t)=>{const r=Fa(e);if(!r.length)return()=>{};const{root:n=null,rootMargin:s,threshold:o,once:i=!0,onEnter:a,...l}=t;if(typeof IntersectionObserver>"u")return r.forEach(f=>{a?.(f),vt(f,l)}),()=>{};const c=new IntersectionObserver(f=>{f.forEach(m=>{if(!m.isIntersecting)return;const d=m.target;a?.(d),vt(d,l),i&&c.unobserve(d)})},{root:n,rootMargin:s,threshold:o});return r.forEach(f=>c.observe(f)),()=>c.disconnect()},Ba={stiffness:100,damping:10,mass:1,precision:.01},Wa=(e,t={})=>{const{stiffness:r,damping:n,mass:s,precision:o}={...Ba,...t};let i=e,a=0,l=e,c=null,f=null,m=null;const d=new Set,p=()=>{for(const h of d)h(i)},u=h=>{const v=m!==null?(h-m)/1e3:.016666666666666666,b=Math.min(v,1/30);m=h;const y=i-l,w=(-r*y+-n*a)/s;if(a+=w*b,i+=a*b,p(),Math.abs(a)<o&&Math.abs(y)<o){i=l,a=0,c=null,p(),f?.(),f=null;return}c=requestAnimationFrame(u)};return{to(h){return l=h,c!==null&&cancelAnimationFrame(c),f?.(),m=null,new Promise(v=>{f=v,c=requestAnimationFrame(u)})},current(){return i},stop(){c!==null&&(cancelAnimationFrame(c),c=null),a=0,m=null,f?.(),f=null},onChange(h){return d.add(h),()=>d.delete(h)}}},Ha={gentle:{stiffness:80,damping:15},snappy:{stiffness:200,damping:20},bouncy:{stiffness:300,damping:8},stiff:{stiffness:400,damping:30}},Qa=(e,t={})=>{const{start:r=0,from:n="start",easing:s}=t;return(o,i=0)=>{const a=typeof n=="number"?n:n==="center"?(i-1)/2:n==="end"?i-1:0,l=Math.abs(o-a),c=i>1?Math.max(a,i-1-a):1,f=c===0?0:l/c;return r+(s?s(f)*c:l)*e}},Wt=e=>{if(typeof e=="number")return e;if(typeof e=="string"){const t=e.trim();if(t.endsWith("ms")){const n=Number.parseFloat(t.slice(0,-2));return Number.isFinite(n)?n:0}if(t.endsWith("s")){const n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?n*1e3:0}const r=Number.parseFloat(t);return Number.isFinite(r)?r:0}return 0},Va=(e,t)=>{if(typeof e=="number")return e;if(typeof e=="string"){const r=/^([+-])=(\d+(?:\.\d+)?)$/.exec(e);if(r){const n=Number.parseFloat(r[2]);return Number.isFinite(n)?r[1]==="+"?t+n:t-n:t}}return t},Ka=e=>{const t=Wt(e?.duration),r=Wt(e?.endDelay),n=e?.iterations??1;return n===1/0?Number.MAX_SAFE_INTEGER:t*Math.max(0,n)+r},Nn=e=>{let t=0;return e.map(r=>{const n=Va(r.at,t),s=Wt(r.options?.delay),o=Math.max(0,n+s),i=Ka(r.options),a=o+i;return t=Math.max(t,a),{step:r,start:o,end:a,duration:i}})},Ya=async(e,t={})=>{const{stagger:r,onFinish:n}=t,s=e.length;for(let o=0;o<e.length;o+=1){const i=e[o],a=r?r(o,s):0;a>0&&await new Promise(l=>setTimeout(l,a)),await vt(i.target,i)}n?.()},Ga=(e=[],t={})=>{const r=[...e],n=new Set;let s=[],o=0,i=!1,a=!1;const{commitStyles:l=!0,respectReducedMotion:c=!0,onFinish:f}=t,m=()=>{if(!a){if(a=!0,l)for(const p of s){const{animation:u,step:h}=p;typeof u.commitStyles=="function"?u.commitStyles():Ae(h.target,h.keyframes),u.cancel()}n.forEach(p=>p()),f?.()}},d=()=>{s.forEach(({animation:u})=>u.cancel()),s=[],a=!1;const p=Nn(r);if(o=p.length?Math.max(...p.map(u=>u.end)):0,c&&ee()){l&&p.forEach(({step:u})=>Ae(u.target,u.keyframes)),i=!0;return}if(p.some(({step:u})=>typeof u.target.animate!="function")){l&&p.forEach(({step:u})=>Ae(u.target,u.keyframes)),i=!0;return}i=!1,s=p.map(({step:u,start:h})=>{const{delay:v,...b}=u.options??{};return{animation:u.target.animate(u.keyframes,{...b,delay:h,fill:b.fill??"both"}),step:u,start:h}})};return{add(p){r.push(p)},duration(){if(!r.length)return 0;if(!s.length){const p=Nn(r);return Math.max(...p.map(u=>u.end))}return o},async play(){if(d(),i||s.length===0){m();return}const p=s.map(u=>u.animation.finished.catch(()=>{}));await Promise.all(p),m()},pause(){i||s.forEach(({animation:p})=>p.pause())},resume(){i||s.forEach(({animation:p})=>p.play())},stop(){s.forEach(({animation:p})=>p.cancel()),s=[],i=!1},seek(p){i||s.forEach(({animation:u})=>{u.currentTime=p})},onFinish(p){return n.add(p),()=>n.delete(p)}}},Dn=e=>(e??[]).map(t=>t.trim()).filter(t=>t.length>0),Ja=async e=>{const t=Z().transitions,r=typeof e=="function"?{update:e,classes:t?.classes,types:t?.types,skipOnReducedMotion:t?.skipOnReducedMotion}:{...e,classes:e.classes??t?.classes,types:e.types??t?.types,skipOnReducedMotion:e.skipOnReducedMotion??t?.skipOnReducedMotion},n=r.update;if(typeof document>"u"){await n();return}const s=document,o=document.documentElement,i=Dn(r.classes),a=Dn(r.types);if(!s.startViewTransition||r.skipOnReducedMotion&&ee()){await n(),r.onFinish?.();return}i.forEach(l=>o.classList.add(l));try{const l=s.startViewTransition(()=>n()),c=l.types;if(c)for(const f of a)c.add(f);await l.ready,r.onReady?.(),await l.finished,r.onFinish?.()}finally{i.forEach(l=>o.classList.remove(l))}},Xa=(e,t,r={})=>{const{speed:n=50,delay:s=0,cursor:o=!1,cursorChar:i="|",loop:a=!1,loopDelay:l=1e3,respectReducedMotion:c=!0,onComplete:f}=r;if(typeof document>"u")return{stop:()=>{},done:Promise.resolve()};const m=e;let d=!1,p=null,u=null,h=null,v=null;const b=()=>{if(!o)return;u=document.createElement("span"),u.setAttribute("aria-hidden","true"),u.textContent=i,m.appendChild(u);let E=!0;h=setInterval(()=>{u&&(E=!E,u.style.opacity=E?"1":"0")},530)},y=()=>{h!==null&&(clearInterval(h),h=null),u&&u.parentNode&&(u.parentNode.removeChild(u),u=null)},w=()=>{d||(d=!0,p!==null&&(clearTimeout(p),p=null),y(),v?.(),v=null)};return c&&ee()?(m.textContent=t,f?.(),{stop:()=>{},done:Promise.resolve()}):{stop:w,done:new Promise(E=>{v=E;const k=()=>{let A=0;m.textContent="",b();const S=document.createTextNode("");u?m.insertBefore(S,u):m.appendChild(S);const T=()=>{d||(A<t.length?(S.data=t.slice(0,A+1),A++,p=setTimeout(T,n)):(f?.(),a&&!d?p=setTimeout(()=>{d||(y(),k())},l):(y(),E(),v=null)))};p=setTimeout(T,s)};k()})}},Za=class{constructor(e){this.bucketName=e,this.dbPromise=null,this.storeName="blobs"}openDB(){if(this.dbPromise)return this.dbPromise;const e=`bquery-bucket-${this.bucketName}`;return this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(this.storeName)||s.createObjectStore(this.storeName)},n.onsuccess=()=>t(n.result),n.onerror=()=>r(n.error)}),this.dbPromise}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.storeName,e).objectStore(this.storeName));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async put(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},el={async open(e){return new Za(e)}},tl=class{constructor(e){this.cache=e}async add(e){await this.cache.add(e)}async addAll(e){await this.cache.addAll(e)}async put(e,t){await this.cache.put(e,t)}async match(e){return this.cache.match(e)}async remove(e){return this.cache.delete(e)}async keys(){return(await this.cache.keys()).map(e=>e.url)}},rl={isSupported(){return"caches"in window},async open(e){if(!this.isSupported())throw new Error("bQuery: Cache Storage API not supported");return new tl(await caches.open(e))},async delete(e){return this.isSupported()?caches.delete(e):!1},async keys(){return this.isSupported()?caches.keys():[]}},nl=e=>{if(typeof document>"u")return null;const t=`${encodeURIComponent(e)}=`,r=document.cookie?document.cookie.split(";"):[];for(const n of r){const s=n.trim();if(s.startsWith(t)){const o=s.slice(t.length);try{return decodeURIComponent(o)}catch{return o}}}return null},sl=e=>{const t=e.trim();return t.startsWith("{")||t.startsWith("[")||t.startsWith('"')},ol=(e,t)=>{if(typeof document>"u")return;const r=[`${encodeURIComponent(e)}=`,"Expires=Thu, 01 Jan 1970 00:00:00 GMT"];t.path&&r.push(`Path=${t.path}`),t.domain&&r.push(`Domain=${t.domain}`),t.sameSite&&r.push(`SameSite=${t.sameSite}`),t.secure&&r.push("Secure"),document.cookie=r.join("; ")},il=(e,t,r)=>{if(typeof document>"u")return;const n=r.serialize?r.serialize(t):typeof t=="string"?t:JSON.stringify(t),s=[`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];r.path&&s.push(`Path=${r.path}`),r.domain&&s.push(`Domain=${r.domain}`),typeof r.maxAge=="number"&&s.push(`Max-Age=${r.maxAge}`),r.expires&&s.push(`Expires=${r.expires.toUTCString()}`),r.sameSite&&s.push(`SameSite=${r.sameSite}`),r.secure&&s.push("Secure"),document.cookie=s.join("; ")},al=(e,t={})=>{const r=Z().cookies,n={path:r?.path??"/",sameSite:r?.sameSite??"Lax",secure:r?.secure??!1,watch:!0,...t};n.sameSite==="None"&&(n.secure=!0);const s=nl(e);let o=n.defaultValue??null;if(s!==null)try{o=n.deserialize?n.deserialize(s):sl(s)?JSON.parse(s):s??o}catch(l){console.warn(`bQuery: Failed to deserialize cookie "${e}", using raw string value`,l),o=s??o}const i=$(o);if(typeof document>"u"||n.watch===!1)return i;let a=!1;return j(()=>{const l=i.value;if(!a){a=!0;return}if(l==null){ol(e,n);return}il(e,l,n)}),i},ll={isSupported(){return"Notification"in window},getPermission(){return this.isSupported()?Notification.permission:"denied"},async requestPermission(){return this.isSupported()?Notification.permission==="granted"?"granted":Notification.permission==="denied"?"denied":Notification.requestPermission():"denied"},send(e,t){return this.isSupported()?Notification.permission!=="granted"?(console.warn("bQuery: Notification permission not granted"),null):new Notification(e,t):(console.warn("bQuery: Notifications not supported in this browser"),null)}},cl=["position:absolute","width:1px","height:1px","padding:0","margin:-1px","overflow:hidden","clip:rect(0, 0, 0, 0)","white-space:nowrap","border:0"].join(";"),ul=(e={})=>{const t=Z().announcer,r={politeness:t?.politeness??"polite",atomic:t?.atomic??!0,delay:t?.delay??16,clearDelay:t?.clearDelay??1e3,...e},n=$("");if(typeof document>"u")return{element:null,message:n,announce(h){n.value=h},clear(){n.value=""},destroy(){n.value=""}};const s=r.id?document.getElementById(r.id):null,o=s??document.createElement("div"),i=!s;if(r.id&&(o.id=r.id),r.className&&(o.className=r.className),o.setAttribute("aria-live",r.politeness),o.setAttribute("aria-atomic",String(r.atomic)),o.setAttribute("role",r.politeness==="assertive"?"alert":"status"),o.setAttribute("data-bquery-announcer","true"),o.getAttribute("style")||o.setAttribute("style",cl),i){const h=r.container??document.body??document.documentElement;if(!h)return{element:null,message:n,announce(v){n.value=v},clear(){n.value=""},destroy(){n.value=""}};h.appendChild(o)}const a=j(()=>{o.textContent=n.value});let l,c,f=!1;const m=()=>{l&&(clearTimeout(l),l=void 0),c&&(clearTimeout(c),c=void 0)};return{element:o,message:n,announce:(h,v={})=>{if(f)return;const b=v.politeness??r.politeness,y=v.delay??r.delay,w=v.clearDelay??r.clearDelay;m(),o.setAttribute("aria-live",b),o.setAttribute("role",b==="assertive"?"alert":"status"),n.value="",l=setTimeout(()=>{f||(n.value=h,w>0&&(c=setTimeout(()=>{f||(n.value="")},w)))},y)},clear:()=>{f||(m(),n.value="")},destroy:()=>{f||(f=!0,m(),n.value="",a(),i&&o.remove())}}},In=(e,t)=>{const r=new Map;for(const[n,s]of Object.entries(t))r.set(n,e.getAttribute(n)),e.setAttribute(n,s);return()=>{for(const[n,s]of r.entries())s==null?e.removeAttribute(n):e.setAttribute(n,s)}},_n=(e,t)=>{const r=document.createElement(e);r.setAttribute("data-bquery-page-meta","true");for(const[n,s]of Object.entries(t))s!==void 0&&r.setAttribute(n,s);return r},fl=e=>{if(typeof document>"u")return()=>{};const t=Z().pageMeta,r=e.title?t?.titleTemplate?t.titleTemplate(e.title):e.title:void 0,n=[],s=[],o=document.title;r!==void 0&&(document.title=r);const i=[...e.meta??[]];e.description&&i.unshift({name:"description",content:e.description});for(const a of i){const l=_n("meta",{name:a.name,property:a.property,"http-equiv":a.httpEquiv,content:a.content});document.head.appendChild(l),n.push(l)}for(const a of e.link??[]){const l=_n("link",{rel:a.rel,href:a.href,type:a.type,media:a.media,crossorigin:a.crossOrigin});document.head.appendChild(l),n.push(l)}return e.htmlAttributes&&s.push(In(document.documentElement,e.htmlAttributes)),e.bodyAttributes&&document.body&&s.push(In(document.body,e.bodyAttributes)),()=>{document.title=o;for(const a of s.reverse())a();for(const a of n)a.remove()}},qn=class{constructor(e){this.storage=e}async get(e){const t=this.storage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return t}}async set(e,t){const r=typeof t=="string"?t:JSON.stringify(t);this.storage.setItem(e,r)}async remove(e){this.storage.removeItem(e)}async clear(){this.storage.clear()}async keys(){const e=[];for(let t=0;t<this.storage.length;t++){const r=this.storage.key(t);r!==null&&e.push(r)}return e}},dl=class extends qn{constructor(){super(localStorage)}},hl=class extends qn{constructor(){super(sessionStorage)}},ml=class{constructor(e){this.options=e,this.dbPromise=null}openDB(){return this.dbPromise?this.dbPromise:(this.dbPromise=new Promise((e,t)=>{const r=indexedDB.open(this.options.name,this.options.version??1);r.onupgradeneeded=()=>{const n=r.result;n.objectStoreNames.contains(this.options.store)||n.createObjectStore(this.options.store)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)}),this.dbPromise)}async withStore(e,t){const r=await this.openDB();return new Promise((n,s)=>{const o=t(r.transaction(this.options.store,e).objectStore(this.options.store));o.onsuccess=()=>n(o.result),o.onerror=()=>s(o.error)})}async get(e){return await this.withStore("readonly",t=>t.get(e))??null}async set(e,t){await this.withStore("readwrite",r=>r.put(t,e))}async remove(e){await this.withStore("readwrite",t=>t.delete(e))}async clear(){await this.withStore("readwrite",e=>e.clear())}async keys(){return(await this.withStore("readonly",e=>e.getAllKeys())).map(e=>String(e))}},pl={local(){return new dl},session(){return new hl},indexedDB(e){return new ml(e)}},zn=null,re=$({path:"",params:{},query:{},matched:null,hash:""}),xn=D(()=>re.value),Ue=$(0),yt=$(!1),vl=I(yt),jn=()=>{Ue.value===0&&(yt.value=!0),Ue.value+=1},Fn=()=>{const e=Math.max(0,Ue.value-1);Ue.value=e,e===0&&(yt.value=!1)},yl=()=>{Ue.value=0,yt.value=!1},he=()=>zn,Un=e=>{zn=e},Be=async(e,t={})=>{const r=he();if(!r)throw new Error("bQuery router: No router initialized. Call createRouter() first.");await r[t.replace?"replace":"push"](e)},gl=()=>{const e=he();e?e.back():history.back()},bl=()=>{const e=he();e?e.forward():history.forward()},wl="active",El=e=>e.split(/\s+/).map(t=>t.trim()).filter(t=>t.length>0),Sl=typeof HTMLElement<"u"?HTMLElement:class{},Bn=class extends Sl{constructor(...e){super(...e),this._cleanup=null,this._trackedActiveClasses=new Map,this._handleClick=t=>{t instanceof MouseEvent&&(t.defaultPrevented||t.button===0&&(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),this._navigate())))},this._handleKeydown=t=>{t instanceof KeyboardEvent&&t.key==="Enter"&&(t.preventDefault(),this._navigate())}}static get observedAttributes(){return["to","replace","exact","active-class"]}get to(){const e=this.getAttribute("to");return e==null||e.trim()===""?"/":e}set to(e){this.setAttribute("to",e)}get replace(){return this.hasAttribute("replace")}set replace(e){e?this.setAttribute("replace",""):this.removeAttribute("replace")}get exact(){return this.hasAttribute("exact")}set exact(e){e?this.setAttribute("exact",""):this.removeAttribute("exact")}get activeClass(){return this.getAttribute("active-class")??wl}set activeClass(e){this.setAttribute("active-class",e)}connectedCallback(){this.getAttribute("role")||this.setAttribute("role","link"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("click",this._handleClick),this.addEventListener("keydown",this._handleKeydown),this._setupActiveTracking()}disconnectedCallback(){this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeydown),this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses()}attributeChangedCallback(e,t,r){(e==="to"||e==="exact"||e==="active-class")&&this.isConnected&&this._setupActiveTracking()}_setupActiveTracking(){this._cleanup&&(this._cleanup(),this._cleanup=null),this._clearTrackedActiveClasses();const e=this.to,t=this.exact,r=El(this.activeClass);this._trackedActiveClasses=new Map(r.map(n=>[n,this.classList.contains(n)])),this._cleanup=j(()=>{const n=re.value.path,s=t?n===e:e==="/"?n==="/":n===e||n.startsWith(e.endsWith("/")?e:e+"/");for(const o of r){const i=this._trackedActiveClasses.get(o)??!1;this.classList.toggle(o,s||i)}s?this.setAttribute("aria-current","page"):this.removeAttribute("aria-current")})}_clearTrackedActiveClasses(){for(const[e,t]of this._trackedActiveClasses)this.classList.toggle(e,t);this._trackedActiveClasses.clear()}_navigate(){const e=this.to;e&&he()&&Be(e,{replace:this.replace}).catch(t=>{console.error("bq-link: Navigation failed:",t)})}},Al=()=>{typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("bq-link")&&customElements.define("bq-link",Bn)},kl=(e,t={})=>r=>{r.preventDefault(),Be(e,t).catch(n=>{console.error("Navigation failed:",n)})},Tl=e=>{const t=e??(typeof document<"u"?document.body:null);if(!t)return()=>{};const r=n=>{if(!(n instanceof MouseEvent)||n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey||typeof Element>"u"||!(n.target instanceof Element))return;const s=n.target.closest("a");if(!s||!(s instanceof(s.ownerDocument.defaultView?.HTMLAnchorElement??HTMLAnchorElement))||s.target||s.hasAttribute("download")||typeof window>"u"||s.origin!==window.location.origin)return;const o=he();if(!o){n.preventDefault(),Be(s.pathname+s.search+s.hash).catch(c=>{console.error("Navigation failed:",c)});return}const i=o.base,a=o.hash;let l;if(a&&s.hash&&s.hash.startsWith("#/"))l=s.hash.slice(1);else{let c=s.pathname;i&&i!=="/"&&c.startsWith(i)&&(c=c.slice(i.length)||"/"),l=c+s.search+s.hash}n.preventDefault(),Be(l).catch(c=>{console.error("Navigation failed:",c)})};return t.addEventListener("click",r),()=>t.removeEventListener("click",r)},Cl=e=>{const t={};return new URLSearchParams(e).forEach((r,n)=>{if(x(n))return;const s=t[n];s===void 0?t[n]=r:Array.isArray(s)?s.push(r):t[n]=[s,r]}),t},Rl=128,Wn=new Map,Hn=new Map,Qn=(e,t,r)=>{if(e.has(t)&&e.delete(t),e.set(t,r),e.size<=Rl)return;const n=e.keys().next().value;n!==void 0&&e.delete(n)},Ol=e=>{const t=[];let r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){n++;continue}if(s==="["&&!r){r=!0;continue}if(s==="]"&&r){r=!1;continue}if(!r){if(s==="("){t.push(!1);continue}if(s===")"){const o=t.pop()??!1,i=e[n+1];if(o&&(i==="+"||i==="*"||i==="?"||i==="{"))return!0;o&&t.length>0&&(t[t.length-1]=!0);continue}if(t.length>0){if(s==="?"&&n>0&&e[n-1]==="(")continue;(s==="+"||s==="*"||s==="?"||s==="{")&&(t[t.length-1]=!0)}}}return!1},Ll=e=>{let t="",r=!1;for(let n=0;n<e.length;n++){const s=e[n];if(s==="\\"&&n+1<e.length){if(!r&&e[n+1]>="1"&&e[n+1]<="9")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);if(!r&&e[n+1]==="k"&&e[n+2]==="<")throw new Error(`bQuery router: Route constraints cannot use backreferences: "${e}".`);t+=s+e[n+1],n++;continue}if(s==="["&&!r){r=!0,t+=s;continue}if(s==="]"&&r){r=!1,t+=s;continue}if(!r&&s==="("){if(n+1<e.length&&e[n+1]==="?"){if(e[n+2]==="<"){if(e[n+3]==="="||e[n+3]==="!"){t+="(";continue}const o=e.indexOf(">",n+3);if(o===-1)throw new Error(`bQuery router: Invalid route constraint named capture group: "${e}".`);t+="(?:",n=o;continue}t+="(";continue}t+="(?:";continue}t+=s}return t},Ht=e=>{const t=Wn.get(e);if(t!==void 0)return t;const r=Ll(e);return Qn(Wn,e,r),r},Vn=e=>{const t=Ht(e),r=Hn.get(t);if(r)return r;if(Ol(t))throw new Error(`bQuery router: Route constraint contains a potentially catastrophic (ReDoS) pattern. Nested quantifiers are not allowed: "${e}".`);try{const n=new RegExp(`^(?:${t})$`);return Qn(Hn,t,n),n}catch(n){throw n instanceof SyntaxError?new Error(`bQuery router: Invalid route constraint regex "${e}": ${n.message}`):n}},We=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"),Kn=e=>We(e)||e!==void 0&&e>="0"&&e<="9",Yn=(e,t)=>{let r=1,n="",s=t+1,o=!1;for(;s<e.length;){const i=e[s];if(i==="\\"&&s+1<e.length){n+=i+e[s+1],s+=2;continue}if(i==="["&&!o)o=!0;else if(i==="]"&&o)o=!1;else if(!o&&i==="(")r++;else if(!o&&i===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=i,s++}return null},$l=(e,t)=>{const r=Yn(e,t);if(!r)throw new Error(`bQuery router: Invalid route param constraint syntax in path "${e}" at index ${t}.`);return r},Gn=new Set,Jn=(e,t)=>{if(e[t]!==":"||!We(e[t+1]))return null;let r=t+2;for(;r<e.length&&Kn(e[r]);)r++;let n=r,s;if(e[r]==="("){const o=$l(e,r);s=o.constraint,n=o.endIndex}return{name:e.slice(t+1,r),constraint:s,nextIndex:n}},Pl=e=>{if(!Gn.has(e)){for(let t=0;t<e.length;){if(e[t]===":"&&We(e[t+1])){const r=Jn(e,t);r?.constraint&&Ht(r.constraint),t=r?.nextIndex??t+1;continue}t++}Gn.add(e)}},Ml=(e,t)=>{const r=e.indexOf("/",t);return r===-1?e.length:r},Xn=(e,t)=>{let r=t;for(;r<e.length&&!(e[r]==="*"||e[r]===":"&&We(e[r+1]));)r++;return e.slice(t,r)},Zn=(e,t,r,n)=>{const s=[];let o=t;for(;o<=r;){const i=e.indexOf(n,o);if(i===-1||i>r)break;s.push(i),o=i+1}return s.reverse()},Nl=(e,t)=>{const r=new Map,n=(s,o)=>{const i=`${s}:${o}`;if(r.has(i))return r.get(i)??null;if(s===e.length){const f=o===t.length?{}:null;return r.set(i,f),f}const a=e[s];if(a==="*"){if(s===e.length-1){const p={};return r.set(i,p),p}const f=Xn(e,s+1),m=f.length>0?Zn(t,o,t.length,f):null,d=(m?p=>{for(const u of m){const h=p(u);if(h)return h}return null}:p=>{for(let u=t.length;u>=o;u--){const h=p(u);if(h)return h}return null})(p=>{const u=n(s+1,p);return u?(r.set(i,u),u):null});return d||(r.set(i,null),null)}const l=Jn(e,s);if(l){const f=l.constraint?Vn(l.constraint):void 0,m=l.constraint?t.length:Ml(t,o),d=Xn(e,l.nextIndex),p=d.length>0?Zn(t,o,m,d):null,u=(p?h=>{for(const v of p){if(v<=o)continue;const b=h(v);if(b)return b}return null}:h=>{for(let v=m;v>o;v--){const b=h(v);if(b)return b}return null})(h=>{const v=t.slice(o,h);if(f&&!f.test(v))return null;const b=n(l.nextIndex,h);if(b){const y={[l.name]:v,...b};return r.set(i,y),y}return null});return u||(r.set(i,null),null)}if(o>=t.length||a!==t[o])return r.set(i,null),null;const c=n(s+1,o+1);return r.set(i,c),c};return n(0,0)},Dl=(e,t)=>{for(const r of t){Pl(r.path);const n=Nl(r.path,e);if(n)return{matched:r,params:n}}return null},gt=(e,t,r,n)=>{const s=Dl(e,n);return{path:e,params:s?.params??{},query:Cl(t),matched:s?.matched??null,hash:r.replace(/^#/,"")}},es=(e,t="")=>{const r=[];for(const n of e){const s=n.path==="*"?"*":`${t}${n.path}`.replace(/\/+/g,"/");r.push({...n,path:s}),n.children&&r.push(...es(n.children,s))}return r},Il=(e,t={})=>{const r=he();if(!r)throw new Error("bQuery router: No router initialized.");const n=r.routes.find(o=>o.name===e);if(!n)throw new Error(`bQuery router: Route "${e}" not found.`);let s="";for(let o=0;o<n.path.length;){if(n.path[o]===":"&&We(n.path[o+1])){let i=o+2;for(;i<n.path.length&&Kn(n.path[i]);)i++;let a=i,l=null;if(n.path[i]==="("){const m=Yn(n.path,i);if(!m)throw new Error(`bQuery router: Invalid constraint syntax in path "${n.path}" for route "${e}".`);l=m.constraint,a=m.endIndex}const c=n.path.slice(o+1,i),f=t[c];if(f===void 0)throw new Error(`bQuery router: Missing required param "${c}" for route "${e}".`);if(l&&!Vn(l).test(f))throw new Error(`bQuery router: Param "${c}" with value "${f}" does not satisfy the route constraint "${l}" for route "${e}".`);s+=encodeURIComponent(f),o=a;continue}s+=n.path[o],o++}return s},_l=(e,t=!1)=>{const r=re.value.path;return t?r===e:r.startsWith(e)},ql=(e,t=!1)=>D(()=>{const r=re.value.path;return t?r===e:r.startsWith(e)}),zl=100,xl=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},jl=e=>{const t=he();t&&t.destroy();const{routes:r,base:n="",hash:s=!1,scrollRestoration:o=!1}=e,i=[],a=[],l=es(r),c=new Map;let f="0",m=0,d=null;if(o&&typeof history<"u"&&"scrollRestoration"in history){d=history.scrollRestoration,history.scrollRestoration!=="manual"&&(history.scrollRestoration="manual");const S=history.state&&typeof history.state=="object"?history.state:{};if(typeof S.__bqScrollKey!="string"){const T=s?window.location.hash||"#/":`${window.location.pathname}${window.location.search}${window.location.hash}`;history.replaceState({...S,__bqScrollKey:f},"",T)}}const p=()=>history.state&&history.state.__bqScrollKey||f,u=()=>`${Date.now()}-${m++}`,h=(S=p())=>{if(o)for(c.has(S)&&c.delete(S),c.set(S,{x:window.scrollX,y:window.scrollY});c.size>zl;){const T=c.keys().next().value;if(T===void 0)break;c.delete(T)}},v=(S=p())=>{if(!o)return;const T=c.get(S);T?window.scrollTo(T.x,T.y):window.scrollTo(0,0)},b=()=>{const S=history.state&&typeof history.state=="object"?{...history.state}:{};return o&&(S.__bqScrollKey=f),S},y=()=>{if(s){const[T,P=""]=(window.location.hash.slice(1)||"/").split("#"),[R,O=""]=T.split("?");return{pathname:R,search:O?`?${O}`:"",hash:P?`#${P}`:""}}let S=window.location.pathname;return n&&(S===n||S.startsWith(n+"/"))&&(S=S.slice(n.length)||"/"),{pathname:S,search:window.location.search,hash:window.location.hash}},w=()=>{const{pathname:S,search:T,hash:P}=y();re.value=gt(S,T,P,l)},E=async(S,T,P=new Set)=>{jn();try{const{pathname:R,search:O,hash:C}=y(),L=gt(R,O,C,l),M=new URL(S,window.location.origin),_=`${M.pathname}${M.search}${M.hash}`;if(P.has(_))throw new Error(`bQuery router: redirect loop detected for path "${_}"`);P.add(_);const U=gt(M.pathname,M.search,M.hash,l);if(U.matched?.redirectTo){await E(U.matched.redirectTo,T,P);return}if(U.matched?.beforeEnter&&await U.matched.beforeEnter(U,L)===!1)return;for(const Ze of i)if(await Ze(U,L)===!1)return;h();const q=o?p():void 0,Q=T==="replaceState"&&q?q:u(),oe=s?`#${S}`:`${n}${S}`,Oe=o&&history.state&&typeof history.state=="object"?xl(history.state):{},or=o?{...Oe,__bqScrollKey:Q}:{};history[T](or,"",oe),f=Q,w(),o&&T==="pushState"&&window.scrollTo(0,0);for(const Ze of a)Ze(re.value,L)}finally{Fn()}},k=async S=>{jn();try{const{pathname:T,search:P,hash:R}=y(),O=re.value,C=gt(T,P,R,l);if(C.matched?.redirectTo){await E(C.matched.redirectTo,"replaceState");return}if(C.matched?.beforeEnter&&await C.matched.beforeEnter(C,O)===!1){const L=new URLSearchParams(Object.entries(O.query).flatMap(([q,Q])=>Array.isArray(Q)?Q.map(oe=>[q,oe]):[[q,Q]])).toString(),M=L?`?${L}`:"",_=O.hash?`#${O.hash}`:"",U=s?`#${O.path}${M}${_}`:`${n}${O.path}${M}${_}`;history.replaceState(b(),"",U);return}for(const L of i)if(await L(C,O)===!1){const M=new URLSearchParams(Object.entries(O.query).flatMap(([Q,oe])=>Array.isArray(oe)?oe.map(Oe=>[Q,Oe]):[[Q,oe]])).toString(),_=M?`?${M}`:"",U=O.hash?`#${O.hash}`:"",q=s?`#${O.path}${_}${U}`:`${n}${O.path}${_}${U}`;history.replaceState(b(),"",q);return}h(f),f=S.state?.__bqScrollKey??p(),w(),v(f);for(const L of a)L(re.value,O)}finally{Fn()}};window.addEventListener("popstate",k),w();const A={push:S=>E(S,"pushState"),replace:S=>E(S,"replaceState"),back:()=>history.back(),forward:()=>history.forward(),go:S=>history.go(S),beforeEach:S=>(i.push(S),()=>{const T=i.indexOf(S);T>-1&&i.splice(T,1)}),afterEach:S=>(a.push(S),()=>{const T=a.indexOf(S);T>-1&&a.splice(T,1)}),currentRoute:xn,routes:l,base:n,hash:s,destroy:()=>{window.removeEventListener("popstate",k),i.length=0,a.length=0,c.clear(),d!==null&&typeof history<"u"&&"scrollRestoration"in history&&(history.scrollRestoration=d),yl(),Un(null)}};return Un(A),A},ke=D(()=>re.value),Fl={route:ke,path:D(()=>ke.value.path),params:D(()=>ke.value.params),query:D(()=>ke.value.query),hash:D(()=>ke.value.hash),matched:D(()=>ke.value.matched)},Ul=()=>Fl,Bl=()=>{if(!(typeof window>"u"))return window.__BQUERY_DEVTOOLS__||(window.__BQUERY_DEVTOOLS__={stores:new Map}),window.__BQUERY_DEVTOOLS__},Wl=(e,t)=>{const r=Bl();r&&(r.stores.set(e,t),r.onStoreCreated?.(e,t))},Hl=e=>{typeof window>"u"||!window.__BQUERY_DEVTOOLS__||window.__BQUERY_DEVTOOLS__.stores.delete(e)},Ql=(e,t)=>{typeof window>"u"||window.__BQUERY_DEVTOOLS__?.onStateChange?.(e,t)},ts=[],Vl=e=>{ts.push(e)},Kl=(e,t)=>{for(const r of ts){const n=r({store:e,options:t});n&&Object.assign(e,n)}},He=new Map,rs=e=>He.has(e),Yl=(e,t)=>{He.set(e,t)},Te=e=>He.get(e),Qt=()=>Array.from(He.keys()),Gl=e=>{He.delete(e),Hl(e)},ns=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,me=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(me);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map)return new Map(Array.from(e.entries()).map(([r,n])=>[r,me(n)]));if(e instanceof Set)return new Set(Array.from(e).map(me));const t={};for(const r of Object.keys(e))t[r]=me(e[r]);return t},Ce=(e,t)=>{if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e.entries())if(!t.has(s)||!Ce(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e.values()){let o=!1;for(const i of t.values())if(Ce(s,i)){o=!0;break}if(!o)return!1}return!0}if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>Ce(s,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e),n=Object.keys(t);return r.length!==n.length?!1:r.every(s=>Ce(e[s],t[s]))},Jl=(e,t,r)=>{const n=[];for(const s of Object.keys(t)){const o=e[s],i=t[s];r.get(s)===i&&ns(o)&&ns(i)&&!Ce(o,i)&&n.push(s)}return n},Qe=()=>qt(),Vt=e=>{const{id:t,state:r,getters:n={},actions:s={}}=e;if(rs(t))return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`),Te(t);const o=r(),i=new Map;for(const y of Object.keys(o))i.set(y,$(o[y]));const a=[],l=[],c=(y,w,E)=>{!Qe()||typeof console>"u"||typeof console.error!="function"||console.error(`[bQuery store "${t}"] Error in $onAction ${y} for action "${w}"`,E)},f=new WeakSet,m=(y,w)=>{!Qe()||typeof console>"u"||typeof console.warn!="function"||f.has(y)||(f.add(y),console.warn(`[bQuery store "${t}"] Async $onAction listener detected for action "${w}". If it awaits, register after()/onError() before the first await; late registrations will not affect the current action.`))},d=(y,w,E,k)=>{try{const A=E();Le(A)&&(y==="listener"&&k&&m(k,w),A.catch(S=>{c(y,w,S)}))}catch(A){c(y,w,A)}},p=()=>ue(()=>({...h})),u=()=>{const y=typeof window<"u"&&typeof window.__BQUERY_DEVTOOLS__?.onStateChange=="function";if(a.length===0&&!y)return;const w=p();for(const E of a)E(w);Ql(t,w)},h=new Proxy({},{get:(y,w)=>{const E=w;if(i.has(E))return i.get(E).value},ownKeys:()=>Array.from(i.keys()),getOwnPropertyDescriptor:(y,w)=>{if(i.has(w))return{enumerable:!0,configurable:!0}},has:(y,w)=>i.has(w)}),v=new Map,b={};for(const y of Object.keys(o))Object.defineProperty(b,y,{get:()=>i.get(y).value,set:w=>{i.get(y).value=w,u()},enumerable:!0,configurable:!1});for(const y of Object.keys(n)){const w=n[y],E=D(()=>w(h,new Proxy({},{get:(k,A)=>{const S=A;if(v.has(S))return v.get(S).value}})));v.set(y,E),Object.defineProperty(b,y,{get:()=>E.value,enumerable:!0,configurable:!1})}for(const y of Object.keys(s)){const w=s[y],E=y;b[E]=function(...k){const A=new Proxy(b,{get:(C,L)=>typeof L=="string"&&i.has(L)?i.get(L).value:C[L],set:(C,L,M)=>typeof L=="string"&&i.has(L)?(i.get(L).value=M,u(),!0):Reflect.set(C,L,M)});if(l.length===0)return w.apply(A,k);const S=[],T=[],P=[...l],R={name:E,store:b,args:k,after:C=>{S.push(L=>C(L))},onError:C=>{T.push(C)}};for(const C of P)d("listener",E,()=>C(R),C);let O;try{O=w.apply(A,k)}catch(C){for(const L of T)d("onError",E,()=>L(C));throw C}if(Le(O))return O.then(C=>{for(const L of S)d("after",E,()=>L(C));return C},C=>{for(const L of T)d("onError",E,()=>L(C));throw C});for(const C of S)d("after",E,()=>C(O));return O}}return Object.defineProperties(b,{$id:{value:t,writable:!1,enumerable:!1},$reset:{value:()=>{const y=r();ce(()=>{for(const[w,E]of i)E.value=y[w]}),u()},writable:!1,enumerable:!1},$subscribe:{value:y=>(a.push(y),()=>{const w=a.indexOf(y);w>-1&&a.splice(w,1)}),writable:!1,enumerable:!1},$onAction:{value:y=>(l.push(y),()=>{const w=l.indexOf(y);w>-1&&l.splice(w,1)}),writable:!1,enumerable:!1},$patch:{value:y=>{ce(()=>{if(typeof y=="function"){const w=Qe(),E=w?me(p()):null,k=w?new Map(Array.from(i.entries()).map(([S,T])=>[S,T.value])):null,A=p();if(y(A),w&&E&&k){const S=Jl(E,A,k);S.length>0&&console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${S.map(String).join(", ")}.
|
|
171
255
|
Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
|
|
172
256
|
To fix this, either:
|
|
173
257
|
1. Replace the entire object: state.user = { ...state.user, name: "New" }
|
|
174
258
|
2. Use $patchDeep() for automatic deep cloning
|
|
175
|
-
See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,C]of Object.entries(A))i.has(S)&&(i.get(S).value=C)}else for(const[w,E]of Object.entries(v))i.has(w)&&(i.get(w).value=E)}),f()},writable:!1,enumerable:!1},$patchDeep:{value:v=>{Le(()=>{if(typeof v=="function"){const w=ue(p());v(w);for(const[E,T]of Object.entries(w))i.has(E)&&(i.get(E).value=T)}else for(const[w,E]of Object.entries(v))i.has(w)&&(i.get(w).value=ue(E))}),f()},writable:!1,enumerable:!1},$state:{get:()=>p(),enumerable:!1}}),Ba(t,b),Fa(b,e),qa(t,b),b},Qa=(e,t)=>()=>vn(e)?Ee(e):Mt({id:e,...t}),Va=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Wa=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},Ka=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},Ya="__version",Ga={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},gn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},Ja=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))x(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},Xa=()=>{try{return globalThis.localStorage}catch{return}},Za=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??Xa(),o=r.serializer??Ga,i=r.version,a=r.migrate,l=n+Ya;let c=s!==void 0&&i!==void 0,u=!1,h=!1;const d=m=>{if(!s||i===void 0)return!1;try{return s.setItem(l,String(i)),!0}catch(g){return m&&je()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(m,g),!1}},p=e.state,f=Mt({...e,state:()=>{const m=p();if(!s)return m;try{const g=s.getItem(n);if(!g)return m;const b=o.deserialize(g);if(!gn(b))return m;let v=b;if(i!==void 0&&a){const w=s.getItem(l),E=w!==null?Number(w):0,T=Number.isFinite(E)?E:0;if(T!==i){c=!1,u=!0;const A=a(v,T);if(!gn(A))return m;v=A;let S=!1;try{s.setItem(n,o.serialize(v)),S=!0,h=!0}catch(C){je()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,C)}S&&d(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(u=!1)}else c=!1}return Ja(m,v)}catch{return m}}});return c&&s?d():u&&h&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(u=!1),f.$subscribe(m=>{if(s)try{s.setItem(n,o.serialize(m)),u&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`)&&(u=!1)}catch{}}),f},el=(e,t,r,n={})=>{const s=n.equals??(n.deep?Se:Object.is);let o=t(e.$state);return n.immediate&&r(o,void 0),e.$subscribe(i=>{const a=t(i);if(!s(a,o)){const l=o;o=a,r(a,l)}})},bn=500,wn=class{constructor(e){this.cache=new Map,this.maxSize=e}get(e){const t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}get size(){return this.cache.size}},En=new wn(bn),Sn=new wn(bn),tl=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return le(n)||Pe(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),U=(e,t)=>{try{const r=tl(t);let n=En.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),En.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},it=(e,t)=>{try{let r=Sn.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),Sn.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Dt=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",o=0,i=null;for(let a=0;a<r.length;a++){const l=r[a];if(l==='"'||l==="'"||l==="`"){let c=0,u=a-1;for(;u>=0&&r[u]==="\\";)c++,u--;c%2===0&&(i===null?i=l:i===l&&(i=null)),s+=l;continue}if(i!==null){s+=l;continue}l==="("||l==="["||l==="{"?(o++,s+=l):l===")"||l==="]"||l==="}"?(o--,s+=l):l===","&&o===0?(n.push(s.trim()),s=""):s+=l}s.trim()&&n.push(s.trim());for(const a of n){let l=-1,c=0,u=null;for(let h=0;h<a.length;h++){const d=a[h];if(d==='"'||d==="'"||d==="`"){let p=0,f=h-1;for(;f>=0&&a[f]==="\\";)p++,f--;p%2===0&&(u===null?u=d:u===d&&(u=null));continue}if(u===null){if(d==="("||d==="["||d==="{")c++;else if(d===")"||d==="]"||d==="}")c--;else if(d===":"&&c===0){l=h;break}}}if(l>-1){const h=a.slice(0,l).trim().replace(/^['"]|['"]$/g,"");if(x(h))continue;t[h]=a.slice(l+1).trim()}}return t},rl=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),nl=e=>{const t=e.trim(),r=t.toLowerCase();return r.startsWith("aria-")?r:`aria-${rl(/^aria[A-Z]/.test(t)?t.slice(4):t).replace(/^-/,"")}`},sl=e=>e==null||e==="",ol=(e,t,r,n)=>{let s=new Set;const o=z(()=>{const i=new Set,a=Object.create(null);if(t.trimStart().startsWith("{")){const l=Dt(t);for(const[c,u]of Object.entries(l))a[c]=U(u,r)}else{const l=U(t,r);if(l&&typeof l=="object"&&!Array.isArray(l))for(const[c,u]of Object.entries(l))x(c)||(a[c]=u)}for(const[l,c]of Object.entries(a)){const u=nl(l);if(sl(c)){e.removeAttribute(u);continue}e.setAttribute(u,c===!0?"true":String(c)),i.add(u)}for(const l of s)i.has(l)||e.removeAttribute(l);s=i});n.push(o)},il=e=>(t,r,n,s)=>{const o=z(()=>{const i=U(r,n);i==null||i===!1?t.removeAttribute(e):i===!0?t.setAttribute(e,""):t.setAttribute(e,String(i))});s.push(o)},al=(e,t,r,n)=>{let s=new Set;const o=z(()=>{const i=new Set;if(t.trimStart().startsWith("{")){const a=Dt(t);for(const[l,c]of Object.entries(a)){const u=U(c,r);e.classList.toggle(l,!!u),i.add(l)}}else if(/^\s*\[/.test(t)){const a=U(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),i.add(l))}else{const a=U(t,r);typeof a=="string"?a.split(/\s+/).forEach(l=>{l&&(e.classList.add(l),i.add(l))}):Array.isArray(a)&&a.forEach(l=>{l&&(e.classList.add(l),i.add(l))})}for(const a of s)i.has(a)||e.classList.remove(a);s=i});n.push(o)},ll=e=>{if(le(e)||Pe(e))return String(e.value??"");if(e&&typeof e=="object"&&"error"in e){const t=e.error;return le(t)||Pe(t)?String(t.value??""):String(t??"")}return String(e??"")},cl=(e,t,r,n)=>{const s=e,o=!s.hasAttribute("aria-hidden");s.hasAttribute("role")||s.setAttribute("role","alert"),s.hasAttribute("aria-live")||s.setAttribute("aria-live","assertive");const i=z(()=>{const a=ll(U(t,r)).trim(),l=a.length>0;s.textContent=a,s.hidden=!l,o&&(l?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden","true"))});n.push(i)},ul=(e,t,r,n,s,o)=>{if(!r)return t;const i={...o,[n]:e};return s&&(i[s]=t),U(r,i)},fl=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,o,i,a)=>{const l=s.parentNode;if(!l)return;const c=o.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!c){console.error(`bQuery view: Invalid bq-for expression "${o}"`);return}const[,u,h,d]=c,p=s.getAttribute(":key")||s.getAttribute(`${t}-key`),f=s.cloneNode(!0);f.removeAttribute(`${t}-for`),f.removeAttribute(":key"),f.removeAttribute(`${t}-key`);const m=document.createComment(`bq-for: ${o}`);l.replaceChild(m,s);let g=new Map,b=[];const v=(A,S,C)=>{const R=f.cloneNode(!0),O=[],L=M(A),k=h?M(S):null,$={...i,[u]:L};return h&&k&&($[h]=k),r(R,$,t,O),n(R,$,t,O),{key:C,element:R,cleanups:O,item:A,index:S,itemSignal:L,indexSignal:k}},w=A=>{for(const S of A.cleanups)S();A.element.remove()},E=(A,S,C)=>{Object.is(A.item,S)||(A.item=S,A.itemSignal.value=S),A.index!==C&&(A.index=C,A.indexSignal&&(A.indexSignal.value=C))},T=z(()=>{const A=U(d,i);if(!Array.isArray(A)){for(const $ of g.values())w($);g.clear(),b=[];return}const S=[],C=new Map,R=new Set;A.forEach(($,D)=>{let I=ul($,D,p,u,h,i);R.has(I)&&(console.warn(`bq-for: Duplicate key "${String(I)}" detected at index ${D}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),I={__bqDuplicateKey:I,__bqIndex:D}),R.add(I),S.push(I),C.set(I,{item:$,index:D})});const O=[];for(const $ of b)C.has($)||O.push($);for(const $ of O){const D=g.get($);D&&(w(D),g.delete($))}const L=new Map;let k=m;for(let $=0;$<S.length;$++){const D=S[$],{item:I,index:j}=C.get(D);let _=g.get(D);_?(E(_,I,j),L.set(D,_),k.nextSibling!==_.element&&k.after(_.element),k=_.element):(_=v(I,j,D),L.set(D,_),k.after(_.element),k=_.element)}g=L,b=S});a.push(()=>{T();for(const A of g.values())for(const S of A.cleanups)S();g.clear()})}},dl=e=>(t,r,n,s)=>{const o=z(()=>{const i=U(r,n),a=String(i??"");t.innerHTML=e?J(a):a});s.push(o)},hl=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let o=!0;const i=z(()=>{const a=U(t,r);a&&!o?(s.replaceWith(e),o=!0):!a&&o&&(e.replaceWith(s),o=!1)});n.push(i)},ml=(e,t,r,n)=>{const s=e,o=it(t,r);if(!le(o)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const i=o,a=s.type==="checkbox",l=s.type==="radio",c=()=>{a?s.checked=!!i.value:l?s.checked=i.value===s.value:s.value=String(i.value??"")},u=z(()=>{c()});n.push(u);const h=s.tagName==="SELECT"?"change":"input",d=()=>{a?i.value=s.checked:l?s.checked&&(i.value=s.value):i.value=s.value};s.addEventListener(h,d),n.push(()=>s.removeEventListener(h,d))},pl=e=>(t,r,n,s)=>{const o=i=>{const a={...n,$event:i,$el:t};if(!r.includes("(")){const l=it(r,a);if(typeof l=="function"){l(i);return}return}it(r,a)};t.addEventListener(e,o),s.push(()=>t.removeEventListener(e,o))};function vl(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var yl=(e,t,r,n)=>{const s=it(t,r);le(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&vl(s)&&(s.value=e,n.push(()=>{s.value=null}))},gl=(e,t,r,n)=>{const s=e;let o=s.style.display;if(!o||o==="none"){const a=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";o=a!=="none"?a:""}const i=z(()=>{const a=U(t,r);s.style.display=a?o:"none"});n.push(i)},bl=(e,t,r,n)=>{const s=e;let o=new Set;const i=z(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=Dt(t);for(const[c,u]of Object.entries(l)){const h=U(u,r),d=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(d,String(h??"")),a.add(d)}}else{const l=U(t,r);if(l&&typeof l=="object")for(const[c,u]of Object.entries(l)){const h=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(h,String(u??"")),a.add(h)}}for(const l of o)a.has(l)||s.style.removeProperty(l);o=a});n.push(i)},wl=(e,t,r,n)=>{const s=z(()=>{const o=U(t,r);e.textContent=String(o??"")});n.push(s)},Nt=null,El=e=>{Nt=e},Sl=e=>Nt?Nt(e):void 0,at=(e,t,r,n,s)=>{const o=Array.from(e.attributes);for(const i of o){const{name:a,value:l}=i;if(!a.startsWith(`${r}-`))continue;const c=a.slice(r.length+1);if(c==="for"){s.for(e,l,t,n);return}if(c==="text")s.text(e,l,t,n);else if(c==="error")s.error(e,l,t,n);else if(c==="aria")s.aria(e,l,t,n);else if(c==="html")s.html(e,l,t,n);else if(c==="if")s.if(e,l,t,n);else if(c==="show")s.show(e,l,t,n);else if(c==="class")s.class(e,l,t,n);else if(c==="style")s.style(e,l,t,n);else if(c==="model")s.model(e,l,t,n);else if(c==="ref")s.ref(e,l,t,n);else if(c.startsWith("bind:")){const u=c.slice(5);s.bind(u)(e,l,t,n)}else if(c.startsWith("on:")){const u=c.slice(3);s.on(u)(e,l,t,n)}else{const u=Sl(c);u?u(e,l,t,n):Et()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${c}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},Pt=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?at(i,t,r,n,s):(at(i,t,r,n,s),Pt(i,t,r,n,s))},It=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,o=typeof e=="string"?document.querySelector(e):e;if(!o)throw new Error(`bQuery view: Element "${e}" not found.`);if(o.hasAttribute(`${n}-for`))throw new Error(`bQuery view: Cannot mount on element with ${n}-for directive. Wrap the ${n}-for element in a container instead.`);const i=[],a={text:wl,error:cl,aria:ol,html:dl(s),if:hl,show:gl,class:al,style:bl,model:ml,ref:yl,for:fl({prefix:n,processElement:(c,u,h,d)=>at(c,u,h,d,a),processChildren:(c,u,h,d)=>Pt(c,u,h,d,a)}),bind:il,on:pl};return((c,u,h)=>{const d=c.hasAttribute(`${n}-for`);at(c,u,n,h,a),d||Pt(c,u,n,h,a)})(o,t,i),{el:o,context:t,update:c=>{Object.assign(t,c)},destroy:()=>{for(const c of i)c();i.length=0}}},Al=(e,t={})=>r=>{const n=document.createElement("div");n.innerHTML=e.trim();const s=n.firstElementChild;if(!s)throw new Error("bQuery view: Template must contain a single root element.");if(n.childElementCount>1)throw new Error(`bQuery view: Template must contain exactly one root element, found ${n.childElementCount}.`);const{prefix:o="bq"}=t;if(s.hasAttribute(`${o}-for`)||s.hasAttribute(`${o}-if`)){const i=s.hasAttribute(`${o}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${o}-${i} directive. Wrap the ${o}-${i} element in a container instead.`)}return It(s,r,t)},Cl=e=>e===!0||e===void 0,kl=async(e,t)=>{const r=e(t),n=ke(r)?await r:r;return Cl(n)?void 0:n},Ol=e=>{const t=e.initialValue,r=M(t),n=M(""),s=M(!1),o=P(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:o,isTouched:s,isPristine:P(()=>!o.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},An=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await kl(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},Tl=e=>{const t=Object.entries(e.fields),r={},n={};for(const[f,m]of t){const g=Ol(m);r[f]=g,n[f]=g.error}const s=M(!1),o=P(()=>{for(const f of Object.keys(r))if(r[f].error.value!=="")return!1;return!0}),i=P(()=>{for(const f of Object.keys(r))if(r[f].isDirty.value)return!0;return!1}),a=async f=>{const m=r[f],g=e.fields[f];!m||!g||await An(m,g.validators)},l=async()=>{let f=!1;for(const[m,g]of t){const b=r[m];await An(b,g.validators)&&(f=!0)}if(e.crossValidators&&e.crossValidators.length>0){const m=h();for(const g of e.crossValidators){const b=await g(m);if(b){for(const[v,w]of Object.entries(b))if(w){const E=r[v];E&&(E.error.value===""&&(E.error.value=w),f=!0)}}}}return!f},c=async()=>{if(!s.value){s.value=!0;try{if(!await l())return;e.onSubmit&&await e.onSubmit(h())}finally{s.value=!1}}},u=()=>{for(const f of Object.keys(r))r[f].reset()},h=()=>{const f={};for(const m of Object.keys(r))f[m]=r[m].value.value;return f};return{fields:r,errors:n,isValid:o,isDirty:i,isSubmitting:s,handleSubmit:c,validateField:a,validate:l,reset:u,getValues:h,setValues:f=>{for(const[m,g]of Object.entries(f)){if(x(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.value.value=g)}},setErrors:f=>{for(const[m,g]of Object.entries(f)){if(x(m)||!Object.prototype.hasOwnProperty.call(r,m))continue;const b=r[m];b&&(b.error.value=g??"")}}}},Ll=e=>e===!0||e===void 0,$l=async(e,t)=>{const r=e(t),n=ke(r)?await r:r;return Ll(n)?void 0:n},Rl=(e,t={})=>{let r;Ml(e)?r=e:r=M(Cr(e)||Dl(e)?e.peek():e);const n=r.peek(),s=M(t.initialError??""),o=M(!1),i=M(!1),a=P(()=>!Object.is(r.value,n)),l=P(()=>!a.value),c=P(()=>s.value===""),u=t.validateOn??"manual",h=Math.max(0,t.debounceMs??0);let d=0,p=!1,f=!1,m=!1,g;const b=A=>{console.error("bQuery forms: Error in scheduled field validation",A)},v=async()=>{const A=++d,S=t.validators;if(!S||S.length===0)return s.value="",i.value=!1,!0;i.value=!0;try{const C=r.peek();for(const R of S){const O=await $l(R,C);if(A!==d)return s.peek()==="";if(O)return s.value=O,!1}return A===d&&(s.value=""),!0}finally{A===d&&(i.value=!1)}},w=dt(()=>{v().catch(b)},h),E=()=>{if(!m){if(h>0){w();return}v().catch(b)}};return(u==="change"||u==="both")&&(g=z(()=>{if(r.value,!p){p=!0;return}if(f){f=!1;return}E()})),{value:r,error:s,isDirty:a,isTouched:o,isPristine:l,isValid:c,isValidating:i,touch:()=>{o.value=!0,(u==="blur"||u==="both")&&E()},reset:()=>{d+=1,w.cancel(),Object.is(r.peek(),n)||(f=!0),r.value=n,s.value=t.initialError??"",o.value=!1,i.value=!1},validate:async()=>(w.cancel(),v()),destroy:()=>{m||(m=!0,d+=1,w.cancel(),g?.(),g=void 0,a.dispose(),l.dispose(),c.dispose(),i.value=!1)}}},Ml=e=>e instanceof Ne,Dl=e=>e instanceof De,Nl=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,Pl=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},Il=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},_l=(e,t="Invalid format")=>{const r=e.global||e.sticky?new RegExp(e.source,e.flags.replace(/[gy]/g,"")):e;return n=>{const s=typeof n=="string"?n:String(n??"");return r.lastIndex=0,r.test(s)?!0:t}},ql=(e="Invalid email address")=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r=>{const n=typeof r=="string"?r:String(r??"");return n===""||t.test(n)?!0:e}},xl=(e="Invalid URL")=>t=>{const r=typeof t=="string"?t:String(t??"");if(r==="")return!0;try{return new URL(r),!0}catch{return e}},zl=(e,t)=>{const r=t??`Must be at least ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))>=e?!0:r},jl=(e,t)=>{const r=t??`Must be at most ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))<=e?!0:r},Fl=(e,t)=>r=>e(r)?!0:t,Bl=(e,t)=>async r=>await e(r)?!0:t,Hl=(e,t="Fields do not match")=>r=>Object.is(r,e.value)?!0:t,Cn=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},kn=(e,t,r)=>{const{locale:n,...s}=r??{},o=typeof e=="number"?new Date(e):e;try{return new Intl.DateTimeFormat(t,s).format(o)}catch{return o.toLocaleString()}},On=(e,t)=>{const r=t.split(".");let n=e;for(const s of r){if(typeof n=="string"||n[s]===void 0)return;n=n[s]}return typeof n=="string"?n:void 0},Ul=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),Ql=(e,t)=>{if(!e.includes("|")||!("count"in t))return e;const r=Number(t.count),n=e.split("|").map(s=>s.trim());return n.length===3?r===0?n[0]:r===1?n[1]:n[2]:n.length===2?r===1?n[0]:n[1]:r===0&&n.length>0?n[0]:r===1&&n.length>1?n[1]:n[n.length-1]},Tn=(e,t,r,n)=>{let s;return e&&(s=On(e,t)),s===void 0&&n&&(s=On(n,t)),s===void 0?t:Ul(Ql(s,r),r)},Ln=(e,t)=>{const r=me(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!he(s))return s;const o=Object.create(null);for(const[i,a]of Object.entries(s))x(i)||(o[i]=n(a));return o};return n(r)},Vl=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=v=>Ln(Object.create(null),v),o=Object.create(null);for(const[v,w]of Object.entries(r))x(v)||(o[v]=s(w));const i=M(t),a=new Map,l=new Set(Object.keys(o));return{$locale:i,t:(v,w={})=>{const E=o[i.value];return Tn(E,v,w,n?o[n]:void 0)},tc:(v,w={})=>P(()=>{const E=o[i.value];return Tn(E,v,w,n?o[n]:void 0)}),loadLocale:(v,w)=>{x(v)||a.set(v,w)},ensureLocale:async v=>{if(x(v)||l.has(v))return;const w=a.get(v);if(!w)throw new Error(`bQuery i18n: No messages or loader registered for locale "${v}".`);const E=await w();o[v]=s(E.default??E),l.add(v)},n:(v,w)=>Cn(v,w?.locale??i.value,w),d:(v,w)=>kn(v,w?.locale??i.value,w),getMessages:v=>{if(!x(v))return o[v]},mergeMessages:(v,w)=>{x(v)||(o[v]||(o[v]=Object.create(null),l.add(v)),o[v]=Ln(o[v],s(w)))},availableLocales:()=>{const v=new Set([...l,...a.keys()]);return Array.from(v).sort()}}},lt=new Map,Fe=new Map,Wl=50,Kl=e=>{const t=lt.get(e);if(t&&t.isConnected)return t;const r=document.createElement("div");return r.setAttribute("aria-live",e),r.setAttribute("aria-atomic","true"),r.setAttribute("role",e==="assertive"?"alert":"status"),Object.assign(r.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),document.body.appendChild(r),lt.set(e,r),r},Yl=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=Kl(t),n=Fe.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Fe.delete(t),r.isConnected&&(r.textContent=e)},Wl);Fe.set(t,s)},Gl=()=>{for(const e of Fe.values())clearTimeout(e);Fe.clear();for(const[,e]of lt)e.remove();lt.clear()},K=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),Jl=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(K("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(K("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},Xl=e=>{const t=[],r=e.querySelectorAll("input, select, textarea");for(const n of r){const s=n.getAttribute("type");if(s==="hidden"||s==="submit"||s==="button"||s==="reset")continue;const o=n.getAttribute("id"),i=o?!!e.querySelector(`label[for="${o}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),c=n.closest("label")!==null;!i&&!a&&!l&&!c&&t.push(K("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},Zl=e=>{const t=[],r=e.querySelectorAll("button");for(const s of r){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title");!o&&!i&&!a&&t.push(K("error","Button has no accessible name. Add text content, aria-label, or title.",s,"button-name"))}const n=e.querySelectorAll("a[href]");for(const s of n){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title"),l=s.querySelector("img[alt]")!==null;!o&&!i&&!a&&!l&&t.push(K("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},ec=e=>{const t=[],r=e.querySelectorAll("h1, h2, h3, h4, h5, h6");let n=0;for(const s of r){const o=parseInt(s.tagName.charAt(1),10);n>0&&o>n+1&&t.push(K("warning",`Heading level skipped: <${s.tagName.toLowerCase()}> follows <h${n}>. Don't skip heading levels.`,s,"heading-order")),(s.textContent??"").trim().length===0&&t.push(K("warning","Heading element is empty.",s,"heading-empty")),n=o}return t},tc=e=>{const t=[],r=e.querySelectorAll("[aria-labelledby]");for(const s of r){const o=(s.getAttribute("aria-labelledby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(K("error",`aria-labelledby references "${i}" which does not exist in the document.`,s,"aria-labelledby-ref"))}const n=e.querySelectorAll("[aria-describedby]");for(const s of n){const o=(s.getAttribute("aria-describedby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(K("error",`aria-describedby references "${i}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},rc=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(K("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},nc=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...Jl(t),...Xl(t),...Zl(t),...ec(t),...tc(t),...rc(t)],n=r.filter(s=>s.severity==="error").length;return{findings:r,errors:n,warnings:r.filter(s=>s.severity==="warning").length,passed:n===0}},$n=(e,t)=>{if(typeof e.addEventListener=="function")return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)};const r=e;if(typeof r.addListener=="function")return r.addListener(t),()=>{r.removeListener?.(t)}},Rn=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},sc=()=>{const e=M("light");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function")try{const r=window.matchMedia("(prefers-color-scheme: dark)");e.value=r.matches?"dark":"light";const s=$n(r,o=>{e.value=o.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return Rn(H(e),t)},oc=()=>{const e=M("no-preference");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function"){let r,n,s;const o=()=>{!r||!n||!s||(r.matches?e.value="more":n.matches?e.value="less":s.matches?e.value="custom":e.value="no-preference")};try{r=window.matchMedia("(prefers-contrast: more)"),n=window.matchMedia("(prefers-contrast: less)"),s=window.matchMedia("(prefers-contrast: custom)"),o();const i=[r,n,s].map(a=>$n(a,()=>{o()})).filter(a=>a!==void 0);i.length>0&&(t=()=>{for(const a of i)a();e.dispose()})}catch{}}return Rn(H(e),t)},ic=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:o}=r;let i=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),c=f=>{for(const m of f)a.has(m)||a.set(m,m.getAttribute("tabindex"))},u=f=>{const m=l();if(m.length===0)return;c(m);const g=Math.max(0,Math.min(f,m.length-1));for(let b=0;b<m.length;b++)m[b].setAttribute("tabindex",b===g?"0":"-1");i=g,m[g].focus(),o?.(m[g],g)},h=f=>{if(f==="Home"||f==="End")return!0;switch(s){case"horizontal":return f==="ArrowLeft"||f==="ArrowRight";case"vertical":return f==="ArrowUp"||f==="ArrowDown";case"both":return f==="ArrowLeft"||f==="ArrowRight"||f==="ArrowUp"||f==="ArrowDown";default:return!1}},d=f=>{if(!h(f.key))return;const m=l();if(m.length===0)return;f.preventDefault();let g=i;switch(f.key){case"ArrowDown":case"ArrowRight":g=i+1,g>=m.length&&(g=n?0:m.length-1);break;case"ArrowUp":case"ArrowLeft":g=i-1,g<0&&(g=n?m.length-1:0);break;case"Home":g=0;break;case"End":g=m.length-1;break}u(g)},p=l();c(p);for(let f=0;f<p.length;f++)p[f].setAttribute("tabindex",f===0?"0":"-1");return e.addEventListener("keydown",d),{destroy:()=>{e.removeEventListener("keydown",d);for(const[f,m]of a)m===null?f.removeAttribute("tabindex"):f.setAttribute("tabindex",m);a.clear()},focusItem:f=>{u(f)},activeIndex:()=>i}},_t=`
|
|
259
|
+
See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,T]of Object.entries(A))i.has(S)&&(i.get(S).value=T)}else for(const[w,E]of Object.entries(y))i.has(w)&&(i.get(w).value=E)}),u()},writable:!1,enumerable:!1},$patchDeep:{value:y=>{ce(()=>{if(typeof y=="function"){const w=me(p());y(w);for(const[E,k]of Object.entries(w))i.has(E)&&(i.get(E).value=k)}else for(const[w,E]of Object.entries(y))i.has(w)&&(i.get(w).value=me(E))}),u()},writable:!1,enumerable:!1},$state:{get:()=>p(),enumerable:!1}}),Yl(t,b),Kl(b,e),Wl(t,b),b},Xl=(e,t)=>()=>rs(e)?Te(e):Vt({id:e,...t}),Zl=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},ec=(e,t)=>{const r={};for(const n of t)Object.defineProperty(r,n,{get:()=>e[n],enumerable:!0});return r},tc=(e,t)=>{const r={};for(const n of t)r[n]=(...s)=>e[n](...s);return r},rc="__version",nc={serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},ss=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null},sc=(e,t)=>{const r={...e};for(const[n,s]of Object.entries(t))x(n)||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s);return r},oc=()=>{try{return globalThis.localStorage}catch{return}},ic=(e,t)=>{const r=typeof t=="string"?{key:t}:t??{},n=r.key??`bquery-store-${e.id}`,s=r.storage??oc(),o=r.serializer??nc,i=r.version,a=r.migrate,l=n+rc;let c=s!==void 0&&i!==void 0,f=!1,m=!1;const d=h=>{if(!s||i===void 0)return!1;try{return s.setItem(l,String(i)),!0}catch(v){return h&&Qe()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(h,v),!1}},p=e.state,u=Vt({...e,state:()=>{const h=p();if(!s)return h;try{const v=s.getItem(n);if(!v)return h;const b=o.deserialize(v);if(!ss(b))return h;let y=b;if(i!==void 0&&a){const w=s.getItem(l),E=w!==null?Number(w):0,k=Number.isFinite(E)?E:0;if(k!==i){c=!1,f=!0;const A=a(y,k);if(!ss(A))return h;y=A;let S=!1;try{s.setItem(n,o.serialize(y)),S=!0,m=!0}catch(T){Qe()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery store "${e.id}"] Failed to persist migrated state:`,T)}S&&d(`[bQuery store "${e.id}"] Failed to persist migrated version:`)&&(f=!1)}else c=!1}return sc(h,y)}catch{return h}}});return c&&s?d():f&&m&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after store creation:`)&&(f=!1),u.$subscribe(h=>{if(s)try{s.setItem(n,o.serialize(h)),f&&d(`[bQuery store "${e.id}"] Failed to persist migrated version after a successful state write:`)&&(f=!1)}catch{}}),u},ac=(e,t,r,n={})=>{const s=n.equals??(n.deep?Ce:Object.is);let o=t(e.$state);return n.immediate&&r(o,void 0),e.$subscribe(i=>{const a=t(i);if(!s(a,o)){const l=o;o=a,r(a,l)}})},os=500,is=class{constructor(e){this.cache=new Map,this.maxSize=e}get(e){const t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const r=this.cache.keys().next().value;r!==void 0&&this.cache.delete(r)}this.cache.set(e,t)}clear(){this.cache.clear()}get size(){return this.cache.size}},as=new is(os),ls=new is(os),lc=e=>new Proxy(e,{get(t,r){if(typeof r!="string")return Reflect.get(t,r);const n=t[r];return fe(n)||qe(n)?n.value:n},has(t,r){return typeof r!="string"?Reflect.has(t,r):r in t}}),H=(e,t)=>{try{const r=lc(t);let n=as.get(e);return n||(n=new Function("$ctx",`with($ctx) { return (${e}); }`),as.set(e,n)),n(r)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},bt=(e,t)=>{try{let r=ls.get(e);return r||(r=new Function("$ctx",`with($ctx) { return (${e}); }`),ls.set(e,r)),r(t)}catch(r){console.error(`bQuery view: Error evaluating "${e}"`,r);return}},Kt=e=>{const t={},r=e.trim().replace(/^\{|\}$/g,"").trim();if(!r)return t;const n=[];let s="",o=0,i=null;for(let a=0;a<r.length;a++){const l=r[a];if(l==='"'||l==="'"||l==="`"){let c=0,f=a-1;for(;f>=0&&r[f]==="\\";)c++,f--;c%2===0&&(i===null?i=l:i===l&&(i=null)),s+=l;continue}if(i!==null){s+=l;continue}l==="("||l==="["||l==="{"?(o++,s+=l):l===")"||l==="]"||l==="}"?(o--,s+=l):l===","&&o===0?(n.push(s.trim()),s=""):s+=l}s.trim()&&n.push(s.trim());for(const a of n){let l=-1,c=0,f=null;for(let m=0;m<a.length;m++){const d=a[m];if(d==='"'||d==="'"||d==="`"){let p=0,u=m-1;for(;u>=0&&a[u]==="\\";)p++,u--;p%2===0&&(f===null?f=d:f===d&&(f=null));continue}if(f===null){if(d==="("||d==="["||d==="{")c++;else if(d===")"||d==="]"||d==="}")c--;else if(d===":"&&c===0){l=m;break}}}if(l>-1){const m=a.slice(0,l).trim().replace(/^['"]|['"]$/g,"");if(x(m))continue;t[m]=a.slice(l+1).trim()}}return t},cc=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),uc=e=>{const t=e.trim(),r=t.toLowerCase();return r.startsWith("aria-")?r:`aria-${cc(/^aria[A-Z]/.test(t)?t.slice(4):t).replace(/^-/,"")}`},fc=e=>e==null||e==="",dc=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set,a=Object.create(null);if(t.trimStart().startsWith("{")){const l=Kt(t);for(const[c,f]of Object.entries(l))a[c]=H(f,r)}else{const l=H(t,r);if(l&&typeof l=="object"&&!Array.isArray(l))for(const[c,f]of Object.entries(l))x(c)||(a[c]=f)}for(const[l,c]of Object.entries(a)){const f=uc(l);if(fc(c)){e.removeAttribute(f);continue}e.setAttribute(f,c===!0?"true":String(c)),i.add(f)}for(const l of s)i.has(l)||e.removeAttribute(l);s=i});n.push(o)},hc=e=>(t,r,n,s)=>{const o=j(()=>{const i=H(r,n);i==null||i===!1?t.removeAttribute(e):i===!0?t.setAttribute(e,""):t.setAttribute(e,String(i))});s.push(o)},mc=(e,t,r,n)=>{let s=new Set;const o=j(()=>{const i=new Set;if(t.trimStart().startsWith("{")){const a=Kt(t);for(const[l,c]of Object.entries(a)){const f=H(c,r);e.classList.toggle(l,!!f),i.add(l)}}else if(/^\s*\[/.test(t)){const a=H(t,r);if(Array.isArray(a))for(const l of a)l&&(e.classList.add(l),i.add(l))}else{const a=H(t,r);typeof a=="string"?a.split(/\s+/).forEach(l=>{l&&(e.classList.add(l),i.add(l))}):Array.isArray(a)&&a.forEach(l=>{l&&(e.classList.add(l),i.add(l))})}for(const a of s)i.has(a)||e.classList.remove(a);s=i});n.push(o)},pc=e=>{if(fe(e)||qe(e))return String(e.value??"");if(e&&typeof e=="object"&&"error"in e){const t=e.error;return fe(t)||qe(t)?String(t.value??""):String(t??"")}return String(e??"")},vc=(e,t,r,n)=>{const s=e,o=!s.hasAttribute("aria-hidden");s.hasAttribute("role")||s.setAttribute("role","alert"),s.hasAttribute("aria-live")||s.setAttribute("aria-live","assertive");const i=j(()=>{const a=pc(H(t,r)).trim(),l=a.length>0;s.textContent=a,s.hidden=!l,o&&(l?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden","true"))});n.push(i)},yc=(e,t,r,n,s,o)=>{if(!r)return t;const i={...o,[n]:e};return s&&(i[s]=t),H(r,i)},gc=e=>{const{prefix:t,processElement:r,processChildren:n}=e;return(s,o,i,a)=>{const l=s.parentNode;if(!l)return;const c=o.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);if(!c){console.error(`bQuery view: Invalid bq-for expression "${o}"`);return}const[,f,m,d]=c,p=s.getAttribute(":key")||s.getAttribute(`${t}-key`),u=s.cloneNode(!0);u.removeAttribute(`${t}-for`),u.removeAttribute(":key"),u.removeAttribute(`${t}-key`);const h=document.createComment(`bq-for: ${o}`);l.replaceChild(h,s);let v=new Map,b=[];const y=(A,S,T)=>{const P=u.cloneNode(!0),R=[],O=$(A),C=m?$(S):null,L={...i,[f]:O};return m&&C&&(L[m]=C),r(P,L,t,R),n(P,L,t,R),{key:T,element:P,cleanups:R,item:A,index:S,itemSignal:O,indexSignal:C}},w=A=>{for(const S of A.cleanups)S();A.element.remove()},E=(A,S,T)=>{Object.is(A.item,S)||(A.item=S,A.itemSignal.value=S),A.index!==T&&(A.index=T,A.indexSignal&&(A.indexSignal.value=T))},k=j(()=>{const A=H(d,i);if(!Array.isArray(A)){for(const L of v.values())w(L);v.clear(),b=[];return}const S=[],T=new Map,P=new Set;A.forEach((L,M)=>{let _=yc(L,M,p,f,m,i);P.has(_)&&(console.warn(`bq-for: Duplicate key "${String(_)}" detected at index ${M}. Falling back to index-based key for this item. Ensure :key expressions produce unique values for each item.`),_={__bqDuplicateKey:_,__bqIndex:M}),P.add(_),S.push(_),T.set(_,{item:L,index:M})});const R=[];for(const L of b)T.has(L)||R.push(L);for(const L of R){const M=v.get(L);M&&(w(M),v.delete(L))}const O=new Map;let C=h;for(let L=0;L<S.length;L++){const M=S[L],{item:_,index:U}=T.get(M);let q=v.get(M);q?(E(q,_,U),O.set(M,q),C.nextSibling!==q.element&&C.after(q.element),C=q.element):(q=y(_,U,M),O.set(M,q),C.after(q.element),C=q.element)}v=O,b=S});a.push(()=>{k();for(const A of v.values())for(const S of A.cleanups)S();v.clear()})}},bc=e=>(t,r,n,s)=>{const o=j(()=>{const i=H(r,n),a=String(i??"");t.innerHTML=e?X(a):a});s.push(o)},wc=(e,t,r,n)=>{const s=document.createComment(`bq-if: ${t}`);let o=!0;const i=j(()=>{const a=H(t,r);a&&!o?(s.replaceWith(e),o=!0):!a&&o&&(e.replaceWith(s),o=!1)});n.push(i)},Ec=(e,t,r,n)=>{const s=e,o=bt(t,r);if(!fe(o)){console.warn(`bQuery view: bq-model requires a signal, got "${t}"`);return}const i=o,a=s.type==="checkbox",l=s.type==="radio",c=()=>{a?s.checked=!!i.value:l?s.checked=i.value===s.value:s.value=String(i.value??"")},f=j(()=>{c()});n.push(f);const m=s.tagName==="SELECT"?"change":"input",d=()=>{a?i.value=s.checked:l?s.checked&&(i.value=s.value):i.value=s.value};s.addEventListener(m,d),n.push(()=>s.removeEventListener(m,d))},Sc=e=>(t,r,n,s)=>{const o=i=>{const a={...n,$event:i,$el:t};if(!r.includes("(")){const l=bt(r,a);if(typeof l=="function"){l(i);return}return}bt(r,a)};t.addEventListener(e,o),s.push(()=>t.removeEventListener(e,o))};function Ac(e){const t=Object.getOwnPropertyDescriptor(e,"value");return t?"value"in t?t.writable===!0:typeof t.set=="function":!1}var kc=(e,t,r,n)=>{const s=bt(t,r);fe(s)?(s.value=e,n.push(()=>{s.value=null})):typeof s=="object"&&s!==null&&Ac(s)&&(s.value=e,n.push(()=>{s.value=null}))},Tc=(e,t,r,n)=>{const s=e;let o=s.style.display;if(!o||o==="none"){const a=s.ownerDocument.defaultView?.getComputedStyle(s).display??"";o=a!=="none"?a:""}const i=j(()=>{const a=H(t,r);s.style.display=a?o:"none"});n.push(i)},Cc=(e,t,r,n)=>{const s=e;let o=new Set;const i=j(()=>{const a=new Set;if(t.trimStart().startsWith("{")){const l=Kt(t);for(const[c,f]of Object.entries(l)){const m=H(f,r),d=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(d,String(m??"")),a.add(d)}}else{const l=H(t,r);if(l&&typeof l=="object")for(const[c,f]of Object.entries(l)){const m=c.replace(/([A-Z])/g,"-$1").toLowerCase();s.style.setProperty(m,String(f??"")),a.add(m)}}for(const l of o)a.has(l)||s.style.removeProperty(l);o=a});n.push(i)},Rc=(e,t,r,n)=>{const s=j(()=>{const o=H(t,r);e.textContent=String(o??"")});n.push(s)},Yt=null,Oc=e=>{Yt=e},Lc=e=>Yt?Yt(e):void 0,wt=(e,t,r,n,s)=>{const o=Array.from(e.attributes);for(const i of o){const{name:a,value:l}=i;if(!a.startsWith(`${r}-`))continue;const c=a.slice(r.length+1);if(c==="for"){s.for(e,l,t,n);return}if(c==="text")s.text(e,l,t,n);else if(c==="error")s.error(e,l,t,n);else if(c==="aria")s.aria(e,l,t,n);else if(c==="html")s.html(e,l,t,n);else if(c==="if")s.if(e,l,t,n);else if(c==="show")s.show(e,l,t,n);else if(c==="class")s.class(e,l,t,n);else if(c==="style")s.style(e,l,t,n);else if(c==="model")s.model(e,l,t,n);else if(c==="ref")s.ref(e,l,t,n);else if(c.startsWith("bind:")){const f=c.slice(5);s.bind(f)(e,l,t,n)}else if(c.startsWith("on:")){const f=c.slice(3);s.on(f)(e,l,t,n)}else{const f=Lc(c);f?f(e,l,t,n):qt()&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery][view] Unknown directive "${a}" (parsed as "${c}") on <${e.tagName.toLowerCase()}>. This may be a typo or a missing custom directive registration.`)}}},Gt=(e,t,r,n,s)=>{const o=Array.from(e.children);for(const i of o)i.hasAttribute(`${r}-for`)?wt(i,t,r,n,s):(wt(i,t,r,n,s),Gt(i,t,r,n,s))},Jt=(e,t,r={})=>{const{prefix:n="bq",sanitize:s=!0}=r,o=typeof e=="string"?document.querySelector(e):e;if(!o)throw new Error(`bQuery view: Element "${e}" not found.`);if(o.hasAttribute(`${n}-for`))throw new Error(`bQuery view: Cannot mount on element with ${n}-for directive. Wrap the ${n}-for element in a container instead.`);const i=[],a={text:Rc,error:vc,aria:dc,html:bc(s),if:wc,show:Tc,class:mc,style:Cc,model:Ec,ref:kc,for:gc({prefix:n,processElement:(c,f,m,d)=>wt(c,f,m,d,a),processChildren:(c,f,m,d)=>Gt(c,f,m,d,a)}),bind:hc,on:Sc};return((c,f,m)=>{const d=c.hasAttribute(`${n}-for`);wt(c,f,n,m,a),d||Gt(c,f,n,m,a)})(o,t,i),{el:o,context:t,update:c=>{Object.assign(t,c)},destroy:()=>{for(const c of i)c();i.length=0}}},$c=(e,t={})=>r=>{const n=document.createElement("div");n.innerHTML=e.trim();const s=n.firstElementChild;if(!s)throw new Error("bQuery view: Template must contain a single root element.");if(n.childElementCount>1)throw new Error(`bQuery view: Template must contain exactly one root element, found ${n.childElementCount}.`);const{prefix:o="bq"}=t;if(s.hasAttribute(`${o}-for`)||s.hasAttribute(`${o}-if`)){const i=s.hasAttribute(`${o}-for`)?"for":"if";throw new Error(`bQuery view: Template root element cannot have ${o}-${i} directive. Wrap the ${o}-${i} element in a container instead.`)}return Jt(s,r,t)},Pc=e=>e===!0||e===void 0,Mc=async(e,t)=>{const r=e(t),n=Le(r)?await r:r;return Pc(n)?void 0:n},Nc=e=>{const t=e.initialValue,r=$(t),n=$(""),s=$(!1),o=D(()=>!Object.is(r.value,t));return{value:r,error:n,isDirty:o,isTouched:s,isPristine:D(()=>!o.value),touch:()=>{s.value=!0},reset:()=>{r.value=t,n.value="",s.value=!1}}},cs=async(e,t)=>{if(!t||t.length===0)return e.error.value="","";for(const r of t){const n=await Mc(r,e.value.value);if(n)return e.error.value=n,n}return e.error.value="",""},Dc=e=>{const t=Object.entries(e.fields),r={},n={};for(const[u,h]of t){const v=Nc(h);r[u]=v,n[u]=v.error}const s=$(!1),o=D(()=>{for(const u of Object.keys(r))if(r[u].error.value!=="")return!1;return!0}),i=D(()=>{for(const u of Object.keys(r))if(r[u].isDirty.value)return!0;return!1}),a=async u=>{const h=r[u],v=e.fields[u];!h||!v||await cs(h,v.validators)},l=async()=>{let u=!1;for(const[h,v]of t){const b=r[h];await cs(b,v.validators)&&(u=!0)}if(e.crossValidators&&e.crossValidators.length>0){const h=m();for(const v of e.crossValidators){const b=await v(h);if(b){for(const[y,w]of Object.entries(b))if(w){const E=r[y];E&&(E.error.value===""&&(E.error.value=w),u=!0)}}}}return!u},c=async()=>{if(!s.value){s.value=!0;try{if(!await l())return;e.onSubmit&&await e.onSubmit(m())}finally{s.value=!1}}},f=()=>{for(const u of Object.keys(r))r[u].reset()},m=()=>{const u={};for(const h of Object.keys(r))u[h]=r[h].value.value;return u};return{fields:r,errors:n,isValid:o,isDirty:i,isSubmitting:s,handleSubmit:c,validateField:a,validate:l,reset:f,getValues:m,setValues:u=>{for(const[h,v]of Object.entries(u)){if(x(h)||!Object.prototype.hasOwnProperty.call(r,h))continue;const b=r[h];b&&(b.value.value=v)}},setErrors:u=>{for(const[h,v]of Object.entries(u)){if(x(h)||!Object.prototype.hasOwnProperty.call(r,h))continue;const b=r[h];b&&(b.error.value=v??"")}}}},Ic=e=>e===!0||e===void 0,_c=async(e,t)=>{const r=e(t),n=Le(r)?await r:r;return Ic(n)?void 0:n},qc=(e,t={})=>{let r;zc(e)?r=e:r=$(jr(e)||xc(e)?e.peek():e);const n=r.peek(),s=$(t.initialError??""),o=$(!1),i=$(!1),a=D(()=>!Object.is(r.value,n)),l=D(()=>!a.value),c=D(()=>s.value===""),f=t.validateOn??"manual",m=Math.max(0,t.debounceMs??0);let d=0,p=!1,u=!1,h=!1,v;const b=A=>{console.error("bQuery forms: Error in scheduled field validation",A)},y=async()=>{const A=++d,S=t.validators;if(!S||S.length===0)return s.value="",i.value=!1,!0;i.value=!0;try{const T=r.peek();for(const P of S){const R=await _c(P,T);if(A!==d)return s.peek()==="";if(R)return s.value=R,!1}return A===d&&(s.value=""),!0}finally{A===d&&(i.value=!1)}},w=Tt(()=>{y().catch(b)},m),E=()=>{if(!h){if(m>0){w();return}y().catch(b)}};return(f==="change"||f==="both")&&(v=j(()=>{if(r.value,!p){p=!0;return}if(u){u=!1;return}E()})),{value:r,error:s,isDirty:a,isTouched:o,isPristine:l,isValid:c,isValidating:i,touch:()=>{o.value=!0,(f==="blur"||f==="both")&&E()},reset:()=>{d+=1,w.cancel(),Object.is(r.peek(),n)||(u=!0),r.value=n,s.value=t.initialError??"",o.value=!1,i.value=!1},validate:async()=>(w.cancel(),y()),destroy:()=>{h||(h=!0,d+=1,w.cancel(),v?.(),v=void 0,a.dispose(),l.dispose(),c.dispose(),i.value=!1)}}},zc=e=>e instanceof _e,xc=e=>e instanceof Ie,jc=(e="This field is required")=>t=>t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0?e:!0,Fc=(e,t)=>{const r=t??`Must be at least ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length>=e?!0:r},Uc=(e,t)=>{const r=t??`Must be at most ${e} characters`;return n=>(typeof n=="string"?n:String(n??"")).length<=e?!0:r},Bc=(e,t="Invalid format")=>{const r=e.global||e.sticky?new RegExp(e.source,e.flags.replace(/[gy]/g,"")):e;return n=>{const s=typeof n=="string"?n:String(n??"");return r.lastIndex=0,r.test(s)?!0:t}},Wc=(e="Invalid email address")=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r=>{const n=typeof r=="string"?r:String(r??"");return n===""||t.test(n)?!0:e}},Hc=(e="Invalid URL")=>t=>{const r=typeof t=="string"?t:String(t??"");if(r==="")return!0;try{return new URL(r),!0}catch{return e}},Qc=(e,t)=>{const r=t??`Must be at least ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))>=e?!0:r},Vc=(e,t)=>{const r=t??`Must be at most ${e}`;return n=>n==null||typeof n=="string"&&n.trim()===""||(typeof n=="number"?n:Number(n))<=e?!0:r},Kc=(e,t)=>r=>e(r)?!0:t,Yc=(e,t)=>async r=>await e(r)?!0:t,Gc=(e,t="Fields do not match")=>r=>Object.is(r,e.value)?!0:t,us=(e,t,r)=>{const{locale:n,...s}=r??{};try{return new Intl.NumberFormat(t,s).format(e)}catch{return String(e)}},fs=(e,t,r)=>{const{locale:n,...s}=r??{},o=typeof e=="number"?new Date(e):e;try{return new Intl.DateTimeFormat(t,s).format(o)}catch{return o.toLocaleString()}},ds=(e,t)=>{const r=t.split(".");let n=e;for(const s of r){if(typeof n=="string"||n[s]===void 0)return;n=n[s]}return typeof n=="string"?n:void 0},Jc=(e,t)=>e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r),Xc=(e,t)=>{if(!e.includes("|")||!("count"in t))return e;const r=Number(t.count),n=e.split("|").map(s=>s.trim());return n.length===3?r===0?n[0]:r===1?n[1]:n[2]:n.length===2?r===1?n[0]:n[1]:r===0&&n.length>0?n[0]:r===1&&n.length>1?n[1]:n[n.length-1]},hs=(e,t,r,n)=>{let s;return e&&(s=ds(e,t)),s===void 0&&n&&(s=ds(n,t)),s===void 0?t:Jc(Xc(s,r),r)},ms=(e,t)=>{const r=ge(e,t),n=s=>{if(Array.isArray(s))return s.map(i=>n(i));if(!ye(s))return s;const o=Object.create(null);for(const[i,a]of Object.entries(s))x(i)||(o[i]=n(a));return o};return n(r)},Zc=e=>{const{locale:t,messages:r,fallbackLocale:n}=e,s=y=>ms(Object.create(null),y),o=Object.create(null);for(const[y,w]of Object.entries(r))x(y)||(o[y]=s(w));const i=$(t),a=new Map,l=new Set(Object.keys(o));return{$locale:i,t:(y,w={})=>{const E=o[i.value];return hs(E,y,w,n?o[n]:void 0)},tc:(y,w={})=>D(()=>{const E=o[i.value];return hs(E,y,w,n?o[n]:void 0)}),loadLocale:(y,w)=>{x(y)||a.set(y,w)},ensureLocale:async y=>{if(x(y)||l.has(y))return;const w=a.get(y);if(!w)throw new Error(`bQuery i18n: No messages or loader registered for locale "${y}".`);const E=await w();o[y]=s(E.default??E),l.add(y)},n:(y,w)=>us(y,w?.locale??i.value,w),d:(y,w)=>fs(y,w?.locale??i.value,w),getMessages:y=>{if(!x(y))return o[y]},mergeMessages:(y,w)=>{x(y)||(o[y]||(o[y]=Object.create(null),l.add(y)),o[y]=ms(o[y],s(w)))},availableLocales:()=>{const y=new Set([...l,...a.keys()]);return Array.from(y).sort()}}},Et=new Map,Ve=new Map,eu=50,tu=e=>{const t=Et.get(e);if(t&&t.isConnected)return t;const r=document.createElement("div");return r.setAttribute("aria-live",e),r.setAttribute("aria-atomic","true"),r.setAttribute("role",e==="assertive"?"alert":"status"),Object.assign(r.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),document.body.appendChild(r),Et.set(e,r),r},ru=(e,t="polite")=>{if(!e||typeof document>"u"||!document.body)return;const r=tu(t),n=Ve.get(t);n!==void 0&&clearTimeout(n),r.textContent="";const s=setTimeout(()=>{Ve.delete(t),r.isConnected&&(r.textContent=e)},eu);Ve.set(t,s)},nu=()=>{for(const e of Ve.values())clearTimeout(e);Ve.clear();for(const[,e]of Et)e.remove();Et.clear()},Y=(e,t,r,n)=>({severity:e,message:t,element:r,rule:n}),su=e=>{const t=[],r=e.querySelectorAll("img");for(const n of r)n.hasAttribute("alt")?n.getAttribute("alt")===""&&!n.hasAttribute("role")&&t.push(Y("info",'Image has empty alt text. Consider adding role="presentation" if decorative.',n,"img-decorative")):t.push(Y("error",'Image is missing an alt attribute. Add alt="" for decorative images or a descriptive alt text.',n,"img-alt"));return t},ou=e=>{const t=[],r=e.querySelectorAll("input, select, textarea");for(const n of r){const s=n.getAttribute("type");if(s==="hidden"||s==="submit"||s==="button"||s==="reset")continue;const o=n.getAttribute("id"),i=o?!!e.querySelector(`label[for="${o}"]`):!1,a=n.hasAttribute("aria-label")||n.hasAttribute("aria-labelledby"),l=n.hasAttribute("title"),c=n.closest("label")!==null;!i&&!a&&!l&&!c&&t.push(Y("error",'Form input is missing a label. Add a <label for="id">, aria-label, or aria-labelledby attribute.',n,"input-label"))}return t},iu=e=>{const t=[],r=e.querySelectorAll("button");for(const s of r){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title");!o&&!i&&!a&&t.push(Y("error","Button has no accessible name. Add text content, aria-label, or title.",s,"button-name"))}const n=e.querySelectorAll("a[href]");for(const s of n){const o=(s.textContent??"").trim().length>0,i=s.hasAttribute("aria-label")||s.hasAttribute("aria-labelledby"),a=s.hasAttribute("title"),l=s.querySelector("img[alt]")!==null;!o&&!i&&!a&&!l&&t.push(Y("error","Link has no accessible name. Add text content, aria-label, or title.",s,"link-name"))}return t},au=e=>{const t=[],r=e.querySelectorAll("h1, h2, h3, h4, h5, h6");let n=0;for(const s of r){const o=parseInt(s.tagName.charAt(1),10);n>0&&o>n+1&&t.push(Y("warning",`Heading level skipped: <${s.tagName.toLowerCase()}> follows <h${n}>. Don't skip heading levels.`,s,"heading-order")),(s.textContent??"").trim().length===0&&t.push(Y("warning","Heading element is empty.",s,"heading-empty")),n=o}return t},lu=e=>{const t=[],r=e.querySelectorAll("[aria-labelledby]");for(const s of r){const o=(s.getAttribute("aria-labelledby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(Y("error",`aria-labelledby references "${i}" which does not exist in the document.`,s,"aria-labelledby-ref"))}const n=e.querySelectorAll("[aria-describedby]");for(const s of n){const o=(s.getAttribute("aria-describedby")??"").split(/\s+/);for(const i of o)i&&!document.getElementById(i)&&t.push(Y("error",`aria-describedby references "${i}" which does not exist in the document.`,s,"aria-describedby-ref"))}return t},cu=e=>{const t=[];return(e===document.body||e===document.documentElement)&&(e.querySelector("main")||e.querySelector('[role="main"]')||t.push(Y("warning",'Page is missing a <main> landmark. Add <main> or role="main" to the primary content area.',e,"landmark-main"))),t},uu=e=>{if(typeof document>"u"||!document.body)return{findings:[],errors:0,warnings:0,passed:!0};const t=e??document.body,r=[...su(t),...ou(t),...iu(t),...au(t),...lu(t),...cu(t)],n=r.filter(s=>s.severity==="error").length;return{findings:r,errors:n,warnings:r.filter(s=>s.severity==="warning").length,passed:n===0}},ps=(e,t)=>{if(typeof e.addEventListener=="function")return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)};const r=e;if(typeof r.addListener=="function")return r.addListener(t),()=>{r.removeListener?.(t)}},vs=(e,t)=>{let r=t;const n=e;return Object.defineProperty(n,"destroy",{configurable:!0,enumerable:!1,value:()=>{const s=r;r=()=>{},s()}}),n},fu=()=>{const e=$("light");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function")try{const r=window.matchMedia("(prefers-color-scheme: dark)");e.value=r.matches?"dark":"light";const s=ps(r,o=>{e.value=o.matches?"dark":"light"});s&&(t=()=>{s(),e.dispose()})}catch{}return vs(I(e),t)},du=()=>{const e=$("no-preference");let t=()=>{e.dispose()};if(typeof window<"u"&&typeof window.matchMedia=="function"){let r,n,s;const o=()=>{!r||!n||!s||(r.matches?e.value="more":n.matches?e.value="less":s.matches?e.value="custom":e.value="no-preference")};try{r=window.matchMedia("(prefers-contrast: more)"),n=window.matchMedia("(prefers-contrast: less)"),s=window.matchMedia("(prefers-contrast: custom)"),o();const i=[r,n,s].map(a=>ps(a,()=>{o()})).filter(a=>a!==void 0);i.length>0&&(t=()=>{for(const a of i)a();e.dispose()})}catch{}}return vs(I(e),t)},hu=(e,t,r={})=>{const{wrap:n=!0,orientation:s="vertical",onActivate:o}=r;let i=0;const a=new Map,l=()=>Array.from(e.querySelectorAll(t)),c=u=>{for(const h of u)a.has(h)||a.set(h,h.getAttribute("tabindex"))},f=u=>{const h=l();if(h.length===0)return;c(h);const v=Math.max(0,Math.min(u,h.length-1));for(let b=0;b<h.length;b++)h[b].setAttribute("tabindex",b===v?"0":"-1");i=v,h[v].focus(),o?.(h[v],v)},m=u=>{if(u==="Home"||u==="End")return!0;switch(s){case"horizontal":return u==="ArrowLeft"||u==="ArrowRight";case"vertical":return u==="ArrowUp"||u==="ArrowDown";case"both":return u==="ArrowLeft"||u==="ArrowRight"||u==="ArrowUp"||u==="ArrowDown";default:return!1}},d=u=>{if(!m(u.key))return;const h=l();if(h.length===0)return;u.preventDefault();let v=i;switch(u.key){case"ArrowDown":case"ArrowRight":v=i+1,v>=h.length&&(v=n?0:h.length-1);break;case"ArrowUp":case"ArrowLeft":v=i-1,v<0&&(v=n?h.length-1:0);break;case"Home":v=0;break;case"End":v=h.length-1;break}f(v)},p=l();c(p);for(let u=0;u<p.length;u++)p[u].setAttribute("tabindex",u===0?"0":"-1");return e.addEventListener("keydown",d),{destroy:()=>{e.removeEventListener("keydown",d);for(const[u,h]of a)h===null?u.removeAttribute("tabindex"):u.setAttribute("tabindex",h);a.clear()},focusItem:u=>{f(u)},activeIndex:()=>i}},Xt=`
|
|
176
260
|
position: absolute;
|
|
177
261
|
top: -9999px;
|
|
178
262
|
left: -9999px;
|
|
@@ -185,9 +269,9 @@ See: https://bquery.dev/guide/store#deep-reactivity`)}for(const[S,C]of Object.en
|
|
|
185
269
|
border-radius: 0 0 4px 0;
|
|
186
270
|
outline: 2px solid #4A90D9;
|
|
187
271
|
outline-offset: 2px;
|
|
188
|
-
`,
|
|
272
|
+
`,mu=`
|
|
189
273
|
top: 0;
|
|
190
274
|
left: 0;
|
|
191
|
-
`,Mn=0,Ae=new Map,lc=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,cc=()=>({destroy:()=>{},element:null}),uc=(e,t={})=>{if(!lc())return cc();const{text:r="Skip to main content",className:n="bq-skip-link"}=t;let s,o;const i=m=>{try{return document.querySelector(m)}catch{return null}},a=()=>{if(!s)return;const m=Ae.get(s),g=(m?.count??0)-1;g<=0?(Ae.delete(s),m?.target.isConnected&&m.target.id===s&&m.target.removeAttribute("id")):Ae.set(s,{count:g,target:m.target}),s=void 0},l=()=>{if(!o)return;const{target:m,hadTabIndex:g,previousTabIndex:b}=o;m.isConnected&&(g?m.setAttribute("tabindex",b??""):m.removeAttribute("tabindex")),o=void 0},c=m=>{if(o?.target!==m){if(l(),m.hasAttribute("tabindex")){o={target:m,hadTabIndex:!0,previousTabIndex:m.getAttribute("tabindex")};return}m.tabIndex===-1&&(o={target:m,hadTabIndex:!1,previousTabIndex:null},m.setAttribute("tabindex","-1"))}},u=(m,g)=>{if(s===g)return;a();const b=Ae.get(g);Ae.set(g,{count:(b?.count??0)+1,target:m}),s=g},h=()=>{if(e.startsWith("#")){const g=e.slice(1),b=g?document.getElementById(g):null;return b||i(e)}const m=document.getElementById(e);return m||i(e)},d=m=>{if(m.id)return Ae.get(m.id)?.target===m&&u(m,m.id),m.id;let g;do Mn+=1,g=`bq-skip-target-${Mn}`;while(document.getElementById(g)!==null);return m.id=g,u(m,g),g},p=document.createElement("a"),f=h();return p.href=e.startsWith("#")?e:f?`#${d(f)}`:`#${e}`,p.textContent=r,p.className=n,p.setAttribute("style",_t),p.addEventListener("focus",()=>{p.setAttribute("style",_t+ac)}),p.addEventListener("blur",()=>{p.setAttribute("style",_t)}),p.addEventListener("click",m=>{m.preventDefault();const g=h();g&&(p.href=`#${d(g)}`,c(g),g.focus())}),document.body.firstChild?document.body.insertBefore(p,document.body.firstChild):document.body.appendChild(p),{destroy:()=>{l(),a(),p.remove()},element:p}},fc=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"details > summary","audio[controls]","video[controls]"].join(", "),qt=e=>Array.from(e.querySelectorAll(fc)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),Dn=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,dc=(e,t={})=>{const{escapeDeactivates:r=!0,onEscape:n,initialFocus:s,returnFocus:o}=t;if(typeof document>"u"||typeof document.addEventListener!="function"||typeof document.removeEventListener!="function"){let h=!1;return{get active(){return h},release:()=>{h=!1}}}const i=document.activeElement;let a=!0;const l=h=>{if(!a)return;if(h.key==="Escape"&&r){h.preventDefault(),u.release(),n?.();return}if(h.key!=="Tab")return;const d=qt(e);if(d.length===0){h.preventDefault();return}const p=d[0],f=d[d.length-1];h.shiftKey?(document.activeElement===p||!e.contains(document.activeElement))&&(h.preventDefault(),f.focus()):(document.activeElement===f||!e.contains(document.activeElement))&&(h.preventDefault(),p.focus())};document.addEventListener("keydown",l,!0);const c=Dn(s,e);if(c)c.focus();else{const h=qt(e);h.length>0&&h[0].focus()}const u={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",l,!0);const h=Dn(o,document.body);h?h.focus():i&&i.focus&&i.focus()}};return u},hc=e=>{e.release()},Be=new Map,Nn=()=>{const e=Array.from(Be.values());return e[e.length-1]},mc=(e,t)=>{if(typeof t=="object")return t;let r=null;if(t==="parent"?r=e.parentElement:r=document.querySelector(t),!r)return null;const n=r.getBoundingClientRect(),s=e.getBoundingClientRect(),o=parseFloat(e.style.left||"0"),i=parseFloat(e.style.top||"0"),a=Number.isNaN(o)?0:o,l=Number.isNaN(i)?0:i;return{left:n.left-s.left+a,top:n.top-s.top+l,right:n.right-s.right+a+(n.width-s.width),bottom:n.bottom-s.bottom+l+(n.height-s.height)}},pc=(e,t)=>t?{x:Math.max(t.left,Math.min(t.right,e.x)),y:Math.max(t.top,Math.min(t.bottom,e.y))}:e,vc=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:o=!1,ghostClass:i="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:c,onDragEnd:u}=t;let h=!t.disabled,d=!1,p={x:0,y:0},f={x:0,y:0},m={x:0,y:0},g=null,b=null;const v=e.style.touchAction,w=e.style.userSelect,E=O=>({element:e,position:{...f},delta:{x:f.x-m.x,y:f.y-m.y},event:O}),T=()=>{const O=e.cloneNode(!0),L=e.getBoundingClientRect();return O.classList.add(i),O.style.position="fixed",O.style.left=`${L.left}px`,O.style.top=`${L.top}px`,O.style.width=`${L.width}px`,O.style.height=`${L.height}px`,O.style.pointerEvents="none",O.style.zIndex="999999",O.style.opacity="0.7",O.style.margin="0",document.body.appendChild(O),O},A=()=>{g&&(g.remove(),g=null),b=null},S=O=>{if(h&&!(s&&!O.target.closest(s))){if(O.preventDefault(),d=!0,p={x:O.clientX,y:O.clientY},m={...f},e.classList.add(a),e.setPointerCapture(O.pointerId),o){const L=e.getBoundingClientRect();b={x:L.left,y:L.top},g=T()}Be.set(e,{element:e,position:f}),l?.(E(O))}},C=O=>{if(!d)return;O.preventDefault(),m={...f};let L=f.x+(O.clientX-p.x),k=f.y+(O.clientY-p.y);p={x:O.clientX,y:O.clientY},r==="x"&&(k=f.y),r==="y"&&(L=f.x);let $={x:L,y:k};if(n){const D=mc(e,n);$=pc($,D)}if(f=$,Be.set(e,{element:e,position:f}),o&&g){const D=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};g.style.left=`${D.x+f.x}px`,g.style.top=`${D.y+f.y}px`}else e.style.transform=`translate(${f.x}px, ${f.y}px)`;c?.(E(O))},R=O=>{if(d){d=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(O.pointerId))&&e.releasePointerCapture(O.pointerId)}catch{}finally{A(),Be.delete(e),u?.(E(O))}}};return e.addEventListener("pointerdown",S),e.addEventListener("pointermove",C),e.addEventListener("pointerup",R),e.addEventListener("pointercancel",R),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",S),e.removeEventListener("pointermove",C),e.removeEventListener("pointerup",R),e.removeEventListener("pointercancel",R),A(),Be.delete(e),e.style.touchAction=v,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},yc={passive:!0},He=new Set,Ue=null,re=null,Pn=()=>Array.from(He),gc=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",bc=e=>{for(const t of Pn())t.handlePointerMove(e)},wc=()=>{re=null;const e=Ue;Ue=null,e&&bc(e)},In=e=>{Ue=e,re===null&&(re=requestAnimationFrame(wc))},_n=e=>{re!==null&&(cancelAnimationFrame(re),re=null,Ue=null);for(const t of Pn())t.handlePointerUp(e)},Ec=e=>{He.size===0&&(document.addEventListener("pointermove",In,yc),document.addEventListener("pointerup",_n)),He.add(e)},Sc=e=>{He.delete(e),He.size===0&&(document.removeEventListener("pointermove",In),document.removeEventListener("pointerup",_n),re!==null&&(cancelAnimationFrame(re),re=null),Ue=null)},qn=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,Ac=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:o,onDragLeave:i,onDrop:a}=t;if(!gc())return{destroy:()=>{}};let l=!1,c=null;const u=(b,v)=>({zone:e,dragged:b,event:v}),h=b=>{const v=e.getBoundingClientRect();return b.clientX>=v.left&&b.clientX<=v.right&&b.clientY>=v.top&&b.clientY<=v.bottom},d=()=>Nn()?.element??c,p=(b,v=c)=>{l&&(l=!1,e.classList.remove(r),v&&i?.(u(v,b)),c=null)},g={handlePointerMove:b=>{const v=Nn()?.element??null,w=h(b);if(!(v!==null&&v!==e&&qn(v,n))||!w){p(b,v??c);return}l?o?.(u(v,b)):(l=!0,c=v,e.classList.add(r),s?.(u(v,b)))},handlePointerUp:b=>{const v=d(),w=h(b),E=v!==null&&v!==e&&qn(v,n);w&&E&&v&&a?.(u(v,b)),l&&(l=!1,e.classList.remove(r)),c=null}};return Ec(g),{destroy:()=>{Sc(g),e.classList.remove(r),c=null}}},xn=(e,t)=>Array.from(e.querySelectorAll(t)),Cc=(e,t,r,n)=>{let s=null;for(let o=0;o<e.length;o++){const i=e[o];if(i===n)continue;const a=i.getBoundingClientRect(),l=t-(r==="y"?a.top+a.height/2:a.left+a.width/2);(s===null||l<0&&l>s.distance||s.distance>=0&&l<0&&Math.abs(l)<Math.abs(s.distance))&&l<0&&(s={element:i,index:o,distance:l})}return s?{element:s.element,index:s.index}:null},kc=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:o="bq-sort-placeholder",sortingClass:i="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:c,onSortEnd:u}=t;let h=!t.disabled,d=!1,p=null,f=null,m=-1,g=0,b=0,v=0,w=0;const E=(R,O,L)=>({container:e,item:R,oldIndex:O,newIndex:L}),T=R=>{if(!h)return;const O=R.target,L=xn(e,r);let k=null;for(const D of L)if(D.contains(O)){k=D;break}if(!k||s&&!O.closest(s))return;R.preventDefault(),d=!0,p=k,m=L.indexOf(k),g=R.clientY,b=R.clientX;const $=k.getBoundingClientRect();v=$.top,w=$.left,f=document.createElement("div"),f.classList.add(o),f.style.width=`${$.width}px`,f.style.height=`${$.height}px`,f.style.boxSizing="border-box",k.classList.add(i),k.style.position="fixed",k.style.width=`${$.width}px`,k.style.height=`${$.height}px`,k.style.left=`${$.left}px`,k.style.top=`${$.top}px`,k.style.zIndex="999999",k.style.pointerEvents="none",k.style.margin="0",k.parentNode?.insertBefore(f,k),e.setPointerCapture(R.pointerId),l?.(E(k,m,m))},A=R=>{if(!d||!p||!f)return;R.preventDefault();const O=R.clientX-b,L=R.clientY-g;n==="y"?p.style.top=`${v+L}px`:p.style.left=`${w+O}px`;const k=Cc(xn(e,r),n==="y"?R.clientY:R.clientX,n,p);k?e.insertBefore(f,k.element):e.appendChild(f);const $=Array.from(e.children).indexOf(f);c?.(E(p,m,$))},S=R=>{if(!d||!p||!f)return;d=!1;const O=p,L=Array.from(e.children).indexOf(f),k=f.getBoundingClientRect(),$=O.getBoundingClientRect();if(a>0){const D=k.left-$.left,I=k.top-$.top;O.style.transition=`transform ${a}ms ease`,O.style.transform=`translate(${D}px, ${I}px)`;let j=!1,_=null;const Q=()=>{j||(j=!0,_!==null&&(window.clearTimeout(_),_=null),C(),u?.(E(O,m,L)))};_=window.setTimeout(()=>{Q()},a+50),O.addEventListener("transitionend",Q,{once:!0})}else C(),u?.(E(O,m,L));e.releasePointerCapture(R.pointerId)},C=()=>{!p||!f||(f.parentNode?.insertBefore(p,f),f.remove(),f=null,p.classList.remove(i),p.style.position="",p.style.width="",p.style.height="",p.style.left="",p.style.top="",p.style.zIndex="",p.style.pointerEvents="",p.style.margin="",p.style.transition="",p.style.transform="",p=null)};return e.addEventListener("pointerdown",T),e.addEventListener("pointermove",A),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",T),e.removeEventListener("pointermove",A),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),e.style.touchAction="",d&&C()},disable:()=>{h=!1},enable:()=>{h=!0},get enabled(){return h}}},Oc=e=>{const t=M(!1);let r;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const o=window.matchMedia(e);t.value=o.matches;const i=a=>{t.value=a.matches};if(typeof o.addEventListener=="function")o.addEventListener("change",i),r=()=>{o.removeEventListener("change",i)};else if(typeof o.addListener=="function"){const a=o;a.addListener(i),r=()=>{a.removeListener(i)}}}catch{}const n=H(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},Tc=e=>{const t={},r=[];for(const o of Object.keys(e)){const i=e[o],a=M(!1);let l;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const h=window.matchMedia(`(min-width: ${i}px)`);a.value=h.matches;const d=p=>{a.value=p.matches};if(typeof h.addEventListener=="function")h.addEventListener("change",d),l=()=>{h.removeEventListener("change",d)};else{const p=h;typeof p.addListener=="function"&&(p.addListener(d),l=()=>{p.removeListener?.(d)})}}catch{}const c=H(a);let u=!1;Object.defineProperty(c,"destroy",{enumerable:!1,configurable:!0,value(){u||(u=!0,l?.(),a.dispose())}}),r.push(c.destroy),t[o]=c}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(o=>{o()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},zn=(e,t)=>t>=e?"portrait":"landscape",Lc=()=>{const e=M({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?zn(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:zn(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},jn=()=>{const e=typeof navigator<"u"&&navigator.onLine!==void 0?navigator.onLine:!0,t=(typeof navigator<"u"?navigator:void 0)?.connection;return{online:e,effectiveType:t?.effectiveType??"unknown",downlink:t?.downlink??0,rtt:t?.rtt??0}},$c=()=>{const e=M(jn());let t;if(typeof window<"u"){const s=()=>{e.value=jn()};window.addEventListener("online",s),window.addEventListener("offline",s);const o=typeof navigator<"u"?navigator:void 0;o?.connection&&typeof o.connection.addEventListener=="function"&&o.connection.addEventListener("change",s),t=()=>{window.removeEventListener("online",s),window.removeEventListener("offline",s),o?.connection&&typeof o.connection.removeEventListener=="function"&&o.connection.removeEventListener("change",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},Rc={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},Mc=()=>{const e=M({...Rc});let t,r=!1;typeof navigator<"u"&&"getBattery"in navigator&&typeof navigator.getBattery=="function"&&navigator.getBattery().then(s=>{if(r)return;const o=()=>{e.value={supported:!0,charging:s.charging,chargingTime:s.chargingTime,dischargingTime:s.dischargingTime,level:s.level}};o(),s.addEventListener("chargingchange",o),s.addEventListener("chargingtimechange",o),s.addEventListener("dischargingtimechange",o),s.addEventListener("levelchange",o),t=()=>{s.removeEventListener("chargingchange",o),s.removeEventListener("chargingtimechange",o),s.removeEventListener("dischargingtimechange",o),s.removeEventListener("levelchange",o)}}).catch(()=>{});const n=H(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},Fn={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},Dc=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,o=M({...Fn});let i;if(typeof navigator<"u"&&"geolocation"in navigator){o.value={...Fn,supported:!0,loading:!0};const c={enableHighAccuracy:t,maximumAge:r,timeout:n===1/0?void 0:n},u=d=>{o.value={supported:!0,loading:!1,latitude:d.coords.latitude,longitude:d.coords.longitude,accuracy:d.coords.accuracy,altitude:d.coords.altitude,altitudeAccuracy:d.coords.altitudeAccuracy,heading:d.coords.heading,speed:d.coords.speed,timestamp:d.timestamp,error:null}},h=d=>{o.value={...o.value,loading:!1,error:d.message}};if(s){const d=navigator.geolocation.watchPosition(u,h,c);i=()=>{navigator.geolocation.clearWatch(d)}}else navigator.geolocation.getCurrentPosition(u,h,c)}const a=H(o);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,i?.(),o.dispose())}}),a},Nc={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},Pc={alpha:null,beta:null,gamma:null,absolute:!1},Ic=()=>{const e=M({...Nc});let t;if(typeof window<"u"){const s=o=>{e.value={acceleration:{x:o.acceleration?.x??null,y:o.acceleration?.y??null,z:o.acceleration?.z??null},accelerationIncludingGravity:{x:o.accelerationIncludingGravity?.x??null,y:o.accelerationIncludingGravity?.y??null,z:o.accelerationIncludingGravity?.z??null},rotationRate:{alpha:o.rotationRate?.alpha??null,beta:o.rotationRate?.beta??null,gamma:o.rotationRate?.gamma??null},interval:o.interval??0}};window.addEventListener("devicemotion",s),t=()=>{window.removeEventListener("devicemotion",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},_c=()=>{const e=M({...Pc});let t;if(typeof window<"u"){const s=o=>{e.value={alpha:o.alpha??null,beta:o.beta??null,gamma:o.gamma??null,absolute:o.absolute??!1}};window.addEventListener("deviceorientation",s),t=()=>{window.removeEventListener("deviceorientation",s)}}const r=H(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Bn="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",qc={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(Bn);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(Bn);return navigator.clipboard.writeText(e)}},xc=(e,t)=>{let r;t==="border-box"?r=e.borderBoxSize:t==="device-pixel-content-box"?r=e.devicePixelContentBoxSize:r=e.contentBoxSize;const n=Array.isArray(r)?r[0]:r;return n&&typeof n.inlineSize=="number"&&typeof n.blockSize=="number"?{width:n.inlineSize,height:n.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}},zc=(e,t)=>{const r=M({isIntersecting:!1,intersectionRatio:0,entry:null});let n,s=!1;if(typeof window<"u"&&typeof IntersectionObserver<"u")try{if(n=new IntersectionObserver(i=>{if(s)return;const a=i[i.length-1];a&&(r.value={isIntersecting:a.isIntersecting,intersectionRatio:a.intersectionRatio,entry:a})},{root:t?.root??null,rootMargin:t?.rootMargin??"0px",threshold:t?.threshold??0}),e){const i=Array.isArray(e)?e:[e];for(const a of i)n.observe(a)}}catch{n&&n.disconnect(),n=void 0}const o=H(r);return Object.defineProperties(o,{observe:{enumerable:!1,configurable:!0,value(i){if(!s)try{n?.observe(i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(i){s||n?.unobserve(i)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),o},jc=(e,t)=>{const r=M({width:0,height:0,entry:null});let n,s=!1;const o=t?.box??"content-box",i=t?.box?{box:t.box}:void 0;if(typeof window<"u"&&typeof ResizeObserver<"u")try{if(n=new ResizeObserver(l=>{if(s)return;const c=l[l.length-1];if(c){const{width:u,height:h}=xc(c,o);r.value={width:u,height:h,entry:c}}}),e){const l=Array.isArray(e)?e:[e];for(const c of l)n.observe(c,i)}}catch{n&&n.disconnect(),n=void 0}const a=H(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(l){s||n?.unobserve(l)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Fc=(e,t)=>{const r=M({mutations:[],count:0});let n,s=!1,o=0;const i={attributes:t?.attributes??!0,childList:t?.childList??!1,characterData:t?.characterData??!1,subtree:t?.subtree??!1,attributeOldValue:t?.attributeOldValue??!1,characterDataOldValue:t?.characterDataOldValue??!1,...t&&t.attributeFilter!==void 0?{attributeFilter:t.attributeFilter}:{}};if(!i.attributes&&!i.childList&&!i.characterData&&(i.attributes=!0),i.attributes||(i.attributeOldValue=!1,delete i.attributeFilter),i.characterData||(i.characterDataOldValue=!1),typeof window<"u"&&typeof MutationObserver<"u")try{n=new MutationObserver(l=>{s||(o+=1,r.value={mutations:l,count:o})}),e&&n.observe(e,i)}catch{n&&n.disconnect(),n=void 0}const a=H(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},takeRecords:{enumerable:!1,configurable:!0,value(){return n?.takeRecords()??[]}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Qe=new Set,ne=new Map,xt=()=>{El(e=>ne.get(e))};xt();var Hn=e=>{ne.clear();for(const[t,r]of e)ne.set(t,r)},Bc=e=>({directive(t,r){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin directive: name must be a non-empty string");if(t.startsWith("bq-")){const n=t.slice(3);throw new Error(`bQuery plugin directive: name "${t}" must be provided without the "bq-" prefix`+(n?` (use "${n}")`:""))}if(typeof r!="function")throw new Error(`bQuery plugin directive: handler for "${t}" must be a function`);if(ne.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);ne.set(t,r)},component(t,r,n){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin component: tagName must be a non-empty string");if(!t.includes("-"))throw new Error(`bQuery plugin component: tagName "${t}" must be a valid custom element name containing a hyphen`);if(typeof r!="function")throw new Error(`bQuery plugin component: constructor for "${t}" must be a function`);if(typeof customElements>"u"){typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery] plugin component "${t}" was not registered because customElements is not available in this environment.`);return}!customElements.get(t)&&!e.some(s=>s.tagName===t)&&e.push({tagName:t,constructor:r,options:n})}}),Hc=(e,t)=>{if(xt(),!e||typeof e!="object")throw new Error("bQuery plugin: use() expects a plugin object with { name, install }");if(typeof e.name!="string"||e.name.length===0)throw new Error('bQuery plugin: plugin must have a non-empty "name" property');if(typeof e.install!="function")throw new Error(`bQuery plugin: plugin "${e.name}" must have an "install" function`);if(Qe.has(e.name))return;const r=[],n=Bc(r),s=new Map(ne);try{e.install(n,t)}catch(o){throw Hn(s),o}try{for(const o of r)customElements.get(o.tagName)||customElements.define(o.tagName,o.constructor,o.options)}catch(o){throw Hn(s),o}Qe.add(e.name)},Uc=e=>Qe.has(e),Qc=()=>[...Qe],Vc=e=>ne.get(e),Wc=()=>[...ne.entries()].map(([e,t])=>({name:e,handler:t})),Kc=()=>{Qe.clear(),ne.clear(),xt()},Ve=!1,zt={},fe=[],ct=new Map,Un=0,Yc=(e,t)=>{Ve=e,zt=t??{},e||(fe.length=0,ct.clear(),Un=0)},Gc=()=>Ve,Jc=(e,t,r)=>{if(Ve){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");ct.set(e,{peek:t,subscriberCount:r})}},Xc=e=>{ct.delete(e)},Zc=()=>`signal_${Un++}`,Qn=()=>{const e=[];for(const[t,r]of ct)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},Vn=()=>{try{return Rt().map(e=>{const t=Ee(e),r={};if(t&&typeof t=="object"&&"$state"in t){const n=t.$state;n&&typeof n=="object"&&Object.assign(r,n)}return{id:e,state:r}})}catch{return[]}},Wn=()=>{if(typeof document>"u")return[];const e=[],t=new Set,r=document.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n].tagName.toLowerCase();if(s.includes("-")&&!t.has(s)&&typeof customElements<"u"&&customElements.get(s)){t.add(s);const o=document.querySelectorAll(s);e.push({tagName:s,instanceCount:o.length})}}return e},eu=(e,t)=>{if(!Ve)return;const r={timestamp:Date.now(),type:e,detail:t};fe.push(r),zt.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},tu=()=>fe,ru=()=>{fe.length=0},nu=()=>({enabled:Ve,options:{...zt},timeline:[...fe]}),su=()=>{const e=Qn();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},ou=()=>{const e=Vn();if(e.length===0){console.log("[bq:devtools] No stores registered.");return}console.table(e.map(t=>({id:t.id,state:JSON.stringify(t.state)})))},iu=()=>{const e=Wn();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},au=e=>{const t=typeof e=="number"&&e>0?fe.slice(-e):fe;if(t.length===0){console.log("[bq:devtools] Timeline is empty.");return}console.table(t.map(r=>({time:new Date(r.timestamp).toISOString(),type:r.type,detail:r.detail})))},Kn=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),lu=(e,t)=>{let r=1,n="",s=t+1;for(;s<e.length;){const o=e[s];if(o==="\\"&&s+1<e.length){n+=o+e[s+1],s+=2;continue}if(o==="(")r++;else if(o===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=o,s++}return null},Yn=new Map,cu=e=>{const t=$t(e),r=Yn.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return Yn.set(t,n),n};function uu(e,t={}){if(!e||!e.includes("-"))throw new Error(`bQuery testing: "${e}" is not a valid custom element tag name (must contain a hyphen)`);const{props:r,slots:n,container:s=document.body}=t,o=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&o.setAttribute(a,String(l));if(n)if(typeof n=="string")o.innerHTML=n;else{const a=[];for(const[l,c]of Object.entries(n))if(l==="default")a.push(c);else{const u=l.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");a.push(`<div slot="${u}">${c}</div>`)}o.innerHTML=a.join("")}return s.appendChild(o),{el:o,unmount:()=>{o.parentNode&&o.parentNode.removeChild(o)}}}function Gn(){Le(()=>{})}function fu(e){const t=M(e);return Object.defineProperty(t,"initialValue",{value:e,writable:!1,enumerable:!0}),t.set=function(r){t.value=r},t.reset=function(){t.value=e},t}function du(e,t){let r=e;t&&r.startsWith(t)&&(r=r.slice(t.length)||"/");let n="";const s=r.indexOf("#");s>=0&&(n=r.slice(s+1),r=r.slice(0,s));const o={},i=r.indexOf("?");if(i>=0){const a=r.slice(i+1);r=r.slice(0,i);for(const l of a.split("&")){const c=l.indexOf("="),u=c>=0?decodeURIComponent(l.slice(0,c)):decodeURIComponent(l),h=c>=0?decodeURIComponent(l.slice(c+1)):"",d=o[u];d!==void 0?Array.isArray(d)?d.push(h):o[u]=[d,h]:o[u]=h}}return{path:r||"/",query:o,hash:n}}function hu(e,t){for(const r of t){const n=mu(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function mu(e,t){if(e==="*")return{};const r=new Map,n=(o,i)=>{const a=o.indexOf("/",i);return a===-1?o.length:a},s=(o,i)=>{const a=`${o}:${i}`;if(r.has(a))return r.get(a)??null;if(o===e.length){const u=i===t.length?{}:null;return r.set(a,u),u}const l=e[o];if(l==="*"){for(let u=t.length;u>=i;u--){const h=s(o+1,u);if(h)return r.set(a,h),h}return r.set(a,null),null}if(l===":"&&Kn(e[o+1])){let u=o+2;for(;u<e.length&&Kn(e[u]);)u++;const h=e.slice(o+1,u);let d=u,p,f=!1;if(e[u]==="("){const g=lu(e,u);g&&(p=g.constraint,d=g.endIndex)}e[d]==="*"&&(f=!0,d++);const m=f||p?t.length:n(t,i);for(let g=m;g>i;g--){const b=t.slice(i,g);if(p&&!cu(p).test(b))continue;const v=s(d,g);if(v){const w={[h]:b,...v};return r.set(a,w),w}}return r.set(a,null),null}if(i>=t.length||l!==t[i])return r.set(a,null),null;const c=s(o+1,i+1);return r.set(a,c),c};return s(0,0)}function pu(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=i=>{const{path:a,query:l,hash:c}=du(i,r),{matched:u,params:h}=hu(a,t);return{path:a,params:h,query:l,matched:u,hash:c}},o=M(s(n));return{push(i){o.value=s(i)},replace(i){o.value=s(i)},get currentRoute(){return o},get routes(){return t},destroy(){o.dispose()}}}function vu(e,t,r={}){if(!e)throw new Error("bQuery testing: fireEvent requires a valid element");if(!t)throw new Error("bQuery testing: fireEvent requires an event name");const{bubbles:n=!0,cancelable:s=!0,composed:o=!0,detail:i}=r;let a;i!==void 0?a=new CustomEvent(t,{bubbles:n,cancelable:s,composed:o,detail:i}):a=new Event(t,{bubbles:n,cancelable:s,composed:o});const l=e.dispatchEvent(a);return Gn(),l}async function yu(e,t={}){if(typeof e!="function")throw new Error("bQuery testing: waitFor requires a predicate function");const{timeout:r=1e3,interval:n=10}=t,s=Date.now();for(;;){try{if(await e())return}catch{}if(Date.now()-s>=r)throw new Error(`bQuery testing: waitFor timed out after ${r}ms — predicate never returned true`);await new Promise(o=>setTimeout(o,n))}}var gu=(e,t,r={})=>{const{hydrate:n=!0,...s}=r;if(!n)throw new Error("bQuery ssr: hydrateMount() requires { hydrate: true } when options are provided.");return It(e,t,s)},ut=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),jt=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},Jn=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),bu=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),Xn=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(x(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const o=n??Rt(),i=Object.create(null);for(const u of o){if(x(u))continue;const h=Ee(u);h&&(i[u]=jt(h.$state))}const a=s(i);if(typeof a!="string")throw new Error("serializeStoreState: custom serialize function must return a string.");if(s!==JSON.stringify){let u;try{u=JSON.parse(a)}catch{throw new Error("serializeStoreState: custom serialize function returned invalid JSON.")}if(!ut(u))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=Jn(a),c=Jn(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${bu(t)}">window[${c}]=${l}<\/script>`}},wu=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(x(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`deserializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);if(typeof window>"u")return{};const r=window[e];if(!r)return{};try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const s=document.getElementById(t);s&&s.remove()}if(!ut(r))return{};for(const s of Object.values(r))if(!ut(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))x(s)||!ut(o)||(n[s]=jt(o));return n},Zn=(e,t)=>{const r=Ee(e);r&&typeof r.$patch=="function"&&r.$patch(jt(t))},Eu=e=>{for(const[t,r]of Object.entries(e))Zn(t,r)},Su=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),es=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Au=e=>es(e).replace(/"/g,"""),Cu=e=>{const t=e.toLowerCase();return t==="href"||t==="src"||t==="xlink:href"||t==="formaction"||t==="action"||t==="poster"||t==="background"||t==="cite"||t==="data"},ku=e=>e.trim().replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Ou=e=>{const t=ku(e);return Kt.some(r=>t.startsWith(r))},ts=e=>{if(e.nodeType===Node.TEXT_NODE)return es(e.textContent??"");if(e.nodeType!==Node.ELEMENT_NODE)return"";const t=e,r=t.tagName.toLowerCase();if(r==="script")return"";let n="";for(const o of t.attributes){const i=o.name.toLowerCase();i.startsWith("on")||Cu(i)&&Ou(o.value)||(n+=` ${o.name}="${Au(o.value)}"`)}if(Su.has(r))return`<${r}${n}>`;let s="";for(const o of t.childNodes)s+=ts(o);return`<${r}${n}>${s}</${r}>`},rs=e=>le(e)||Pe(e)?e.value:e,Y=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!Y(r.slice(1).trim(),t);if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);if(r==="true")return!0;if(r==="false")return!1;if(r==="null")return null;if(r!=="undefined"){if(/^[\w$]+(?:\.[\w$]+)*$/.test(r)){const n=r.split(".");let s=t;for(const o of n){if(s==null)return;s===t?s=rs(s[o]):s=s[o]}return s}try{const n=Object.keys(t),s=n.map(o=>rs(t[o]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},Tu=e=>{const t=e.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);return t?{itemName:t[1],indexName:t[2]||void 0,listExpr:t[3].trim()}:null},Ft=(e,t,r,n)=>{const s=e.getAttribute(`${r}-if`);if(s!==null&&!Y(s,t))return!1;const o=e.getAttribute(`${r}-show`);if(o!==null&&!Y(o,t)){const d=e;d.style?d.style.display="none":e.setAttribute("style","display: none;")}const i=e.getAttribute(`${r}-text`);if(i!==null){const d=Y(i,t);e.textContent=String(d??"")}const a=e.getAttribute(`${r}-html`);if(a!==null){const d=Y(a,t);e.innerHTML=String(J(String(d??"")))}const l=e.getAttribute(`${r}-class`);if(l!==null){const d=l.trim();if(d.startsWith("{")){const p=d.slice(1,-1).trim().split(",");for(const f of p){const m=f.indexOf(":");if(m>-1){const g=f.slice(0,m).trim().replace(/^['"]|['"]$/g,"");Y(f.slice(m+1).trim(),t)&&e.classList.add(g)}}}else{const p=Y(l,t);typeof p=="string"?p.split(/\s+/).filter(Boolean).forEach(f=>e.classList.add(f)):Array.isArray(p)&&p.filter(Boolean).forEach(f=>e.classList.add(f))}}const c=e.getAttribute(`${r}-style`);if(c!==null){const d=Y(c,t);if(d&&typeof d=="object"){const p=e;for(const[f,m]of Object.entries(d)){const g=f.replace(/([A-Z])/g,"-$1").toLowerCase();p.style.setProperty(g,String(m))}}}const u=Array.from(e.attributes);for(const d of u)if(d.name.startsWith(`${r}-bind:`)){const p=d.name.slice(`${r}-bind:`.length),f=Y(d.value,t);f===!1||f===null||f===void 0?e.removeAttribute(p):f===!0?e.setAttribute(p,""):e.setAttribute(p,String(f))}const h=e.getAttribute(`${r}-for`);if(h!==null){const d=Tu(h);if(d){const p=Y(d.listExpr,t);if(Array.isArray(p)&&e.parentNode){const f=e.parentNode;for(let m=0;m<p.length;m++){const g=p[m],b=e.cloneNode(!0);b.removeAttribute(`${r}-for`),b.removeAttribute(":key"),b.removeAttribute(`${r}-key`);const v={...t,[d.itemName]:g};d.indexName&&(v[d.indexName]=m),Ft(b,v,r,n),Bt(b,v,r,n),f.insertBefore(b,e)}return f.removeChild(e),!0}}}return!0},Bt=(e,t,r,n)=>{const s=Array.from(e.children);for(const o of s){if(o.hasAttribute(`${r}-for`)){Ft(o,t,r,n)||o.remove();continue}if(!Ft(o,t,r,n)){o.remove();continue}Bt(o,t,r,n)}},ns=(e,t)=>{const r=Array.from(e.attributes);for(const n of r)(n.name.startsWith(`${t}-`)||n.name.startsWith(":")||n.name===":key")&&e.removeAttribute(n.name);for(const n of Array.from(e.children))ns(n,t)},Lu=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:o=!1}=r;if(!e||typeof e!="string")throw new Error("bQuery SSR: template must be a non-empty string.");if(typeof DOMParser>"u")throw new Error("bQuery SSR: DOMParser is not available in this environment. Provide a DOMParser-compatible implementation before calling renderToString().");const i=new DOMParser().parseFromString(e.trim(),"text/html"),a=i.body||i.documentElement;if(!a)throw new Error("bQuery SSR: Failed to parse template.");if(Bt(a,t,n,i),s)for(const u of Array.from(a.children))ns(u,n);let l="";for(const u of a.childNodes)l+=ts(u);let c;return o&&(c=Xn({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:l,storeState:c}};return y.$=Rs,y.$$=Ms,y.BQueryCollection=Xe,y.BQueryElement=pe,y.BqLinkElement=rn,y.Computed=De,y.HttpError=oe,y.Signal=Ne,y.animate=nt,y.announceToScreenReader=Yl,y.auditA11y=nc,y.back=fa,y.batch=Le,y.bool=Si,y.breakpoints=Tc,y.buckets=Wi,y.cache=Yi,y.capturePosition=Ot,y.clearAnnouncements=Gl,y.clearTimeline=ru,y.clipboard=qc,y.component=ye,y.computed=P,y.createForm=Tl,y.createHttp=gt,y.createI18n=Vl,y.createPersistedStore=Za,y.createRequestQueue=Yo,y.createRestClient=ni,y.createRouter=Na,y.createStore=Mt,y.createTemplate=Al,y.createTrustedHtml=Ss,y.createUseFetch=Io,y.currentRoute=Xr,y.custom=Fl,y.customAsync=Bl,y.deduplicateRequest=oi,y.defineBqueryConfig=mo,y.defineComponent=gi,y.definePageMeta=sa,y.defineStore=Qa,y.deserializeStoreState=wu,y.destroyStore=Ha,y.draggable=vc,y.droppable=Ac,y.easeInCubic=jr,y.easeInOutCubic=Br,y.easeInOutQuad=zr,y.easeInQuad=qr,y.easeOutBack=Hr,y.easeOutCubic=Fr,y.easeOutExpo=Ur,y.easeOutQuad=xr,y.easingPresets=$i,y.effect=z,y.effectScope=go,y.email=ql,y.enableDevtools=Yc,y.escapeHtml=nr,y.fireEvent=vu,y.flip=Tt,y.flipElements=Qr,y.flipList=Ri,y.flushEffects=Gn,y.formatDate=kn,y.formatNumber=Cn,y.forward=da,y.generateNonce=bs,y.generateSignalLabel=Zc,y.getBqueryConfig=X,y.getCurrentScope=pr,y.getCustomDirective=Vc,y.getCustomDirectives=Wc,y.getDevtoolsState=nu,y.getFocusableElements=qt,y.getInstalledPlugins=Qc,y.getStore=Ee,y.getTimeline=tu,y.getTrustedTypesPolicy=rr,y.hasCSPDirective=ws,y.html=ge,y.http=Ko,y.hydrateMount=gu,y.hydrateStore=Zn,y.hydrateStores=Eu,y.inspectComponents=Wn,y.inspectSignals=Qn,y.inspectStores=Vn,y.interceptLinks=ga,y.isActive=$a,y.isActiveSignal=Ra,y.isComputed=Pe,y.isDevtoolsEnabled=Gc,y.isInstalled=Uc,y.isNavigating=ca,y.isSignal=le,y.isTrustedTypesSupported=Es,y.keyframePresets=Mi,y.linear=_r,y.link=ya,y.linkedSignal=Go,y.listStores=Rt,y.logComponents=iu,y.logSignals=su,y.logStores=ou,y.logTimeline=au,y.mapActions=Ka,y.mapGetters=Wa,y.mapState=Va,y.matchField=Hl,y.max=jl,y.maxLength=Il,y.mediaQuery=Oc,y.min=zl,y.minLength=Pl,y.mockRouter=pu,y.mockSignal=fu,y.morphElement=Di,y.mount=It,y.navigate=qe,y.notifications=ta,y.onScopeDispose=vr,y.parallax=Ni,y.pattern=_l,y.persistedSignal=Zo,y.prefersColorScheme=sc,y.prefersContrast=oc,y.prefersReducedMotion=Z,y.readonly=H,y.recordEvent=eu,y.registerBqLink=va,y.registerDefaultComponents=Ti,y.registerPlugin=ja,y.releaseFocus=hc,y.renderComponent=uu,y.renderToString=Lu,y.required=Nl,y.resetPlugins=Kc,y.resolve=La,y.rovingTabIndex=ic,y.safeHtml=Ai,y.sanitize=J,y.sanitizeHtml=J,y.scrollAnimate=Ii,y.sequence=Bi,y.serializeStoreState=Xn,y.setReducedMotion=Li,y.signal=M,y.skipLink=uc,y.sortable=kc,y.spring=qi,y.springPresets=xi,y.stagger=zi,y.storage=la,y.stripTags=As,y.timeline=Hi,y.toValue=ii,y.trackSignal=Jc,y.transition=Ui,y.trapFocus=dc,y.trusted=vs,y.typewriter=Qi,y.untrack=ae,y.untrackSignal=Xc,y.url=xl,y.use=Hc,y.useAnnouncer=na,y.useAsyncData=gr,y.useBattery=Mc,y.useComputed=mi,y.useCookie=ea,y.useDeviceMotion=Ic,y.useDeviceOrientation=_c,y.useEffect=pi,y.useEventSource=fi,y.useFetch=W,y.useFormField=Rl,y.useGeolocation=Dc,y.useInfiniteFetch=Xo,y.useIntersectionObserver=zc,y.useMutationObserver=Fc,y.useNetworkStatus=$c,y.usePaginatedFetch=Jo,y.usePolling=ei,y.useResizeObserver=jc,y.useResource=ti,y.useResourceList=si,y.useRoute=Ia,y.useSignal=hi,y.useSubmit=ri,y.useViewport=Lc,y.useWebSocket=Tr,y.useWebSocketChannel=ui,y.utils=lo,y.waitFor=yu,y.watch=wt,y.watchDebounce=ai,y.watchStore=el,y.watchThrottle=li,y})({});
|
|
275
|
+
`,ys=0,Re=new Map,pu=()=>typeof document>"u"?!1:typeof document.createElement=="function"&&typeof document.querySelector=="function"&&typeof document.getElementById=="function"&&document.body!==null&&document.body!==void 0,vu=()=>({destroy:()=>{},element:null}),yu=(e,t={})=>{if(!pu())return vu();const{text:r="Skip to main content",className:n="bq-skip-link"}=t;let s,o;const i=h=>{try{return document.querySelector(h)}catch{return null}},a=()=>{if(!s)return;const h=Re.get(s),v=(h?.count??0)-1;v<=0?(Re.delete(s),h?.target.isConnected&&h.target.id===s&&h.target.removeAttribute("id")):Re.set(s,{count:v,target:h.target}),s=void 0},l=()=>{if(!o)return;const{target:h,hadTabIndex:v,previousTabIndex:b}=o;h.isConnected&&(v?h.setAttribute("tabindex",b??""):h.removeAttribute("tabindex")),o=void 0},c=h=>{if(o?.target!==h){if(l(),h.hasAttribute("tabindex")){o={target:h,hadTabIndex:!0,previousTabIndex:h.getAttribute("tabindex")};return}h.tabIndex===-1&&(o={target:h,hadTabIndex:!1,previousTabIndex:null},h.setAttribute("tabindex","-1"))}},f=(h,v)=>{if(s===v)return;a();const b=Re.get(v);Re.set(v,{count:(b?.count??0)+1,target:h}),s=v},m=()=>{if(e.startsWith("#")){const v=e.slice(1),b=v?document.getElementById(v):null;return b||i(e)}const h=document.getElementById(e);return h||i(e)},d=h=>{if(h.id)return Re.get(h.id)?.target===h&&f(h,h.id),h.id;let v;do ys+=1,v=`bq-skip-target-${ys}`;while(document.getElementById(v)!==null);return h.id=v,f(h,v),v},p=document.createElement("a"),u=m();return p.href=e.startsWith("#")?e:u?`#${d(u)}`:`#${e}`,p.textContent=r,p.className=n,p.setAttribute("style",Xt),p.addEventListener("focus",()=>{p.setAttribute("style",Xt+mu)}),p.addEventListener("blur",()=>{p.setAttribute("style",Xt)}),p.addEventListener("click",h=>{h.preventDefault();const v=m();v&&(p.href=`#${d(v)}`,c(v),v.focus())}),document.body.firstChild?document.body.insertBefore(p,document.body.firstChild):document.body.appendChild(p),{destroy:()=>{l(),a(),p.remove()},element:p}},gu=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"details > summary","audio[controls]","video[controls]"].join(", "),Zt=e=>Array.from(e.querySelectorAll(gu)).filter(t=>!t.hasAttribute("disabled")&&t.tabIndex!==-1&&t.getClientRects().length>0),gs=(e,t)=>e?typeof e=="string"?t.querySelector(e):e:null,bu=(e,t={})=>{const{escapeDeactivates:r=!0,onEscape:n,initialFocus:s,returnFocus:o}=t;if(typeof document>"u"||typeof document.addEventListener!="function"||typeof document.removeEventListener!="function"){let m=!1;return{get active(){return m},release:()=>{m=!1}}}const i=document.activeElement;let a=!0;const l=m=>{if(!a)return;if(m.key==="Escape"&&r){m.preventDefault(),f.release(),n?.();return}if(m.key!=="Tab")return;const d=Zt(e);if(d.length===0){m.preventDefault();return}const p=d[0],u=d[d.length-1];m.shiftKey?(document.activeElement===p||!e.contains(document.activeElement))&&(m.preventDefault(),u.focus()):(document.activeElement===u||!e.contains(document.activeElement))&&(m.preventDefault(),p.focus())};document.addEventListener("keydown",l,!0);const c=gs(s,e);if(c)c.focus();else{const m=Zt(e);m.length>0&&m[0].focus()}const f={get active(){return a},release:()=>{if(!a)return;a=!1,document.removeEventListener("keydown",l,!0);const m=gs(o,document.body);m?m.focus():i&&i.focus&&i.focus()}};return f},wu=e=>{e.release()},Ke=new Map,bs=()=>{const e=Array.from(Ke.values());return e[e.length-1]},Eu=(e,t)=>{if(typeof t=="object")return t;let r=null;if(t==="parent"?r=e.parentElement:r=document.querySelector(t),!r)return null;const n=r.getBoundingClientRect(),s=e.getBoundingClientRect(),o=parseFloat(e.style.left||"0"),i=parseFloat(e.style.top||"0"),a=Number.isNaN(o)?0:o,l=Number.isNaN(i)?0:i;return{left:n.left-s.left+a,top:n.top-s.top+l,right:n.right-s.right+a+(n.width-s.width),bottom:n.bottom-s.bottom+l+(n.height-s.height)}},Su=(e,t)=>t?{x:Math.max(t.left,Math.min(t.right,e.x)),y:Math.max(t.top,Math.min(t.bottom,e.y))}:e,Au=(e,t={})=>{const{axis:r="both",bounds:n,handle:s,ghost:o=!1,ghostClass:i="bq-drag-ghost",draggingClass:a="bq-dragging",onDragStart:l,onDrag:c,onDragEnd:f}=t;let m=!t.disabled,d=!1,p={x:0,y:0},u={x:0,y:0},h={x:0,y:0},v=null,b=null;const y=e.style.touchAction,w=e.style.userSelect,E=R=>({element:e,position:{...u},delta:{x:u.x-h.x,y:u.y-h.y},event:R}),k=()=>{const R=e.cloneNode(!0),O=e.getBoundingClientRect();return R.classList.add(i),R.style.position="fixed",R.style.left=`${O.left}px`,R.style.top=`${O.top}px`,R.style.width=`${O.width}px`,R.style.height=`${O.height}px`,R.style.pointerEvents="none",R.style.zIndex="999999",R.style.opacity="0.7",R.style.margin="0",document.body.appendChild(R),R},A=()=>{v&&(v.remove(),v=null),b=null},S=R=>{if(m&&!(s&&!R.target.closest(s))){if(R.preventDefault(),d=!0,p={x:R.clientX,y:R.clientY},h={...u},e.classList.add(a),e.setPointerCapture(R.pointerId),o){const O=e.getBoundingClientRect();b={x:O.left,y:O.top},v=k()}Ke.set(e,{element:e,position:u}),l?.(E(R))}},T=R=>{if(!d)return;R.preventDefault(),h={...u};let O=u.x+(R.clientX-p.x),C=u.y+(R.clientY-p.y);p={x:R.clientX,y:R.clientY},r==="x"&&(C=u.y),r==="y"&&(O=u.x);let L={x:O,y:C};if(n){const M=Eu(e,n);L=Su(L,M)}if(u=L,Ke.set(e,{element:e,position:u}),o&&v){const M=b??{x:e.getBoundingClientRect().left,y:e.getBoundingClientRect().top};v.style.left=`${M.x+u.x}px`,v.style.top=`${M.y+u.y}px`}else e.style.transform=`translate(${u.x}px, ${u.y}px)`;c?.(E(R))},P=R=>{if(d){d=!1,e.classList.remove(a);try{typeof e.releasePointerCapture=="function"&&(typeof e.hasPointerCapture!="function"||e.hasPointerCapture(R.pointerId))&&e.releasePointerCapture(R.pointerId)}catch{}finally{A(),Ke.delete(e),f?.(E(R))}}};return e.addEventListener("pointerdown",S),e.addEventListener("pointermove",T),e.addEventListener("pointerup",P),e.addEventListener("pointercancel",P),e.style.touchAction="none",e.style.userSelect="none",{destroy:()=>{e.removeEventListener("pointerdown",S),e.removeEventListener("pointermove",T),e.removeEventListener("pointerup",P),e.removeEventListener("pointercancel",P),A(),Ke.delete(e),e.style.touchAction=y,e.style.userSelect=w,e.classList.remove(a)},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},ku={passive:!0},Ye=new Set,Ge=null,ne=null,ws=()=>Array.from(Ye),Tu=()=>typeof document<"u"&&typeof document.addEventListener=="function"&&typeof document.removeEventListener=="function"&&typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function",Cu=e=>{for(const t of ws())t.handlePointerMove(e)},Ru=()=>{ne=null;const e=Ge;Ge=null,e&&Cu(e)},Es=e=>{Ge=e,ne===null&&(ne=requestAnimationFrame(Ru))},Ss=e=>{ne!==null&&(cancelAnimationFrame(ne),ne=null,Ge=null);for(const t of ws())t.handlePointerUp(e)},Ou=e=>{Ye.size===0&&(document.addEventListener("pointermove",Es,ku),document.addEventListener("pointerup",Ss)),Ye.add(e)},Lu=e=>{Ye.delete(e),Ye.size===0&&(document.removeEventListener("pointermove",Es),document.removeEventListener("pointerup",Ss),ne!==null&&(cancelAnimationFrame(ne),ne=null),Ge=null)},As=(e,t)=>t?typeof t=="string"?e.matches(t):t(e):!0,$u=(e,t={})=>{const{overClass:r="bq-drop-over",accept:n,onDragEnter:s,onDragOver:o,onDragLeave:i,onDrop:a}=t;if(!Tu())return{destroy:()=>{}};let l=!1,c=null;const f=(b,y)=>({zone:e,dragged:b,event:y}),m=b=>{const y=e.getBoundingClientRect();return b.clientX>=y.left&&b.clientX<=y.right&&b.clientY>=y.top&&b.clientY<=y.bottom},d=()=>bs()?.element??c,p=(b,y=c)=>{l&&(l=!1,e.classList.remove(r),y&&i?.(f(y,b)),c=null)},v={handlePointerMove:b=>{const y=bs()?.element??null,w=m(b);if(!(y!==null&&y!==e&&As(y,n))||!w){p(b,y??c);return}l?o?.(f(y,b)):(l=!0,c=y,e.classList.add(r),s?.(f(y,b)))},handlePointerUp:b=>{const y=d(),w=m(b),E=y!==null&&y!==e&&As(y,n);w&&E&&y&&a?.(f(y,b)),l&&(l=!1,e.classList.remove(r)),c=null}};return Ou(v),{destroy:()=>{Lu(v),e.classList.remove(r),c=null}}},ks=(e,t)=>Array.from(e.querySelectorAll(t)),Pu=(e,t,r,n)=>{let s=null;for(let o=0;o<e.length;o++){const i=e[o];if(i===n)continue;const a=i.getBoundingClientRect(),l=t-(r==="y"?a.top+a.height/2:a.left+a.width/2);(s===null||l<0&&l>s.distance||s.distance>=0&&l<0&&Math.abs(l)<Math.abs(s.distance))&&l<0&&(s={element:i,index:o,distance:l})}return s?{element:s.element,index:s.index}:null},Mu=(e,t={})=>{const{items:r=":scope > *",axis:n="y",handle:s,placeholderClass:o="bq-sort-placeholder",sortingClass:i="bq-sorting",animationDuration:a=200,onSortStart:l,onSortMove:c,onSortEnd:f}=t;let m=!t.disabled,d=!1,p=null,u=null,h=-1,v=0,b=0,y=0,w=0;const E=(P,R,O)=>({container:e,item:P,oldIndex:R,newIndex:O}),k=P=>{if(!m)return;const R=P.target,O=ks(e,r);let C=null;for(const M of O)if(M.contains(R)){C=M;break}if(!C||s&&!R.closest(s))return;P.preventDefault(),d=!0,p=C,h=O.indexOf(C),v=P.clientY,b=P.clientX;const L=C.getBoundingClientRect();y=L.top,w=L.left,u=document.createElement("div"),u.classList.add(o),u.style.width=`${L.width}px`,u.style.height=`${L.height}px`,u.style.boxSizing="border-box",C.classList.add(i),C.style.position="fixed",C.style.width=`${L.width}px`,C.style.height=`${L.height}px`,C.style.left=`${L.left}px`,C.style.top=`${L.top}px`,C.style.zIndex="999999",C.style.pointerEvents="none",C.style.margin="0",C.parentNode?.insertBefore(u,C),e.setPointerCapture(P.pointerId),l?.(E(C,h,h))},A=P=>{if(!d||!p||!u)return;P.preventDefault();const R=P.clientX-b,O=P.clientY-v;n==="y"?p.style.top=`${y+O}px`:p.style.left=`${w+R}px`;const C=Pu(ks(e,r),n==="y"?P.clientY:P.clientX,n,p);C?e.insertBefore(u,C.element):e.appendChild(u);const L=Array.from(e.children).indexOf(u);c?.(E(p,h,L))},S=P=>{if(!d||!p||!u)return;d=!1;const R=p,O=Array.from(e.children).indexOf(u),C=u.getBoundingClientRect(),L=R.getBoundingClientRect();if(a>0){const M=C.left-L.left,_=C.top-L.top;R.style.transition=`transform ${a}ms ease`,R.style.transform=`translate(${M}px, ${_}px)`;let U=!1,q=null;const Q=()=>{U||(U=!0,q!==null&&(window.clearTimeout(q),q=null),T(),f?.(E(R,h,O)))};q=window.setTimeout(()=>{Q()},a+50),R.addEventListener("transitionend",Q,{once:!0})}else T(),f?.(E(R,h,O));e.releasePointerCapture(P.pointerId)},T=()=>{!p||!u||(u.parentNode?.insertBefore(p,u),u.remove(),u=null,p.classList.remove(i),p.style.position="",p.style.width="",p.style.height="",p.style.left="",p.style.top="",p.style.zIndex="",p.style.pointerEvents="",p.style.margin="",p.style.transition="",p.style.transform="",p=null)};return e.addEventListener("pointerdown",k),e.addEventListener("pointermove",A),e.addEventListener("pointerup",S),e.addEventListener("pointercancel",S),e.style.touchAction="none",{destroy:()=>{e.removeEventListener("pointerdown",k),e.removeEventListener("pointermove",A),e.removeEventListener("pointerup",S),e.removeEventListener("pointercancel",S),e.style.touchAction="",d&&T()},disable:()=>{m=!1},enable:()=>{m=!0},get enabled(){return m}}},Nu=e=>{const t=$(!1);let r;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const o=window.matchMedia(e);t.value=o.matches;const i=a=>{t.value=a.matches};if(typeof o.addEventListener=="function")o.addEventListener("change",i),r=()=>{o.removeEventListener("change",i)};else if(typeof o.addListener=="function"){const a=o;a.addListener(i),r=()=>{a.removeListener(i)}}}catch{}const n=I(t);let s=!1;return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){s||(s=!0,r?.(),t.dispose())}}),n},Du=e=>{const t={},r=[];for(const o of Object.keys(e)){const i=e[o],a=$(!1);let l;if(typeof window<"u"&&typeof window.matchMedia=="function")try{const m=window.matchMedia(`(min-width: ${i}px)`);a.value=m.matches;const d=p=>{a.value=p.matches};if(typeof m.addEventListener=="function")m.addEventListener("change",d),l=()=>{m.removeEventListener("change",d)};else{const p=m;typeof p.addListener=="function"&&(p.addListener(d),l=()=>{p.removeListener?.(d)})}}catch{}const c=I(a);let f=!1;Object.defineProperty(c,"destroy",{enumerable:!1,configurable:!0,value(){f||(f=!0,l?.(),a.dispose())}}),r.push(c.destroy),t[o]=c}let n=!1;const s=Object.defineProperty(t,"destroyAll",{enumerable:!1,configurable:!0,value(){n||(n=!0,r.forEach(o=>{o()}))}});return Object.prototype.hasOwnProperty.call(t,"destroy")||Object.defineProperty(s,"destroy",{enumerable:!1,configurable:!0,value:s.destroyAll}),s},Ts=(e,t)=>t>=e?"portrait":"landscape",Iu=()=>{const e=$({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0,orientation:typeof window<"u"?Ts(window.innerWidth,window.innerHeight):"portrait"});let t;if(typeof window<"u"){const s=()=>{e.value={width:window.innerWidth,height:window.innerHeight,orientation:Ts(window.innerWidth,window.innerHeight)}};window.addEventListener("resize",s),t=()=>{window.removeEventListener("resize",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value:()=>{n||(n=!0,t?.(),e.dispose())}}),r},Cs=()=>{const e=typeof navigator<"u"&&navigator.onLine!==void 0?navigator.onLine:!0,t=(typeof navigator<"u"?navigator:void 0)?.connection;return{online:e,effectiveType:t?.effectiveType??"unknown",downlink:t?.downlink??0,rtt:t?.rtt??0}},_u=()=>{const e=$(Cs());let t;if(typeof window<"u"){const s=()=>{e.value=Cs()};window.addEventListener("online",s),window.addEventListener("offline",s);const o=typeof navigator<"u"?navigator:void 0;o?.connection&&typeof o.connection.addEventListener=="function"&&o.connection.addEventListener("change",s),t=()=>{window.removeEventListener("online",s),window.removeEventListener("offline",s),o?.connection&&typeof o.connection.removeEventListener=="function"&&o.connection.removeEventListener("change",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{value(){n||(n=!0,t?.(),e.dispose())},enumerable:!1,configurable:!0}),r},qu={supported:!1,charging:!1,chargingTime:0,dischargingTime:0,level:1},zu=()=>{const e=$({...qu});let t,r=!1;typeof navigator<"u"&&"getBattery"in navigator&&typeof navigator.getBattery=="function"&&navigator.getBattery().then(s=>{if(r)return;const o=()=>{e.value={supported:!0,charging:s.charging,chargingTime:s.chargingTime,dischargingTime:s.dischargingTime,level:s.level}};o(),s.addEventListener("chargingchange",o),s.addEventListener("chargingtimechange",o),s.addEventListener("dischargingtimechange",o),s.addEventListener("levelchange",o),t=()=>{s.removeEventListener("chargingchange",o),s.removeEventListener("chargingtimechange",o),s.removeEventListener("dischargingtimechange",o),s.removeEventListener("levelchange",o)}}).catch(()=>{});const n=I(e);return Object.defineProperty(n,"destroy",{enumerable:!1,configurable:!0,value(){r||(r=!0,t?.(),e.dispose())}}),n},Rs={supported:!1,loading:!1,latitude:null,longitude:null,accuracy:null,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:null,error:null},xu=(e={})=>{const{enableHighAccuracy:t=!1,maximumAge:r=0,timeout:n=1/0,watch:s=!1}=e,o=$({...Rs});let i;if(typeof navigator<"u"&&"geolocation"in navigator){o.value={...Rs,supported:!0,loading:!0};const c={enableHighAccuracy:t,maximumAge:r,timeout:n===1/0?void 0:n},f=d=>{o.value={supported:!0,loading:!1,latitude:d.coords.latitude,longitude:d.coords.longitude,accuracy:d.coords.accuracy,altitude:d.coords.altitude,altitudeAccuracy:d.coords.altitudeAccuracy,heading:d.coords.heading,speed:d.coords.speed,timestamp:d.timestamp,error:null}},m=d=>{o.value={...o.value,loading:!1,error:d.message}};if(s){const d=navigator.geolocation.watchPosition(f,m,c);i=()=>{navigator.geolocation.clearWatch(d)}}else navigator.geolocation.getCurrentPosition(f,m,c)}const a=I(o);let l=!1;return Object.defineProperty(a,"destroy",{enumerable:!1,configurable:!0,value(){l||(l=!0,i?.(),o.dispose())}}),a},ju={acceleration:{x:null,y:null,z:null},accelerationIncludingGravity:{x:null,y:null,z:null},rotationRate:{alpha:null,beta:null,gamma:null},interval:0},Fu={alpha:null,beta:null,gamma:null,absolute:!1},Uu=()=>{const e=$({...ju});let t;if(typeof window<"u"){const s=o=>{e.value={acceleration:{x:o.acceleration?.x??null,y:o.acceleration?.y??null,z:o.acceleration?.z??null},accelerationIncludingGravity:{x:o.accelerationIncludingGravity?.x??null,y:o.accelerationIncludingGravity?.y??null,z:o.accelerationIncludingGravity?.z??null},rotationRate:{alpha:o.rotationRate?.alpha??null,beta:o.rotationRate?.beta??null,gamma:o.rotationRate?.gamma??null},interval:o.interval??0}};window.addEventListener("devicemotion",s),t=()=>{window.removeEventListener("devicemotion",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Bu=()=>{const e=$({...Fu});let t;if(typeof window<"u"){const s=o=>{e.value={alpha:o.alpha??null,beta:o.beta??null,gamma:o.gamma??null,absolute:o.absolute??!1}};window.addEventListener("deviceorientation",s),t=()=>{window.removeEventListener("deviceorientation",s)}}const r=I(e);let n=!1;return Object.defineProperty(r,"destroy",{enumerable:!1,configurable:!0,value(){n||(n=!0,t?.(),e.dispose())}}),r},Os="bQuery media: Clipboard API is unavailable. Use a secure context (HTTPS or localhost) and ensure clipboard permissions or user-activation requirements are met.",Wu={read:async()=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.readText!="function")throw new Error(Os);return navigator.clipboard.readText()},write:async e=>{if(typeof navigator>"u"||!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error(Os);return navigator.clipboard.writeText(e)}},Hu=(e,t)=>{let r;t==="border-box"?r=e.borderBoxSize:t==="device-pixel-content-box"?r=e.devicePixelContentBoxSize:r=e.contentBoxSize;const n=Array.isArray(r)?r[0]:r;return n&&typeof n.inlineSize=="number"&&typeof n.blockSize=="number"?{width:n.inlineSize,height:n.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}},Qu=(e,t)=>{const r=$({isIntersecting:!1,intersectionRatio:0,entry:null});let n,s=!1;if(typeof window<"u"&&typeof IntersectionObserver<"u")try{if(n=new IntersectionObserver(i=>{if(s)return;const a=i[i.length-1];a&&(r.value={isIntersecting:a.isIntersecting,intersectionRatio:a.intersectionRatio,entry:a})},{root:t?.root??null,rootMargin:t?.rootMargin??"0px",threshold:t?.threshold??0}),e){const i=Array.isArray(e)?e:[e];for(const a of i)n.observe(a)}}catch{n&&n.disconnect(),n=void 0}const o=I(r);return Object.defineProperties(o,{observe:{enumerable:!1,configurable:!0,value(i){if(!s)try{n?.observe(i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(i){s||n?.unobserve(i)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),o},Vu=(e,t)=>{const r=$({width:0,height:0,entry:null});let n,s=!1;const o=t?.box??"content-box",i=t?.box?{box:t.box}:void 0;if(typeof window<"u"&&typeof ResizeObserver<"u")try{if(n=new ResizeObserver(l=>{if(s)return;const c=l[l.length-1];if(c){const{width:f,height:m}=Hu(c,o);r.value={width:f,height:m,entry:c}}}),e){const l=Array.isArray(e)?e:[e];for(const c of l)n.observe(c,i)}}catch{n&&n.disconnect(),n=void 0}const a=I(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},unobserve:{enumerable:!1,configurable:!0,value(l){s||n?.unobserve(l)}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Ku=(e,t)=>{const r=$({mutations:[],count:0});let n,s=!1,o=0;const i={attributes:t?.attributes??!0,childList:t?.childList??!1,characterData:t?.characterData??!1,subtree:t?.subtree??!1,attributeOldValue:t?.attributeOldValue??!1,characterDataOldValue:t?.characterDataOldValue??!1,...t&&t.attributeFilter!==void 0?{attributeFilter:t.attributeFilter}:{}};if(!i.attributes&&!i.childList&&!i.characterData&&(i.attributes=!0),i.attributes||(i.attributeOldValue=!1,delete i.attributeFilter),i.characterData||(i.characterDataOldValue=!1),typeof window<"u"&&typeof MutationObserver<"u")try{n=new MutationObserver(l=>{s||(o+=1,r.value={mutations:l,count:o})}),e&&n.observe(e,i)}catch{n&&n.disconnect(),n=void 0}const a=I(r);return Object.defineProperties(a,{observe:{enumerable:!1,configurable:!0,value(l){if(!s)try{n?.observe(l,i)}catch{}}},takeRecords:{enumerable:!1,configurable:!0,value(){return n?.takeRecords()??[]}},destroy:{enumerable:!1,configurable:!0,value(){s||(s=!0,n?.disconnect(),n=void 0,r.dispose())}}}),a},Je=new Set,se=new Map,er=()=>{Oc(e=>se.get(e))};er();var Ls=e=>{se.clear();for(const[t,r]of e)se.set(t,r)},Yu=e=>({directive(t,r){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin directive: name must be a non-empty string");if(t.startsWith("bq-")){const n=t.slice(3);throw new Error(`bQuery plugin directive: name "${t}" must be provided without the "bq-" prefix`+(n?` (use "${n}")`:""))}if(typeof r!="function")throw new Error(`bQuery plugin directive: handler for "${t}" must be a function`);if(se.has(t))throw new Error(`bQuery plugin directive: a directive named "${t}" is already registered`);se.set(t,r)},component(t,r,n){if(typeof t!="string"||t.length===0)throw new Error("bQuery plugin component: tagName must be a non-empty string");if(!t.includes("-"))throw new Error(`bQuery plugin component: tagName "${t}" must be a valid custom element name containing a hyphen`);if(typeof r!="function")throw new Error(`bQuery plugin component: constructor for "${t}" must be a function`);if(typeof customElements>"u"){typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[bQuery] plugin component "${t}" was not registered because customElements is not available in this environment.`);return}!customElements.get(t)&&!e.some(s=>s.tagName===t)&&e.push({tagName:t,constructor:r,options:n})}}),Gu=(e,t)=>{if(er(),!e||typeof e!="object")throw new Error("bQuery plugin: use() expects a plugin object with { name, install }");if(typeof e.name!="string"||e.name.length===0)throw new Error('bQuery plugin: plugin must have a non-empty "name" property');if(typeof e.install!="function")throw new Error(`bQuery plugin: plugin "${e.name}" must have an "install" function`);if(Je.has(e.name))return;const r=[],n=Yu(r),s=new Map(se);try{e.install(n,t)}catch(o){throw Ls(s),o}try{for(const o of r)customElements.get(o.tagName)||customElements.define(o.tagName,o.constructor,o.options)}catch(o){throw Ls(s),o}Je.add(e.name)},Ju=e=>Je.has(e),Xu=()=>[...Je],Zu=e=>se.get(e),ef=()=>[...se.entries()].map(([e,t])=>({name:e,handler:t})),tf=()=>{Je.clear(),se.clear(),er()},Xe=!1,tr={},pe=[],St=new Map,$s=0,rf=(e,t)=>{Xe=e,tr=t??{},e||(pe.length=0,St.clear(),$s=0)},nf=()=>Xe,sf=(e,t,r)=>{if(Xe){if(typeof e!="string"||e.length===0)throw new Error("bQuery devtools: trackSignal() requires a non-empty label");St.set(e,{peek:t,subscriberCount:r})}},of=e=>{St.delete(e)},af=()=>`signal_${$s++}`,Ps=()=>{const e=[];for(const[t,r]of St)e.push({label:t,value:r.peek(),subscriberCount:r.subscriberCount()});return e},Ms=()=>{try{return Qt().map(e=>{const t=Te(e),r={};if(t&&typeof t=="object"&&"$state"in t){const n=t.$state;n&&typeof n=="object"&&Object.assign(r,n)}return{id:e,state:r}})}catch{return[]}},Ns=()=>{if(typeof document>"u")return[];const e=[],t=new Set,r=document.querySelectorAll("*");for(let n=0;n<r.length;n++){const s=r[n].tagName.toLowerCase();if(s.includes("-")&&!t.has(s)&&typeof customElements<"u"&&customElements.get(s)){t.add(s);const o=document.querySelectorAll(s);e.push({tagName:s,instanceCount:o.length})}}return e},lf=(e,t)=>{if(!Xe)return;const r={timestamp:Date.now(),type:e,detail:t};pe.push(r),tr.logToConsole&&console.log(`[bq:devtools] ${e} — ${t}`)},cf=()=>pe,uf=()=>{pe.length=0},ff=()=>({enabled:Xe,options:{...tr},timeline:[...pe]}),df=()=>{const e=Ps();if(e.length===0){console.log("[bq:devtools] No tracked signals.");return}console.table(e)},hf=()=>{const e=Ms();if(e.length===0){console.log("[bq:devtools] No stores registered.");return}console.table(e.map(t=>({id:t.id,state:JSON.stringify(t.state)})))},mf=()=>{const e=Ns();if(e.length===0){console.log("[bq:devtools] No custom elements found.");return}console.table(e)},pf=e=>{const t=typeof e=="number"&&e>0?pe.slice(-e):pe;if(t.length===0){console.log("[bq:devtools] Timeline is empty.");return}console.table(t.map(r=>({time:new Date(r.timestamp).toISOString(),type:r.type,detail:r.detail})))},Ds=e=>e!==void 0&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="_"),vf=(e,t)=>{let r=1,n="",s=t+1;for(;s<e.length;){const o=e[s];if(o==="\\"&&s+1<e.length){n+=o+e[s+1],s+=2;continue}if(o==="(")r++;else if(o===")"&&(r--,r===0))return{constraint:n,endIndex:s+1};n+=o,s++}return null},Is=new Map,yf=e=>{const t=Ht(e),r=Is.get(t);if(r)return r;const n=new RegExp(`^(?:${t})$`);return Is.set(t,n),n};function gf(e,t={}){if(!e||!e.includes("-"))throw new Error(`bQuery testing: "${e}" is not a valid custom element tag name (must contain a hyphen)`);const{props:r,slots:n,container:s=document.body}=t,o=document.createElement(e);if(r)for(const[a,l]of Object.entries(r))l!=null&&o.setAttribute(a,String(l));if(n)if(typeof n=="string")o.innerHTML=n;else{const a=[];for(const[l,c]of Object.entries(n))if(l==="default")a.push(c);else{const f=l.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");a.push(`<div slot="${f}">${c}</div>`)}o.innerHTML=a.join("")}return s.appendChild(o),{el:o,unmount:()=>{o.parentNode&&o.parentNode.removeChild(o)}}}function _s(){ce(()=>{})}function bf(e){const t=$(e);return Object.defineProperty(t,"initialValue",{value:e,writable:!1,enumerable:!0}),t.set=function(r){t.value=r},t.reset=function(){t.value=e},t}function wf(e,t){let r=e;t&&r.startsWith(t)&&(r=r.slice(t.length)||"/");let n="";const s=r.indexOf("#");s>=0&&(n=r.slice(s+1),r=r.slice(0,s));const o={},i=r.indexOf("?");if(i>=0){const a=r.slice(i+1);r=r.slice(0,i);for(const l of a.split("&")){const c=l.indexOf("="),f=c>=0?decodeURIComponent(l.slice(0,c)):decodeURIComponent(l),m=c>=0?decodeURIComponent(l.slice(c+1)):"",d=o[f];d!==void 0?Array.isArray(d)?d.push(m):o[f]=[d,m]:o[f]=m}}return{path:r||"/",query:o,hash:n}}function Ef(e,t){for(const r of t){const n=Sf(r.path,e);if(n)return{matched:r,params:n}}return{matched:null,params:{}}}function Sf(e,t){if(e==="*")return{};const r=new Map,n=(o,i)=>{const a=o.indexOf("/",i);return a===-1?o.length:a},s=(o,i)=>{const a=`${o}:${i}`;if(r.has(a))return r.get(a)??null;if(o===e.length){const f=i===t.length?{}:null;return r.set(a,f),f}const l=e[o];if(l==="*"){for(let f=t.length;f>=i;f--){const m=s(o+1,f);if(m)return r.set(a,m),m}return r.set(a,null),null}if(l===":"&&Ds(e[o+1])){let f=o+2;for(;f<e.length&&Ds(e[f]);)f++;const m=e.slice(o+1,f);let d=f,p,u=!1;if(e[f]==="("){const v=vf(e,f);v&&(p=v.constraint,d=v.endIndex)}e[d]==="*"&&(u=!0,d++);const h=u||p?t.length:n(t,i);for(let v=h;v>i;v--){const b=t.slice(i,v);if(p&&!yf(p).test(b))continue;const y=s(d,v);if(y){const w={[m]:b,...y};return r.set(a,w),w}}return r.set(a,null),null}if(i>=t.length||l!==t[i])return r.set(a,null),null;const c=s(o+1,i+1);return r.set(a,c),c};return s(0,0)}function Af(e={}){const t=e.routes??[{path:"*",component:()=>null}],r=e.base??"",n=e.initialPath??"/",s=i=>{const{path:a,query:l,hash:c}=wf(i,r),{matched:f,params:m}=Ef(a,t);return{path:a,params:m,query:l,matched:f,hash:c}},o=$(s(n));return{push(i){o.value=s(i)},replace(i){o.value=s(i)},get currentRoute(){return o},get routes(){return t},destroy(){o.dispose()}}}function kf(e,t,r={}){if(!e)throw new Error("bQuery testing: fireEvent requires a valid element");if(!t)throw new Error("bQuery testing: fireEvent requires an event name");const{bubbles:n=!0,cancelable:s=!0,composed:o=!0,detail:i}=r;let a;i!==void 0?a=new CustomEvent(t,{bubbles:n,cancelable:s,composed:o,detail:i}):a=new Event(t,{bubbles:n,cancelable:s,composed:o});const l=e.dispatchEvent(a);return _s(),l}async function Tf(e,t={}){if(typeof e!="function")throw new Error("bQuery testing: waitFor requires a predicate function");const{timeout:r=1e3,interval:n=10}=t,s=Date.now();for(;;){try{if(await e())return}catch{}if(Date.now()-s>=r)throw new Error(`bQuery testing: waitFor timed out after ${r}ms — predicate never returned true`);await new Promise(o=>setTimeout(o,n))}}var Cf=(e,t,r={})=>{const{hydrate:n=!0,...s}=r;if(!n)throw new Error("bQuery ssr: hydrateMount() requires { hydrate: true } when options are provided.");return Jt(e,t,s)},At=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rr=e=>{const t={};for(const[r,n]of Object.entries(e))x(r)||(t[r]=n);return t},qs=e=>e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\//g,"\\u002f").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"),Rf=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),zs=(e={})=>{const{scriptId:t="__BQUERY_STORE_STATE__",globalKey:r="__BQUERY_INITIAL_STATE__",storeIds:n,serialize:s=JSON.stringify}=e;if(x(r))throw new Error(`serializeStoreState: invalid globalKey "${r}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`serializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);const o=n??Qt(),i=Object.create(null);for(const f of o){if(x(f))continue;const m=Te(f);m&&(i[f]=rr(m.$state))}const a=s(i);if(typeof a!="string")throw new Error("serializeStoreState: custom serialize function must return a string.");if(s!==JSON.stringify){let f;try{f=JSON.parse(a)}catch{throw new Error("serializeStoreState: custom serialize function returned invalid JSON.")}if(!At(f))throw new Error("serializeStoreState: custom serialize function must return a JSON object string.")}const l=qs(a),c=qs(JSON.stringify(r));return{stateJson:a,scriptTag:`<script id="${Rf(t)}">window[${c}]=${l}<\/script>`}},Of=(e="__BQUERY_INITIAL_STATE__",t="__BQUERY_STORE_STATE__")=>{if(x(e))throw new Error(`deserializeStoreState: invalid globalKey "${e}" - prototype-pollution keys are not allowed.`);if(x(t))throw new Error(`deserializeStoreState: invalid scriptId "${t}" - prototype-pollution keys are not allowed.`);if(typeof window>"u")return{};const r=window[e];if(!r)return{};try{delete window[e]}catch{window[e]=void 0}if(typeof document<"u"&&typeof document.getElementById=="function"){const s=document.getElementById(t);s&&s.remove()}if(!At(r))return{};for(const s of Object.values(r))if(!At(s))return{};const n=Object.create(null);for(const[s,o]of Object.entries(r))x(s)||!At(o)||(n[s]=rr(o));return n},xs=(e,t)=>{const r=Te(e);r&&typeof r.$patch=="function"&&r.$patch(rr(t))},Lf=e=>{for(const[t,r]of Object.entries(e))xs(t,r)},$f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),js=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Pf=e=>js(e).replace(/"/g,"""),Mf=e=>{const t=e.toLowerCase();return t==="href"||t==="src"||t==="xlink:href"||t==="formaction"||t==="action"||t==="poster"||t==="background"||t==="cite"||t==="data"},Nf=e=>e.trim().replace(/[\u0000-\u001F\u007F]+/g,"").replace(/[\u200B-\u200D\uFEFF\u2028\u2029]+/g,"").replace(/\\u[\da-fA-F]{4}/g,"").replace(/\s+/g,"").toLowerCase(),Df=e=>{const t=Nf(e);return ur.some(r=>t.startsWith(r))},Fs=e=>{if(e.nodeType===Node.TEXT_NODE)return js(e.textContent??"");if(e.nodeType!==Node.ELEMENT_NODE)return"";const t=e,r=t.tagName.toLowerCase();if(r==="script")return"";let n="";for(const o of t.attributes){const i=o.name.toLowerCase();i.startsWith("on")||Mf(i)&&Df(o.value)||(n+=` ${o.name}="${Pf(o.value)}"`)}if($f.has(r))return`<${r}${n}>`;let s="";for(const o of t.childNodes)s+=Fs(o);return`<${r}${n}>${s}</${r}>`},Us=e=>fe(e)||qe(e)?e.value:e,G=(e,t)=>{const r=e.trim();if(r.startsWith("!"))return!G(r.slice(1).trim(),t);if(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);if(/^-?\d+(\.\d+)?$/.test(r))return Number(r);if(r==="true")return!0;if(r==="false")return!1;if(r==="null")return null;if(r!=="undefined"){if(/^[\w$]+(?:\.[\w$]+)*$/.test(r)){const n=r.split(".");let s=t;for(const o of n){if(s==null)return;s===t?s=Us(s[o]):s=s[o]}return s}try{const n=Object.keys(t),s=n.map(o=>Us(t[o]));return new Function(...n,`return (${r});`)(...s)}catch{return}}},If=e=>{const t=e.match(/^\(?(\w+)(?:\s*,\s*(\w+))?\)?\s+in\s+(\S.*)$/);return t?{itemName:t[1],indexName:t[2]||void 0,listExpr:t[3].trim()}:null},nr=(e,t,r,n)=>{const s=e.getAttribute(`${r}-if`);if(s!==null&&!G(s,t))return!1;const o=e.getAttribute(`${r}-show`);if(o!==null&&!G(o,t)){const d=e;d.style?d.style.display="none":e.setAttribute("style","display: none;")}const i=e.getAttribute(`${r}-text`);if(i!==null){const d=G(i,t);e.textContent=String(d??"")}const a=e.getAttribute(`${r}-html`);if(a!==null){const d=G(a,t);e.innerHTML=String(X(String(d??"")))}const l=e.getAttribute(`${r}-class`);if(l!==null){const d=l.trim();if(d.startsWith("{")){const p=d.slice(1,-1).trim().split(",");for(const u of p){const h=u.indexOf(":");if(h>-1){const v=u.slice(0,h).trim().replace(/^['"]|['"]$/g,"");G(u.slice(h+1).trim(),t)&&e.classList.add(v)}}}else{const p=G(l,t);typeof p=="string"?p.split(/\s+/).filter(Boolean).forEach(u=>e.classList.add(u)):Array.isArray(p)&&p.filter(Boolean).forEach(u=>e.classList.add(u))}}const c=e.getAttribute(`${r}-style`);if(c!==null){const d=G(c,t);if(d&&typeof d=="object"){const p=e;for(const[u,h]of Object.entries(d)){const v=u.replace(/([A-Z])/g,"-$1").toLowerCase();p.style.setProperty(v,String(h))}}}const f=Array.from(e.attributes);for(const d of f)if(d.name.startsWith(`${r}-bind:`)){const p=d.name.slice(`${r}-bind:`.length),u=G(d.value,t);u===!1||u===null||u===void 0?e.removeAttribute(p):u===!0?e.setAttribute(p,""):e.setAttribute(p,String(u))}const m=e.getAttribute(`${r}-for`);if(m!==null){const d=If(m);if(d){const p=G(d.listExpr,t);if(Array.isArray(p)&&e.parentNode){const u=e.parentNode;for(let h=0;h<p.length;h++){const v=p[h],b=e.cloneNode(!0);b.removeAttribute(`${r}-for`),b.removeAttribute(":key"),b.removeAttribute(`${r}-key`);const y={...t,[d.itemName]:v};d.indexName&&(y[d.indexName]=h),nr(b,y,r,n),sr(b,y,r,n),u.insertBefore(b,e)}return u.removeChild(e),!0}}}return!0},sr=(e,t,r,n)=>{const s=Array.from(e.children);for(const o of s){if(o.hasAttribute(`${r}-for`)){nr(o,t,r,n)||o.remove();continue}if(!nr(o,t,r,n)){o.remove();continue}sr(o,t,r,n)}},Bs=(e,t)=>{const r=Array.from(e.attributes);for(const n of r)(n.name.startsWith(`${t}-`)||n.name.startsWith(":")||n.name===":key")&&e.removeAttribute(n.name);for(const n of Array.from(e.children))Bs(n,t)},_f=(e,t,r={})=>{const{prefix:n="bq",stripDirectives:s=!1,includeStoreState:o=!1}=r;if(!e||typeof e!="string")throw new Error("bQuery SSR: template must be a non-empty string.");if(typeof DOMParser>"u")throw new Error("bQuery SSR: DOMParser is not available in this environment. Provide a DOMParser-compatible implementation before calling renderToString().");const i=new DOMParser().parseFromString(e.trim(),"text/html"),a=i.body||i.documentElement;if(!a)throw new Error("bQuery SSR: Failed to parse template.");if(sr(a,t,n,i),s)for(const f of Array.from(a.children))Bs(f,n);let l="";for(const f of a.childNodes)l+=Fs(f);let c;return o&&(c=zs({storeIds:Array.isArray(o)?o:void 0}).stateJson),{html:l,storeState:c}};return g.$=go,g.$$=bo,g.BQueryCollection=st,g.BQueryElement=be,g.BqLinkElement=Bn,g.Computed=Ie,g.HttpError=ie,g.Signal=_e,g.TaskWorkerAbortError=ae,g.TaskWorkerError=F,g.TaskWorkerSerializationError=de,g.TaskWorkerTimeoutError=lt,g.TaskWorkerUnsupportedError=It,g.animate=vt,g.announceToScreenReader=ru,g.auditA11y=uu,g.back=gl,g.batch=ce,g.batchTasks=fa,g.bool=La,g.breakpoints=Du,g.buckets=el,g.cache=rl,g.callWorkerMethod=sa,g.capturePosition=Ut,g.clearAnnouncements=nu,g.clearTimeline=uf,g.clipboard=Wu,g.component=Ee,g.computed=D,g.createForm=Dc,g.createHttp=Pt,g.createI18n=Zc,g.createPersistedStore=ic,g.createReactiveRpcPool=ga,g.createReactiveRpcWorker=va,g.createReactiveTaskPool=ya,g.createReactiveTaskWorker=pa,g.createRequestQueue=_i,g.createRestClient=Wi,g.createRouter=jl,g.createRpcPool=en,g.createRpcWorker=ut,g.createStore=Vt,g.createTaskPool=ht,g.createTaskWorker=ft,g.createTemplate=$c,g.createTrustedHtml=co,g.createUseFetch=Si,g.currentRoute=xn,g.custom=Kc,g.customAsync=Yc,g.deduplicateRequest=Qi,g.defineBqueryConfig=ti,g.defineComponent=Ta,g.definePageMeta=fl,g.defineStore=Xl,g.deserializeStoreState=Of,g.destroyStore=Gl,g.draggable=Au,g.droppable=$u,g.easeInCubic=Rn,g.easeInOutCubic=Ln,g.easeInOutQuad=Cn,g.easeInQuad=kn,g.easeOutBack=$n,g.easeOutCubic=On,g.easeOutExpo=Pn,g.easeOutQuad=Tn,g.easingPresets=_a,g.effect=j,g.effectScope=oi,g.email=Wc,g.enableDevtools=rf,g.escapeHtml=br,g.every=ln,g.filter=on,g.find=cn,g.fireEvent=kf,g.flip=Bt,g.flipElements=Mn,g.flipList=qa,g.flushEffects=_s,g.formatDate=fs,g.formatNumber=us,g.forward=bl,g.generateNonce=io,g.generateSignalLabel=af,g.getBqueryConfig=Z,g.getConcurrencySupport=Qr,g.getCurrentScope=Pr,g.getCustomDirective=Zu,g.getCustomDirectives=ef,g.getDevtoolsState=ff,g.getFocusableElements=Zt,g.getInstalledPlugins=Xu,g.getStore=Te,g.getTimeline=cf,g.getTrustedTypesPolicy=gr,g.hasCSPDirective=ao,g.html=Se,g.http=Ii,g.hydrateMount=Cf,g.hydrateStore=xs,g.hydrateStores=Lf,g.inspectComponents=Ns,g.inspectSignals=Ps,g.inspectStores=Ms,g.interceptLinks=Tl,g.isActive=_l,g.isActiveSignal=ql,g.isComputed=qe,g.isConcurrencySupported=_t,g.isDevtoolsEnabled=nf,g.isInstalled=Ju,g.isNavigating=vl,g.isSignal=fe,g.isTrustedTypesSupported=lo,g.keyframePresets=za,g.linear=An,g.link=kl,g.linkedSignal=qi,g.listStores=Qt,g.logComponents=mf,g.logSignals=df,g.logStores=hf,g.logTimeline=pf,g.map=sn,g.mapActions=tc,g.mapGetters=ec,g.mapState=Zl,g.matchField=Gc,g.max=Vc,g.maxLength=Uc,g.mediaQuery=Nu,g.min=Qc,g.minLength=Fc,g.mockRouter=Af,g.mockSignal=bf,g.morphElement=xa,g.mount=Jt,g.navigate=Be,g.notifications=ll,g.onScopeDispose=Mr,g.parallax=ja,g.parallel=ua,g.pattern=Bc,g.persistedSignal=ji,g.pipeline=ma,g.prefersColorScheme=fu,g.prefersContrast=du,g.prefersReducedMotion=ee,g.readonly=I,g.recordEvent=lf,g.reduce=un,g.registerBqLink=Al,g.registerDefaultComponents=Da,g.registerPlugin=Vl,g.releaseFocus=wu,g.renderComponent=gf,g.renderToString=_f,g.required=jc,g.resetPlugins=tf,g.resolve=Il,g.rovingTabIndex=hu,g.runTask=Yr,g.safeHtml=$a,g.sanitize=X,g.sanitizeHtml=X,g.scrollAnimate=Ua,g.sequence=Ya,g.serializeStoreState=zs,g.setReducedMotion=Ia,g.signal=$,g.skipLink=yu,g.some=an,g.sortable=Mu,g.spring=Wa,g.springPresets=Ha,g.stagger=Qa,g.storage=pl,g.stripTags=uo,g.timeline=Ga,g.toValue=Vi,g.trackSignal=sf,g.transition=Ja,g.trapFocus=bu,g.trusted=no,g.typewriter=Xa,g.untrack=ue,g.untrackSignal=of,g.url=Hc,g.use=Gu,g.useAnnouncer=ul,g.useAsyncData=Dr,g.useBattery=zu,g.useComputed=Ea,g.useCookie=al,g.useDeviceMotion=Uu,g.useDeviceOrientation=Bu,g.useEffect=Sa,g.useEventSource=Xi,g.useFetch=K,g.useFormField=qc,g.useGeolocation=xu,g.useInfiniteFetch=xi,g.useIntersectionObserver=Qu,g.useMutationObserver=Ku,g.useNetworkStatus=_u,g.usePaginatedFetch=zi,g.usePolling=Fi,g.useResizeObserver=Vu,g.useResource=Ui,g.useResourceList=Hi,g.useRoute=Ul,g.useSignal=wa,g.useSubmit=Bi,g.useViewport=Iu,g.useWebSocket=Br,g.useWebSocketChannel=Ji,g.utils=Go,g.waitFor=Tf,g.watch=Nt,g.watchDebounce=Ki,g.watchStore=ac,g.watchThrottle=Yi,g})({});
|
|
192
276
|
|
|
193
277
|
//# sourceMappingURL=full.iife.js.map
|