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;nt.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{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<(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{"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{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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2Ij48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uMDYyLTIuNjU1IDEuMDYycy0xLjk0Ny0uMzU0LTIuNjU1LTEuMDYybC0yNi4yLTI2LjJjLTEuMjQtMS4wNjItMS40MTYtMi40NzgtLjg4NS00LjA3Mi43MDgtMS41OTMgMS43Ny0yLjMgMy41NC0yLjNIMzYuNzZ2LTI2LjJjMC0xLjA2Mi4zNTQtMS45NDcgMS4wNjItMi42NTVzMS41OTMtMS4wNjIgMi42NTUtMS4wNjJoMTUuMDQ3YzEuMDYyIDAgMS45NDcuMzU0IDIuNjU1IDEuMDYyUzU5LjI0IDUuNzggNTkuMjQgNi44NDJ2MjYuMmgxNS4wNDdjMS40MTYgMCAyLjY1NS44ODUgMy4zNjMgMi4zeiIgZmlsbD0iIzAwMCIvPjwvc3ZnPgo=";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='
 
',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',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;tn=!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;nn(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="<>",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{"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{"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;et[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{"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;a0;){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;e0&&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>",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;t0?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&&et._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