mirror of
https://github.com/HananoshikaYomaru/openfreebooks.git
synced 2026-11-13 21:15:54 +00:00
2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/quadratic-explorer-BEDvXl1S.js","js/katex-Dc8nsIP1.js","js/render-math-H0D_R-AC.js","js/katex.css"])))=>i.map(i=>d[i]);
|
|
const ke="modulepreload",Ce=function(e){return"/"+e},te={},j=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(a=>({status:"fulfilled",value:a}),a=>({status:"rejected",reason:a}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=l(n.map(u=>{if(u=Ce(u),u in te)return;te[u]=!0;const f=u.endsWith(".css"),a=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${a}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":ke,f||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),f)return new Promise((p,v)=>{m.addEventListener("load",p),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(l){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=l,window.dispatchEvent(o),!o.defaultPrevented)throw l}return r.then(l=>{for(const o of l||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};const _e=(e,t)=>e===t,$e=Symbol("solid-track"),V={equals:_e};let de=pe;const x=1,F=2,he={owned:null,cleanups:null,context:null,owner:null};var g=null;let Q=null,Te=null,h=null,w=null,$=null,W=0;function N(e,t){const n=h,s=g,r=e.length===0,i=t===void 0?s:t,l=r?he:{owned:null,cleanups:null,context:i?i.context:null,owner:i},o=r?e:()=>e(()=>L(()=>U(l)));g=l,h=null;try{return M(o,!0)}finally{h=n,g=s}}function G(e,t){t=t?Object.assign({},V,t):V;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=r=>(typeof r=="function"&&(r=r(n.value)),me(n,r));return[ge.bind(n),s]}function I(e,t,n){const s=ee(e,t,!1,x);R(s)}function Le(e,t,n){de=Be;const s=ee(e,t,!1,x);s.user=!0,$?$.push(s):R(s)}function P(e,t,n){n=n?Object.assign({},V,n):V;const s=ee(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,R(s),ge.bind(s)}function L(e){if(h===null)return e();const t=h;h=null;try{return e()}finally{h=t}}function J(e){Le(()=>L(e))}function z(e){return g===null||(g.cleanups===null?g.cleanups=[e]:g.cleanups.push(e)),e}function ge(){if(this.sources&&this.state)if(this.state===x)R(this);else{const e=w;w=null,M(()=>K(this),!1),w=e}if(h){const e=this.observers;if(!e||e[e.length-1]!==h){const t=e?e.length:0;h.sources?(h.sources.push(this),h.sourceSlots.push(t)):(h.sources=[this],h.sourceSlots=[t]),e?(e.push(h),this.observerSlots.push(h.sources.length-1)):(this.observers=[h],this.observerSlots=[h.sources.length-1])}}return this.value}function me(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&M(()=>{for(let r=0;r<e.observers.length;r+=1){const i=e.observers[r],l=Q&&Q.running;l&&Q.disposed.has(i),(l?!i.tState:!i.state)&&(i.pure?w.push(i):$.push(i),i.observers&&be(i)),l||(i.state=x)}if(w.length>1e6)throw w=[],new Error},!1)),t}function R(e){if(!e.fn)return;U(e);const t=W;xe(e,e.value,t)}function xe(e,t,n){let s;const r=g,i=h;h=g=e;try{s=e.fn(t)}catch(l){return e.pure&&(e.state=x,e.owned&&e.owned.forEach(U),e.owned=null),e.updatedAt=n+1,we(l)}finally{h=i,g=r}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?me(e,s):e.value=s,e.updatedAt=n)}function ee(e,t,n,s=x,r){const i={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:g,context:g?g.context:null,pure:n};return g===null||g!==he&&(g.owned?g.owned.push(i):g.owned=[i]),i}function H(e){if(e.state===0)return;if(e.state===F)return K(e);if(e.suspense&&L(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<W);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===x)R(e);else if(e.state===F){const s=w;w=null,M(()=>K(e,t[0]),!1),w=s}}function M(e,t){if(w)return e();let n=!1;t||(w=[]),$?n=!0:$=[],W++;try{const s=e();return Ie(n),s}catch(s){n||($=null),w=null,we(s)}}function Ie(e){if(w&&(pe(w),w=null),e)return;const t=$;$=null,t.length&&M(()=>de(t),!1)}function pe(e){for(let t=0;t<e.length;t++)H(e[t])}function Be(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:H(s)}for(t=0;t<n;t++)H(e[t])}function K(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const r=s.state;r===x?s!==t&&(!s.updatedAt||s.updatedAt<W)&&H(s):r===F&&K(s,t)}}}function be(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=F,n.pure?w.push(n):$.push(n),n.observers&&be(n))}}function U(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const i=r.pop(),l=n.observerSlots.pop();s<r.length&&(i.sourceSlots[l]=s,r[s]=i,n.observerSlots[s]=l)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)U(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)U(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Oe(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function we(e,t=g){throw Oe(e)}const De=Symbol("fallback");function ne(e){for(let t=0;t<e.length;t++)e[t]()}function Pe(e,t,n={}){let s=[],r=[],i=[],l=0,o=t.length>1?[]:null;return z(()=>ne(i)),()=>{let c=e()||[],u=c.length,f,a;return c[$e],L(()=>{let p,v,C,d,b,y,E,S,_;if(u===0)l!==0&&(ne(i),i=[],s=[],r=[],l=0,o&&(o=[])),n.fallback&&(s=[De],r[0]=N(Ae=>(i[0]=Ae,n.fallback())),l=1);else if(l===0){for(r=new Array(u),a=0;a<u;a++)s[a]=c[a],r[a]=N(m);l=u}else{for(C=new Array(u),d=new Array(u),o&&(b=new Array(u)),y=0,E=Math.min(l,u);y<E&&s[y]===c[y];y++);for(E=l-1,S=u-1;E>=y&&S>=y&&s[E]===c[S];E--,S--)C[S]=r[E],d[S]=i[E],o&&(b[S]=o[E]);for(p=new Map,v=new Array(S+1),a=S;a>=y;a--)_=c[a],f=p.get(_),v[a]=f===void 0?-1:f,p.set(_,a);for(f=y;f<=E;f++)_=s[f],a=p.get(_),a!==void 0&&a!==-1?(C[a]=r[f],d[a]=i[f],o&&(b[a]=o[f]),a=v[a],p.set(_,a)):i[f]();for(a=y;a<u;a++)a in C?(r[a]=C[a],i[a]=d[a],o&&(o[a]=b[a],o[a](a))):r[a]=N(m);r=r.slice(0,l=u),s=c.slice(0)}return r});function m(p){if(i[a]=p,o){const[v,C]=G(a);return o[a]=C,t(c[a],v)}return t(c[a])}}}function k(e,t){return L(()=>e(t||{}))}const qe=e=>`Stale read from <${e}>.`;function se(e){const t="fallback"in e&&{fallback:()=>e.fallback};return P(Pe(()=>e.each,e.children,t||void 0))}function Ue(e){const t=e.keyed,n=P(()=>e.when,void 0,void 0),s=t?n:P(n,void 0,{equals:(r,i)=>!r==!i});return P(()=>{const r=s();if(r){const i=e.children;return typeof i=="function"&&i.length>0?L(()=>i(t?r:()=>{if(!L(s))throw qe("Show");return n()})):i}return e.fallback},void 0,void 0)}const ft=e=>P(()=>e());function Re(e,t,n){let s=n.length,r=t.length,i=s,l=0,o=0,c=t[r-1].nextSibling,u=null;for(;l<r||o<i;){if(t[l]===n[o]){l++,o++;continue}for(;t[r-1]===n[i-1];)r--,i--;if(r===l){const f=i<s?o?n[o-1].nextSibling:n[i-o]:c;for(;o<i;)e.insertBefore(n[o++],f)}else if(i===o)for(;l<r;)(!u||!u.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[i-1]&&n[o]===t[r-1]){const f=t[--r].nextSibling;e.insertBefore(n[o++],t[l++].nextSibling),e.insertBefore(n[--i],f),t[r]=n[i]}else{if(!u){u=new Map;let a=o;for(;a<i;)u.set(n[a],a++)}const f=u.get(t[l]);if(f!=null)if(o<f&&f<i){let a=l,m=1,p;for(;++a<r&&a<i&&!((p=u.get(t[a]))==null||p!==f+m);)m++;if(m>f-o){const v=t[l];for(;o<f;)e.insertBefore(n[o++],v)}else e.replaceChild(n[o++],t[l++])}else l++;else t[l++].remove()}}}const re="_$DX_DELEGATE";function D(e,t,n,s={}){let r;return N(i=>{r=i,t===document?e():A(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{r(),t.textContent=""}}function B(e,t,n,s){let r;const i=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},l=()=>(r||(r=i())).cloneNode(!0);return l.cloneNode=l,l}function ve(e,t=window.document){const n=t[re]||(t[re]=new Set);for(let s=0,r=e.length;s<r;s++){const i=e[s];n.has(i)||(n.add(i),t.addEventListener(i,Ne))}}function T(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function Me(e,t){t==null?e.removeAttribute("class"):e.className=t}function dt(e,t,n={}){const s=Object.keys(t||{}),r=Object.keys(n);let i,l;for(i=0,l=r.length;i<l;i++){const o=r[i];!o||o==="undefined"||t[o]||(oe(e,o,!1),delete n[o])}for(i=0,l=s.length;i<l;i++){const o=s[i],c=!!t[o];!o||o==="undefined"||n[o]===c||!c||(oe(e,o,!0),n[o]=c)}return n}function ht(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function gt(e,t,n){return L(()=>e(t,n))}function A(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return Y(e,t,s,n);I(r=>Y(e,t(),r,n),s)}function oe(e,t,n){const s=t.trim().split(/\s+/);for(let r=0,i=s.length;r<i;r++)e.classList.toggle(s[r],n)}function Ne(e){let t=e.target;const n=`$$${e.type}`,s=e.target,r=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),l=()=>{const c=t[n];if(c&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},o=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),e.composedPath){const c=e.composedPath();i(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!l());u++){if(t._$host){t=t._$host,o();break}if(t.parentNode===r)break}}else o();i(s)}function Y(e,t,n,s,r){for(;typeof n=="function";)n=n();if(t===n)return n;const i=typeof t,l=s!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,i==="string"||i==="number"){if(i==="number"&&(t=t.toString(),t===n))return n;if(l){let o=n[0];o&&o.nodeType===3?o.data!==t&&(o.data=t):o=document.createTextNode(t),n=O(e,n,s,o)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||i==="boolean")n=O(e,n,s);else{if(i==="function")return I(()=>{let o=t();for(;typeof o=="function";)o=o();n=Y(e,o,n,s)}),()=>n;if(Array.isArray(t)){const o=[],c=n&&Array.isArray(n);if(Z(o,t,n,r))return I(()=>n=Y(e,o,n,s,!0)),()=>n;if(o.length===0){if(n=O(e,n,s),l)return n}else c?n.length===0?ie(e,o,s):Re(e,n,o):(n&&O(e),ie(e,o));n=o}else if(t.nodeType){if(Array.isArray(n)){if(l)return n=O(e,n,s,t);O(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function Z(e,t,n,s){let r=!1;for(let i=0,l=t.length;i<l;i++){let o=t[i],c=n&&n[e.length],u;if(!(o==null||o===!0||o===!1))if((u=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))r=Z(e,o,c)||r;else if(u==="function")if(s){for(;typeof o=="function";)o=o();r=Z(e,Array.isArray(o)?o:[o],Array.isArray(c)?c:[c])||r}else e.push(o),r=!0;else{const f=String(o);c&&c.nodeType===3&&c.data===f?e.push(c):e.push(document.createTextNode(f))}}return r}function ie(e,t,n=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],n)}function O(e,t,n,s){if(n===void 0)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let i=!1;for(let l=t.length-1;l>=0;l--){const o=t[l];if(r!==o){const c=o.parentNode===e;!i&&!l?c?e.replaceChild(r,o):e.insertBefore(r,n):c&&o.remove()}else i=!0}}else e.insertBefore(r,n);return[r]}const ye="openfreebooks-theme";function je(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ve(){const e=localStorage.getItem(ye);return e==="light"||e==="dark"?e:null}function Ee(){return Ve()??je()}function Se(e){document.documentElement.setAttribute("data-theme",e)}function Fe(e){localStorage.setItem(ye,e),Se(e)}function Ge(){Se(Ee())}var He=B("<span aria-hidden=true>☀"),Ke=B("<button type=button class=theme-toggle>"),Ye=B("<span aria-hidden=true>☾");function We(){const[e,t]=G("light");J(()=>{t(Ee())});const n=()=>{const s=e()==="dark"?"light":"dark";Fe(s),t(s)};return(()=>{var s=Ke();return s.$$click=n,A(s,k(Ue,{get when(){return e()==="dark"},get fallback(){return Ye()},get children(){return He()}})),I(r=>{var i=e()==="dark"?"Switch to light theme":"Switch to dark theme",l=e()==="dark"?"Light mode":"Dark mode";return i!==r.e&&T(s,"aria-label",r.e=i),l!==r.t&&T(s,"title",r.t=l),r},{e:void 0,t:void 0}),s})()}ve(["click"]);var Je=B('<header><div class="container header-row"><div class=brand><a class=brand-name></a></div><div class=header-actions><nav class=main-nav aria-label="Primary navigation"></nav><button type=button class=nav-burger aria-controls=mobile-nav><span class=nav-burger-line></span><span class=nav-burger-line></span><span class=nav-burger-line></span></button></div></div><div class=nav-backdrop></div><nav id=mobile-nav class=mobile-nav-panel aria-label="Mobile navigation">'),le=B("<a>");function Qe(e){const[t,n]=G(!1),[s,r]=G(!1);J(()=>{const o=()=>n(window.scrollY>24);o(),window.addEventListener("scroll",o,{passive:!0});const c=()=>{window.innerWidth>467&&s()&&(r(!1),document.body.style.overflow="")};window.addEventListener("resize",c,{passive:!0}),z(()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",c),document.body.style.overflow=""})});const i=o=>{r(o),document.body.style.overflow=o?"hidden":""},l=()=>{const o=["site-header"];return t()&&o.push("is-scrolled"),s()&&o.push("nav-is-open"),o.join(" ")};return(()=>{var o=Je(),c=o.firstChild,u=c.firstChild,f=u.firstChild,a=u.nextSibling,m=a.firstChild,p=m.nextSibling,v=c.nextSibling,C=v.nextSibling;return A(f,()=>e.brand),A(m,k(se,{get each(){return e.links},children:d=>(()=>{var b=le();return A(b,()=>d.label),I(()=>T(b,"href",d.href)),b})()})),A(a,k(We,{}),p),p.$$click=()=>i(!s()),v.$$click=()=>i(!1),A(C,k(se,{get each(){return e.links},children:d=>(()=>{var b=le();return b.$$click=()=>i(!1),A(b,()=>d.label),I(()=>T(b,"href",d.href)),b})()})),I(d=>{var b=l(),y=e.homeUrl,E=s()?"true":"false",S=s()?"Close menu":"Open menu",_=s()?"false":"true";return b!==d.e&&Me(o,d.e=b),y!==d.t&&T(f,"href",d.t=y),E!==d.a&&T(p,"aria-expanded",d.a=E),S!==d.o&&T(p,"aria-label",d.o=S),_!==d.i&&T(v,"aria-hidden",d.i=_),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),o})()}ve(["click"]);var Xe=B("<span class=marquee-text>Every human being deserves free high quality learning materials — Man Lung Yeung "),Ze=B('<div class=marquee-shell role=region aria-label="Site quote"><div class=marquee-line></div><div class=marquee aria-hidden=true><div class=marquee-track></div></div><div class=marquee-line>');function ze(){const e=()=>Xe();return(()=>{var t=Ze(),n=t.firstChild,s=n.nextSibling,r=s.firstChild;return A(r,e,null),A(r,e,null),A(r,e,null),t})()}function et(e){const t=document.getElementById(e);t instanceof HTMLDialogElement&&t.showModal()}function tt(){const e=document.querySelectorAll("[data-contributor-dialog]"),t=document.querySelectorAll(".contributor-dialog"),n=r=>{const i=r.currentTarget;if(!(i instanceof HTMLButtonElement))return;const l=i.dataset.contributorDialog;l&&et(l)},s=r=>{const i=r.currentTarget;i instanceof HTMLDialogElement&&r.target===i&&i.close()};return e.forEach(r=>r.addEventListener("click",n)),t.forEach(r=>r.addEventListener("click",s)),()=>{e.forEach(r=>r.removeEventListener("click",n)),t.forEach(r=>r.removeEventListener("click",s))}}function nt(){return J(()=>tt()),null}const st=80;function rt(e){return e.closest("[data-scroll-reveal]")??e.closest("section")??e.parentElement??document.body}function ot(e){const t=e.getBoundingClientRect();return t.top<window.innerHeight&&t.bottom>0}function it(e){const t=new Map;for(const n of e){const s=rt(n),r=t.get(s);r?r.push(n):t.set(s,[n])}return t}function lt(){return J(()=>{const e=document.querySelectorAll("[data-scroll-reveal-card]");if(!e.length)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){e.forEach(r=>r.classList.add("is-inview"));return}const n=new IntersectionObserver((r,i)=>{r.forEach(l=>{l.isIntersecting&&(l.target.classList.add("is-inview"),i.unobserve(l.target))})},{threshold:.14}),s=it([...e]);for(const r of s.values())r.forEach((i,l)=>{if(ot(i)){i.style.transitionDelay="0ms",i.classList.add("is-inview");return}i.style.transitionDelay=`${l*st}ms`,n.observe(i)});z(()=>n.disconnect())}),null}function at(){const e=document.getElementById("site-config");return e!=null&&e.textContent?JSON.parse(e.textContent):{brand:"Open Free Books",homeUrl:"/",browseUrl:"/catalog/",aboutUrl:"/about/",githubUrl:"https://github.com/openfreebooks/openfreebooks"}}function ct(){const e=document.getElementById("footer-year");e&&(e.textContent=String(new Date().getFullYear()))}Ge();const q=at(),ut=[{label:"Browse",href:q.browseUrl},{label:"About",href:q.aboutUrl},{label:"GitHub",href:q.githubUrl}],ae=document.getElementById("site-header");ae&&D(()=>k(Qe,{get brand(){return q.brand},get homeUrl(){return q.homeUrl},links:ut}),ae);const ce=document.getElementById("marquee");ce&&D(()=>k(ze,{}),ce);D(()=>k(lt,{}),document.body);D(()=>k(nt,{}),document.body);const ue=document.getElementById("webgl-background");ue&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&j(async()=>{const{initParticleBackground:e}=await import("./particle-background-D6AacBl-.js");return{initParticleBackground:e}},[]).then(({initParticleBackground:e})=>{e(ue)});const fe=document.getElementById("quadratic-explorer");fe&&Promise.all([j(()=>import("./quadratic-explorer-BEDvXl1S.js"),__vite__mapDeps([0,1])),j(()=>import("./render-math-H0D_R-AC.js"),__vite__mapDeps([2,1,3]))]).then(([{QuadraticExplorer:e},{renderBookMath:t}])=>{D(()=>k(e,{}),fe),requestAnimationFrame(()=>t())});const X=document.getElementById("catalog-app");X&&j(async()=>{const{CatalogApp:e}=await import("./catalog-app-BEjaT8IN.js");return{CatalogApp:e}},[]).then(({CatalogApp:e})=>{X.replaceChildren(),D(()=>k(e,{}),X)});ct();export{se as F,Ue as S,Me as a,k as b,dt as c,Le as d,P as e,I as f,G as g,ve as h,A as i,ht as j,ft as m,z as o,Ee as r,T as s,B as t,gt as u};
|