Publish the dist-embed build so it can be served from jsDelivr
Galena loads the viewer from cdn.jsdelivr.net/gh/Alpaq92/ReaderJS@<sha>/dist-embed/ instead of vendoring it, so the built bundle is committed and pinned by commit SHA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
node_modules/
|
||||
dist/
|
||||
dist-embed/
|
||||
.env
|
||||
.env.*
|
||||
*.local
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
var e=class{constructor(){this.numPages=1,this.scale=1,this.container=null,this.viewer=null,this.defaultScaleOption=`page-width`}async load(e,t,n){this.container=t,this.viewer=n}scrollToPage(e){let t=this.container?.querySelector(`[data-page="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}setScale(e){this.scale=e,this.container?.querySelectorAll(`.doc-page`).forEach(t=>{t.style.zoom=e===1?``:e})}getPageWidth(){return 816}getPageHeight(){return null}async preparePrint(){}cleanupAfterPrint(){}destroy(){this.container&&(this.container.innerHTML=``)}};export{e as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{c as e,n as t,r as n,t as r}from"./driver-0cTj10HJ.js";var i=class extends t{constructor(e){super(),this.ctx=e}beginPage(e,t){super.beginPage(e,t),this.ctx.clearRect(0,0,e,t)}_trace(e){let t=this.ctx;t.beginPath();for(let n of e.segs)n.op===`M`?t.moveTo(n.x,n.y):n.op===`L`?t.lineTo(n.x,n.y):n.op===`C`?t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x3,n.y3):n.op===`Z`&&t.closePath()}fill(t,n,r){this.ctx.fillStyle=e(r),this._trace(t),this.ctx.fill(n)}stroke(t,i,a){let o=this.ctx;o.strokeStyle=e(a),o.lineWidth=i.width,o.lineCap=r[i.cap]||`butt`,o.lineJoin=n[i.join]||`miter`,o.miterLimit=i.miter,o.setLineDash(i.dash||[]),o.lineDashOffset=i.offset||0,this._trace(t),o.stroke()}clip(e,t){this._trace(e),this.ctx.clip(t)}save(){this.ctx.save()}restore(){this.ctx.restore()}showText(t,n,r,i,a){let o=this.ctx;o.save(),o.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),o.fillStyle=e(i),o.font=`${(a.italic?`italic `:``)+(a.bold?`bold `:``)}${r}px ${a.family}`,o.textBaseline=`alphabetic`,o.fillText(t,0,0),o.restore()}};export{i as CanvasDriver};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=null,r=class extends t{constructor(){super(),this._reader=null,this._blobs=null,this._frame=null,this._onFrameClick=this._onFrameClick.bind(this)}async load(t,r,i){await super.load(t,r,i);let[{ChmReader:a},o]=await Promise.all([e(()=>import(`./chm-reader-Bjyc0KjP.js`),[],import.meta.url),e(()=>import(`./render-D6jv0HaF.js`),[],import.meta.url)]);n=o.renderTopic;let s=a.open(t);this._reader=s,this._blobs=new o.BlobCache(s),r.innerHTML=``;let c=document.createElement(`div`);c.className=`doc-page chm-page`,c.dataset.page=1;let l=document.createElement(`iframe`);l.className=`chm-frame`,l.sandbox=`allow-same-origin`,this._frame=l,c.appendChild(l),r.appendChild(c),this._buildContents(s);let u=s.defaultTopic||s.listFiles().find(e=>/\.html?$/i.test(e));u?this._navigate(u):l.srcdoc=`<!DOCTYPE html><meta charset="utf-8"><body style="font:14px sans-serif;padding:24px;color:#555">This .chm has no displayable HTML topic.</body>`,this.numPages=1}_navigate(e,t=``){let r=this._reader;if(!r)return;let i=e.indexOf(`#`);if(i>=0&&(t=t||e.slice(i+1),e=e.slice(0,i)),!r.hasFile(e))return;let a=this._frame;a.onload=()=>{let n=a.contentDocument;if(n){if(a.style.height=`${n.documentElement.scrollHeight}px`,n.addEventListener(`click`,this._onFrameClick,!0),t){let e=n.getElementById(t)||n.querySelector(`a[name="${CSS.escape(t)}"]`);e&&e.scrollIntoView({block:`start`})}this._highlightContents(e)}},a.srcdoc=n(r,e,this._blobs)}_onFrameClick(e){let t=e.target.closest?.(`a`);if(!t)return;let n=t.getAttribute(`data-chm-href`),r=t.getAttribute(`data-chm-ext`);n?(e.preventDefault(),this._navigate(n,t.getAttribute(`data-chm-frag`)||``)):r&&(e.preventDefault(),confirm(`Open external link?\n\n${r}`)&&window.open(r,`_blank`,`noopener`))}_buildContents(e){let t=document.getElementById(`thumbsContent`);if(!t)return;let n=e.getContents();if(!n?.length)return;this.buildsThumbnailsAsync=!0,t.innerHTML=``;let r=document.createElement(`div`);r.className=`chm-toc`,this._renderNodes(e,n,r),t.appendChild(r)}_renderNodes(e,t,n){for(let r of t){let t=document.createElement(`div`);t.className=`chm-toc-row`,t.textContent=r.name||`(untitled)`;let i=this._nodeTarget(e,r);if(i&&(t.classList.add(`chm-toc-link`),t.dataset.target=i,t.addEventListener(`click`,()=>this._navigate(i))),n.appendChild(t),r.children?.length){let t=document.createElement(`div`);t.className=`chm-toc-children`,this._renderNodes(e,r.children,t),n.appendChild(t)}}}_nodeTarget(e,t){if(t.url||!t.local)return null;let n=e.resolvePath(e.contentsPath||`/`,t.local).replace(/#.*$/,``);return e.hasFile(n)?n:null}_highlightContents(e){let t=document.getElementById(`thumbsContent`);t&&(t.querySelectorAll(`.chm-toc-active`).forEach(e=>e.classList.remove(`chm-toc-active`)),t.querySelectorAll(`.chm-toc-row[data-target="${CSS.escape(e)}"]`).forEach(e=>e.classList.add(`chm-toc-active`)))}destroy(){this._blobs?.revokeAll(),this._blobs=null,this._reader=null,this._frame=null;let e=document.getElementById(`thumbsContent`);e&&(e.innerHTML=``),super.destroy()}};export{r as CHMRenderer};
|
||||
@@ -0,0 +1 @@
|
||||
function e(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function t(t,n){e(t,n),n.add(t)}function n(t,n,r){e(t,n),n.set(t,r)}function r(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function i(e,t){return e.get(r(e,t))}function a(e,t,n){return e.set(r(e,t),n),n}export{t as a,n as i,i as n,r,a as t};
|
||||
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./common-D7sP-4Y_.js","./rolldown-runtime-DAXXjFlN.js","./github-DdKuH37F.css"])))=>i.map(i=>d[i]);
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n={js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,json:`json`,jsonc:`json`,xml:`xml`,html:`xml`,htm:`xml`,yaml:`yaml`,yml:`yaml`,css:`css`,scss:`scss`,less:`less`,py:`python`,java:`java`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,hpp:`cpp`,cs:`csharp`,go:`go`,rs:`rust`,rb:`ruby`,php:`php`,sh:`bash`,bash:`bash`,sql:`sql`,kt:`kotlin`,swift:`swift`,toml:`ini`,ini:`ini`,diff:`diff`},r=class extends t{async load(t,r,i){await super.load(t,r,i);let a=(await e(async()=>{let{default:e}=await import(`./common-D7sP-4Y_.js`);return{default:e}},__vite__mapDeps([0,1]),import.meta.url)).default;await e(()=>Promise.resolve({}),__vite__mapDeps([2]),import.meta.url);let o=new TextDecoder(`utf-8`).decode(t),s=n[(i?.currentFileName||``).split(`.`).pop().toLowerCase()];if(s===`json`)try{o=JSON.stringify(JSON.parse(o),null,2)}catch{}let c=s&&a.getLanguage(s)?a.highlight(o,{language:s}):a.highlightAuto(o);r.innerHTML=``;let l=document.createElement(`div`);l.className=`doc-page`,l.dataset.page=1;let u=document.createElement(`pre`);u.className=`code-content`;let d=document.createElement(`code`);d.className=`hljs`,d.innerHTML=c.value,u.appendChild(d),l.appendChild(u),r.appendChild(l),this.numPages=1}};export{r as CodeRenderer};
|
||||
@@ -0,0 +1 @@
|
||||
var e=({entries:e,loadBlob:t,getSize:n},r)=>{let i=new Map,a=new Map,o=async e=>{if(i.has(e))return i.get(e);let n=URL.createObjectURL(await t(e)),r=URL.createObjectURL(new Blob([`<!DOCTYPE html><html><head><meta charset="utf-8"></head><body style="margin: 0"><img src="${n}"></body></html>`],{type:`text/html`}));return a.set(e,[n,r]),i.set(e,r),r},s=e=>{a.get(e)?.forEach?.(e=>URL.revokeObjectURL(e)),a.delete(e),i.delete(e)},c=[`.jpg`,`.jpeg`,`.png`,`.gif`,`.bmp`,`.webp`,`.svg`,`.jxl`,`.avif`],l=e.map(e=>e.filename).filter(e=>c.some(t=>e.endsWith(t))).sort(new Intl.Collator([],{numeric:!0}).compare);if(!l.length)throw Error(`No supported image files in archive`);let u={};return u.getCover=()=>t(l[0]),u.metadata={title:r.name},u.sections=l.map(e=>({id:e,load:()=>o(e),unload:()=>s(e),size:n(e)})),u.toc=l.map(e=>({label:e,href:e})),u.rendition={layout:`pre-paginated`},u.resolveHref=e=>({index:u.sections.findIndex(t=>t.id===e)}),u.splitTOCHref=e=>[e,null],u.getTOCFragment=e=>e.documentElement,u.destroy=()=>{for(let e of a.values())for(let t of e)URL.revokeObjectURL(t)},u};export{e as makeComicBook};
|
||||
@@ -0,0 +1 @@
|
||||
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";import{t as n}from"./jszip.min-C__FR9jF.js";import{t as r}from"./base-renderer-DM6Nw1yD.js";var i=e(n()),a=/\.(jpe?g|png|gif|webp|bmp|avif)$/i,o={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`,avif:`image/avif`};function s(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}var c=class extends r{constructor(){super(),this._imgUrls=[],this._observer=null,this._naturalW=0,this._naturalH=0,this.defaultScaleOption=`page-height`}async load(e,t,n){await super.load(e,t,n);let r=await this._extract(e);if(!r.length)throw Error(`No images found in comic archive`);t.innerHTML=``;for(let[e,n]of r.entries()){let r=document.createElement(`div`);r.className=`comic-page`,r.dataset.page=e+1;let i=document.createElement(`img`);i.src=n.url,i.alt=n.name,i.loading=`lazy`,i.draggable=!1,r.appendChild(i),t.appendChild(r)}this.numPages=r.length,await this._measureFirst(r[0].url),this.setScale(this.scale),this._attachScrollObserver(),this._buildThumbnails(r)}async _extract(e){let t=new Uint8Array(e.slice(0,4));return t[0]===80&&t[1]===75?this._extractZip(e):this._extractArchive(e)}async _extractZip(e){let t=await i.default.loadAsync(e),n=[];t.forEach((e,t)=>{!t.dir&&a.test(e)&&n.push({path:e,file:t})}),n.sort((e,t)=>s(e.path,t.path));let r=[];for(let{path:e,file:t}of n){let n=await t.async(`uint8array`);r.push({name:e,url:this._toUrl(n,e)})}return r}async _extractArchive(e){let{Archive:n}=await t(async()=>{let{Archive:e}=await import(`./libarchive-Dhbbd3NZ.js`);return{Archive:e}},[],import.meta.url);n.init({workerUrl:`./libarchive/worker-bundle.js`});let r=await n.open(new Blob([e])),i=(await r.getFilesArray()).filter(e=>a.test(e.file.name)).sort((e,t)=>s((e.path||``)+e.file.name,(t.path||``)+t.file.name)),o=[];for(let e of i){let t=await e.file.extract(),n=new Uint8Array(await t.arrayBuffer());o.push({name:e.file.name,url:this._toUrl(n,e.file.name)})}return await r.close?.(),o}_toUrl(e,t){let n=o[t.split(`.`).pop().toLowerCase()]??`application/octet-stream`,r=URL.createObjectURL(new Blob([e],{type:n}));return this._imgUrls.push(r),r}_measureFirst(e){return new Promise(t=>{let n=new Image;n.onload=()=>{this._naturalW=n.naturalWidth,this._naturalH=n.naturalHeight,t()},n.onerror=()=>t(),n.src=e})}setScale(e){if(this.scale=e,!this._naturalW)return;let t=Math.round(this._naturalW*e);this.container?.querySelectorAll(`.comic-page`).forEach(e=>{e.style.width=`${t}px`})}getPageWidth(){return this._naturalW||null}getPageHeight(){return this._naturalH||null}_attachScrollObserver(){this._observer&&this._observer.disconnect();let e=this.container.parentElement;this._observer=new IntersectionObserver(e=>{let t={ratio:0,page:this.viewer?.currentPage||1};e.forEach(e=>{e.intersectionRatio>t.ratio&&(t={ratio:e.intersectionRatio,page:+e.target.dataset.page})}),t.ratio>0&&this.viewer&&t.page!==this.viewer.currentPage&&(this.viewer.currentPage=t.page,this.viewer.updatePageInfo(),this._highlightThumb(t.page))},{threshold:[0,.25,.5,.75,1],root:e}),this.container.querySelectorAll(`.comic-page`).forEach(e=>this._observer.observe(e))}_buildThumbnails(e){let t=document.getElementById(`thumbsContent`);t&&(t.innerHTML=``,e.forEach((e,n)=>{let r=document.createElement(`div`);r.className=`thumb`,r.dataset.thumbPage=n+1,r.title=`Page ${n+1}`;let i=document.createElement(`img`);i.src=e.url,i.loading=`lazy`;let a=document.createElement(`div`);a.className=`thumb-label`,a.textContent=n+1,r.appendChild(i),r.appendChild(a),r.addEventListener(`click`,()=>this.viewer?.goToPage(n+1)),t.appendChild(r)}))}_highlightThumb(e){document.querySelectorAll(`.thumb`).forEach(t=>{t.classList.toggle(`active`,+t.dataset.thumbPage===e)})}scrollToPage(e){let t=this.container?.querySelector(`.comic-page[data-page="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})}destroy(){this._observer?.disconnect(),this._observer=null,this._imgUrls.forEach(e=>URL.revokeObjectURL(e)),this._imgUrls=[],super.destroy()}};export{c as ComicRenderer};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./papaparse.min-D30bkSB7.js","./rolldown-runtime-DAXXjFlN.js"])))=>i.map(i=>d[i]);
|
||||
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";import{t as n}from"./base-renderer-DM6Nw1yD.js";var r=class extends n{async load(n,r,i){await super.load(n,r,i);let a=(await t(async()=>{let{default:t}=await import(`./papaparse.min-D30bkSB7.js`).then(t=>e(t.default));return{default:t}},__vite__mapDeps([0,1]),import.meta.url)).default,o=new TextDecoder(`utf-8`).decode(n),s=i?.currentFileName||``,c=/\.tsv$/i.test(s)?` `:``,l=a.parse(o,{delimiter:c,skipEmptyLines:!0}).data;r.innerHTML=``;let u=document.createElement(`div`);u.className=`doc-page`,u.dataset.page=1;let d=document.createElement(`table`);d.className=`data-table`,l.forEach((e,t)=>{let n=document.createElement(`tr`);e.forEach(e=>{let r=document.createElement(t===0?`th`:`td`);r.textContent=e,n.appendChild(r)}),d.appendChild(n)});let f=document.createElement(`div`);f.className=`data-table-wrap`,f.appendChild(d),u.appendChild(f),r.appendChild(u),this.numPages=1}};export{r as CSVRenderer};
|
||||
@@ -0,0 +1 @@
|
||||
function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}export{r as t};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
import{t as e}from"./base-renderer-DM6Nw1yD.js";var t=2e3,n=200,r=class extends e{constructor(){super(),this._worker=null,this._reqId=0,this._pending=new Map,this._infos=[],this._pageW=800,this._pageH=1e3,this._gen=0,this._renderObs=null,this._pageObs=null,this.defaultScaleOption=`page-height`,this.buildsThumbnailsAsync=!0}_call(e,t){return new Promise((n,r)=>{let i=++this._reqId;this._pending.set(i,{resolve:n,reject:r}),this._worker.postMessage({id:i,type:e,...t})})}_spawnWorker(){this._worker=new Worker(new URL(``+new URL(`worker-OhPDRroP.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),this._worker.onmessage=e=>{let{id:t,error:n}=e.data,r=this._pending.get(t);r&&(this._pending.delete(t),n?r.reject(Error(n)):r.resolve(e.data))}}async extractText(e){this._spawnWorker();try{let t=await this._call(`open`,{buffer:e}),n=[];for(let e=0;e<(t.pageCount||1);e++){let{words:t}=await this._call(`text`,{index:e}),r=[],i=[],a=null;for(let e of t||[]){let t=e.ymax-e.ymin||10;a!=null&&Math.abs(e.ymin-a)>t*.7&&(r.push(i.join(` `)),i=[]),i.push(e.str),a=e.ymin}i.length&&r.push(i.join(` `)),n.push(r.join(`
|
||||
`))}return n}finally{this._worker?.terminate(),this._worker=null}}_logical(e){let t=e?.dpi||300;return{w:Math.max(1,Math.round((e?.width||800)*96/t)),h:Math.max(1,Math.round((e?.height||1e3)*96/t))}}async load(e,t,n){await super.load(e,t,n);let r=++this._gen;this._spawnWorker();let i=await this._call(`open`,{buffer:e});if(r!==this._gen)return;this.numPages=i.pageCount||1,this._infos=i.infos||[];let a=this._logical(this._infos[0]);this._pageW=a.w,this._pageH=a.h,t.innerHTML=``;for(let e=0;e<this.numPages;e++){let n=this._logical(this._infos[e]),r=document.createElement(`div`);r.className=`djvu-page`,r.dataset.page=e+1,r.dataset.lw=n.w,r.dataset.lh=n.h,t.appendChild(r)}this.setScale(this.scale),this._attachObservers(),this._renderWindow(0),this._buildThumbnails(r)}_renderWindow(e){for(let t=e-1;t<=e+1;t++)t>=0&&t<this.numPages&&this._renderPage(t)}_attachObservers(){let e=this.container.parentElement;this._renderObs=new IntersectionObserver(e=>{e.forEach(e=>{let t=e.target.dataset.page-1;e.isIntersecting?this._renderPage(t):this._clearPage(e.target)})},{root:e,rootMargin:`150% 0px`,threshold:0}),this._pageObs=new IntersectionObserver(e=>{let t={ratio:0,page:this.viewer?.currentPage||1};e.forEach(e=>{e.intersectionRatio>t.ratio&&(t={ratio:e.intersectionRatio,page:+e.target.dataset.page})}),t.ratio>0&&this.viewer&&t.page!==this.viewer.currentPage&&(this.viewer.currentPage=t.page,this.viewer.updatePageInfo(),this._highlightThumb(t.page))},{root:e,threshold:[0,.25,.5,.75,1]}),this.container.querySelectorAll(`.djvu-page`).forEach(e=>{this._renderObs.observe(e),this._pageObs.observe(e)})}_subsample(e,t){let n=e?.width||800;return Math.max(1,Math.round(n/Math.min(n,t)))}_canvasFromRender(e){let t=document.createElement(`canvas`);return t.width=e.width,t.height=e.height,t.getContext(`2d`).putImageData(new ImageData(e.rgba,e.width,e.height),0,0),t}async _renderPage(e){let n=this.container?.querySelector(`.djvu-page[data-page="${e+1}"]`);if(!n||n.dataset.rendered)return;n.dataset.rendered=`1`;let r=this._gen;try{let i=await this._call(`render`,{index:e,subsample:this._subsample(this._infos[e],t)});if(r!==this._gen||!this._worker)return;let a=this._canvasFromRender(i);n.innerHTML=``,n.appendChild(a)}catch{n.dataset.rendered=``}}_clearPage(e){e.dataset.rendered&&(e.innerHTML=``,e.dataset.rendered=``)}setScale(e){this.scale=e,this.container?.querySelectorAll(`.djvu-page`).forEach(t=>{t.style.width=`${Math.round((+t.dataset.lw||this._pageW)*e)}px`,t.style.height=`${Math.round((+t.dataset.lh||this._pageH)*e)}px`})}getPageWidth(){return this._pageW}getPageHeight(){return this._pageH}scrollToPage(e){let t=this.container?.querySelector(`.djvu-page[data-page="${e}"]`);t&&(this._renderWindow(e-1),t.scrollIntoView({behavior:`smooth`,block:`start`}))}async _buildThumbnails(e){let t=document.getElementById(`thumbsContent`);if(t){for(let r=0;r<this.numPages;r++){let i=this._infos[r],a;try{a=await this._call(`render`,{index:r,subsample:this._subsample(i,n)})}catch{continue}if(e!==this._gen||!this._worker)return;let o=this._canvasFromRender(a),s=document.createElement(`img`);s.src=o.toDataURL(`image/png`);let c=document.createElement(`div`);c.className=`thumb`,c.dataset.thumbPage=r+1;let l=document.createElement(`div`);l.className=`thumb-label`,l.textContent=r+1,c.append(s,l),c.addEventListener(`click`,()=>this.viewer?.goToPage(r+1)),t.appendChild(c)}this._highlightThumb(this.viewer?.currentPage||1)}}_highlightThumb(e){document.querySelectorAll(`#thumbsContent .thumb`).forEach(t=>{t.classList.toggle(`active`,+t.dataset.thumbPage===e)})}destroy(){this._gen++,this._renderObs?.disconnect(),this._pageObs?.disconnect(),this._renderObs=this._pageObs=null,this._pending.clear(),this._worker?.terminate(),this._worker=null,super.destroy()}};export{r as DjVuRenderer};
|
||||
@@ -0,0 +1,2 @@
|
||||
import{t as e}from"./base-renderer-DM6Nw1yD.js";var t=[``,`center`,`right`,`justify`],n=null;function r(){return window.docToText?Promise.resolve():n||(n=new Promise((e,t)=>{let n=document.createElement(`script`);n.src=`./jsdoc/docToText.js`,n.onload=()=>{e()},n.onerror=()=>t(Error(`Failed to load /jsdoc/docToText.js`)),document.head.appendChild(n)}),n)}function i(e){return String(e).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}function a(e){if(!e)return``;let t=``;return e.indL&&(t+=`margin-left:${e.indL/20}pt;`),e.indR&&(t+=`margin-right:${e.indR/20}pt;`),e.ind1&&(t+=`text-indent:${e.ind1/20}pt;`),e.spB&&(t+=`margin-bottom:${e.spB/20}pt;`),e.spA&&(t+=`margin-top:${e.spA/20}pt;`),e.line&&(t+=`line-height:${e.lineMult?e.line/240:Math.abs(e.line)/20+`pt`};`),t}function o(e){let t=``;e.b&&(t+=`font-weight:bold;`),e.i&&(t+=`font-style:italic;`);let n=(e.u?`underline `:``)+(e.strike?`line-through`:``);return n.trim()&&(t+=`text-decoration:${n.trim()};`),e.size&&(t+=`font-size:${e.size}pt;`),e.font&&(t+=`font-family:'${String(e.font).replace(/['\\<>]/g,``)}';`),e.color!=null&&(t+=`color:rgb(${e.color&255},${e.color>>8&255},${e.color>>16&255});`),t}function s(e,t){let n=``;for(let r of e||[])if(r.image&&r.image.bytes)try{let e=URL.createObjectURL(new Blob([r.image.bytes],{type:r.image.mime||`image/png`}));t.push(e),n+=`<img class="docimg" src="${e}" alt="embedded image">`}catch{}else if(r.ftnRef!=null)n+=`<sup class="ftnref" title="footnote ${r.ftnRef+1}">${r.ftnRef+1}</sup>`;else if(r.endRef!=null){let e=[`i`,`ii`,`iii`,`iv`,`v`,`vi`,`vii`,`viii`,`ix`,`x`][r.endRef]||r.endRef+1;n+=`<sup class="ftnref" title="endnote ${r.endRef+1}">${e}</sup>`}else if(r.comRef!=null)n+=`<sup class="comref" title="comment ${r.comRef+1}">✎</sup>`;else if(r.text){let e=o(r),t=e?`<span style="${e}">${i(r.text)}</span>`:i(r.text);r.url&&(t=`<a href="${i(r.url)}" target="_blank" rel="noopener nofollow">${t}</a>`),n+=t}return n}function c(e,n){let r=``,i=0,o=null,c=()=>{o&&(r+=`</${o}>`,o=null)};for(;i<e.length;){let l=e[i];if(l.kind===`cell`||l.kind===`rowEnd`){c();let t=[],a=[];for(;i<e.length&&(e[i].kind===`cell`||e[i].kind===`rowEnd`);)a.push(e[i]),e[i].kind===`rowEnd`&&(t.push({cells:a.slice(),tblw:e[i].tblw,shd:e[i].tblShd}),a=[]),i++;a.length&&t.push({cells:a,tblw:null,shd:null});let o={};t.forEach(e=>{e.tblw&&e.tblw.forEach(e=>{o[e]=1})});let l=Object.keys(o).map(Number).sort((e,t)=>e-t),u=l.length>2,d=``;if(u){let e=l[l.length-1]-l[0];if(e>0){d=`<colgroup>`;for(let t=0;t<l.length-1;t++)d+=`<col style="width:${((l[t+1]-l[t])/e*100).toFixed(2)}%">`;d+=`</colgroup>`}}r+=`<table class="doc-table${u?` sized`:``}">${d}<tbody>`,t.forEach(e=>{r+=`<tr>`;for(let t=0;t<e.cells.length;t++){let i=1;if(e.tblw&&e.tblw.length===e.cells.length+1&&l.length>2){let n=e.tblw[t],r=e.tblw[t+1],a=0;for(let e=0;e<l.length;e++)l[e]>n&&l[e]<r&&a++;i=a+1}let a=e.shd&&e.shd[t]!=null?e.shd[t]:null,o=a==null?``:`rgb(${a&255},${a>>8&255},${a>>16&255})`;r+=`<td${i>1?` colspan="${i}"`:``}${o?` style="background:${o}"`:``}>${s(e.cells[t].runs,n)||` `}</td>`}r+=`</tr>`}),r+=`</tbody></table>`}else{let e=l.align?`text-align:${t[l.align]};`:``,u=s(l.runs,n);if(l.list){let t=l.list.kind===`number`?`ol`:`ul`;o!==t&&(c(),r+=`<${t}>`,o=t),r+=`<li${e?` style="${e}"`:``}>${u||` `}</li>`}else{c();let t=e+a(l.pp);r+=`<p${t?` style="${t}"`:``}>${u||`<br>`}</p>`}i++}}return c(),r||`<p><em>(document contains no main-body text)</em></p>`}function l(e){let t=e.split(`
|
||||
`),n=``,r=0;for(;r<t.length;)if(t[r].includes(` `)){let e=[];for(;r<t.length&&t[r].includes(` `);)e.push(t[r].split(` `)),r++;n+=`<table class="doc-table"><tbody>`;for(let t=0;t<e.length;t++){let r=t===0?`th`:`td`;n+=`<tr>`+e[t].map(e=>`<${r}>${e}</${r}>`).join(``)+`</tr>`}n+=`</tbody></table>`}else t[r].trim()&&(n+=`<p>${t[r]}</p>`),r++;return n||`<p><em>(document contains no main-body text)</em></p>`}var u=class extends e{constructor(){super(),this._imgUrls=[]}async load(e,t,n){await super.load(e,t,n),await r();let a=window.docToText;if(typeof a!=`function`)throw Error(`docToText library failed to load.`);let o=null;try{o=a.model(e)}catch{}let s;if(o&&o.body){if(s=c(o.body,this._imgUrls),o.props){let e=[];[[`title`,`Title`],[`author`,`Author`],[`subject`,`Subject`]].forEach(([t,n])=>{o.props[t]&&e.push(`<b>${n}:</b> ${i(o.props[t])}`)}),e.length&&(s=`<div class="docprops">${e.join(` · `)}</div>`+s)}for(let[e,t]of[[`footnotes`,`Footnotes`],[`endnotes`,`Endnotes`],[`annotations`,`Comments`],[`textboxes`,`Text boxes`]])o[e]&&o[e].length&&(s+=`<h3 class="sec">${t}</h3>`+c(o[e],this._imgUrls));o.header&&o.header.length&&(s+=`<h3 class="sec">Header</h3>`+c(o.header,this._imgUrls)),o.footer&&o.footer.length&&(s+=`<h3 class="sec">Footer</h3>`+c(o.footer,this._imgUrls))}else{let t=null;try{t=a.html(e)}catch{}if(!t||!t.body)throw Error(`Could not read .doc file — may be Word 6/95, encrypted, or corrupt.`);s=l(t.body)}t.innerHTML=``;let u=document.createElement(`div`);u.className=`doc-page`,u.dataset.page=1,u.innerHTML=s,t.appendChild(u),this.numPages=1}destroy(){this._imgUrls.forEach(e=>URL.revokeObjectURL(e)),this._imgUrls=[],super.destroy()}};export{u as DOCRenderer};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./lib-sUWhpJan.js","./rolldown-runtime-DAXXjFlN.js","./jszip.min-C__FR9jF.js"])))=>i.map(i=>d[i]);
|
||||
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./reader-Bd1ccloG.js";import{t as n}from"./base-renderer-DM6Nw1yD.js";var r=class extends n{async load(n,r,i){await super.load(n,r,i);let a;try{let n=await t(()=>import(`./lib-sUWhpJan.js`).then(t=>e(t.default)),__vite__mapDeps([0,1,2]),import.meta.url);a=n.default??n}catch(e){throw Error(`mammoth could not be loaded: ${e.message}`)}let o=await a.convertToHtml({arrayBuffer:n});o.messages?.length&&console.warn(`[DOCX] conversion messages:`,o.messages),r.innerHTML=``;let s=document.createElement(`div`);s.className=`doc-page`,s.dataset.page=1,s.innerHTML=o.value,r.appendChild(s),this.numPages=1}};export{r as DOCXRenderer};
|
||||
@@ -0,0 +1 @@
|
||||
var e=e=>e<0?0:e>1?1:e,t=e=>({space:`gray`,c:[e]}),n=(e,t,n)=>({space:`rgb`,c:[e,t,n]}),r=(e,t,n,r)=>({space:`cmyk`,c:[e,t,n,r]});function i(e,t,r){e=(e%1+1)%1;let i=Math.floor(e*6),a=e*6-i,o=r*(1-t),s=r*(1-a*t),c=r*(1-(1-a)*t),[l,u,d]=[[r,c,o],[s,r,o],[o,r,c],[o,s,r],[c,o,r],[r,o,s]][i%6];return n(l,u,d)}function a(t){switch(t.space){case`gray`:{let n=e(t.c[0]);return{r:n,g:n,b:n,a:1}}case`rgb`:return{r:e(t.c[0]),g:e(t.c[1]),b:e(t.c[2]),a:1};case`cmyk`:{let[n,r,i,a]=t.c;return{r:(1-e(n))*(1-e(a)),g:(1-e(r))*(1-e(a)),b:(1-e(i))*(1-e(a)),a:1}}default:return{r:0,g:0,b:0,a:1}}}function o(t){let n=t=>Math.round(e(t)*255).toString(16).padStart(2,`0`);return`#`+n(t.r)+n(t.g)+n(t.b)}function s(t){let n=t=>Math.round(e(t)*255);return`rgba(${n(t.r)},${n(t.g)},${n(t.b)},${t.a})`}var c=class{beginPage(e,t){this.width=e,this.height=t}save(){}restore(){}fill(e,t,n){}stroke(e,t,n){}clip(e,t){}showText(e,t,n,r,i){}showPage(){}endPage(){}},l=[`butt`,`round`,`square`],u=[`miter`,`round`,`bevel`];export{t as a,s as c,r as i,o as l,c as n,i as o,u as r,n as s,l as t,a as u};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
var e=(e,t)=>e.map((e,n,r)=>t(e,n,r)?n:null).filter(e=>e!=null),t=(e,t)=>[-1,...t,e.length].reduce(({xs:t,a:n},r)=>({xs:t?.concat([e.slice(n+1,r)])??[],a:r}),{}).xs,n=(e,t)=>e.slice(0,-1).concat([e[e.length-1].concat(t[0])]).concat(t.slice(1)),r=/\d/,i=/^epubcfi\((.*)\)$/,a=e=>e.replace(/[\^[\](),;=]/g,`^$&`),o=e=>i.test(e)?e:`epubcfi(${e})`,s=e=>e.match(i)?.[1]??e,c=(e=>(...t)=>`epubcfi(${e(...t.map(e=>e.match(i)?.[1]??e))})`)((...e)=>e.join(`!`)),l=e=>{let t=[],n,i,a=``,o=e=>(t.push(e),n=null,a=``),s=e=>(a+=e,i=!1);for(let t of Array.from(e.trim()).concat(``)){if(t===`^`&&!i){i=!0;continue}if(n===`!`)o([`!`]);else if(n===`,`)o([`,`]);else if(n===`/`||n===`:`)if(r.test(t)){s(t);continue}else o([n,parseInt(a)]);else if(n===`~`)if(r.test(t)||t===`.`){s(t);continue}else o([`~`,parseFloat(a)]);else if(n===`@`){if(t===`:`){o([`@`,parseFloat(a)]),n=`@`;continue}if(r.test(t)||t===`.`){s(t);continue}else o([`@`,parseFloat(a)])}else if(n===`[`){t===`;`&&!i?(o([`[`,a]),n=`;`):t===`,`&&!i?(o([`[`,a]),n=`[`):t===`]`&&!i?o([`[`,a]):s(t);continue}else if(n?.startsWith(`;`)){t===`=`&&!i?(n=`;${a}`,a=``):t===`;`&&!i?(o([n,a]),n=`;`):t===`]`&&!i?o([n,a]):s(t);continue}(t===`/`||t===`:`||t===`~`||t===`@`||t===`[`||t===`!`||t===`,`)&&(n=t)}return t},u=(t,n)=>e(t,([e])=>e===n),d=e=>{let t=[],n;for(let[r,i]of e){if(r===`/`)t.push({index:i});else{let e=t[t.length-1];if(r===`:`)e.offset=i;else if(r===`~`)e.temporal=i;else if(r===`@`)e.spatial=(e.spatial??[]).concat(i);else if(r===`;s`)e.side=i;else if(r===`[`)if(n===`/`&&i)e.id=i;else{e.text=(e.text??[]).concat(i);continue}}n=r}return t},f=e=>t(e,u(e,`!`)).map(d),p=e=>{let n=l(s(e)),r=u(n,`,`);if(!r.length)return f(n);let[i,a,o]=t(n,r).map(f);return{parent:i,start:a,end:o}},m=({index:e,id:t,offset:n,temporal:r,spatial:i,text:o,side:s})=>{let c=s?`;s=${s}`:``;return`/${e}`+(t?`[${a(t)}${c}]`:``)+(n!=null&&e%2?`:${n}`:``)+(r?`~${r}`:``)+(i?`@${i.join(`:`)}`:``)+(o||!t&&s?`[`+(o?.map(a)?.join(`,`)??``)+c+`]`:``)},h=e=>e.parent?[e.parent,e.start,e.end].map(h).join(`,`):e.map(e=>e.map(m).join(``)).join(`!`),g=e=>o(h(e)),_=(e,t)=>typeof e==`string`?g(_(p(e),t)):e.parent?n(e.parent,e[t?`end`:`start`]):e,v=(e,t)=>{typeof e==`string`&&(e=p(e)),typeof t==`string`&&(t=p(t)),e=_(e),t=_(t,!0);let n=e[e.length-1],r=t[t.length-1],i=[],a=[],o=[],s=!0,c=Math.max(n.length,r.length);for(let e=0;e<c;e++){let t=n[e],c=r[e];s&&(s=t?.index===c?.index&&!t?.offset&&!c?.offset),s?i.push(t):(t&&a.push(t),c&&o.push(c))}return g({parent:e.slice(0,-1).concat([i]),start:[a],end:[o]})},y=({nodeType:e})=>e===3||e===4,b=({nodeType:e})=>e===1,x=(e,t)=>{let n=Array.from(e.childNodes).filter(e=>y(e)||b(e));return t?n.map(e=>{let n=t(e);return n===NodeFilter.FILTER_REJECT?null:n===NodeFilter.FILTER_SKIP?x(e,t):e}).flat().filter(e=>e):n},S=(e,t)=>{let n=x(e,t).reduce((e,t)=>{let n=e[e.length-1];return n?y(t)?Array.isArray(n)?n.push(t):y(n)?e[e.length-1]=[n,t]:e.push(t):b(n)?e.push(null,t):e.push(t):e.push(t),e},[]);return b(n[0])&&n.unshift(`first`),b(n[n.length-1])&&n.push(`last`),n.unshift(`before`),n.push(`after`),n},C=(e,t,n)=>{let{id:r}=t[t.length-1];if(r){let t=e.ownerDocument.getElementById(r);if(t)return{node:t,offset:0}}for(let{index:r}of t){let t=e?S(e,n)[r]:null;if(t===`first`)return{node:e.firstChild??e};if(t===`last`)return{node:e.lastChild??e};if(t===`before`)return{node:e,before:!0};if(t===`after`)return{node:e,after:!0};e=t}let{offset:i}=t[t.length-1];if(!Array.isArray(e))return{node:e,offset:i};let a=0;for(let t of e){let{length:e}=t.nodeValue;if(a+e>=i)return{node:t,offset:i-a};a+=e}},w=(e,t,n)=>{let{id:r,parentNode:i}=e;for(;n&&i&&i!==e.ownerDocument.documentElement&&n(i)===NodeFilter.FILTER_SKIP;)i=i.parentNode;let a=S(i,n),o=a.findIndex(t=>Array.isArray(t)?t.some(t=>t===e):t===e),s=a[o];if(Array.isArray(s)){let n=0;for(let r of s)if(r===e){n+=t;break}else n+=r.nodeValue.length;t=n}let c={id:r,index:o,offset:t};return(i===e.ownerDocument.documentElement?[c]:w(i,null,n).concat(c)).filter(e=>e.index!==-1)},T=(e,t)=>{let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e,o=w(n,r,t);if(e.collapsed)return g([o]);let s=w(i,a,t);return v([o],[s])},E=(e,t,n)=>{let r=_(t),i=_(t,!0),a=e.documentElement,o=C(a,r[0],n),s=C(a,i[0],n),c=e.createRange();return o.before?c.setStartBefore(o.node):o.after?c.setStartAfter(o.node):c.setStart(o.node,o.offset),s.before?c.setEndBefore(s.node):s.after?c.setEndAfter(s.node):c.setEnd(s.node,s.offset),c},D=e=>{let t=[],{parentNode:n}=e[0],r=w(n);for(let[i,a]of S(n).entries()){let n=e[t.length];a===n&&t.push(g([r.concat({id:n.id,index:i})]))}return t},O=(e,t)=>C(e.documentElement,_(t)).node,k={fromIndex:e=>o(`/6/${(e+1)*2}`),toIndex:e=>e?.at(-1).index/2-1};export{c as a,E as c,i,D as n,p as o,T as r,O as s,k as t};
|
||||
@@ -0,0 +1,53 @@
|
||||
var e=e=>e?e.replace(/[\t\n\f\r ]+/g,` `).replace(/^[\t\n\f\r ]+/,``).replace(/[\t\n\f\r ]+$/,``):``,t=t=>e(t?.textContent),n={XLINK:`http://www.w3.org/1999/xlink`,EPUB:`http://www.idpf.org/2007/ops`},r={XML:`application/xml`,XHTML:`application/xhtml+xml`},i={strong:[`strong`,`self`],emphasis:[`em`,`self`],style:[`span`,`self`],a:`anchor`,strikethrough:[`s`,`self`],sub:[`sub`,`self`],sup:[`sup`,`self`],code:[`code`,`self`],image:`image`},a={tr:[`tr`,{th:[`th`,i,[`colspan`,`rowspan`,`align`,`valign`]],td:[`td`,i,[`colspan`,`rowspan`,`align`,`valign`]]},[`align`]]},o={epigraph:[`blockquote`],subtitle:[`h2`,i],"text-author":[`p`,i],date:[`p`,i],stanza:`stanza`},s={title:[`header`,{p:[`h1`,i],"empty-line":[`br`]}],epigraph:[`blockquote`,`self`],image:`image`,annotation:[`aside`],section:[`section`,`self`],p:[`p`,i],poem:[`blockquote`,o],subtitle:[`h2`,i],cite:[`blockquote`,`self`],"empty-line":[`br`],table:[`table`,a],"text-author":[`p`,i]};o.epigraph.push(s);var c={image:`image`,title:[`section`,{p:[`h1`,i],"empty-line":[`br`]}],epigraph:[`section`,s],section:[`section`,s]},l=class{constructor(e){this.fb2=e,this.doc=document.implementation.createDocument(n.XHTML,`html`),this.bins=new Map(Array.from(this.fb2.getElementsByTagName(`binary`),e=>[e.id,e]))}getImageSrc(e){let t=e.getAttributeNS(n.XLINK,`href`);if(!t)return`data:,`;let[,r]=t.split(`#`);if(!r)return t;let i=this.bins.get(r);return i?`data:${i.getAttribute(`content-type`)};base64,${i.textContent}`:t}image(e){let t=this.doc.createElement(`img`);return t.alt=e.getAttribute(`alt`),t.title=e.getAttribute(`title`),t.setAttribute(`src`,this.getImageSrc(e)),t}anchor(e){let t=this.convert(e,{a:[`a`,i]});return t.setAttribute(`href`,e.getAttributeNS(n.XLINK,`href`)),e.getAttribute(`type`)===`note`&&t.setAttributeNS(n.EPUB,`epub:type`,`noteref`),t}stanza(e){let t=this.convert(e,{stanza:[`p`,{title:[`header`,{p:[`strong`,i],"empty-line":[`br`]}],subtitle:[`p`,i]}]});for(let n of e.children)n.nodeName===`v`&&(t.append(this.doc.createTextNode(n.textContent)),t.append(this.doc.createElement(`br`)));return t}convert(e,t){if(e.nodeType===3)return this.doc.createTextNode(e.textContent);if(e.nodeType===4)return this.doc.createCDATASection(e.textContent);if(e.nodeType===8)return this.doc.createComment(e.textContent);let n=t?.[e.nodeName];if(!n)return null;if(typeof n==`string`)return this[n](e);let[r,i,a]=n,o=this.doc.createElement(r);if(e.id&&(o.id=e.id),o.classList.add(e.nodeName),Array.isArray(a))for(let t of a){let n=e.getAttribute(t);n&&o.setAttribute(t,n)}let s=i===`self`?t:i,c=e.firstChild;for(;c;){let e=this.convert(c,s);e&&o.append(e),c=c.nextSibling}return o}},u=async e=>{let t=await e.arrayBuffer(),n=new TextDecoder(`utf-8`).decode(t),i=new DOMParser,a=i.parseFromString(n,r.XML),o=a.xmlEncoding||n.match(/^<\?xml\s+version\s*=\s*["']1.\d+"\s+encoding\s*=\s*["']([A-Za-z0-9._-]*)["']/)?.[1];if(o&&o.toLowerCase()!==`utf-8`){let e=new TextDecoder(o).decode(t);return i.parseFromString(e,r.XML)}return a},d=URL.createObjectURL(new Blob([`
|
||||
@namespace epub "http://www.idpf.org/2007/ops";
|
||||
body > img, section > img {
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
.title h1 {
|
||||
text-align: center;
|
||||
}
|
||||
body > section > .title, body.notesBodyType > .title {
|
||||
margin: 3em 0;
|
||||
}
|
||||
body.notesBodyType > section .title h1 {
|
||||
text-align: start;
|
||||
}
|
||||
body.notesBodyType > section .title {
|
||||
margin: 1em 0;
|
||||
}
|
||||
p {
|
||||
text-indent: 1em;
|
||||
margin: 0;
|
||||
}
|
||||
:not(p) + p, p:first-child {
|
||||
text-indent: 0;
|
||||
}
|
||||
.poem p {
|
||||
text-indent: 0;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.text-author, .date {
|
||||
text-align: end;
|
||||
}
|
||||
.text-author:before {
|
||||
content: "—";
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
td, th {
|
||||
padding: .25em;
|
||||
}
|
||||
a[epub|type~="noteref"] {
|
||||
font-size: .75em;
|
||||
vertical-align: super;
|
||||
}
|
||||
body:not(.notesBodyType) > .title, body:not(.notesBodyType) > .epigraph {
|
||||
margin: 3em 0;
|
||||
}
|
||||
`],{type:`text/css`})),f=e=>`<?xml version="1.0" encoding="utf-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head><link href="${d}" rel="stylesheet" type="text/css"/></head>
|
||||
<body>${e}</body>
|
||||
</html>`,p=`data-foliate-id`,m=async n=>{let i={},a=await u(n),o=new l(a),d=e=>a.querySelector(e),m=e=>[...a.querySelectorAll(e)],h=e=>{let n=t(e.querySelector(`nickname`));if(n)return n;let r=t(e.querySelector(`first-name`)),i=t(e.querySelector(`middle-name`)),a=t(e.querySelector(`last-name`));return{name:[r,i,a].filter(e=>e).join(` `),sortAs:a?[a,[r,i].filter(e=>e).join(` `)].join(`, `):null}},g=e=>e?.getAttribute(`value`)??t(e),_=d(`title-info annotation`);if(i.metadata={title:t(d(`title-info book-title`)),identifier:t(d(`document-info id`)),language:t(d(`title-info lang`)),author:m(`title-info author`).map(h),translator:m(`title-info translator`).map(h),contributor:m(`document-info author`).map(h).concat(m(`document-info program-used`).map(t)).map(e=>Object.assign(typeof e==`string`?{name:e}:e,{role:`bkp`})),publisher:t(d(`publish-info publisher`)),published:g(d(`title-info date`)),modified:g(d(`document-info date`)),description:_?o.convert(_,{annotation:[`div`,s]}).innerHTML:null,subject:m(`title-info genre`).map(t)},d(`coverpage image`)){let e=o.getImageSrc(d(`coverpage image`));i.getCover=()=>fetch(e).then(e=>e.blob())}else i.getCover=()=>null;let v=Array.from(a.querySelectorAll(`body`),e=>{let t=o.convert(e,{body:[`body`,c]});return[Array.from(t.children,e=>({el:e,ids:[e,...e.querySelectorAll(`[id]`)].map(e=>e.id)})),t]}),y=[],b=v[0][0].map(({el:e,ids:n})=>({ids:n,titles:Array.from(e.querySelectorAll(`:scope > section > .title`),(e,n)=>(e.setAttribute(p,n),{title:t(e),index:n})),el:e})).concat(v.slice(1).map(([e,t])=>{let n=e.map(e=>e.ids).flat();return t.classList.add(`notesBodyType`),{ids:n,el:t,linear:`no`}})).map(({ids:t,titles:n,el:i,linear:a})=>{let o=f(i.outerHTML),s=new Blob([o],{type:r.XHTML}),c=URL.createObjectURL(s);return y.push(c),{ids:t,title:e(i.querySelector(`.title, .subtitle, p`)?.textContent??(i.classList.contains(`title`)?i.textContent:``)),titles:n,load:()=>c,createDocument:()=>new DOMParser().parseFromString(o,r.XHTML),size:s.size-Array.from(i.querySelectorAll(`[src]`),e=>e.getAttribute(`src`)?.length??0).reduce((e,t)=>e+t,0),linear:a}}),x=new Map;return i.sections=b.map((e,t)=>{let{ids:n,load:r,createDocument:i,size:a,linear:o}=e;for(let e of n)e&&x.set(e,t);return{id:t,load:r,createDocument:i,size:a,linear:o}}),i.toc=b.map(({title:e,titles:t},n)=>{let r=n.toString();return{label:e,href:r,subitems:t?.length?t.map(({title:e,index:t})=>({label:e,href:`${r}#${t}`})):null}}).filter(e=>e),i.resolveHref=e=>{let[t,n]=e.split(`#`);return t?{index:Number(t),anchor:e=>e.querySelector(`[${p}="${n}"]`)}:{index:x.get(n),anchor:e=>e.getElementById(n)}},i.splitTOCHref=e=>e?.split(`#`)?.map(e=>Number(e))??[],i.getTOCFragment=(e,t)=>e.querySelector(`[${p}="${t}"]`),i.isExternal=e=>/^\w+:/i.test(e),i.destroy=()=>{for(let e of y)URL.revokeObjectURL(e)},i};export{m as makeFB2};
|
||||
@@ -0,0 +1 @@
|
||||
var e=Uint8Array,t=Uint16Array,n=Int32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(e,r){for(var i=new t(31),a=0;a<31;++a)i[a]=r+=1<<e[a-1];var o=new n(i[30]);for(a=1;a<30;++a)for(var s=i[a];s<i[a+1];++s)o[s]=s-i[a]<<5|a;return{b:i,r:o}},s=o(r,2),c=s.b,l=s.r;c[28]=258,l[258]=28;for(var u=o(i,0).b,d=new t(32768),f=0;f<32768;++f){var p=(43690&f)>>1|(21845&f)<<1;p=(61680&(p=(52428&p)>>2|(13107&p)<<2))>>4|(3855&p)<<4,d[f]=((65280&p)>>8|(255&p)<<8)>>1}var m=function(e,n,r){for(var i=e.length,a=0,o=new t(n);a<i;++a)e[a]&&++o[e[a]-1];var s,c=new t(n);for(a=1;a<n;++a)c[a]=c[a-1]+o[a-1]<<1;if(r){s=new t(1<<n);var l=15-n;for(a=0;a<i;++a)if(e[a])for(var u=a<<4|e[a],f=n-e[a],p=c[e[a]-1]++<<f,m=p|(1<<f)-1;p<=m;++p)s[d[p]>>l]=u}else for(s=new t(i),a=0;a<i;++a)e[a]&&(s[a]=d[c[e[a]-1]++]>>15-e[a]);return s},h=new e(288);for(f=0;f<144;++f)h[f]=8;for(f=144;f<256;++f)h[f]=9;for(f=256;f<280;++f)h[f]=7;for(f=280;f<288;++f)h[f]=8;var g=new e(32);for(f=0;f<32;++f)g[f]=5;var _=m(h,9,1),ee=m(g,5,1),v=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},y=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},b=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},te=function(e){return(e+7)/8|0},x=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],S=function(e,t,n){var r=Error(t||x[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,S),!n)throw r;return r},C=function(t,n,o,s){var l=t.length,d=s?s.length:0;if(!l||n.f&&!n.l)return o||new e(0);var f=!o,p=f||n.i!=2,h=n.i;f&&(o=new e(3*l));var g=function(t){var n=o.length;if(t>n){var r=new e(Math.max(2*n,t));r.set(o),o=r}},x=n.f||0,C=n.p||0,w=n.b||0,T=n.l,E=n.d,D=n.m,O=n.n,k=8*l;do{if(!T){x=y(t,C,1);var A=y(t,C+1,3);if(C+=3,!A){var j=t[(B=te(C)+4)-4]|t[B-3]<<8,M=B+j;if(M>l){h&&S(0);break}p&&g(w+j),o.set(t.subarray(B,M),w),n.b=w+=j,n.p=C=8*M,n.f=x;continue}if(A==1)T=_,E=ee,D=9,O=5;else if(A==2){var N=y(t,C,31)+257,P=y(t,C+10,15)+4,F=N+y(t,C+5,31)+1;C+=14;for(var I=new e(F),L=new e(19),R=0;R<P;++R)L[a[R]]=y(t,C+3*R,7);C+=3*P;var z=v(L),ne=(1<<z)-1,re=m(L,z,1);for(R=0;R<F;){var B,V=re[y(t,C,ne)];if(C+=15&V,(B=V>>4)<16)I[R++]=B;else{var H=0,U=0;for(B==16?(U=3+y(t,C,3),C+=2,H=I[R-1]):B==17?(U=3+y(t,C,7),C+=3):B==18&&(U=11+y(t,C,127),C+=7);U--;)I[R++]=H}}var W=I.subarray(0,N),G=I.subarray(N);D=v(W),O=v(G),T=m(W,D,1),E=m(G,O,1)}else S(1);if(C>k){h&&S(0);break}}p&&g(w+131072);for(var ie=(1<<D)-1,ae=(1<<O)-1,K=C;;K=C){var q=(H=T[b(t,C)&ie])>>4;if((C+=15&H)>k){h&&S(0);break}if(H||S(2),q<256)o[w++]=q;else{if(q==256){K=C,T=null;break}var J=q-254;if(q>264){var Y=r[R=q-257];J=y(t,C,(1<<Y)-1)+c[R],C+=Y}var X=E[b(t,C)&ae],Z=X>>4;if(X||S(3),C+=15&X,G=u[Z],Z>3&&(Y=i[Z],G+=b(t,C)&(1<<Y)-1,C+=Y),C>k){h&&S(0);break}p&&g(w+131072);var Q=w+J;if(w<G){var $=d-G,oe=Math.min(G,Q);for($+w<0&&S(3);w<oe;++w)o[w]=s[$+w]}for(;w<Q;++w)o[w]=o[w-G]}}n.l=T,n.p=K,n.b=w,n.f=x,T&&(x=1,n.m=D,n.d=E,n.n=O)}while(!x);return w!=o.length&&f?function(t,n,r){return(r==null||r>t.length)&&(r=t.length),new e(t.subarray(n,r))}(o,0,w):o.subarray(0,w)},w=new e(0);function T(e,t){return C(e.subarray((n=e,r=t&&t.dictionary,((15&n[0])!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&S(6,`invalid zlib data`),(n[1]>>5&1)==+!r&&S(6,`invalid zlib data: `+(32&n[1]?`need`:`unexpected`)+` dictionary`),2+(n[1]>>3&4)),-4),{i:2},t&&t.out,t&&t.dictionary);var n,r}var E=typeof TextDecoder<`u`&&new TextDecoder;try{E.decode(w,{stream:!0})}catch{}export{T as unzlibSync};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
var e=()=>{throw Error(`PDFs are handled by ReaderJS PDFRenderer, not foliate-js`)};export{e as makePDF};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#005cc5}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-comment,.hljs-code,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./marked.esm-N0v7i-_3.js","./defineProperty-BbfpZ9Tg.js"])))=>i.map(i=>d[i]);
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=class extends t{async load(t,n,r){await super.load(t,n,r);let{marked:i}=await e(async()=>{let{marked:e}=await import(`./marked.esm-N0v7i-_3.js`);return{marked:e}},__vite__mapDeps([0,1]),import.meta.url),a=new TextDecoder().decode(t),o=await i.parse(a,{async:!1});n.innerHTML=``;let s=document.createElement(`div`);s.className=`doc-page`,s.dataset.page=1,s.innerHTML=o,n.appendChild(s),this.numPages=1}};export{n as MDRenderer};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=class extends t{async load(t,n,r){await super.load(t,n,r);let{convert:i}=await e(async()=>{let{convert:e}=await import(`./lib-CTiWugWo.js`);return{convert:e}},[],import.meta.url),{data:a}=await i(new Uint8Array(t),{enableScripts:!1,fetchMissingResources:!1});n.innerHTML=``;let o=document.createElement(`div`);o.className=`doc-page mhtml-page`,o.dataset.page=1;let s=document.createElement(`iframe`);s.className=`mhtml-frame`,s.sandbox=`allow-same-origin`,s.srcdoc=a,s.addEventListener(`load`,()=>{let e=s.contentDocument;e&&(s.style.height=`${e.documentElement.scrollHeight}px`)}),o.appendChild(s),n.appendChild(o),this.numPages=1}};export{n as MHTMLRenderer};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{t}from"./jszip.min-C__FR9jF.js";import{t as n}from"./base-renderer-DM6Nw1yD.js";var r=e(t()),i={text:`urn:oasis:names:tc:opendocument:xmlns:text:1.0`,table:`urn:oasis:names:tc:opendocument:xmlns:table:1.0`,draw:`urn:oasis:names:tc:opendocument:xmlns:drawing:1.0`,xlink:`http://www.w3.org/1999/xlink`,style:`urn:oasis:names:tc:opendocument:xmlns:style:1.0`,fo:`urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0`};function a(e,t,n){return e.getElementsByTagNameNS(t,n)[0]??null}var o=class extends n{constructor(){super(),this._imgUrls=[]}async load(e,t,n){await super.load(e,t,n);let i=await r.default.loadAsync(e),o=i.file(`mimetype`);if(!o)throw Error(`Not a valid ODF file (missing mimetype entry)`);let s=(await o.async(`string`)).trim();if(!s.startsWith(`application/vnd.oasis.opendocument`))throw Error(`Unexpected MIME type: ${s}`);let c=i.file(`content.xml`);if(!c)throw Error(`ODF file has no content.xml`);let l=await c.async(`string`),u=new DOMParser().parseFromString(l,`application/xml`),d=a(u,`http://www.mozilla.org/newlayout/xml/parsererror.xml`,`parseerror`);if(d)throw Error(`content.xml parse error: ${d.textContent.slice(0,120)}`);let f=await this._extractImages(i),p=await this._convertToHtml(u,f);t.innerHTML=``;let m=document.createElement(`div`);m.className=`doc-page`,m.dataset.page=1,m.innerHTML=p,t.appendChild(m),this.numPages=1}async _extractImages(e){let t={};e.forEach((e,n)=>{/^(Pictures|images)\//i.test(e)&&!n.dir&&(t[e]=n)});let n={};for(let[e,r]of Object.entries(t)){let t=await r.async(`uint8array`),i={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`}[e.split(`.`).pop().toLowerCase()]??`application/octet-stream`,a=URL.createObjectURL(new Blob([t],{type:i}));this._imgUrls.push(a),n[e]=a}return n}_convertToHtml(e,t){let n=e.querySelector(`*|body`)??e.documentElement,r=[];return this._nodeToHtml(n,r,t),r.join(``)}_nodeToHtml(e,t,n){if(e.nodeType===Node.TEXT_NODE){t.push(this._esc(e.textContent));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let r=e.namespaceURI,a=e.localName;if(r===i.text){if(a===`p`){t.push(`<p>`),this._childrenToHtml(e,t,n),t.push(`</p>`);return}if(a===`h`){let r=Math.min(6,Math.max(1,parseInt(e.getAttributeNS(i.text,`outline-level`)||`1`,10)));t.push(`<h${r}>`),this._childrenToHtml(e,t,n),t.push(`</h${r}>`);return}if(a===`span`){t.push(`<span>`),this._childrenToHtml(e,t,n),t.push(`</span>`);return}if(a===`a`){let r=e.getAttributeNS(i.xlink,`href`)||`#`;t.push(`<a href="${this._esc(r)}" target="_blank" rel="noopener">`),this._childrenToHtml(e,t,n),t.push(`</a>`);return}if(a===`line-break`){t.push(`<br>`);return}if(a===`s`){t.push(` `);return}if(a===`tab`){t.push(` `);return}if(a===`list`){t.push(`<ul>`),this._childrenToHtml(e,t,n),t.push(`</ul>`);return}if(a===`list-item`){t.push(`<li>`),this._childrenToHtml(e,t,n),t.push(`</li>`);return}}if(r===i.table){if(a===`table`){t.push(`<table>`),this._childrenToHtml(e,t,n),t.push(`</table>`);return}if(a===`table-row`){t.push(`<tr>`),this._childrenToHtml(e,t,n),t.push(`</tr>`);return}if(a===`table-cell`){t.push(`<td>`),this._childrenToHtml(e,t,n),t.push(`</td>`);return}}if(r===i.draw){if(a===`frame`){this._childrenToHtml(e,t,n);return}if(a===`image`){let r=e.getAttributeNS(i.xlink,`href`)||``,a=n[r]??n[r.replace(/^\//,``)]??``;a&&t.push(`<img src="${a}" style="max-width:100%;height:auto">`);return}}this._childrenToHtml(e,t,n)}_childrenToHtml(e,t,n){for(let r of e.childNodes)this._nodeToHtml(r,t,n)}_esc(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}destroy(){this._imgUrls.forEach(e=>URL.revokeObjectURL(e)),this._imgUrls=[],super.destroy()}};export{o as ODFRenderer};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./document-BvO1jqhz.js","./driver-0cTj10HJ.js","./canvas-driver-BnEksqHW.js"])))=>i.map(i=>d[i]);
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=class extends t{async load(t,n,r){await super.load(t,n,r);let[{loadDocument:i,pageSize:a,renderPageToDriver:o},{CanvasDriver:s}]=await Promise.all([e(()=>import(`./document-BvO1jqhz.js`),__vite__mapDeps([0,1]),import.meta.url),e(()=>import(`./canvas-driver-BnEksqHW.js`),__vite__mapDeps([2,1]),import.meta.url)]),c=t instanceof Uint8Array?t:new Uint8Array(t),l=``;for(let e=0;e<c.length;e+=8192)l+=String.fromCharCode.apply(null,c.subarray(e,e+8192));let u=i(l);n.innerHTML=``;for(let e=0;e<u.pageCount;e++){let{width:t,height:r}=a(u,e),i=document.createElement(`div`);i.className=`postscript-page`,i.dataset.page=String(e+1);let c=document.createElement(`canvas`);c.width=Math.max(1,Math.round(t)),c.height=Math.max(1,Math.round(r));let l=c.getContext(`2d`);try{l&&o(u,e,new s(l))}catch(t){console.warn(`[PostScript] page ${e+1} render error:`,t?.message||t)}i.appendChild(c),n.appendChild(i)}let d=u.pageCount?a(u,0):{width:816,height:1056};this._pageW=Math.round(d.width)||816,this._pageH=Math.round(d.height)||1056,this.numPages=u.pageCount||1}setScale(e){this.scale=e,this.container?.querySelectorAll(`.postscript-page`).forEach(t=>{t.style.zoom=e===1?``:e})}getPageWidth(){return this._pageW||816}getPageHeight(){return this._pageH||null}};export{n as PostScriptRenderer};
|
||||
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./PptxViewJS.es-DznKWbU1.js","./rolldown-runtime-DAXXjFlN.js","./defineProperty-BbfpZ9Tg.js","./jszip.min-C__FR9jF.js"])))=>i.map(i=>d[i]);
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=9525,r=320,i=400,a=class extends t{constructor(){super(),this._view=null,this._wrap=null,this._canvas=null,this._idx=0,this._slideW=960,this._slideH=720,this._gen=0,this._chain=Promise.resolve(),this.defaultScaleOption=`page-fit`,this.buildsThumbnailsAsync=!0}async load(t,n,r){await super.load(t,n,r);let a=++this._gen,{PPTXViewer:o}=await e(async()=>{let{PPTXViewer:e}=await import(`./PptxViewJS.es-DznKWbU1.js`);return{PPTXViewer:e}},__vite__mapDeps([0,1,2,3]),import.meta.url);n.innerHTML=``;let s=document.createElement(`div`);s.className=`pptx-slide`;let c=document.createElement(`canvas`);s.appendChild(c),n.appendChild(s),this._wrap=s,this._canvas=c,await this._loadWithRetry(t,a,o),setTimeout(()=>{a===this._gen&&this._buildThumbnails(a)},i)}async _loadWithRetry(e,t,r){let i;for(let a=0;a<2;a++)try{if(this._chain=Promise.resolve(),this._view=new r({canvas:this._canvas,slideSizeMode:`fit`}),await this._view.loadFile(e),t!==this._gen)return;this.numPages=this._view.getSlideCount()||1,this._idx=0;let i=this._view.presentation?.slideSize;i?.cx&&i?.cy&&(this._slideW=Math.round(i.cx/n),this._slideH=Math.round(i.cy/n)),await this._renderSlide(0);return}catch(e){i=e,await new Promise(e=>setTimeout(e,200))}throw i}_enqueue(e){let t=this._chain.then(()=>this._view?e():void 0);return this._chain=t.catch(()=>{}),t}_renderSlide(e){return this._enqueue(async()=>{this._canvas.width=this._slideW,this._canvas.height=this._slideH,await this._view.renderSlide(e,this._canvas)})}async _buildThumbnails(e){let t=document.getElementById(`thumbsContent`);if(!t)return;let n=r,i=Math.max(1,Math.round(n*this._slideH/this._slideW)),a=document.createElement(`canvas`);a.width=n,a.height=i;for(let n=0;n<this.numPages;n++){if(await this._enqueue(()=>this._view.renderSlide(n,a)).catch(()=>{}),e!==this._gen||!this._view)return;let r=document.createElement(`img`);r.src=a.toDataURL(`image/png`);let i=document.createElement(`div`);i.className=`thumb`,i.dataset.thumbPage=n+1;let o=document.createElement(`div`);o.className=`thumb-label`,o.textContent=n+1,i.append(r,o),i.addEventListener(`click`,()=>this.viewer?.goToPage(n+1)),t.appendChild(i)}this._highlightThumb(this._idx+1)}scrollToPage(e){this._view&&(this._idx=Math.max(0,Math.min(this.numPages-1,e-1)),this._renderSlide(this._idx).catch(()=>{}),this._highlightThumb(this._idx+1))}_highlightThumb(e){document.querySelectorAll(`#thumbsContent .thumb`).forEach(t=>{t.classList.toggle(`active`,+t.dataset.thumbPage===e)})}setScale(e){this.scale=e,this._wrap&&(this._wrap.style.zoom=e===1?``:e)}getPageWidth(){return this._slideW}getPageHeight(){return this._slideH}destroy(){this._gen++,this._view=null,this._wrap=null,this._canvas=null,super.destroy()}};export{a as PPTXRenderer};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
|
||||
var e=/^\s*(javascript|vbscript|data:text\/html|data:application|about|mhtml|file|ms-its|mk):/i,t={css:`text/css`,htm:`text/html`,html:`text/html`,gif:`image/gif`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`,webp:`image/webp`,js:`text/javascript`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`};function n(e){return t[(e.split(`.`).pop()||``).toLowerCase()]||`application/octet-stream`}var r=class{constructor(e){this.reader=e,this.urls=new Map}urlFor(e){if(this.urls.has(e))return this.urls.get(e);let t=this.reader.getFile(e);if(!t)return this.urls.set(e,null),null;let r=new Blob([t],{type:n(e)}),i=URL.createObjectURL(r);return this.urls.set(e,i),i}revokeAll(){for(let e of this.urls.values())e&&URL.revokeObjectURL(e);this.urls.clear()}},i=`default-src 'none'; img-src blob: data:; style-src blob: data: 'unsafe-inline'; font-src blob: data:; media-src blob: data:; frame-src blob:; object-src 'none'; base-uri 'none'; form-action 'none'`,a=`
|
||||
html { background: #f4f4f6; }
|
||||
body { background: #ffffff; color: #1b1b1f; margin: 0; padding: 22px 26px;
|
||||
max-width: 100%; overflow-wrap: break-word; }
|
||||
img { max-width: 100%; height: auto; }
|
||||
a { color: #1a56db; }
|
||||
::selection { background: #b9d2ff; }
|
||||
mark.chm-find { background: #ffd54a; color: #1b1b1f; padding: 0; }
|
||||
mark.chm-find.chm-active { background: #ff9d3b; box-shadow: 0 0 0 2px #ff9d3b; }
|
||||
|
||||
/* Thin, modern scrollbars for the topic (no native stepper arrows). */
|
||||
html { scrollbar-width: thin; scrollbar-color: rgba(135,135,150,0.6) transparent; }
|
||||
::-webkit-scrollbar { width: 12px; height: 12px; }
|
||||
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
::-webkit-scrollbar-corner { background: transparent; }
|
||||
::-webkit-scrollbar-thumb { background: rgba(135,135,150,0.6); border-radius: 7px;
|
||||
border: 3px solid transparent; background-clip: padding-box; }
|
||||
::-webkit-scrollbar-thumb:hover { background: rgba(135,135,150,0.85); }
|
||||
|
||||
/* Document theme. CHM topics carry arbitrary inline colours, so dark mode is
|
||||
a smart-invert filter on the root with media re-inverted back to normal. */
|
||||
html[data-theme="dark"] { filter: invert(1) hue-rotate(180deg); }
|
||||
html[data-theme="dark"] img, html[data-theme="dark"] picture, html[data-theme="dark"] video,
|
||||
html[data-theme="dark"] svg, html[data-theme="dark"] canvas, html[data-theme="dark"] embed,
|
||||
html[data-theme="dark"] object, html[data-theme="dark"] iframe { filter: invert(1) hue-rotate(180deg); }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html[data-theme="system"] { filter: invert(1) hue-rotate(180deg); }
|
||||
html[data-theme="system"] img, html[data-theme="system"] picture, html[data-theme="system"] video,
|
||||
html[data-theme="system"] svg, html[data-theme="system"] canvas, html[data-theme="system"] embed,
|
||||
html[data-theme="system"] object, html[data-theme="system"] iframe { filter: invert(1) hue-rotate(180deg); }
|
||||
}
|
||||
`;function o(t,n,r){let o=t.getText(n)||``,c=new DOMParser().parseFromString(o,`text/html`);c.querySelectorAll(`script, noscript, base, meta[http-equiv], object, embed, applet`).forEach(e=>e.remove());for(let t of c.querySelectorAll(`*`))for(let n of Array.from(t.attributes)){let r=n.name.toLowerCase();if(r.startsWith(`on`)){t.removeAttribute(n.name);continue}(r===`href`||r===`src`||r===`background`)&&e.test(n.value)&&t.removeAttribute(n.name)}let l=e=>t.resolvePath(n,e);c.querySelectorAll(`img[src], input[type="image"][src]`).forEach(e=>{let t=r.urlFor(l(e.getAttribute(`src`)));t?e.setAttribute(`src`,t):e.removeAttribute(`src`),e.removeAttribute(`srcset`),e.removeAttribute(`loading`)}),c.querySelectorAll(`[background]`).forEach(e=>{let t=r.urlFor(l(e.getAttribute(`background`)));t?e.setAttribute(`background`,t):e.removeAttribute(`background`)}),c.querySelectorAll(`link[rel~="stylesheet" i][href]`).forEach(e=>{let n=l(e.getAttribute(`href`)),i=t.getFile(n);if(i){let a=new TextDecoder(`utf-8`).decode(i),o=c.createElement(`style`);o.textContent=s(a,n,t,r),e.replaceWith(o)}else e.remove()}),c.querySelectorAll(`style`).forEach(e=>{e.textContent=s(e.textContent||``,n,t,r)}),c.querySelectorAll(`[style]`).forEach(e=>{let i=e.getAttribute(`style`);i&&i.includes(`url(`)&&e.setAttribute(`style`,s(i,n,t,r))}),c.querySelectorAll(`frame[src], iframe[src]`).forEach(e=>{let t=r.urlFor(l(e.getAttribute(`src`)));t?e.setAttribute(`src`,t):e.removeAttribute(`src`)}),c.querySelectorAll(`a[href]`).forEach(e=>{let t=e.getAttribute(`href`).trim();if(t.startsWith(`#`))return;if(/^(https?|mailto|ftp):/i.test(t)){e.setAttribute(`data-chm-ext`,t),e.setAttribute(`href`,`#`);return}let n=l(t),r=(t.match(/#(.*)$/)||[,``])[1];e.setAttribute(`data-chm-href`,n),r&&e.setAttribute(`data-chm-frag`,r),e.setAttribute(`href`,`#`)});let u=c.head||c.createElement(`head`),d=c.createElement(`meta`);d.setAttribute(`http-equiv`,`Content-Security-Policy`),d.setAttribute(`content`,i),u.insertBefore(d,u.firstChild);let f=c.createElement(`style`);return f.textContent=a,u.appendChild(f),`<!DOCTYPE html>
|
||||
`+c.documentElement.outerHTML}function s(e,t,n,r){let i=e.replace(/@import\s+[^;]+;/gi,``);return i=i.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi,(e,i,a)=>{let o=a.trim();if(/^(data:|blob:|https?:|#)/i.test(o))return e;let s=r.urlFor(n.resolvePath(t,o));return s?`url("${s}")`:`none`}),i}export{r as BlobCache,o as renderTopic};
|
||||
@@ -0,0 +1 @@
|
||||
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e),f=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});export{d as a,f as i,o as n,u as o,c as r,s as t};
|
||||
@@ -0,0 +1 @@
|
||||
import{t as e}from"./base-renderer-DM6Nw1yD.js";var t=`./`,n=[`${t}rtfjs/jquery.min.js`,`${t}rtfjs/EMFJS.bundle.min.js`,`${t}rtfjs/WMFJS.bundle.min.js`,`${t}rtfjs/RTFJS.bundle.min.js`],r=!1;function i(e){return new Promise((t,n)=>{if(document.querySelector(`script[src="${e}"]`))return t();let r=document.createElement(`script`);r.src=e,r.onload=t,r.onerror=()=>n(Error(`Failed to load: ${e}`)),document.head.appendChild(r)})}async function a(){if(!(r&&window.RTFJS)){for(let e of n)await i(e);if(!window.RTFJS)throw Error(`RTFJS global not set after script load`);r=!0}}var o=class extends e{async load(e,t,n){await super.load(e,t,n),await a();let r=await new window.RTFJS.Document(e).render();t.innerHTML=``;let i=document.createElement(`div`);i.className=`doc-page`,i.dataset.page=1,window.$(i).append(r),t.appendChild(i),this.numPages=1}};export{o as RTFRenderer};
|
||||
@@ -0,0 +1 @@
|
||||
var e=50,t=e=>e.replace(/\s+/g,` `),n=(n,{startIndex:r,startOffset:i,endIndex:a,endOffset:o})=>{let s=n[r],c=n[a],l=s===c?s.slice(i,o):s.slice(i)+n.slice(s+1,c).join(``)+c.slice(0,o),u=t(s.slice(0,i)).trimStart(),d=t(c.slice(o)).trimEnd(),f=u.length<e?``:`…`,p=d.length<e?``:`…`;return{pre:`${f}${u.slice(-50)}`,match:l,post:`${d.slice(0,e)}${p}`}},r=function*(e,t,r={}){let{locales:i=`en`,sensitivity:a}=r,o=a===`variant`,s=e.join(``),c=o?s:s.toLocaleLowerCase(i),l=o?t:t.toLocaleLowerCase(i),u=l.length,d=-1,f=-1,p=0;do if(d=c.indexOf(l,d+1),d>-1){for(;p<=d;)p+=e[++f].length;let t=f,r=d-(p-e[f].length),i=d+u;for(;p<=i;)p+=e[++f].length;let a={startIndex:t,startOffset:r,endIndex:f,endOffset:i-(p-e[f].length)};yield{range:a,excerpt:n(e,a)}}while(d>-1)},i=function*(e,t,r={}){let{locales:i=`en`,granularity:a=`word`,sensitivity:o=`base`}=r,s,c;try{s=new Intl.Segmenter(i,{usage:`search`,granularity:a}),c=new Intl.Collator(i,{sensitivity:o})}catch(e){console.warn(e),s=new Intl.Segmenter(`en`,{usage:`search`,granularity:a}),c=new Intl.Collator(`en`,{sensitivity:o})}let l=Array.from(s.segment(t)).length,u=[],d=0,f=s.segment(e[d])[Symbol.iterator]();main:for(;d<e.length;){for(;u.length<l;){let{done:t,value:n}=f.next();if(t)if(d++,d<e.length){f=s.segment(e[d])[Symbol.iterator]();continue}else break main;let{index:r,segment:i}=n;if(/[^\p{Format}]/u.test(i)){if(/\s/u.test(i)){/\s/u.test(u[u.length-1]?.segment)||u.push({strIndex:d,index:r,segment:` `});continue}n.strIndex=d,u.push(n)}}let r=u.map(e=>e.segment).join(``);if(c.compare(t,r)===0){let t=d,r=u[u.length-1],i=r.index+r.segment.length,a={startIndex:u[0].strIndex,startOffset:u[0].index,endIndex:t,endOffset:i};yield{range:a,excerpt:n(e,a)}}u.shift()}},a=(e,t,n)=>{let{granularity:a=`grapheme`,sensitivity:o=`base`}=n;return!Intl?.Segmenter||a===`grapheme`&&(o===`variant`||o===`accent`)?r(e,t,n):i(e,t,n)},o=(e,t)=>{let{defaultLocale:n,matchCase:r,matchDiacritics:i,matchWholeWords:o,acceptNode:s}=t;return function*(t,c){let l=e(t,function*(e,s){for(let l of a(e,c,{locales:t.body.lang||t.documentElement.lang||n||`en`,granularity:o?`word`:`grapheme`,sensitivity:i&&r?`variant`:i&&!r?`accent`:!i&&r?`case`:`base`})){let{startIndex:e,startOffset:t,endIndex:n,endOffset:r}=l.range;l.range=s(e,t,n,r),yield l}},s);for(let e of l)yield e}};export{o as searchMatcher};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
import{t as e}from"./base-renderer-DM6Nw1yD.js";var t=class extends e{async load(e,t,n){await super.load(e,t,n);let r=new TextDecoder(`utf-8`).decode(e);t.innerHTML=``;let i=document.createElement(`div`);i.className=`doc-page`,i.dataset.page=1;let a=document.createElement(`pre`);a.className=`txt-content`,a.textContent=r,i.appendChild(a),t.appendChild(i),this.numPages=1}};export{t as TXTRenderer};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
import{t as e}from"./reader-Bd1ccloG.js";import{t}from"./base-renderer-DM6Nw1yD.js";var n=class extends t{async load(t,n,r){await super.load(t,n,r);let i=await e(()=>import(`./xlsx-vk3JpTXp.js`),[],import.meta.url),a=i.read(new Uint8Array(t),{type:`array`});n.innerHTML=``;let o=document.createElement(`div`);o.className=`doc-page`,o.dataset.page=1;let s=a.SheetNames.length>1;a.SheetNames.forEach(e=>{if(s){let t=document.createElement(`h3`);t.className=`sheet-title`,t.textContent=e,o.appendChild(t)}let t=document.createElement(`div`);t.className=`data-table-wrap`,t.innerHTML=i.utils.sheet_to_html(a.Sheets[e]);let n=t.querySelector(`table`);n&&n.classList.add(`data-table`),o.appendChild(t)}),n.appendChild(o),this.numPages=1}};export{n as XLSXRenderer};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title data-i18n="app.title">ReaderJS — Universal Document Viewer</title>
|
||||
<!-- WebODF is loaded on-demand by odf-renderer.js when an ODF file is opened -->
|
||||
<script type="module" crossorigin src="./assets/reader-Bd1ccloG.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/reader-BsenByj_.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="outerContainer">
|
||||
|
||||
<!-- Sidebar: page thumbnails -->
|
||||
<div id="sidebarContainer">
|
||||
<div id="sidebarToolbar">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
|
||||
<path d="M3,11H11V3H3M3,21H11V13H3M13,21H21V13H13M13,3V11H21V3" />
|
||||
</svg>
|
||||
<span class="sidebar-title" data-i18n="sidebar.pages">Pages</span>
|
||||
</div>
|
||||
<div id="sidebarContent">
|
||||
<div id="thumbsContent"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main content -->
|
||||
<div id="mainContainer">
|
||||
|
||||
<!-- Top toolbar -->
|
||||
<div id="toolbarContainer">
|
||||
<div id="toolbarLeft">
|
||||
<button id="sidebarToggle" class="toolbar-btn" title="Toggle Sidebar" data-i18n-title="tip.sidebar">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
|
||||
<path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="toolbar-separator"></div>
|
||||
|
||||
<button id="prevPage" class="toolbar-btn" title="Previous Page (←)" data-i18n-title="tip.prevPage" disabled>
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
|
||||
<path d="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div id="pageNumberGroup">
|
||||
<input id="pageNumber" type="number" value="1" min="1" max="1" title="Current Page" data-i18n-title="tip.currentPage" />
|
||||
<span class="page-sep">/</span>
|
||||
<span id="totalPages">—</span>
|
||||
</div>
|
||||
|
||||
<button id="nextPage" class="toolbar-btn" title="Next Page (→)" data-i18n-title="tip.nextPage" disabled>
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor">
|
||||
<path d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="toolbarMiddle">
|
||||
<button id="zoomOut" class="toolbar-btn" title="Zoom Out (Ctrl -)" data-i18n-title="tip.zoomOut">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
|
||||
<path d="M19,13H5V11H19V13Z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<select id="scaleSelect" title="Zoom" data-i18n-title="tip.zoom">
|
||||
<option value="auto" data-i18n="zoom.auto">Auto</option>
|
||||
<option value="page-fit" data-i18n="zoom.pageFit">Page Fit</option>
|
||||
<option value="page-width" data-i18n="zoom.pageWidth">Page Width</option>
|
||||
<option value="page-height" data-i18n="zoom.fitHeight">Fit Height</option>
|
||||
<option value="0.5">50%</option>
|
||||
<option value="0.75">75%</option>
|
||||
<option value="1" selected>100%</option>
|
||||
<option value="1.25">125%</option>
|
||||
<option value="1.5">150%</option>
|
||||
<option value="2">200%</option>
|
||||
<option value="3">300%</option>
|
||||
</select>
|
||||
|
||||
<button id="zoomIn" class="toolbar-btn" title="Zoom In (Ctrl +)" data-i18n-title="tip.zoomIn">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
|
||||
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="toolbarRight">
|
||||
<select id="compareModeSelect" class="compare-only" title="Compare view" data-i18n-title="compare.badge">
|
||||
<option value="side-by-side" data-i18n="compare.modeSideBySide">Side by side</option>
|
||||
<option value="unified" data-i18n="compare.modeUnified">Unified</option>
|
||||
<option value="inline" data-i18n="compare.modeInline">Inline</option>
|
||||
</select>
|
||||
<select id="langSelect" title="Language" data-i18n-title="tip.language">
|
||||
<option value="en">English</option>
|
||||
<option value="pl">Polski</option>
|
||||
<option value="es">Español</option>
|
||||
<option value="fr">Français</option>
|
||||
<option value="de">Deutsch</option>
|
||||
<option value="pt">Português</option>
|
||||
<option value="zh">中文</option>
|
||||
<option value="ja">日本語</option>
|
||||
<option value="ru">Русский</option>
|
||||
</select>
|
||||
|
||||
<div class="toolbar-separator"></div>
|
||||
|
||||
<span id="formatBadge" class="hidden"></span>
|
||||
|
||||
<div class="toolbar-separator"></div>
|
||||
|
||||
<button id="printBtn" class="toolbar-btn" title="Print (Ctrl+P)" data-i18n-title="tip.print">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor">
|
||||
<path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Loading bar -->
|
||||
<div id="loadingBar" class="hidden">
|
||||
<div id="loadingBarProgress"></div>
|
||||
</div>
|
||||
|
||||
<!-- Error bar -->
|
||||
<div id="errorBar" class="hidden" role="alert">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" style="flex-shrink:0">
|
||||
<path d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
|
||||
</svg>
|
||||
<span id="errorMsg"></span>
|
||||
<button id="errorClose" aria-label="Dismiss" data-i18n-aria="aria.dismiss">
|
||||
<svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor">
|
||||
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Viewer -->
|
||||
<div id="viewerContainer">
|
||||
|
||||
<!-- Document render target (the host hands documents in as bytes) -->
|
||||
<div id="docContainer"></div>
|
||||
|
||||
</div><!-- /viewerContainer -->
|
||||
</div><!-- /mainContainer -->
|
||||
</div><!-- /outerContainer -->
|
||||
|
||||
<!-- Print layer: populated by PDF renderer before window.print() -->
|
||||
<div id="printLayer" aria-hidden="true"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=document.currentScript&&document.currentScript.src||(()=>{let e=[...document.getElementsByTagName(`script`)].reverse().find(e=>/readerjs(\.min)?\.js(\?|#|$)/.test(e.src||``));return e?e.src:location.href})();function n(e){let n=new URL(`./reader.html`,t);return e.src&&n.searchParams.set(`src`,e.src),e.name&&n.searchParams.set(`name`,e.name),n.href}function r(e,t={}){if(!e)throw Error(`ReaderJS.mount: a container element is required`);let r=document.createElement(`iframe`);r.src=n(t),r.title=`ReaderJS document viewer`,r.style.cssText=`width:100%;height:100%;border:0;display:block`,r.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-modals allow-popups`);let i=new URL(r.src,location.href).origin,a=!1,o=null,s=e=>r.contentWindow.postMessage(e,i);function c(e){e.source!==r.contentWindow||e.origin!==i||e.data&&e.data.type===`readerjs:ready`&&(a=!0,o&&(s(o),o=null))}window.addEventListener(`message`,c);let l=e=>Promise.resolve(e instanceof Blob?e.arrayBuffer():e),u=e=>{a?s(e):o=e};function d(e,t,n){l(e).then(e=>u({type:`readerjs:load`,buffer:e,name:t,mime:n}))}function f(e,t,n={}){Promise.all([l(e.source),l(t.source)]).then(([r,i])=>u({type:`readerjs:compare`,bufferA:r,nameA:e.name,bufferB:i,nameB:t.name,blame:n.blame,mode:n.mode}))}return e.appendChild(r),t.compare?f(t.compare.a,t.compare.b,t.compare):!t.src&&(t.blob||t.arrayBuffer)&&d(t.blob||t.arrayBuffer,t.name,t.mime),{load:d,compare:f,setLang(e){a&&s({type:`readerjs:setLang`,lang:e})},iframe:r,destroy(){window.removeEventListener(`message`,c),r.remove()}}}e.mount=r})(this.ReaderJS=this.ReaderJS||{});
|
||||
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+3
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user