// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later
var f=(e,n,t)=>{e.addEventListener(n,t)},d=(e,n)=>{document.addEventListener(e,n)},u=document.getElementById("open-pane"),h=document.getElementById("site-pane");if(!u||!h)throw Error("open-pane or site-pane not found");var C=e=>{"".concat(e," sitePane"),h.setAttribute("state",e)},g=()=>{C("open")},l=()=>{C("close")},E=e=>e===u||e===h||h.contains(e);f(u,"mouseover",g);f(u,"mouseleave",l);d("focusin",e=>{E(e.target)?g():l()});d("focusout",e=>{E(e.target)&&l()});f(u,"click",g);d("click",e=>{E(e.target)||l()});var i={x:null,y:null};d("touchstart",e=>{var n,t,o,s;i.x=(t=(n=e.touches[0])==null?void 0:n.clientX)!=null?t:null,i.y=(s=(o=e.touches[0])==null?void 0:o.clientY)!=null?s:null});d("touchmove",e=>{var s,r,a,p;if(i.x===null||i.y===null)return;let n=i.x-((r=(s=e.touches[0])==null?void 0:s.clientX)!=null?r:0),t=i.y-((p=(a=e.touches[0])==null?void 0:a.clientY)!=null?p:0);if(n===0&&t===0)return;i.x=null,i.y=null;let o=Math.max(12,.01*screen.width,t*1.5);Math.abs(n)>=o&&(n>0?g():l())});// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT
var x="children",T="className",b=(e,n)=>{n==null||n.forEach(t=>{e.append(t)})},L=(e,n)=>{if(typeof e=="function")return e(n);let t=_.createElement(e);return Object.entries(n).forEach(([o,s])=>{o===x?b(t,s):o===T?t[T]=s:o.startsWith("on")?s&&t.addEventListener(o.slice(2),s):t.setAttribute(o,s)}),t},S=(e,n)=>L(e,n),M=e=>{let n=new DocumentFragment;return b(n,e[x]),n};var _=document;function P(e){return _.getElementById(e)}var X=P,c=String(location);function D(e){c=e}var v="application/json";function R(e,n={},t=console.log,o=console.error,s=v){return fetch(e,{method:"POST",body:JSON.stringify(n),headers:{Accept:s,"Content-Type":v}}).then(r=>r.json()).catch(o).then(t).catch(o)}function I(e,n={},t=console.log,o=console.error,s=v){let r=new URLSearchParams(n).toString();return fetch(r?"".concat(e,"?").concat(r):e,{method:"GET",headers:{Accept:s}}).then(a=>a.json()).catch(o).then(t).catch(o)}var H={},y="URLParamChange";H[y]=()=>{location.reload()};function J(e,n,t,o=y,s=!0){return w([[e,n]],t,o,s)}function w(e,n,t=y,o=!0){let s=new URLSearchParams(location.search);e.forEach(([a,p])=>{s.set(a,p)});let r="".concat(location.origin).concat(location.pathname,"?").concat(s.toString());return n.stateType=t,o&&r!==location.href?history.pushState(n,r,r):history.replaceState(n,r,r),c=location.href,r}function m(){let e=P("header"),n=P(location.hash.slice(1));e&&n&&scrollBy(0,n.getBoundingClientRect().top-Math.floor(Number(getComputedStyle(e).height)))}setTimeout(m,4);window.onhashchange=m;window.onpopstate=e=>{if(c.split("#")[0]===location.href.split("#")[0]){c=location.href,m();return}if(e.state){let n=e.state,t=H[n.stateType];if(t){e.preventDefault(),t(e),c=location.href,m();return}else console.error("No state handler",n)}console.error("Couldn't handle",e),c=location.href,location.reload()};export{M as Fragment,H as PopStateHandlers,_ as d,X as e,I as get,l as hideSitePane,L as jsx,S as jsxs,R as post,D as setLastLocation,w as setMultipleURLParams,J as setURLParam};
// @license-end
//# sourceMappingURL=utils.js.map
