PageSourceSearch

https://www.bookize.com/_next/static/chunks/1763.1b26b3e41d0abe5c.js

js bookize.com collected 2026-10-07 14:52:31 UTC 9,263 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1763],{48770:function(e,t,o){o.r(t);var n=o(57437),s=o(5934),r=o(75019),i=o(71986),l=o(14123),a=o.n(l),c=o(99376),d=o(2265),g=o(77763),u=o(28996),h=o(49360),w=o(5789);t.default=e=>{let{content:t,savedHighlights:o,addHighlight:l,rendition:m,setRendition:p,setSavedHighlights:x,isCloudFile:f=!1,updateLocation:b}=e,{file:y,fileName:k,key:B,location:v}=t,[j,S]=(0,d.useState)("0"),[D,q]=(0,d.useState)(!1),{updatePageNumber:I}=(0,i.Z)(),C=(0,r.Z)(),N=(0,d.useRef)(a()(e=>p(e)));(0,d.useEffect)(()=>{"0"!==v&&S(v)},[]),(0,d.useEffect)(()=>{if(m)return m.on("selected",H),o.forEach(e=>{m.annotations.add("highlight",e.cfiRange,{},void 0,"hl",{fill:"yellow","fill-opacity":"0.5","mix-blend-mode":"multiply"})}),()=>{null==m||m.off("selected",H)}},[m,o]);let H=async(e,t)=>{if(m){let o={quote:m.getRange(e).toString(),cfiRange:e,id:(0,h.Z)(),book_id:B};x(o),m.annotations.add("highlight",e,{},void 0,"hl",{fill:"yellow","fill-opacity":"0.5","mix-blend-mode":"multiply"});let n=t.window.getSelection();
1null==n||n.removeAllRanges(),l&&await l(o,B)}};return y?(0,n.jsxs)("div",{className:"tw-relative tw-mx-auto tw-min-h-screen tw-w-full tw-max-w-4xl",id:"viewer",children:[(0,n.jsx)(u.fy,{title:k,url:y,location:j,locationChanged:e=>{if(S(e),f&&b){b(B,e);return}I(B,e).then(()=>null).catch(()=>console.error("onPageNumberChange: something went wrong"))},getRendition:e=>{N.current(e)}}),(0,n.jsx)(g.lTq,{onClick:()=>q(!0),className:"tw-absolute tw-right-5 tw-top-5 tw-z-50 tw-h-10 tw-w-10 tw-cursor-pointer tw-text-primaryDarkColor"}),(0,n.jsx)(w.Z,{open:D,onClose:()=>q(!1),onConfirm:()=>{C.push("".concat(s.Z.reader))}})]}):(0,c.notFound)()}},25847:function(e,t,o){var n=o(57437);o(2265);let s={primary:"tw-bg-primary tw-text-white hover:tw-shadow-md",danger:"tw-bg-danger tw-text-white hover:tw-shadow-md",default:"tw-bg-none tw-text-primary hover:tw-bg-primary hover:tw-bg-opacity-10",outlined:"tw-bg-none tw-border-primary tw-border-[1px] tw-text-primary hover:tw-bg-primary hover:tw-bg-opacity-10",secondary:"tw-bg-secondary tw-text-white hover:tw-shadow-md"};t.Z=e=>{let t,{children:o,variant:r="primary",className:i,"aria-label":l,...a}=e,c=s[r];return"string"==typeof o?t=o:l&&(t=l),(0,n.jsx)("button",{className:"tw-rounded-md tw-px-3 tw-py-2 ".concat(c," ").concat(i),"aria-label":t,...a,children:o})}},5789:function(e,t,o){var n=o(57437),s=o(27844);o(2265);var r=o(21151),i=o(25847),l=o(12168);t.Z=e=>{let{open:t,onClose:o,onConfirm:a,isDeletion:c=!1}=e,{t:d}=(0,s.E)();return(0,n.jsx)(l.Z,{open:t,onClose:o,children:(0,n.jsxs)("div",{className:"tw-z-50 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-5",children:[(0,n.jsx)(r.j6T,{className:"tw-h-16 tw-w-16 tw-text-primaryDarkColor"}),(0,n.jsx)("h2",{className:"tw-text-xl tw-font-bold tw-text-darkGray",children:d("Common.dialog.confirmation.title")}),(0,n.jsx)("p",{children:d(c?"Common.dialog.confirmation.deletionText":"Common.dialog.confirmation.closeText")}),(0,n.jsxs)("div",{className:"tw-flex tw-gap-5",children:[(0,n.jsx)(i.Z,{variant:"primary",onClick:a,children:d("Common.dialog.confirmation.acceptButton")}),(0,n.jsx)(i.Z,{variant:"secondary",onClick:o,children:d("Common.dialog.confirmation.rejectButton")})]})]})})}},12168:function(e,t,o){var n=o(57437);o(2265),t.Z=e=>{let{open:t,onClose:o,children:s}=e;return(0,n.jsx)("div",{className:"tw-fixed tw-inset-0 tw-z-[1000] tw-flex tw-h-screen tw-w-screen tw-place-items-center tw-items-center tw-justify-center tw-transition-colors\n      ".concat(t?"tw-visible tw-bg-black/20":"tw-invisible"),onClick:o,children:(0,n.jsx)("div",{className:"tw-mx-5 tw-w-full tw-max-w-sm tw-rounded-xl tw-bg-white tw-p-6 tw-shadow tw-transition-all\n        ".concat(t?"tw-scale-100 tw-opacity-100":"tw-scale-125 tw-opacity-0","\n        "),onClick:e=>e.stopPropagation(),children:s})})}},71986:function(e,t,o){let n,s;o.d(t,{Z:function(){return g}});(i=l||(l={})).Books="Books",i.Highlights="Highlights",i.HighlightsArea="HighlightsArea";let r=()=>new Promise(e=>{(n=indexedDB.open("UsersDB")).onupgradeneeded=()=>{if(!(s=n.result).objectStoreNames.contains("Books")||!s.objectStoreNames.contains("Highlights")){console.log("Creating Books store"),s.createObjectStore("Books",{keyPath:"key"});let e=s.createObjectStore("Highlights",{keyPath:"id"});e.createIndex("content","content",{unique:!1}),e.createIndex("quote","quote",{unique:!1}),e.createIndex("cfiRange","cfiRange",{unique:!1}),e.createIndex("book_id","book_id",{unique:!1});let t=s.createObjectStore("HighlightsArea",{keyPath:"id",autoIncrement:!0});t.createIndex("highlight_Id","highlight_Id",{unique:!1}),t.createIndex("height","height",{unique:!1}),t.createIndex("left","left",{unique:!1}),t.createIndex("pageIndex","pageIndex",{unique:!1}),t.createIndex("top","top",{unique:!1}),t.createIndex("width","width",{unique:!1})}},n.onsuccess=()=>{console.log("request.onsuccess - initDB",(s=n.result).version),e(!0)},n.onerror=()=>{e(!1)}});var i,l,a=o(2265),c=o(69064);let d="UsersDB";var g=()=>{let[e,t]=(0,a.useState)(!1),o=async()=>{await r()},n=(0,a.useCallback)(()=>{let e=sessionStorage.getItem("isDbReady"),t=sessionStorage.getItem("isExpired");e&&t||(sessionStorage.setItem("isDbReady",JSON.stringify(!0)),sessionStorage.setItem("isExpired",JSON.stringify(!0)),o().then(()=>
1null).catch(()=>console.error("InitDb- something went wrong")))},[]);(0,a.useEffect)(()=>{n()},[]);let s=e=>new Promise((t,o)=>{let n=indexedDB.open(d,1);n.onsuccess=()=>{console.log("request.onsuccess - getHighlightsByBookId");let s=n.result.transaction(l.Highlights,"readonly").objectStore(l.Highlights).index("book_id"),r=IDBKeyRange.only(e),i=s.getAll(r);i.onsuccess=()=>{t(i.result)},i.onerror=()=>{o(Error("Failed to get highlights"))}},n.onerror=()=>{o(Error("Failed to open database"))}});return{saveInDb:(e,o,n)=>(t(!0),new Promise(s=>{let r=indexedDB.open(d,1),i={file:e,fileName:o,key:n,location:"0"};r.onsuccess=()=>{console.log("request.onsuccess - addData",o),r.result.transaction(l.Books,"readwrite").objectStore(l.Books).add(i),t(!1),s(i)},r.onerror=()=>{var e;let o=null===(e=r.error)||void 0===e?void 0:e.message;c.ZP.error(null!=o?o:"Something went wrong..."),t(!1)}})),getFromDb:e=>new Promise(t=>{let o=indexedDB.open(d,1);o.onsuccess=()=>{console.log("request.onsuccess - getFromDb");let n=o.result.transaction(l.Books,"readonly").objectStore(l.Books).get(e);n.onsuccess=()=>{t(n.result)},n.onerror=()=>{t(null)}}}),removeFromDb:e=>(t(!0),new Promise((o,n)=>{let s=indexedDB.open(d,1);s.onsuccess=s=>{let r=s.target.result.transaction([l.Books,l.Highlights],"readwrite"),i=r.objectStore(l.Books),a=r.objectStore(l.Highlights).index("book_id");i.delete(e).onsuccess=()=>{console.log("Book with key ".concat(e," deleted"))},a.openCursor(IDBKeyRange.only(e)).onsuccess=e=>{let t=e.target.result;t&&(t.delete(),t.continue())},r.oncomplete=()=>{console.log("Book and related highlights for key ".concat(e," deleted")),t(!1),o()},r.onerror=()=>{console.error("Transaction failed"),t(!1),n(Error("Transaction failed"))}},s.onerror=()=>{console.error("Failed to open database"),t(!1),n(Error("Failed to open database"))}})),getAllFromDB:()=>new Promise(e=>{let t=indexedDB.open(d,1);t.onsuccess=()=>{console.log("request.onsuccess - getAllData");let o=t.result.transaction(l.Books,"readonly").objectStore(l.Books).getAll();o.onsuccess=()=>{e(o.result.map(e=>{let{fileName:t,key:o}=e;return{fileName:t,key:o}}))},o.onerror=()=>{e([])}}}),isDbProcessing:e,updatePageNumber:(e,t)=>new Promise(()=>{let o=indexedDB.open(d,1);o.onsuccess=()=>{let n=o.result.transaction(l.Books,"readwrite").objectStore(l.Books),s=n.get(e);s.onsuccess=()=>{let e=s.result;e.location=t,n.put(e).onsuccess=()=>{console.log("Book page have been updated, book: ".concat(e.fileName))}}}}),addHighlight:e=>(t(!0),new Promise((o,n)=>{let s=indexedDB.open(d,1);s.onsuccess=()=>{console.log("request.onsuccess - add Highlight",e.id),s.result.transaction(l.Highlights,"readwrite").objectStore(l.Highlights).add(e)},s.onerror=()=>{var e;let o=null===(e=s.error)||void 0===e?void 0:e.message;c.ZP.error(null!=o?o:"Something went wrong..."),t(!1),n(null!=o?o:"Something went wrong...")}})),getHighlightsByBookId:s,removeHighlight:o=>new Promise(()=>{let n=indexedDB.open(d,1);n.onsuccess=()=>{console.log("request.onsuccess - delete highlight",o),n.result.transaction(l.Highlights,"readwrite").objectStore(l.Highlights).delete(o),console.log("request.onsuccess - finished",e),t(!1)}}),getBooksWithHighlights:()=>new Promise(e=>{let t=indexedDB.open(d,1);t.onsuccess=()=>{console.log("request.onsuccess - getAllData");let o=t.result.transaction(l.Books,"readonly").objectStore(l.Books).getAll();console.log("here",o),o.onsuccess=()=>{e(o.result.map(async e=>{let t=await s(e.key);return{fileName:e.fileName,key:e.key,count:t.length}}))},o.onerror=()=>{e([])}}}),getBooksWithHighlightsForSync:()=>new Promise(e=>{let t=indexedDB.open(d,1);t.onsuccess=()=>{console.log("request.onsuccess - getAllData");let o=t.result.transaction(l.Books,"readonly").objectStore(l.Books).getAll();o.onsuccess=()=>{e(o.result.map(async e=>{let t=await s(e.key);return{fileName:e.fileName,key:e.key,file:e.file,location:e.location,highlights:t}}))},o.onerror=()=>{e([])}}})}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.