accorder/static/js/bundle.js

3 lines
67 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var app=function(){"use strict";function noop(){}function run(t){return t()}function blank_object(){return Object.create(null)}function run_all(t){t.forEach(run)}function is_function(t){return"function"==typeof t}function safe_not_equal(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function subscribe(t,e){const n=t.subscribe(e);return n.unsubscribe?()=>n.unsubscribe():n}function component_subscribe(t,e,n){t.$$.on_destroy.push(subscribe(e,n))}function append(t,e){t.appendChild(e)}function insert(t,e,n){t.insertBefore(e,n||null)}function detach(t){t.parentNode.removeChild(t)}function destroy_each(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function element(t){return document.createElement(t)}function svg_element(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function text(t){return document.createTextNode(t)}function space(){return text(" ")}function empty(){return text("")}function listen(t,e,n,a){return t.addEventListener(e,n,a),()=>t.removeEventListener(e,n,a)}function stop_propagation(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function self(t){return function(e){e.target===this&&t.call(this,e)}}function attr(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function children(t){return Array.from(t.childNodes)}function set_data(t,e){e=""+e,t.data!==e&&(t.data=e)}function set_input_value(t,e){(null!=e||t.value)&&(t.value=e)}function toggle_class(t,e,n){t.classList[n?"add":"remove"](e)}function custom_event(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}let current_component;function set_current_component(t){current_component=t}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(t){get_current_component().$$.on_mount.push(t)}function createEventDispatcher(){const t=get_current_component();return(e,n)=>{const a=t.$$.callbacks[e];if(a){const o=custom_event(e,n);a.slice().forEach(e=>{e.call(t,o)})}}}const dirty_components=[],binding_callbacks=[],render_callbacks=[],flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function add_render_callback(t){render_callbacks.push(t)}function add_flush_callback(t){flush_callbacks.push(t)}function flush(){const t=new Set;do{for(;dirty_components.length;){const t=dirty_components.shift();set_current_component(t),update(t.$$)}for(;binding_callbacks.length;)binding_callbacks.pop()();for(let e=0;e<render_callbacks.length;e+=1){const n=render_callbacks[e];t.has(n)||(n(),t.add(n))}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1}function update(t){null!==t.fragment&&(t.update(),run_all(t.before_update),t.fragment&&t.fragment.p(t.ctx,t.dirty),t.dirty=[-1],t.after_update.forEach(add_render_callback))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(t,e){t&&t.i&&(outroing.delete(t),t.i(e))}function transition_out(t,e,n,a){if(t&&t.o){if(outroing.has(t))return;outroing.add(t),outros.c.push(()=>{outroing.delete(t),a&&(n&&t.d(1),a())}),t.o(e)}}const globals="undefined"!=typeof window?window:global;function destroy_block(t,e){t.d(1),e.delete(t.key)}function outro_and_destroy_block(t,e){transition_out(t,1,1,()=>{e.delete(t.key)})}function update_keyed_each(t,e,n,a,o,r,c,l,i,s,u,d){let p=t.length,M=r.length,h=p;const _={};for(;h--;)_[t[h].key]=h;const g=[],m=new Map,f=new Map;for(h=M;h--;){const t=d(o,r,h),l=n(t);let i=c.get(l);i?a&&i.p(t,e):(i=s(l,t),i.c()),m.set(l,g[h]=i),l in _&&f.set(l,Math.abs(h-_[l]))}const L=new Set,j=new Set;function N(t){transition_in(t,1),t.m(l,u),c.set(t.key,t),u=t.first,M--}for(;p&&M;){const e=g[M-1],n=t[p-1],a=e.key,o=n.key;e===n?(u=e.first,p--,M--):m.has(o)?!c.has(a)||L.has(a)?N(e):j.has(o)?p--:f.get(a)>f.get(o)?(j.add(a),N(e)):(L.add(o),p--):(i(n,c),p--)}for(;p--;){const e=t[p];m.has(e.key)||i(e,c)}for(;M;)N(g[M-1]);return g}function bind(t,e,n){const a=t.$$.props[e];void 0!==a&&(t.$$.bound[a]=n,n(t.$$.ctx[a]))}function create_component(t){t&&t.c()}function mount_component(t,e,n){const{fragment:a,on_mount:o,on_destroy:r,after_update:c}=t.$$;a&&a.m(e,n),add_render_callback(()=>{const e=o.map(run).filter(is_function);r?r.push(...e):run_all(e),t.$$.on_mount=[]}),c.forEach(add_render_callback)}function destroy_component(t,e){const n=t.$$;null!==n.fragment&&(run_all(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function make_dirty(t,e){-1===t.$$.dirty[0]&&(dirty_components.push(t),schedule_update(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function init(t,e,n,a,o,r,c=[-1]){const l=current_component;set_current_component(t);const i=e.props||{},s=t.$$={fragment:null,ctx:null,props:r,update:noop,not_equal:o,bound:blank_object(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(l?l.$$.context:[]),callbacks:blank_object(),dirty:c};let u=!1;s.ctx=n?n(t,i,(e,n,a=n)=>(s.ctx&&o(s.ctx[e],s.ctx[e]=a)&&(s.bound[e]&&s.bound[e](a),u&&make_dirty(t,e)),n)):[],s.update(),u=!0,run_all(s.before_update),s.fragment=!!a&&a(s.ctx),e.target&&(e.hydrate?s.fragment&&s.fragment.l(children(e.target)):s.fragment&&s.fragment.c(),e.intro&&transition_in(t.$$.fragment),mount_component(t,e.target,e.anchor),flush()),set_current_component(l)}class SvelteComponent{$destroy(){destroy_component(this,1),this.$destroy=noop}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(){}}class Tailwindcss extends SvelteComponent{constructor(t){super(),init(this,t,null,null,safe_not_equal,{})}}function get_each_context(t,e,n){const a=t.slice();return a[9]=e[n],a}function create_each_block(t){let e,n,a,o=t[9].toUpperCase()+"";function r(...e){return t[7](t[9],...e)}return{c(){e=element("li"),n=text(o),attr(e,"class","dropdown-li svelte-24i4z8"),a=listen(e,"click",r)},m(t,a){insert(t,e,a),append(e,n)},p(e,a){t=e,2&a[0]&&o!==(o=t[9].toUpperCase()+"")&&set_data(n,o)},d(t){t&&detach(e),a()}}}function create_fragment(t){let e,n,a,o,r,c,l,i,s,u,d=t[0].toUpperCase()+"",p=t[1],M=[];for(let e=0;e<p.length;e+=1)M[e]=create_each_block(get_each_context(t,p,e));return{c(){e=element("div"),n=element("button"),a=element("span"),o=text(d),r=space(),c=svg_element("svg"),l=svg_element("path"),i=space(),s=element("ul");for(let t=0;t<M.length;t+=1)M[t].c();attr(a,"class","mr-1"),attr(l,"d","M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"),attr(c,"class","fill-current h-4 w-4"),attr(c,"xmlns","http://www.w3.org/2000/svg"),attr(c,"viewBox","0 0 20 20"),attr(n,"class","monocle:text-sm phone:text-sm bg-motw-red text-white font-bold p-2 inline-flex items-center text-lg focus:outline-none active:text-red-200"),attr(s,"class","dropdown-menu absolute text-white pt-1 w-full monocle:text-sm phone:text-sm text-lg cursor-pointer svelte-24i4z8"),toggle_class(s,"hidelist",t[2]),toggle_class(s,"showlist",!t[2]),attr(e,"class","dropdown inline-block relative"),u=[listen(n,"click",t[4]),listen(e,"mouseleave",t[8])]},m(t,u){insert(t,e,u),append(e,n),append(n,a),append(a,o),append(n,r),append(n,c),append(c,l),append(e,i),append(e,s);for(let t=0;t<M.length;t+=1)M[t].m(s,null)},p(t,e){if(1&e[0]&&d!==(d=t[0].toUpperCase()+"")&&set_data(o,d),10&e[0]){let n;for(p=t[1],n=0;n<p.length;n+=1){const a=get_each_context(t,p,n);M[n]?M[n].p(a,e):(M[n]=create_each_block(a),M[n].c(),M[n].m(s,null))}for(;n<M.length;n+=1)M[n].d(1);M.length=p.length}4&e[0]&&toggle_class(s,"hidelist",t[2]),4&e[0]&&toggle_class(s,"showlist",!t[2])},i:noop,o:noop,d(t){t&&detach(e),destroy_each(M,t),run_all(u)}}}function instance(t,e,n){let{defaultItem:a="authors"}=e,{droplist:o=["titles","tags"]}=e,{selectedItem:r=a}=e;const c=createEventDispatcher();let l=!0;function i(t){n(5,r=t),n(2,l=!0)}return t.$set=t=>{"defaultItem"in t&&n(0,a=t.defaultItem),"droplist"in t&&n(1,o=t.droplist),"selectedItem"in t&&n(5,r=t.selectedItem)},[a,o,l,i,function(){c("dropdownClick"),n(2,l=!l)},r,c,t=>i(t),()=>n(2,l=!0)]}class Dropdown extends SvelteComponent{constructor(t){super(),init(this,t,instance,create_fragment,safe_not_equal,{defaultItem:0,droplist:1,selectedItem:5})}}const subscriber_queue=[];function readable(t,e){return{subscribe:writable(t,e).subscribe}}function writable(t,e=noop){let n;const a=[];function o(e){if(safe_not_equal(t,e)&&(t=e,n)){const e=!subscriber_queue.length;for(let e=0;e<a.length;e+=1){const n=a[e];n[1](),subscriber_queue.push(n,t)}if(e){for(let t=0;t<subscriber_queue.length;t+=2)subscriber_queue[t][0](subscriber_queue[t+1]);subscriber_queue.length=0}}}return{set:o,update:function(e){o(e(t))},subscribe:function(r,c=noop){const l=[r,c];return a.push(l),1===a.length&&(n=e(o)||noop),r(t),()=>{const t=a.indexOf(l);-1!==t&&a.splice(t,1),0===a.length&&(n(),n=null)}}}}const lasthash=writable('["",""]'),restapi=readable("https://books.memoryoftheworld.org/");function dynamicSort(t){var e=1;return"-"===t[0]&&(e=-1,t=t.substr(1)),function(n,a){return-1==e?a[t].localeCompare(n[t]):n[t].localeCompare(a[t])}}function mockHttpRequest(t,e,n,a="books"){let o=new URL(e),r=o.pathname.split("/"),c=r[1],l=r[2],i=decodeURIComponent(r[3]);if("librarians"==c&&"on"==l){let e=new Set;for(let n of t)e.add(n.librarian);return{_items:[...e]}}if("autocomplete"==c){if("authors"==l){let e=[];for(let n of t)for(let t of n.authors)-1!=t.toLowerCase().indexOf(r[3].toLowerCase())&&e.push(t);return{_items:e}}if("tags"==l){let e=[];for(let n of t)for(let t of n.tags)-1!=t.toLowerCase().indexOf(r[3].toLowerCase())&&e.push(t);return{_items:e}}if("titles"==l){let e=[];for(let n of t)-1!=n.title.toLowerCase().indexOf(r[3].toLowerCase())&&e.push(n.title);return{_items:e}}}if("search"==c){a="search in "+l;let e=[];for(let n of t)if(["authors","languages","tags"].includes(l))for(let t of n[l])-1!=t.toLowerCase().indexOf(i.toLowerCase())&&e.push(n);else["_id","title","titles","publisher","series","library_uuid","abstract","librarian"].includes(l)&&("titles"==l&&(l="title"),-1!=n[l].toLowerCase().indexOf(i.toLowerCase())&&e.push(n));t=e}if("book"==c){for(let e of t)if(e._id==l)return e.library_url="",e;if(CALIBRE_BOOKS1.total-t.length>0)return"TRYAGAIN"}let s={};for(let t of o.searchParams.entries())s[t[0]]=t[1];let u=s.page||0,d=Math.floor(t.length/n+1),p=Math.max(0,Math.min(d,u-1)),M=p*n,h=(p+1)*n,_=[];for(let e of t.slice(M,h))e.library_url="",_.push(e);let g={_items:_,_links:{parent:{title:"Memory of the World Library",href:"/"},self:{title:a,href:`${a}/${l}/${i}`},prev:{title:"previous page",href:`${o.pathname}?page=${p}`},next:{title:"next page",href:`${o.pathname}?page=${p+2}`},last:{title:"last page",href:`${o.pathname}?page=${d}`}},_meta:{page:p+1,max_results:n,total:t.length,status:a}};return 0==p&&delete g._links.prev,p==d-1&&delete g._links.next,g}const motw_reverse_svg="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2Ij48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLjE0MjkgMCAwIDEuMTQyOSAtMjIuODU3IC05MzAuNDEpIj48cGF0aCBkPSJNMjQzLjg3IDkyMC4wNWEzLjgxID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43MDgtMS41OTMgMS43Ny0yLjMgMy41NC0yLjNIMzYuNzZ2LTI2LjJjMC0xLjA2Mi4zNTQtMS45NDcgMS4wNjItMi42NTVzMS41OTMtMS4wNjIgMi42NTUtMS4wNjJoMTUuMDQ3YzEuMDYyIDAgMS45NDcuMzU0IDIuNjU1IDEuMDYyUzU5LjI0IDUuNzggNTkuMjQgNi44NDJ2MjYuMmgxNS4wNDdjMS40MTYgMCAyLjY1NS44ODUgMy4zNjMgMi4zeiIgZmlsbD0iIzAwMCIvPjwvc3ZnPgo=";function create_else_block(t){let e;return{c(){e=text("list")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block(t){let e;return{c(){e=text("covers")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_fragment$1(t){let e,n,a,o,r,c,l,i,s,u,d,p,M,h,_;function g(e){t[8].call(null,e)}let m={defaultItem:"LIBRARIANS",droplist:t[1]};void 0!==t[2]&&(m.selectedItem=t[2]);const f=new Dropdown({props:m});function L(t,e){return t[0]?create_if_block:create_else_block}binding_callbacks.push(()=>bind(f,"selectedItem",g)),f.$on("dropdownClick",t[3]);let j=L(t),N=j(t);return{c(){e=element("div"),n=element("div"),a=element("img"),r=space(),c=element("div"),c.innerHTML='<div class="hamburger-icon content-center svelte-18c4dj9"> </div>',l=space(),create_component(f.$$.fragment),s=space(),u=element("div"),d=text("show "),N.c(),p=space(),M=element("a"),M.textContent="MEMORY OF THE WORLD",attr(a,"alt","let's share books"),attr(a,"class","cursor-pointer pt-1 pl-1 pr-1 h-10 monocle:h-8 phone:h-8"),a.src!==(o=motw_reverse_svg)&&attr(a,"src",o),attr(c,"class","pt-4 pl-1 pr-1 monocle:hidden phone:hidden"),attr(n,"class","inline-flex bg-motw-red"),attr(u,"class","hover:underline cursor-pointer pt-2 text-motw-blue bg-white text-base font-bold text-center monocle:pr-1 phone:pr-1"),attr(M,"class","motw-bookmark hover:underline monocle:hidden phone:hidden flex text-lg font-bold pr-5 h-0 text-white items-center bg-motw-red svelte-18c4dj9"),attr(M,"href","https://www.memoryoftheworld.org"),attr(e,"class","flex mb-1 mt-1 justify-between w-full"),_=[listen(a,"click",t[7]),listen(u,"click",t[4])]},m(t,o){insert(t,e,o),append(e,n),append(n,a),append(n,r),append(n,c),append(n,l),mount_component(f,n,null),append(e,s),append(e,u),append(u,d),N.m(u,null),append(e,p),append(e,M),h=!0},p(t,e){const n={};2&e[0]&&(n.droplist=t[1]),!i&&4&e[0]&&(i=!0,n.selectedItem=t[2],add_flush_callback(()=>i=!1)),f.$set(n),j!==(j=L(t))&&(N.d(1),N=j(t),N&&(N.c(),N.m(u,null)))},i(t){h||(transition_in(f.$$.fragment,t),h=!0)},o(t){transition_out(f.$$.fragment,t),h=!1},d(t){t&&detach(e),destroy_component(f),N.d(),run_all(_)}}}function instance$1(t,e,n){let a;component_subscribe(t,restapi,t=>n(6,a=t));let o,{mock:r}=e,c=[],{t:l}=e;return t.$set=t=>{"mock"in t&&n(5,r=t.mock),"t"in t&&n(0,l=t.t)},t.$$.update=()=>{4&t.$$.dirty[0]&&o&&"LIBRARIANS"!==o&&(location.hash="#/search/librarian/"+o.toLowerCase())},[l,c,o,async function(){var t=a+"librarians/on";if(r)var e=mockHttpRequest(CALIBRE_BOOKS1.books,t,48,"books");else{const n=await fetch(t);e=await n.json()}n(1,c=e._items.sort())},function(){n(0,l=!l)},r,a,()=>location.hash="",function(t){o=t,n(2,o)}]}class MotwHeader extends SvelteComponent{constructor(t){super(),init(this,t,instance$1,create_fragment$1,safe_not_equal,{mock:5,t:0})}}function get_each_context$1(t,e,n){const a=t.slice();return a[23]=e[n],a[25]=n,a}function create_each_block$1(t){let e,n,a,o,r=t[23]+"";return{c(){e=element("li"),n=text(r),attr(e,"class",a=cssCandidate+" modulo"+t[25]%2+" svelte-14w2vqu"),o=[listen(e,"mouseover",highlightCandidate),listen(e,"mouseout",dimlightCandidate)]},m(t,a){insert(t,e,a),append(e,n)},p(t,e){64&e[0]&&r!==(r=t[23]+"")&&set_data(n,r)},d(t){t&&detach(e),run_all(o)}}}function create_fragment$2(t){let e,n,a,o,r,c,l,i,s,u,d,p,M;function h(e){t[20].call(null,e)}let _={defaultItem:t[3],droplist:t[4]};void 0!==t[5]&&(_.selectedItem=t[5]);const g=new Dropdown({props:_});binding_callbacks.push(()=>bind(g,"selectedItem",h));let m=t[6],f=[];for(let e=0;e<m.length;e+=1)f[e]=create_each_block$1(get_each_context$1(t,m,e));return{c(){e=element("div"),create_component(g.$$.fragment),a=space(),o=element("div"),r=element("input"),c=space(),l=element("ul");for(let t=0;t<f.length;t+=1)f[t].c();i=space(),s=element("button"),s.textContent="SEARCH",u=space(),d=element("div"),d.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" class="object-scaled-down" clip-rule="evenodd" stroke="none" stroke-width="0" fill="white" width="24px" height="24px"><path d="M21.172 24l-7.387-7.387c-1.388.874-3.024 1.387-4.785 1.387-4.971 0-9-4.029-9-9s4.029-9 9-9 9 4.029 9 9c0 1.761-.514 3.398-1.387 4.785l7.387 7.387-2.828 2.828zm-12.172-8c3.859 0 7-3.14 7-7s-3.141-7-7-7-7 3.14-7 7 3.141 7 7 7zm-3-8c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm3 0c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1zm3 0c.552 0 1 .448 1 1s-.448 1-1 1-1-.448-1-1 .448-1 1-1z"></path></svg>',attr(r,"class","monocle:text-sm phone:text-sm appearance-none mt-3 border-b-4 border-motw-red focus:outline-none w-full pl-2 text-lg svelte-14w2vqu"),attr(r,"type","text"),attr(r,"aria-label","Search"),attr(r,"placeholder","Search"),toggle_class(r,"zeroBottomBorder",t[1]),attr(l,"id","candidateList"),attr(l,"class","candilist hidden cursor-pointer absolute z-50 w-full text-lg overflow-y-auto svelte-14w2vqu"),toggle_class(l,"showCandidates",t[1]),attr(o,"class","relative w-full"),attr(s,"class","monocle:hidden phone:hidden bg-motw-red active:text-red-200 focus:outline-none text-white p-2 font-bold text-lg hover:underline"),attr(s,"type","button"),attr(s,"name","B"),attr(d,"class","bg-motw-red phablet:hidden p-1"),attr(e,"class","inline-flex w-full"),M=[listen(r,"input",t[21]),listen(r,"click",t[9]),listen(r,"keyup",t[8]),listen(r,"focusout",t[10]),listen(s,"click",t[7]),listen(d,"click",t[7])]},m(n,M){insert(n,e,M),mount_component(g,e,null),append(e,a),append(e,o),append(o,r),set_input_value(r,t[0]),append(o,c),append(o,l);for(let t=0;t<f.length;t+=1)f[t].m(l,null);t[22](l),append(e,i),append(e,s),append(e,u),append(e,d),p=!0},p(t,e){const a={};if(8&e[0]&&(a.defaultItem=t[3]),16&e[0]&&(a.droplist=t[4]),!n&&32&e[0]&&(n=!0,a.selectedItem=t[5],add_flush_callback(()=>n=!1)),g.$set(a),1&e[0]&&r.value!==t[0]&&set_input_value(r,t[0]),2&e[0]&&toggle_class(r,"zeroBottomBorder",t[1]),64&e[0]){let n;for(m=t[6],n=0;n<m.length;n+=1){const a=get_each_context$1(t,m,n);f[n]?f[n].p(a,e):(f[n]=create_each_block$1(a),f[n].c(),f[n].m(l,null))}for(;n<f.length;n+=1)f[n].d(1);f.length=m.length}2&e[0]&&toggle_class(l,"showCandidates",t[1])},i(t){p||(transition_in(g.$$.fragment,t),p=!0)},o(t){transition_out(g.$$.fragment,t),p=!1},d(n){n&&detach(e),destroy_component(g),destroy_each(f,n),t[22](null),run_all(M)}}}const cssCandidate="pl-2 text-lg",cssSelectedCandidate="pl-2 border-b-2 border-motw-red italic font-bold";function setSelectedCandidate(t){if(t){var e=" modulo1";t.className.includes("modulo0")?(t.style.backgroundColor="#e7e7e7",e=" modulo0"):t.style.backgroundColor="#ffffff",t.className=cssSelectedCandidate+e,t.id="selectedCandidate"}}function resetSelectedCandidate(t){if(t){var e=" modulo1";t.className.includes("modulo0")?(t.style.backgroundColor="#e7e7e7",e=" modulo0"):t.style.backgroundColor="#ffffff",t.className=cssCandidate+e,t.id=""}}function highlightCandidate(t){setSelectedCandidate(t.target)}function dimlightCandidate(t){resetSelectedCandidate(t.target)}function instance$2(t,e,n){let a;component_subscribe(t,restapi,t=>n(15,a=t));let o,r,{mock:c}=e,l=[],i=!1,s="",u=document.getElementById("selectedCandidate"),d=!1,p={authors:new Set,titles:new Set,tags:new Set},M="authors",h=["titles","tags"],_=[M].concat(h),g=M;async function m(t){var e=t.toLowerCase(),o=`${a}autocomplete/${g}/${e}`;if(n(12,l=[...Array.from(p[g])]),4===t.length){if(c)var i=mockHttpRequest(CALIBRE_BOOKS1.books,o,48);else{const t=await fetch(o);i=await t.json()}i._items.forEach(t=>p[g].add(t));var s=[...Array.from(p[g])].sort();n(12,l=s),l.length>0&&n(6,r=l.filter(e=>-1!==e.toLowerCase().indexOf(t.toLowerCase())))}}function f(t){o&&o.scroll(0,0),i=!1,u=document.getElementById("selectedCandidate"),resetSelectedCandidate(u),u=!1,"string"==typeof t&&n(0,s=t),d&&n(1,d=!1)}return t.$set=t=>{"mock"in t&&n(11,c=t.mock)},t.$$.update=()=>{56&t.$$.dirty[0]&&g!=M&&(n(3,M=g),n(4,h=[]),_.forEach(t=>{t!==M&&h.push(t)}),n(12,l=[...Array.from(p[M])]),f("")),4097&t.$$.dirty[0]&&n(6,r=l.filter(t=>-1!==t.toLowerCase().indexOf(s.toLowerCase()))),1&t.$$.dirty[0]&&m(s)},[s,d,o,M,h,g,r,function(t){location.hash=`#/search/${g}/${s}`},function(t){if(["ArrowLeft","ArrowRight","Backspace","Delete"].includes(t.key)&&f(s),u=document.getElementById("selectedCandidate"),"Enter"==t.key)return u&&n(0,s=u.innerText.toLowerCase()),location.hash=`#/search/${g}/${s.toLowerCase()}`,void f(s);if("Escape"!=t.key){if(r&&("ArrowDown"==t.key||s.length>0)&&n(1,d=!0),["ArrowDown","ArrowUp"].includes(t.key)){if(!u)return void setSelectedCandidate(o.firstChild);resetSelectedCandidate(u),"ArrowDown"==t.key?u.nextSibling?setSelectedCandidate(u.nextSibling):(setSelectedCandidate(o.firstChild),u=document.getElementById("selectedCandidate")):u.previousSibling?setSelectedCandidate(u.previousSibling):(setSelectedCandidate(o.lastChild),u=document.getElementById("selectedCandidate")),window.scroll(0,0),u.scrollIntoView({behavior:"smooth",block:"center"})}}else f("")},function(t){i&&0==s.length?(n(1,d=!0),i=!1):(f(s),i=!0)},function(t){d&&n(1,d=!1),u=document.getElementById("selectedCandidate"),u&&(n(0,s=u.innerText.toLowerCase()),location.hash=`#/search/${g}/${s.toLowerCase()}`,f(s))},c,l,i,u,a,p,_,m,f,function(t){g=t,n(5,g)},function(){s=this.value,n(0,s)},function(t){binding_callbacks[t?"unshift":"push"](()=>{n(2,o=t)})}]}class SearchBar extends SvelteComponent{constructor(t){super(),init(this,t,instance$2,create_fragment$2,safe_not_equal,{mock:11})}}function create_else_block_1(t){let e;return{c(){e=element("span"),e.textContent="<<prev    ",attr(e,"class","text-white cursor-default select-none")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block_1(t){let e,n,a;return{c(){e=element("a"),n=text("<< prev    "),attr(e,"href",a="#"+t[0].prev.href),attr(e,"class","hover:underline items-start text-motw-blue")},m(t,a){insert(t,e,a),append(e,n)},p(t,n){1&n[0]&&a!==(a="#"+t[0].prev.href)&&attr(e,"href",a)},d(t){t&&detach(e)}}}function create_else_block$1(t){let e;return{c(){e=element("span"),e.textContent="    next >>",attr(e,"class","text-white cursor-default select-nonE")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block$1(t){let e,n,a;return{c(){e=element("a"),n=text("    next >>"),attr(e,"href",a="#"+t[0].next.href),attr(e,"class","hover:underline text-motw-blue")},m(t,a){insert(t,e,a),append(e,n)},p(t,n){1&n[0]&&a!==(a="#"+t[0].next.href)&&attr(e,"href",a)},d(t){t&&detach(e)}}}function create_fragment$3(t){let e,n,a,o,r,c,l,i=t[0].searchStatus+"";function s(t,e){return(null==n||1&e[0])&&(n=!!(Object.keys(t[0]).indexOf("prev")+1)),n?create_if_block_1:create_else_block_1}let u=s(t,-1),d=u(t);function p(t,e){return(null==l||1&e[0])&&(l=!!(Object.keys(t[0]).indexOf("next")+1)),l?create_if_block$1:create_else_block$1}let M=p(t,-1),h=M(t);return{c(){e=element("div"),d.c(),a=space(),o=element("span"),r=text(i),c=space(),h.c(),attr(o,"class","text-center text-black"),attr(e,"class","flex justify-between bg-white sticky top-0 w-full z-40 p-2 items-baseline items-stretch text-base font-bold monocle:text-xs phone:text-xs")},m(t,n){insert(t,e,n),d.m(e,null),append(e,a),append(e,o),append(o,r),append(e,c),h.m(e,null)},p(t,n){u===(u=s(t,n))&&d?d.p(t,n):(d.d(1),d=u(t),d&&(d.c(),d.m(e,a))),1&n[0]&&i!==(i=t[0].searchStatus+"")&&set_data(r,i),M===(M=p(t,n))&&h?h.p(t,n):(h.d(1),h=M(t),h&&(h.c(),h.m(e,null)))},i:noop,o:noop,d(t){t&&detach(e),d.d(),h.d()}}}function instance$3(t,e,n){let{navbarLinks:a}=e;return t.$set=t=>{"navbarLinks"in t&&n(0,a=t.navbarLinks)},[a]}class NavBar extends SvelteComponent{constructor(t){super(),init(this,t,instance$3,create_fragment$3,safe_not_equal,{navbarLinks:0})}}function readableBytes(t){var e=Math.floor(Math.log(t)/Math.log(1024));return 1*(t/Math.pow(1024,e)).toFixed(2)+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][e]}function getFormats(t,e=", "){if(void 0===t.formats||0==t.formats.length)return[{url:"",size:"",title:""}];let n=[];for(let a of t.formats){let o=t.library_url+a.dir_path+a.file_name,r=a.format.toUpperCase()+e;n.push({url:o,title:r,size:readableBytes(a.size)})}return n[n.length-1].title=n[n.length-1].title.slice(0,-2),n}function get_each_context$2(t,e,n){const a=t.slice();return a[4]=e[n],a}function get_each_context_1(t,e,n){const a=t.slice();return a[7]=e[n],a[9]=n,a}function create_if_block_4(t){let e,n,a,o=t[7]+"";return{c(){e=element("a"),n=text(o),attr(e,"title","search in authors"),attr(e,"href",a="#/search/authors/"+t[7]),attr(e,"class","hover:underline")},m(t,a){insert(t,e,a),append(e,n)},p(t,r){1&r[0]&&o!==(o=t[7]+"")&&set_data(n,o),1&r[0]&&a!==(a="#/search/authors/"+t[7])&&attr(e,"href",a)},d(t){t&&detach(e)}}}function create_if_block_3(t){let e;return{c(){e=text(" et al.")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_2(t){let e;return{c(){e=text(", ")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block_1(t){let e,n,a=t[9]+1<4&&create_if_block_4(t);function o(t,e){return t[9]+1!==t[0].authors.length&&t[9]+t[9]<4?create_if_block_2:t[9]+t[9]===4?create_if_block_3:void 0}let r=o(t),c=r&&r(t);return{c(){a&&a.c(),e=empty(),c&&c.c(),n=empty()},m(t,o){a&&a.m(t,o),insert(t,e,o),c&&c.m(t,o),insert(t,n,o)},p(t,e){t[9]+1<4&&a.p(t,e),r!==(r=o(t))&&(c&&c.d(1),c=r&&r(t),c&&(c.c(),c.m(n.parentNode,n)))},d(t){a&&a.d(t),t&&detach(e),c&&c.d(t),t&&detach(n)}}}function create_if_block_1$1(t){let e,n,a,o,r,c=t[0].librarian+"";return{c(){e=element("div"),n=text("via "),a=element("a"),o=text(c),attr(a,"title","search in librarians"),attr(a,"class","hover:underline cursor-pointer"),attr(a,"href",r="#/search/librarian/"+t[0].librarian),attr(e,"class","pb-2")},m(t,r){insert(t,e,r),append(e,n),append(e,a),append(a,o)},p(t,e){1&e[0]&&c!==(c=t[0].librarian+"")&&set_data(o,c),1&e[0]&&r!==(r="#/search/librarian/"+t[0].librarian)&&attr(a,"href",r)},d(t){t&&detach(e)}}}function create_else_block$2(t){let e;return{c(){e=element("span"),e.textContent=".",attr(e,"class","text-black")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block$2(t){let e,n=getFormats(t[0]),a=[];for(let e=0;e<n.length;e+=1)a[e]=create_each_block$2(get_each_context$2(t,n,e));return{c(){for(let t=0;t<a.length;t+=1)a[t].c();e=empty()},m(t,n){for(let e=0;e<a.length;e+=1)a[e].m(t,n);insert(t,e,n)},p(t,o){if(1&o[0]){let r;for(n=getFormats(t[0]),r=0;r<n.length;r+=1){const c=get_each_context$2(t,n,r);a[r]?a[r].p(c,o):(a[r]=create_each_block$2(c),a[r].c(),a[r].m(e.parentNode,e))}for(;r<a.length;r+=1)a[r].d(1);a.length=n.length}},d(t){destroy_each(a,t),t&&detach(e)}}}function create_each_block$2(t){let e,n,a,o,r,c,l,i=t[4].title+"";return{c(){e=element("a"),n=element("img"),o=element("i"),r=text(i),attr(n,"class","w-4 inline-block"),attr(n,"alt","dl"),n.src!==(a=download_svg)&&attr(n,"src",a),attr(e,"class","hover:underline inline-block p-1"),attr(e,"href",c=t[4].url),attr(e,"title",l=t[4].size)},m(t,a){insert(t,e,a),append(e,n),append(e,o),append(o,r)},p(t,n){1&n[0]&&i!==(i=t[4].title+"")&&set_data(r,i),1&n[0]&&c!==(c=t[4].url)&&attr(e,"href",c),1&n[0]&&l!==(l=t[4].size)&&attr(e,"title",l)},d(t){t&&detach(e)}}}function create_fragment$4(t){let e,n,a,o,r,c,l,i,s,u,d,p,M,h,_,g=t[0].title+"",m=t[0].authors,f=[];for(let e=0;e<m.length;e+=1)f[e]=create_each_block_1(get_each_context_1(t,m,e));let L=t[1]&&create_if_block_1$1(t);function j(t,e){return null!=t[0].formats&&0!=t[0].formats.length?create_if_block$2:create_else_block$2}let N=j(t),b=N(t);return{c(){e=element("div"),n=element("img"),o=space(),r=element("div"),c=element("a"),l=text(g),i=text(" "),u=space(),d=element("div");for(let t=0;t<f.length;t+=1)f[t].c();p=space(),M=element("div"),L&&L.c(),h=space(),b.c(),attr(n,"title","show book card"),attr(n,"class","w-full min-h-full text-white"),n.src!==(a=t[0].library_url+t[0].cover_url)&&attr(n,"src",a),attr(n,"alt",""),attr(c,"title","show book card"),attr(c,"href",s="#/book/"+t[0]._id),attr(c,"class","pl-2 block hover:underline"),attr(d,"class","pl-2 not-italic text-base suv:text-sm block"),attr(r,"class","bg-black text-white absolute top-0 mt-4 font-bold text-base suv:text-sm w-full"),attr(M,"class","bg-black text-white absolute w-full bottom-0 pl-2"),attr(e,"class","cover monocle:w-full phone:w-1/2 phablet:w-1/3 tablet:w-1/4 laptop:w-1/6 suv:w-1/12 relative bg-white border-white border-2 svelte-18010u"),_=[listen(n,"click",t[3]),listen(e,"mouseenter",t[2])]},m(t,a){insert(t,e,a),append(e,n),append(e,o),append(e,r),append(r,c),append(c,l),append(c,i),append(r,u),append(r,d);for(let t=0;t<f.length;t+=1)f[t].m(d,null);append(e,p),append(e,M),L&&L.m(M,null),append(M,h),b.m(M,null)},p(t,e){if(1&e[0]&&n.src!==(a=t[0].library_url+t[0].cover_url)&&attr(n,"src",a),1&e[0]&&g!==(g=t[0].title+"")&&set_data(l,g),1&e[0]&&s!==(s="#/book/"+t[0]._id)&&attr(c,"href",s),1&e[0]){let n;for(m=t[0].authors,n=0;n<m.length;n+=1){const a=get_each_context_1(t,m,n);f[n]?f[n].p(a,e):(f[n]=create_each_block_1(a),f[n].c(),f[n].m(d,null))}for(;n<f.length;n+=1)f[n].d(1);f.length=m.length}t[1]?L?L.p(t,e):(L=create_if_block_1$1(t),L.c(),L.m(M,h)):L&&(L.d(1),L=null),N===(N=j(t))&&b?b.p(t,e):(b.d(1),b=N(t),b&&(b.c(),b.m(M,null)))},i:noop,o:noop,d(t){t&&detach(e),destroy_each(f,t),L&&L.d(),b.d(),run_all(_)}}}function instance$4(t,e,n){let{book:a}=e,o=!1;return t.$set=t=>{"book"in t&&n(0,a=t.book)},[a,o,function(){n(1,o=!0),setTimeout(()=>n(1,o=!1),3e3)},()=>window.location.hash="#/book/"+a._id]}class BookCard extends SvelteComponent{constructor(t){super(),init(this,t,instance$4,create_fragment$4,safe_not_equal,{book:0})}}function get_each_context$3(t,e,n){const a=t.slice();return a[1]=e[n],a}function create_each_block$3(t,e){let n,a;const o=new BookCard({props:{book:e[1]}});return{key:t,first:null,c(){n=empty(),create_component(o.$$.fragment),this.first=n},m(t,e){insert(t,n,e),mount_component(o,t,e),a=!0},p(t,e){const n={};1&e[0]&&(n.book=t[1]),o.$set(n)},i(t){a||(transition_in(o.$$.fragment,t),a=!0)},o(t){transition_out(o.$$.fragment,t),a=!1},d(t){t&&detach(n),destroy_component(o,t)}}}function create_fragment$5(t){let e,n,a=[],o=new Map,r=t[0];const c=t=>t[1]._id;for(let e=0;e<r.length;e+=1){let n=get_each_context$3(t,r,e),l=c(n);o.set(l,a[e]=create_each_block$3(l,n))}return{c(){e=element("div");for(let t=0;t<a.length;t+=1)a[t].c();attr(e,"class","flex flex-wrap font-bold italic")},m(t,o){insert(t,e,o);for(let t=0;t<a.length;t+=1)a[t].m(e,null);n=!0},p(t,n){const r=t[0];group_outros(),a=update_keyed_each(a,n,c,1,t,r,o,e,outro_and_destroy_block,create_each_block$3,null,get_each_context$3),check_outros()},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(a[t]);n=!0}},o(t){for(let t=0;t<a.length;t+=1)transition_out(a[t]);n=!1},d(t){t&&detach(e);for(let t=0;t<a.length;t+=1)a[t].d()}}}function instance$5(t,e,n){let{books:a}=e;return t.$set=t=>{"books"in t&&n(0,a=t.books)},[a]}class LibraryCovers extends SvelteComponent{constructor(t){super(),init(this,t,instance$5,create_fragment$5,safe_not_equal,{books:0})}}function get_each_context_1$1(t,e,n){const a=t.slice();return a[5]=e[n],a}function get_each_context_2(t,e,n){const a=t.slice();return a[8]=e[n],a[10]=n,a}function get_each_context$4(t,e,n){const a=t.slice();return a[2]=e[n],a}function create_if_block$3(t){let e,n=t[2].authors,a=[];for(let e=0;e<n.length;e+=1)a[e]=create_each_block_2(get_each_context_2(t,n,e));return{c(){e=element("div");for(let t=0;t<a.length;t+=1)a[t].c();attr(e,"class","monocle:text-xs phone:text-xs")},m(t,n){insert(t,e,n);for(let t=0;t<a.length;t+=1)a[t].m(e,null)},p(t,o){if(1&o[0]){let r;for(n=t[2].authors,r=0;r<n.length;r+=1){const c=get_each_context_2(t,n,r);a[r]?a[r].p(c,o):(a[r]=create_each_block_2(c),a[r].c(),a[r].m(e,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=n.length}},d(t){t&&detach(e),destroy_each(a,t)}}}function create_if_block_3$1(t){let e,n,a,o=t[8]+"";return{c(){e=element("a"),n=text(o),attr(e,"title","search in authors"),attr(e,"href",a="#/search/authors/"+t[8]),attr(e,"class","hover:underline svelte-cty6wm")},m(t,a){insert(t,e,a),append(e,n)},p(t,r){1&r[0]&&o!==(o=t[8]+"")&&set_data(n,o),1&r[0]&&a!==(a="#/search/authors/"+t[8])&&attr(e,"href",a)},d(t){t&&detach(e)}}}function create_if_block_2$1(t){let e;return{c(){e=text(" et al.")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_1$2(t){let e,n;return{c(){e=text(","),n=element("br")},m(t,a){insert(t,e,a),insert(t,n,a)},d(t){t&&detach(e),t&&detach(n)}}}function create_each_block_2(t){let e,n,a=t[10]+1<4&&create_if_block_3$1(t);function o(t,e){return t[10]+1!==t[2].authors.length&&t[10]+t[10]<4?create_if_block_1$2:t[10]+1===4?create_if_block_2$1:void 0}let r=o(t),c=r&&r(t);return{c(){a&&a.c(),e=empty(),c&&c.c(),n=empty()},m(t,o){a&&a.m(t,o),insert(t,e,o),c&&c.m(t,o),insert(t,n,o)},p(t,e){t[10]+1<4&&a.p(t,e),r!==(r=o(t))&&(c&&c.d(1),c=r&&r(t),c&&(c.c(),c.m(n.parentNode,n)))},d(t){a&&a.d(t),t&&detach(e),c&&c.d(t),t&&detach(n)}}}function create_each_block_1$1(t){let e,n,a,o,r,c=t[5].title+"";return{c(){e=element("a"),n=text(c),r=element("br"),attr(e,"href",a=t[5].url),attr(e,"title",o=t[5].size),attr(e,"class","svelte-cty6wm")},m(t,a){insert(t,e,a),append(e,n),insert(t,r,a)},p(t,r){1&r[0]&&c!==(c=t[5].title+"")&&set_data(n,c),1&r[0]&&a!==(a=t[5].url)&&attr(e,"href",a),1&r[0]&&o!==(o=t[5].size)&&attr(e,"title",o)},d(t){t&&detach(e),t&&detach(r)}}}function create_each_block$4(t,e){let n,a,o,r,c,l,i,s,u,d,p,M,h=e[2].title+"",_=getYear(e[2])+"",g=e[2].authors&&create_if_block$3(e);function m(...t){return e[1](e[2],...t)}let f=getFormats(e[2]," "),L=[];for(let t=0;t<f.length;t+=1)L[t]=create_each_block_1$1(get_each_context_1$1(e,f,t));return{key:t,first:null,c(){n=element("tr"),a=element("td"),g&&g.c(),o=space(),r=element("td"),c=element("a"),l=text(h),i=text(_),u=space(),d=element("td");for(let t=0;t<L.length;t+=1)L[t].c();p=space(),attr(a,"class","phablet:pl-2 max-w-xs monocle:max-w-xs phone:max-w-xs svelte-cty6wm"),attr(c,"title","show book card"),attr(c,"href",s="#/book/"+e[2]._id),attr(c,"class","svelte-cty6wm"),attr(r,"class","italic w-11/12 phablet:pl-2 monocle:text-xs phone:text-xs svelte-cty6wm"),attr(d,"class","pr-1 pl-2 text-right phone:text-right phablet:pl-2 svelte-cty6wm"),attr(n,"class","svelte-cty6wm"),M=listen(r,"click",stop_propagation(m)),this.first=n},m(t,e){insert(t,n,e),append(n,a),g&&g.m(a,null),append(n,o),append(n,r),append(r,c),append(c,l),append(c,i),append(n,u),append(n,d);for(let t=0;t<L.length;t+=1)L[t].m(d,null);append(n,p)},p(t,n){if((e=t)[2].authors?g?g.p(e,n):(g=create_if_block$3(e),g.c(),g.m(a,null)):g&&(g.d(1),g=null),1&n[0]&&h!==(h=e[2].title+"")&&set_data(l,h),1&n[0]&&_!==(_=getYear(e[2])+"")&&set_data(i,_),1&n[0]&&s!==(s="#/book/"+e[2]._id)&&attr(c,"href",s),1&n[0]){let t;for(f=getFormats(e[2]," "),t=0;t<f.length;t+=1){const a=get_each_context_1$1(e,f,t);L[t]?L[t].p(a,n):(L[t]=create_each_block_1$1(a),L[t].c(),L[t].m(d,null))}for(;t<L.length;t+=1)L[t].d(1);L.length=f.length}},d(t){t&&detach(n),g&&g.d(),destroy_each(L,t),M()}}}function create_fragment$6(t){let e,n,a,o,r,c,l,i,s,u,d,p,M=[],h=new Map,_=t[0];const g=t=>t[2]._id;for(let e=0;e<_.length;e+=1){let n=get_each_context$4(t,_,e),a=g(n);h.set(a,M[e]=create_each_block$4(a,n))}return{c(){e=element("table"),n=element("thead"),a=element("tr"),o=element("th"),o.textContent="Authors",r=space(),c=element("th"),c.textContent="Title",l=space(),i=element("th"),s=element("img"),d=space(),p=element("tbody");for(let t=0;t<M.length;t+=1)M[t].c();attr(o,"class","monocle:w-1/3 phone:w-1/3 phablet:pl-2 px-1 pt-3 pb-1 w-1/4 svelte-cty6wm"),attr(c,"class","px-1 pt-3 pb-1 w-9/12 svelte-cty6wm"),attr(s,"class","w-4 pt-1 inline-block"),attr(s,"alt","dl"),s.src!==(u=bownload_svg)&&attr(s,"src",u),attr(i,"class","text-right pr-2 w-1/12 monocle:w-1/6 phone:w-1/6 svelte-cty6wm"),attr(a,"class","svelte-cty6wm"),attr(n,"class","border-motw-red border-b-2"),attr(e,"class","table-auto border-0 text-left w-full")},m(t,u){insert(t,e,u),append(e,n),append(n,a),append(a,o),append(a,r),append(a,c),append(a,l),append(a,i),append(i,s),append(e,d),append(e,p);for(let t=0;t<M.length;t+=1)M[t].m(p,null)},p(t,e){const n=t[0];M=update_keyed_each(M,e,g,1,t,n,h,p,destroy_block,create_each_block$4,null,get_each_context$4)},i:noop,o:noop,d(t){t&&detach(e);for(let t=0;t<M.length;t+=1)M[t].d()}}}function getYear(t){return t.year="",t.hasOwnProperty("pubdate")&&"0101"!==t.pubdate.slice(0,4)&&(t.year=` (${t.pubdate.slice(0,4)})`),t.year}function instance$6(t,e,n){let{books:a}=e;return t.$set=t=>{"books"in t&&n(0,a=t.books)},[a,t=>location.hash="#/book/"+t._id]}class LibraryTable extends SvelteComponent{constructor(t){super(),init(this,t,instance$6,create_fragment$6,safe_not_equal,{books:0})}}function HtmlWhitelistedSanitizer(t,e,n,a){if(this.escape=t,this.allowedTags=e,this.allowedCss=n,this.doc=document.implementation.createHTMLDocument(),null==a&&(a=["http://","https://"]),null==this.allowedTags){var o=function(t){return t},r={dir:o,lang:o,title:o},c=HtmlWhitelistedSanitizer.makeUrlSanitizer(a);this.allowedTags={a:HtmlWhitelistedSanitizer.mergeMap(r,{download:o,href:c,hreflang:o,ping:c,rel:o,target:o,type:o}),p:r,div:r,span:r,br:r,i:r,u:r}}null==this.allowedCss&&(this.allowedCss=[])}HtmlWhitelistedSanitizer.makeUrlSanitizer=function(t){return function(e){if(!e)return"";for(var n in t)if(e.startsWith(t[n]))return e;return""}},HtmlWhitelistedSanitizer.mergeMap=function(){var t={};for(var e in arguments)for(var n in arguments[e])t[n]=arguments[e][n];return t},HtmlWhitelistedSanitizer.prototype.sanitizeString=function(t){var e=this.doc.createElement("div");return e.innerHTML=t,this.sanitizeNode(e).innerHTML},HtmlWhitelistedSanitizer.prototype.sanitizeNode=function(t){var e=t.nodeName.toLowerCase();if("#text"==e)return t;if("#comment"==e)return this.doc.createTextNode("");if(!this.allowedTags.hasOwnProperty(e))return t.textContent?this.doc.createTextNode(t.textContent):this.doc.createTextNode("");for(var n=this.doc.createElement(e),a=0;a<t.attributes.length;a++){var o=t.attributes.item(a).name;if(this.allowedTags[e].hasOwnProperty(o)){var r=this.allowedTags[e][o];n.setAttribute(o,r(t.getAttribute(o)))}}for(var c in this.allowedCss)n.style[this.allowedCss[c]]=t.style[this.allowedCss[c]];for(;t.childNodes.length>0;){var l=t.removeChild(t.childNodes[0]);n.appendChild(this.sanitizeNode(l))}return n};const{window:window_1}=globals;function get_each_context$5(t,e,n){const a=t.slice();return a[7]=e[n],a[9]=n,a}function get_each_context_1$2(t,e,n){const a=t.slice();return a[10]=e[n],a[9]=n,a}function get_each_context_2$1(t,e,n){const a=t.slice();return a[12]=e[n],a}function get_each_context_3(t,e,n){const a=t.slice();return a[10]=e[n],a[9]=n,a}function create_if_block_12(t){let e,n=t[10]+"";return{c(){e=text(n)},m(t,n){insert(t,e,n)},p(t,a){1&a[0]&&n!==(n=t[10]+"")&&set_data(e,n)},d(t){t&&detach(e)}}}function create_if_block_11(t){let e;return{c(){e=text("et al.")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_10(t){let e;return{c(){e=text(", ")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block_3(t){let e,n,a=t[9]+1<4&&create_if_block_12(t);function o(t,e){return t[9]+1!==t[0].authors.length&&t[9]+1<4?create_if_block_10:t[9]+1===4?create_if_block_11:void 0}let r=o(t),c=r&&r(t);return{c(){a&&a.c(),e=empty(),c&&c.c(),n=empty()},m(t,o){a&&a.m(t,o),insert(t,e,o),c&&c.m(t,o),insert(t,n,o)},p(t,e){t[9]+1<4&&a.p(t,e),r!==(r=o(t))&&(c&&c.d(1),c=r&&r(t),c&&(c.c(),c.m(n.parentNode,n)))},d(t){a&&a.d(t),t&&detach(e),c&&c.d(t),t&&detach(n)}}}function create_if_block_8(t){let e,n,a,o;function r(t,e){return null!=t[0].formats&&0!=t[0].formats.length?create_if_block_9:create_else_block$3}let c=r(t),l=c(t);return{c(){e=element("div"),n=element("img"),o=space(),l.c(),attr(n,"class","text-white object-cover w-full"),n.src!==(a=t[0].library_url+t[0].cover_url)&&attr(n,"src",a),attr(n,"alt",""),attr(e,"class","cover phablet:w-1/2 phablet:float-right monocle:pr-3 phone:pr-3 svelte-xjoc7v")},m(t,a){insert(t,e,a),append(e,n),append(e,o),l.m(e,null)},p(t,o){1&o[0]&&n.src!==(a=t[0].library_url+t[0].cover_url)&&attr(n,"src",a),c===(c=r(t))&&l?l.p(t,o):(l.d(1),l=c(t),l&&(l.c(),l.m(e,null)))},d(t){t&&detach(e),l.d()}}}function create_else_block$3(t){let e;return{c(){e=element("div"),e.textContent=".",attr(e,"class",".inset-x-0.bottom-0 bg-black text-black")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block_9(t){let e,n,a,o=getFormats(t[0]),r=[];for(let e=0;e<o.length;e+=1)r[e]=create_each_block_2$1(get_each_context_2$1(t,o,e));return{c(){e=element("div"),n=element("span"),n.textContent="Download:",a=space();for(let t=0;t<r.length;t+=1)r[t].c();attr(n,"class","pl-2 text-white text-base font-bold"),attr(e,"class",".inset-x-0.bottom-0 bg-black")},m(t,o){insert(t,e,o),append(e,n),append(e,a);for(let t=0;t<r.length;t+=1)r[t].m(e,null)},p(t,n){if(1&n[0]){let a;for(o=getFormats(t[0]),a=0;a<o.length;a+=1){const c=get_each_context_2$1(t,o,a);r[a]?r[a].p(c,n):(r[a]=create_each_block_2$1(c),r[a].c(),r[a].m(e,null))}for(;a<r.length;a+=1)r[a].d(1);r.length=o.length}},d(t){t&&detach(e),destroy_each(r,t)}}}function create_each_block_2$1(t){let e,n,a,o,r,c,l=t[12].title.replace(",","")+"";return{c(){e=element("a"),n=element("img"),o=text(l),attr(n,"class","w-4 inline-block"),attr(n,"alt","dl"),n.src!==(a=download_svg)&&attr(n,"src",a),attr(e,"class","hover:underline inline-block font-bold italic text-xl pr-3 py-1 bg-black text-white"),attr(e,"href",r=t[12].url),attr(e,"title",c=t[12].size)},m(t,a){insert(t,e,a),append(e,n),append(e,o)},p(t,n){1&n[0]&&l!==(l=t[12].title.replace(",","")+"")&&set_data(o,l),1&n[0]&&r!==(r=t[12].url)&&attr(e,"href",r),1&n[0]&&c!==(c=t[12].size)&&attr(e,"title",c)},d(t){t&&detach(e)}}}function create_if_block_6(t){let e,n,a,o=t[0].authors,r=[];for(let e=0;e<o.length;e+=1)r[e]=create_each_block_1$2(get_each_context_1$2(t,o,e));return{c(){e=element("div"),n=element("span"),n.textContent="Authors:",a=space();for(let t=0;t<r.length;t+=1)r[t].c();attr(n,"class","font-bold"),attr(e,"class","pt-3 monocle:px-2 phone:px-2")},m(t,o){insert(t,e,o),append(e,n),append(e,a);for(let t=0;t<r.length;t+=1)r[t].m(e,null)},p(t,n){if(5&n[0]){let a;for(o=t[0].authors,a=0;a<o.length;a+=1){const c=get_each_context_1$2(t,o,a);r[a]?r[a].p(c,n):(r[a]=create_each_block_1$2(c),r[a].c(),r[a].m(e,null))}for(;a<r.length;a+=1)r[a].d(1);r.length=o.length}},d(t){t&&detach(e),destroy_each(r,t)}}}function create_if_block_7(t){let e;return{c(){e=text(", ")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block_1$2(t){let e,n,a,o,r,c=t[10]+"",l=t[9]+1!==t[0].authors.length&&create_if_block_7();return{c(){e=element("a"),n=text(c),l&&l.c(),o=empty(),attr(e,"title","search in authors"),attr(e,"href",a="#/search/authors/"+t[10]),attr(e,"class","hover:underline"),r=listen(e,"click",self(t[2]))},m(t,a){insert(t,e,a),append(e,n),l&&l.m(t,a),insert(t,o,a)},p(t,r){1&r[0]&&c!==(c=t[10]+"")&&set_data(n,c),1&r[0]&&a!==(a="#/search/authors/"+t[10])&&attr(e,"href",a),t[9]+1!==t[0].authors.length?l||(l=create_if_block_7(),l.c(),l.m(o.parentNode,o)):l&&(l.d(1),l=null)},d(t){t&&detach(e),l&&l.d(t),t&&detach(o),r()}}}function create_if_block_5(t){let e,n,a,o,r,c,l,i=t[0].publisher+"";return{c(){e=element("div"),n=element("span"),n.textContent="Publisher:",a=space(),o=element("a"),r=text(i),attr(n,"class","font-bold"),attr(o,"title","search in publishers"),attr(o,"href",c="#/search/publisher/"+t[0].publisher),attr(o,"class","hover:underline"),attr(e,"class","pt-3 monocle:px-2 phone:px-2"),l=listen(o,"click",self(t[2]))},m(t,c){insert(t,e,c),append(e,n),append(e,a),append(e,o),append(o,r)},p(t,e){1&e[0]&&i!==(i=t[0].publisher+"")&&set_data(r,i),1&e[0]&&c!==(c="#/search/publisher/"+t[0].publisher)&&attr(o,"href",c)},d(t){t&&detach(e),l()}}}function create_if_block_4$1(t){let e,n,a,o,r,c,l,i=t[0].series+"";return{c(){e=element("div"),n=element("span"),n.textContent="Series:",a=space(),o=element("a"),r=text(i),attr(n,"class","font-bold"),attr(o,"title","search in series"),attr(o,"href",c="#/search/series/"+t[0].series),attr(o,"class","hover:underline"),attr(e,"class","pt-3 monocle:px-2 phone:px-2"),l=listen(o,"click",self(t[2]))},m(t,c){insert(t,e,c),append(e,n),append(e,a),append(e,o),append(o,r)},p(t,e){1&e[0]&&i!==(i=t[0].series+"")&&set_data(r,i),1&e[0]&&c!==(c="#/search/series/"+t[0].series)&&attr(o,"href",c)},d(t){t&&detach(e),l()}}}function create_if_block_3$2(t){let e,n,a,o=t[0].year+"";return{c(){e=element("div"),n=element("span"),n.textContent="Year: ",a=text(o),attr(n,"class","font-bold"),attr(e,"class","pt-3 monocle:px-2 phone:px-2")},m(t,o){insert(t,e,o),append(e,n),append(e,a)},p(t,e){1&e[0]&&o!==(o=t[0].year+"")&&set_data(a,o)},d(t){t&&detach(e)}}}function create_if_block_2$2(t){let e,n=sanitizeAbstract(t[0].abstract)+"";return{c(){e=element("div"),attr(e,"class","pt-3 monocle:px-2 phone:px-2")},m(t,a){insert(t,e,a),e.innerHTML=n},p(t,a){1&a[0]&&n!==(n=sanitizeAbstract(t[0].abstract)+"")&&(e.innerHTML=n)},d(t){t&&detach(e)}}}function create_if_block$4(t){let e,n,a,o=t[0].tags,r=[];for(let e=0;e<o.length;e+=1)r[e]=create_each_block$5(get_each_context$5(t,o,e));return{c(){e=element("div"),n=element("span"),n.textContent="Tags:",a=space();for(let t=0;t<r.length;t+=1)r[t].c();attr(n,"class","font-bold"),attr(e,"class","p-6 monocle:px-2 phone:px-2 monocle:text-xs phone:text-xs text-sm italic bg-white")},m(t,o){insert(t,e,o),append(e,n),append(e,a);for(let t=0;t<r.length;t+=1)r[t].m(e,null)},p(t,n){if(5&n[0]){let a;for(o=t[0].tags,a=0;a<o.length;a+=1){const c=get_each_context$5(t,o,a);r[a]?r[a].p(c,n):(r[a]=create_each_block$5(c),r[a].c(),r[a].m(e,null))}for(;a<r.length;a+=1)r[a].d(1);r.length=o.length}},d(t){t&&detach(e),destroy_each(r,t)}}}function create_if_block_1$3(t){let e;return{c(){e=text(", ")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block$5(t){let e,n,a,o,r,c=t[7]+"",l=t[9]+1!==t[0].tags.length&&create_if_block_1$3();return{c(){e=element("a"),n=text(c),l&&l.c(),o=empty(),attr(e,"title","search in tags"),attr(e,"href",a="#/search/tags/"+t[7]),attr(e,"class","hover:underline"),r=listen(e,"click",self(t[2]))},m(t,a){insert(t,e,a),append(e,n),l&&l.m(t,a),insert(t,o,a)},p(t,r){1&r[0]&&c!==(c=t[7]+"")&&set_data(n,c),1&r[0]&&a!==(a="#/search/tags/"+t[7])&&attr(e,"href",a),t[9]+1!==t[0].tags.length?l||(l=create_if_block_1$3(),l.c(),l.m(o.parentNode,o)):l&&(l.d(1),l=null)},d(t){t&&detach(e),l&&l.d(t),t&&detach(o),r()}}}function create_fragment$7(t){let e,n,a,o,r,c,l,i,s,u,d,p,M,h,_,g,m,f,L,j,N,b,y,x,k,w,I,D,S,T,A,z,$,C=t[0].title+"",v=t[0].title+"",O=t[0].librarian+"",E=t[0].authors,Y=[];for(let e=0;e<E.length;e+=1)Y[e]=create_each_block_3(get_each_context_3(t,E,e));let U=t[0].cover_url&&create_if_block_8(t),Q=t[0].authors&&create_if_block_6(t),B=t[0].publisher&&create_if_block_5(t),H=t[0].series&&create_if_block_4$1(t),Z=t[0].year&&create_if_block_3$2(t),P=t[0].abstract&&create_if_block_2$2(t),R=t[0].tags&&t[0].tags.length>0&&create_if_block$4(t);return{c(){e=element("div"),n=element("div"),a=element("div"),o=element("span"),o.textContent=" x",r=text(" "),c=text(C),l=text(" by ");for(let t=0;t<Y.length;t+=1)Y[t].c();i=space(),s=element("div"),U&&U.c(),u=space(),d=element("div"),p=element("span"),p.textContent="Title: ",M=text(v),h=space(),Q&&Q.c(),_=space(),B&&B.c(),g=space(),H&&H.c(),m=space(),Z&&Z.c(),f=space(),P&&P.c(),L=space(),R&&R.c(),j=space(),N=element("div"),b=element("a"),y=text("catalogued by "),x=text(O),w=space(),I=element("div"),I.textContent=".",D=space(),S=element("div"),T=element("span"),T.textContent="<<",A=text(" "),z=element("span"),z.textContent=">>",attr(o,"title","[ESC]"),attr(o,"class","cursor-pointer monocle:text-2xl phone:text-2xl monocle:pr-2 phone:pr-2 float-right font-extrabold text-white opacity-50"),attr(a,"class","inset-x-0.top-0 p-6 monocle:px-4 phone:px-4 bg-motw-red text-white font-extrabold text-xl monocle:text-sm phone:text-sm"),attr(p,"class","font-bold"),attr(d,"class","pt-4 monocle:px-2 phone:px-2"),attr(s,"class","bg-white phablet:p-6"),attr(b,"class","hover:underline inline-flex"),attr(b,"href",k="#/search/librarian/"+t[0].librarian),attr(I,"class","text-motw-red text-center select-none"),attr(T,"title","[]"),attr(T,"id","prev"),attr(T,"class","hover:underline cursor-pointer"),attr(z,"title","[]"),attr(z,"id","next"),attr(z,"class","hover:underline cursor-pointer"),attr(S,"class","font-extrabold text-white monocle:text-xl phone:text-xl monocle:pr-2 phone:pr-2"),attr(N,"class","inset-x-0.bottom-0 items-baseline bg-motw-red text-white font-bold p-6 monocle:px-2 phone:px-2 flex justify-between items-center"),attr(n,"class","pt-6 w-full max-w-4xl m-auto flex-col flex monocle:text-xs phone:text-xs"),attr(e,"class","modal px-4 monocle:px-0 phone:px-0 svelte-xjoc7v"),$=[listen(window_1,"keydown",t[1]),listen(o,"click",t[2]),listen(T,"click",t[1]),listen(z,"click",t[1]),listen(e,"click",self(t[2]))]},m(t,k){insert(t,e,k),append(e,n),append(n,a),append(a,o),append(a,r),append(a,c),append(a,l);for(let t=0;t<Y.length;t+=1)Y[t].m(a,null);append(n,i),append(n,s),U&&U.m(s,null),append(s,u),append(s,d),append(d,p),append(d,M),append(s,h),Q&&Q.m(s,null),append(s,_),B&&B.m(s,null),append(s,g),H&&H.m(s,null),append(s,m),Z&&Z.m(s,null),append(s,f),P&&P.m(s,null),append(n,L),R&&R.m(n,null),append(n,j),append(n,N),append(N,b),append(b,y),append(b,x),append(N,w),append(N,I),append(N,D),append(N,S),append(S,T),append(S,A),append(S,z)},p(t,e){if(1&e[0]&&C!==(C=t[0].title+"")&&set_data(c,C),1&e[0]){let n;for(E=t[0].authors,n=0;n<E.length;n+=1){const o=get_each_context_3(t,E,n);Y[n]?Y[n].p(o,e):(Y[n]=create_each_block_3(o),Y[n].c(),Y[n].m(a,null))}for(;n<Y.length;n+=1)Y[n].d(1);Y.length=E.length}t[0].cover_url?U?U.p(t,e):(U=create_if_block_8(t),U.c(),U.m(s,u)):U&&(U.d(1),U=null),1&e[0]&&v!==(v=t[0].title+"")&&set_data(M,v),t[0].authors?Q?Q.p(t,e):(Q=create_if_block_6(t),Q.c(),Q.m(s,_)):Q&&(Q.d(1),Q=null),t[0].publisher?B?B.p(t,e):(B=create_if_block_5(t),B.c(),B.m(s,g)):B&&(B.d(1),B=null),t[0].series?H?H.p(t,e):(H=create_if_block_4$1(t),H.c(),H.m(s,m)):H&&(H.d(1),H=null),t[0].year?Z?Z.p(t,e):(Z=create_if_block_3$2(t),Z.c(),Z.m(s,f)):Z&&(Z.d(1),Z=null),t[0].abstract?P?P.p(t,e):(P=create_if_block_2$2(t),P.c(),P.m(s,null)):P&&(P.d(1),P=null),t[0].tags&&t[0].tags.length>0?R?R.p(t,e):(R=create_if_block$4(t),R.c(),R.m(n,j)):R&&(R.d(1),R=null),1&e[0]&&O!==(O=t[0].librarian+"")&&set_data(x,O),1&e[0]&&k!==(k="#/search/librarian/"+t[0].librarian)&&attr(b,"href",k)},i:noop,o:noop,d(t){t&&detach(e),destroy_each(Y,t),U&&U.d(),Q&&Q.d(),B&&B.d(),H&&H.d(),Z&&Z.d(),P&&P.d(),R&&R.d(),run_all($)}}}function sanitizeAbstract(t){return new HtmlWhitelistedSanitizer(!0).sanitizeString(t.replace("**",""))}function instance$7(t,e,n){let{book:a}=e,{bookm:o}=e,r=[];const c=createEventDispatcher();lasthash.subscribe(t=>{r=JSON.parse(t)});function l(t){r[0]=!0,lasthash.set(JSON.stringify(r)),window.location.hash=r[1],n(3,o=!1)}return t.$set=t=>{"book"in t&&n(0,a=t.book),"bookm"in t&&n(3,o=t.bookm)},[a,function(t){"Escape"===t.key?l():"ArrowRight"===t.key||"next"===t.target.id?c("nextModal",a._id):"ArrowLeft"!==t.key&&"prev"!==t.target.id||c("prevModal",a._id)},l,o]}class BookModal extends SvelteComponent{constructor(t){super(),init(this,t,instance$7,create_fragment$7,safe_not_equal,{book:0,bookm:3})}}const{window:window_1$1}=globals;function create_if_block_1$4(t){let e,n;function a(e){t[16].call(null,e)}let o={book:t[5]};void 0!==t[2]&&(o.bookm=t[2]);const r=new BookModal({props:o});return binding_callbacks.push(()=>bind(r,"bookm",a)),r.$on("nextModal",t[7]),r.$on("prevModal",t[8]),{c(){create_component(r.$$.fragment)},m(t,e){mount_component(r,t,e),n=!0},p(t,n){const a={};32&n[0]&&(a.book=t[5]),!e&&4&n[0]&&(e=!0,a.bookm=t[2],add_flush_callback(()=>e=!1)),r.$set(a)},i(t){n||(transition_in(r.$$.fragment,t),n=!0)},o(t){transition_out(r.$$.fragment,t),n=!1},d(t){destroy_component(r,t)}}}function create_else_block$4(t){let e;const n=new LibraryCovers({props:{books:t[3]}});return{c(){create_component(n.$$.fragment)},m(t,a){mount_component(n,t,a),e=!0},p(t,e){const a={};8&e[0]&&(a.books=t[3]),n.$set(a)},i(t){e||(transition_in(n.$$.fragment,t),e=!0)},o(t){transition_out(n.$$.fragment,t),e=!1},d(t){destroy_component(n,t)}}}function create_if_block$5(t){let e;const n=new LibraryTable({props:{books:t[3]}});return{c(){create_component(n.$$.fragment)},m(t,a){mount_component(n,t,a),e=!0},p(t,e){const a={};8&e[0]&&(a.books=t[3]),n.$set(a)},i(t){e||(transition_in(n.$$.fragment,t),e=!0)},o(t){transition_out(n.$$.fragment,t),e=!1},d(t){destroy_component(n,t)}}}function create_fragment$8(t){let e,n,a,o,r,c,l,i,s,u,d;const p=new Tailwindcss({});let M=t[2]&&create_if_block_1$4(t);function h(e){t[17].call(null,e)}let _={mock:t[1]};void 0!==t[0]&&(_.t=t[0]);const g=new MotwHeader({props:_});binding_callbacks.push(()=>bind(g,"t",h));const m=new SearchBar({props:{mock:t[1]}}),f=new NavBar({props:{navbarLinks:t[4]}}),L=[create_if_block$5,create_else_block$4],j=[];function N(t,e){return t[0]?0:1}l=N(t),i=j[l]=L[l](t);const b=new NavBar({props:{navbarLinks:t[4]}});return{c(){create_component(p.$$.fragment),e=space(),M&&M.c(),n=space(),create_component(g.$$.fragment),o=space(),create_component(m.$$.fragment),r=space(),create_component(f.$$.fragment),c=space(),i.c(),s=space(),create_component(b.$$.fragment),d=listen(window_1$1,"hashchange",t[6])},m(t,a){mount_component(p,t,a),insert(t,e,a),M&&M.m(t,a),insert(t,n,a),mount_component(g,t,a),insert(t,o,a),mount_component(m,t,a),insert(t,r,a),mount_component(f,t,a),insert(t,c,a),j[l].m(t,a),insert(t,s,a),mount_component(b,t,a),u=!0},p(t,e){t[2]?M?(M.p(t,e),transition_in(M,1)):(M=create_if_block_1$4(t),M.c(),transition_in(M,1),M.m(n.parentNode,n)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros());const o={};2&e[0]&&(o.mock=t[1]),!a&&1&e[0]&&(a=!0,o.t=t[0],add_flush_callback(()=>a=!1)),g.$set(o);const r={};2&e[0]&&(r.mock=t[1]),m.$set(r);const c={};16&e[0]&&(c.navbarLinks=t[4]),f.$set(c);let u=l;l=N(t),l===u?j[l].p(t,e):(group_outros(),transition_out(j[u],1,1,()=>{j[u]=null}),check_outros(),i=j[l],i||(i=j[l]=L[l](t),i.c()),transition_in(i,1),i.m(s.parentNode,s));const d={};16&e[0]&&(d.navbarLinks=t[4]),b.$set(d)},i(t){u||(transition_in(p.$$.fragment,t),transition_in(M),transition_in(g.$$.fragment,t),transition_in(m.$$.fragment,t),transition_in(f.$$.fragment,t),transition_in(i),transition_in(b.$$.fragment,t),u=!0)},o(t){transition_out(p.$$.fragment,t),transition_out(M),transition_out(g.$$.fragment,t),transition_out(m.$$.fragment,t),transition_out(f.$$.fragment,t),transition_out(i),transition_out(b.$$.fragment,t),u=!1},d(t){destroy_component(p,t),t&&detach(e),M&&M.d(t),t&&detach(n),destroy_component(g,t),t&&detach(o),destroy_component(m,t),t&&detach(r),destroy_component(f,t),t&&detach(c),j[l].d(t),t&&detach(s),destroy_component(b,t),d()}}}function getLoadingBook(){return{title:"Loading...",authors:["Slow Network","Mere Boredom","La-di-dada","et al."],cover_url:"data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",library_url:"",pubdate:"",formats:[],publisher:"Wait until you're older; wait until the upturn;",year:"wait until it stops raining.",abstract:"You are called for interview at ten past ten only to find yourself pulling a ticket from a machine that seems designed not for the efficient parcelling of your time, only to tease, to torment. Number one hundred and forty fucking six. The practical method would be to spend such time profitably: be prepared; take a book with you. You know its going to happen because everyday you have lived, you have learned more about the deferral of events. Wait until you're older; wait until the upturn; wait until it stops raining. Whether it's the fear of failure or sheer, stupid obediance that allays the logical and most human desire to lash out at such moments is a mystery to me, but for now I'll offer no alternative. Let time sharpen your anxiety and mould it into a palpable hatred whose very formation is the precipitate of release. Just wait.",tags:[],librarian:"Amateur"}}function getLoadingBooks(){var t={title:"",authors:[""],library_url:"",cover_url:"data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",librarian:"",_id:""};return[...Array(12)].map((e,n)=>t)}function instance$8($$self,$$props,$$invalidate){let $restapi;component_subscribe($$self,restapi,t=>$$invalidate(10,$restapi=t));let t=!0,mock=!1,bookm=!1,books=[],navbarLinks={searchStatus:"loading..."},book=getLoadingBook(),lochash=[];const unsubscribe=lasthash.subscribe(t=>{lochash=JSON.parse(t)});function setLastHash(t){lochash[1]=t,lasthash.set(JSON.stringify(lochash))}async function fetchBooks(t){if(0===books.length&&$$invalidate(3,books=getLoadingBooks()),$$invalidate(4,navbarLinks={searchStatus:"loading"+".".repeat(Math.floor(4*Math.random()+2))}),mock)var e=mockHttpRequest(CALIBRE_BOOKS1.books,t,48);else{const n=await fetch(t);e=await n.json()}const n=e._meta,a=e._links.self.href.split("/");var o="";o="books"===a[0]?"all books":`${a[1]}: ${decodeURIComponent(a[2])}`.toLowerCase();const r=n.max_results*(n.page-1),c=Math.min(n.page*n.max_results,n.total);e._links.searchStatus=`${r}-${c} of ${n.total} (${o})`,$$invalidate(4,navbarLinks=e._links),$$invalidate(3,books=e._items)}async function fetchBook(t){if(t.endsWith("book/"))return getLoadingBook();if(""==lochash[lochash.length-1]&&$$invalidate(4,navbarLinks={searchStatus:""}),$$invalidate(5,book=getLoadingBook()),mock)var e=mockHttpRequest(CALIBRE_BOOKS1.books,t,48,"books");else{const n=await fetch(t);e=await n.json()}"TRYAGAIN"!==e&&("0101"!==e.pubdate.slice(0,4)&&(e.year=e.pubdate.slice(0,4)),$$invalidate(5,book=e))}function dispatchHash(){var e=location.hash;lochash[0]||e.startsWith("#/book/")||window.scrollTo(0,0),e.endsWith("t=l")&&(e=e.replace("t=l",""),$$invalidate(0,t=!0)),$$invalidate(2,bookm=!1);var n="";if(""==e||"#/?"==e)lochash[0]=!1,n="books";else{if(e.startsWith("#/book/"))return $$invalidate(2,bookm=!bookm),void fetchBook(`${$restapi}${e.slice(2)}`);e.startsWith("#/")&&(lochash[0]=!1,n=e.slice(2))}setLastHash(e),fetchBooks(`${$restapi}${n}`)}function nextModal(t){var e=books.map(t=>t._id).indexOf(t.detail);e>-1&&e<books.length-1?location.hash="#/book/"+books[e+1]._id:(window.scrollTo(0,document.body.scrollHeight),lochash[0]=!0,lasthash.set(JSON.stringify(lochash)),location.hash=lochash[lochash.length-1])}function prevModal(t){var e=books.map(t=>t._id).indexOf(t.detail);e>0?location.hash="#/book/"+books[e-1]._id:(location.hash=lochash[lochash.length-1],window.scrollTo(0,0))}function bookmodal_bookm_binding(t){bookm=t,$$invalidate(2,bookm)}function motwheader_t_binding(e){t=e,$$invalidate(0,t)}let hashChanged;return document.onreadystatechange=function(){"complete"!==document.readyState||location.hash.endsWith("t=l")||$$invalidate(0,t=!1)},onMount(()=>{CALIBRE_BOOKS1.portable&&($$invalidate(1,mock=!0),[...Array(7).keys()].forEach((function(n){var i=n+2,e=document.createElement("script");e.onload=function(){CALIBRE_BOOKS1.books=[...CALIBRE_BOOKS1.books,...eval("CALIBRE_BOOKS"+i).books],CALIBRE_BOOKS1.books.sort(dynamicSort("-last_modified")),dispatchHash()},e.src=`static/data${i}.js`,document.body.appendChild(e)}))),lasthash.set('["",""]'),dispatchHash()}),$$invalidate(6,hashChanged=()=>dispatchHash()),[t,mock,bookm,books,navbarLinks,book,hashChanged,nextModal,prevModal,lochash,$restapi,unsubscribe,setLastHash,fetchBooks,fetchBook,dispatchHash,bookmodal_bookm_binding,motwheader_t_binding]}class App extends SvelteComponent{constructor(t){super(),init(this,t,instance$8,create_fragment$8,safe_not_equal,{})}}const app=new App({target:document.body,props:{name:"world"}});return app}();
//# sourceMappingURL=bundle.js.map