mirror of
https://github.com/HananoshikaYomaru/openfreebooks.git
synced 2026-11-12 20:45:52 +00:00
2 lines
17 KiB
JavaScript
2 lines
17 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 Se="modulepreload",Ae=function(e){return"/"+e},z={},ee=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=Ae(u),u in z)return;z[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":Se,f||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),f)return new Promise((b,v)=>{m.addEventListener("load",b),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 ke=(e,t)=>e===t,Ce=Symbol("solid-track"),j={equals:ke};let ue=ge;const L=1,V=2,fe={owned:null,cleanups:null,context:null,owner:null};var g=null;let J=null,$e=null,h=null,w=null,$=null,Y=0;function N(e,t){const n=h,s=g,r=e.length===0,i=t===void 0?s:t,l=r?fe:{owned:null,cleanups:null,context:i?i.context:null,owner:i},o=r?e:()=>e(()=>x(()=>D(l)));g=l,h=null;try{return P(o,!0)}finally{h=n,g=s}}function G(e,t){t=t?Object.assign({},j,t):j;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=r=>(typeof r=="function"&&(r=r(n.value)),he(n,r));return[de.bind(n),s]}function B(e,t,n){const s=Z(e,t,!1,L);U(s)}function Te(e,t,n){ue=Le;const s=Z(e,t,!1,L);s.user=!0,$?$.push(s):U(s)}function R(e,t,n){n=n?Object.assign({},j,n):j;const s=Z(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,U(s),de.bind(s)}function x(e){if(h===null)return e();const t=h;h=null;try{return e()}finally{h=t}}function W(e){Te(()=>x(e))}function X(e){return g===null||(g.cleanups===null?g.cleanups=[e]:g.cleanups.push(e)),e}function de(){if(this.sources&&this.state)if(this.state===L)U(this);else{const e=w;w=null,P(()=>F(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 he(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&P(()=>{for(let r=0;r<e.observers.length;r+=1){const i=e.observers[r],l=J&&J.running;l&&J.disposed.has(i),(l?!i.tState:!i.state)&&(i.pure?w.push(i):$.push(i),i.observers&&me(i)),l||(i.state=L)}if(w.length>1e6)throw w=[],new Error},!1)),t}function U(e){if(!e.fn)return;D(e);const t=Y;_e(e,e.value,t)}function _e(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=L,e.owned&&e.owned.forEach(D),e.owned=null),e.updatedAt=n+1,be(l)}finally{h=i,g=r}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?he(e,s):e.value=s,e.updatedAt=n)}function Z(e,t,n,s=L,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!==fe&&(g.owned?g.owned.push(i):g.owned=[i]),i}function H(e){if(e.state===0)return;if(e.state===V)return F(e);if(e.suspense&&x(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Y);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===L)U(e);else if(e.state===V){const s=w;w=null,P(()=>F(e,t[0]),!1),w=s}}function P(e,t){if(w)return e();let n=!1;t||(w=[]),$?n=!0:$=[],Y++;try{const s=e();return xe(n),s}catch(s){n||($=null),w=null,be(s)}}function xe(e){if(w&&(ge(w),w=null),e)return;const t=$;$=null,t.length&&P(()=>ue(t),!1)}function ge(e){for(let t=0;t<e.length;t++)H(e[t])}function Le(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 F(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===L?s!==t&&(!s.updatedAt||s.updatedAt<Y)&&H(s):r===V&&F(s,t)}}}function me(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=V,n.pure?w.push(n):$.push(n),n.observers&&me(n))}}function D(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--)D(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)D(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 Be(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function be(e,t=g){throw Be(e)}const Ie=Symbol("fallback");function te(e){for(let t=0;t<e.length;t++)e[t]()}function Oe(e,t,n={}){let s=[],r=[],i=[],l=0,o=t.length>1?[]:null;return X(()=>te(i)),()=>{let c=e()||[],u=c.length,f,a;return c[Ce],x(()=>{let b,v,k,d,p,y,E,S,C;if(u===0)l!==0&&(te(i),i=[],s=[],r=[],l=0,o&&(o=[])),n.fallback&&(s=[Ie],r[0]=N(Ee=>(i[0]=Ee,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(k=new Array(u),d=new Array(u),o&&(p=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--)k[S]=r[E],d[S]=i[E],o&&(p[S]=o[E]);for(b=new Map,v=new Array(S+1),a=S;a>=y;a--)C=c[a],f=b.get(C),v[a]=f===void 0?-1:f,b.set(C,a);for(f=y;f<=E;f++)C=s[f],a=b.get(C),a!==void 0&&a!==-1?(k[a]=r[f],d[a]=i[f],o&&(p[a]=o[f]),a=v[a],b.set(C,a)):i[f]();for(a=y;a<u;a++)a in k?(r[a]=k[a],i[a]=d[a],o&&(o[a]=p[a],o[a](a))):r[a]=N(m);r=r.slice(0,l=u),s=c.slice(0)}return r});function m(b){if(i[a]=b,o){const[v,k]=G(a);return o[a]=k,t(c[a],v)}return t(c[a])}}}function T(e,t){return x(()=>e(t||{}))}const qe=e=>`Stale read from <${e}>.`;function ne(e){const t="fallback"in e&&{fallback:()=>e.fallback};return R(Oe(()=>e.each,e.children,t||void 0))}function De(e){const t=e.keyed,n=R(()=>e.when,void 0,void 0),s=t?n:R(n,void 0,{equals:(r,i)=>!r==!i});return R(()=>{const r=s();if(r){const i=e.children;return typeof i=="function"&&i.length>0?x(()=>i(t?r:()=>{if(!x(s))throw qe("Show");return n()})):i}return e.fallback},void 0,void 0)}function Ue(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,b;for(;++a<r&&a<i&&!((b=u.get(t[a]))==null||b!==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 se="_$DX_DELEGATE";function M(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 I(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 pe(e,t=window.document){const n=t[se]||(t[se]=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,Me))}}function _(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function Pe(e,t){t==null?e.removeAttribute("class"):e.className=t}function ct(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]||(re(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||(re(e,o,!0),n[o]=c)}return n}function ut(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function ft(e,t,n){return x(()=>e(t,n))}function A(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return K(e,t,s,n);B(r=>K(e,t(),r,n),s)}function re(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 Me(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 K(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 B(()=>{let o=t();for(;typeof o=="function";)o=o();n=K(e,o,n,s)}),()=>n;if(Array.isArray(t)){const o=[],c=n&&Array.isArray(n);if(Q(o,t,n,r))return B(()=>n=K(e,o,n,s,!0)),()=>n;if(o.length===0){if(n=O(e,n,s),l)return n}else c?n.length===0?oe(e,o,s):Ue(e,n,o):(n&&O(e),oe(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 Q(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=Q(e,o,c)||r;else if(u==="function")if(s){for(;typeof o=="function";)o=o();r=Q(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 oe(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 we="openfreebooks-theme";function Ne(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Re(){const e=localStorage.getItem(we);return e==="light"||e==="dark"?e:null}function ve(){return Re()??Ne()}function ye(e){document.documentElement.setAttribute("data-theme",e)}function je(e){localStorage.setItem(we,e),ye(e)}function Ve(){ye(ve())}var Ge=I("<span aria-hidden=true>☀"),He=I("<button type=button class=theme-toggle>"),Fe=I("<span aria-hidden=true>☾");function Ke(){const[e,t]=G("light");W(()=>{t(ve())});const n=()=>{const s=e()==="dark"?"light":"dark";je(s),t(s)};return(()=>{var s=He();return s.$$click=n,A(s,T(De,{get when(){return e()==="dark"},get fallback(){return Fe()},get children(){return Ge()}})),B(r=>{var i=e()==="dark"?"Switch to light theme":"Switch to dark theme",l=e()==="dark"?"Light mode":"Dark mode";return i!==r.e&&_(s,"aria-label",r.e=i),l!==r.t&&_(s,"title",r.t=l),r},{e:void 0,t:void 0}),s})()}pe(["click"]);var Ye=I('<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">'),ie=I("<a>");function We(e){const[t,n]=G(!1),[s,r]=G(!1);W(()=>{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}),X(()=>{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=Ye(),c=o.firstChild,u=c.firstChild,f=u.firstChild,a=u.nextSibling,m=a.firstChild,b=m.nextSibling,v=c.nextSibling,k=v.nextSibling;return A(f,()=>e.brand),A(m,T(ne,{get each(){return e.links},children:d=>(()=>{var p=ie();return A(p,()=>d.label),B(()=>_(p,"href",d.href)),p})()})),A(a,T(Ke,{}),b),b.$$click=()=>i(!s()),v.$$click=()=>i(!1),A(k,T(ne,{get each(){return e.links},children:d=>(()=>{var p=ie();return p.$$click=()=>i(!1),A(p,()=>d.label),B(()=>_(p,"href",d.href)),p})()})),B(d=>{var p=l(),y=e.homeUrl,E=s()?"true":"false",S=s()?"Close menu":"Open menu",C=s()?"false":"true";return p!==d.e&&Pe(o,d.e=p),y!==d.t&&_(f,"href",d.t=y),E!==d.a&&_(b,"aria-expanded",d.a=E),S!==d.o&&_(b,"aria-label",d.o=S),C!==d.i&&_(v,"aria-hidden",d.i=C),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),o})()}pe(["click"]);var Je=I("<span class=marquee-text>Every human being deserves free high quality learning materials — Man Lung Yeung "),Qe=I('<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 Xe(){const e=()=>Je();return(()=>{var t=Qe(),n=t.firstChild,s=n.nextSibling,r=s.firstChild;return A(r,e,null),A(r,e,null),A(r,e,null),t})()}function Ze(e){const t=document.getElementById(e);t instanceof HTMLDialogElement&&t.showModal()}function ze(){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&&Ze(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 et(){return W(()=>ze()),null}const tt=80;function nt(e){return e.closest("[data-scroll-reveal]")??e.closest("section")??e.parentElement??document.body}function st(e){const t=e.getBoundingClientRect();return t.top<window.innerHeight&&t.bottom>0}function rt(e){const t=new Map;for(const n of e){const s=nt(n),r=t.get(s);r?r.push(n):t.set(s,[n])}return t}function ot(){return W(()=>{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=rt([...e]);for(const r of s.values())r.forEach((i,l)=>{if(st(i)){i.style.transitionDelay="0ms",i.classList.add("is-inview");return}i.style.transitionDelay=`${l*tt}ms`,n.observe(i)});X(()=>n.disconnect())}),null}function it(){const e=document.getElementById("site-config");return e!=null&&e.textContent?JSON.parse(e.textContent):{brand:"Open Free Books",homeUrl:"/",browseUrl:"/browse/",aboutUrl:"/about/",githubUrl:"https://github.com/openfreebooks/openfreebooks"}}function lt(){const e=document.getElementById("footer-year");e&&(e.textContent=String(new Date().getFullYear()))}Ve();const q=it(),at=[{label:"Browse",href:q.browseUrl},{label:"About",href:q.aboutUrl},{label:"GitHub",href:q.githubUrl}],le=document.getElementById("site-header");le&&M(()=>T(We,{get brand(){return q.brand},get homeUrl(){return q.homeUrl},links:at}),le);const ae=document.getElementById("marquee");ae&&M(()=>T(Xe,{}),ae);M(()=>T(ot,{}),document.body);M(()=>T(et,{}),document.body);const ce=document.getElementById("quadratic-explorer");ce&&Promise.all([ee(()=>import("./quadratic-explorer-BEDvXl1S.js"),__vite__mapDeps([0,1])),ee(()=>import("./render-math-H0D_R-AC.js"),__vite__mapDeps([2,1,3]))]).then(([{QuadraticExplorer:e},{renderBookMath:t}])=>{M(()=>T(e,{}),ce),requestAnimationFrame(()=>t())});lt();export{De as S,Pe as a,T as b,ct as c,Te as d,R as e,B as f,G as g,pe as h,A as i,ut as j,X as o,_ as s,I as t,ft as u};
|