@eternalheart/vue-file-preview 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -1,21 +1,21 @@
1
- "use strict";var su=Object.defineProperty;var ba=C=>{throw TypeError(C)};var ou=(C,w,t)=>w in C?su(C,w,{enumerable:!0,configurable:!0,writable:!0,value:t}):C[w]=t;var De=(C,w,t)=>ou(C,typeof w!="symbol"?w+"":w,t),po=(C,w,t)=>w.has(C)||ba("Cannot "+t);var Z=(C,w,t)=>(po(C,w,"read from private field"),t?t.call(C):w.get(C)),mt=(C,w,t)=>w.has(C)?ba("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(C):w.set(C,t),gt=(C,w,t,h)=>(po(C,w,"write to private field"),h?h.call(C,t):w.set(C,t),t),ht=(C,w,t)=>(po(C,w,"access private method"),t);var Ei=(C,w,t,h)=>({set _(d){gt(C,w,d,t)},get _(){return Z(C,w,h)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("vue"),Ot=require("lucide-vue-next"),au=require("jszip"),lu=require("pdfjs-dist/build/pdf.mjs"),cu=require("mammoth"),uu=require("x-data-spreadsheet"),mo=require("pptx-preview"),fu=require("@kenjiuno/msgreader"),hu=require("@likecoin/epub-ts"),du=require("video.js"),pu=require("markdown-it"),ra=require("shiki");function mu(C){const w=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(C){for(const t in C)if(t!=="default"){const h=Object.getOwnPropertyDescriptor(C,t);Object.defineProperty(w,t,h.get?h:{enumerable:!0,get:()=>C[t]})}}return w.default=C,Object.freeze(w)}const va=mu(lu),gu="1.3.2",bu={version:gu};function vu(C){try{const w=new URL(C).pathname.split("/").pop()||"file";return decodeURIComponent(w)}catch{const w=C.split("/").pop()||"file";return decodeURIComponent(w)}}function Oi(C){var w;const t=((w=C.split(".").pop())==null?void 0:w.toLowerCase())||"";return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/x-m4v","3gp":"video/3gpp",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ppt:"application/vnd.ms-powerpoint",msg:"application/vnd.ms-outlook",mobi:"application/x-mobipocket-ebook",azw:"application/vnd.amazon.ebook",azw3:"application/vnd.amazon.ebook",kf8:"application/vnd.amazon.ebook",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",json:"application/json",xml:"application/xml",html:"text/html",css:"text/css",js:"text/javascript",ts:"text/typescript",jsx:"text/javascript",tsx:"text/typescript",py:"text/x-python",java:"text/x-java",cpp:"text/x-c++src",c:"text/x-csrc",cs:"text/x-csharp",php:"text/x-php",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",yaml:"text/yaml",yml:"text/yaml",toml:"text/toml",ini:"text/plain",env:"text/plain",diff:"text/x-diff",patch:"text/x-diff",log:"text/plain",csv:"text/csv",tsv:"text/tab-separated-values",srt:"application/x-subrip",vtt:"text/vtt",zip:"application/zip"}[t]||"application/octet-stream"}function Ml(C,w=0){if(C instanceof File)return{id:`file-${Date.now()}-${w}`,name:C.name,url:URL.createObjectURL(C),type:C.type||Oi(C.name),size:C.size};if(typeof C=="string"){const t=vu(C);return{id:`url-${Date.now()}-${w}`,name:t,url:C,type:Oi(t)}}return{id:C.id||`link-${Date.now()}-${w}`,name:C.name,url:C.url,type:C.type||Oi(C.name),size:C.size}}function Al(C){return C.map((w,t)=>Ml(w,t))}function na(C){var w;const t=((w=C.name.split(".").pop())==null?void 0:w.toLowerCase())||"",h=C.type.toLowerCase();if(h.startsWith("image/")||["jpg","jpeg","png","gif","webp","svg"].includes(t))return"image";if(h.includes("pdf")||t==="pdf")return"pdf";if(h.includes("wordprocessingml")||t==="docx")return"docx";if(h.includes("spreadsheetml")||t==="xlsx")return"xlsx";if(h.includes("presentationml")||t==="pptx"||t==="ppt")return"pptx";if(h.includes("ms-outlook")||t==="msg")return"msg";if(h.includes("epub")||t==="epub")return"epub";if(["mobi","azw","azw3","kf8"].includes(t)||h==="application/x-mobipocket-ebook"||h==="application/vnd.amazon.ebook")return"mobi";if(["csv","tsv"].includes(t)||h==="text/csv"||h==="text/tab-separated-values")return"csv";if(t==="xml"||h==="application/xml"||h==="text/xml")return"xml";if(["srt","vtt","lrc","elrc","ass","ssa","ttml","dfxp"].includes(t)||h==="text/vtt"||h==="application/x-subrip"||h==="application/ttml+xml")return"subtitle";if(t==="zip"||h==="application/zip"||h==="application/x-zip-compressed")return"zip";if(h.startsWith("video/")||["mp4","webm","ogg","ogv","mov","avi","mkv","m4v","3gp","flv"].includes(t))return"video";if(h.startsWith("audio/")||["mp3","wav","ogg","m4a","flac","aac"].includes(t))return"audio";if(t==="md"||t==="markdown")return"markdown";if(h==="application/json"||t==="json")return"json";const d=["txt","log","lock","js","jsx","ts","tsx","py","java","cpp","c","h","cs","php","rb","go","mod","rs","swift","kt","lua","vim","html","css","scss","sass","less","yaml","yml","toml","ini","conf","env","diff","patch","sh","bash","zsh","sql"];return h.startsWith("text/")||d.includes(t)?"text":"unsupported"}function yu(C){var w;const t=((w=C.split(".").pop())==null?void 0:w.toLowerCase())||"";return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",mod:"go",rs:"rust",swift:"swift",kt:"kotlin",lua:"lua",vim:"vim",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",env:"bash",conf:"nginx",diff:"diff",patch:"diff",log:"log",md:"markdown",txt:"text"}[t]||"text"}function ya(C){var w;const t=((w=C.split(".").pop())==null?void 0:w.toLowerCase().split("?")[0])||"";return{mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/mp4","3gp":"video/3gpp",flv:"video/x-flv"}[t]||"video/mp4"}function ia(C){return C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`}function wu(C){if(!isFinite(C)||isNaN(C)||C<0)return"0:00";const w=Math.floor(C/60),t=Math.floor(C%60);return`${w}:${t.toString().padStart(2,"0")}`}function _u(C){var w;return(((w=C.split(".").pop())==null?void 0:w.toLowerCase())||"")==="tsv"?" ":","}function xu(C,w={}){const t=w.delimiter??",",h=w.firstRowAsHeader??!0,d=[];let l=[],i="",o=!1,r=0;const e=C.length;for(;r<e;){const s=C[r];if(o){if(s==='"'){if(C[r+1]==='"'){i+='"',r+=2;continue}o=!1,r+=1;continue}i+=s,r+=1;continue}if(s==='"'){o=!0,r+=1;continue}if(s===t){l.push(i),i="",r+=1;continue}if(s==="\r"){C[r+1]===`
1
+ "use strict";var ou=Object.defineProperty;var ba=C=>{throw TypeError(C)};var au=(C,w,t)=>w in C?ou(C,w,{enumerable:!0,configurable:!0,writable:!0,value:t}):C[w]=t;var De=(C,w,t)=>au(C,typeof w!="symbol"?w+"":w,t),po=(C,w,t)=>w.has(C)||ba("Cannot "+t);var Z=(C,w,t)=>(po(C,w,"read from private field"),t?t.call(C):w.get(C)),mt=(C,w,t)=>w.has(C)?ba("Cannot add the same private member more than once"):w instanceof WeakSet?w.add(C):w.set(C,t),gt=(C,w,t,h)=>(po(C,w,"write to private field"),h?h.call(C,t):w.set(C,t),t),ht=(C,w,t)=>(po(C,w,"access private method"),t);var Ei=(C,w,t,h)=>({set _(d){gt(C,w,d,t)},get _(){return Z(C,w,h)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("vue"),Ot=require("lucide-vue-next"),lu=require("jszip"),cu=require("pdfjs-dist/build/pdf.mjs"),uu=require("mammoth"),Ml=require("x-data-spreadsheet"),mo=require("pptx-preview"),fu=require("@kenjiuno/msgreader"),hu=require("@likecoin/epub-ts"),du=require("video.js"),pu=require("markdown-it"),ra=require("shiki");function mu(C){const w=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(C){for(const t in C)if(t!=="default"){const h=Object.getOwnPropertyDescriptor(C,t);Object.defineProperty(w,t,h.get?h:{enumerable:!0,get:()=>C[t]})}}return w.default=C,Object.freeze(w)}const va=mu(cu),gu="1.3.3",bu={version:gu};function vu(C){try{const w=new URL(C).pathname.split("/").pop()||"file";return decodeURIComponent(w)}catch{const w=C.split("/").pop()||"file";return decodeURIComponent(w)}}function Oi(C){var w;const t=((w=C.split(".").pop())==null?void 0:w.toLowerCase())||"";return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/x-m4v","3gp":"video/3gpp",flv:"video/x-flv",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ppt:"application/vnd.ms-powerpoint",msg:"application/vnd.ms-outlook",mobi:"application/x-mobipocket-ebook",azw:"application/vnd.amazon.ebook",azw3:"application/vnd.amazon.ebook",kf8:"application/vnd.amazon.ebook",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",json:"application/json",xml:"application/xml",html:"text/html",css:"text/css",js:"text/javascript",ts:"text/typescript",jsx:"text/javascript",tsx:"text/typescript",py:"text/x-python",java:"text/x-java",cpp:"text/x-c++src",c:"text/x-csrc",cs:"text/x-csharp",php:"text/x-php",rb:"text/x-ruby",go:"text/x-go",rs:"text/x-rust",yaml:"text/yaml",yml:"text/yaml",toml:"text/toml",ini:"text/plain",env:"text/plain",diff:"text/x-diff",patch:"text/x-diff",log:"text/plain",csv:"text/csv",tsv:"text/tab-separated-values",srt:"application/x-subrip",vtt:"text/vtt",zip:"application/zip"}[t]||"application/octet-stream"}function Al(C,w=0){if(C instanceof File)return{id:`file-${Date.now()}-${w}`,name:C.name,url:URL.createObjectURL(C),type:C.type||Oi(C.name),size:C.size};if(typeof C=="string"){const t=vu(C);return{id:`url-${Date.now()}-${w}`,name:t,url:C,type:Oi(t)}}return{id:C.id||`link-${Date.now()}-${w}`,name:C.name,url:C.url,type:C.type||Oi(C.name),size:C.size}}function Rl(C){return C.map((w,t)=>Al(w,t))}function na(C){var w;const t=((w=C.name.split(".").pop())==null?void 0:w.toLowerCase())||"",h=C.type.toLowerCase();if(h.startsWith("image/")||["jpg","jpeg","png","gif","webp","svg"].includes(t))return"image";if(h.includes("pdf")||t==="pdf")return"pdf";if(h.includes("wordprocessingml")||t==="docx")return"docx";if(h.includes("spreadsheetml")||t==="xlsx")return"xlsx";if(h.includes("presentationml")||t==="pptx"||t==="ppt")return"pptx";if(h.includes("ms-outlook")||t==="msg")return"msg";if(h.includes("epub")||t==="epub")return"epub";if(["mobi","azw","azw3","kf8"].includes(t)||h==="application/x-mobipocket-ebook"||h==="application/vnd.amazon.ebook")return"mobi";if(["csv","tsv"].includes(t)||h==="text/csv"||h==="text/tab-separated-values")return"csv";if(t==="xml"||h==="application/xml"||h==="text/xml")return"xml";if(["srt","vtt","lrc","elrc","ass","ssa","ttml","dfxp"].includes(t)||h==="text/vtt"||h==="application/x-subrip"||h==="application/ttml+xml")return"subtitle";if(t==="zip"||h==="application/zip"||h==="application/x-zip-compressed")return"zip";if(h.startsWith("video/")||["mp4","webm","ogg","ogv","mov","avi","mkv","m4v","3gp","flv"].includes(t))return"video";if(h.startsWith("audio/")||["mp3","wav","ogg","m4a","flac","aac"].includes(t))return"audio";if(t==="md"||t==="markdown")return"markdown";if(h==="application/json"||t==="json")return"json";const d=["txt","log","lock","js","jsx","ts","tsx","py","java","cpp","c","h","cs","php","rb","go","mod","rs","swift","kt","lua","vim","html","css","scss","sass","less","yaml","yml","toml","ini","conf","env","diff","patch","sh","bash","zsh","sql"];return h.startsWith("text/")||d.includes(t)?"text":"unsupported"}function yu(C){var w;const t=((w=C.split(".").pop())==null?void 0:w.toLowerCase())||"";return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",mod:"go",rs:"rust",swift:"swift",kt:"kotlin",lua:"lua",vim:"vim",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",json:"json",xml:"xml",html:"html",css:"css",scss:"scss",sass:"sass",less:"less",sql:"sql",yaml:"yaml",yml:"yaml",toml:"toml",ini:"ini",env:"bash",conf:"nginx",diff:"diff",patch:"diff",log:"log",md:"markdown",txt:"text"}[t]||"text"}function ya(C){var w;const t=((w=C.split(".").pop())==null?void 0:w.toLowerCase().split("?")[0])||"";return{mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",avi:"video/x-msvideo",mkv:"video/x-matroska",m4v:"video/mp4","3gp":"video/3gpp",flv:"video/x-flv"}[t]||"video/mp4"}function ia(C){return C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`}function wu(C){if(!isFinite(C)||isNaN(C)||C<0)return"0:00";const w=Math.floor(C/60),t=Math.floor(C%60);return`${w}:${t.toString().padStart(2,"0")}`}function _u(C){var w;return(((w=C.split(".").pop())==null?void 0:w.toLowerCase())||"")==="tsv"?" ":","}function xu(C,w={}){const t=w.delimiter??",",h=w.firstRowAsHeader??!0,d=[];let l=[],i="",o=!1,r=0;const e=C.length;for(;r<e;){const s=C[r];if(o){if(s==='"'){if(C[r+1]==='"'){i+='"',r+=2;continue}o=!1,r+=1;continue}i+=s,r+=1;continue}if(s==='"'){o=!0,r+=1;continue}if(s===t){l.push(i),i="",r+=1;continue}if(s==="\r"){C[r+1]===`
2
2
  `&&(r+=1),l.push(i),d.push(l),l=[],i="",r+=1;continue}if(s===`
3
3
  `){l.push(i),d.push(l),l=[],i="",r+=1;continue}i+=s,r+=1}for((i.length>0||l.length>0)&&(l.push(i),d.push(l));d.length>0;){const s=d[d.length-1];if(s.length===1&&s[0]==="")d.pop();else break}let n=[],c=d;h&&d.length>0&&(n=d[0],c=d.slice(1));const a=Math.max(n.length,...c.map(s=>s.length),0);for(const s of c)for(;s.length<a;)s.push("");return{header:n,rows:c,columnCount:a,delimiter:t}}function ku(C){const w=C instanceof Uint8Array?C:new Uint8Array(C);if(w.length>=3&&w[0]===239&&w[1]===187&&w[2]===191)return new TextDecoder("utf-8").decode(w);if(w.length>=2&&w[0]===255&&w[1]===254)return new TextDecoder("utf-16le").decode(w);if(w.length>=2&&w[0]===254&&w[1]===255)return new TextDecoder("utf-16be").decode(w);try{return new TextDecoder("utf-8",{fatal:!0}).decode(w)}catch{}try{return new TextDecoder("gbk").decode(w)}catch{}return new TextDecoder("utf-8",{fatal:!1}).decode(w)}async function ki(C,w){const t=await fetch(C,w);if(!t.ok)throw new Error(`请求失败: ${t.status}`);const h=await t.arrayBuffer();return ku(h)}function wa(C){const w=C.trim().replace(",","."),t=w.split(":").map(h=>h.trim());if(t.length===3){const[h,d,l]=t;return Number(h)*3600+Number(d)*60+Number(l)}if(t.length===2){const[h,d]=t;return Number(h)*60+Number(d)}return Number(w)||0}function _s(C){if(!isFinite(C)||C<0)return"00:00:00.000";const w=Math.floor(C*1e3),t=w%1e3,h=Math.floor(w/1e3)%60,d=Math.floor(w/6e4)%60,l=Math.floor(w/36e5),i=(o,r=2)=>o.toString().padStart(r,"0");return`${i(l)}:${i(d)}:${i(h)}.${i(t,3)}`}const _a=/(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}\s*-->\s*(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}/,Su=/^\s*\[\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?\]/;function Eu(C){const w=C.replace(/^\uFEFF/,"").trimStart();return/^WEBVTT/.test(w)?"vtt":/^<\?xml/i.test(w)||/<tt\b[^>]*>/i.test(w)?"ttml":/^\[Script Info\]/im.test(w)||/^Dialogue:/m.test(w)?/ScriptType:\s*v4\.00\s*$/im.test(w)?"ssa":"ass":Su.test(w)||/^\[(ti|ar|al|au|by|length|offset|re|ve):/im.test(w)?/<\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?>/.test(w)?"elrc":"lrc":"srt"}function xa(C,w){const t=C.replace(/\r\n?/g,`
4
4
  `).replace(/^\uFEFF/,"").split(`
5
5
  `),h=[];let d,l=0;if(w==="vtt"){const i=[];for(;l<t.length&&t[l].trim()!=="";)i.push(t[l]),l++;for(d=i.join(`
6
6
  `);l<t.length&&t[l].trim()==="";)l++}for(;l<t.length;){for(;l<t.length&&t[l].trim()==="";)l++;if(l>=t.length)break;let i,o=null;if(_a.test(t[l]))o=t[l],l++;else if(i=t[l].trim()||void 0,l++,l<t.length&&_a.test(t[l]))o=t[l],l++;else continue;if(!o)continue;const r=o.match(/([\d:.,]+)\s*-->\s*([\d:.,]+)/);if(!r)continue;const e=wa(r[1]),n=wa(r[2]),c=[];for(;l<t.length&&t[l].trim()!=="";)c.push(t[l]),l++;h.push({id:i,start:e,end:n,text:c.join(`
7
- `)})}return{format:w,cues:h,header:d}}function Mo(C,w,t){const h=Number(C),d=Number(w);let l=0;if(t){const i=(t+"000").slice(0,3);l=Number(i)}return h*60+d+l/1e3}function Rl(C,w){const t=/^\[(ti|ar|al|au|by|length|offset|re|ve):(.*)\]$/i.exec(C.trim());if(!t)return!1;const h=t[1].toLowerCase(),d=t[2].trim();if(w.metadata[h]=d,h==="offset"){const l=Number(d);isNaN(l)||(w.offsetMs=l)}return!0}function Cu(C){const w=C.replace(/\r\n?/g,`
7
+ `)})}return{format:w,cues:h,header:d}}function Mo(C,w,t){const h=Number(C),d=Number(w);let l=0;if(t){const i=(t+"000").slice(0,3);l=Number(i)}return h*60+d+l/1e3}function Nl(C,w){const t=/^\[(ti|ar|al|au|by|length|offset|re|ve):(.*)\]$/i.exec(C.trim());if(!t)return!1;const h=t[1].toLowerCase(),d=t[2].trim();if(w.metadata[h]=d,h==="offset"){const l=Number(d);isNaN(l)||(w.offsetMs=l)}return!0}function Cu(C){const w=C.replace(/\r\n?/g,`
8
8
  `).replace(/^\uFEFF/,"").split(`
9
- `),t={metadata:{},offsetMs:0},h=/\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g,d=[];for(const i of w){const o=i.trim();if(!o||Rl(o,t))continue;const r=[];let e=0;h.lastIndex=0;let n;for(;(n=h.exec(o))!==null&&n.index===e;)r.push(Mo(n[1],n[2],n[3])),e=n.index+n[0].length;if(r.length===0)continue;const c=o.slice(e).trim();for(const a of r)d.push({start:a,text:c})}d.sort((i,o)=>i.start-o.start);const l=t.offsetMs/1e3;return{format:"lrc",cues:d.map((i,o)=>{const r=Math.max(0,i.start-l),e=d[o+1],n=e?Math.max(r,e.start-l):r+5;return{start:r,end:n,text:i.text}}),metadata:t.metadata}}function Tu(C){const w=C.replace(/\r\n?/g,`
9
+ `),t={metadata:{},offsetMs:0},h=/\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g,d=[];for(const i of w){const o=i.trim();if(!o||Nl(o,t))continue;const r=[];let e=0;h.lastIndex=0;let n;for(;(n=h.exec(o))!==null&&n.index===e;)r.push(Mo(n[1],n[2],n[3])),e=n.index+n[0].length;if(r.length===0)continue;const c=o.slice(e).trim();for(const a of r)d.push({start:a,text:c})}d.sort((i,o)=>i.start-o.start);const l=t.offsetMs/1e3;return{format:"lrc",cues:d.map((i,o)=>{const r=Math.max(0,i.start-l),e=d[o+1],n=e?Math.max(r,e.start-l):r+5;return{start:r,end:n,text:i.text}}),metadata:t.metadata}}function Tu(C){const w=C.replace(/\r\n?/g,`
10
10
  `).replace(/^\uFEFF/,"").split(`
11
- `),t={metadata:{},offsetMs:0},h=/\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g,d=/<(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?>/g,l=[];for(const o of w){const r=o.trim();if(!r||Rl(r,t))continue;const e=[];let n=0;h.lastIndex=0;let c;for(;(c=h.exec(r))!==null&&c.index===n;)e.push(Mo(c[1],c[2],c[3])),n=c.index+c[0].length;if(e.length===0)continue;const a=r.slice(n);for(const s of e)l.push({start:s,raw:a})}l.sort((o,r)=>o.start-r.start);const i=t.offsetMs/1e3;return{format:"elrc",cues:l.map((o,r)=>{const e=[];let n="",c=0,a=null;d.lastIndex=0;let s;for(;(s=d.exec(o.raw))!==null;){const m=o.raw.slice(c,s.index);a!==null&&m&&e.push({start:Math.max(0,a-i),text:m}),n+=m,a=Mo(s[1],s[2],s[3]),c=s.index+s[0].length}const f=o.raw.slice(c);a!==null&&f&&e.push({start:Math.max(0,a-i),text:f}),n+=f;const p=Math.max(0,o.start-i),u=l[r+1],g=u?Math.max(p,u.start-i):p+5;return{start:p,end:g,text:n.trim(),words:e.length?e:void 0}}),metadata:t.metadata}}function ka(C){const w=C.trim().split(":");return w.length!==3?0:Number(w[0])*3600+Number(w[1])*60+Number(w[2].replace(",","."))}function Sa(C,w){const t=C.replace(/\r\n?/g,`
11
+ `),t={metadata:{},offsetMs:0},h=/\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g,d=/<(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?>/g,l=[];for(const o of w){const r=o.trim();if(!r||Nl(r,t))continue;const e=[];let n=0;h.lastIndex=0;let c;for(;(c=h.exec(r))!==null&&c.index===n;)e.push(Mo(c[1],c[2],c[3])),n=c.index+c[0].length;if(e.length===0)continue;const a=r.slice(n);for(const s of e)l.push({start:s,raw:a})}l.sort((o,r)=>o.start-r.start);const i=t.offsetMs/1e3;return{format:"elrc",cues:l.map((o,r)=>{const e=[];let n="",c=0,a=null;d.lastIndex=0;let s;for(;(s=d.exec(o.raw))!==null;){const m=o.raw.slice(c,s.index);a!==null&&m&&e.push({start:Math.max(0,a-i),text:m}),n+=m,a=Mo(s[1],s[2],s[3]),c=s.index+s[0].length}const f=o.raw.slice(c);a!==null&&f&&e.push({start:Math.max(0,a-i),text:f}),n+=f;const p=Math.max(0,o.start-i),u=l[r+1],g=u?Math.max(p,u.start-i):p+5;return{start:p,end:g,text:n.trim(),words:e.length?e:void 0}}),metadata:t.metadata}}function ka(C){const w=C.trim().split(":");return w.length!==3?0:Number(w[0])*3600+Number(w[1])*60+Number(w[2].replace(",","."))}function Sa(C,w){const t=C.replace(/\r\n?/g,`
12
12
  `).replace(/^\uFEFF/,"").split(`
13
13
  `);let h="",d=[];const l=[],i=[];for(const o of t){const r=o.replace(/\s+$/,""),e=r.trim(),n=/^\[([^\]]+)\]\s*$/.exec(e);if(n){h=n[1].toLowerCase(),i.push(r);continue}if(h!=="events"){i.push(r);continue}const c=/^Format:\s*(.+)$/i.exec(e);if(c){d=c[1].split(",").map(R=>R.trim());continue}const a=/^(Dialogue|Comment):\s*(.+)$/i.exec(e);if(!a||a[1].toLowerCase()==="comment"||d.length===0)continue;const s=d.length,f=a[2].split(","),p=f.slice(0,s-1),u=f.slice(s-1).join(","),g={};d.forEach((R,I)=>{g[R]=I===s-1?u:p[I]??""});const m=ka(g.Start||""),v=ka(g.End||""),S=(g.Text||"").replace(/\\N/g,`
14
14
  `).replace(/\\n/g,`
15
15
  `).replace(/\\h/g," ").replace(/\{[^}]*\}/g,"");l.push({start:m,end:v,text:S,style:g.Style})}return l.sort((o,r)=>o.start-r.start),{format:w,cues:l,header:i.join(`
16
16
  `).trim()||void 0}}function go(C){const w=C.trim();if(!w)return 0;const t=/^(\d+(?:\.\d+)?)(h|m|s|ms|f|t)$/i.exec(w);if(t){const d=Number(t[1]),l=t[2].toLowerCase();return l==="h"?d*3600:l==="m"?d*60:l==="ms"?d/1e3:d}const h=w.split(":");return h.length===3?Number(h[0])*3600+Number(h[1])*60+Number(h[2]):h.length===2?Number(h[0])*60+Number(h[1]):Number(w)||0}function Mu(C){if(typeof DOMParser>"u")throw new Error("TTML parsing requires a DOMParser environment");const w=new DOMParser().parseFromString(C,"application/xml");if(w.getElementsByTagName("parsererror").length>0)throw new Error("TTML XML parse error");const t=w.getElementsByTagName("p"),h=[];for(let d=0;d<t.length;d++){const l=t[d],i=l.getAttribute("begin")||"",o=l.getAttribute("end")||"",r=l.getAttribute("dur")||"",e=go(i);let n;o?n=go(o):r?n=e+go(r):n=e+5;let c="";l.childNodes.forEach(s=>{if(s.nodeType===3)c+=s.nodeValue||"";else if(s.nodeType===1){const f=s;f.tagName.toLowerCase()==="br"?c+=`
17
17
  `:c+=f.textContent||""}});const a=c.replace(/[ \t]+/g," ").replace(/\n /g,`
18
- `).trim();(a||e||n)&&h.push({start:e,end:n,text:a})}return h.sort((d,l)=>d.start-l.start),{format:"ttml",cues:h}}function Au(C,w){switch(w??Eu(C)){case"lrc":return Cu(C);case"elrc":return Tu(C);case"ass":return Sa(C,"ass");case"ssa":return Sa(C,"ssa");case"ttml":return Mu(C);case"vtt":return xa(C,"vtt");case"srt":default:return xa(C,"srt")}}async function Ru(C){return au.loadAsync(C)}function Nu(C){const w=[];return C.forEach((t,h)=>{var d;const l=h.dir,i=l&&!t.endsWith("/")?t+"/":t,o=l?i.replace(/\/$/,""):i,r=o.lastIndexOf("/"),e=r>=0?o.slice(r+1):o,n=r>=0?o.slice(0,r):"",c=l?0:((d=h._data)==null?void 0:d.uncompressedSize)??0;w.push({path:i,name:e,dir:n,isDir:l,size:c,date:h.date})}),w}function Ou(C){const w={name:"",path:"",isDir:!0,children:[],size:0},t=new Map;t.set("",w);const h=l=>{if(t.has(l))return t.get(l);const i=l.split("/").filter(Boolean);let o=w,r="";for(const e of i){r=r?`${r}/${e}`:e;let n=t.get(r);n||(n={name:e,path:r+"/",isDir:!0,children:[],size:0},o.children.push(n),t.set(r,n)),o=n}return o};for(const l of C){if(l.isDir){h(l.path.replace(/\/$/,""));continue}h(l.dir).children.push({name:l.name,path:l.path,isDir:!1,size:l.size})}const d=l=>{if(l.children){l.children.sort((i,o)=>i.isDir!==o.isDir?i.isDir?-1:1:i.name.localeCompare(o.name));for(const i of l.children)d(i)}};return d(w),w}async function ju(C,w,t){const h=C.file(w);if(!h)throw new Error(`ZIP entry not found: ${w}`);const d=await h.async("arraybuffer");return new Blob([d],t?{type:t}:void 0)}function Iu(C){return C?C.startsWith("#")?C:C.length===8?"#"+C.substring(2):C.length===6?"#"+C:"#000000":"#000000"}const Bu=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],Pu=["000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","800000","008000","000080","808000","800080","008080","C0C0C0","808080","9999FF","993366","FFFFCC","CCFFFF","660066","FF8080","0066CC","CCCCFF","000080","FF00FF","FFFF00","00FFFF","800080","800000","008080","0000FF","00CCFF","CCFFFF","CCFFCC","FFFF99","99CCFF","FF99CC","CC99FF","FFCC99","3366FF","33CCCC","99CC00","FFCC00","FF9900","FF6600","666699","969696","003366","339966","003300","333300","993300","993366","333399","333333"];function Fu(C,w){const t=parseInt(C.substring(0,2),16),h=parseInt(C.substring(2,4),16),d=parseInt(C.substring(4,6),16),l=e=>w<0?Math.round(e*(1+w)):Math.round(e+(255-e)*w),i=Math.min(255,Math.max(0,l(t))),o=Math.min(255,Math.max(0,l(h))),r=Math.min(255,Math.max(0,l(d)));return i.toString(16).padStart(2,"0")+o.toString(16).padStart(2,"0")+r.toString(16).padStart(2,"0")}function Du(C){if(C&&C.type==="pattern"&&C.pattern==="solid"){const w=C.fgColor;if(w)return sa(w)}}function sa(C){if(C){if("argb"in C&&typeof C.argb=="string"&&C.argb)return Iu(C.argb);if("theme"in C&&typeof C.theme=="number"){const w=Bu[C.theme]||"000000",t="tint"in C&&typeof C.tint=="number"?C.tint:0;return"#"+(t!==0?Fu(w,t):w)}if("indexed"in C&&typeof C.indexed=="number"){const w=Pu[C.indexed];if(w)return"#"+w}}}function Lu(C){if(!C||!C.style)return;const w=sa(C.color)||"#000000";return[C.style,w]}function zu(C){const w={};let t=!1;if(C.font){const d=C.font;if((d.name||d.size||d.bold||d.italic)&&(t=!0,w.font={},d.name&&(w.font.name=d.name),d.size&&(w.font.size=d.size),d.bold&&(w.font.bold=!0),d.italic&&(w.font.italic=!0)),d.color){const l=sa(d.color);l&&(t=!0,w.color=l)}d.underline&&(t=!0,w.underline=!0),d.strike&&(t=!0,w.strike=!0)}const h=Du(C.fill);if(h&&(t=!0,w.bgcolor=h),C.alignment){const d=C.alignment;d.horizontal&&(t=!0,w.align=d.horizontal),d.vertical&&(t=!0,w.valign=d.vertical),d.wrapText&&(t=!0,w.textwrap=!0)}if(C.border){const d={};let l=!1;const i=["top","bottom","left","right"];for(const o of i){const r=Lu(C.border[o]);r&&(d[o]=r,l=!0)}l&&(t=!0,w.border=d)}return t?w:null}function $u(C){return JSON.stringify(C)}function Vu(C,w,t){const h=zu(C);if(!h)return-1;const d=$u(h),l=t.get(d);if(l!==void 0)return l;const i=w.length;return w.push(h),t.set(d,i),i}function Uu(C){const w=C.value;if(w==null)return"";if(typeof w=="string")return w;if(typeof w=="number")return String(w);if(typeof w=="boolean")return w?"TRUE":"FALSE";if(w instanceof Date)return w.toLocaleDateString();if(typeof w=="object"&&"formula"in w){const t=w.result;return t!=null?String(t):""}return typeof w=="object"&&"richText"in w?w.richText.map(t=>t.text).join(""):typeof w=="object"&&"hyperlink"in w?w.text||"":typeof w=="object"&&"error"in w?String(w.error):String(w)}function Hu(C){const w=C.split(":"),t=Ea(w[0]),h=w[1]?Ea(w[1]):t;return{top:t.row,left:t.col,bottom:h.row,right:h.col}}function Ea(C){const w=C.match(/^([A-Z]+)(\d+)$/);if(!w)return{row:1,col:1};const t=w[1],h=parseInt(w[2],10);let d=0;for(let l=0;l<t.length;l++)d=d*26+(t.charCodeAt(l)-64);return{row:h,col:d}}function Wu(C){const w=[];return C.eachSheet(t=>{const h=[],d=new Map,l=[],i={},o={},r=t.columnCount;for(let a=1;a<=r;a++){const s=t.getColumn(a);s.width&&(o[String(a-1)]={width:Math.round(s.width*7.5)})}o.len=Math.max(r,26);const e=new Map,n=t.model,c=(n==null?void 0:n.merges)||[];for(const a of c){l.push(a);const{top:s,left:f,bottom:p,right:u}=Hu(a),g=p-s,m=u-f;e.set(`${s-1},${f-1}`,[g,m])}t.eachRow({includeEmpty:!0},(a,s)=>{const f=s-1,p={};a.eachCell({includeEmpty:!1},(g,m)=>{const v=m-1;if(g.isMerged&&g.master!==g)return;const S=Uu(g),R=Vu(g,h,d),I={text:S};R!==-1&&(I.style=R);const F=`${f},${v}`;e.has(F)&&(I.merge=e.get(F)),p[String(v)]=I});const u={cells:p};a.height&&(u.height=Math.round(a.height*1.333)),i[String(f)]=u}),w.push({name:t.name,styles:h,merges:l,rows:i,cols:o})}),w}function Nl(C,w){var t;if(typeof window>"u")return;const h=(C==null?void 0:C.version)||((t=C==null?void 0:C.GlobalWorkerOptions)==null?void 0:t.version)||"",{workerSrc:d=`https://unpkg.com/pdfjs-dist@${h}/build/pdf.worker.min.mjs`,cMapUrl:l=`https://unpkg.com/pdfjs-dist@${h}/cmaps/`,cMapPacked:i=!0}=w||{};C.GlobalWorkerOptions&&(C.GlobalWorkerOptions.workerSrc=d,C.GlobalWorkerOptions.cMapUrl=l,C.GlobalWorkerOptions.cMapPacked=i)}const qu={"common.download":"下载","common.close":"关闭","common.loading":"加载中","common.unknown_error":"未知错误","common.unsupported_preview":"不支持预览此文件类型 ({type})","toolbar.zoom_in":"放大","toolbar.zoom_out":"缩小","toolbar.rotate_left":"向左旋转","toolbar.rotate_right":"向右旋转","toolbar.reset":"复原","toolbar.fit_to_window":"适应窗口","toolbar.original_size":"原始尺寸","toolbar.toc":"目录","toolbar.prev_page":"上一页","toolbar.next_page":"下一页","toolbar.full_width":"全屏宽度","toolbar.normal_width":"正常宽度","toolbar.wrap_on":"自动换行","toolbar.wrap_off":"不换行","toolbar.source":"源码","toolbar.preview":"预览","image.load_failed":"图片加载失败","pdf.load_failed":"PDF 文件加载失败","docx.parse_failed":"Word 文档解析失败","xlsx.loading":"加载 Excel 中...","xlsx.load_failed":"Excel 加载失败","xlsx.parse_failed":"Excel 文件解析失败","xlsx.not_found":"Excel 文件不存在","pptx.loading":"加载 PPT 中...","pptx.load_failed":"PPT 加载失败","pptx.parse_failed":"PPT 文件解析失败","pptx.not_found":"PPT 文件不存在","pptx.invalid_format":"PPT 文件格式错误或已损坏","pptx.no_pages":"PPT 文件无有效页面","pptx.timeout":"加载超时,请检查网络或稍后重试","msg.parse_failed":"Outlook 邮件解析失败","msg.parse_failed_short":"邮件解析失败","msg.empty_body":"(无邮件正文)","epub.load_failed":"EPUB 文件加载失败","mobi.load_failed":"电子书加载失败,文件可能已损坏或带有 DRM 保护","video.loading":"加载视频中...","video.load_failed":"视频加载失败","video.load_failed_with_error":"视频加载失败: {error}","audio.aria.play":"播放","audio.aria.pause":"暂停","audio.aria.forward_10":"前进 10 秒","audio.aria.backward_10":"后退 10 秒","audio.aria.mute":"静音","audio.aria.unmute":"取消静音","audio.aria.loop_on":"开启循环","audio.aria.loop_off":"关闭循环","audio.aria.progress":"播放进度","audio.aria.volume":"音量","markdown.load_failed":"Markdown 文件加载失败","markdown.copy_code":"复制代码","markdown.copied":"已复制","json.load_failed":"JSON 文件加载失败","json.items":"items","json.keys":"keys","csv.load_failed":"CSV 文件加载失败","csv.parse_failed":"CSV 解析失败","xml.load_failed":"XML 文件加载失败","subtitle.load_failed":"字幕文件加载失败","subtitle.parse_failed":"字幕解析失败","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"标题","subtitle.meta.artist":"艺术家","subtitle.meta.album":"专辑","subtitle.meta.author":"作者","subtitle.meta.by":"制作","subtitle.meta.length":"时长","subtitle.meta.offset":"偏移","subtitle.meta.editor":"编辑器","subtitle.meta.version":"版本","zip.load_failed":"ZIP 文件加载失败","zip.parse_failed":"ZIP 解析失败","text.load_failed":"文本文件加载失败"},Xu={"common.download":"Download","common.close":"Close","common.loading":"Loading","common.unknown_error":"Unknown error","common.unsupported_preview":"Preview not supported for this file type ({type})","toolbar.zoom_in":"Zoom in","toolbar.zoom_out":"Zoom out","toolbar.rotate_left":"Rotate left","toolbar.rotate_right":"Rotate right","toolbar.reset":"Reset","toolbar.fit_to_window":"Fit to window","toolbar.original_size":"Original size","toolbar.toc":"Table of contents","toolbar.prev_page":"Previous page","toolbar.next_page":"Next page","toolbar.full_width":"Full width","toolbar.normal_width":"Normal width","toolbar.wrap_on":"Word wrap","toolbar.wrap_off":"No wrap","toolbar.source":"Source","toolbar.preview":"Preview","image.load_failed":"Failed to load image","pdf.load_failed":"Failed to load PDF","docx.parse_failed":"Failed to parse Word document","xlsx.loading":"Loading Excel...","xlsx.load_failed":"Failed to load Excel","xlsx.parse_failed":"Failed to parse Excel file","xlsx.not_found":"Excel file not found","pptx.loading":"Loading PPT...","pptx.load_failed":"Failed to load PPT","pptx.parse_failed":"Failed to parse PPT file","pptx.not_found":"PPT file not found","pptx.invalid_format":"PPT file format is invalid or corrupted","pptx.no_pages":"PPT file has no valid pages","pptx.timeout":"Loading timed out, please check your network and retry","msg.parse_failed":"Failed to parse Outlook message","msg.parse_failed_short":"Failed to parse message","msg.empty_body":"(No message body)","epub.load_failed":"Failed to load EPUB","mobi.load_failed":"Failed to load ebook — file may be corrupted or DRM-protected","video.loading":"Loading video...","video.load_failed":"Failed to load video","video.load_failed_with_error":"Failed to load video: {error}","audio.aria.play":"Play","audio.aria.pause":"Pause","audio.aria.forward_10":"Forward 10 seconds","audio.aria.backward_10":"Back 10 seconds","audio.aria.mute":"Mute","audio.aria.unmute":"Unmute","audio.aria.loop_on":"Enable loop","audio.aria.loop_off":"Disable loop","audio.aria.progress":"Playback progress","audio.aria.volume":"Volume","markdown.load_failed":"Failed to load Markdown","markdown.copy_code":"Copy code","markdown.copied":"Copied","json.load_failed":"Failed to load JSON","json.items":"items","json.keys":"keys","csv.load_failed":"Failed to load CSV","csv.parse_failed":"Failed to parse CSV","xml.load_failed":"Failed to load XML","subtitle.load_failed":"Failed to load subtitle","subtitle.parse_failed":"Failed to parse subtitle","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"Title","subtitle.meta.artist":"Artist","subtitle.meta.album":"Album","subtitle.meta.author":"Author","subtitle.meta.by":"By","subtitle.meta.length":"Length","subtitle.meta.offset":"Offset","subtitle.meta.editor":"Editor","subtitle.meta.version":"Version","zip.load_failed":"Failed to load ZIP","zip.parse_failed":"Failed to parse ZIP","text.load_failed":"Failed to load text file"},xs={"zh-CN":qu,"en-US":Xu},Zu=/\{(\w+)\}/g;function Gu(C,w){return w?C.replace(Zu,(t,h)=>{const d=w[h];return d===void 0?`{${h}}`:String(d)}):C}function oa(C){var w;const t=C.fallbackLocale??"zh-CN",h=xs[C.locale]??xs[t]??xs["zh-CN"],d=(w=C.messages)==null?void 0:w[C.locale],l=d?{...h,...d}:h,i=xs["zh-CN"];return(o,r)=>{const e=l[o]??i[o]??o;return Gu(e,r)}}const ao=Symbol("file-preview-locale");function Ol(C,w){const t=T.computed(()=>T.unref(C)??"zh-CN"),h=T.computed(()=>oa({locale:t.value,messages:T.unref(w)}));T.provide(ao,{locale:t,t:h})}let bo=null;function Ku(){return bo||(bo=oa({locale:"zh-CN"})),bo}function Te(){const C=T.inject(ao,null);if(C)return C;const w=T.computed(()=>"zh-CN"),t=T.computed(()=>Ku());return{locale:w,t}}const Yu=(C,{attrs:w})=>T.h("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...w},[T.h("text",{x:"12",y:"17.5","text-anchor":"middle","font-size":"20","font-weight":"bold",fill:"currentColor",stroke:"none"},"1:1")]);function Ju(C){return[{items:[{type:"button",icon:Ot.ZoomOut,tooltip:C.t("toolbar.zoom_out"),action:C.onZoomOut,disabled:C.zoom<=.01},{type:"text",content:`${Math.round(C.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:Ot.ZoomIn,tooltip:C.t("toolbar.zoom_in"),action:C.onZoomIn,disabled:C.zoom>=10}]},{items:[{type:"button",icon:Ot.Scan,tooltip:C.t("toolbar.fit_to_window"),action:C.onFitToWidth},{type:"button",icon:Yu,tooltip:C.t("toolbar.original_size"),action:C.onOriginalSize}]},{items:[{type:"button",icon:Ot.RotateCcw,tooltip:C.t("toolbar.rotate_left"),action:C.onRotateLeft},{type:"button",icon:Ot.RotateCw,tooltip:C.t("toolbar.rotate_right"),action:C.onRotateRight}]},{items:[{type:"button",icon:Ot.RefreshCw,tooltip:C.t("toolbar.reset"),action:C.onReset}]}]}function Qu(C){return[{items:[{type:"button",icon:Ot.ZoomOut,tooltip:C.t("toolbar.zoom_out"),action:C.onZoomOut,disabled:C.zoom<=.01},{type:"text",content:`${Math.round(C.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:Ot.ZoomIn,tooltip:C.t("toolbar.zoom_in"),action:C.onZoomIn,disabled:C.zoom>=10}]},{items:[{type:"button",icon:Ot.RefreshCw,tooltip:C.t("toolbar.reset"),action:C.onReset}]}]}function tf(C){return[{items:[{type:"button",icon:Ot.List,tooltip:C.t("toolbar.toc"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.toggleToc()}}]},{items:[{type:"button",icon:Ot.ChevronLeft,tooltip:C.t("toolbar.prev_page"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.prevPage()}},{type:"text",content:`${C.current} / ${C.total}`,minWidth:"4rem"},{type:"button",icon:Ot.ChevronRight,tooltip:C.t("toolbar.next_page"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.nextPage()}}]},{items:[{type:"button",icon:C.fullWidth?Ot.Minimize2:Ot.Maximize2,tooltip:C.fullWidth?C.t("toolbar.normal_width"):C.t("toolbar.full_width"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.toggleFullWidth()}}]}]}function ef(C){return[{items:[{type:"button",icon:Ot.List,tooltip:C.t("toolbar.toc"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.toggleToc()}}]},{items:[{type:"button",icon:Ot.ChevronLeft,tooltip:C.t("toolbar.prev_page"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.prevPage()}},{type:"text",content:`${C.current} / ${C.total}`,minWidth:"4rem"},{type:"button",icon:Ot.ChevronRight,tooltip:C.t("toolbar.next_page"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.nextPage()}}]},{items:[{type:"button",icon:C.fullWidth?Ot.Minimize2:Ot.Maximize2,tooltip:C.fullWidth?C.t("toolbar.normal_width"):C.t("toolbar.full_width"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.toggleFullWidth()}}]}]}function rf({stats:C}){return C?[{items:[{type:"text",content:`${C.files} files · ${C.dirs} dirs · ${ia(C.size)}`,minWidth:"10rem"}]}]:[]}function nf(C){const w=[{items:[{type:"button",icon:T.h(Ot.WrapText,{class:"vfp-w-4 vfp-h-4"}),tooltip:C.wordWrap?C.t("toolbar.wrap_off"):C.t("toolbar.wrap_on"),action:C.onToggleWrap}]}];return C.isHtml&&w.push({items:[{type:"button",icon:C.htmlPreview?T.h(Ot.Code,{class:"vfp-w-4 vfp-h-4"}):T.h(Ot.Eye,{class:"vfp-w-4 vfp-h-4"}),tooltip:C.htmlPreview?C.t("toolbar.source"):C.t("toolbar.preview"),action:C.onToggleHtmlPreview}]}),w}const sf={key:0,class:"vfp-flex vfp-items-center vfp-justify-center"},of={key:1,class:"vfp-text-white/70 vfp-text-center"},af={class:"vfp-text-lg"},lf=["src"],cf={key:2,class:"vfp-absolute vfp-bottom-2 vfp-right-3 vfp-text-[10px] vfp-text-white/30 hover:vfp-text-white/80 vfp-transition-colors vfp-pointer-events-auto vfp-select-none vfp-cursor-default"},uf=T.defineComponent({__name:"index",props:{url:{},zoom:{},rotation:{},resetKey:{},fileSize:{}},emits:["zoomChange","naturalWidthChange","naturalHeightChange"],setup(C,{emit:w}){const t=C,h=w,{t:d}=Te(),l=T.ref(!1),i=T.ref(null),o=T.ref({x:0,y:0}),r=T.ref(!1);let e={x:0,y:0};const n=T.ref(1),c=T.ref({width:0,height:0}),a=T.ref(null),s=T.ref(null);T.watch(()=>t.url,()=>{l.value=!1,i.value=null,o.value={x:0,y:0},n.value=1}),T.watch(()=>t.zoom,j=>{n.value=j}),T.watch(()=>t.resetKey,()=>{o.value={x:0,y:0}});const f=(j,L)=>{const $=s.value;if(!$||c.value.width===0)return j;const V=$.clientWidth,z=$.clientHeight,E=c.value.width*L,A=c.value.height*L,k=Math.min(80,V*.15,z*.15),b=(V+E)/2-k,y=(z+A)/2-k;return{x:b>0?Math.max(-b,Math.min(b,j.x)):0,y:y>0?Math.max(-y,Math.min(y,j.y)):0}},p=j=>{l.value=!0;const L=j.currentTarget;c.value={width:L.naturalWidth,height:L.naturalHeight},h("naturalWidthChange",L.naturalWidth),h("naturalHeightChange",L.naturalHeight)},u=()=>{i.value=d.value("image.load_failed"),l.value=!0},g=()=>{o.value={x:0,y:0},n.value=1,h("zoomChange",1)},m=j=>{j.preventDefault(),j.stopPropagation();const L=s.value;if(!L)return;const $=L.getBoundingClientRect(),V=j.clientX-$.left-$.width/2,z=j.clientY-$.top-$.height/2,E=j.deltaY>0?-.05:.05,A=n.value,k=Math.max(.01,Math.min(10,A+E)),b=k/A;o.value=f({x:V-b*(V-o.value.x),y:z-b*(z-o.value.y)},k),n.value=k,h("zoomChange",k)};T.onMounted(()=>{const j=s.value;j&&j.addEventListener("wheel",m,{passive:!1})}),T.onBeforeUnmount(()=>{const j=s.value;j&&j.removeEventListener("wheel",m)});const v=j=>{j.button===0&&(r.value=!0,e={x:j.clientX-o.value.x,y:j.clientY-o.value.y})},S=j=>{r.value&&(o.value=f({x:j.clientX-e.x,y:j.clientY-e.y},n.value))},R=()=>{r.value=!1},I=T.computed(()=>({transform:`translate(${o.value.x}px, ${o.value.y}px) scale(${n.value}) rotate(${t.rotation}deg)`,transformOrigin:"center",transition:r.value?"none":"transform 0.3s ease-out",opacity:l.value?1:0})),F=T.computed(()=>t.fileSize==null?"":` · ${ia(t.fileSize)}`);return(j,L)=>(T.openBlock(),T.createElementBlock("div",{ref_key:"containerRef",ref:s,class:"vfp-relative vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-overflow-hidden",style:T.normalizeStyle({cursor:r.value?"grabbing":"grab"}),onMousedown:v,onMousemove:S,onMouseup:R,onMouseleave:R},[!l.value&&!i.value?(T.openBlock(),T.createElementBlock("div",sf,[...L[0]||(L[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),i.value?(T.openBlock(),T.createElementBlock("div",of,[T.createElementVNode("p",af,T.toDisplayString(i.value),1)])):T.createCommentVNode("",!0),T.createElementVNode("img",{ref_key:"imgRef",ref:a,src:C.url,alt:"Preview",class:T.normalizeClass(["vfp-max-w-none vfp-select-none",!l.value&&"vfp-hidden"]),style:T.normalizeStyle(I.value),draggable:!1,onLoad:p,onError:u,onDblclick:g},null,46,lf),l.value&&!i.value&&c.value.width>0?(T.openBlock(),T.createElementBlock("div",cf,T.toDisplayString(c.value.width)+" × "+T.toDisplayString(c.value.height)+T.toDisplayString(F.value),1)):T.createCommentVNode("",!0)],36))}}),ff={key:0,class:"vfp-text-white/70 vfp-text-center"},hf={class:"vfp-text-lg"},df={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-min-h-screen"},pf={class:"pdf-pages vfp-flex vfp-flex-col vfp-gap-4"},mf={key:2,class:"vfp-sticky vfp-bottom-2 md:vfp-bottom-4 vfp-mt-4 md:vfp-mt-8 vfp-bg-black/60 vfp-backdrop-blur-xl vfp-text-white vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-rounded-full vfp-text-xs md:vfp-text-sm vfp-font-medium vfp-shadow-2xl vfp-border vfp-border-white/10"},gf=T.defineComponent({__name:"index",props:{url:{},zoom:{},currentPage:{}},emits:["pageChange","totalPagesChange","pageWidthChange"],setup(C,{emit:w}){Nl(va);const t=C,h=w,{t:d}=Te(),l=T.ref(0),i=T.ref(null),o=T.ref(null);let r=null;const e=[],n=async(f,p,u)=>{if(!r)return;const g=await r.getPage(f),m=g.getViewport({scale:p}),v=document.createElement("canvas");v.width=m.width,v.height=m.height,v.style.maxWidth="100%",v.style.height="auto",v.style.borderRadius="0",v.style.display="block",v.style.boxShadow="0 25px 50px -12px rgba(0,0,0,0.25)",v.style.filter="brightness(0.95) contrast(1.05)";const S=v.getContext("2d");if(!S)return;if(await g.render({canvasContext:S,viewport:m}).promise,f===1){const I=g.getViewport({scale:1});h("pageWidthChange",I.width)}u.innerHTML="",u.appendChild(v);const R=document.createElement("div");R.textContent=String(f),R.style.cssText="position:absolute;top:8px;right:8px;background:rgba(0,0,0,0.6);backdrop-filter:blur(4px);color:white;font-size:12px;padding:4px 12px;border-radius:9999px;",u.appendChild(R)},c=async()=>{if(!r||!o.value)return;const f=o.value.querySelector(".pdf-pages");if(f){f.innerHTML="",e.length=0;for(let p=1;p<=l.value;p++){const u=document.createElement("div");u.style.cssText="position:relative;display:flex;justify-content:center;",f.appendChild(u),e.push(u),await n(p,t.zoom,u)}}},a=async()=>{if(i.value=null,l.value=0,r){try{r.destroy()}catch{}r=null}try{r=await va.getDocument({url:t.url}).promise,l.value=r.numPages,h("totalPagesChange",r.numPages),h("pageChange",1),await T.nextTick(),await c()}catch(f){console.error("PDF 加载错误:",f),i.value=d.value("pdf.load_failed")}},s=()=>{if(!o.value)return;const f=o.value,p=f.scrollTop,u=f.clientHeight,g=p+u/2;let m=1,v=1/0;e.forEach((S,R)=>{const I=R+1,F=S.getBoundingClientRect(),j=f.getBoundingClientRect(),L=F.top-j.top+F.height/2+p,$=Math.abs(L-g);$<v&&(v=$,m=I)}),m!==t.currentPage&&h("pageChange",m)};return T.onMounted(()=>{a(),o.value&&o.value.addEventListener("scroll",s)}),T.watch(()=>t.url,()=>{a()}),T.watch(()=>t.zoom,()=>{c()}),T.onBeforeUnmount(()=>{if(o.value&&o.value.removeEventListener("scroll",s),r){try{r.destroy()}catch{}r=null}}),(f,p)=>(T.openBlock(),T.createElementBlock("div",{ref_key:"containerRef",ref:o,class:"vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-4 md:vfp-py-8 vfp-px-2 md:vfp-px-4"},[i.value?(T.openBlock(),T.createElementBlock("div",ff,[T.createElementVNode("p",hf,T.toDisplayString(i.value),1)])):T.createCommentVNode("",!0),!i.value&&l.value===0?(T.openBlock(),T.createElementBlock("div",df,[...p[0]||(p[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),T.withDirectives(T.createElementVNode("div",pf,null,512),[[T.vShow,!i.value&&l.value>0]]),l.value>0?(T.openBlock(),T.createElementBlock("div",mf," 第 "+T.toDisplayString(C.currentPage)+" 页 / 共 "+T.toDisplayString(l.value)+" 页 ",1)):T.createCommentVNode("",!0)],512))}}),bf={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},vf={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},yf={class:"vfp-text-white/70 vfp-text-center"},wf={class:"vfp-text-lg"},_f={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"}},xf=["innerHTML"],kf=["innerHTML"],Ca=1123,Ta=60,Ma=50,Sf=24,Ef=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=Ca-Ta*2,t=C,{t:h}=Te(),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=T.ref([]),r=T.ref(null),e=async()=>{l.value=!0,i.value=null,d.value="",o.value=[];try{const f=await fetch(t.url);if(!f.ok)throw new Error("文件加载失败");const p=await f.arrayBuffer(),u=await cu.convertToHtml({arrayBuffer:p});d.value=u.value}catch(f){console.error("Docx 解析错误:",f),i.value=h.value("docx.parse_failed")}finally{l.value=!1}},n=()=>{const f=r.value;if(!f||!d.value)return;const p=Array.from(f.children);if(p.length===0){o.value=[d.value];return}const u=[[]];let g=0;for(const m of p){const v=m.offsetHeight;g>0&&g+v>w&&(u.push([]),g=0),u[u.length-1].push(m.outerHTML),g+=v}u.length===0&&u.push([]),o.value=u.map(m=>m.join(""))};T.watch(()=>t.url,e,{immediate:!0}),T.watch(d,async()=>{d.value&&(await T.nextTick(),requestAnimationFrame(()=>n()))});const c={fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.8",color:"#333"},a={...c,position:"absolute",visibility:"hidden",width:`${794-Ma*2}px`,pointerEvents:"none"},s={width:"100%",maxWidth:"794px",minHeight:`${Ca}px`,background:"white",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.15)",flexShrink:0,padding:`${Ta}px ${Ma}px`};return(f,p)=>l.value?(T.openBlock(),T.createElementBlock("div",bf,[...p[0]||(p[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",vf,[T.createElementVNode("div",yf,[T.createElementVNode("p",wf,T.toDisplayString(i.value),1)])])):(T.openBlock(),T.createElementBlock("div",_f,[T.createElementVNode("div",{ref_key:"measureRef",ref:r,style:a,innerHTML:d.value},null,8,xf),T.createElementVNode("div",{class:"vfp-py-6 md:vfp-py-10 vfp-flex vfp-flex-col vfp-items-center",style:T.normalizeStyle({gap:`${Sf}px`})},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(o.value.length>0?o.value:[""],(u,g)=>(T.openBlock(),T.createElementBlock("div",{key:g,style:s},[T.createElementVNode("div",{style:c,innerHTML:u},null,8,kf)]))),128))],4)]))}});var ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cf(C){return C&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default")?C.default:C}function ks(C){throw new Error('Could not dynamically require "'+C+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jl={exports:{}};/*! ExcelJS 19-10-2023 */(function(C,w){(function(t){C.exports=t()})(function(){return function t(h,d,l){function i(e,n){if(!d[e]){if(!h[e]){var c=typeof ks=="function"&&ks;if(!n&&c)return c(e,!0);if(o)return o(e,!0);var a=new Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a}var s=d[e]={exports:{}};h[e][0].call(s.exports,function(f){return i(h[e][1][f]||f)},s,s.exports,t,h,d,l)}return d[e].exports}for(var o=typeof ks=="function"&&ks,r=0;r<l.length;r++)i(l[r]);return i}({1:[function(t,h,d){const l=t("fs"),i=t("fast-csv"),o=t("dayjs/plugin/customParseFormat"),r=t("dayjs/plugin/utc"),e=t("dayjs").extend(o).extend(r),n=t("../utils/stream-buf"),{fs:{exists:c}}=t("../utils/utils"),a={true:!0,false:!1,"#N/A":{error:"#N/A"},"#REF!":{error:"#REF!"},"#NAME?":{error:"#NAME?"},"#DIV/0!":{error:"#DIV/0!"},"#NULL!":{error:"#NULL!"},"#VALUE!":{error:"#VALUE!"},"#NUM!":{error:"#NUM!"}};h.exports=class{constructor(s){this.workbook=s,this.worksheet=null}async readFile(s,f){if(f=f||{},!await c(s))throw new Error("File not found: "+s);const p=l.createReadStream(s),u=await this.read(p,f);return p.close(),u}read(s,f){return f=f||{},new Promise((p,u)=>{const g=this.workbook.addWorksheet(f.sheetName),m=f.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],v=f.map||function(R){if(R==="")return null;const I=Number(R);if(!Number.isNaN(I)&&I!==1/0)return I;const F=m.reduce((L,$)=>{if(L)return L;const V=e(R,$,!0);return V.isValid()?V:null},null);if(F)return new Date(F.valueOf());const j=a[R];return j!==void 0?j:R},S=i.parse(f.parserOptions).on("data",R=>{g.addRow(R.map(v))}).on("end",()=>{S.emit("worksheet",g)});S.on("worksheet",p).on("error",u),s.pipe(S)})}createInputStream(){throw new Error("`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}write(s,f){return new Promise((p,u)=>{f=f||{};const g=this.workbook.getWorksheet(f.sheetName||f.sheetId),m=i.format(f.formatterOptions);s.on("finish",()=>{p()}),m.on("error",u),m.pipe(s);const{dateFormat:v,dateUTC:S}=f,R=f.map||(j=>{if(j){if(j.text||j.hyperlink)return j.hyperlink||j.text||"";if(j.formula||j.result)return j.result||"";if(j instanceof Date)return v?S?e.utc(j).format(v):e(j).format(v):S?e.utc(j).format():e(j).format();if(j.error)return j.error;if(typeof j=="object")return JSON.stringify(j)}return j}),I=f.includeEmptyRows===void 0||f.includeEmptyRows;let F=1;g&&g.eachRow((j,L)=>{if(I)for(;F++<L-1;)m.write([]);const{values:$}=j;$.shift(),m.write($.map(R)),F=L}),m.end()})}writeFile(s,f){const p={encoding:(f=f||{}).encoding||"utf8"},u=l.createWriteStream(s,p);return this.write(u,f)}async writeBuffer(s){const f=new n;return await this.write(f,s),f.read()}}},{"../utils/stream-buf":24,"../utils/utils":27,dayjs:391,"dayjs/plugin/customParseFormat":392,"dayjs/plugin/utc":393,"fast-csv":424,fs:216}],2:[function(t,h,d){const l=t("../utils/col-cache");class i{constructor(r,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this.worksheet=r,e)if(typeof e=="string"){const c=l.decodeAddress(e);this.nativeCol=c.col+n,this.nativeColOff=0,this.nativeRow=c.row+n,this.nativeRowOff=0}else e.nativeCol!==void 0?(this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0):e.col!==void 0?(this.col=e.col+n,this.row=e.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(r){return r instanceof i||r==null?r:new i(r)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(r){this.nativeCol=Math.floor(r),this.nativeColOff=Math.floor((r-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(r){this.nativeRow=Math.floor(r),this.nativeRowOff=Math.floor((r-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(r){this.nativeCol=r.nativeCol,this.nativeColOff=r.nativeColOff,this.nativeRow=r.nativeRow,this.nativeRowOff=r.nativeRowOff}}h.exports=i},{"../utils/col-cache":19}],3:[function(t,h,d){const l=t("../utils/col-cache"),i=t("../utils/under-dash"),o=t("./enums"),{slideFormula:r}=t("../utils/shared-formula"),e=t("./note");class n{constructor(s,f,p){if(!s||!f)throw new Error("A Cell needs a Row");this._row=s,this._column=f,l.validateAddress(p),this._address=p,this._value=c.create(n.Types.Null,this),this.style=this._mergeStyle(s.style,f.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(s){this.style.numFmt=s}get font(){return this.style.font}set font(s){this.style.font=s}get alignment(){return this.style.alignment}set alignment(s){this.style.alignment=s}get border(){return this.style.border}set border(s){this.style.border=s}get fill(){return this.style.fill}set fill(s){this.style.fill=s}get protection(){return this.style.protection}set protection(s){this.style.protection=s}_mergeStyle(s,f,p){const u=s&&s.numFmt||f&&f.numFmt;u&&(p.numFmt=u);const g=s&&s.font||f&&f.font;g&&(p.font=g);const m=s&&s.alignment||f&&f.alignment;m&&(p.alignment=m);const v=s&&s.border||f&&f.border;v&&(p.border=v);const S=s&&s.fill||f&&f.fill;S&&(p.fill=S);const R=s&&s.protection||f&&f.protection;return R&&(p.protection=R),p}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===n.Types.Merge}merge(s,f){this._value.release(),this._value=c.create(n.Types.Merge,this,s),f||(this.style=s.style)}unmerge(){this.type===n.Types.Merge&&(this._value.release(),this._value=c.create(n.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(s){return this._value.type===n.Types.Merge&&this._value.isMergedTo(s)}get master(){return this.type===n.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===n.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(s){this.type!==n.Types.Merge?(this._value.release(),this._value=c.create(c.getType(s),this,s)):this._value.master.value=s}get note(){return this._comment&&this._comment.note}set note(s){this._comment=new e(s)}get text(){return this._value.toString()}get html(){return i.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(s){this.type===n.Types.String&&(this._value=c.create(n.Types.Hyperlink,this,{text:this._value.value,hyperlink:s}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){const{worksheet:s}=this._row;return{sheetName:s.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(s){this.names=[s]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(s){const{definedNames:f}=this.workbook;f.removeAllNames(this.fullAddress),s.forEach(p=>{f.addEx(this.fullAddress,p)})}addName(s){this.workbook.definedNames.addEx(this.fullAddress,s)}removeName(s){this.workbook.definedNames.removeEx(this.fullAddress,s)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(s){this._dataValidations.add(this.address,s)}get model(){const{model:s}=this._value;return s.style=this.style,this._comment&&(s.comment=this._comment.model),s}set model(s){if(this._value.release(),this._value=c.create(s.type,this),this._value.model=s,s.comment)switch(s.comment.type){case"note":this._comment=e.fromModel(s.comment)}s.style?this.style=s.style:this.style={}}}n.Types=o.ValueType;const c={getType:a=>a==null?n.Types.Null:a instanceof String||typeof a=="string"?n.Types.String:typeof a=="number"?n.Types.Number:typeof a=="boolean"?n.Types.Boolean:a instanceof Date?n.Types.Date:a.text&&a.hyperlink?n.Types.Hyperlink:a.formula||a.sharedFormula?n.Types.Formula:a.richText?n.Types.RichText:a.sharedString?n.Types.SharedString:a.error?n.Types.Error:n.Types.JSON,types:[{t:n.Types.Null,f:class{constructor(a){this.model={address:a.address,type:n.Types.Null}}get value(){return null}set value(a){}get type(){return n.Types.Null}get effectiveType(){return n.Types.Null}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return""}release(){}toString(){return""}}},{t:n.Types.Number,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Number,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Number}get effectiveType(){return n.Types.Number}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.String,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.String,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.String}get effectiveType(){return n.Types.String}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return`"${this.model.value.replace(/"/g,'""')}"`}release(){}toString(){return this.model.value}}},{t:n.Types.Date,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Date,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Date}get effectiveType(){return n.Types.Date}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.Hyperlink,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Hyperlink,text:s?s.text:void 0,hyperlink:s?s.hyperlink:void 0},s&&s.tooltip&&(this.model.tooltip=s.tooltip)}get value(){const a={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(a.tooltip=this.model.tooltip),a}set value(a){this.model={text:a.text,hyperlink:a.hyperlink},a.tooltip&&(this.model.tooltip=a.tooltip)}get text(){return this.model.text}set text(a){this.model.text=a}get hyperlink(){return this.model.hyperlink}set hyperlink(a){this.model.hyperlink=a}get type(){return n.Types.Hyperlink}get effectiveType(){return n.Types.Hyperlink}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:n.Types.Formula,f:class{constructor(a,s){this.cell=a,this.model={address:a.address,type:n.Types.Formula,shareType:s?s.shareType:void 0,ref:s?s.ref:void 0,formula:s?s.formula:void 0,sharedFormula:s?s.sharedFormula:void 0,result:s?s.result:void 0}}_copyModel(a){const s={},f=p=>{const u=a[p];u&&(s[p]=u)};return f("formula"),f("result"),f("ref"),f("shareType"),f("sharedFormula"),s}get value(){return this._copyModel(this.model)}set value(a){this.model=this._copyModel(a)}validate(a){switch(c.getType(a)){case n.Types.Null:case n.Types.String:case n.Types.Number:case n.Types.Date:break;case n.Types.Hyperlink:case n.Types.Formula:default:throw new Error("Cannot process that type of result value")}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(a){this.model.formula=a}get formulaType(){return this.model.formula?o.FormulaType.Master:this.model.sharedFormula?o.FormulaType.Shared:o.FormulaType.None}get result(){return this.model.result}set result(a){this.model.result=a}get type(){return n.Types.Formula}get effectiveType(){const a=this.model.result;return a==null?o.ValueType.Null:a instanceof String||typeof a=="string"?o.ValueType.String:typeof a=="number"?o.ValueType.Number:a instanceof Date?o.ValueType.Date:a.text&&a.hyperlink?o.ValueType.Hyperlink:a.formula?o.ValueType.Formula:o.ValueType.Null}get address(){return this.model.address}set address(a){this.model.address=a}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){const{worksheet:a}=this.cell,s=a.findCell(this.model.sharedFormula);this._translatedFormula=s&&r(s.formula,s.address,this.model.address)}return this._translatedFormula}toCsvString(){return""+(this.model.result||"")}release(){}toString(){return this.model.result?this.model.result.toString():""}}},{t:n.Types.Merge,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Merge,master:s?s.address:void 0},this._master=s,s&&s.addMergeRef()}get value(){return this._master.value}set value(a){a instanceof n?(this._master&&this._master.releaseMergeRef(),a.addMergeRef(),this._master=a):this._master.value=a}isMergedTo(a){return a===this._master}get master(){return this._master}get type(){return n.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return""}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:n.Types.JSON,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.String,value:JSON.stringify(s),rawValue:s}}get value(){return this.model.rawValue}set value(a){this.model.rawValue=a,this.model.value=JSON.stringify(a)}get type(){return n.Types.String}get effectiveType(){return n.Types.String}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:n.Types.SharedString,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.SharedString,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.SharedString}get effectiveType(){return n.Types.SharedString}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.RichText,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.String,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}toString(){return this.model.value.richText.map(a=>a.text).join("")}get type(){return n.Types.RichText}get effectiveType(){return n.Types.RichText}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return`"${this.text.replace(/"/g,'""')}"`}release(){}}},{t:n.Types.Boolean,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Boolean,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Boolean}get effectiveType(){return n.Types.Boolean}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.Error,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Error,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Error}get effectiveType(){return n.Types.Error}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce((a,s)=>(a[s.t]=s.f,a),[]),create(a,s,f){const p=this.types[a];if(!p)throw new Error("Could not create Value of type "+a);return new p(s,f)}};h.exports=n},{"../utils/col-cache":19,"../utils/shared-formula":23,"../utils/under-dash":26,"./enums":7,"./note":9}],4:[function(t,h,d){const l=t("../utils/under-dash"),i=t("./enums"),o=t("../utils/col-cache");class r{constructor(n,c,a){this._worksheet=n,this._number=c,a!==!1&&(this.defn=a)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return o.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(n){n?(this.key=n.key,this.width=n.width!==void 0?n.width:9,this.outlineLevel=n.outlineLevel,n.style?this.style=n.style:this.style={},this.header=n.header,this._hidden=!!n.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(n){n!==void 0?(this._header=n,this.headers.forEach((c,a)=>{this._worksheet.getCell(a+1,this.number).value=c})):this._header=void 0}get key(){return this._key}set key(n){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=n,n&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(n){this._hidden=n}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(n){this._outlineLevel=n}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(n){return this.width===n.width&&this.hidden===n.hidden&&this.outlineLevel===n.outlineLevel&&l.isEqual(this.style,n.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;const n=this.style;return!n||!(n.font||n.numFmt||n.alignment||n.border||n.fill||n.protection)}get headerCount(){return this.headers.length}eachCell(n,c){const a=this.number;c||(c=n,n=null),this._worksheet.eachRow(n,(s,f)=>{c(s.getCell(a),f)})}get values(){const n=[];return this.eachCell((c,a)=>{c&&c.type!==i.ValueType.Null&&(n[a]=c.value)}),n}set values(n){if(!n)return;const c=this.number;let a=0;n.hasOwnProperty("0")&&(a=1),n.forEach((s,f)=>{this._worksheet.getCell(f+a,c).value=s})}_applyStyle(n,c){return this.style[n]=c,this.eachCell(a=>{a[n]=c}),c}get numFmt(){return this.style.numFmt}set numFmt(n){this._applyStyle("numFmt",n)}get font(){return this.style.font}set font(n){this._applyStyle("font",n)}get alignment(){return this.style.alignment}set alignment(n){this._applyStyle("alignment",n)}get protection(){return this.style.protection}set protection(n){this._applyStyle("protection",n)}get border(){return this.style.border}set border(n){this._applyStyle("border",n)}get fill(){return this.style.fill}set fill(n){this._applyStyle("fill",n)}static toModel(n){const c=[];let a=null;return n&&n.forEach((s,f)=>{s.isDefault?a&&(a=null):a&&s.equivalentTo(a)?a.max=f+1:(a={min:f+1,max:f+1,width:s.width!==void 0?s.width:9,style:s.style,isCustomWidth:s.isCustomWidth,hidden:s.hidden,outlineLevel:s.outlineLevel,collapsed:s.collapsed},c.push(a))}),c.length?c:void 0}static fromModel(n,c){const a=[];let s=1,f=0;for(c=(c=c||[]).sort(function(p,u){return p.min-u.min});f<c.length;){const p=c[f++];for(;s<p.min;)a.push(new r(n,s++));for(;s<=p.max;)a.push(new r(n,s++,p))}return a.length?a:null}}h.exports=r},{"../utils/col-cache":19,"../utils/under-dash":26,"./enums":7}],5:[function(t,h,d){h.exports=class{constructor(l){this.model=l||{}}add(l,i){return this.model[l]=i}find(l){return this.model[l]}remove(l){this.model[l]=void 0}}},{}],6:[function(t,h,d){const l=t("../utils/under-dash"),i=t("../utils/col-cache"),o=t("../utils/cell-matrix"),r=t("./range"),e=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;h.exports=class{constructor(){this.matrixMap={}}getMatrix(n){return this.matrixMap[n]||(this.matrixMap[n]=new o)}add(n,c){const a=i.decodeEx(n);this.addEx(a,c)}addEx(n,c){const a=this.getMatrix(c);if(n.top)for(let s=n.left;s<=n.right;s++)for(let f=n.top;f<=n.bottom;f++){const p={sheetName:n.sheetName,address:i.n2l(s)+f,row:f,col:s};a.addCellEx(p)}else a.addCellEx(n)}remove(n,c){const a=i.decodeEx(n);this.removeEx(a,c)}removeEx(n,c){this.getMatrix(c).removeCellEx(n)}removeAllNames(n){l.each(this.matrixMap,c=>{c.removeCellEx(n)})}forEach(n){l.each(this.matrixMap,(c,a)=>{c.forEach(s=>{n(a,s)})})}getNames(n){return this.getNamesEx(i.decodeEx(n))}getNamesEx(n){return l.map(this.matrixMap,(c,a)=>c.findCellEx(n)&&a).filter(Boolean)}_explore(n,c){c.mark=!1;const{sheetName:a}=c,s=new r(c.row,c.col,c.row,c.col,a);let f,p;function u(m,v){const S=n.findCellAt(a,m,c.col);return!(!S||!S.mark)&&(s[v]=m,S.mark=!1,!0)}for(p=c.row-1;u(p,"top");p--);for(p=c.row+1;u(p,"bottom");p++);function g(m,v){const S=[];for(p=s.top;p<=s.bottom;p++){const R=n.findCellAt(a,p,m);if(!R||!R.mark)return!1;S.push(R)}s[v]=m;for(let R=0;R<S.length;R++)S[R].mark=!1;return!0}for(f=c.col-1;g(f,"left");f--);for(f=c.col+1;g(f,"right");f++);return s}getRanges(n,c){return(c=c||this.matrixMap[n])?(c.forEach(a=>{a.mark=!0}),{name:n,ranges:c.map(a=>a.mark&&this._explore(c,a)).filter(Boolean).map(a=>a.$shortRange)}):{name:n,ranges:[]}}normaliseMatrix(n,c){n.forEachInSheet(c,(a,s,f)=>{a&&(a.row===s&&a.col===f||(a.row=s,a.col=f,a.address=i.n2l(f)+s))})}spliceRows(n,c,a,s){l.each(this.matrixMap,f=>{f.spliceRows(n,c,a,s),this.normaliseMatrix(f,n)})}spliceColumns(n,c,a,s){l.each(this.matrixMap,f=>{f.spliceColumns(n,c,a,s),this.normaliseMatrix(f,n)})}get model(){return l.map(this.matrixMap,(n,c)=>this.getRanges(c,n)).filter(n=>n.ranges.length)}set model(n){const c=this.matrixMap={};n.forEach(a=>{const s=c[a.name]=new o;a.ranges.forEach(f=>{e.test(f.split("!").pop()||"")&&s.addCell(f)})})}}},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":26,"./range":10}],7:[function(t,h,d){h.exports={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:"#N/A",Ref:"#REF!",Name:"#NAME?",DivZero:"#DIV/0!",Null:"#NULL!",Value:"#VALUE!",Num:"#NUM!"}}},{}],8:[function(t,h,d){const l=t("../utils/col-cache"),i=t("./anchor");h.exports=class{constructor(o,r){this.worksheet=o,this.model=r}get model(){switch(this.type){case"background":return{type:this.type,imageId:this.imageId};case"image":return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw new Error("Invalid Image Type")}}set model(o){let{type:r,imageId:e,range:n,hyperlinks:c}=o;if(this.type=r,this.imageId=e,r==="image")if(typeof n=="string"){const a=l.decode(n);this.range={tl:new i(this.worksheet,{col:a.left,row:a.top},-1),br:new i(this.worksheet,{col:a.right,row:a.bottom},0),editAs:"oneCell"}}else this.range={tl:new i(this.worksheet,n.tl,0),br:n.br&&new i(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:c||n.hyperlinks}}}},{"../utils/col-cache":19,"./anchor":2}],9:[function(t,h,d){const l=t("../utils/under-dash");class i{constructor(r){this.note=r}get model(){let r=null;switch(typeof this.note){case"string":r={type:"note",note:{texts:[{text:this.note}]}};break;default:r={type:"note",note:this.note}}return l.deepMerge({},i.DEFAULT_CONFIGS,r)}set model(r){const{note:e}=r,{texts:n}=e;n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=e}static fromModel(r){const e=new i;return e.model=r,e}}i.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},h.exports=i},{"../utils/under-dash":26}],10:[function(t,h,d){const l=t("../utils/col-cache");class i{constructor(){this.decode(arguments)}setTLBR(r,e,n,c,a){if(arguments.length<4){const s=l.decodeAddress(r),f=l.decodeAddress(e);this.model={top:Math.min(s.row,f.row),left:Math.min(s.col,f.col),bottom:Math.max(s.row,f.row),right:Math.max(s.col,f.col),sheetName:n},this.setTLBR(s.row,s.col,f.row,f.col,a)}else this.model={top:Math.min(r,n),left:Math.min(e,c),bottom:Math.max(r,n),right:Math.max(e,c),sheetName:a}}decode(r){switch(r.length){case 5:this.setTLBR(r[0],r[1],r[2],r[3],r[4]);break;case 4:this.setTLBR(r[0],r[1],r[2],r[3]);break;case 3:this.setTLBR(r[0],r[1],r[2]);break;case 2:this.setTLBR(r[0],r[1]);break;case 1:{const e=r[0];if(e instanceof i)this.model={top:e.model.top,left:e.model.left,bottom:e.model.bottom,right:e.model.right,sheetName:e.sheetName};else if(e instanceof Array)this.decode(e);else if(e.top&&e.left&&e.bottom&&e.right)this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName};else{const n=l.decodeEx(e);n.top?this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName}:this.model={top:n.row,left:n.col,bottom:n.row,right:n.col,sheetName:n.sheetName}}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new Error("Invalid number of arguments to _getDimensions() - "+r.length)}}get top(){return this.model.top||1}set top(r){this.model.top=r}get left(){return this.model.left||1}set left(r){this.model.left=r}get bottom(){return this.model.bottom||1}set bottom(r){this.model.bottom=r}get right(){return this.model.right||1}set right(r){this.model.right=r}get sheetName(){return this.model.sheetName}set sheetName(r){this.model.sheetName=r}get _serialisedSheetName(){const{sheetName:r}=this.model;return r?/^[a-zA-Z0-9]*$/.test(r)?r+"!":`'${r}'!`:""}expand(r,e,n,c){(!this.model.top||r<this.top)&&(this.top=r),(!this.model.left||e<this.left)&&(this.left=e),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||c>this.right)&&(this.right=c)}expandRow(r){if(r){const{dimensions:e,number:n}=r;e&&this.expand(n,e.min,n,e.max)}}expandToAddress(r){const e=l.decodeEx(r);this.expand(e.row,e.col,e.row,e.col)}get tl(){return l.n2l(this.left)+this.top}get $t$l(){return`$${l.n2l(this.left)}$${this.top}`}get br(){return l.n2l(this.right)+this.bottom}get $b$r(){return`$${l.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&!(r.bottom<this.top)&&!(r.top>this.bottom)&&!(r.right<this.left)&&!(r.left>this.right)}contains(r){const e=l.decodeEx(r);return this.containsEx(e)}containsEx(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&r.row>=this.top&&r.row<=this.bottom&&r.col>=this.left&&r.col<=this.right}forEachAddress(r){for(let e=this.left;e<=this.right;e++)for(let n=this.top;n<=this.bottom;n++)r(l.encodeAddress(n,e),n,e)}}h.exports=i},{"../utils/col-cache":19}],11:[function(t,h,d){const l=t("../utils/under-dash"),i=t("./enums"),o=t("../utils/col-cache"),r=t("./cell");h.exports=class{constructor(e,n){this._worksheet=e,this._number=n,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(e){return this._cells[e-1]}getCellEx(e){let n=this._cells[e.col-1];if(!n){const c=this._worksheet.getColumn(e.col);n=new r(this,c,e.address),this._cells[e.col-1]=n}return n}getCell(e){if(typeof e=="string"){const n=this._worksheet.getColumnKey(e);e=n?n.number:o.l2n(e)}return this._cells[e-1]||this.getCellEx({address:o.encodeAddress(this._number,e),row:this._number,col:e})}splice(e,n){const c=e+n;for(var a=arguments.length,s=new Array(a>2?a-2:0),f=2;f<a;f++)s[f-2]=arguments[f];const p=s.length-n,u=this._cells.length;let g,m,v;if(p<0)for(g=e+s.length;g<=u;g++)v=this._cells[g-1],m=this._cells[g-p-1],m?(v=this.getCell(g),v.value=m.value,v.style=m.style,v._comment=m._comment):v&&(v.value=null,v.style={},v._comment=void 0);else if(p>0)for(g=u;g>=c;g--)m=this._cells[g-1],m?(v=this.getCell(g+p),v.value=m.value,v.style=m.style,v._comment=m._comment):this._cells[g+p-1]=void 0;for(g=0;g<s.length;g++)v=this.getCell(e+g),v.value=s[g],v.style={},v._comment=void 0}eachCell(e,n){if(n||(n=e,e=null),e&&e.includeEmpty){const c=this._cells.length;for(let a=1;a<=c;a++)n(this.getCell(a),a)}else this._cells.forEach((c,a)=>{c&&c.type!==i.ValueType.Null&&n(c,a+1)})}addPageBreak(e,n){const c=this._worksheet,a=Math.max(0,e-1)||0,s=Math.max(0,n-1)||16838,f={id:this._number,max:s,man:1};a&&(f.min=a),c.rowBreaks.push(f)}get values(){const e=[];return this._cells.forEach(n=>{n&&n.type!==i.ValueType.Null&&(e[n.col]=n.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let n=0;e.hasOwnProperty("0")&&(n=1),e.forEach((c,a)=>{c!==void 0&&(this.getCellEx({address:o.encodeAddress(this._number,a+n),row:this._number,col:a+n}).value=c)})}else this._worksheet.eachColumnKey((n,c)=>{e[c]!==void 0&&(this.getCellEx({address:o.encodeAddress(this._number,n.number),row:this._number,col:n.number}).value=e[c])})}get hasValues(){return l.some(this._cells,e=>e&&e.type!==i.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,n=0;return this._cells.forEach(c=>{c&&c.type!==i.ValueType.Null&&((!e||e>c.col)&&(e=c.col),n<c.col&&(n=c.col))}),e>0?{min:e,max:n}:null}_applyStyle(e,n){return this.style[e]=n,this._cells.forEach(c=>{c&&(c[e]=n)}),n}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle("numFmt",e)}get font(){return this.style.font}set font(e){this._applyStyle("font",e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle("alignment",e)}get protection(){return this.style.protection}set protection(e){this._applyStyle("protection",e)}get border(){return this.style.border}set border(e){this._applyStyle("border",e)}get fill(){return this.style.fill}set fill(e){this._applyStyle("fill",e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){const e=[];let n=0,c=0;return this._cells.forEach(a=>{if(a){const s=a.model;s&&((!n||n>a.col)&&(n=a.col),c<a.col&&(c=a.col),e.push(s))}}),this.height||e.length?{cells:e,number:this.number,min:n,max:c,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(e){if(e.number!==this._number)throw new Error("Invalid row number in model");let n;this._cells=[],e.cells.forEach(c=>{switch(c.type){case r.Types.Merge:break;default:{let a;if(c.address)a=o.decodeAddress(c.address);else if(n){const{row:s}=n,f=n.col+1;a={row:s,col:f,address:o.encodeAddress(s,f),$col$row:`$${o.n2l(f)}$${s}`}}n=a,this.getCellEx(a).model=c;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}}},{"../utils/col-cache":19,"../utils/under-dash":26,"./cell":3,"./enums":7}],12:[function(t,h,d){const l=t("../utils/col-cache");class i{constructor(r,e,n){this.table=r,this.column=e,this.index=n}_set(r,e){this.table.cacheState(),this.column[r]=e}get name(){return this.column.name}set name(r){this._set("name",r)}get filterButton(){return this.column.filterButton}set filterButton(r){this.column.filterButton=r}get style(){return this.column.style}set style(r){this.column.style=r}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(r){this._set("totalsRowLabel",r)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(r){this._set("totalsRowFunction",r)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(r){this._set("totalsRowResult",r)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(r){this._set("totalsRowFormula",r)}}h.exports=class{constructor(o,r){this.worksheet=o,r&&(this.table=r,this.validate(),this.store())}getFormula(o){switch(o.totalsRowFunction){case"none":return null;case"average":return`SUBTOTAL(101,${this.table.name}[${o.name}])`;case"countNums":return`SUBTOTAL(102,${this.table.name}[${o.name}])`;case"count":return`SUBTOTAL(103,${this.table.name}[${o.name}])`;case"max":return`SUBTOTAL(104,${this.table.name}[${o.name}])`;case"min":return`SUBTOTAL(105,${this.table.name}[${o.name}])`;case"stdDev":return`SUBTOTAL(106,${this.table.name}[${o.name}])`;case"var":return`SUBTOTAL(107,${this.table.name}[${o.name}])`;case"sum":return`SUBTOTAL(109,${this.table.name}[${o.name}])`;case"custom":return o.totalsRowFormula;default:throw new Error("Invalid Totals Row Function: "+o.totalsRowFunction)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){const{table:o}=this,r=(p,u,g)=>{p[u]===void 0&&(p[u]=g)};r(o,"headerRow",!0),r(o,"totalsRow",!1),r(o,"style",{}),r(o.style,"theme","TableStyleMedium2"),r(o.style,"showFirstColumn",!1),r(o.style,"showLastColumn",!1),r(o.style,"showRowStripes",!1),r(o.style,"showColumnStripes",!1);const e=(p,u)=>{if(!p)throw new Error(u)};e(o.ref,"Table must have ref"),e(o.columns,"Table must have column definitions"),e(o.rows,"Table must have row definitions"),o.tl=l.decodeAddress(o.ref);const{row:n,col:c}=o.tl;e(n>0,"Table must be on valid row"),e(c>0,"Table must be on valid col");const{width:a,filterHeight:s,tableHeight:f}=this;o.autoFilterRef=l.encode(n,c,n+s-1,c+a-1),o.tableRef=l.encode(n,c,n+f-1,c+a-1),o.columns.forEach((p,u)=>{e(p.name,`Column ${u} must have a name`),u===0?r(p,"totalsRowLabel","Total"):(r(p,"totalsRowFunction","none"),p.totalsRowFormula=this.getFormula(p))})}store(){const o=(s,f)=>{f&&Object.keys(f).forEach(p=>{s[p]=f[p]})},{worksheet:r,table:e}=this,{row:n,col:c}=e.tl;let a=0;if(e.headerRow){const s=r.getRow(n+a++);e.columns.forEach((f,p)=>{const{style:u,name:g}=f,m=s.getCell(c+p);m.value=g,o(m,u)})}if(e.rows.forEach(s=>{const f=r.getRow(n+a++);s.forEach((p,u)=>{const g=f.getCell(c+u);g.value=p,o(g,e.columns[u].style)})}),e.totalsRow){const s=r.getRow(n+a++);e.columns.forEach((f,p)=>{const u=s.getCell(c+p);if(p===0)u.value=f.totalsRowLabel;else{const g=this.getFormula(f);u.value=g?{formula:f.totalsRowFormula,result:f.totalsRowResult}:null}o(u,f.style)})}}load(o){const{table:r}=this,{row:e,col:n}=r.tl;let c=0;if(r.headerRow){const a=o.getRow(e+c++);r.columns.forEach((s,f)=>{a.getCell(n+f).value=s.name})}if(r.rows.forEach(a=>{const s=o.getRow(e+c++);a.forEach((f,p)=>{s.getCell(n+p).value=f})}),r.totalsRow){const a=o.getRow(e+c++);r.columns.forEach((s,f)=>{const p=a.getCell(n+f);f===0?p.value=s.totalsRowLabel:this.getFormula(s)&&(p.value={formula:s.totalsRowFormula,result:s.totalsRowResult})})}}get model(){return this.table}set model(o){this.table=o}cacheState(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}commit(){if(!this._cache)return;this.validate();const o=l.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let r=0;r<this._cache.tableHeight;r++){const e=this.worksheet.getRow(o.row+r);for(let n=0;n<this._cache.width;n++)e.getCell(o.col+n).value=null}else{for(let r=this.tableHeight;r<this._cache.tableHeight;r++){const e=this.worksheet.getRow(o.row+r);for(let n=0;n<this._cache.width;n++)e.getCell(o.col+n).value=null}for(let r=0;r<this.tableHeight;r++){const e=this.worksheet.getRow(o.row+r);for(let n=this.width;n<this._cache.width;n++)e.getCell(o.col+n).value=null}}this.store()}addRow(o,r){this.cacheState(),r===void 0?this.table.rows.push(o):this.table.rows.splice(r,0,o)}removeRows(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.rows.splice(o,r)}getColumn(o){const r=this.table.columns[o];return new i(this,r,o)}addColumn(o,r,e){this.cacheState(),e===void 0?(this.table.columns.push(o),this.table.rows.forEach((n,c)=>{n.push(r[c])})):(this.table.columns.splice(e,0,o),this.table.rows.forEach((n,c)=>{n.splice(e,0,r[c])}))}removeColumns(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.columns.splice(o,r),this.table.rows.forEach(e=>{e.splice(o,r)})}_assign(o,r,e){this.cacheState(),o[r]=e}get ref(){return this.table.ref}set ref(o){this._assign(this.table,"ref",o)}get name(){return this.table.name}set name(o){this.table.name=o}get displayName(){return this.table.displyName||this.table.name}set displayNamename(o){this.table.displayName=o}get headerRow(){return this.table.headerRow}set headerRow(o){this._assign(this.table,"headerRow",o)}get totalsRow(){return this.table.totalsRow}set totalsRow(o){this._assign(this.table,"totalsRow",o)}get theme(){return this.table.style.name}set theme(o){this.table.style.name=o}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(o){this.table.style.showFirstColumn=o}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(o){this.table.style.showLastColumn=o}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(o){this.table.style.showRowStripes=o}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(o){this.table.style.showColumnStripes=o}}},{"../utils/col-cache":19}],13:[function(t,h,d){const l=t("./worksheet"),i=t("./defined-names"),o=t("../xlsx/xlsx"),r=t("../csv/csv");h.exports=class{constructor(){this.category="",this.company="",this.created=new Date,this.description="",this.keywords="",this.manager="",this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject="",this.title="",this.views=[],this.media=[],this._definedNames=new i}get xlsx(){return this._xlsx||(this._xlsx=new o(this)),this._xlsx}get csv(){return this._csv||(this._csv=new r(this)),this._csv}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,n){const c=this.nextId;n&&(typeof n=="string"?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),n={properties:{tabColor:{argb:n}}}):(n.argb||n.theme||n.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),n={properties:{tabColor:n}}));const a=this._worksheets.reduce((p,u)=>(u&&u.orderNo)>p?u.orderNo:p,0),s=Object.assign({},n,{id:c,name:e,orderNo:a+1,workbook:this}),f=new l(s);return this._worksheets[c]=f,f}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){const n=this.getWorksheet(e);n&&n.destroy()}getWorksheet(e){return e===void 0?this._worksheets.find(Boolean):typeof e=="number"?this._worksheets[e]:typeof e=="string"?this._worksheets.find(n=>n&&n.name===e):void 0}get worksheets(){return this._worksheets.slice(1).sort((e,n)=>e.orderNo-n.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(n=>{e(n,n.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){const n=this.media.length;return this.media.push(Object.assign({},e,{type:"image"})),n}getImage(e){return this.media[e]}get model(){return{creator:this.creator||"Unknown",lastModifiedBy:this.lastModifiedBy||"Unknown",lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,calcProperties:this.calcProperties}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(n=>{const{id:c,name:a,state:s}=n,f=e.sheets&&e.sheets.findIndex(p=>p.id===c);(this._worksheets[c]=new l({id:c,name:a,orderNo:f,state:s,workbook:this})).model=n}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media||[]}}},{"../csv/csv":1,"../xlsx/xlsx":144,"./defined-names":6,"./worksheet":14}],14:[function(t,h,d){const l=t("../utils/under-dash"),i=t("../utils/col-cache"),o=t("./range"),r=t("./row"),e=t("./column"),n=t("./enums"),c=t("./image"),a=t("./table"),s=t("./data-validations"),f=t("../utils/encryptor"),{copyStyle:p}=t("../utils/copy-style");h.exports=class{constructor(u){u=u||{},this._workbook=u.workbook,this.id=u.id,this.orderNo=u.orderNo,this.name=u.name,this.state=u.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},u.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!(!u.pageSetup||!u.pageSetup.fitToWidth&&!u.pageSetup.fitToHeight||u.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},u.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},u.headerFooter),this.dataValidations=new s,this.views=u.views||[],this.autoFilter=u.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.conditionalFormattings=[]}get name(){return this._name}set name(u){if(u===void 0&&(u="sheet"+this.id),this._name!==u){if(typeof u!="string")throw new Error("The name has to be a string.");if(u==="")throw new Error("The name can't be empty.");if(u==="History")throw new Error('The name "History" is protected. Please use a different name.');if(/[*?:/\\[\]]/.test(u))throw new Error(`Worksheet name ${u} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(u))throw new Error("The first or last character of worksheet name cannot be a single quotation mark: "+u);if(u&&u.length>31&&(console.warn(`Worksheet name ${u} exceeds 31 chars. This will be truncated`),u=u.substring(0,31)),this._workbook._worksheets.find(g=>g&&g.name.toLowerCase()===u.toLowerCase()))throw new Error("Worksheet name already exists: "+u);this._name=u}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){const u=new o;return this._rows.forEach(g=>{if(g){const m=g.dimensions;m&&u.expand(g.number,m.min,g.number,m.max)}}),u}get columns(){return this._columns}set columns(u){this._headerRowCount=u.reduce((v,S)=>{const R=(S.header?1:S.headers&&S.headers.length)||0;return Math.max(v,R)},0);let g=1;const m=this._columns=[];u.forEach(v=>{const S=new e(this,g++,!1);m.push(S),S.defn=v})}getColumnKey(u){return this._keys[u]}setColumnKey(u,g){this._keys[u]=g}deleteColumnKey(u){delete this._keys[u]}eachColumnKey(u){l.each(this._keys,u)}getColumn(u){if(typeof u=="string"){const g=this._keys[u];if(g)return g;u=i.l2n(u)}if(this._columns||(this._columns=[]),u>this._columns.length){let g=this._columns.length+1;for(;g<=u;)this._columns.push(new e(this,g++))}return this._columns[u-1]}spliceColumns(u,g){const m=this._rows.length;for(var v=arguments.length,S=new Array(v>2?v-2:0),R=2;R<v;R++)S[R-2]=arguments[R];if(S.length>0)for(let L=0;L<m;L++){const $=[u,g];S.forEach(z=>{$.push(z[L]||null)});const V=this.getRow(L+1);V.splice.apply(V,$)}else this._rows.forEach(L=>{L&&L.splice(u,g)});const I=S.length-g,F=u+g,j=this._columns.length;if(I<0)for(let L=u+S.length;L<=j;L++)this.getColumn(L).defn=this.getColumn(L-I).defn;else if(I>0)for(let L=j;L>=F;L--)this.getColumn(L+I).defn=this.getColumn(L).defn;for(let L=u;L<u+S.length;L++)this.getColumn(L).defn=null;this.workbook.definedNames.spliceColumns(this.name,u,g,S.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let u=0;return this.eachRow(g=>{u=Math.max(u,g.cellCount)}),u}get actualColumnCount(){const u=[];let g=0;return this.eachRow(m=>{m.eachCell(v=>{let{col:S}=v;u[S]||(u[S]=!0,g++)})}),g}_commitRow(){}get _lastRowNumber(){const u=this._rows;let g=u.length;for(;g>0&&u[g-1]===void 0;)g--;return g}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(u){return this._rows[u-1]}findRows(u,g){return this._rows.slice(u-1,u-1+g)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let u=0;return this.eachRow(()=>{u++}),u}getRow(u){let g=this._rows[u-1];return g||(g=this._rows[u-1]=new r(this,u)),g}getRows(u,g){if(g<1)return;const m=[];for(let v=u;v<u+g;v++)m.push(this.getRow(v));return m}addRow(u){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"n";const m=this._nextRow,v=this.getRow(m);return v.values=u,this._setStyleOption(m,g[0]==="i"?g:"n"),v}addRows(u){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"n";const m=[];return u.forEach(v=>{m.push(this.addRow(v,g))}),m}insertRow(u,g){let m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"n";return this.spliceRows(u,0,g),this._setStyleOption(u,m),this.getRow(u)}insertRows(u,g){let m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"n";if(this.spliceRows(u,0,...g),m!=="n")for(let v=0;v<g.length;v++)m[0]==="o"&&this.findRow(g.length+u+v)!==void 0?this._copyStyle(g.length+u+v,u+v,m[1]==="+"):m[0]==="i"&&this.findRow(u-1)!==void 0&&this._copyStyle(u-1,u+v,m[1]==="+");return this.getRows(u,g.length)}_setStyleOption(u){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"n";g[0]==="o"&&this.findRow(u+1)!==void 0?this._copyStyle(u+1,u,g[1]==="+"):g[0]==="i"&&this.findRow(u-1)!==void 0&&this._copyStyle(u-1,u,g[1]==="+")}_copyStyle(u,g){let m=arguments.length>2&&arguments[2]!==void 0&&arguments[2];const v=this.getRow(u),S=this.getRow(g);S.style=p(v.style),v.eachCell({includeEmpty:m},(R,I)=>{S.getCell(I).style=p(R.style)}),S.height=v.height}duplicateRow(u,g){let m=arguments.length>2&&arguments[2]!==void 0&&arguments[2];const v=this._rows[u-1],S=new Array(g).fill(v.values);this.spliceRows(u+1,m?0:g,...S);for(let R=0;R<g;R++){const I=this._rows[u+R];I.style=v.style,I.height=v.height,v.eachCell({includeEmpty:!0},(F,j)=>{I.getCell(j).style=F.style})}}spliceRows(u,g){const m=u+g;for(var v=arguments.length,S=new Array(v>2?v-2:0),R=2;R<v;R++)S[R-2]=arguments[R];const I=S.length,F=I-g,j=this._rows.length;let L,$;if(F<0)for(u===j&&(this._rows[j-1]=void 0),L=m;L<=j;L++)if($=this._rows[L-1],$){const V=this.getRow(L+F);V.values=$.values,V.style=$.style,V.height=$.height,$.eachCell({includeEmpty:!0},(z,E)=>{V.getCell(E).style=z.style}),this._rows[L-1]=void 0}else this._rows[L+F-1]=void 0;else if(F>0)for(L=j;L>=m;L--)if($=this._rows[L-1],$){const V=this.getRow(L+F);V.values=$.values,V.style=$.style,V.height=$.height,$.eachCell({includeEmpty:!0},(z,E)=>{if(V.getCell(E).style=z.style,z._value.constructor.name==="MergeValue"){const A=this.getRow(z._row._number+I).getCell(E),k=z._value._master,b=this.getRow(k._row._number+I).getCell(k._column._number);A.merge(b)}})}else this._rows[L+F-1]=void 0;for(L=0;L<I;L++){const V=this.getRow(u+L);V.style={},V.values=S[L]}this.workbook.definedNames.spliceRows(this.name,u,g,I)}eachRow(u,g){if(g||(g=u,u=void 0),u&&u.includeEmpty){const m=this._rows.length;for(let v=1;v<=m;v++)g(this.getRow(v),v)}else this._rows.forEach(m=>{m&&m.hasValues&&g(m,m.number)})}getSheetValues(){const u=[];return this._rows.forEach(g=>{g&&(u[g.number]=g.values)}),u}findCell(u,g){const m=i.getAddress(u,g),v=this._rows[m.row-1];return v?v.findCell(m.col):void 0}getCell(u,g){const m=i.getAddress(u,g);return this.getRow(m.row).getCellEx(m)}mergeCells(){for(var u=arguments.length,g=new Array(u),m=0;m<u;m++)g[m]=arguments[m];const v=new o(g);this._mergeCellsInternal(v)}mergeCellsWithoutStyle(){for(var u=arguments.length,g=new Array(u),m=0;m<u;m++)g[m]=arguments[m];const v=new o(g);this._mergeCellsInternal(v,!0)}_mergeCellsInternal(u,g){l.each(this._merges,v=>{if(v.intersects(u))throw new Error("Cannot merge already merged cells")});const m=this.getCell(u.top,u.left);for(let v=u.top;v<=u.bottom;v++)for(let S=u.left;S<=u.right;S++)(v>u.top||S>u.left)&&this.getCell(v,S).merge(m,g);this._merges[m.address]=u}_unMergeMaster(u){const g=this._merges[u.address];if(g){for(let m=g.top;m<=g.bottom;m++)for(let v=g.left;v<=g.right;v++)this.getCell(m,v).unmerge();delete this._merges[u.address]}}get hasMerges(){return l.some(this._merges,Boolean)}unMergeCells(){for(var u=arguments.length,g=new Array(u),m=0;m<u;m++)g[m]=arguments[m];const v=new o(g);for(let S=v.top;S<=v.bottom;S++)for(let R=v.left;R<=v.right;R++){const I=this.findCell(S,R);I&&(I.type===n.ValueType.Merge?this._unMergeMaster(I.master):this._merges[I.address]&&this._unMergeMaster(I))}}fillFormula(u,g,m){let v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"shared";const S=i.decode(u),{top:R,left:I,bottom:F,right:j}=S,L=j-I+1,$=i.encodeAddress(R,I),V=v==="shared";let z;z=typeof m=="function"?m:Array.isArray(m)?Array.isArray(m[0])?(A,k)=>m[A-R][k-I]:(A,k)=>m[(A-R)*L+(k-I)]:()=>{};let E=!0;for(let A=R;A<=F;A++)for(let k=I;k<=j;k++)E?(this.getCell(A,k).value={shareType:v,formula:g,ref:u,result:z(A,k)},E=!1):this.getCell(A,k).value=V?{sharedFormula:$,result:z(A,k)}:z(A,k)}addImage(u,g){const m={type:"image",imageId:u,range:g};this._media.push(new c(this,m))}getImages(){return this._media.filter(u=>u.type==="image")}addBackgroundImage(u){const g={type:"background",imageId:u};this._media.push(new c(this,g))}getBackgroundImageId(){const u=this._media.find(g=>g.type==="background");return u&&u.imageId}protect(u,g){return new Promise(m=>{this.sheetProtection={sheet:!0},g&&"spinCount"in g&&(g.spinCount=Number.isFinite(g.spinCount)?Math.round(Math.max(0,g.spinCount)):1e5),u&&(this.sheetProtection.algorithmName="SHA-512",this.sheetProtection.saltValue=f.randomBytes(16).toString("base64"),this.sheetProtection.spinCount=g&&"spinCount"in g?g.spinCount:1e5,this.sheetProtection.hashValue=f.convertPasswordToHash(u,"SHA512",this.sheetProtection.saltValue,this.sheetProtection.spinCount)),g&&(this.sheetProtection=Object.assign(this.sheetProtection,g),!u&&"spinCount"in g&&delete this.sheetProtection.spinCount),m()})}unprotect(){this.sheetProtection=null}addTable(u){const g=new a(this,u);return this.tables[u.name]=g,g}getTable(u){return this.tables[u]}removeTable(u){delete this.tables[u]}getTables(){return Object.values(this.tables)}addConditionalFormatting(u){this.conditionalFormattings.push(u)}removeConditionalFormatting(u){typeof u=="number"?this.conditionalFormattings.splice(u,1):this.conditionalFormattings=u instanceof Function?this.conditionalFormattings.filter(u):[]}get tabColor(){return console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor}set tabColor(u){console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor=u}get model(){const u={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(v=>v.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(v=>v.model),conditionalFormattings:this.conditionalFormattings};u.cols=e.toModel(this.columns);const g=u.rows=[],m=u.dimensions=new o;return this._rows.forEach(v=>{const S=v&&v.model;S&&(m.expand(S.number,S.min,S.number,S.max),g.push(S))}),u.merges=[],l.each(this._merges,v=>{u.merges.push(v.range)}),u}_parseRows(u){this._rows=[],u.rows.forEach(g=>{const m=new r(this,g.number);this._rows[m.number-1]=m,m.model=g})}_parseMergeCells(u){l.each(u.mergeCells,g=>{this.mergeCellsWithoutStyle(g)})}set model(u){this.name=u.name,this._columns=e.fromModel(this,u.cols),this._parseRows(u),this._parseMergeCells(u),this.dataValidations=new s(u.dataValidations),this.properties=u.properties,this.pageSetup=u.pageSetup,this.headerFooter=u.headerFooter,this.views=u.views,this.autoFilter=u.autoFilter,this._media=u.media.map(g=>new c(this,g)),this.sheetProtection=u.sheetProtection,this.tables=u.tables.reduce((g,m)=>{const v=new a;return v.model=m,g[m.name]=v,g},{}),this.conditionalFormattings=u.conditionalFormattings}}},{"../utils/col-cache":19,"../utils/copy-style":20,"../utils/encryptor":21,"../utils/under-dash":26,"./column":4,"./data-validations":5,"./enums":7,"./image":8,"./range":10,"./row":11,"./table":12}],15:[function(t,h,d){t("core-js/modules/es.promise"),t("core-js/modules/es.promise.finally"),t("core-js/modules/es.object.assign"),t("core-js/modules/es.object.keys"),t("core-js/modules/es.object.values"),t("core-js/modules/es.symbol"),t("core-js/modules/es.symbol.async-iterator"),t("core-js/modules/es.array.iterator"),t("core-js/modules/es.array.includes"),t("core-js/modules/es.array.find-index"),t("core-js/modules/es.array.find"),t("core-js/modules/es.string.from-code-point"),t("core-js/modules/es.string.includes"),t("core-js/modules/es.number.is-nan"),t("regenerator-runtime/runtime");const l={Workbook:t("./doc/workbook")},i=t("./doc/enums");Object.keys(i).forEach(o=>{l[o]=i[o]}),h.exports=l},{"./doc/enums":7,"./doc/workbook":13,"core-js/modules/es.array.find":359,"core-js/modules/es.array.find-index":358,"core-js/modules/es.array.includes":360,"core-js/modules/es.array.iterator":361,"core-js/modules/es.number.is-nan":363,"core-js/modules/es.object.assign":364,"core-js/modules/es.object.keys":366,"core-js/modules/es.object.values":367,"core-js/modules/es.promise":372,"core-js/modules/es.promise.finally":371,"core-js/modules/es.string.from-code-point":376,"core-js/modules/es.string.includes":377,"core-js/modules/es.symbol":381,"core-js/modules/es.symbol.async-iterator":378,"regenerator-runtime/runtime":492}],16:[function(t,h,d){const l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");d.bufferToString=function(i){return typeof i=="string"?i:l?l.decode(i):i.toString()}},{}],17:[function(t,h,d){const l=typeof TextEncoder>"u"?null:new TextEncoder("utf-8"),{Buffer:i}=t("buffer");d.stringToBuffer=function(o){return typeof o!="string"?o:l?i.from(l.encode(o).buffer):i.from(o)}},{buffer:220}],18:[function(t,h,d){const l=t("./under-dash"),i=t("./col-cache");h.exports=class{constructor(o){this.template=o,this.sheets={}}addCell(o){this.addCellEx(i.decodeEx(o))}getCell(o){return this.findCellEx(i.decodeEx(o),!0)}findCell(o){return this.findCellEx(i.decodeEx(o),!1)}findCellAt(o,r,e){const n=this.sheets[o],c=n&&n[r];return c&&c[e]}addCellEx(o){if(o.top)for(let r=o.top;r<=o.bottom;r++)for(let e=o.left;e<=o.right;e++)this.getCellAt(o.sheetName,r,e);else this.findCellEx(o,!0)}getCellEx(o){return this.findCellEx(o,!0)}findCellEx(o,r){const e=this.findSheet(o,r),n=this.findSheetRow(e,o,r);return this.findRowCell(n,o,r)}getCellAt(o,r,e){const n=this.sheets[o]||(this.sheets[o]=[]),c=n[r]||(n[r]=[]);return c[e]||(c[e]={sheetName:o,address:i.n2l(e)+r,row:r,col:e})}removeCellEx(o){const r=this.findSheet(o);if(!r)return;const e=this.findSheetRow(r,o);e&&delete e[o.col]}forEachInSheet(o,r){const e=this.sheets[o];e&&e.forEach((n,c)=>{n&&n.forEach((a,s)=>{a&&r(a,c,s)})})}forEach(o){l.each(this.sheets,(r,e)=>{this.forEachInSheet(e,o)})}map(o){const r=[];return this.forEach(e=>{r.push(o(e))}),r}findSheet(o,r){const e=o.sheetName;return this.sheets[e]?this.sheets[e]:r?this.sheets[e]=[]:void 0}findSheetRow(o,r,e){const{row:n}=r;return o&&o[n]?o[n]:e?o[n]=[]:void 0}findRowCell(o,r,e){const{col:n}=r;return o&&o[n]?o[n]:e?o[n]=this.template?Object.assign(r,JSON.parse(JSON.stringify(this.template))):r:void 0}spliceRows(o,r,e,n){const c=this.sheets[o];if(c){const a=[];for(let s=0;s<n;s++)a.push([]);c.splice(r,e,...a)}}spliceColumns(o,r,e,n){const c=this.sheets[o];if(c){const a=[];for(let s=0;s<n;s++)a.push(null);l.each(c,s=>{s.splice(r,e,...a)})}}}},{"./col-cache":19,"./under-dash":26}],19:[function(t,h,d){const l=/^[A-Z]+\d+$/,i={_dictionary:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_l2nFill:0,_l2n:{},_n2l:[],_level:o=>o<=26?1:o<=676?2:3,_fill(o){let r,e,n,c,a,s=1;if(o>=4)throw new Error("Out of bounds. Excel supports columns from 1 to 16384");if(this._l2nFill<1&&o>=1){for(;s<=26;)r=this._dictionary[s-1],this._n2l[s]=r,this._l2n[r]=s,s++;this._l2nFill=1}if(this._l2nFill<2&&o>=2){for(s=27;s<=702;)e=s-27,n=e%26,c=Math.floor(e/26),r=this._dictionary[c]+this._dictionary[n],this._n2l[s]=r,this._l2n[r]=s,s++;this._l2nFill=2}if(this._l2nFill<3&&o>=3){for(s=703;s<=16384;)e=s-703,n=e%26,c=Math.floor(e/26)%26,a=Math.floor(e/676),r=this._dictionary[a]+this._dictionary[c]+this._dictionary[n],this._n2l[s]=r,this._l2n[r]=s,s++;this._l2nFill=3}},l2n(o){if(this._l2n[o]||this._fill(o.length),!this._l2n[o])throw new Error("Out of bounds. Invalid column letter: "+o);return this._l2n[o]},n2l(o){if(o<1||o>16384)throw new Error(o+" is out of bounds. Excel supports columns from 1 to 16384");return this._n2l[o]||this._fill(this._level(o)),this._n2l[o]},_hash:{},validateAddress(o){if(!l.test(o))throw new Error("Invalid Address: "+o);return!0},decodeAddress(o){const r=o.length<5&&this._hash[o];if(r)return r;let e=!1,n="",c=0,a=!1,s="",f=0;for(let u,g=0;g<o.length;g++)if(u=o.charCodeAt(g),!a&&u>=65&&u<=90)e=!0,n+=o[g],c=26*c+u-64;else if(u>=48&&u<=57)a=!0,s+=o[g],f=10*f+u-48;else if(a&&e&&u!==36)break;if(e){if(c>16384)throw new Error("Out of bounds. Invalid column letter: "+n)}else c=void 0;a||(f=void 0);const p={address:o=n+s,col:c,row:f,$col$row:`$${n}$${s}`};return c<=100&&f<=100&&(this._hash[o]=p,this._hash[p.$col$row]=p),p},getAddress(o,r){if(r){const e=this.n2l(r)+o;return this.decodeAddress(e)}return this.decodeAddress(o)},decode(o){const r=o.split(":");if(r.length===2){const e=this.decodeAddress(r[0]),n=this.decodeAddress(r[1]),c={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col)};return c.tl=this.n2l(c.left)+c.top,c.br=this.n2l(c.right)+c.bottom,c.dimensions=`${c.tl}:${c.br}`,c}return this.decodeAddress(o)},decodeEx(o){const r=o.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),e=r[1]||r[2],n=r[3],c=n.split(":");if(c.length>1){let s=this.decodeAddress(c[0]),f=this.decodeAddress(c[1]);const p=Math.min(s.row,f.row),u=Math.min(s.col,f.col),g=Math.max(s.row,f.row),m=Math.max(s.col,f.col);return s=this.n2l(u)+p,f=this.n2l(m)+g,{top:p,left:u,bottom:g,right:m,sheetName:e,tl:{address:s,col:u,row:p,$col$row:`$${this.n2l(u)}$${p}`,sheetName:e},br:{address:f,col:m,row:g,$col$row:`$${this.n2l(m)}$${g}`,sheetName:e},dimensions:`${s}:${f}`}}if(n.startsWith("#"))return e?{sheetName:e,error:n}:{error:n};const a=this.decodeAddress(n);return e?{sheetName:e,...a}:a},encodeAddress:(o,r)=>i.n2l(r)+o,encode(){switch(arguments.length){case 2:return i.encodeAddress(arguments[0],arguments[1]);case 4:return`${i.encodeAddress(arguments[0],arguments[1])}:${i.encodeAddress(arguments[2],arguments[3])}`;default:throw new Error("Can only encode with 2 or 4 arguments")}},inRange(o,r){const[e,n,,c,a]=o,[s,f]=r;return s>=e&&s<=c&&f>=n&&f<=a}};h.exports=i},{}],20:[function(t,h,d){const l=(o,r)=>({...o,...r.reduce((e,n)=>(o[n]&&(e[n]={...o[n]}),e),{})}),i=function(o,r,e){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];o[e]&&(r[e]=l(o[e],n))};d.copyStyle=o=>{if(!o)return o;if(r=o,Object.keys(r).length===0)return{};var r;const e={...o};return i(o,e,"font",["color"]),i(o,e,"alignment"),i(o,e,"protection"),o.border&&(i(o,e,"border"),i(o.border,e.border,"top",["color"]),i(o.border,e.border,"left",["color"]),i(o.border,e.border,"bottom",["color"]),i(o.border,e.border,"right",["color"]),i(o.border,e.border,"diagonal",["color"])),o.fill&&(i(o,e,"fill",["fgColor","bgColor","center"]),o.fill.stops&&(e.fill.stops=o.fill.stops.map(n=>l(n,["color"])))),e}},{}],21:[function(t,h,d){(function(l){(function(){const i=t("crypto"),o={hash(r){const e=i.createHash(r);for(var n=arguments.length,c=new Array(n>1?n-1:0),a=1;a<n;a++)c[a-1]=arguments[a];return e.update(l.concat(c)),e.digest()},convertPasswordToHash(r,e,n,c){if(e=e.toLowerCase(),i.getHashes().indexOf(e)<0)throw new Error(`Hash algorithm '${e}' not supported!`);const a=l.from(r,"utf16le");let s=this.hash(e,l.from(n,"base64"),a);for(let f=0;f<c;f++){const p=l.alloc(4);p.writeUInt32LE(f,0),s=this.hash(e,s,p)}return s.toString("base64")},randomBytes:r=>i.randomBytes(r)};h.exports=o}).call(this)}).call(this,t("buffer").Buffer)},{buffer:220,crypto:390}],22:[function(t,h,d){const{SaxesParser:l}=t("saxes"),{PassThrough:i}=t("readable-stream"),{bufferToString:o}=t("./browser-buffer-decode");h.exports=async function*(r){r.pipe&&!r[Symbol.asyncIterator]&&(r=r.pipe(new i));const e=new l;let n;e.on("error",a=>{n=a});let c=[];e.on("opentag",a=>c.push({eventType:"opentag",value:a})),e.on("text",a=>c.push({eventType:"text",value:a})),e.on("closetag",a=>c.push({eventType:"closetag",value:a}));for await(const a of r){if(e.write(o(a)),n)throw n;yield c,c=[]}}},{"./browser-buffer-decode":16,"readable-stream":491,saxes:496}],23:[function(t,h,d){const l=t("./col-cache"),i=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,o=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;h.exports={slideFormula:function(r,e,n){const c=l.decode(e),a=l.decode(n);return r.replace(i,(s,f,p,u,g)=>{if(g)return s;const m=o.exec(u);if(m){const v=m[1],S=m[2].toUpperCase(),R=m[3],I=m[4];if(S.length>3||S.length===3&&S>"XFD")return s;let F=l.l2n(S),j=parseInt(I,10);return v||(F+=a.col-c.col),R||(j+=a.row-c.row),(f||"")+(v||"")+l.n2l(F)+(R||"")+j}return s})}}},{"./col-cache":19}],24:[function(t,h,d){(function(l,i){(function(){const o=t("readable-stream"),r=t("./utils"),e=t("./string-buf");class n{constructor(u,g){this._data=u,this._encoding=g}get length(){return this.toBuffer().length}copy(u,g,m,v){return this.toBuffer().copy(u,g,m,v)}toBuffer(){return this._buffer||(this._buffer=i.from(this._data,this._encoding)),this._buffer}}class c{constructor(u){this._data=u}get length(){return this._data.length}copy(u,g,m,v){return this._data._buf.copy(u,g,m,v)}toBuffer(){return this._data.toBuffer()}}class a{constructor(u){this._data=u}get length(){return this._data.length}copy(u,g,m,v){this._data.copy(u,g,m,v)}toBuffer(){return this._data}}class s{constructor(u){this.size=u,this.buffer=i.alloc(u),this.iRead=0,this.iWrite=0}toBuffer(){if(this.iRead===0&&this.iWrite===this.size)return this.buffer;const u=i.alloc(this.iWrite-this.iRead);return this.buffer.copy(u,0,this.iRead,this.iWrite),u}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(u){let g;return u===0?null:u===void 0||u>=this.length?(g=this.toBuffer(),this.iRead=this.iWrite,g):(g=i.alloc(u),this.buffer.copy(g,0,this.iRead,u),this.iRead+=u,g)}write(u,g,m){const v=Math.min(m,this.size-this.iWrite);return u.copy(this.buffer,this.iWrite,g,g+v),this.iWrite+=v,v}}const f=function(p){p=p||{},this.bufSize=p.bufSize||1048576,this.buffers=[],this.batch=p.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};r.inherits(f,o.Duplex,{toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return i.concat(this.buffers.map(p=>p.toBuffer()))}},_getWritableBuffer(){if(this.buffers.length){const u=this.buffers[this.buffers.length-1];if(!u.full)return u}const p=new s(this.bufSize);return this.buffers.push(p),p},async _pipe(p){await Promise.all(this.pipes.map(function(u){return new Promise(g=>{u.write(p.toBuffer(),()=>{g()})})}))},_writeToBuffers(p){let u=0;const g=p.length;for(;u<g;)u+=this._getWritableBuffer().write(p,u,g-u)},async write(p,u,g){let m;if(u instanceof Function&&(g=u,u="utf8"),g=g||r.nop,p instanceof e)m=new c(p);else if(p instanceof i)m=new a(p);else{if(!(typeof p=="string"||p instanceof String||p instanceof ArrayBuffer))throw new Error("Chunk must be one of type String, Buffer or StringBuf.");m=new n(p,u)}if(this.pipes.length)if(this.batch)for(this._writeToBuffers(m);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(m),l.nextTick(g)):(await this._pipe(m),g());else this.paused||this.emit("data",m.toBuffer()),this._writeToBuffers(m),this.emit("readable");return!0},cork(){this.corked=!0},_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork(){this.corked=!1,this._flush()},end(p,u,g){const m=v=>{v?g(v):(this._flush(),this.pipes.forEach(S=>{S.end()}),this.emit("finish"))};p?this.write(p,u,m):m()},read(p){let u;if(p){for(u=[];p&&this.buffers.length&&!this.buffers[0].eod;){const g=this.buffers[0],m=g.read(p);p-=m.length,u.push(m),g.eod&&g.full&&this.buffers.shift()}return i.concat(u)}return u=this.buffers.map(g=>g.toBuffer()).filter(Boolean),this.buffers=[],i.concat(u)},setEncoding(p){this.encoding=p},pause(){this.paused=!0},resume(){this.paused=!1},isPaused(){return!!this.paused},pipe(p){this.pipes.push(p),!this.paused&&this.buffers.length&&this.end()},unpipe(p){this.pipes=this.pipes.filter(u=>u!==p)},unshift(){throw new Error("Not Implemented")},wrap(){throw new Error("Not Implemented")}}),h.exports=f}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{"./string-buf":25,"./utils":27,_process:467,buffer:220,"readable-stream":491}],25:[function(t,h,d){(function(l){(function(){h.exports=class{constructor(i){this._buf=l.alloc(i&&i.size||16384),this._encoding=i&&i.encoding||"utf8",this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||(this._buffer=l.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer}reset(i){i=i||0,this._buffer=void 0,this._inPos=i}_grow(i){let o=2*this._buf.length;for(;o<i;)o*=2;const r=l.alloc(o);this._buf.copy(r,0),this._buf=r}addText(i){this._buffer=void 0;let o=this._inPos+this._buf.write(i,this._inPos,this._encoding);for(;o>=this._buf.length-4;)this._grow(this._inPos+i.length),o=this._inPos+this._buf.write(i,this._inPos,this._encoding);this._inPos=o}addStringBuf(i){i.length&&(this._buffer=void 0,this.length+i.length>this.capacity&&this._grow(this.length+i.length),i._buf.copy(this._buf,this._inPos,0,i.length),this._inPos+=i.length)}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:220}],26:[function(t,h,d){const{toString:l}=Object.prototype,i=/["&<>]/,o={each:function(r,e){r&&(Array.isArray(r)?r.forEach(e):Object.keys(r).forEach(n=>{e(r[n],n)}))},some:function(r,e){return!!r&&(Array.isArray(r)?r.some(e):Object.keys(r).some(n=>e(r[n],n)))},every:function(r,e){return!r||(Array.isArray(r)?r.every(e):Object.keys(r).every(n=>e(r[n],n)))},map:function(r,e){return r?Array.isArray(r)?r.map(e):Object.keys(r).map(n=>e(r[n],n)):[]},keyBy:(r,e)=>r.reduce((n,c)=>(n[c[e]]=c,n),{}),isEqual:function(r,e){const n=typeof r,c=typeof e,a=Array.isArray(r),s=Array.isArray(e);let f;if(n!==c)return!1;switch(typeof r){case"object":if(a||s)return!(!a||!s)&&r.length===e.length&&r.every((p,u)=>{const g=e[u];return o.isEqual(p,g)});if(r===null||e===null)return r===e;if(f=Object.keys(r),Object.keys(e).length!==f.length)return!1;for(const p of f)if(!e.hasOwnProperty(p))return!1;return o.every(r,(p,u)=>{const g=e[u];return o.isEqual(p,g)});default:return r===e}},escapeHtml(r){const e=i.exec(r);if(!e)return r;let n="",c="",a=0,s=e.index;for(;s<r.length;s++){switch(r.charAt(s)){case'"':c="&quot;";break;case"&":c="&amp;";break;case"'":c="&apos;";break;case"<":c="&lt;";break;case">":c="&gt;";break;default:continue}a!==s&&(n+=r.substring(a,s)),a=s+1,n+=c}return a!==s?n+r.substring(a,s):n},strcmp:(r,e)=>r<e?-1:r>e?1:0,isUndefined:r=>l.call(r)==="[object Undefined]",isObject:r=>l.call(r)==="[object Object]",deepMerge(){const r=arguments[0]||{},{length:e}=arguments;let n,c,a;function s(f,p){n=r[p],a=Array.isArray(f),o.isObject(f)||a?(a?(a=!1,c=n&&Array.isArray(n)?n:[]):c=n&&o.isObject(n)?n:{},r[p]=o.deepMerge(c,f)):o.isUndefined(f)||(r[p]=f)}for(let f=0;f<e;f++)o.each(arguments[f],s);return r}};h.exports=o},{}],27:[function(t,h,d){(function(l,i){(function(){const o=t("fs"),r=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/,e={nop(){},promiseImmediate:n=>new Promise(c=>{l.setImmediate?i(()=>{c(n)}):setTimeout(()=>{c(n)},1)}),inherits:function(n,c,a,s){n.super_=c,s||(s=a,a=null),a&&Object.keys(a).forEach(p=>{Object.defineProperty(n,p,Object.getOwnPropertyDescriptor(a,p))});const f={constructor:{value:n,enumerable:!1,writable:!1,configurable:!0}};s&&Object.keys(s).forEach(p=>{f[p]=Object.getOwnPropertyDescriptor(s,p)}),n.prototype=Object.create(c.prototype,f)},dateToExcel:(n,c)=>25569+n.getTime()/864e5-(c?1462:0),excelToDate(n,c){const a=Math.round(24*(n-25569+(c?1462:0))*3600*1e3);return new Date(a)},parsePath(n){const c=n.lastIndexOf("/");return{path:n.substring(0,c),name:n.substring(c+1)}},getRelsPath(n){const c=e.parsePath(n);return`${c.path}/_rels/${c.name}.rels`},xmlEncode(n){const c=r.exec(n);if(!c)return n;let a="",s="",f=0,p=c.index;for(;p<n.length;p++){const u=n.charCodeAt(p);switch(u){case 34:s="&quot;";break;case 38:s="&amp;";break;case 39:s="&apos;";break;case 60:s="&lt;";break;case 62:s="&gt;";break;case 127:s="";break;default:if(u<=31&&(u<=8||u>=11&&u!==13)){s="";break}continue}f!==p&&(a+=n.substring(f,p)),f=p+1,s&&(a+=s)}return f!==p?a+n.substring(f,p):a},xmlDecode:n=>n.replace(/&([a-z]*);/g,c=>{switch(c){case"&lt;":return"<";case"&gt;":return">";case"&amp;":return"&";case"&apos;":return"'";case"&quot;":return'"';default:return c}}),validInt(n){const c=parseInt(n,10);return Number.isNaN(c)?0:c},isDateFmt(n){return n?(n=(n=n.replace(/\[[^\]]*]/g,"")).replace(/"[^"]*"/g,"")).match(/[ymdhMsb]+/)!==null:!1},fs:{exists:n=>new Promise(c=>{o.access(n,o.constants.F_OK,a=>{c(!a)})})},toIsoDateString:n=>n.toIsoString().subsstr(0,10),parseBoolean:n=>n===!0||n==="true"||n===1||n==="1"};h.exports=e}).call(this)}).call(this,typeof ie<"u"?ie:typeof self<"u"?self:typeof window<"u"?window:{},t("timers").setImmediate)},{fs:216,timers:523}],28:[function(t,h,d){const l=t("./under-dash"),i=t("./utils");function o(n,c,a){n.push(` ${c}="${i.xmlEncode(a.toString())}"`)}function r(n,c){if(c){const a=[];l.each(c,(s,f)=>{s!==void 0&&o(a,f,s)}),n.push(a.join(""))}}class e{constructor(){this._xml=[],this._stack=[],this._rollbacks=[]}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._xml.length}openXml(c){const a=this._xml;a.push("<?xml"),r(a,c),a.push(`?>
18
+ `).trim();(a||e||n)&&h.push({start:e,end:n,text:a})}return h.sort((d,l)=>d.start-l.start),{format:"ttml",cues:h}}function Au(C,w){switch(w??Eu(C)){case"lrc":return Cu(C);case"elrc":return Tu(C);case"ass":return Sa(C,"ass");case"ssa":return Sa(C,"ssa");case"ttml":return Mu(C);case"vtt":return xa(C,"vtt");case"srt":default:return xa(C,"srt")}}async function Ru(C){return lu.loadAsync(C)}function Nu(C){const w=[];return C.forEach((t,h)=>{var d;const l=h.dir,i=l&&!t.endsWith("/")?t+"/":t,o=l?i.replace(/\/$/,""):i,r=o.lastIndexOf("/"),e=r>=0?o.slice(r+1):o,n=r>=0?o.slice(0,r):"",c=l?0:((d=h._data)==null?void 0:d.uncompressedSize)??0;w.push({path:i,name:e,dir:n,isDir:l,size:c,date:h.date})}),w}function Ou(C){const w={name:"",path:"",isDir:!0,children:[],size:0},t=new Map;t.set("",w);const h=l=>{if(t.has(l))return t.get(l);const i=l.split("/").filter(Boolean);let o=w,r="";for(const e of i){r=r?`${r}/${e}`:e;let n=t.get(r);n||(n={name:e,path:r+"/",isDir:!0,children:[],size:0},o.children.push(n),t.set(r,n)),o=n}return o};for(const l of C){if(l.isDir){h(l.path.replace(/\/$/,""));continue}h(l.dir).children.push({name:l.name,path:l.path,isDir:!1,size:l.size})}const d=l=>{if(l.children){l.children.sort((i,o)=>i.isDir!==o.isDir?i.isDir?-1:1:i.name.localeCompare(o.name));for(const i of l.children)d(i)}};return d(w),w}async function ju(C,w,t){const h=C.file(w);if(!h)throw new Error(`ZIP entry not found: ${w}`);const d=await h.async("arraybuffer");return new Blob([d],t?{type:t}:void 0)}function Iu(C){return C?C.startsWith("#")?C:C.length===8?"#"+C.substring(2):C.length===6?"#"+C:"#000000":"#000000"}const Bu=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],Pu=["000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","000000","FFFFFF","FF0000","00FF00","0000FF","FFFF00","FF00FF","00FFFF","800000","008000","000080","808000","800080","008080","C0C0C0","808080","9999FF","993366","FFFFCC","CCFFFF","660066","FF8080","0066CC","CCCCFF","000080","FF00FF","FFFF00","00FFFF","800080","800000","008080","0000FF","00CCFF","CCFFFF","CCFFCC","FFFF99","99CCFF","FF99CC","CC99FF","FFCC99","3366FF","33CCCC","99CC00","FFCC00","FF9900","FF6600","666699","969696","003366","339966","003300","333300","993300","993366","333399","333333"];function Fu(C,w){const t=parseInt(C.substring(0,2),16),h=parseInt(C.substring(2,4),16),d=parseInt(C.substring(4,6),16),l=e=>w<0?Math.round(e*(1+w)):Math.round(e+(255-e)*w),i=Math.min(255,Math.max(0,l(t))),o=Math.min(255,Math.max(0,l(h))),r=Math.min(255,Math.max(0,l(d)));return i.toString(16).padStart(2,"0")+o.toString(16).padStart(2,"0")+r.toString(16).padStart(2,"0")}function Du(C){if(C&&C.type==="pattern"&&C.pattern==="solid"){const w=C.fgColor;if(w)return sa(w)}}function sa(C){if(C){if("argb"in C&&typeof C.argb=="string"&&C.argb)return Iu(C.argb);if("theme"in C&&typeof C.theme=="number"){const w=Bu[C.theme]||"000000",t="tint"in C&&typeof C.tint=="number"?C.tint:0;return"#"+(t!==0?Fu(w,t):w)}if("indexed"in C&&typeof C.indexed=="number"){const w=Pu[C.indexed];if(w)return"#"+w}}}function Lu(C){if(!C||!C.style)return;const w=sa(C.color)||"#000000";return[C.style,w]}function zu(C){const w={};let t=!1;if(C.font){const d=C.font;if((d.name||d.size||d.bold||d.italic)&&(t=!0,w.font={},d.name&&(w.font.name=d.name),d.size&&(w.font.size=d.size),d.bold&&(w.font.bold=!0),d.italic&&(w.font.italic=!0)),d.color){const l=sa(d.color);l&&(t=!0,w.color=l)}d.underline&&(t=!0,w.underline=!0),d.strike&&(t=!0,w.strike=!0)}const h=Du(C.fill);if(h&&(t=!0,w.bgcolor=h),C.alignment){const d=C.alignment;d.horizontal&&(t=!0,w.align=d.horizontal),d.vertical&&(t=!0,w.valign=d.vertical),d.wrapText&&(t=!0,w.textwrap=!0)}if(C.border){const d={};let l=!1;const i=["top","bottom","left","right"];for(const o of i){const r=Lu(C.border[o]);r&&(d[o]=r,l=!0)}l&&(t=!0,w.border=d)}return t?w:null}function $u(C){return JSON.stringify(C)}function Vu(C,w,t){const h=zu(C);if(!h)return-1;const d=$u(h),l=t.get(d);if(l!==void 0)return l;const i=w.length;return w.push(h),t.set(d,i),i}function Uu(C){const w=C.value;if(w==null)return"";if(typeof w=="string")return w;if(typeof w=="number")return String(w);if(typeof w=="boolean")return w?"TRUE":"FALSE";if(w instanceof Date)return w.toLocaleDateString();if(typeof w=="object"&&"formula"in w){const t=w.result;return t!=null?String(t):""}return typeof w=="object"&&"richText"in w?w.richText.map(t=>t.text).join(""):typeof w=="object"&&"hyperlink"in w?w.text||"":typeof w=="object"&&"error"in w?String(w.error):String(w)}function Hu(C){const w=C.split(":"),t=Ea(w[0]),h=w[1]?Ea(w[1]):t;return{top:t.row,left:t.col,bottom:h.row,right:h.col}}function Ea(C){const w=C.match(/^([A-Z]+)(\d+)$/);if(!w)return{row:1,col:1};const t=w[1],h=parseInt(w[2],10);let d=0;for(let l=0;l<t.length;l++)d=d*26+(t.charCodeAt(l)-64);return{row:h,col:d}}function Wu(C){const w=[];return C.eachSheet(t=>{const h=[],d=new Map,l=[],i={},o={},r=t.columnCount;for(let a=1;a<=r;a++){const s=t.getColumn(a);s.width&&(o[String(a-1)]={width:Math.round(s.width*7.5)})}o.len=Math.max(r,26);const e=new Map,n=t.model,c=(n==null?void 0:n.merges)||[];for(const a of c){l.push(a);const{top:s,left:f,bottom:p,right:u}=Hu(a),g=p-s,m=u-f;e.set(`${s-1},${f-1}`,[g,m])}t.eachRow({includeEmpty:!0},(a,s)=>{const f=s-1,p={};a.eachCell({includeEmpty:!1},(g,m)=>{const v=m-1;if(g.isMerged&&g.master!==g)return;const S=Uu(g),R=Vu(g,h,d),I={text:S};R!==-1&&(I.style=R);const F=`${f},${v}`;e.has(F)&&(I.merge=e.get(F)),p[String(v)]=I});const u={cells:p};a.height&&(u.height=Math.round(a.height*1.333)),i[String(f)]=u}),w.push({name:t.name,styles:h,merges:l,rows:i,cols:o})}),w}function qu(C,w,t="Sheet1"){const h=C.length>0,d=h?[{font:{bold:!0}}]:[],l={};if(h){const o={};C.forEach((r,e)=>{o[String(e)]={text:r,style:0}}),l[0]={cells:o}}const i=h?1:0;return w.forEach((o,r)=>{const e={};o.forEach((n,c)=>{n!==void 0&&n!==""&&(e[String(c)]={text:n})}),l[String(r+i)]={cells:e}}),[{name:t,styles:d,rows:l}]}function Ol(C,w){var t;if(typeof window>"u")return;const h=(C==null?void 0:C.version)||((t=C==null?void 0:C.GlobalWorkerOptions)==null?void 0:t.version)||"",{workerSrc:d=`https://unpkg.com/pdfjs-dist@${h}/build/pdf.worker.min.mjs`,cMapUrl:l=`https://unpkg.com/pdfjs-dist@${h}/cmaps/`,cMapPacked:i=!0}=w||{};C.GlobalWorkerOptions&&(C.GlobalWorkerOptions.workerSrc=d,C.GlobalWorkerOptions.cMapUrl=l,C.GlobalWorkerOptions.cMapPacked=i)}const Xu={"common.download":"下载","common.close":"关闭","common.loading":"加载中","common.unknown_error":"未知错误","common.unsupported_preview":"不支持预览此文件类型 ({type})","toolbar.zoom_in":"放大","toolbar.zoom_out":"缩小","toolbar.rotate_left":"向左旋转","toolbar.rotate_right":"向右旋转","toolbar.reset":"复原","toolbar.fit_to_window":"适应窗口","toolbar.original_size":"原始尺寸","toolbar.toc":"目录","toolbar.prev_page":"上一页","toolbar.next_page":"下一页","toolbar.full_width":"全屏宽度","toolbar.normal_width":"正常宽度","toolbar.wrap_on":"自动换行","toolbar.wrap_off":"不换行","toolbar.source":"源码","toolbar.preview":"预览","image.load_failed":"图片加载失败","pdf.load_failed":"PDF 文件加载失败","docx.parse_failed":"Word 文档解析失败","xlsx.loading":"加载 Excel 中...","xlsx.load_failed":"Excel 加载失败","xlsx.parse_failed":"Excel 文件解析失败","xlsx.not_found":"Excel 文件不存在","pptx.loading":"加载 PPT 中...","pptx.load_failed":"PPT 加载失败","pptx.parse_failed":"PPT 文件解析失败","pptx.not_found":"PPT 文件不存在","pptx.invalid_format":"PPT 文件格式错误或已损坏","pptx.no_pages":"PPT 文件无有效页面","pptx.timeout":"加载超时,请检查网络或稍后重试","msg.parse_failed":"Outlook 邮件解析失败","msg.parse_failed_short":"邮件解析失败","msg.empty_body":"(无邮件正文)","epub.load_failed":"EPUB 文件加载失败","mobi.load_failed":"电子书加载失败,文件可能已损坏或带有 DRM 保护","video.loading":"加载视频中...","video.load_failed":"视频加载失败","video.load_failed_with_error":"视频加载失败: {error}","audio.aria.play":"播放","audio.aria.pause":"暂停","audio.aria.forward_10":"前进 10 秒","audio.aria.backward_10":"后退 10 秒","audio.aria.mute":"静音","audio.aria.unmute":"取消静音","audio.aria.loop_on":"开启循环","audio.aria.loop_off":"关闭循环","audio.aria.progress":"播放进度","audio.aria.volume":"音量","markdown.load_failed":"Markdown 文件加载失败","markdown.copy_code":"复制代码","markdown.copied":"已复制","json.load_failed":"JSON 文件加载失败","json.items":"items","json.keys":"keys","csv.loading":"加载 CSV 中...","csv.load_failed":"CSV 文件加载失败","csv.parse_failed":"CSV 解析失败","xml.load_failed":"XML 文件加载失败","subtitle.load_failed":"字幕文件加载失败","subtitle.parse_failed":"字幕解析失败","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"标题","subtitle.meta.artist":"艺术家","subtitle.meta.album":"专辑","subtitle.meta.author":"作者","subtitle.meta.by":"制作","subtitle.meta.length":"时长","subtitle.meta.offset":"偏移","subtitle.meta.editor":"编辑器","subtitle.meta.version":"版本","zip.load_failed":"ZIP 文件加载失败","zip.parse_failed":"ZIP 解析失败","text.load_failed":"文本文件加载失败"},Zu={"common.download":"Download","common.close":"Close","common.loading":"Loading","common.unknown_error":"Unknown error","common.unsupported_preview":"Preview not supported for this file type ({type})","toolbar.zoom_in":"Zoom in","toolbar.zoom_out":"Zoom out","toolbar.rotate_left":"Rotate left","toolbar.rotate_right":"Rotate right","toolbar.reset":"Reset","toolbar.fit_to_window":"Fit to window","toolbar.original_size":"Original size","toolbar.toc":"Table of contents","toolbar.prev_page":"Previous page","toolbar.next_page":"Next page","toolbar.full_width":"Full width","toolbar.normal_width":"Normal width","toolbar.wrap_on":"Word wrap","toolbar.wrap_off":"No wrap","toolbar.source":"Source","toolbar.preview":"Preview","image.load_failed":"Failed to load image","pdf.load_failed":"Failed to load PDF","docx.parse_failed":"Failed to parse Word document","xlsx.loading":"Loading Excel...","xlsx.load_failed":"Failed to load Excel","xlsx.parse_failed":"Failed to parse Excel file","xlsx.not_found":"Excel file not found","pptx.loading":"Loading PPT...","pptx.load_failed":"Failed to load PPT","pptx.parse_failed":"Failed to parse PPT file","pptx.not_found":"PPT file not found","pptx.invalid_format":"PPT file format is invalid or corrupted","pptx.no_pages":"PPT file has no valid pages","pptx.timeout":"Loading timed out, please check your network and retry","msg.parse_failed":"Failed to parse Outlook message","msg.parse_failed_short":"Failed to parse message","msg.empty_body":"(No message body)","epub.load_failed":"Failed to load EPUB","mobi.load_failed":"Failed to load ebook — file may be corrupted or DRM-protected","video.loading":"Loading video...","video.load_failed":"Failed to load video","video.load_failed_with_error":"Failed to load video: {error}","audio.aria.play":"Play","audio.aria.pause":"Pause","audio.aria.forward_10":"Forward 10 seconds","audio.aria.backward_10":"Back 10 seconds","audio.aria.mute":"Mute","audio.aria.unmute":"Unmute","audio.aria.loop_on":"Enable loop","audio.aria.loop_off":"Disable loop","audio.aria.progress":"Playback progress","audio.aria.volume":"Volume","markdown.load_failed":"Failed to load Markdown","markdown.copy_code":"Copy code","markdown.copied":"Copied","json.load_failed":"Failed to load JSON","json.items":"items","json.keys":"keys","csv.loading":"Loading CSV...","csv.load_failed":"Failed to load CSV","csv.parse_failed":"Failed to parse CSV","xml.load_failed":"Failed to load XML","subtitle.load_failed":"Failed to load subtitle","subtitle.parse_failed":"Failed to parse subtitle","subtitle.lines":"lines","subtitle.cues":"cues","subtitle.meta.title":"Title","subtitle.meta.artist":"Artist","subtitle.meta.album":"Album","subtitle.meta.author":"Author","subtitle.meta.by":"By","subtitle.meta.length":"Length","subtitle.meta.offset":"Offset","subtitle.meta.editor":"Editor","subtitle.meta.version":"Version","zip.load_failed":"Failed to load ZIP","zip.parse_failed":"Failed to parse ZIP","text.load_failed":"Failed to load text file"},xs={"zh-CN":Xu,"en-US":Zu},Gu=/\{(\w+)\}/g;function Ku(C,w){return w?C.replace(Gu,(t,h)=>{const d=w[h];return d===void 0?`{${h}}`:String(d)}):C}function oa(C){var w;const t=C.fallbackLocale??"zh-CN",h=xs[C.locale]??xs[t]??xs["zh-CN"],d=(w=C.messages)==null?void 0:w[C.locale],l=d?{...h,...d}:h,i=xs["zh-CN"];return(o,r)=>{const e=l[o]??i[o]??o;return Ku(e,r)}}const ao=Symbol("file-preview-locale");function jl(C,w){const t=T.computed(()=>T.unref(C)??"zh-CN"),h=T.computed(()=>oa({locale:t.value,messages:T.unref(w)}));T.provide(ao,{locale:t,t:h})}let bo=null;function Yu(){return bo||(bo=oa({locale:"zh-CN"})),bo}function Te(){const C=T.inject(ao,null);if(C)return C;const w=T.computed(()=>"zh-CN"),t=T.computed(()=>Yu());return{locale:w,t}}const Ju=(C,{attrs:w})=>T.h("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...w},[T.h("text",{x:"12",y:"17.5","text-anchor":"middle","font-size":"20","font-weight":"bold",fill:"currentColor",stroke:"none"},"1:1")]);function Qu(C){return[{items:[{type:"button",icon:Ot.ZoomOut,tooltip:C.t("toolbar.zoom_out"),action:C.onZoomOut,disabled:C.zoom<=.01},{type:"text",content:`${Math.round(C.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:Ot.ZoomIn,tooltip:C.t("toolbar.zoom_in"),action:C.onZoomIn,disabled:C.zoom>=10}]},{items:[{type:"button",icon:Ot.Scan,tooltip:C.t("toolbar.fit_to_window"),action:C.onFitToWidth},{type:"button",icon:Ju,tooltip:C.t("toolbar.original_size"),action:C.onOriginalSize}]},{items:[{type:"button",icon:Ot.RotateCcw,tooltip:C.t("toolbar.rotate_left"),action:C.onRotateLeft},{type:"button",icon:Ot.RotateCw,tooltip:C.t("toolbar.rotate_right"),action:C.onRotateRight}]},{items:[{type:"button",icon:Ot.RefreshCw,tooltip:C.t("toolbar.reset"),action:C.onReset}]}]}function tf(C){return[{items:[{type:"button",icon:Ot.ZoomOut,tooltip:C.t("toolbar.zoom_out"),action:C.onZoomOut,disabled:C.zoom<=.01},{type:"text",content:`${Math.round(C.zoom*100)}%`,minWidth:"3rem"},{type:"button",icon:Ot.ZoomIn,tooltip:C.t("toolbar.zoom_in"),action:C.onZoomIn,disabled:C.zoom>=10}]},{items:[{type:"button",icon:Ot.RefreshCw,tooltip:C.t("toolbar.reset"),action:C.onReset}]}]}function ef(C){return[{items:[{type:"button",icon:Ot.List,tooltip:C.t("toolbar.toc"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.toggleToc()}}]},{items:[{type:"button",icon:Ot.ChevronLeft,tooltip:C.t("toolbar.prev_page"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.prevPage()}},{type:"text",content:`${C.current} / ${C.total}`,minWidth:"4rem"},{type:"button",icon:Ot.ChevronRight,tooltip:C.t("toolbar.next_page"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.nextPage()}}]},{items:[{type:"button",icon:C.fullWidth?Ot.Minimize2:Ot.Maximize2,tooltip:C.fullWidth?C.t("toolbar.normal_width"):C.t("toolbar.full_width"),action:()=>{var w;return(w=C.epubRef)==null?void 0:w.toggleFullWidth()}}]}]}function rf(C){return[{items:[{type:"button",icon:Ot.List,tooltip:C.t("toolbar.toc"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.toggleToc()}}]},{items:[{type:"button",icon:Ot.ChevronLeft,tooltip:C.t("toolbar.prev_page"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.prevPage()}},{type:"text",content:`${C.current} / ${C.total}`,minWidth:"4rem"},{type:"button",icon:Ot.ChevronRight,tooltip:C.t("toolbar.next_page"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.nextPage()}}]},{items:[{type:"button",icon:C.fullWidth?Ot.Minimize2:Ot.Maximize2,tooltip:C.fullWidth?C.t("toolbar.normal_width"):C.t("toolbar.full_width"),action:()=>{var w;return(w=C.mobiRef)==null?void 0:w.toggleFullWidth()}}]}]}function nf({stats:C}){return C?[{items:[{type:"text",content:`${C.files} files · ${C.dirs} dirs · ${ia(C.size)}`,minWidth:"10rem"}]}]:[]}function sf(C){const w=[{items:[{type:"button",icon:T.h(Ot.WrapText,{class:"vfp-w-4 vfp-h-4"}),tooltip:C.wordWrap?C.t("toolbar.wrap_off"):C.t("toolbar.wrap_on"),action:C.onToggleWrap}]}];return C.isHtml&&w.push({items:[{type:"button",icon:C.htmlPreview?T.h(Ot.Code,{class:"vfp-w-4 vfp-h-4"}):T.h(Ot.Eye,{class:"vfp-w-4 vfp-h-4"}),tooltip:C.htmlPreview?C.t("toolbar.source"):C.t("toolbar.preview"),action:C.onToggleHtmlPreview}]}),w}const of={key:0,class:"vfp-flex vfp-items-center vfp-justify-center"},af={key:1,class:"vfp-text-white/70 vfp-text-center"},lf={class:"vfp-text-lg"},cf=["src"],uf={key:2,class:"vfp-absolute vfp-bottom-2 vfp-right-3 vfp-text-[10px] vfp-text-white/30 hover:vfp-text-white/80 vfp-transition-colors vfp-pointer-events-auto vfp-select-none vfp-cursor-default"},ff=T.defineComponent({__name:"index",props:{url:{},zoom:{},rotation:{},resetKey:{},fileSize:{}},emits:["zoomChange","naturalWidthChange","naturalHeightChange"],setup(C,{emit:w}){const t=C,h=w,{t:d}=Te(),l=T.ref(!1),i=T.ref(null),o=T.ref({x:0,y:0}),r=T.ref(!1);let e={x:0,y:0};const n=T.ref(1),c=T.ref({width:0,height:0}),a=T.ref(null),s=T.ref(null);T.watch(()=>t.url,()=>{l.value=!1,i.value=null,o.value={x:0,y:0},n.value=1}),T.watch(()=>t.zoom,j=>{n.value=j}),T.watch(()=>t.resetKey,()=>{o.value={x:0,y:0}});const f=(j,L)=>{const $=s.value;if(!$||c.value.width===0)return j;const V=$.clientWidth,z=$.clientHeight,E=c.value.width*L,A=c.value.height*L,k=Math.min(80,V*.15,z*.15),b=(V+E)/2-k,y=(z+A)/2-k;return{x:b>0?Math.max(-b,Math.min(b,j.x)):0,y:y>0?Math.max(-y,Math.min(y,j.y)):0}},p=j=>{l.value=!0;const L=j.currentTarget;c.value={width:L.naturalWidth,height:L.naturalHeight},h("naturalWidthChange",L.naturalWidth),h("naturalHeightChange",L.naturalHeight)},u=()=>{i.value=d.value("image.load_failed"),l.value=!0},g=()=>{o.value={x:0,y:0},n.value=1,h("zoomChange",1)},m=j=>{j.preventDefault(),j.stopPropagation();const L=s.value;if(!L)return;const $=L.getBoundingClientRect(),V=j.clientX-$.left-$.width/2,z=j.clientY-$.top-$.height/2,E=j.deltaY>0?-.05:.05,A=n.value,k=Math.max(.01,Math.min(10,A+E)),b=k/A;o.value=f({x:V-b*(V-o.value.x),y:z-b*(z-o.value.y)},k),n.value=k,h("zoomChange",k)};T.onMounted(()=>{const j=s.value;j&&j.addEventListener("wheel",m,{passive:!1})}),T.onBeforeUnmount(()=>{const j=s.value;j&&j.removeEventListener("wheel",m)});const v=j=>{j.button===0&&(r.value=!0,e={x:j.clientX-o.value.x,y:j.clientY-o.value.y})},S=j=>{r.value&&(o.value=f({x:j.clientX-e.x,y:j.clientY-e.y},n.value))},R=()=>{r.value=!1},I=T.computed(()=>({transform:`translate(${o.value.x}px, ${o.value.y}px) scale(${n.value}) rotate(${t.rotation}deg)`,transformOrigin:"center",transition:r.value?"none":"transform 0.3s ease-out",opacity:l.value?1:0})),F=T.computed(()=>t.fileSize==null?"":` · ${ia(t.fileSize)}`);return(j,L)=>(T.openBlock(),T.createElementBlock("div",{ref_key:"containerRef",ref:s,class:"vfp-relative vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-overflow-hidden",style:T.normalizeStyle({cursor:r.value?"grabbing":"grab"}),onMousedown:v,onMousemove:S,onMouseup:R,onMouseleave:R},[!l.value&&!i.value?(T.openBlock(),T.createElementBlock("div",of,[...L[0]||(L[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),i.value?(T.openBlock(),T.createElementBlock("div",af,[T.createElementVNode("p",lf,T.toDisplayString(i.value),1)])):T.createCommentVNode("",!0),T.createElementVNode("img",{ref_key:"imgRef",ref:a,src:C.url,alt:"Preview",class:T.normalizeClass(["vfp-max-w-none vfp-select-none",!l.value&&"vfp-hidden"]),style:T.normalizeStyle(I.value),draggable:!1,onLoad:p,onError:u,onDblclick:g},null,46,cf),l.value&&!i.value&&c.value.width>0?(T.openBlock(),T.createElementBlock("div",uf,T.toDisplayString(c.value.width)+" × "+T.toDisplayString(c.value.height)+T.toDisplayString(F.value),1)):T.createCommentVNode("",!0)],36))}}),hf={key:0,class:"vfp-text-white/70 vfp-text-center"},df={class:"vfp-text-lg"},pf={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-min-h-screen"},mf={class:"pdf-pages vfp-flex vfp-flex-col vfp-gap-4"},gf={key:2,class:"vfp-sticky vfp-bottom-2 md:vfp-bottom-4 vfp-mt-4 md:vfp-mt-8 vfp-bg-black/60 vfp-backdrop-blur-xl vfp-text-white vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-rounded-full vfp-text-xs md:vfp-text-sm vfp-font-medium vfp-shadow-2xl vfp-border vfp-border-white/10"},bf=T.defineComponent({__name:"index",props:{url:{},zoom:{},currentPage:{}},emits:["pageChange","totalPagesChange","pageWidthChange"],setup(C,{emit:w}){Ol(va);const t=C,h=w,{t:d}=Te(),l=T.ref(0),i=T.ref(null),o=T.ref(null);let r=null;const e=[],n=async(f,p,u)=>{if(!r)return;const g=await r.getPage(f),m=g.getViewport({scale:p}),v=document.createElement("canvas");v.width=m.width,v.height=m.height,v.style.maxWidth="100%",v.style.height="auto",v.style.borderRadius="0",v.style.display="block",v.style.boxShadow="0 25px 50px -12px rgba(0,0,0,0.25)",v.style.filter="brightness(0.95) contrast(1.05)";const S=v.getContext("2d");if(!S)return;if(await g.render({canvasContext:S,viewport:m}).promise,f===1){const I=g.getViewport({scale:1});h("pageWidthChange",I.width)}u.innerHTML="",u.appendChild(v);const R=document.createElement("div");R.textContent=String(f),R.style.cssText="position:absolute;top:8px;right:8px;background:rgba(0,0,0,0.6);backdrop-filter:blur(4px);color:white;font-size:12px;padding:4px 12px;border-radius:9999px;",u.appendChild(R)},c=async()=>{if(!r||!o.value)return;const f=o.value.querySelector(".pdf-pages");if(f){f.innerHTML="",e.length=0;for(let p=1;p<=l.value;p++){const u=document.createElement("div");u.style.cssText="position:relative;display:flex;justify-content:center;",f.appendChild(u),e.push(u),await n(p,t.zoom,u)}}},a=async()=>{if(i.value=null,l.value=0,r){try{r.destroy()}catch{}r=null}try{r=await va.getDocument({url:t.url}).promise,l.value=r.numPages,h("totalPagesChange",r.numPages),h("pageChange",1),await T.nextTick(),await c()}catch(f){console.error("PDF 加载错误:",f),i.value=d.value("pdf.load_failed")}},s=()=>{if(!o.value)return;const f=o.value,p=f.scrollTop,u=f.clientHeight,g=p+u/2;let m=1,v=1/0;e.forEach((S,R)=>{const I=R+1,F=S.getBoundingClientRect(),j=f.getBoundingClientRect(),L=F.top-j.top+F.height/2+p,$=Math.abs(L-g);$<v&&(v=$,m=I)}),m!==t.currentPage&&h("pageChange",m)};return T.onMounted(()=>{a(),o.value&&o.value.addEventListener("scroll",s)}),T.watch(()=>t.url,()=>{a()}),T.watch(()=>t.zoom,()=>{c()}),T.onBeforeUnmount(()=>{if(o.value&&o.value.removeEventListener("scroll",s),r){try{r.destroy()}catch{}r=null}}),(f,p)=>(T.openBlock(),T.createElementBlock("div",{ref_key:"containerRef",ref:o,class:"vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-4 md:vfp-py-8 vfp-px-2 md:vfp-px-4"},[i.value?(T.openBlock(),T.createElementBlock("div",hf,[T.createElementVNode("p",df,T.toDisplayString(i.value),1)])):T.createCommentVNode("",!0),!i.value&&l.value===0?(T.openBlock(),T.createElementBlock("div",pf,[...p[0]||(p[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),T.withDirectives(T.createElementVNode("div",mf,null,512),[[T.vShow,!i.value&&l.value>0]]),l.value>0?(T.openBlock(),T.createElementBlock("div",gf," 第 "+T.toDisplayString(C.currentPage)+" 页 / 共 "+T.toDisplayString(l.value)+" 页 ",1)):T.createCommentVNode("",!0)],512))}}),vf={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},yf={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},wf={class:"vfp-text-white/70 vfp-text-center"},_f={class:"vfp-text-lg"},xf={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"}},kf=["innerHTML"],Sf=["innerHTML"],Ca=1123,Ta=60,Ma=50,Ef=24,Cf=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=Ca-Ta*2,t=C,{t:h}=Te(),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=T.ref([]),r=T.ref(null),e=async()=>{l.value=!0,i.value=null,d.value="",o.value=[];try{const f=await fetch(t.url);if(!f.ok)throw new Error("文件加载失败");const p=await f.arrayBuffer(),u=await uu.convertToHtml({arrayBuffer:p});d.value=u.value}catch(f){console.error("Docx 解析错误:",f),i.value=h.value("docx.parse_failed")}finally{l.value=!1}},n=()=>{const f=r.value;if(!f||!d.value)return;const p=Array.from(f.children);if(p.length===0){o.value=[d.value];return}const u=[[]];let g=0;for(const m of p){const v=m.offsetHeight;g>0&&g+v>w&&(u.push([]),g=0),u[u.length-1].push(m.outerHTML),g+=v}u.length===0&&u.push([]),o.value=u.map(m=>m.join(""))};T.watch(()=>t.url,e,{immediate:!0}),T.watch(d,async()=>{d.value&&(await T.nextTick(),requestAnimationFrame(()=>n()))});const c={fontFamily:"system-ui, -apple-system, sans-serif",lineHeight:"1.8",color:"#333"},a={...c,position:"absolute",visibility:"hidden",width:`${794-Ma*2}px`,pointerEvents:"none"},s={width:"100%",maxWidth:"794px",minHeight:`${Ca}px`,background:"white",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.15)",flexShrink:0,padding:`${Ta}px ${Ma}px`};return(f,p)=>l.value?(T.openBlock(),T.createElementBlock("div",vf,[...p[0]||(p[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",yf,[T.createElementVNode("div",wf,[T.createElementVNode("p",_f,T.toDisplayString(i.value),1)])])):(T.openBlock(),T.createElementBlock("div",xf,[T.createElementVNode("div",{ref_key:"measureRef",ref:r,style:a,innerHTML:d.value},null,8,kf),T.createElementVNode("div",{class:"vfp-py-6 md:vfp-py-10 vfp-flex vfp-flex-col vfp-items-center",style:T.normalizeStyle({gap:`${Ef}px`})},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(o.value.length>0?o.value:[""],(u,g)=>(T.openBlock(),T.createElementBlock("div",{key:g,style:s},[T.createElementVNode("div",{style:c,innerHTML:u},null,8,Sf)]))),128))],4)]))}});var ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tf(C){return C&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default")?C.default:C}function ks(C){throw new Error('Could not dynamically require "'+C+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Il={exports:{}};/*! ExcelJS 19-10-2023 */(function(C,w){(function(t){C.exports=t()})(function(){return function t(h,d,l){function i(e,n){if(!d[e]){if(!h[e]){var c=typeof ks=="function"&&ks;if(!n&&c)return c(e,!0);if(o)return o(e,!0);var a=new Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a}var s=d[e]={exports:{}};h[e][0].call(s.exports,function(f){return i(h[e][1][f]||f)},s,s.exports,t,h,d,l)}return d[e].exports}for(var o=typeof ks=="function"&&ks,r=0;r<l.length;r++)i(l[r]);return i}({1:[function(t,h,d){const l=t("fs"),i=t("fast-csv"),o=t("dayjs/plugin/customParseFormat"),r=t("dayjs/plugin/utc"),e=t("dayjs").extend(o).extend(r),n=t("../utils/stream-buf"),{fs:{exists:c}}=t("../utils/utils"),a={true:!0,false:!1,"#N/A":{error:"#N/A"},"#REF!":{error:"#REF!"},"#NAME?":{error:"#NAME?"},"#DIV/0!":{error:"#DIV/0!"},"#NULL!":{error:"#NULL!"},"#VALUE!":{error:"#VALUE!"},"#NUM!":{error:"#NUM!"}};h.exports=class{constructor(s){this.workbook=s,this.worksheet=null}async readFile(s,f){if(f=f||{},!await c(s))throw new Error("File not found: "+s);const p=l.createReadStream(s),u=await this.read(p,f);return p.close(),u}read(s,f){return f=f||{},new Promise((p,u)=>{const g=this.workbook.addWorksheet(f.sheetName),m=f.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],v=f.map||function(R){if(R==="")return null;const I=Number(R);if(!Number.isNaN(I)&&I!==1/0)return I;const F=m.reduce((L,$)=>{if(L)return L;const V=e(R,$,!0);return V.isValid()?V:null},null);if(F)return new Date(F.valueOf());const j=a[R];return j!==void 0?j:R},S=i.parse(f.parserOptions).on("data",R=>{g.addRow(R.map(v))}).on("end",()=>{S.emit("worksheet",g)});S.on("worksheet",p).on("error",u),s.pipe(S)})}createInputStream(){throw new Error("`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}write(s,f){return new Promise((p,u)=>{f=f||{};const g=this.workbook.getWorksheet(f.sheetName||f.sheetId),m=i.format(f.formatterOptions);s.on("finish",()=>{p()}),m.on("error",u),m.pipe(s);const{dateFormat:v,dateUTC:S}=f,R=f.map||(j=>{if(j){if(j.text||j.hyperlink)return j.hyperlink||j.text||"";if(j.formula||j.result)return j.result||"";if(j instanceof Date)return v?S?e.utc(j).format(v):e(j).format(v):S?e.utc(j).format():e(j).format();if(j.error)return j.error;if(typeof j=="object")return JSON.stringify(j)}return j}),I=f.includeEmptyRows===void 0||f.includeEmptyRows;let F=1;g&&g.eachRow((j,L)=>{if(I)for(;F++<L-1;)m.write([]);const{values:$}=j;$.shift(),m.write($.map(R)),F=L}),m.end()})}writeFile(s,f){const p={encoding:(f=f||{}).encoding||"utf8"},u=l.createWriteStream(s,p);return this.write(u,f)}async writeBuffer(s){const f=new n;return await this.write(f,s),f.read()}}},{"../utils/stream-buf":24,"../utils/utils":27,dayjs:391,"dayjs/plugin/customParseFormat":392,"dayjs/plugin/utc":393,"fast-csv":424,fs:216}],2:[function(t,h,d){const l=t("../utils/col-cache");class i{constructor(r,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this.worksheet=r,e)if(typeof e=="string"){const c=l.decodeAddress(e);this.nativeCol=c.col+n,this.nativeColOff=0,this.nativeRow=c.row+n,this.nativeRowOff=0}else e.nativeCol!==void 0?(this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0):e.col!==void 0?(this.col=e.col+n,this.row=e.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(r){return r instanceof i||r==null?r:new i(r)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(r){this.nativeCol=Math.floor(r),this.nativeColOff=Math.floor((r-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(r){this.nativeRow=Math.floor(r),this.nativeRowOff=Math.floor((r-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(r){this.nativeCol=r.nativeCol,this.nativeColOff=r.nativeColOff,this.nativeRow=r.nativeRow,this.nativeRowOff=r.nativeRowOff}}h.exports=i},{"../utils/col-cache":19}],3:[function(t,h,d){const l=t("../utils/col-cache"),i=t("../utils/under-dash"),o=t("./enums"),{slideFormula:r}=t("../utils/shared-formula"),e=t("./note");class n{constructor(s,f,p){if(!s||!f)throw new Error("A Cell needs a Row");this._row=s,this._column=f,l.validateAddress(p),this._address=p,this._value=c.create(n.Types.Null,this),this.style=this._mergeStyle(s.style,f.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(s){this.style.numFmt=s}get font(){return this.style.font}set font(s){this.style.font=s}get alignment(){return this.style.alignment}set alignment(s){this.style.alignment=s}get border(){return this.style.border}set border(s){this.style.border=s}get fill(){return this.style.fill}set fill(s){this.style.fill=s}get protection(){return this.style.protection}set protection(s){this.style.protection=s}_mergeStyle(s,f,p){const u=s&&s.numFmt||f&&f.numFmt;u&&(p.numFmt=u);const g=s&&s.font||f&&f.font;g&&(p.font=g);const m=s&&s.alignment||f&&f.alignment;m&&(p.alignment=m);const v=s&&s.border||f&&f.border;v&&(p.border=v);const S=s&&s.fill||f&&f.fill;S&&(p.fill=S);const R=s&&s.protection||f&&f.protection;return R&&(p.protection=R),p}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===n.Types.Merge}merge(s,f){this._value.release(),this._value=c.create(n.Types.Merge,this,s),f||(this.style=s.style)}unmerge(){this.type===n.Types.Merge&&(this._value.release(),this._value=c.create(n.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(s){return this._value.type===n.Types.Merge&&this._value.isMergedTo(s)}get master(){return this.type===n.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===n.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(s){this.type!==n.Types.Merge?(this._value.release(),this._value=c.create(c.getType(s),this,s)):this._value.master.value=s}get note(){return this._comment&&this._comment.note}set note(s){this._comment=new e(s)}get text(){return this._value.toString()}get html(){return i.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(s){this.type===n.Types.String&&(this._value=c.create(n.Types.Hyperlink,this,{text:this._value.value,hyperlink:s}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){const{worksheet:s}=this._row;return{sheetName:s.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(s){this.names=[s]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(s){const{definedNames:f}=this.workbook;f.removeAllNames(this.fullAddress),s.forEach(p=>{f.addEx(this.fullAddress,p)})}addName(s){this.workbook.definedNames.addEx(this.fullAddress,s)}removeName(s){this.workbook.definedNames.removeEx(this.fullAddress,s)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(s){this._dataValidations.add(this.address,s)}get model(){const{model:s}=this._value;return s.style=this.style,this._comment&&(s.comment=this._comment.model),s}set model(s){if(this._value.release(),this._value=c.create(s.type,this),this._value.model=s,s.comment)switch(s.comment.type){case"note":this._comment=e.fromModel(s.comment)}s.style?this.style=s.style:this.style={}}}n.Types=o.ValueType;const c={getType:a=>a==null?n.Types.Null:a instanceof String||typeof a=="string"?n.Types.String:typeof a=="number"?n.Types.Number:typeof a=="boolean"?n.Types.Boolean:a instanceof Date?n.Types.Date:a.text&&a.hyperlink?n.Types.Hyperlink:a.formula||a.sharedFormula?n.Types.Formula:a.richText?n.Types.RichText:a.sharedString?n.Types.SharedString:a.error?n.Types.Error:n.Types.JSON,types:[{t:n.Types.Null,f:class{constructor(a){this.model={address:a.address,type:n.Types.Null}}get value(){return null}set value(a){}get type(){return n.Types.Null}get effectiveType(){return n.Types.Null}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return""}release(){}toString(){return""}}},{t:n.Types.Number,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Number,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Number}get effectiveType(){return n.Types.Number}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.String,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.String,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.String}get effectiveType(){return n.Types.String}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return`"${this.model.value.replace(/"/g,'""')}"`}release(){}toString(){return this.model.value}}},{t:n.Types.Date,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Date,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Date}get effectiveType(){return n.Types.Date}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.Hyperlink,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Hyperlink,text:s?s.text:void 0,hyperlink:s?s.hyperlink:void 0},s&&s.tooltip&&(this.model.tooltip=s.tooltip)}get value(){const a={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(a.tooltip=this.model.tooltip),a}set value(a){this.model={text:a.text,hyperlink:a.hyperlink},a.tooltip&&(this.model.tooltip=a.tooltip)}get text(){return this.model.text}set text(a){this.model.text=a}get hyperlink(){return this.model.hyperlink}set hyperlink(a){this.model.hyperlink=a}get type(){return n.Types.Hyperlink}get effectiveType(){return n.Types.Hyperlink}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:n.Types.Formula,f:class{constructor(a,s){this.cell=a,this.model={address:a.address,type:n.Types.Formula,shareType:s?s.shareType:void 0,ref:s?s.ref:void 0,formula:s?s.formula:void 0,sharedFormula:s?s.sharedFormula:void 0,result:s?s.result:void 0}}_copyModel(a){const s={},f=p=>{const u=a[p];u&&(s[p]=u)};return f("formula"),f("result"),f("ref"),f("shareType"),f("sharedFormula"),s}get value(){return this._copyModel(this.model)}set value(a){this.model=this._copyModel(a)}validate(a){switch(c.getType(a)){case n.Types.Null:case n.Types.String:case n.Types.Number:case n.Types.Date:break;case n.Types.Hyperlink:case n.Types.Formula:default:throw new Error("Cannot process that type of result value")}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(a){this.model.formula=a}get formulaType(){return this.model.formula?o.FormulaType.Master:this.model.sharedFormula?o.FormulaType.Shared:o.FormulaType.None}get result(){return this.model.result}set result(a){this.model.result=a}get type(){return n.Types.Formula}get effectiveType(){const a=this.model.result;return a==null?o.ValueType.Null:a instanceof String||typeof a=="string"?o.ValueType.String:typeof a=="number"?o.ValueType.Number:a instanceof Date?o.ValueType.Date:a.text&&a.hyperlink?o.ValueType.Hyperlink:a.formula?o.ValueType.Formula:o.ValueType.Null}get address(){return this.model.address}set address(a){this.model.address=a}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){const{worksheet:a}=this.cell,s=a.findCell(this.model.sharedFormula);this._translatedFormula=s&&r(s.formula,s.address,this.model.address)}return this._translatedFormula}toCsvString(){return""+(this.model.result||"")}release(){}toString(){return this.model.result?this.model.result.toString():""}}},{t:n.Types.Merge,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Merge,master:s?s.address:void 0},this._master=s,s&&s.addMergeRef()}get value(){return this._master.value}set value(a){a instanceof n?(this._master&&this._master.releaseMergeRef(),a.addMergeRef(),this._master=a):this._master.value=a}isMergedTo(a){return a===this._master}get master(){return this._master}get type(){return n.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return""}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:n.Types.JSON,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.String,value:JSON.stringify(s),rawValue:s}}get value(){return this.model.rawValue}set value(a){this.model.rawValue=a,this.model.value=JSON.stringify(a)}get type(){return n.Types.String}get effectiveType(){return n.Types.String}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:n.Types.SharedString,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.SharedString,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.SharedString}get effectiveType(){return n.Types.SharedString}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.RichText,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.String,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}toString(){return this.model.value.richText.map(a=>a.text).join("")}get type(){return n.Types.RichText}get effectiveType(){return n.Types.RichText}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return`"${this.text.replace(/"/g,'""')}"`}release(){}}},{t:n.Types.Boolean,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Boolean,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Boolean}get effectiveType(){return n.Types.Boolean}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:n.Types.Error,f:class{constructor(a,s){this.model={address:a.address,type:n.Types.Error,value:s}}get value(){return this.model.value}set value(a){this.model.value=a}get type(){return n.Types.Error}get effectiveType(){return n.Types.Error}get address(){return this.model.address}set address(a){this.model.address=a}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce((a,s)=>(a[s.t]=s.f,a),[]),create(a,s,f){const p=this.types[a];if(!p)throw new Error("Could not create Value of type "+a);return new p(s,f)}};h.exports=n},{"../utils/col-cache":19,"../utils/shared-formula":23,"../utils/under-dash":26,"./enums":7,"./note":9}],4:[function(t,h,d){const l=t("../utils/under-dash"),i=t("./enums"),o=t("../utils/col-cache");class r{constructor(n,c,a){this._worksheet=n,this._number=c,a!==!1&&(this.defn=a)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return o.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(n){n?(this.key=n.key,this.width=n.width!==void 0?n.width:9,this.outlineLevel=n.outlineLevel,n.style?this.style=n.style:this.style={},this.header=n.header,this._hidden=!!n.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(n){n!==void 0?(this._header=n,this.headers.forEach((c,a)=>{this._worksheet.getCell(a+1,this.number).value=c})):this._header=void 0}get key(){return this._key}set key(n){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=n,n&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(n){this._hidden=n}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(n){this._outlineLevel=n}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(n){return this.width===n.width&&this.hidden===n.hidden&&this.outlineLevel===n.outlineLevel&&l.isEqual(this.style,n.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;const n=this.style;return!n||!(n.font||n.numFmt||n.alignment||n.border||n.fill||n.protection)}get headerCount(){return this.headers.length}eachCell(n,c){const a=this.number;c||(c=n,n=null),this._worksheet.eachRow(n,(s,f)=>{c(s.getCell(a),f)})}get values(){const n=[];return this.eachCell((c,a)=>{c&&c.type!==i.ValueType.Null&&(n[a]=c.value)}),n}set values(n){if(!n)return;const c=this.number;let a=0;n.hasOwnProperty("0")&&(a=1),n.forEach((s,f)=>{this._worksheet.getCell(f+a,c).value=s})}_applyStyle(n,c){return this.style[n]=c,this.eachCell(a=>{a[n]=c}),c}get numFmt(){return this.style.numFmt}set numFmt(n){this._applyStyle("numFmt",n)}get font(){return this.style.font}set font(n){this._applyStyle("font",n)}get alignment(){return this.style.alignment}set alignment(n){this._applyStyle("alignment",n)}get protection(){return this.style.protection}set protection(n){this._applyStyle("protection",n)}get border(){return this.style.border}set border(n){this._applyStyle("border",n)}get fill(){return this.style.fill}set fill(n){this._applyStyle("fill",n)}static toModel(n){const c=[];let a=null;return n&&n.forEach((s,f)=>{s.isDefault?a&&(a=null):a&&s.equivalentTo(a)?a.max=f+1:(a={min:f+1,max:f+1,width:s.width!==void 0?s.width:9,style:s.style,isCustomWidth:s.isCustomWidth,hidden:s.hidden,outlineLevel:s.outlineLevel,collapsed:s.collapsed},c.push(a))}),c.length?c:void 0}static fromModel(n,c){const a=[];let s=1,f=0;for(c=(c=c||[]).sort(function(p,u){return p.min-u.min});f<c.length;){const p=c[f++];for(;s<p.min;)a.push(new r(n,s++));for(;s<=p.max;)a.push(new r(n,s++,p))}return a.length?a:null}}h.exports=r},{"../utils/col-cache":19,"../utils/under-dash":26,"./enums":7}],5:[function(t,h,d){h.exports=class{constructor(l){this.model=l||{}}add(l,i){return this.model[l]=i}find(l){return this.model[l]}remove(l){this.model[l]=void 0}}},{}],6:[function(t,h,d){const l=t("../utils/under-dash"),i=t("../utils/col-cache"),o=t("../utils/cell-matrix"),r=t("./range"),e=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;h.exports=class{constructor(){this.matrixMap={}}getMatrix(n){return this.matrixMap[n]||(this.matrixMap[n]=new o)}add(n,c){const a=i.decodeEx(n);this.addEx(a,c)}addEx(n,c){const a=this.getMatrix(c);if(n.top)for(let s=n.left;s<=n.right;s++)for(let f=n.top;f<=n.bottom;f++){const p={sheetName:n.sheetName,address:i.n2l(s)+f,row:f,col:s};a.addCellEx(p)}else a.addCellEx(n)}remove(n,c){const a=i.decodeEx(n);this.removeEx(a,c)}removeEx(n,c){this.getMatrix(c).removeCellEx(n)}removeAllNames(n){l.each(this.matrixMap,c=>{c.removeCellEx(n)})}forEach(n){l.each(this.matrixMap,(c,a)=>{c.forEach(s=>{n(a,s)})})}getNames(n){return this.getNamesEx(i.decodeEx(n))}getNamesEx(n){return l.map(this.matrixMap,(c,a)=>c.findCellEx(n)&&a).filter(Boolean)}_explore(n,c){c.mark=!1;const{sheetName:a}=c,s=new r(c.row,c.col,c.row,c.col,a);let f,p;function u(m,v){const S=n.findCellAt(a,m,c.col);return!(!S||!S.mark)&&(s[v]=m,S.mark=!1,!0)}for(p=c.row-1;u(p,"top");p--);for(p=c.row+1;u(p,"bottom");p++);function g(m,v){const S=[];for(p=s.top;p<=s.bottom;p++){const R=n.findCellAt(a,p,m);if(!R||!R.mark)return!1;S.push(R)}s[v]=m;for(let R=0;R<S.length;R++)S[R].mark=!1;return!0}for(f=c.col-1;g(f,"left");f--);for(f=c.col+1;g(f,"right");f++);return s}getRanges(n,c){return(c=c||this.matrixMap[n])?(c.forEach(a=>{a.mark=!0}),{name:n,ranges:c.map(a=>a.mark&&this._explore(c,a)).filter(Boolean).map(a=>a.$shortRange)}):{name:n,ranges:[]}}normaliseMatrix(n,c){n.forEachInSheet(c,(a,s,f)=>{a&&(a.row===s&&a.col===f||(a.row=s,a.col=f,a.address=i.n2l(f)+s))})}spliceRows(n,c,a,s){l.each(this.matrixMap,f=>{f.spliceRows(n,c,a,s),this.normaliseMatrix(f,n)})}spliceColumns(n,c,a,s){l.each(this.matrixMap,f=>{f.spliceColumns(n,c,a,s),this.normaliseMatrix(f,n)})}get model(){return l.map(this.matrixMap,(n,c)=>this.getRanges(c,n)).filter(n=>n.ranges.length)}set model(n){const c=this.matrixMap={};n.forEach(a=>{const s=c[a.name]=new o;a.ranges.forEach(f=>{e.test(f.split("!").pop()||"")&&s.addCell(f)})})}}},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":26,"./range":10}],7:[function(t,h,d){h.exports={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:"#N/A",Ref:"#REF!",Name:"#NAME?",DivZero:"#DIV/0!",Null:"#NULL!",Value:"#VALUE!",Num:"#NUM!"}}},{}],8:[function(t,h,d){const l=t("../utils/col-cache"),i=t("./anchor");h.exports=class{constructor(o,r){this.worksheet=o,this.model=r}get model(){switch(this.type){case"background":return{type:this.type,imageId:this.imageId};case"image":return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw new Error("Invalid Image Type")}}set model(o){let{type:r,imageId:e,range:n,hyperlinks:c}=o;if(this.type=r,this.imageId=e,r==="image")if(typeof n=="string"){const a=l.decode(n);this.range={tl:new i(this.worksheet,{col:a.left,row:a.top},-1),br:new i(this.worksheet,{col:a.right,row:a.bottom},0),editAs:"oneCell"}}else this.range={tl:new i(this.worksheet,n.tl,0),br:n.br&&new i(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:c||n.hyperlinks}}}},{"../utils/col-cache":19,"./anchor":2}],9:[function(t,h,d){const l=t("../utils/under-dash");class i{constructor(r){this.note=r}get model(){let r=null;switch(typeof this.note){case"string":r={type:"note",note:{texts:[{text:this.note}]}};break;default:r={type:"note",note:this.note}}return l.deepMerge({},i.DEFAULT_CONFIGS,r)}set model(r){const{note:e}=r,{texts:n}=e;n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=e}static fromModel(r){const e=new i;return e.model=r,e}}i.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},h.exports=i},{"../utils/under-dash":26}],10:[function(t,h,d){const l=t("../utils/col-cache");class i{constructor(){this.decode(arguments)}setTLBR(r,e,n,c,a){if(arguments.length<4){const s=l.decodeAddress(r),f=l.decodeAddress(e);this.model={top:Math.min(s.row,f.row),left:Math.min(s.col,f.col),bottom:Math.max(s.row,f.row),right:Math.max(s.col,f.col),sheetName:n},this.setTLBR(s.row,s.col,f.row,f.col,a)}else this.model={top:Math.min(r,n),left:Math.min(e,c),bottom:Math.max(r,n),right:Math.max(e,c),sheetName:a}}decode(r){switch(r.length){case 5:this.setTLBR(r[0],r[1],r[2],r[3],r[4]);break;case 4:this.setTLBR(r[0],r[1],r[2],r[3]);break;case 3:this.setTLBR(r[0],r[1],r[2]);break;case 2:this.setTLBR(r[0],r[1]);break;case 1:{const e=r[0];if(e instanceof i)this.model={top:e.model.top,left:e.model.left,bottom:e.model.bottom,right:e.model.right,sheetName:e.sheetName};else if(e instanceof Array)this.decode(e);else if(e.top&&e.left&&e.bottom&&e.right)this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName};else{const n=l.decodeEx(e);n.top?this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName}:this.model={top:n.row,left:n.col,bottom:n.row,right:n.col,sheetName:n.sheetName}}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new Error("Invalid number of arguments to _getDimensions() - "+r.length)}}get top(){return this.model.top||1}set top(r){this.model.top=r}get left(){return this.model.left||1}set left(r){this.model.left=r}get bottom(){return this.model.bottom||1}set bottom(r){this.model.bottom=r}get right(){return this.model.right||1}set right(r){this.model.right=r}get sheetName(){return this.model.sheetName}set sheetName(r){this.model.sheetName=r}get _serialisedSheetName(){const{sheetName:r}=this.model;return r?/^[a-zA-Z0-9]*$/.test(r)?r+"!":`'${r}'!`:""}expand(r,e,n,c){(!this.model.top||r<this.top)&&(this.top=r),(!this.model.left||e<this.left)&&(this.left=e),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||c>this.right)&&(this.right=c)}expandRow(r){if(r){const{dimensions:e,number:n}=r;e&&this.expand(n,e.min,n,e.max)}}expandToAddress(r){const e=l.decodeEx(r);this.expand(e.row,e.col,e.row,e.col)}get tl(){return l.n2l(this.left)+this.top}get $t$l(){return`$${l.n2l(this.left)}$${this.top}`}get br(){return l.n2l(this.right)+this.bottom}get $b$r(){return`$${l.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&!(r.bottom<this.top)&&!(r.top>this.bottom)&&!(r.right<this.left)&&!(r.left>this.right)}contains(r){const e=l.decodeEx(r);return this.containsEx(e)}containsEx(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&r.row>=this.top&&r.row<=this.bottom&&r.col>=this.left&&r.col<=this.right}forEachAddress(r){for(let e=this.left;e<=this.right;e++)for(let n=this.top;n<=this.bottom;n++)r(l.encodeAddress(n,e),n,e)}}h.exports=i},{"../utils/col-cache":19}],11:[function(t,h,d){const l=t("../utils/under-dash"),i=t("./enums"),o=t("../utils/col-cache"),r=t("./cell");h.exports=class{constructor(e,n){this._worksheet=e,this._number=n,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(e){return this._cells[e-1]}getCellEx(e){let n=this._cells[e.col-1];if(!n){const c=this._worksheet.getColumn(e.col);n=new r(this,c,e.address),this._cells[e.col-1]=n}return n}getCell(e){if(typeof e=="string"){const n=this._worksheet.getColumnKey(e);e=n?n.number:o.l2n(e)}return this._cells[e-1]||this.getCellEx({address:o.encodeAddress(this._number,e),row:this._number,col:e})}splice(e,n){const c=e+n;for(var a=arguments.length,s=new Array(a>2?a-2:0),f=2;f<a;f++)s[f-2]=arguments[f];const p=s.length-n,u=this._cells.length;let g,m,v;if(p<0)for(g=e+s.length;g<=u;g++)v=this._cells[g-1],m=this._cells[g-p-1],m?(v=this.getCell(g),v.value=m.value,v.style=m.style,v._comment=m._comment):v&&(v.value=null,v.style={},v._comment=void 0);else if(p>0)for(g=u;g>=c;g--)m=this._cells[g-1],m?(v=this.getCell(g+p),v.value=m.value,v.style=m.style,v._comment=m._comment):this._cells[g+p-1]=void 0;for(g=0;g<s.length;g++)v=this.getCell(e+g),v.value=s[g],v.style={},v._comment=void 0}eachCell(e,n){if(n||(n=e,e=null),e&&e.includeEmpty){const c=this._cells.length;for(let a=1;a<=c;a++)n(this.getCell(a),a)}else this._cells.forEach((c,a)=>{c&&c.type!==i.ValueType.Null&&n(c,a+1)})}addPageBreak(e,n){const c=this._worksheet,a=Math.max(0,e-1)||0,s=Math.max(0,n-1)||16838,f={id:this._number,max:s,man:1};a&&(f.min=a),c.rowBreaks.push(f)}get values(){const e=[];return this._cells.forEach(n=>{n&&n.type!==i.ValueType.Null&&(e[n.col]=n.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let n=0;e.hasOwnProperty("0")&&(n=1),e.forEach((c,a)=>{c!==void 0&&(this.getCellEx({address:o.encodeAddress(this._number,a+n),row:this._number,col:a+n}).value=c)})}else this._worksheet.eachColumnKey((n,c)=>{e[c]!==void 0&&(this.getCellEx({address:o.encodeAddress(this._number,n.number),row:this._number,col:n.number}).value=e[c])})}get hasValues(){return l.some(this._cells,e=>e&&e.type!==i.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,n=0;return this._cells.forEach(c=>{c&&c.type!==i.ValueType.Null&&((!e||e>c.col)&&(e=c.col),n<c.col&&(n=c.col))}),e>0?{min:e,max:n}:null}_applyStyle(e,n){return this.style[e]=n,this._cells.forEach(c=>{c&&(c[e]=n)}),n}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle("numFmt",e)}get font(){return this.style.font}set font(e){this._applyStyle("font",e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle("alignment",e)}get protection(){return this.style.protection}set protection(e){this._applyStyle("protection",e)}get border(){return this.style.border}set border(e){this._applyStyle("border",e)}get fill(){return this.style.fill}set fill(e){this._applyStyle("fill",e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){const e=[];let n=0,c=0;return this._cells.forEach(a=>{if(a){const s=a.model;s&&((!n||n>a.col)&&(n=a.col),c<a.col&&(c=a.col),e.push(s))}}),this.height||e.length?{cells:e,number:this.number,min:n,max:c,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(e){if(e.number!==this._number)throw new Error("Invalid row number in model");let n;this._cells=[],e.cells.forEach(c=>{switch(c.type){case r.Types.Merge:break;default:{let a;if(c.address)a=o.decodeAddress(c.address);else if(n){const{row:s}=n,f=n.col+1;a={row:s,col:f,address:o.encodeAddress(s,f),$col$row:`$${o.n2l(f)}$${s}`}}n=a,this.getCellEx(a).model=c;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}}},{"../utils/col-cache":19,"../utils/under-dash":26,"./cell":3,"./enums":7}],12:[function(t,h,d){const l=t("../utils/col-cache");class i{constructor(r,e,n){this.table=r,this.column=e,this.index=n}_set(r,e){this.table.cacheState(),this.column[r]=e}get name(){return this.column.name}set name(r){this._set("name",r)}get filterButton(){return this.column.filterButton}set filterButton(r){this.column.filterButton=r}get style(){return this.column.style}set style(r){this.column.style=r}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(r){this._set("totalsRowLabel",r)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(r){this._set("totalsRowFunction",r)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(r){this._set("totalsRowResult",r)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(r){this._set("totalsRowFormula",r)}}h.exports=class{constructor(o,r){this.worksheet=o,r&&(this.table=r,this.validate(),this.store())}getFormula(o){switch(o.totalsRowFunction){case"none":return null;case"average":return`SUBTOTAL(101,${this.table.name}[${o.name}])`;case"countNums":return`SUBTOTAL(102,${this.table.name}[${o.name}])`;case"count":return`SUBTOTAL(103,${this.table.name}[${o.name}])`;case"max":return`SUBTOTAL(104,${this.table.name}[${o.name}])`;case"min":return`SUBTOTAL(105,${this.table.name}[${o.name}])`;case"stdDev":return`SUBTOTAL(106,${this.table.name}[${o.name}])`;case"var":return`SUBTOTAL(107,${this.table.name}[${o.name}])`;case"sum":return`SUBTOTAL(109,${this.table.name}[${o.name}])`;case"custom":return o.totalsRowFormula;default:throw new Error("Invalid Totals Row Function: "+o.totalsRowFunction)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){const{table:o}=this,r=(p,u,g)=>{p[u]===void 0&&(p[u]=g)};r(o,"headerRow",!0),r(o,"totalsRow",!1),r(o,"style",{}),r(o.style,"theme","TableStyleMedium2"),r(o.style,"showFirstColumn",!1),r(o.style,"showLastColumn",!1),r(o.style,"showRowStripes",!1),r(o.style,"showColumnStripes",!1);const e=(p,u)=>{if(!p)throw new Error(u)};e(o.ref,"Table must have ref"),e(o.columns,"Table must have column definitions"),e(o.rows,"Table must have row definitions"),o.tl=l.decodeAddress(o.ref);const{row:n,col:c}=o.tl;e(n>0,"Table must be on valid row"),e(c>0,"Table must be on valid col");const{width:a,filterHeight:s,tableHeight:f}=this;o.autoFilterRef=l.encode(n,c,n+s-1,c+a-1),o.tableRef=l.encode(n,c,n+f-1,c+a-1),o.columns.forEach((p,u)=>{e(p.name,`Column ${u} must have a name`),u===0?r(p,"totalsRowLabel","Total"):(r(p,"totalsRowFunction","none"),p.totalsRowFormula=this.getFormula(p))})}store(){const o=(s,f)=>{f&&Object.keys(f).forEach(p=>{s[p]=f[p]})},{worksheet:r,table:e}=this,{row:n,col:c}=e.tl;let a=0;if(e.headerRow){const s=r.getRow(n+a++);e.columns.forEach((f,p)=>{const{style:u,name:g}=f,m=s.getCell(c+p);m.value=g,o(m,u)})}if(e.rows.forEach(s=>{const f=r.getRow(n+a++);s.forEach((p,u)=>{const g=f.getCell(c+u);g.value=p,o(g,e.columns[u].style)})}),e.totalsRow){const s=r.getRow(n+a++);e.columns.forEach((f,p)=>{const u=s.getCell(c+p);if(p===0)u.value=f.totalsRowLabel;else{const g=this.getFormula(f);u.value=g?{formula:f.totalsRowFormula,result:f.totalsRowResult}:null}o(u,f.style)})}}load(o){const{table:r}=this,{row:e,col:n}=r.tl;let c=0;if(r.headerRow){const a=o.getRow(e+c++);r.columns.forEach((s,f)=>{a.getCell(n+f).value=s.name})}if(r.rows.forEach(a=>{const s=o.getRow(e+c++);a.forEach((f,p)=>{s.getCell(n+p).value=f})}),r.totalsRow){const a=o.getRow(e+c++);r.columns.forEach((s,f)=>{const p=a.getCell(n+f);f===0?p.value=s.totalsRowLabel:this.getFormula(s)&&(p.value={formula:s.totalsRowFormula,result:s.totalsRowResult})})}}get model(){return this.table}set model(o){this.table=o}cacheState(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}commit(){if(!this._cache)return;this.validate();const o=l.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let r=0;r<this._cache.tableHeight;r++){const e=this.worksheet.getRow(o.row+r);for(let n=0;n<this._cache.width;n++)e.getCell(o.col+n).value=null}else{for(let r=this.tableHeight;r<this._cache.tableHeight;r++){const e=this.worksheet.getRow(o.row+r);for(let n=0;n<this._cache.width;n++)e.getCell(o.col+n).value=null}for(let r=0;r<this.tableHeight;r++){const e=this.worksheet.getRow(o.row+r);for(let n=this.width;n<this._cache.width;n++)e.getCell(o.col+n).value=null}}this.store()}addRow(o,r){this.cacheState(),r===void 0?this.table.rows.push(o):this.table.rows.splice(r,0,o)}removeRows(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.rows.splice(o,r)}getColumn(o){const r=this.table.columns[o];return new i(this,r,o)}addColumn(o,r,e){this.cacheState(),e===void 0?(this.table.columns.push(o),this.table.rows.forEach((n,c)=>{n.push(r[c])})):(this.table.columns.splice(e,0,o),this.table.rows.forEach((n,c)=>{n.splice(e,0,r[c])}))}removeColumns(o){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.columns.splice(o,r),this.table.rows.forEach(e=>{e.splice(o,r)})}_assign(o,r,e){this.cacheState(),o[r]=e}get ref(){return this.table.ref}set ref(o){this._assign(this.table,"ref",o)}get name(){return this.table.name}set name(o){this.table.name=o}get displayName(){return this.table.displyName||this.table.name}set displayNamename(o){this.table.displayName=o}get headerRow(){return this.table.headerRow}set headerRow(o){this._assign(this.table,"headerRow",o)}get totalsRow(){return this.table.totalsRow}set totalsRow(o){this._assign(this.table,"totalsRow",o)}get theme(){return this.table.style.name}set theme(o){this.table.style.name=o}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(o){this.table.style.showFirstColumn=o}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(o){this.table.style.showLastColumn=o}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(o){this.table.style.showRowStripes=o}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(o){this.table.style.showColumnStripes=o}}},{"../utils/col-cache":19}],13:[function(t,h,d){const l=t("./worksheet"),i=t("./defined-names"),o=t("../xlsx/xlsx"),r=t("../csv/csv");h.exports=class{constructor(){this.category="",this.company="",this.created=new Date,this.description="",this.keywords="",this.manager="",this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject="",this.title="",this.views=[],this.media=[],this._definedNames=new i}get xlsx(){return this._xlsx||(this._xlsx=new o(this)),this._xlsx}get csv(){return this._csv||(this._csv=new r(this)),this._csv}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,n){const c=this.nextId;n&&(typeof n=="string"?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),n={properties:{tabColor:{argb:n}}}):(n.argb||n.theme||n.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),n={properties:{tabColor:n}}));const a=this._worksheets.reduce((p,u)=>(u&&u.orderNo)>p?u.orderNo:p,0),s=Object.assign({},n,{id:c,name:e,orderNo:a+1,workbook:this}),f=new l(s);return this._worksheets[c]=f,f}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){const n=this.getWorksheet(e);n&&n.destroy()}getWorksheet(e){return e===void 0?this._worksheets.find(Boolean):typeof e=="number"?this._worksheets[e]:typeof e=="string"?this._worksheets.find(n=>n&&n.name===e):void 0}get worksheets(){return this._worksheets.slice(1).sort((e,n)=>e.orderNo-n.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(n=>{e(n,n.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){const n=this.media.length;return this.media.push(Object.assign({},e,{type:"image"})),n}getImage(e){return this.media[e]}get model(){return{creator:this.creator||"Unknown",lastModifiedBy:this.lastModifiedBy||"Unknown",lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,calcProperties:this.calcProperties}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(n=>{const{id:c,name:a,state:s}=n,f=e.sheets&&e.sheets.findIndex(p=>p.id===c);(this._worksheets[c]=new l({id:c,name:a,orderNo:f,state:s,workbook:this})).model=n}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media||[]}}},{"../csv/csv":1,"../xlsx/xlsx":144,"./defined-names":6,"./worksheet":14}],14:[function(t,h,d){const l=t("../utils/under-dash"),i=t("../utils/col-cache"),o=t("./range"),r=t("./row"),e=t("./column"),n=t("./enums"),c=t("./image"),a=t("./table"),s=t("./data-validations"),f=t("../utils/encryptor"),{copyStyle:p}=t("../utils/copy-style");h.exports=class{constructor(u){u=u||{},this._workbook=u.workbook,this.id=u.id,this.orderNo=u.orderNo,this.name=u.name,this.state=u.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},u.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!(!u.pageSetup||!u.pageSetup.fitToWidth&&!u.pageSetup.fitToHeight||u.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},u.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},u.headerFooter),this.dataValidations=new s,this.views=u.views||[],this.autoFilter=u.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.conditionalFormattings=[]}get name(){return this._name}set name(u){if(u===void 0&&(u="sheet"+this.id),this._name!==u){if(typeof u!="string")throw new Error("The name has to be a string.");if(u==="")throw new Error("The name can't be empty.");if(u==="History")throw new Error('The name "History" is protected. Please use a different name.');if(/[*?:/\\[\]]/.test(u))throw new Error(`Worksheet name ${u} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(u))throw new Error("The first or last character of worksheet name cannot be a single quotation mark: "+u);if(u&&u.length>31&&(console.warn(`Worksheet name ${u} exceeds 31 chars. This will be truncated`),u=u.substring(0,31)),this._workbook._worksheets.find(g=>g&&g.name.toLowerCase()===u.toLowerCase()))throw new Error("Worksheet name already exists: "+u);this._name=u}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){const u=new o;return this._rows.forEach(g=>{if(g){const m=g.dimensions;m&&u.expand(g.number,m.min,g.number,m.max)}}),u}get columns(){return this._columns}set columns(u){this._headerRowCount=u.reduce((v,S)=>{const R=(S.header?1:S.headers&&S.headers.length)||0;return Math.max(v,R)},0);let g=1;const m=this._columns=[];u.forEach(v=>{const S=new e(this,g++,!1);m.push(S),S.defn=v})}getColumnKey(u){return this._keys[u]}setColumnKey(u,g){this._keys[u]=g}deleteColumnKey(u){delete this._keys[u]}eachColumnKey(u){l.each(this._keys,u)}getColumn(u){if(typeof u=="string"){const g=this._keys[u];if(g)return g;u=i.l2n(u)}if(this._columns||(this._columns=[]),u>this._columns.length){let g=this._columns.length+1;for(;g<=u;)this._columns.push(new e(this,g++))}return this._columns[u-1]}spliceColumns(u,g){const m=this._rows.length;for(var v=arguments.length,S=new Array(v>2?v-2:0),R=2;R<v;R++)S[R-2]=arguments[R];if(S.length>0)for(let L=0;L<m;L++){const $=[u,g];S.forEach(z=>{$.push(z[L]||null)});const V=this.getRow(L+1);V.splice.apply(V,$)}else this._rows.forEach(L=>{L&&L.splice(u,g)});const I=S.length-g,F=u+g,j=this._columns.length;if(I<0)for(let L=u+S.length;L<=j;L++)this.getColumn(L).defn=this.getColumn(L-I).defn;else if(I>0)for(let L=j;L>=F;L--)this.getColumn(L+I).defn=this.getColumn(L).defn;for(let L=u;L<u+S.length;L++)this.getColumn(L).defn=null;this.workbook.definedNames.spliceColumns(this.name,u,g,S.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let u=0;return this.eachRow(g=>{u=Math.max(u,g.cellCount)}),u}get actualColumnCount(){const u=[];let g=0;return this.eachRow(m=>{m.eachCell(v=>{let{col:S}=v;u[S]||(u[S]=!0,g++)})}),g}_commitRow(){}get _lastRowNumber(){const u=this._rows;let g=u.length;for(;g>0&&u[g-1]===void 0;)g--;return g}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(u){return this._rows[u-1]}findRows(u,g){return this._rows.slice(u-1,u-1+g)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let u=0;return this.eachRow(()=>{u++}),u}getRow(u){let g=this._rows[u-1];return g||(g=this._rows[u-1]=new r(this,u)),g}getRows(u,g){if(g<1)return;const m=[];for(let v=u;v<u+g;v++)m.push(this.getRow(v));return m}addRow(u){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"n";const m=this._nextRow,v=this.getRow(m);return v.values=u,this._setStyleOption(m,g[0]==="i"?g:"n"),v}addRows(u){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"n";const m=[];return u.forEach(v=>{m.push(this.addRow(v,g))}),m}insertRow(u,g){let m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"n";return this.spliceRows(u,0,g),this._setStyleOption(u,m),this.getRow(u)}insertRows(u,g){let m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"n";if(this.spliceRows(u,0,...g),m!=="n")for(let v=0;v<g.length;v++)m[0]==="o"&&this.findRow(g.length+u+v)!==void 0?this._copyStyle(g.length+u+v,u+v,m[1]==="+"):m[0]==="i"&&this.findRow(u-1)!==void 0&&this._copyStyle(u-1,u+v,m[1]==="+");return this.getRows(u,g.length)}_setStyleOption(u){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"n";g[0]==="o"&&this.findRow(u+1)!==void 0?this._copyStyle(u+1,u,g[1]==="+"):g[0]==="i"&&this.findRow(u-1)!==void 0&&this._copyStyle(u-1,u,g[1]==="+")}_copyStyle(u,g){let m=arguments.length>2&&arguments[2]!==void 0&&arguments[2];const v=this.getRow(u),S=this.getRow(g);S.style=p(v.style),v.eachCell({includeEmpty:m},(R,I)=>{S.getCell(I).style=p(R.style)}),S.height=v.height}duplicateRow(u,g){let m=arguments.length>2&&arguments[2]!==void 0&&arguments[2];const v=this._rows[u-1],S=new Array(g).fill(v.values);this.spliceRows(u+1,m?0:g,...S);for(let R=0;R<g;R++){const I=this._rows[u+R];I.style=v.style,I.height=v.height,v.eachCell({includeEmpty:!0},(F,j)=>{I.getCell(j).style=F.style})}}spliceRows(u,g){const m=u+g;for(var v=arguments.length,S=new Array(v>2?v-2:0),R=2;R<v;R++)S[R-2]=arguments[R];const I=S.length,F=I-g,j=this._rows.length;let L,$;if(F<0)for(u===j&&(this._rows[j-1]=void 0),L=m;L<=j;L++)if($=this._rows[L-1],$){const V=this.getRow(L+F);V.values=$.values,V.style=$.style,V.height=$.height,$.eachCell({includeEmpty:!0},(z,E)=>{V.getCell(E).style=z.style}),this._rows[L-1]=void 0}else this._rows[L+F-1]=void 0;else if(F>0)for(L=j;L>=m;L--)if($=this._rows[L-1],$){const V=this.getRow(L+F);V.values=$.values,V.style=$.style,V.height=$.height,$.eachCell({includeEmpty:!0},(z,E)=>{if(V.getCell(E).style=z.style,z._value.constructor.name==="MergeValue"){const A=this.getRow(z._row._number+I).getCell(E),k=z._value._master,b=this.getRow(k._row._number+I).getCell(k._column._number);A.merge(b)}})}else this._rows[L+F-1]=void 0;for(L=0;L<I;L++){const V=this.getRow(u+L);V.style={},V.values=S[L]}this.workbook.definedNames.spliceRows(this.name,u,g,I)}eachRow(u,g){if(g||(g=u,u=void 0),u&&u.includeEmpty){const m=this._rows.length;for(let v=1;v<=m;v++)g(this.getRow(v),v)}else this._rows.forEach(m=>{m&&m.hasValues&&g(m,m.number)})}getSheetValues(){const u=[];return this._rows.forEach(g=>{g&&(u[g.number]=g.values)}),u}findCell(u,g){const m=i.getAddress(u,g),v=this._rows[m.row-1];return v?v.findCell(m.col):void 0}getCell(u,g){const m=i.getAddress(u,g);return this.getRow(m.row).getCellEx(m)}mergeCells(){for(var u=arguments.length,g=new Array(u),m=0;m<u;m++)g[m]=arguments[m];const v=new o(g);this._mergeCellsInternal(v)}mergeCellsWithoutStyle(){for(var u=arguments.length,g=new Array(u),m=0;m<u;m++)g[m]=arguments[m];const v=new o(g);this._mergeCellsInternal(v,!0)}_mergeCellsInternal(u,g){l.each(this._merges,v=>{if(v.intersects(u))throw new Error("Cannot merge already merged cells")});const m=this.getCell(u.top,u.left);for(let v=u.top;v<=u.bottom;v++)for(let S=u.left;S<=u.right;S++)(v>u.top||S>u.left)&&this.getCell(v,S).merge(m,g);this._merges[m.address]=u}_unMergeMaster(u){const g=this._merges[u.address];if(g){for(let m=g.top;m<=g.bottom;m++)for(let v=g.left;v<=g.right;v++)this.getCell(m,v).unmerge();delete this._merges[u.address]}}get hasMerges(){return l.some(this._merges,Boolean)}unMergeCells(){for(var u=arguments.length,g=new Array(u),m=0;m<u;m++)g[m]=arguments[m];const v=new o(g);for(let S=v.top;S<=v.bottom;S++)for(let R=v.left;R<=v.right;R++){const I=this.findCell(S,R);I&&(I.type===n.ValueType.Merge?this._unMergeMaster(I.master):this._merges[I.address]&&this._unMergeMaster(I))}}fillFormula(u,g,m){let v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"shared";const S=i.decode(u),{top:R,left:I,bottom:F,right:j}=S,L=j-I+1,$=i.encodeAddress(R,I),V=v==="shared";let z;z=typeof m=="function"?m:Array.isArray(m)?Array.isArray(m[0])?(A,k)=>m[A-R][k-I]:(A,k)=>m[(A-R)*L+(k-I)]:()=>{};let E=!0;for(let A=R;A<=F;A++)for(let k=I;k<=j;k++)E?(this.getCell(A,k).value={shareType:v,formula:g,ref:u,result:z(A,k)},E=!1):this.getCell(A,k).value=V?{sharedFormula:$,result:z(A,k)}:z(A,k)}addImage(u,g){const m={type:"image",imageId:u,range:g};this._media.push(new c(this,m))}getImages(){return this._media.filter(u=>u.type==="image")}addBackgroundImage(u){const g={type:"background",imageId:u};this._media.push(new c(this,g))}getBackgroundImageId(){const u=this._media.find(g=>g.type==="background");return u&&u.imageId}protect(u,g){return new Promise(m=>{this.sheetProtection={sheet:!0},g&&"spinCount"in g&&(g.spinCount=Number.isFinite(g.spinCount)?Math.round(Math.max(0,g.spinCount)):1e5),u&&(this.sheetProtection.algorithmName="SHA-512",this.sheetProtection.saltValue=f.randomBytes(16).toString("base64"),this.sheetProtection.spinCount=g&&"spinCount"in g?g.spinCount:1e5,this.sheetProtection.hashValue=f.convertPasswordToHash(u,"SHA512",this.sheetProtection.saltValue,this.sheetProtection.spinCount)),g&&(this.sheetProtection=Object.assign(this.sheetProtection,g),!u&&"spinCount"in g&&delete this.sheetProtection.spinCount),m()})}unprotect(){this.sheetProtection=null}addTable(u){const g=new a(this,u);return this.tables[u.name]=g,g}getTable(u){return this.tables[u]}removeTable(u){delete this.tables[u]}getTables(){return Object.values(this.tables)}addConditionalFormatting(u){this.conditionalFormattings.push(u)}removeConditionalFormatting(u){typeof u=="number"?this.conditionalFormattings.splice(u,1):this.conditionalFormattings=u instanceof Function?this.conditionalFormattings.filter(u):[]}get tabColor(){return console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor}set tabColor(u){console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor=u}get model(){const u={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(v=>v.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(v=>v.model),conditionalFormattings:this.conditionalFormattings};u.cols=e.toModel(this.columns);const g=u.rows=[],m=u.dimensions=new o;return this._rows.forEach(v=>{const S=v&&v.model;S&&(m.expand(S.number,S.min,S.number,S.max),g.push(S))}),u.merges=[],l.each(this._merges,v=>{u.merges.push(v.range)}),u}_parseRows(u){this._rows=[],u.rows.forEach(g=>{const m=new r(this,g.number);this._rows[m.number-1]=m,m.model=g})}_parseMergeCells(u){l.each(u.mergeCells,g=>{this.mergeCellsWithoutStyle(g)})}set model(u){this.name=u.name,this._columns=e.fromModel(this,u.cols),this._parseRows(u),this._parseMergeCells(u),this.dataValidations=new s(u.dataValidations),this.properties=u.properties,this.pageSetup=u.pageSetup,this.headerFooter=u.headerFooter,this.views=u.views,this.autoFilter=u.autoFilter,this._media=u.media.map(g=>new c(this,g)),this.sheetProtection=u.sheetProtection,this.tables=u.tables.reduce((g,m)=>{const v=new a;return v.model=m,g[m.name]=v,g},{}),this.conditionalFormattings=u.conditionalFormattings}}},{"../utils/col-cache":19,"../utils/copy-style":20,"../utils/encryptor":21,"../utils/under-dash":26,"./column":4,"./data-validations":5,"./enums":7,"./image":8,"./range":10,"./row":11,"./table":12}],15:[function(t,h,d){t("core-js/modules/es.promise"),t("core-js/modules/es.promise.finally"),t("core-js/modules/es.object.assign"),t("core-js/modules/es.object.keys"),t("core-js/modules/es.object.values"),t("core-js/modules/es.symbol"),t("core-js/modules/es.symbol.async-iterator"),t("core-js/modules/es.array.iterator"),t("core-js/modules/es.array.includes"),t("core-js/modules/es.array.find-index"),t("core-js/modules/es.array.find"),t("core-js/modules/es.string.from-code-point"),t("core-js/modules/es.string.includes"),t("core-js/modules/es.number.is-nan"),t("regenerator-runtime/runtime");const l={Workbook:t("./doc/workbook")},i=t("./doc/enums");Object.keys(i).forEach(o=>{l[o]=i[o]}),h.exports=l},{"./doc/enums":7,"./doc/workbook":13,"core-js/modules/es.array.find":359,"core-js/modules/es.array.find-index":358,"core-js/modules/es.array.includes":360,"core-js/modules/es.array.iterator":361,"core-js/modules/es.number.is-nan":363,"core-js/modules/es.object.assign":364,"core-js/modules/es.object.keys":366,"core-js/modules/es.object.values":367,"core-js/modules/es.promise":372,"core-js/modules/es.promise.finally":371,"core-js/modules/es.string.from-code-point":376,"core-js/modules/es.string.includes":377,"core-js/modules/es.symbol":381,"core-js/modules/es.symbol.async-iterator":378,"regenerator-runtime/runtime":492}],16:[function(t,h,d){const l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");d.bufferToString=function(i){return typeof i=="string"?i:l?l.decode(i):i.toString()}},{}],17:[function(t,h,d){const l=typeof TextEncoder>"u"?null:new TextEncoder("utf-8"),{Buffer:i}=t("buffer");d.stringToBuffer=function(o){return typeof o!="string"?o:l?i.from(l.encode(o).buffer):i.from(o)}},{buffer:220}],18:[function(t,h,d){const l=t("./under-dash"),i=t("./col-cache");h.exports=class{constructor(o){this.template=o,this.sheets={}}addCell(o){this.addCellEx(i.decodeEx(o))}getCell(o){return this.findCellEx(i.decodeEx(o),!0)}findCell(o){return this.findCellEx(i.decodeEx(o),!1)}findCellAt(o,r,e){const n=this.sheets[o],c=n&&n[r];return c&&c[e]}addCellEx(o){if(o.top)for(let r=o.top;r<=o.bottom;r++)for(let e=o.left;e<=o.right;e++)this.getCellAt(o.sheetName,r,e);else this.findCellEx(o,!0)}getCellEx(o){return this.findCellEx(o,!0)}findCellEx(o,r){const e=this.findSheet(o,r),n=this.findSheetRow(e,o,r);return this.findRowCell(n,o,r)}getCellAt(o,r,e){const n=this.sheets[o]||(this.sheets[o]=[]),c=n[r]||(n[r]=[]);return c[e]||(c[e]={sheetName:o,address:i.n2l(e)+r,row:r,col:e})}removeCellEx(o){const r=this.findSheet(o);if(!r)return;const e=this.findSheetRow(r,o);e&&delete e[o.col]}forEachInSheet(o,r){const e=this.sheets[o];e&&e.forEach((n,c)=>{n&&n.forEach((a,s)=>{a&&r(a,c,s)})})}forEach(o){l.each(this.sheets,(r,e)=>{this.forEachInSheet(e,o)})}map(o){const r=[];return this.forEach(e=>{r.push(o(e))}),r}findSheet(o,r){const e=o.sheetName;return this.sheets[e]?this.sheets[e]:r?this.sheets[e]=[]:void 0}findSheetRow(o,r,e){const{row:n}=r;return o&&o[n]?o[n]:e?o[n]=[]:void 0}findRowCell(o,r,e){const{col:n}=r;return o&&o[n]?o[n]:e?o[n]=this.template?Object.assign(r,JSON.parse(JSON.stringify(this.template))):r:void 0}spliceRows(o,r,e,n){const c=this.sheets[o];if(c){const a=[];for(let s=0;s<n;s++)a.push([]);c.splice(r,e,...a)}}spliceColumns(o,r,e,n){const c=this.sheets[o];if(c){const a=[];for(let s=0;s<n;s++)a.push(null);l.each(c,s=>{s.splice(r,e,...a)})}}}},{"./col-cache":19,"./under-dash":26}],19:[function(t,h,d){const l=/^[A-Z]+\d+$/,i={_dictionary:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_l2nFill:0,_l2n:{},_n2l:[],_level:o=>o<=26?1:o<=676?2:3,_fill(o){let r,e,n,c,a,s=1;if(o>=4)throw new Error("Out of bounds. Excel supports columns from 1 to 16384");if(this._l2nFill<1&&o>=1){for(;s<=26;)r=this._dictionary[s-1],this._n2l[s]=r,this._l2n[r]=s,s++;this._l2nFill=1}if(this._l2nFill<2&&o>=2){for(s=27;s<=702;)e=s-27,n=e%26,c=Math.floor(e/26),r=this._dictionary[c]+this._dictionary[n],this._n2l[s]=r,this._l2n[r]=s,s++;this._l2nFill=2}if(this._l2nFill<3&&o>=3){for(s=703;s<=16384;)e=s-703,n=e%26,c=Math.floor(e/26)%26,a=Math.floor(e/676),r=this._dictionary[a]+this._dictionary[c]+this._dictionary[n],this._n2l[s]=r,this._l2n[r]=s,s++;this._l2nFill=3}},l2n(o){if(this._l2n[o]||this._fill(o.length),!this._l2n[o])throw new Error("Out of bounds. Invalid column letter: "+o);return this._l2n[o]},n2l(o){if(o<1||o>16384)throw new Error(o+" is out of bounds. Excel supports columns from 1 to 16384");return this._n2l[o]||this._fill(this._level(o)),this._n2l[o]},_hash:{},validateAddress(o){if(!l.test(o))throw new Error("Invalid Address: "+o);return!0},decodeAddress(o){const r=o.length<5&&this._hash[o];if(r)return r;let e=!1,n="",c=0,a=!1,s="",f=0;for(let u,g=0;g<o.length;g++)if(u=o.charCodeAt(g),!a&&u>=65&&u<=90)e=!0,n+=o[g],c=26*c+u-64;else if(u>=48&&u<=57)a=!0,s+=o[g],f=10*f+u-48;else if(a&&e&&u!==36)break;if(e){if(c>16384)throw new Error("Out of bounds. Invalid column letter: "+n)}else c=void 0;a||(f=void 0);const p={address:o=n+s,col:c,row:f,$col$row:`$${n}$${s}`};return c<=100&&f<=100&&(this._hash[o]=p,this._hash[p.$col$row]=p),p},getAddress(o,r){if(r){const e=this.n2l(r)+o;return this.decodeAddress(e)}return this.decodeAddress(o)},decode(o){const r=o.split(":");if(r.length===2){const e=this.decodeAddress(r[0]),n=this.decodeAddress(r[1]),c={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col)};return c.tl=this.n2l(c.left)+c.top,c.br=this.n2l(c.right)+c.bottom,c.dimensions=`${c.tl}:${c.br}`,c}return this.decodeAddress(o)},decodeEx(o){const r=o.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),e=r[1]||r[2],n=r[3],c=n.split(":");if(c.length>1){let s=this.decodeAddress(c[0]),f=this.decodeAddress(c[1]);const p=Math.min(s.row,f.row),u=Math.min(s.col,f.col),g=Math.max(s.row,f.row),m=Math.max(s.col,f.col);return s=this.n2l(u)+p,f=this.n2l(m)+g,{top:p,left:u,bottom:g,right:m,sheetName:e,tl:{address:s,col:u,row:p,$col$row:`$${this.n2l(u)}$${p}`,sheetName:e},br:{address:f,col:m,row:g,$col$row:`$${this.n2l(m)}$${g}`,sheetName:e},dimensions:`${s}:${f}`}}if(n.startsWith("#"))return e?{sheetName:e,error:n}:{error:n};const a=this.decodeAddress(n);return e?{sheetName:e,...a}:a},encodeAddress:(o,r)=>i.n2l(r)+o,encode(){switch(arguments.length){case 2:return i.encodeAddress(arguments[0],arguments[1]);case 4:return`${i.encodeAddress(arguments[0],arguments[1])}:${i.encodeAddress(arguments[2],arguments[3])}`;default:throw new Error("Can only encode with 2 or 4 arguments")}},inRange(o,r){const[e,n,,c,a]=o,[s,f]=r;return s>=e&&s<=c&&f>=n&&f<=a}};h.exports=i},{}],20:[function(t,h,d){const l=(o,r)=>({...o,...r.reduce((e,n)=>(o[n]&&(e[n]={...o[n]}),e),{})}),i=function(o,r,e){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];o[e]&&(r[e]=l(o[e],n))};d.copyStyle=o=>{if(!o)return o;if(r=o,Object.keys(r).length===0)return{};var r;const e={...o};return i(o,e,"font",["color"]),i(o,e,"alignment"),i(o,e,"protection"),o.border&&(i(o,e,"border"),i(o.border,e.border,"top",["color"]),i(o.border,e.border,"left",["color"]),i(o.border,e.border,"bottom",["color"]),i(o.border,e.border,"right",["color"]),i(o.border,e.border,"diagonal",["color"])),o.fill&&(i(o,e,"fill",["fgColor","bgColor","center"]),o.fill.stops&&(e.fill.stops=o.fill.stops.map(n=>l(n,["color"])))),e}},{}],21:[function(t,h,d){(function(l){(function(){const i=t("crypto"),o={hash(r){const e=i.createHash(r);for(var n=arguments.length,c=new Array(n>1?n-1:0),a=1;a<n;a++)c[a-1]=arguments[a];return e.update(l.concat(c)),e.digest()},convertPasswordToHash(r,e,n,c){if(e=e.toLowerCase(),i.getHashes().indexOf(e)<0)throw new Error(`Hash algorithm '${e}' not supported!`);const a=l.from(r,"utf16le");let s=this.hash(e,l.from(n,"base64"),a);for(let f=0;f<c;f++){const p=l.alloc(4);p.writeUInt32LE(f,0),s=this.hash(e,s,p)}return s.toString("base64")},randomBytes:r=>i.randomBytes(r)};h.exports=o}).call(this)}).call(this,t("buffer").Buffer)},{buffer:220,crypto:390}],22:[function(t,h,d){const{SaxesParser:l}=t("saxes"),{PassThrough:i}=t("readable-stream"),{bufferToString:o}=t("./browser-buffer-decode");h.exports=async function*(r){r.pipe&&!r[Symbol.asyncIterator]&&(r=r.pipe(new i));const e=new l;let n;e.on("error",a=>{n=a});let c=[];e.on("opentag",a=>c.push({eventType:"opentag",value:a})),e.on("text",a=>c.push({eventType:"text",value:a})),e.on("closetag",a=>c.push({eventType:"closetag",value:a}));for await(const a of r){if(e.write(o(a)),n)throw n;yield c,c=[]}}},{"./browser-buffer-decode":16,"readable-stream":491,saxes:496}],23:[function(t,h,d){const l=t("./col-cache"),i=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,o=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;h.exports={slideFormula:function(r,e,n){const c=l.decode(e),a=l.decode(n);return r.replace(i,(s,f,p,u,g)=>{if(g)return s;const m=o.exec(u);if(m){const v=m[1],S=m[2].toUpperCase(),R=m[3],I=m[4];if(S.length>3||S.length===3&&S>"XFD")return s;let F=l.l2n(S),j=parseInt(I,10);return v||(F+=a.col-c.col),R||(j+=a.row-c.row),(f||"")+(v||"")+l.n2l(F)+(R||"")+j}return s})}}},{"./col-cache":19}],24:[function(t,h,d){(function(l,i){(function(){const o=t("readable-stream"),r=t("./utils"),e=t("./string-buf");class n{constructor(u,g){this._data=u,this._encoding=g}get length(){return this.toBuffer().length}copy(u,g,m,v){return this.toBuffer().copy(u,g,m,v)}toBuffer(){return this._buffer||(this._buffer=i.from(this._data,this._encoding)),this._buffer}}class c{constructor(u){this._data=u}get length(){return this._data.length}copy(u,g,m,v){return this._data._buf.copy(u,g,m,v)}toBuffer(){return this._data.toBuffer()}}class a{constructor(u){this._data=u}get length(){return this._data.length}copy(u,g,m,v){this._data.copy(u,g,m,v)}toBuffer(){return this._data}}class s{constructor(u){this.size=u,this.buffer=i.alloc(u),this.iRead=0,this.iWrite=0}toBuffer(){if(this.iRead===0&&this.iWrite===this.size)return this.buffer;const u=i.alloc(this.iWrite-this.iRead);return this.buffer.copy(u,0,this.iRead,this.iWrite),u}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(u){let g;return u===0?null:u===void 0||u>=this.length?(g=this.toBuffer(),this.iRead=this.iWrite,g):(g=i.alloc(u),this.buffer.copy(g,0,this.iRead,u),this.iRead+=u,g)}write(u,g,m){const v=Math.min(m,this.size-this.iWrite);return u.copy(this.buffer,this.iWrite,g,g+v),this.iWrite+=v,v}}const f=function(p){p=p||{},this.bufSize=p.bufSize||1048576,this.buffers=[],this.batch=p.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};r.inherits(f,o.Duplex,{toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return i.concat(this.buffers.map(p=>p.toBuffer()))}},_getWritableBuffer(){if(this.buffers.length){const u=this.buffers[this.buffers.length-1];if(!u.full)return u}const p=new s(this.bufSize);return this.buffers.push(p),p},async _pipe(p){await Promise.all(this.pipes.map(function(u){return new Promise(g=>{u.write(p.toBuffer(),()=>{g()})})}))},_writeToBuffers(p){let u=0;const g=p.length;for(;u<g;)u+=this._getWritableBuffer().write(p,u,g-u)},async write(p,u,g){let m;if(u instanceof Function&&(g=u,u="utf8"),g=g||r.nop,p instanceof e)m=new c(p);else if(p instanceof i)m=new a(p);else{if(!(typeof p=="string"||p instanceof String||p instanceof ArrayBuffer))throw new Error("Chunk must be one of type String, Buffer or StringBuf.");m=new n(p,u)}if(this.pipes.length)if(this.batch)for(this._writeToBuffers(m);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(m),l.nextTick(g)):(await this._pipe(m),g());else this.paused||this.emit("data",m.toBuffer()),this._writeToBuffers(m),this.emit("readable");return!0},cork(){this.corked=!0},_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork(){this.corked=!1,this._flush()},end(p,u,g){const m=v=>{v?g(v):(this._flush(),this.pipes.forEach(S=>{S.end()}),this.emit("finish"))};p?this.write(p,u,m):m()},read(p){let u;if(p){for(u=[];p&&this.buffers.length&&!this.buffers[0].eod;){const g=this.buffers[0],m=g.read(p);p-=m.length,u.push(m),g.eod&&g.full&&this.buffers.shift()}return i.concat(u)}return u=this.buffers.map(g=>g.toBuffer()).filter(Boolean),this.buffers=[],i.concat(u)},setEncoding(p){this.encoding=p},pause(){this.paused=!0},resume(){this.paused=!1},isPaused(){return!!this.paused},pipe(p){this.pipes.push(p),!this.paused&&this.buffers.length&&this.end()},unpipe(p){this.pipes=this.pipes.filter(u=>u!==p)},unshift(){throw new Error("Not Implemented")},wrap(){throw new Error("Not Implemented")}}),h.exports=f}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{"./string-buf":25,"./utils":27,_process:467,buffer:220,"readable-stream":491}],25:[function(t,h,d){(function(l){(function(){h.exports=class{constructor(i){this._buf=l.alloc(i&&i.size||16384),this._encoding=i&&i.encoding||"utf8",this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||(this._buffer=l.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer}reset(i){i=i||0,this._buffer=void 0,this._inPos=i}_grow(i){let o=2*this._buf.length;for(;o<i;)o*=2;const r=l.alloc(o);this._buf.copy(r,0),this._buf=r}addText(i){this._buffer=void 0;let o=this._inPos+this._buf.write(i,this._inPos,this._encoding);for(;o>=this._buf.length-4;)this._grow(this._inPos+i.length),o=this._inPos+this._buf.write(i,this._inPos,this._encoding);this._inPos=o}addStringBuf(i){i.length&&(this._buffer=void 0,this.length+i.length>this.capacity&&this._grow(this.length+i.length),i._buf.copy(this._buf,this._inPos,0,i.length),this._inPos+=i.length)}}}).call(this)}).call(this,t("buffer").Buffer)},{buffer:220}],26:[function(t,h,d){const{toString:l}=Object.prototype,i=/["&<>]/,o={each:function(r,e){r&&(Array.isArray(r)?r.forEach(e):Object.keys(r).forEach(n=>{e(r[n],n)}))},some:function(r,e){return!!r&&(Array.isArray(r)?r.some(e):Object.keys(r).some(n=>e(r[n],n)))},every:function(r,e){return!r||(Array.isArray(r)?r.every(e):Object.keys(r).every(n=>e(r[n],n)))},map:function(r,e){return r?Array.isArray(r)?r.map(e):Object.keys(r).map(n=>e(r[n],n)):[]},keyBy:(r,e)=>r.reduce((n,c)=>(n[c[e]]=c,n),{}),isEqual:function(r,e){const n=typeof r,c=typeof e,a=Array.isArray(r),s=Array.isArray(e);let f;if(n!==c)return!1;switch(typeof r){case"object":if(a||s)return!(!a||!s)&&r.length===e.length&&r.every((p,u)=>{const g=e[u];return o.isEqual(p,g)});if(r===null||e===null)return r===e;if(f=Object.keys(r),Object.keys(e).length!==f.length)return!1;for(const p of f)if(!e.hasOwnProperty(p))return!1;return o.every(r,(p,u)=>{const g=e[u];return o.isEqual(p,g)});default:return r===e}},escapeHtml(r){const e=i.exec(r);if(!e)return r;let n="",c="",a=0,s=e.index;for(;s<r.length;s++){switch(r.charAt(s)){case'"':c="&quot;";break;case"&":c="&amp;";break;case"'":c="&apos;";break;case"<":c="&lt;";break;case">":c="&gt;";break;default:continue}a!==s&&(n+=r.substring(a,s)),a=s+1,n+=c}return a!==s?n+r.substring(a,s):n},strcmp:(r,e)=>r<e?-1:r>e?1:0,isUndefined:r=>l.call(r)==="[object Undefined]",isObject:r=>l.call(r)==="[object Object]",deepMerge(){const r=arguments[0]||{},{length:e}=arguments;let n,c,a;function s(f,p){n=r[p],a=Array.isArray(f),o.isObject(f)||a?(a?(a=!1,c=n&&Array.isArray(n)?n:[]):c=n&&o.isObject(n)?n:{},r[p]=o.deepMerge(c,f)):o.isUndefined(f)||(r[p]=f)}for(let f=0;f<e;f++)o.each(arguments[f],s);return r}};h.exports=o},{}],27:[function(t,h,d){(function(l,i){(function(){const o=t("fs"),r=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/,e={nop(){},promiseImmediate:n=>new Promise(c=>{l.setImmediate?i(()=>{c(n)}):setTimeout(()=>{c(n)},1)}),inherits:function(n,c,a,s){n.super_=c,s||(s=a,a=null),a&&Object.keys(a).forEach(p=>{Object.defineProperty(n,p,Object.getOwnPropertyDescriptor(a,p))});const f={constructor:{value:n,enumerable:!1,writable:!1,configurable:!0}};s&&Object.keys(s).forEach(p=>{f[p]=Object.getOwnPropertyDescriptor(s,p)}),n.prototype=Object.create(c.prototype,f)},dateToExcel:(n,c)=>25569+n.getTime()/864e5-(c?1462:0),excelToDate(n,c){const a=Math.round(24*(n-25569+(c?1462:0))*3600*1e3);return new Date(a)},parsePath(n){const c=n.lastIndexOf("/");return{path:n.substring(0,c),name:n.substring(c+1)}},getRelsPath(n){const c=e.parsePath(n);return`${c.path}/_rels/${c.name}.rels`},xmlEncode(n){const c=r.exec(n);if(!c)return n;let a="",s="",f=0,p=c.index;for(;p<n.length;p++){const u=n.charCodeAt(p);switch(u){case 34:s="&quot;";break;case 38:s="&amp;";break;case 39:s="&apos;";break;case 60:s="&lt;";break;case 62:s="&gt;";break;case 127:s="";break;default:if(u<=31&&(u<=8||u>=11&&u!==13)){s="";break}continue}f!==p&&(a+=n.substring(f,p)),f=p+1,s&&(a+=s)}return f!==p?a+n.substring(f,p):a},xmlDecode:n=>n.replace(/&([a-z]*);/g,c=>{switch(c){case"&lt;":return"<";case"&gt;":return">";case"&amp;":return"&";case"&apos;":return"'";case"&quot;":return'"';default:return c}}),validInt(n){const c=parseInt(n,10);return Number.isNaN(c)?0:c},isDateFmt(n){return n?(n=(n=n.replace(/\[[^\]]*]/g,"")).replace(/"[^"]*"/g,"")).match(/[ymdhMsb]+/)!==null:!1},fs:{exists:n=>new Promise(c=>{o.access(n,o.constants.F_OK,a=>{c(!a)})})},toIsoDateString:n=>n.toIsoString().subsstr(0,10),parseBoolean:n=>n===!0||n==="true"||n===1||n==="1"};h.exports=e}).call(this)}).call(this,typeof ie<"u"?ie:typeof self<"u"?self:typeof window<"u"?window:{},t("timers").setImmediate)},{fs:216,timers:523}],28:[function(t,h,d){const l=t("./under-dash"),i=t("./utils");function o(n,c,a){n.push(` ${c}="${i.xmlEncode(a.toString())}"`)}function r(n,c){if(c){const a=[];l.each(c,(s,f)=>{s!==void 0&&o(a,f,s)}),n.push(a.join(""))}}class e{constructor(){this._xml=[],this._stack=[],this._rollbacks=[]}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._xml.length}openXml(c){const a=this._xml;a.push("<?xml"),r(a,c),a.push(`?>
19
19
  `)}openNode(c,a){const s=this.tos,f=this._xml;s&&this.open&&f.push(">"),this._stack.push(c),f.push("<"),f.push(c),r(f,a),this.leaf=!0,this.open=!0}addAttribute(c,a){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");a!==void 0&&o(this._xml,c,a)}addAttributes(c){if(!this.open)throw new Error("Cannot write attributes to node if it is not open");r(this._xml,c)}writeText(c){const a=this._xml;this.open&&(a.push(">"),this.open=!1),this.leaf=!1,a.push(i.xmlEncode(c.toString()))}writeXml(c){this.open&&(this._xml.push(">"),this.open=!1),this.leaf=!1,this._xml.push(c)}closeNode(){const c=this._stack.pop(),a=this._xml;this.leaf?a.push("/>"):(a.push("</"),a.push(c),a.push(">")),this.open=!1,this.leaf=!1}leafNode(c,a,s){this.openNode(c,a),s!==void 0&&this.writeText(s),this.closeNode()}closeAll(){for(;this._stack.length;)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){const c=this._rollbacks.pop();this._xml.length>c.xml&&this._xml.splice(c.xml,this._xml.length-c.xml),this._stack.length>c.stack&&this._stack.splice(c.stack,this._stack.length-c.stack),this.leaf=c.leaf,this.open=c.open}get xml(){return this.closeAll(),this._xml.join("")}}e.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"},h.exports=e},{"./under-dash":26,"./utils":27}],29:[function(t,h,d){(function(l){(function(){const i=t("events"),o=t("jszip"),r=t("./stream-buf"),{stringToBuffer:e}=t("./browser-buffer-encode");class n extends i.EventEmitter{constructor(a){super(),this.options=Object.assign({type:"nodebuffer",compression:"DEFLATE"},a),this.zip=new o,this.stream=new r}append(a,s){s.hasOwnProperty("base64")&&s.base64?this.zip.file(s.name,a,{base64:!0}):(l.browser&&typeof a=="string"&&(a=e(a)),this.zip.file(s.name,a))}async finalize(){const a=await this.zip.generateAsync(this.options);this.stream.end(a),this.emit("finish")}read(a){return this.stream.read(a)}setEncoding(a){return this.stream.setEncoding(a)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(a,s){return this.stream.pipe(a,s)}unpipe(a){return this.stream.unpipe(a)}unshift(a){return this.stream.unshift(a)}wrap(a){return this.stream.wrap(a)}}h.exports={ZipWriter:n}}).call(this)}).call(this,t("_process"))},{"./browser-buffer-encode":17,"./stream-buf":24,_process:467,events:422,jszip:441}],30:[function(t,h,d){h.exports={0:{f:"General"},1:{f:"0"},2:{f:"0.00"},3:{f:"#,##0"},4:{f:"#,##0.00"},9:{f:"0%"},10:{f:"0.00%"},11:{f:"0.00E+00"},12:{f:"# ?/?"},13:{f:"# ??/??"},14:{f:"mm-dd-yy"},15:{f:"d-mmm-yy"},16:{f:"d-mmm"},17:{f:"mmm-yy"},18:{f:"h:mm AM/PM"},19:{f:"h:mm:ss AM/PM"},20:{f:"h:mm"},21:{f:"h:mm:ss"},22:{f:'m/d/yy "h":mm'},27:{"zh-tw":"[$-404]e/m/d","zh-cn":'yyyy"年"m"月"',"ja-jp":"[$-411]ge.m.d","ko-kr":'yyyy"年" mm"月" dd"日"'},28:{"zh-tw":'[$-404]e"年"m"月"d"日"',"zh-cn":'m"月"d"日"',"ja-jp":'[$-411]ggge"年"m"月"d"日"',"ko-kr":"mm-dd"},29:{"zh-tw":'[$-404]e"年"m"月"d"日"',"zh-cn":'m"月"d"日"',"ja-jp":'[$-411]ggge"年"m"月"d"日"',"ko-kr":"mm-dd"},30:{"zh-tw":"m/d/yy ","zh-cn":"m-d-yy","ja-jp":"m/d/yy","ko-kr":"mm-dd-yy"},31:{"zh-tw":'yyyy"年"m"月"d"日"',"zh-cn":'yyyy"年"m"月"d"日"',"ja-jp":'yyyy"年"m"月"d"日"',"ko-kr":'yyyy"년" mm"월" dd"일"'},32:{"zh-tw":'hh"時"mm"分"',"zh-cn":'h"时"mm"分"',"ja-jp":'h"時"mm"分"',"ko-kr":'h"시" mm"분"'},33:{"zh-tw":'hh"時"mm"分"ss"秒"',"zh-cn":'h"时"mm"分"ss"秒"',"ja-jp":'h"時"mm"分"ss"秒"',"ko-kr":'h"시" mm"분" ss"초"'},34:{"zh-tw":'上午/下午 hh"時"mm"分"',"zh-cn":'上午/下午 h"时"mm"分"',"ja-jp":'yyyy"年"m"月"',"ko-kr":"yyyy-mm-dd"},35:{"zh-tw":'上午/下午 hh"時"mm"分"ss"秒"',"zh-cn":'上午/下午 h"时"mm"分"ss"秒"',"ja-jp":'m"月"d"日"',"ko-kr":"yyyy-mm-dd"},36:{"zh-tw":"[$-404]e/m/d","zh-cn":'yyyy"年"m"月"',"ja-jp":"[$-411]ge.m.d","ko-kr":'yyyy"年" mm"月" dd"日"'},37:{f:"#,##0 ;(#,##0)"},38:{f:"#,##0 ;[Red](#,##0)"},39:{f:"#,##0.00 ;(#,##0.00)"},40:{f:"#,##0.00 ;[Red](#,##0.00)"},45:{f:"mm:ss"},46:{f:"[h]:mm:ss"},47:{f:"mmss.0"},48:{f:"##0.0E+0"},49:{f:"@"},50:{"zh-tw":"[$-404]e/m/d","zh-cn":'yyyy"年"m"月"',"ja-jp":"[$-411]ge.m.d","ko-kr":'yyyy"年" mm"月" dd"日"'},51:{"zh-tw":'[$-404]e"年"m"月"d"日"',"zh-cn":'m"月"d"日"',"ja-jp":'[$-411]ggge"年"m"月"d"日"',"ko-kr":"mm-dd"},52:{"zh-tw":'上午/下午 hh"時"mm"分"',"zh-cn":'yyyy"年"m"月"',"ja-jp":'yyyy"年"m"月"',"ko-kr":"yyyy-mm-dd"},53:{"zh-tw":'上午/下午 hh"時"mm"分"ss"秒"',"zh-cn":'m"月"d"日"',"ja-jp":'m"月"d"日"',"ko-kr":"yyyy-mm-dd"},54:{"zh-tw":'[$-404]e"年"m"月"d"日"',"zh-cn":'m"月"d"日"',"ja-jp":'[$-411]ggge"年"m"月"d"日"',"ko-kr":"mm-dd"},55:{"zh-tw":'上午/下午 hh"時"mm"分"',"zh-cn":'上午/下午 h"时"mm"分"',"ja-jp":'yyyy"年"m"月"',"ko-kr":"yyyy-mm-dd"},56:{"zh-tw":'上午/下午 hh"時"mm"分"ss"秒"',"zh-cn":'上午/下午 h"时"mm"分"ss"秒"',"ja-jp":'m"月"d"日"',"ko-kr":"yyyy-mm-dd"},57:{"zh-tw":"[$-404]e/m/d","zh-cn":'yyyy"年"m"月"',"ja-jp":"[$-411]ge.m.d","ko-kr":'yyyy"年" mm"月" dd"日"'},58:{"zh-tw":'[$-404]e"年"m"月"d"日"',"zh-cn":'m"月"d"日"',"ja-jp":'[$-411]ggge"年"m"月"d"日"',"ko-kr":"mm-dd"},59:{"th-th":"t0"},60:{"th-th":"t0.00"},61:{"th-th":"t#,##0"},62:{"th-th":"t#,##0.00"},67:{"th-th":"t0%"},68:{"th-th":"t0.00%"},69:{"th-th":"t# ?/?"},70:{"th-th":"t# ??/??"},81:{"th-th":"d/m/bb"}}},{}],31:[function(t,h,d){h.exports={OfficeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",Worksheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",CalcChain:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain",SharedStrings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",Image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",CoreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",ExtenderProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",Comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",VmlDrawing:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Table:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"}},{}],32:[function(t,h,d){const l=t("../../utils/parse-sax"),i=t("../../utils/xml-stream");class o{prepare(){}render(){}parseOpen(e){}parseText(e){}parseClose(e){}reconcile(e,n){}reset(){this.model=null,this.map&&Object.values(this.map).forEach(e=>{e instanceof o?e.reset():e.xform&&e.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){for await(const n of e)for(const{eventType:c,value:a}of n)if(c==="opentag")this.parseOpen(a);else if(c==="text")this.parseText(a);else if(c==="closetag"&&!this.parseClose(a.name))return this.model;return this.model}async parseStream(e){return this.parse(l(e))}get xml(){return this.toXml(this.model)}toXml(e){const n=new i;return this.render(n,e),n.xml}static toAttribute(e,n){let c=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(e===void 0){if(c)return n}else if(c||e!==n)return e.toString()}static toStringAttribute(e,n){let c=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return o.toAttribute(e,n,c)}static toStringValue(e,n){return e===void 0?n:e}static toBoolAttribute(e,n){let c=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(e===void 0){if(c)return n}else if(c||e!==n)return e?"1":"0"}static toBoolValue(e,n){return e===void 0?n:e==="1"}static toIntAttribute(e,n){let c=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return o.toAttribute(e,n,c)}static toIntValue(e,n){return e===void 0?n:parseInt(e,10)}static toFloatAttribute(e,n){let c=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return o.toAttribute(e,n,c)}static toFloatValue(e,n){return e===void 0?n:parseFloat(e)}}h.exports=o},{"../../utils/parse-sax":22,"../../utils/xml-stream":28}],33:[function(t,h,d){const l=t("../base-xform"),i=t("../../../utils/col-cache");function o(e){try{return i.decodeEx(e),!0}catch{return!1}}function r(e){const n=[];let c=!1,a="";return e.split(",").forEach(s=>{if(!s)return;const f=(s.match(/'/g)||[]).length;if(!f)return void(c?a+=s+",":o(s)&&n.push(s));const p=f%2==0;!c&&p&&o(s)?n.push(s):c&&!p?(c=!1,o(a+s)&&n.push(a+s),a=""):(c=!0,a+=s+",")}),n}h.exports=class extends l{render(e,n){e.openNode("definedName",{name:n.name,localSheetId:n.localSheetId}),e.writeText(n.ranges.join(",")),e.closeNode()}parseOpen(e){switch(e.name){case"definedName":return this._parsedName=e.attributes.name,this._parsedLocalSheetId=e.attributes.localSheetId,this._parsedText=[],!0;default:return!1}}parseText(e){this._parsedText.push(e)}parseClose(){return this.model={name:this._parsedName,ranges:r(this._parsedText.join(""))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}}},{"../../../utils/col-cache":19,"../base-xform":32}],34:[function(t,h,d){const l=t("../../../utils/utils"),i=t("../base-xform");h.exports=class extends i{render(o,r){o.leafNode("sheet",{sheetId:r.id,name:r.name,state:r.state,"r:id":r.rId})}parseOpen(o){return o.name==="sheet"&&(this.model={name:l.xmlDecode(o.attributes.name),id:parseInt(o.attributes.sheetId,10),state:o.attributes.state,rId:o.attributes["r:id"]},!0)}parseText(){}parseClose(){return!1}}},{"../../../utils/utils":27,"../base-xform":32}],35:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{render(i,o){i.leafNode("calcPr",{calcId:171027,fullCalcOnLoad:o.fullCalcOnLoad?1:void 0})}parseOpen(i){return i.name==="calcPr"&&(this.model={},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],36:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{render(i,o){i.leafNode("workbookPr",{date1904:o.date1904?1:void 0,defaultThemeVersion:164011,filterPrivacy:1})}parseOpen(i){return i.name==="workbookPr"&&(this.model={date1904:i.attributes.date1904==="1"},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],37:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{render(i,o){const r={xWindow:o.x||0,yWindow:o.y||0,windowWidth:o.width||12e3,windowHeight:o.height||24e3,firstSheet:o.firstSheet,activeTab:o.activeTab};o.visibility&&o.visibility!=="visible"&&(r.visibility=o.visibility),i.leafNode("workbookView",r)}parseOpen(i){if(i.name==="workbookView"){const o=this.model={},r=function(n,c,a){const s=c!==void 0?o[n]=c:a;s!==void 0&&(o[n]=s)},e=function(n,c,a){const s=c!==void 0?o[n]=parseInt(c,10):a;s!==void 0&&(o[n]=s)};return e("x",i.attributes.xWindow,0),e("y",i.attributes.yWindow,0),e("width",i.attributes.windowWidth,25e3),e("height",i.attributes.windowHeight,1e4),r("visibility",i.attributes.visibility,"visible"),e("activeTab",i.attributes.activeTab,void 0),e("firstSheet",i.attributes.firstSheet,void 0),!0}return!1}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],38:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../../../utils/col-cache"),o=t("../../../utils/xml-stream"),r=t("../base-xform"),e=t("../static-xform"),n=t("../list-xform"),c=t("./defined-name-xform"),a=t("./sheet-xform"),s=t("./workbook-view-xform"),f=t("./workbook-properties-xform"),p=t("./workbook-calc-properties-xform");class u extends r{constructor(){super(),this.map={fileVersion:u.STATIC_XFORMS.fileVersion,workbookPr:new f,bookViews:new n({tag:"bookViews",count:!1,childXform:new s}),sheets:new n({tag:"sheets",count:!1,childXform:new a}),definedNames:new n({tag:"definedNames",count:!1,childXform:new c}),calcPr:new p}}prepare(m){m.sheets=m.worksheets;const v=[];let S=0;m.sheets.forEach(R=>{if(R.pageSetup&&R.pageSetup.printArea&&R.pageSetup.printArea.split("&&").forEach(I=>{const F=I.split(":"),j={name:"_xlnm.Print_Area",ranges:[`'${R.name}'!$${F[0]}:$${F[1]}`],localSheetId:S};v.push(j)}),R.pageSetup&&(R.pageSetup.printTitlesRow||R.pageSetup.printTitlesColumn)){const I=[];if(R.pageSetup.printTitlesColumn){const j=R.pageSetup.printTitlesColumn.split(":");I.push(`'${R.name}'!$${j[0]}:$${j[1]}`)}if(R.pageSetup.printTitlesRow){const j=R.pageSetup.printTitlesRow.split(":");I.push(`'${R.name}'!$${j[0]}:$${j[1]}`)}const F={name:"_xlnm.Print_Titles",ranges:I,localSheetId:S};v.push(F)}S++}),v.length&&(m.definedNames=m.definedNames.concat(v)),(m.media||[]).forEach((R,I)=>{R.name=R.type+(I+1)})}render(m,v){m.openXml(o.StdDocAttributes),m.openNode("workbook",u.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(m),this.map.workbookPr.render(m,v.properties),this.map.bookViews.render(m,v.views),this.map.sheets.render(m,v.sheets),this.map.definedNames.render(m,v.definedNames),this.map.calcPr.render(m,v.calcProperties),m.closeNode()}parseOpen(m){if(this.parser)return this.parser.parseOpen(m),!0;switch(m.name){case"workbook":return!0;default:return this.parser=this.map[m.name],this.parser&&this.parser.parseOpen(m),!0}}parseText(m){this.parser&&this.parser.parseText(m)}parseClose(m){if(this.parser)return this.parser.parseClose(m)||(this.parser=void 0),!0;switch(m){case"workbook":return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),!1;default:return!0}}reconcile(m){const v=(m.workbookRels||[]).reduce((j,L)=>(j[L.Id]=L,j),{}),S=[];let R,I=0;(m.sheets||[]).forEach(j=>{const L=v[j.rId];L&&(R=m.worksheetHash["xl/"+L.Target.replace(/^(\s|\/xl\/)+/,"")],R&&(R.name=j.name,R.id=j.id,R.state=j.state,S[I++]=R))});const F=[];l.each(m.definedNames,j=>{if(j.name==="_xlnm.Print_Area"){if(R=S[j.localSheetId],R){R.pageSetup||(R.pageSetup={});const L=i.decodeEx(j.ranges[0]);R.pageSetup.printArea=R.pageSetup.printArea?`${R.pageSetup.printArea}&&${L.dimensions}`:L.dimensions}}else if(j.name==="_xlnm.Print_Titles"){if(R=S[j.localSheetId],R){R.pageSetup||(R.pageSetup={});const L=j.ranges.join(","),$=/\$/g,V=/\$\d+:\$\d+/,z=L.match(V);if(z&&z.length){const k=z[0];R.pageSetup.printTitlesRow=k.replace($,"")}const E=/\$[A-Z]+:\$[A-Z]+/,A=L.match(E);if(A&&A.length){const k=A[0];R.pageSetup.printTitlesColumn=k.replace($,"")}}}else F.push(j)}),m.definedNames=F,m.media.forEach((j,L)=>{j.index=L})}}u.WORKBOOK_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x15","xmlns:x15":"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"},u.STATIC_XFORMS={fileVersion:new e({tag:"fileVersion",$:{appName:"xl",lastEdited:5,lowestEdited:5,rupBuild:9303}})},h.exports=u},{"../../../utils/col-cache":19,"../../../utils/under-dash":26,"../../../utils/xml-stream":28,"../base-xform":32,"../list-xform":71,"../static-xform":120,"./defined-name-xform":33,"./sheet-xform":34,"./workbook-calc-properties-xform":35,"./workbook-properties-xform":36,"./workbook-view-xform":37}],39:[function(t,h,d){const l=t("../strings/rich-text-xform"),i=t("../../../utils/utils"),o=t("../base-xform"),r=h.exports=function(e){this.model=e};i.inherits(r,o,{get tag(){return"r"},get richTextXform(){return this._richTextXform||(this._richTextXform=new l),this._richTextXform},render(e,n){n=n||this.model,e.openNode("comment",{ref:n.ref,authorId:0}),e.openNode("text"),n&&n.note&&n.note.texts&&n.note.texts.forEach(c=>{this.richTextXform.render(e,c)}),e.closeNode(),e.closeNode()},parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"comment":return this.model={type:"note",note:{texts:[]},...e.attributes},!0;case"r":return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}},parseText(e){this.parser&&this.parser.parseText(e)},parseClose(e){switch(e){case"comment":return!1;case"r":return this.model.note.texts.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}})},{"../../../utils/utils":27,"../base-xform":32,"../strings/rich-text-xform":122}],40:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../../../utils/utils"),o=t("../base-xform"),r=t("./comment-xform"),e=h.exports=function(){this.map={comment:new r}};i.inherits(e,o,{COMMENTS_ATTRIBUTES:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},{render(n,c){c=c||this.model,n.openXml(l.StdDocAttributes),n.openNode("comments",e.COMMENTS_ATTRIBUTES),n.openNode("authors"),n.leafNode("author",null,"Author"),n.closeNode(),n.openNode("commentList"),c.comments.forEach(a=>{this.map.comment.render(n,a)}),n.closeNode(),n.closeNode()},parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case"commentList":return this.model={comments:[]},!0;case"comment":return this.parser=this.map.comment,this.parser.parseOpen(n),!0;default:return!1}},parseText(n){this.parser&&this.parser.parseText(n)},parseClose(n){switch(n){case"commentList":return!1;case"comment":return this.model.comments.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(n),!0}}})},{"../../../utils/utils":27,"../../../utils/xml-stream":28,"../base-xform":32,"./comment-xform":39}],41:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{constructor(i){super(),this._model=i}get tag(){return this._model&&this._model.tag}render(i,o,r){(o===r[2]||this.tag==="x:SizeWithCells"&&o===r[1])&&i.leafNode(this.tag)}parseOpen(i){switch(i.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../../base-xform":32}],42:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{constructor(i){super(),this._model=i}get tag(){return this._model&&this._model.tag}render(i,o){i.leafNode(this.tag,null,o)}parseOpen(i){switch(i.name){case this.tag:return this.text="",!0;default:return!1}}parseText(i){this.text=i}parseClose(){return!1}}},{"../../base-xform":32}],43:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"x:Anchor"}getAnchorRect(i){const o=Math.floor(i.left),r=Math.floor(68*(i.left-o)),e=Math.floor(i.top),n=Math.floor(18*(i.top-e)),c=Math.floor(i.right),a=Math.floor(68*(i.right-c)),s=Math.floor(i.bottom);return[o,r,e,n,c,a,s,Math.floor(18*(i.bottom-s))]}getDefaultRect(i){const o=i.col,r=Math.max(i.row-2,0);return[o,6,r,14,o+2,2,r+4,16]}render(i,o){const r=o.anchor?this.getAnchorRect(o.anchor):this.getDefaultRect(o.refAddress);i.leafNode("x:Anchor",null,r.join(", "))}parseOpen(i){switch(i.name){case this.tag:return this.text="",!0;default:return!1}}parseText(i){this.text=i}parseClose(){return!1}}},{"../base-xform":32}],44:[function(t,h,d){const l=t("../base-xform"),i=t("./vml-anchor-xform"),o=t("./style/vml-protection-xform"),r=t("./style/vml-position-xform"),e=["twoCells","oneCells","absolute"];h.exports=class extends l{constructor(){super(),this.map={"x:Anchor":new i,"x:Locked":new o({tag:"x:Locked"}),"x:LockText":new o({tag:"x:LockText"}),"x:SizeWithCells":new r({tag:"x:SizeWithCells"}),"x:MoveWithCells":new r({tag:"x:MoveWithCells"})}}get tag(){return"x:ClientData"}render(n,c){const{protection:a,editAs:s}=c.note;n.openNode(this.tag,{ObjectType:"Note"}),this.map["x:MoveWithCells"].render(n,s,e),this.map["x:SizeWithCells"].render(n,s,e),this.map["x:Anchor"].render(n,c),this.map["x:Locked"].render(n,a.locked),n.leafNode("x:AutoFill",null,"False"),this.map["x:LockText"].render(n,a.lockText),n.leafNode("x:Row",null,c.refAddress.row-1),n.leafNode("x:Column",null,c.refAddress.col-1),n.closeNode()}parseOpen(n){switch(n.name){case this.tag:this.reset(),this.model={anchor:[],protection:{},editAs:""};break;default:this.parser=this.map[n.name],this.parser&&this.parser.parseOpen(n)}return!0}parseText(n){this.parser&&this.parser.parseText(n)}parseClose(n){if(this.parser)return this.parser.parseClose(n)||(this.parser=void 0),!0;switch(n){case this.tag:return this.normalizeModel(),!1;default:return!0}}normalizeModel(){const n=Object.assign({},this.map["x:MoveWithCells"].model,this.map["x:SizeWithCells"].model),c=Object.keys(n).length;this.model.editAs=e[c],this.model.anchor=this.map["x:Anchor"].text,this.model.protection.locked=this.map["x:Locked"].text,this.model.protection.lockText=this.map["x:LockText"].text}}},{"../base-xform":32,"./style/vml-position-xform":41,"./style/vml-protection-xform":42,"./vml-anchor-xform":43}],45:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform"),o=t("./vml-shape-xform");class r extends i{constructor(){super(),this.map={"v:shape":new o}}get tag(){return"xml"}render(n,c){n.openXml(l.StdDocAttributes),n.openNode(this.tag,r.DRAWING_ATTRIBUTES),n.openNode("o:shapelayout",{"v:ext":"edit"}),n.leafNode("o:idmap",{"v:ext":"edit",data:1}),n.closeNode(),n.openNode("v:shapetype",{id:"_x0000_t202",coordsize:"21600,21600","o:spt":202,path:"m,l,21600r21600,l21600,xe"}),n.leafNode("v:stroke",{joinstyle:"miter"}),n.leafNode("v:path",{gradientshapeok:"t","o:connecttype":"rect"}),n.closeNode(),c.comments.forEach((a,s)=>{this.map["v:shape"].render(n,a,s)}),n.closeNode()}parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case this.tag:this.reset(),this.model={comments:[]};break;default:this.parser=this.map[n.name],this.parser&&this.parser.parseOpen(n)}return!0}parseText(n){this.parser&&this.parser.parseText(n)}parseClose(n){if(this.parser)return this.parser.parseClose(n)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(n){case this.tag:return!1;default:return!0}}reconcile(n,c){n.anchors.forEach(a=>{a.br?this.map["xdr:twoCellAnchor"].reconcile(a,c):this.map["xdr:oneCellAnchor"].reconcile(a,c)})}}r.DRAWING_ATTRIBUTES={"xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:x":"urn:schemas-microsoft-com:office:excel"},h.exports=r},{"../../../utils/xml-stream":28,"../base-xform":32,"./vml-shape-xform":46}],46:[function(t,h,d){const l=t("../base-xform"),i=t("./vml-textbox-xform"),o=t("./vml-client-data-xform");class r extends l{constructor(){super(),this.map={"v:textbox":new i,"x:ClientData":new o}}get tag(){return"v:shape"}render(n,c,a){n.openNode("v:shape",r.V_SHAPE_ATTRIBUTES(c,a)),n.leafNode("v:fill",{color2:"infoBackground [80]"}),n.leafNode("v:shadow",{color:"none [81]",obscured:"t"}),n.leafNode("v:path",{"o:connecttype":"none"}),this.map["v:textbox"].render(n,c),this.map["x:ClientData"].render(n,c),n.closeNode()}parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case this.tag:this.reset(),this.model={margins:{insetmode:n.attributes["o:insetmode"]},anchor:"",editAs:"",protection:{}};break;default:this.parser=this.map[n.name],this.parser&&this.parser.parseOpen(n)}return!0}parseText(n){this.parser&&this.parser.parseText(n)}parseClose(n){if(this.parser)return this.parser.parseClose(n)||(this.parser=void 0),!0;switch(n){case this.tag:return this.model.margins.inset=this.map["v:textbox"].model&&this.map["v:textbox"].model.inset,this.model.protection=this.map["x:ClientData"].model&&this.map["x:ClientData"].model.protection,this.model.anchor=this.map["x:ClientData"].model&&this.map["x:ClientData"].model.anchor,this.model.editAs=this.map["x:ClientData"].model&&this.map["x:ClientData"].model.editAs,!1;default:return!0}}}r.V_SHAPE_ATTRIBUTES=(e,n)=>({id:"_x0000_s"+(1025+n),type:"#_x0000_t202",style:"position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden",fillcolor:"infoBackground [80]",strokecolor:"none [81]","o:insetmode":e.note.margins&&e.note.margins.insetmode}),h.exports=r},{"../base-xform":32,"./vml-client-data-xform":44,"./vml-textbox-xform":47}],47:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"v:textbox"}conversionUnit(i,o,r){return`${parseFloat(i)*o.toFixed(2)}${r}`}reverseConversionUnit(i){return(i||"").split(",").map(o=>Number(parseFloat(this.conversionUnit(parseFloat(o),.1,"")).toFixed(2)))}render(i,o){const r={style:"mso-direction-alt:auto"};if(o&&o.note){let{inset:e}=o.note&&o.note.margins;Array.isArray(e)&&(e=e.map(n=>this.conversionUnit(n,10,"mm")).join(",")),e&&(r.inset=e)}i.openNode("v:textbox",r),i.leafNode("div",{style:"text-align:left"}),i.closeNode()}parseOpen(i){switch(i.name){case this.tag:return this.model={inset:this.reverseConversionUnit(i.attributes.inset)},!0;default:return!0}}parseText(){}parseClose(i){switch(i){case this.tag:return!1;default:return!0}}}},{"../base-xform":32}],48:[function(t,h,d){const l=t("./base-xform");h.exports=class extends l{createNewModel(i){return{}}parseOpen(i){return this.parser=this.parser||this.map[i.name],this.parser?(this.parser.parseOpen(i),!0):i.name===this.tag&&(this.model=this.createNewModel(i),!0)}parseText(i){this.parser&&this.parser.parseText(i)}onParserClose(i,o){this.model[i]=o.model}parseClose(i){return this.parser?(this.parser.parseClose(i)||(this.onParserClose(i,this.parser),this.parser=void 0),!0):i!==this.tag}}},{"./base-xform":32}],49:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{render(i,o){i.openNode("HeadingPairs"),i.openNode("vt:vector",{size:2,baseType:"variant"}),i.openNode("vt:variant"),i.leafNode("vt:lpstr",void 0,"Worksheets"),i.closeNode(),i.openNode("vt:variant"),i.leafNode("vt:i4",void 0,o.length),i.closeNode(),i.closeNode(),i.closeNode()}parseOpen(i){return i.name==="HeadingPairs"}parseText(){}parseClose(i){return i!=="HeadingPairs"}}},{"../base-xform":32}],50:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{render(i,o){i.openNode("TitlesOfParts"),i.openNode("vt:vector",{size:o.length,baseType:"lpstr"}),o.forEach(r=>{i.leafNode("vt:lpstr",void 0,r.name)}),i.closeNode(),i.closeNode()}parseOpen(i){return i.name==="TitlesOfParts"}parseText(){}parseClose(i){return i!=="TitlesOfParts"}}},{"../base-xform":32}],51:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform"),o=t("../simple/string-xform"),r=t("./app-heading-pairs-xform"),e=t("./app-titles-of-parts-xform");class n extends i{constructor(){super(),this.map={Company:new o({tag:"Company"}),Manager:new o({tag:"Manager"}),HeadingPairs:new r,TitleOfParts:new e}}render(a,s){a.openXml(l.StdDocAttributes),a.openNode("Properties",n.PROPERTY_ATTRIBUTES),a.leafNode("Application",void 0,"Microsoft Excel"),a.leafNode("DocSecurity",void 0,"0"),a.leafNode("ScaleCrop",void 0,"false"),this.map.HeadingPairs.render(a,s.worksheets),this.map.TitleOfParts.render(a,s.worksheets),this.map.Company.render(a,s.company||""),this.map.Manager.render(a,s.manager),a.leafNode("LinksUpToDate",void 0,"false"),a.leafNode("SharedDoc",void 0,"false"),a.leafNode("HyperlinksChanged",void 0,"false"),a.leafNode("AppVersion",void 0,"16.0300"),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case"Properties":return!0;default:return this.parser=this.map[a.name],!!this.parser&&(this.parser.parseOpen(a),!0)}}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){if(this.parser)return this.parser.parseClose(a)||(this.parser=void 0),!0;switch(a){case"Properties":return this.model={worksheets:this.map.TitleOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}}n.DateFormat=function(c){return c.toISOString().replace(/[.]\d{3,6}/,"")},n.DateAttrs={"xsi:type":"dcterms:W3CDTF"},n.PROPERTY_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},h.exports=n},{"../../../utils/xml-stream":28,"../base-xform":32,"../simple/string-xform":119,"./app-heading-pairs-xform":49,"./app-titles-of-parts-xform":50}],52:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform");class o extends i{render(e,n){e.openXml(l.StdDocAttributes),e.openNode("Types",o.PROPERTY_ATTRIBUTES);const c={};(n.media||[]).forEach(a=>{if(a.type==="image"){const s=a.extension;c[s]||(c[s]=!0,e.leafNode("Default",{Extension:s,ContentType:"image/"+s}))}}),e.leafNode("Default",{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}),e.leafNode("Default",{Extension:"xml",ContentType:"application/xml"}),e.leafNode("Override",{PartName:"/xl/workbook.xml",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"}),n.worksheets.forEach(a=>{const s=`/xl/worksheets/sheet${a.id}.xml`;e.leafNode("Override",{PartName:s,ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"})}),e.leafNode("Override",{PartName:"/xl/theme/theme1.xml",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml"}),e.leafNode("Override",{PartName:"/xl/styles.xml",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"}),n.sharedStrings&&n.sharedStrings.count&&e.leafNode("Override",{PartName:"/xl/sharedStrings.xml",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"}),n.tables&&n.tables.forEach(a=>{e.leafNode("Override",{PartName:"/xl/tables/"+a.target,ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"})}),n.drawings&&n.drawings.forEach(a=>{e.leafNode("Override",{PartName:`/xl/drawings/${a.name}.xml`,ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml"})}),n.commentRefs&&(e.leafNode("Default",{Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"}),n.commentRefs.forEach(a=>{let{commentName:s}=a;e.leafNode("Override",{PartName:`/xl/${s}.xml`,ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"})})),e.leafNode("Override",{PartName:"/docProps/core.xml",ContentType:"application/vnd.openxmlformats-package.core-properties+xml"}),e.leafNode("Override",{PartName:"/docProps/app.xml",ContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml"}),e.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}}o.PROPERTY_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"},h.exports=o},{"../../../utils/xml-stream":28,"../base-xform":32}],53:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform"),o=t("../simple/date-xform"),r=t("../simple/string-xform"),e=t("../simple/integer-xform");class n extends i{constructor(){super(),this.map={"dc:creator":new r({tag:"dc:creator"}),"dc:title":new r({tag:"dc:title"}),"dc:subject":new r({tag:"dc:subject"}),"dc:description":new r({tag:"dc:description"}),"dc:identifier":new r({tag:"dc:identifier"}),"dc:language":new r({tag:"dc:language"}),"cp:keywords":new r({tag:"cp:keywords"}),"cp:category":new r({tag:"cp:category"}),"cp:lastModifiedBy":new r({tag:"cp:lastModifiedBy"}),"cp:lastPrinted":new o({tag:"cp:lastPrinted",format:n.DateFormat}),"cp:revision":new e({tag:"cp:revision"}),"cp:version":new r({tag:"cp:version"}),"cp:contentStatus":new r({tag:"cp:contentStatus"}),"cp:contentType":new r({tag:"cp:contentType"}),"dcterms:created":new o({tag:"dcterms:created",attrs:n.DateAttrs,format:n.DateFormat}),"dcterms:modified":new o({tag:"dcterms:modified",attrs:n.DateAttrs,format:n.DateFormat})}}render(a,s){a.openXml(l.StdDocAttributes),a.openNode("cp:coreProperties",n.CORE_PROPERTY_ATTRIBUTES),this.map["dc:creator"].render(a,s.creator),this.map["dc:title"].render(a,s.title),this.map["dc:subject"].render(a,s.subject),this.map["dc:description"].render(a,s.description),this.map["dc:identifier"].render(a,s.identifier),this.map["dc:language"].render(a,s.language),this.map["cp:keywords"].render(a,s.keywords),this.map["cp:category"].render(a,s.category),this.map["cp:lastModifiedBy"].render(a,s.lastModifiedBy),this.map["cp:lastPrinted"].render(a,s.lastPrinted),this.map["cp:revision"].render(a,s.revision),this.map["cp:version"].render(a,s.version),this.map["cp:contentStatus"].render(a,s.contentStatus),this.map["cp:contentType"].render(a,s.contentType),this.map["dcterms:created"].render(a,s.created),this.map["dcterms:modified"].render(a,s.modified),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case"cp:coreProperties":case"coreProperties":return!0;default:if(this.parser=this.map[a.name],this.parser)return this.parser.parseOpen(a),!0;throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(a))}}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){if(this.parser)return this.parser.parseClose(a)||(this.parser=void 0),!0;switch(a){case"cp:coreProperties":case"coreProperties":return this.model={creator:this.map["dc:creator"].model,title:this.map["dc:title"].model,subject:this.map["dc:subject"].model,description:this.map["dc:description"].model,identifier:this.map["dc:identifier"].model,language:this.map["dc:language"].model,keywords:this.map["cp:keywords"].model,category:this.map["cp:category"].model,lastModifiedBy:this.map["cp:lastModifiedBy"].model,lastPrinted:this.map["cp:lastPrinted"].model,revision:this.map["cp:revision"].model,contentStatus:this.map["cp:contentStatus"].model,contentType:this.map["cp:contentType"].model,created:this.map["dcterms:created"].model,modified:this.map["dcterms:modified"].model},!1;default:throw new Error("Unexpected xml node in parseClose: "+a)}}}n.DateFormat=function(c){return c.toISOString().replace(/[.]\d{3}/,"")},n.DateAttrs={"xsi:type":"dcterms:W3CDTF"},n.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":"http://schemas.openxmlformats.org/package/2006/metadata/core-properties","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:dcterms":"http://purl.org/dc/terms/","xmlns:dcmitype":"http://purl.org/dc/dcmitype/","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance"},h.exports=n},{"../../../utils/xml-stream":28,"../base-xform":32,"../simple/date-xform":117,"../simple/integer-xform":118,"../simple/string-xform":119}],54:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{render(i,o){i.leafNode("Relationship",o)}parseOpen(i){switch(i.name){case"Relationship":return this.model=i.attributes,!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],55:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform"),o=t("./relationship-xform");class r extends i{constructor(){super(),this.map={Relationship:new o}}render(n,c){c=c||this._values,n.openXml(l.StdDocAttributes),n.openNode("Relationships",r.RELATIONSHIPS_ATTRIBUTES),c.forEach(a=>{this.map.Relationship.render(n,a)}),n.closeNode()}parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case"Relationships":return this.model=[],!0;default:if(this.parser=this.map[n.name],this.parser)return this.parser.parseOpen(n),!0;throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(n))}}parseText(n){this.parser&&this.parser.parseText(n)}parseClose(n){if(this.parser)return this.parser.parseClose(n)||(this.model.push(this.parser.model),this.parser=void 0),!0;switch(n){case"Relationships":return!1;default:throw new Error("Unexpected xml node in parseClose: "+n)}}}r.RELATIONSHIPS_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},h.exports=r},{"../../../utils/xml-stream":28,"../base-xform":32,"./relationship-xform":54}],56:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{parseOpen(i){if(this.parser)return this.parser.parseOpen(i),!0;switch(i.name){case this.tag:this.reset(),this.model={range:{editAs:i.attributes.editAs||"oneCell"}};break;default:this.parser=this.map[i.name],this.parser&&this.parser.parseOpen(i)}return!0}parseText(i){this.parser&&this.parser.parseText(i)}reconcilePicture(i,o){if(i&&i.rId){const r=o.rels[i.rId].Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);if(r){const e=r[1],n=o.mediaIndex[e];return o.media[n]}}}}},{"../base-xform":32}],57:[function(t,h,d){const l=t("../base-xform"),i=t("./blip-xform");h.exports=class extends l{constructor(){super(),this.map={"a:blip":new i}}get tag(){return"xdr:blipFill"}render(o,r){o.openNode(this.tag),this.map["a:blip"].render(o,r),o.openNode("a:stretch"),o.leafNode("a:fillRect"),o.closeNode(),o.closeNode()}parseOpen(o){if(this.parser)return this.parser.parseOpen(o),!0;switch(o.name){case this.tag:this.reset();break;default:this.parser=this.map[o.name],this.parser&&this.parser.parseOpen(o)}return!0}parseText(){}parseClose(o){if(this.parser)return this.parser.parseClose(o)||(this.parser=void 0),!0;switch(o){case this.tag:return this.model=this.map["a:blip"].model,!1;default:return!0}}}},{"../base-xform":32,"./blip-xform":58}],58:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"a:blip"}render(i,o){i.leafNode(this.tag,{"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","r:embed":o.rId,cstate:"print"})}parseOpen(i){switch(i.name){case this.tag:return this.model={rId:i.attributes["r:embed"]},!0;default:return!0}}parseText(){}parseClose(i){switch(i){case this.tag:return!1;default:return!0}}}},{"../base-xform":32}],59:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"xdr:cNvPicPr"}render(i){i.openNode(this.tag),i.leafNode("a:picLocks",{noChangeAspect:"1"}),i.closeNode()}parseOpen(i){switch(i.name){case this.tag:default:return!0}}parseText(){}parseClose(i){switch(i){case this.tag:return!1;default:return!0}}}},{"../base-xform":32}],60:[function(t,h,d){const l=t("../base-xform"),i=t("./hlink-click-xform"),o=t("./ext-lst-xform");h.exports=class extends l{constructor(){super(),this.map={"a:hlinkClick":new i,"a:extLst":new o}}get tag(){return"xdr:cNvPr"}render(r,e){r.openNode(this.tag,{id:e.index,name:"Picture "+e.index}),this.map["a:hlinkClick"].render(r,e),this.map["a:extLst"].render(r,e),r.closeNode()}parseOpen(r){if(this.parser)return this.parser.parseOpen(r),!0;switch(r.name){case this.tag:this.reset();break;default:this.parser=this.map[r.name],this.parser&&this.parser.parseOpen(r)}return!0}parseText(){}parseClose(r){if(this.parser)return this.parser.parseClose(r)||(this.parser=void 0),!0;switch(r){case this.tag:return this.model=this.map["a:hlinkClick"].model,!1;default:return!0}}}},{"../base-xform":32,"./ext-lst-xform":63,"./hlink-click-xform":65}],61:[function(t,h,d){const l=t("../base-xform"),i=t("../simple/integer-xform");h.exports=class extends l{constructor(o){super(),this.tag=o.tag,this.map={"xdr:col":new i({tag:"xdr:col",zero:!0}),"xdr:colOff":new i({tag:"xdr:colOff",zero:!0}),"xdr:row":new i({tag:"xdr:row",zero:!0}),"xdr:rowOff":new i({tag:"xdr:rowOff",zero:!0})}}render(o,r){o.openNode(this.tag),this.map["xdr:col"].render(o,r.nativeCol),this.map["xdr:colOff"].render(o,r.nativeColOff),this.map["xdr:row"].render(o,r.nativeRow),this.map["xdr:rowOff"].render(o,r.nativeRowOff),o.closeNode()}parseOpen(o){if(this.parser)return this.parser.parseOpen(o),!0;switch(o.name){case this.tag:this.reset();break;default:this.parser=this.map[o.name],this.parser&&this.parser.parseOpen(o)}return!0}parseText(o){this.parser&&this.parser.parseText(o)}parseClose(o){if(this.parser)return this.parser.parseClose(o)||(this.parser=void 0),!0;switch(o){case this.tag:return this.model={nativeCol:this.map["xdr:col"].model,nativeColOff:this.map["xdr:colOff"].model,nativeRow:this.map["xdr:row"].model,nativeRowOff:this.map["xdr:rowOff"].model},!1;default:return!0}}}},{"../base-xform":32,"../simple/integer-xform":118}],62:[function(t,h,d){const l=t("../../../utils/col-cache"),i=t("../../../utils/xml-stream"),o=t("../base-xform"),r=t("./two-cell-anchor-xform"),e=t("./one-cell-anchor-xform");class n extends o{constructor(){super(),this.map={"xdr:twoCellAnchor":new r,"xdr:oneCellAnchor":new e}}prepare(a){a.anchors.forEach((s,f)=>{s.anchorType=function(p){return(typeof p.range=="string"?l.decode(p.range):p.range).br?"xdr:twoCellAnchor":"xdr:oneCellAnchor"}(s),this.map[s.anchorType].prepare(s,{index:f})})}get tag(){return"xdr:wsDr"}render(a,s){a.openXml(i.StdDocAttributes),a.openNode(this.tag,n.DRAWING_ATTRIBUTES),s.anchors.forEach(f=>{this.map[f.anchorType].render(a,f)}),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case this.tag:this.reset(),this.model={anchors:[]};break;default:this.parser=this.map[a.name],this.parser&&this.parser.parseOpen(a)}return!0}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){if(this.parser)return this.parser.parseClose(a)||(this.model.anchors.push(this.parser.model),this.parser=void 0),!0;switch(a){case this.tag:return!1;default:return!0}}reconcile(a,s){a.anchors.forEach(f=>{f.br?this.map["xdr:twoCellAnchor"].reconcile(f,s):this.map["xdr:oneCellAnchor"].reconcile(f,s)})}}n.DRAWING_ATTRIBUTES={"xmlns:xdr":"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing","xmlns:a":"http://schemas.openxmlformats.org/drawingml/2006/main"},h.exports=n},{"../../../utils/col-cache":19,"../../../utils/xml-stream":28,"../base-xform":32,"./one-cell-anchor-xform":67,"./two-cell-anchor-xform":70}],63:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"a:extLst"}render(i){i.openNode(this.tag),i.openNode("a:ext",{uri:"{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"}),i.leafNode("a16:creationId",{"xmlns:a16":"http://schemas.microsoft.com/office/drawing/2014/main",id:"{00000000-0008-0000-0000-000002000000}"}),i.closeNode(),i.closeNode()}parseOpen(i){switch(i.name){case this.tag:default:return!0}}parseText(){}parseClose(i){switch(i){case this.tag:return!1;default:return!0}}}},{"../base-xform":32}],64:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{constructor(i){super(),this.tag=i.tag,this.map={}}render(i,o){i.openNode(this.tag);const r=Math.floor(9525*o.width),e=Math.floor(9525*o.height);i.addAttribute("cx",r),i.addAttribute("cy",e),i.closeNode()}parseOpen(i){return i.name===this.tag&&(this.model={width:parseInt(i.attributes.cx||"0",10)/9525,height:parseInt(i.attributes.cy||"0",10)/9525},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],65:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"a:hlinkClick"}render(i,o){o.hyperlinks&&o.hyperlinks.rId&&i.leafNode(this.tag,{"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","r:id":o.hyperlinks.rId,tooltip:o.hyperlinks.tooltip})}parseOpen(i){switch(i.name){case this.tag:return this.model={hyperlinks:{rId:i.attributes["r:id"],tooltip:i.attributes.tooltip}},!0;default:return!0}}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],66:[function(t,h,d){const l=t("../base-xform"),i=t("./c-nv-pr-xform"),o=t("./c-nv-pic-pr-xform");h.exports=class extends l{constructor(){super(),this.map={"xdr:cNvPr":new i,"xdr:cNvPicPr":new o}}get tag(){return"xdr:nvPicPr"}render(r,e){r.openNode(this.tag),this.map["xdr:cNvPr"].render(r,e),this.map["xdr:cNvPicPr"].render(r,e),r.closeNode()}parseOpen(r){if(this.parser)return this.parser.parseOpen(r),!0;switch(r.name){case this.tag:this.reset();break;default:this.parser=this.map[r.name],this.parser&&this.parser.parseOpen(r)}return!0}parseText(){}parseClose(r){if(this.parser)return this.parser.parseClose(r)||(this.parser=void 0),!0;switch(r){case this.tag:return this.model=this.map["xdr:cNvPr"].model,!1;default:return!0}}}},{"../base-xform":32,"./c-nv-pic-pr-xform":59,"./c-nv-pr-xform":60}],67:[function(t,h,d){const l=t("./base-cell-anchor-xform"),i=t("../static-xform"),o=t("./cell-position-xform"),r=t("./ext-xform"),e=t("./pic-xform");h.exports=class extends l{constructor(){super(),this.map={"xdr:from":new o({tag:"xdr:from"}),"xdr:ext":new r({tag:"xdr:ext"}),"xdr:pic":new e,"xdr:clientData":new i({tag:"xdr:clientData"})}}get tag(){return"xdr:oneCellAnchor"}prepare(n,c){this.map["xdr:pic"].prepare(n.picture,c)}render(n,c){n.openNode(this.tag,{editAs:c.range.editAs||"oneCell"}),this.map["xdr:from"].render(n,c.range.tl),this.map["xdr:ext"].render(n,c.range.ext),this.map["xdr:pic"].render(n,c.picture),this.map["xdr:clientData"].render(n,{}),n.closeNode()}parseClose(n){if(this.parser)return this.parser.parseClose(n)||(this.parser=void 0),!0;switch(n){case this.tag:return this.model.range.tl=this.map["xdr:from"].model,this.model.range.ext=this.map["xdr:ext"].model,this.model.picture=this.map["xdr:pic"].model,!1;default:return!0}}reconcile(n,c){n.medium=this.reconcilePicture(n.picture,c)}}},{"../static-xform":120,"./base-cell-anchor-xform":56,"./cell-position-xform":61,"./ext-xform":64,"./pic-xform":68}],68:[function(t,h,d){const l=t("../base-xform"),i=t("../static-xform"),o=t("./blip-fill-xform"),r=t("./nv-pic-pr-xform"),e=t("./sp-pr");h.exports=class extends l{constructor(){super(),this.map={"xdr:nvPicPr":new r,"xdr:blipFill":new o,"xdr:spPr":new i(e)}}get tag(){return"xdr:pic"}prepare(n,c){n.index=c.index+1}render(n,c){n.openNode(this.tag),this.map["xdr:nvPicPr"].render(n,c),this.map["xdr:blipFill"].render(n,c),this.map["xdr:spPr"].render(n,c),n.closeNode()}parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case this.tag:this.reset();break;default:this.parser=this.map[n.name],this.parser&&this.parser.parseOpen(n)}return!0}parseText(){}parseClose(n){if(this.parser)return this.parser.parseClose(n)||(this.mergeModel(this.parser.model),this.parser=void 0),!0;switch(n){case this.tag:return!1;default:return!0}}}},{"../base-xform":32,"../static-xform":120,"./blip-fill-xform":57,"./nv-pic-pr-xform":66,"./sp-pr":69}],69:[function(t,h,d){h.exports={tag:"xdr:spPr",c:[{tag:"a:xfrm",c:[{tag:"a:off",$:{x:"0",y:"0"}},{tag:"a:ext",$:{cx:"0",cy:"0"}}]},{tag:"a:prstGeom",$:{prst:"rect"},c:[{tag:"a:avLst"}]}]}},{}],70:[function(t,h,d){const l=t("./base-cell-anchor-xform"),i=t("../static-xform"),o=t("./cell-position-xform"),r=t("./pic-xform");h.exports=class extends l{constructor(){super(),this.map={"xdr:from":new o({tag:"xdr:from"}),"xdr:to":new o({tag:"xdr:to"}),"xdr:pic":new r,"xdr:clientData":new i({tag:"xdr:clientData"})}}get tag(){return"xdr:twoCellAnchor"}prepare(e,n){this.map["xdr:pic"].prepare(e.picture,n)}render(e,n){e.openNode(this.tag,{editAs:n.range.editAs||"oneCell"}),this.map["xdr:from"].render(e,n.range.tl),this.map["xdr:to"].render(e,n.range.br),this.map["xdr:pic"].render(e,n.picture),this.map["xdr:clientData"].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map["xdr:from"].model,this.model.range.br=this.map["xdr:to"].model,this.model.picture=this.map["xdr:pic"].model,!1;default:return!0}}reconcile(e,n){e.medium=this.reconcilePicture(e.picture,n)}}},{"../static-xform":120,"./base-cell-anchor-xform":56,"./cell-position-xform":61,"./pic-xform":68}],71:[function(t,h,d){const l=t("./base-xform");h.exports=class extends l{constructor(i){super(),this.tag=i.tag,this.always=!!i.always,this.count=i.count,this.empty=i.empty,this.$count=i.$count||"count",this.$=i.$,this.childXform=i.childXform,this.maxItems=i.maxItems}prepare(i,o){const{childXform:r}=this;i&&i.forEach((e,n)=>{o.index=n,r.prepare(e,o)})}render(i,o){if(this.always||o&&o.length){i.openNode(this.tag,this.$),this.count&&i.addAttribute(this.$count,o&&o.length||0);const{childXform:r}=this;(o||[]).forEach((e,n)=>{r.render(i,e,n)}),i.closeNode()}else this.empty&&i.leafNode(this.tag)}parseOpen(i){if(this.parser)return this.parser.parseOpen(i),!0;switch(i.name){case this.tag:return this.model=[],!0;default:return!!this.childXform.parseOpen(i)&&(this.parser=this.childXform,!0)}}parseText(i){this.parser&&this.parser.parseText(i)}parseClose(i){if(this.parser){if(!this.parser.parseClose(i)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw new Error(`Max ${this.childXform.tag} count (${this.maxItems}) exceeded`);return!0}return!1}reconcile(i,o){if(i){const{childXform:r}=this;i.forEach(e=>{r.reconcile(e,o)})}}}},{"./base-xform":32}],72:[function(t,h,d){const l=t("../../../utils/col-cache"),i=t("../base-xform");h.exports=class extends i{get tag(){return"autoFilter"}render(o,r){if(r)if(typeof r=="string")o.leafNode("autoFilter",{ref:r});else{const e=function(a){return typeof a=="string"?a:l.getAddress(a.row,a.column).address},n=e(r.from),c=e(r.to);n&&c&&o.leafNode("autoFilter",{ref:`${n}:${c}`})}}parseOpen(o){o.name==="autoFilter"&&(this.model=o.attributes.ref)}}},{"../../../utils/col-cache":19,"../base-xform":32}],73:[function(t,h,d){const l=t("../../../utils/utils"),i=t("../base-xform"),o=t("../../../doc/range"),r=t("../../../doc/enums"),e=t("../strings/rich-text-xform");function n(c){if(c==null)return r.ValueType.Null;if(c instanceof String||typeof c=="string")return r.ValueType.String;if(typeof c=="number")return r.ValueType.Number;if(typeof c=="boolean")return r.ValueType.Boolean;if(c instanceof Date)return r.ValueType.Date;if(c.text&&c.hyperlink)return r.ValueType.Hyperlink;if(c.formula)return r.ValueType.Formula;if(c.error)return r.ValueType.Error;throw new Error("I could not understand type of value")}h.exports=class extends i{constructor(){super(),this.richTextXForm=new e}get tag(){return"c"}prepare(c,a){const s=a.styles.addStyleModel(c.style||{},function(f){switch(f.type){case r.ValueType.Formula:return n(f.result);default:return f.type}}(c));switch(s&&(c.styleId=s),c.comment&&a.comments.push({...c.comment,ref:c.address}),c.type){case r.ValueType.String:case r.ValueType.RichText:a.sharedStrings&&(c.ssId=a.sharedStrings.add(c.value));break;case r.ValueType.Date:a.date1904&&(c.date1904=!0);break;case r.ValueType.Hyperlink:a.sharedStrings&&c.text!==void 0&&c.text!==null&&(c.ssId=a.sharedStrings.add(c.text)),a.hyperlinks.push({address:c.address,target:c.hyperlink,tooltip:c.tooltip});break;case r.ValueType.Merge:a.merges.add(c);break;case r.ValueType.Formula:if(a.date1904&&(c.date1904=!0),c.shareType==="shared"&&(c.si=a.siFormulae++),c.formula)a.formulae[c.address]=c;else if(c.sharedFormula){const f=a.formulae[c.sharedFormula];if(!f)throw new Error("Shared Formula master must exist above and or left of clone for cell "+c.address);f.si===void 0?(f.shareType="shared",f.si=a.siFormulae++,f.range=new o(f.address,c.address)):f.range&&f.range.expandToAddress(c.address),c.si=f.si}}}renderFormula(c,a){let s=null;switch(a.shareType){case"shared":s={t:"shared",ref:a.ref||a.range.range,si:a.si};break;case"array":s={t:"array",ref:a.ref};break;default:a.si!==void 0&&(s={t:"shared",si:a.si})}switch(n(a.result)){case r.ValueType.Null:c.leafNode("f",s,a.formula);break;case r.ValueType.String:c.addAttribute("t","str"),c.leafNode("f",s,a.formula),c.leafNode("v",null,a.result);break;case r.ValueType.Number:c.leafNode("f",s,a.formula),c.leafNode("v",null,a.result);break;case r.ValueType.Boolean:c.addAttribute("t","b"),c.leafNode("f",s,a.formula),c.leafNode("v",null,a.result?1:0);break;case r.ValueType.Error:c.addAttribute("t","e"),c.leafNode("f",s,a.formula),c.leafNode("v",null,a.result.error);break;case r.ValueType.Date:c.leafNode("f",s,a.formula),c.leafNode("v",null,l.dateToExcel(a.result,a.date1904));break;default:throw new Error("I could not understand type of value")}}render(c,a){if(a.type!==r.ValueType.Null||a.styleId){switch(c.openNode("c"),c.addAttribute("r",a.address),a.styleId&&c.addAttribute("s",a.styleId),a.type){case r.ValueType.Null:break;case r.ValueType.Number:c.leafNode("v",null,a.value);break;case r.ValueType.Boolean:c.addAttribute("t","b"),c.leafNode("v",null,a.value?"1":"0");break;case r.ValueType.Error:c.addAttribute("t","e"),c.leafNode("v",null,a.value.error);break;case r.ValueType.String:case r.ValueType.RichText:a.ssId!==void 0?(c.addAttribute("t","s"),c.leafNode("v",null,a.ssId)):a.value&&a.value.richText?(c.addAttribute("t","inlineStr"),c.openNode("is"),a.value.richText.forEach(s=>{this.richTextXForm.render(c,s)}),c.closeNode("is")):(c.addAttribute("t","str"),c.leafNode("v",null,a.value));break;case r.ValueType.Date:c.leafNode("v",null,l.dateToExcel(a.value,a.date1904));break;case r.ValueType.Hyperlink:a.ssId!==void 0?(c.addAttribute("t","s"),c.leafNode("v",null,a.ssId)):(c.addAttribute("t","str"),c.leafNode("v",null,a.text));break;case r.ValueType.Formula:this.renderFormula(c,a);break;case r.ValueType.Merge:}c.closeNode()}}parseOpen(c){if(this.parser)return this.parser.parseOpen(c),!0;switch(c.name){case"c":return this.model={address:c.attributes.r},this.t=c.attributes.t,c.attributes.s&&(this.model.styleId=parseInt(c.attributes.s,10)),!0;case"f":return this.currentNode="f",this.model.si=c.attributes.si,this.model.shareType=c.attributes.t,this.model.ref=c.attributes.ref,!0;case"v":return this.currentNode="v",!0;case"t":return this.currentNode="t",!0;case"r":return this.parser=this.richTextXForm,this.parser.parseOpen(c),!0;default:return!1}}parseText(c){if(this.parser)this.parser.parseText(c);else switch(this.currentNode){case"f":this.model.formula=this.model.formula?this.model.formula+c:c;break;case"v":case"t":this.model.value&&this.model.value.richText?this.model.value.richText.text=this.model.value.richText.text?this.model.value.richText.text+c:c:this.model.value=this.model.value?this.model.value+c:c}}parseClose(c){switch(c){case"c":{const{model:a}=this;if(a.formula||a.shareType)a.type=r.ValueType.Formula,a.value&&(this.t==="str"?a.result=l.xmlDecode(a.value):this.t==="b"?a.result=parseInt(a.value,10)!==0:this.t==="e"?a.result={error:a.value}:a.result=parseFloat(a.value),a.value=void 0);else if(a.value!==void 0)switch(this.t){case"s":a.type=r.ValueType.String,a.value=parseInt(a.value,10);break;case"str":a.type=r.ValueType.String,a.value=l.xmlDecode(a.value);break;case"inlineStr":a.type=r.ValueType.String;break;case"b":a.type=r.ValueType.Boolean,a.value=parseInt(a.value,10)!==0;break;case"e":a.type=r.ValueType.Error,a.value={error:a.value};break;default:a.type=r.ValueType.Number,a.value=parseFloat(a.value)}else a.styleId?a.type=r.ValueType.Null:a.type=r.ValueType.Merge;return!1}case"f":case"v":case"is":return this.currentNode=void 0,!0;case"t":return this.parser?(this.parser.parseClose(c),!0):(this.currentNode=void 0,!0);case"r":return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText||[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return!!this.parser&&(this.parser.parseClose(c),!0)}}reconcile(c,a){const s=c.styleId&&a.styles&&a.styles.getStyleModel(c.styleId);switch(s&&(c.style=s),c.styleId!==void 0&&(c.styleId=void 0),c.type){case r.ValueType.String:typeof c.value=="number"&&a.sharedStrings&&(c.value=a.sharedStrings.getString(c.value)),c.value.richText&&(c.type=r.ValueType.RichText);break;case r.ValueType.Number:s&&l.isDateFmt(s.numFmt)&&(c.type=r.ValueType.Date,c.value=l.excelToDate(c.value,a.date1904));break;case r.ValueType.Formula:c.result!==void 0&&s&&l.isDateFmt(s.numFmt)&&(c.result=l.excelToDate(c.result,a.date1904)),c.shareType==="shared"&&(c.ref?a.formulae[c.si]=c.address:(c.sharedFormula=a.formulae[c.si],delete c.shareType),delete c.si)}const f=a.hyperlinkMap[c.address];f&&(c.type===r.ValueType.Formula?(c.text=c.result,c.result=void 0):(c.text=c.value,c.value=void 0),c.type=r.ValueType.Hyperlink,c.hyperlink=f);const p=a.commentsMap&&a.commentsMap[c.address];p&&(c.comment=p)}}},{"../../../doc/enums":7,"../../../doc/range":10,"../../../utils/utils":27,"../base-xform":32,"../strings/rich-text-xform":122}],74:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{get tag(){return"x14:cfIcon"}render(i,o){i.leafNode(this.tag,{iconSet:o.iconSet,iconId:o.iconId})}parseOpen(i){let{attributes:o}=i;this.model={iconSet:o.iconSet,iconId:l.toIntValue(o.iconId)}}parseClose(i){return i!==this.tag}}},{"../../base-xform":32}],75:[function(t,h,d){const{v4:l}=t("uuid"),i=t("../../base-xform"),o=t("../../composite-xform"),r=t("./databar-ext-xform"),e=t("./icon-set-ext-xform"),n={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};class c extends o{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new r,"x14:iconSet":this.iconSetXform=new e}}get tag(){return"x14:cfRule"}static isExt(s){return s.type==="dataBar"?r.isExt(s):!(s.type!=="iconSet"||!s.custom&&!n[s.iconSet])}prepare(s){c.isExt(s)&&(s.x14Id=`{${l()}}`.toUpperCase())}render(s,f){if(c.isExt(f))switch(f.type){case"dataBar":this.renderDataBar(s,f);break;case"iconSet":this.renderIconSet(s,f)}}renderDataBar(s,f){s.openNode(this.tag,{type:"dataBar",id:f.x14Id}),this.databarXform.render(s,f),s.closeNode()}renderIconSet(s,f){s.openNode(this.tag,{type:"iconSet",priority:f.priority,id:f.x14Id||`{${l()}}`}),this.iconSetXform.render(s,f),s.closeNode()}createNewModel(s){let{attributes:f}=s;return{type:f.type,x14Id:f.id,priority:i.toIntValue(f.priority)}}onParserClose(s,f){Object.assign(this.model,f.model)}}h.exports=c},{"../../base-xform":32,"../../composite-xform":48,"./databar-ext-xform":79,"./icon-set-ext-xform":81,uuid:528}],76:[function(t,h,d){const l=t("../../composite-xform"),i=t("./f-ext-xform");h.exports=class extends l{constructor(){super(),this.map={"xm:f":this.fExtXform=new i}}get tag(){return"x14:cfvo"}render(o,r){o.openNode(this.tag,{type:r.type}),r.value!==void 0&&this.fExtXform.render(o,r.value),o.closeNode()}createNewModel(o){return{type:o.attributes.type}}onParserClose(o,r){switch(o){case"xm:f":this.model.value=r.model?parseFloat(r.model):0}}}},{"../../composite-xform":48,"./f-ext-xform":80}],77:[function(t,h,d){const l=t("../../composite-xform"),i=t("./sqref-ext-xform"),o=t("./cf-rule-ext-xform");h.exports=class extends l{constructor(){super(),this.map={"xm:sqref":this.sqRef=new i,"x14:cfRule":this.cfRule=new o}}get tag(){return"x14:conditionalFormatting"}prepare(r,e){r.rules.forEach(n=>{this.cfRule.prepare(n,e)})}render(r,e){e.rules.some(o.isExt)&&(r.openNode(this.tag,{"xmlns:xm":"http://schemas.microsoft.com/office/excel/2006/main"}),e.rules.filter(o.isExt).forEach(n=>this.cfRule.render(r,n)),this.sqRef.render(r,e.ref),r.closeNode())}createNewModel(){return{rules:[]}}onParserClose(r,e){switch(r){case"xm:sqref":this.model.ref=e.model;break;case"x14:cfRule":this.model.rules.push(e.model)}}}},{"../../composite-xform":48,"./cf-rule-ext-xform":75,"./sqref-ext-xform":82}],78:[function(t,h,d){const l=t("../../composite-xform"),i=t("./cf-rule-ext-xform"),o=t("./conditional-formatting-ext-xform");h.exports=class extends l{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new o}}get tag(){return"x14:conditionalFormattings"}hasContent(r){return r.hasExtContent===void 0&&(r.hasExtContent=r.some(e=>e.rules.some(i.isExt))),r.hasExtContent}prepare(r,e){r.forEach(n=>{this.cfXform.prepare(n,e)})}render(r,e){this.hasContent(e)&&(r.openNode(this.tag),e.forEach(n=>this.cfXform.render(r,n)),r.closeNode())}createNewModel(){return[]}onParserClose(r,e){this.model.push(e.model)}}},{"../../composite-xform":48,"./cf-rule-ext-xform":75,"./conditional-formatting-ext-xform":77}],79:[function(t,h,d){const l=t("../../base-xform"),i=t("../../composite-xform"),o=t("../../style/color-xform"),r=t("./cfvo-ext-xform");h.exports=class extends i{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new r,"x14:borderColor":this.borderColorXform=new o("x14:borderColor"),"x14:negativeBorderColor":this.negativeBorderColorXform=new o("x14:negativeBorderColor"),"x14:negativeFillColor":this.negativeFillColorXform=new o("x14:negativeFillColor"),"x14:axisColor":this.axisColorXform=new o("x14:axisColor")}}static isExt(e){return!e.gradient}get tag(){return"x14:dataBar"}render(e,n){e.openNode(this.tag,{minLength:l.toIntAttribute(n.minLength,0,!0),maxLength:l.toIntAttribute(n.maxLength,100,!0),border:l.toBoolAttribute(n.border,!1),gradient:l.toBoolAttribute(n.gradient,!0),negativeBarColorSameAsPositive:l.toBoolAttribute(n.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:l.toBoolAttribute(n.negativeBarBorderColorSameAsPositive,!0),axisPosition:l.toAttribute(n.axisPosition,"auto"),direction:l.toAttribute(n.direction,"leftToRight")}),n.cfvo.forEach(c=>{this.cfvoXform.render(e,c)}),this.borderColorXform.render(e,n.borderColor),this.negativeBorderColorXform.render(e,n.negativeBorderColor),this.negativeFillColorXform.render(e,n.negativeFillColor),this.axisColorXform.render(e,n.axisColor),e.closeNode()}createNewModel(e){let{attributes:n}=e;return{cfvo:[],minLength:l.toIntValue(n.minLength,0),maxLength:l.toIntValue(n.maxLength,100),border:l.toBoolValue(n.border,!1),gradient:l.toBoolValue(n.gradient,!0),negativeBarColorSameAsPositive:l.toBoolValue(n.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:l.toBoolValue(n.negativeBarBorderColorSameAsPositive,!0),axisPosition:l.toStringValue(n.axisPosition,"auto"),direction:l.toStringValue(n.direction,"leftToRight")}}onParserClose(e,n){const[,c]=e.split(":");switch(c){case"cfvo":this.model.cfvo.push(n.model);break;default:this.model[c]=n.model}}}},{"../../base-xform":32,"../../composite-xform":48,"../../style/color-xform":128,"./cfvo-ext-xform":76}],80:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{get tag(){return"xm:f"}render(i,o){i.leafNode(this.tag,null,o)}parseOpen(){this.model=""}parseText(i){this.model+=i}parseClose(i){return i!==this.tag}}},{"../../base-xform":32}],81:[function(t,h,d){const l=t("../../base-xform"),i=t("../../composite-xform"),o=t("./cfvo-ext-xform"),r=t("./cf-icon-ext-xform");h.exports=class extends i{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new o,"x14:cfIcon":this.cfIconXform=new r}}get tag(){return"x14:iconSet"}render(e,n){e.openNode(this.tag,{iconSet:l.toStringAttribute(n.iconSet),reverse:l.toBoolAttribute(n.reverse,!1),showValue:l.toBoolAttribute(n.showValue,!0),custom:l.toBoolAttribute(n.icons,!1)}),n.cfvo.forEach(c=>{this.cfvoXform.render(e,c)}),n.icons&&n.icons.forEach((c,a)=>{c.iconId=a,this.cfIconXform.render(e,c)}),e.closeNode()}createNewModel(e){let{attributes:n}=e;return{cfvo:[],iconSet:l.toStringValue(n.iconSet,"3TrafficLights"),reverse:l.toBoolValue(n.reverse,!1),showValue:l.toBoolValue(n.showValue,!0)}}onParserClose(e,n){const[,c]=e.split(":");switch(c){case"cfvo":this.model.cfvo.push(n.model);break;case"cfIcon":this.model.icons||(this.model.icons=[]),this.model.icons.push(n.model);break;default:this.model[c]=n.model}}}},{"../../base-xform":32,"../../composite-xform":48,"./cf-icon-ext-xform":74,"./cfvo-ext-xform":76}],82:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{get tag(){return"xm:sqref"}render(i,o){i.leafNode(this.tag,null,o)}parseOpen(){this.model=""}parseText(i){this.model+=i}parseClose(i){return i!==this.tag}}},{"../../base-xform":32}],83:[function(t,h,d){const l=t("../../base-xform"),i=t("../../composite-xform"),o=t("../../../../doc/range"),r=t("./databar-xform"),e=t("./ext-lst-ref-xform"),n=t("./formula-xform"),c=t("./color-scale-xform"),a=t("./icon-set-xform"),s={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},f=u=>{const{type:g,operator:m}=u;switch(g){case"containsText":case"containsBlanks":case"notContainsBlanks":case"containsErrors":case"notContainsErrors":return{type:"containsText",operator:g};default:return{type:g,operator:m}}};class p extends i{constructor(){super(),this.map={dataBar:this.databarXform=new r,extLst:this.extLstRefXform=new e,formula:this.formulaXform=new n,colorScale:this.colorScaleXform=new c,iconSet:this.iconSetXform=new a}}get tag(){return"cfRule"}static isPrimitive(g){return g.type!=="iconSet"||!g.custom&&!s[g.iconSet]}render(g,m){switch(m.type){case"expression":this.renderExpression(g,m);break;case"cellIs":this.renderCellIs(g,m);break;case"top10":this.renderTop10(g,m);break;case"aboveAverage":this.renderAboveAverage(g,m);break;case"dataBar":this.renderDataBar(g,m);break;case"colorScale":this.renderColorScale(g,m);break;case"iconSet":this.renderIconSet(g,m);break;case"containsText":this.renderText(g,m);break;case"timePeriod":this.renderTimePeriod(g,m)}}renderExpression(g,m){g.openNode(this.tag,{type:"expression",dxfId:m.dxfId,priority:m.priority}),this.formulaXform.render(g,m.formulae[0]),g.closeNode()}renderCellIs(g,m){g.openNode(this.tag,{type:"cellIs",dxfId:m.dxfId,priority:m.priority,operator:m.operator}),m.formulae.forEach(v=>{this.formulaXform.render(g,v)}),g.closeNode()}renderTop10(g,m){g.leafNode(this.tag,{type:"top10",dxfId:m.dxfId,priority:m.priority,percent:l.toBoolAttribute(m.percent,!1),bottom:l.toBoolAttribute(m.bottom,!1),rank:l.toIntValue(m.rank,10,!0)})}renderAboveAverage(g,m){g.leafNode(this.tag,{type:"aboveAverage",dxfId:m.dxfId,priority:m.priority,aboveAverage:l.toBoolAttribute(m.aboveAverage,!0)})}renderDataBar(g,m){g.openNode(this.tag,{type:"dataBar",priority:m.priority}),this.databarXform.render(g,m),this.extLstRefXform.render(g,m),g.closeNode()}renderColorScale(g,m){g.openNode(this.tag,{type:"colorScale",priority:m.priority}),this.colorScaleXform.render(g,m),g.closeNode()}renderIconSet(g,m){p.isPrimitive(m)&&(g.openNode(this.tag,{type:"iconSet",priority:m.priority}),this.iconSetXform.render(g,m),g.closeNode())}renderText(g,m){g.openNode(this.tag,{type:m.operator,dxfId:m.dxfId,priority:m.priority,operator:l.toStringAttribute(m.operator,"containsText")});const v=(S=>{if(S.formulae&&S.formulae[0])return S.formulae[0];const R=new o(S.ref),{tl:I}=R;switch(S.operator){case"containsText":return`NOT(ISERROR(SEARCH("${S.text}",${I})))`;case"containsBlanks":return`LEN(TRIM(${I}))=0`;case"notContainsBlanks":return`LEN(TRIM(${I}))>0`;case"containsErrors":return`ISERROR(${I})`;case"notContainsErrors":return`NOT(ISERROR(${I}))`;default:return}})(m);v&&this.formulaXform.render(g,v),g.closeNode()}renderTimePeriod(g,m){g.openNode(this.tag,{type:"timePeriod",dxfId:m.dxfId,priority:m.priority,timePeriod:m.timePeriod});const v=(S=>{if(S.formulae&&S.formulae[0])return S.formulae[0];const R=new o(S.ref),{tl:I}=R;switch(S.timePeriod){case"thisWeek":return`AND(TODAY()-ROUNDDOWN(${I},0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(${I},0)-TODAY()<=7-WEEKDAY(TODAY()))`;case"lastWeek":return`AND(TODAY()-ROUNDDOWN(${I},0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(${I},0)<(WEEKDAY(TODAY())+7))`;case"nextWeek":return`AND(ROUNDDOWN(${I},0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(${I},0)-TODAY()<(15-WEEKDAY(TODAY())))`;case"yesterday":return`FLOOR(${I},1)=TODAY()-1`;case"today":return`FLOOR(${I},1)=TODAY()`;case"tomorrow":return`FLOOR(${I},1)=TODAY()+1`;case"last7Days":return`AND(TODAY()-FLOOR(${I},1)<=6,FLOOR(${I},1)<=TODAY())`;case"lastMonth":return`AND(MONTH(${I})=MONTH(EDATE(TODAY(),0-1)),YEAR(${I})=YEAR(EDATE(TODAY(),0-1)))`;case"thisMonth":return`AND(MONTH(${I})=MONTH(TODAY()),YEAR(${I})=YEAR(TODAY()))`;case"nextMonth":return`AND(MONTH(${I})=MONTH(EDATE(TODAY(),0+1)),YEAR(${I})=YEAR(EDATE(TODAY(),0+1)))`;default:return}})(m);v&&this.formulaXform.render(g,v),g.closeNode()}createNewModel(g){let{attributes:m}=g;return{...f(m),dxfId:l.toIntValue(m.dxfId),priority:l.toIntValue(m.priority),timePeriod:m.timePeriod,percent:l.toBoolValue(m.percent),bottom:l.toBoolValue(m.bottom),rank:l.toIntValue(m.rank),aboveAverage:l.toBoolValue(m.aboveAverage)}}onParserClose(g,m){switch(g){case"dataBar":case"extLst":case"colorScale":case"iconSet":Object.assign(this.model,m.model);break;case"formula":this.model.formulae=this.model.formulae||[],this.model.formulae.push(m.model)}}}h.exports=p},{"../../../../doc/range":10,"../../base-xform":32,"../../composite-xform":48,"./color-scale-xform":85,"./databar-xform":88,"./ext-lst-ref-xform":89,"./formula-xform":90,"./icon-set-xform":91}],84:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{get tag(){return"cfvo"}render(i,o){i.leafNode(this.tag,{type:o.type,val:o.value})}parseOpen(i){this.model={type:i.attributes.type,value:l.toFloatValue(i.attributes.val)}}parseClose(i){return i!==this.tag}}},{"../../base-xform":32}],85:[function(t,h,d){const l=t("../../composite-xform"),i=t("../../style/color-xform"),o=t("./cfvo-xform");h.exports=class extends l{constructor(){super(),this.map={cfvo:this.cfvoXform=new o,color:this.colorXform=new i}}get tag(){return"colorScale"}render(r,e){r.openNode(this.tag),e.cfvo.forEach(n=>{this.cfvoXform.render(r,n)}),e.color.forEach(n=>{this.colorXform.render(r,n)}),r.closeNode()}createNewModel(r){return{cfvo:[],color:[]}}onParserClose(r,e){this.model[r].push(e.model)}}},{"../../composite-xform":48,"../../style/color-xform":128,"./cfvo-xform":84}],86:[function(t,h,d){const l=t("../../composite-xform"),i=t("./cf-rule-xform");h.exports=class extends l{constructor(){super(),this.map={cfRule:new i}}get tag(){return"conditionalFormatting"}render(o,r){r.rules.some(i.isPrimitive)&&(o.openNode(this.tag,{sqref:r.ref}),r.rules.forEach(e=>{i.isPrimitive(e)&&(e.ref=r.ref,this.map.cfRule.render(o,e))}),o.closeNode())}createNewModel(o){let{attributes:r}=o;return{ref:r.sqref,rules:[]}}onParserClose(o,r){this.model.rules.push(r.model)}}},{"../../composite-xform":48,"./cf-rule-xform":83}],87:[function(t,h,d){const l=t("../../base-xform"),i=t("./conditional-formatting-xform");h.exports=class extends l{constructor(){super(),this.cfXform=new i}get tag(){return"conditionalFormatting"}reset(){this.model=[]}prepare(o,r){let e=o.reduce((n,c)=>Math.max(n,...c.rules.map(a=>a.priority||0)),1);o.forEach(n=>{n.rules.forEach(c=>{c.priority||(c.priority=e++),c.style&&(c.dxfId=r.styles.addDxfStyle(c.style))})})}render(o,r){r.forEach(e=>{this.cfXform.render(o,e)})}parseOpen(o){if(this.parser)return this.parser.parseOpen(o),!0;switch(o.name){case"conditionalFormatting":return this.parser=this.cfXform,this.parser.parseOpen(o),!0;default:return!1}}parseText(o){this.parser&&this.parser.parseText(o)}parseClose(o){return!!this.parser&&(!!this.parser.parseClose(o)||(this.model.push(this.parser.model),this.parser=void 0,!1))}reconcile(o,r){o.forEach(e=>{e.rules.forEach(n=>{n.dxfId!==void 0&&(n.style=r.styles.getDxfStyle(n.dxfId),delete n.dxfId)})})}}},{"../../base-xform":32,"./conditional-formatting-xform":86}],88:[function(t,h,d){const l=t("../../composite-xform"),i=t("../../style/color-xform"),o=t("./cfvo-xform");h.exports=class extends l{constructor(){super(),this.map={cfvo:this.cfvoXform=new o,color:this.colorXform=new i}}get tag(){return"dataBar"}render(r,e){r.openNode(this.tag),e.cfvo.forEach(n=>{this.cfvoXform.render(r,n)}),this.colorXform.render(r,e.color),r.closeNode()}createNewModel(){return{cfvo:[]}}onParserClose(r,e){switch(r){case"cfvo":this.model.cfvo.push(e.model);break;case"color":this.model.color=e.model}}}},{"../../composite-xform":48,"../../style/color-xform":128,"./cfvo-xform":84}],89:[function(t,h,d){const l=t("../../base-xform"),i=t("../../composite-xform");class o extends l{get tag(){return"x14:id"}render(n,c){n.leafNode(this.tag,null,c)}parseOpen(){this.model=""}parseText(n){this.model+=n}parseClose(n){return n!==this.tag}}class r extends i{constructor(){super(),this.map={"x14:id":this.idXform=new o}}get tag(){return"ext"}render(n,c){n.openNode(this.tag,{uri:"{B025F937-C7B1-47D3-B67F-A62EFF666E3E}","xmlns:x14":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"}),this.idXform.render(n,c.x14Id),n.closeNode()}createNewModel(){return{}}onParserClose(n,c){this.model.x14Id=c.model}}h.exports=class extends i{constructor(){super(),this.map={ext:new r}}get tag(){return"extLst"}render(e,n){e.openNode(this.tag),this.map.ext.render(e,n),e.closeNode()}createNewModel(){return{}}onParserClose(e,n){Object.assign(this.model,n.model)}}},{"../../base-xform":32,"../../composite-xform":48}],90:[function(t,h,d){const l=t("../../base-xform");h.exports=class extends l{get tag(){return"formula"}render(i,o){i.leafNode(this.tag,null,o)}parseOpen(){this.model=""}parseText(i){this.model+=i}parseClose(i){return i!==this.tag}}},{"../../base-xform":32}],91:[function(t,h,d){const l=t("../../base-xform"),i=t("../../composite-xform"),o=t("./cfvo-xform");h.exports=class extends i{constructor(){super(),this.map={cfvo:this.cfvoXform=new o}}get tag(){return"iconSet"}render(r,e){r.openNode(this.tag,{iconSet:l.toStringAttribute(e.iconSet,"3TrafficLights"),reverse:l.toBoolAttribute(e.reverse,!1),showValue:l.toBoolAttribute(e.showValue,!0)}),e.cfvo.forEach(n=>{this.cfvoXform.render(r,n)}),r.closeNode()}createNewModel(r){let{attributes:e}=r;return{iconSet:l.toStringValue(e.iconSet,"3TrafficLights"),reverse:l.toBoolValue(e.reverse),showValue:l.toBoolValue(e.showValue),cfvo:[]}}onParserClose(r,e){this.model[r].push(e.model)}}},{"../../base-xform":32,"../../composite-xform":48,"./cfvo-xform":84}],92:[function(t,h,d){const l=t("../../../utils/utils"),i=t("../base-xform");h.exports=class extends i{get tag(){return"col"}prepare(o,r){const e=r.styles.addStyleModel(o.style||{});e&&(o.styleId=e)}render(o,r){o.openNode("col"),o.addAttribute("min",r.min),o.addAttribute("max",r.max),r.width&&o.addAttribute("width",r.width),r.styleId&&o.addAttribute("style",r.styleId),r.hidden&&o.addAttribute("hidden","1"),r.bestFit&&o.addAttribute("bestFit","1"),r.outlineLevel&&o.addAttribute("outlineLevel",r.outlineLevel),r.collapsed&&o.addAttribute("collapsed","1"),o.addAttribute("customWidth","1"),o.closeNode()}parseOpen(o){if(o.name==="col"){const r=this.model={min:parseInt(o.attributes.min||"0",10),max:parseInt(o.attributes.max||"0",10),width:o.attributes.width===void 0?void 0:parseFloat(o.attributes.width||"0")};return o.attributes.style&&(r.styleId=parseInt(o.attributes.style,10)),l.parseBoolean(o.attributes.hidden)&&(r.hidden=!0),l.parseBoolean(o.attributes.bestFit)&&(r.bestFit=!0),o.attributes.outlineLevel&&(r.outlineLevel=parseInt(o.attributes.outlineLevel,10)),l.parseBoolean(o.attributes.collapsed)&&(r.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(o,r){o.styleId&&(o.style=r.styles.getStyleModel(o.styleId))}}},{"../../../utils/utils":27,"../base-xform":32}],93:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../../../utils/utils"),o=t("../../../utils/col-cache"),r=t("../base-xform"),e=t("../../../doc/range");function n(a,s,f,p){const u=s[f];u!==void 0?a[f]=u:p!==void 0&&(a[f]=p)}function c(a,s,f,p){const u=s[f];u!==void 0&&(a[f]=i.parseBoolean(u))}h.exports=class extends r{get tag(){return"dataValidations"}render(a,s){const f=function(p){const u=l.map(p,(v,S)=>({address:S,dataValidation:v,marked:!1})).sort((v,S)=>l.strcmp(v.address,S.address)),g=l.keyBy(u,"address"),m=(v,S,R)=>{for(let I=0;I<S;I++){const F=o.encodeAddress(v.row+I,R);if(!p[F]||!l.isEqual(p[v.address],p[F]))return!1}return!0};return u.map(v=>{if(!v.marked){const S=o.decodeEx(v.address);if(S.dimensions)return g[S.dimensions].marked=!0,{...v.dataValidation,sqref:v.address};let R=1,I=o.encodeAddress(S.row+R,S.col);for(;p[I]&&l.isEqual(v.dataValidation,p[I]);)R++,I=o.encodeAddress(S.row+R,S.col);let F=1;for(;m(S,R,S.col+F);)F++;for(let j=0;j<R;j++)for(let L=0;L<F;L++)I=o.encodeAddress(S.row+j,S.col+L),g[I].marked=!0;if(R>1||F>1){const j=S.row+(R-1),L=S.col+(F-1);return{...v.dataValidation,sqref:`${v.address}:${o.encodeAddress(j,L)}`}}return{...v.dataValidation,sqref:v.address}}return null}).filter(Boolean)}(s);f.length&&(a.openNode("dataValidations",{count:f.length}),f.forEach(p=>{a.openNode("dataValidation"),p.type!=="any"&&(a.addAttribute("type",p.type),p.operator&&p.type!=="list"&&p.operator!=="between"&&a.addAttribute("operator",p.operator),p.allowBlank&&a.addAttribute("allowBlank","1")),p.showInputMessage&&a.addAttribute("showInputMessage","1"),p.promptTitle&&a.addAttribute("promptTitle",p.promptTitle),p.prompt&&a.addAttribute("prompt",p.prompt),p.showErrorMessage&&a.addAttribute("showErrorMessage","1"),p.errorStyle&&a.addAttribute("errorStyle",p.errorStyle),p.errorTitle&&a.addAttribute("errorTitle",p.errorTitle),p.error&&a.addAttribute("error",p.error),a.addAttribute("sqref",p.sqref),(p.formulae||[]).forEach((u,g)=>{a.openNode("formula"+(g+1)),p.type==="date"?a.writeText(i.dateToExcel(new Date(u))):a.writeText(u),a.closeNode()}),a.closeNode()}),a.closeNode())}parseOpen(a){switch(a.name){case"dataValidations":return this.model={},!0;case"dataValidation":{this._address=a.attributes.sqref;const s={type:a.attributes.type||"any",formulae:[]};switch(a.attributes.type&&c(s,a.attributes,"allowBlank"),c(s,a.attributes,"showInputMessage"),c(s,a.attributes,"showErrorMessage"),s.type){case"any":case"list":case"custom":break;default:n(s,a.attributes,"operator","between")}return n(s,a.attributes,"promptTitle"),n(s,a.attributes,"prompt"),n(s,a.attributes,"errorStyle"),n(s,a.attributes,"errorTitle"),n(s,a.attributes,"error"),this._dataValidation=s,!0}case"formula1":case"formula2":return this._formula=[],!0;default:return!1}}parseText(a){this._formula&&this._formula.push(a)}parseClose(a){switch(a){case"dataValidations":return!1;case"dataValidation":return this._dataValidation.formulae&&this._dataValidation.formulae.length||(delete this._dataValidation.formulae,delete this._dataValidation.operator),(this._address.split(/\s+/g)||[]).forEach(s=>{s.includes(":")?new e(s).forEachAddress(f=>{this.model[f]=this._dataValidation}):this.model[s]=this._dataValidation}),!0;case"formula1":case"formula2":{let s=this._formula.join("");switch(this._dataValidation.type){case"whole":case"textLength":s=parseInt(s,10);break;case"decimal":s=parseFloat(s);break;case"date":s=i.excelToDate(parseFloat(s))}return this._dataValidation.formulae.push(s),this._formula=void 0,!0}default:return!0}}}},{"../../../doc/range":10,"../../../utils/col-cache":19,"../../../utils/under-dash":26,"../../../utils/utils":27,"../base-xform":32}],94:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"dimension"}render(i,o){o&&i.leafNode("dimension",{ref:o})}parseOpen(i){return i.name==="dimension"&&(this.model=i.attributes.ref,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],95:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"drawing"}render(i,o){o&&i.leafNode(this.tag,{"r:id":o.rId})}parseOpen(i){switch(i.name){case this.tag:return this.model={rId:i.attributes["r:id"]},!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],96:[function(t,h,d){const l=t("../composite-xform"),i=t("./cf-ext/conditional-formattings-ext-xform");class o extends l{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new i}}get tag(){return"ext"}hasContent(e){return this.conditionalFormattings.hasContent(e.conditionalFormattings)}prepare(e,n){this.conditionalFormattings.prepare(e.conditionalFormattings,n)}render(e,n){e.openNode("ext",{uri:"{78C0D931-6437-407d-A8EE-F0AAD7539E65}","xmlns:x14":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"}),this.conditionalFormattings.render(e,n.conditionalFormattings),e.closeNode()}createNewModel(){return{}}onParserClose(e,n){this.model[e]=n.model}}h.exports=class extends l{constructor(){super(),this.map={ext:this.ext=new o}}get tag(){return"extLst"}prepare(r,e){this.ext.prepare(r,e)}hasContent(r){return this.ext.hasContent(r)}render(r,e){this.hasContent(e)&&(r.openNode("extLst"),this.ext.render(r,e),r.closeNode())}createNewModel(){return{}}onParserClose(r,e){Object.assign(this.model,e.model)}}},{"../composite-xform":48,"./cf-ext/conditional-formattings-ext-xform":78}],97:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"headerFooter"}render(i,o){if(o){i.addRollback();let r=!1;i.openNode("headerFooter"),o.differentFirst&&(i.addAttribute("differentFirst","1"),r=!0),o.differentOddEven&&(i.addAttribute("differentOddEven","1"),r=!0),o.oddHeader&&typeof o.oddHeader=="string"&&(i.leafNode("oddHeader",null,o.oddHeader),r=!0),o.oddFooter&&typeof o.oddFooter=="string"&&(i.leafNode("oddFooter",null,o.oddFooter),r=!0),o.evenHeader&&typeof o.evenHeader=="string"&&(i.leafNode("evenHeader",null,o.evenHeader),r=!0),o.evenFooter&&typeof o.evenFooter=="string"&&(i.leafNode("evenFooter",null,o.evenFooter),r=!0),o.firstHeader&&typeof o.firstHeader=="string"&&(i.leafNode("firstHeader",null,o.firstHeader),r=!0),o.firstFooter&&typeof o.firstFooter=="string"&&(i.leafNode("firstFooter",null,o.firstFooter),r=!0),r?(i.closeNode(),i.commit()):i.rollback()}}parseOpen(i){switch(i.name){case"headerFooter":return this.model={},i.attributes.differentFirst&&(this.model.differentFirst=parseInt(i.attributes.differentFirst,0)===1),i.attributes.differentOddEven&&(this.model.differentOddEven=parseInt(i.attributes.differentOddEven,0)===1),!0;case"oddHeader":return this.currentNode="oddHeader",!0;case"oddFooter":return this.currentNode="oddFooter",!0;case"evenHeader":return this.currentNode="evenHeader",!0;case"evenFooter":return this.currentNode="evenFooter",!0;case"firstHeader":return this.currentNode="firstHeader",!0;case"firstFooter":return this.currentNode="firstFooter",!0;default:return!1}}parseText(i){switch(this.currentNode){case"oddHeader":this.model.oddHeader=i;break;case"oddFooter":this.model.oddFooter=i;break;case"evenHeader":this.model.evenHeader=i;break;case"evenFooter":this.model.evenFooter=i;break;case"firstHeader":this.model.firstHeader=i;break;case"firstFooter":this.model.firstFooter=i}}parseClose(){switch(this.currentNode){case"oddHeader":case"oddFooter":case"evenHeader":case"evenFooter":case"firstHeader":case"firstFooter":return this.currentNode=void 0,!0;default:return!1}}}},{"../base-xform":32}],98:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"hyperlink"}render(i,o){this.isInternalLink(o)?i.leafNode("hyperlink",{ref:o.address,"r:id":o.rId,tooltip:o.tooltip,location:o.target}):i.leafNode("hyperlink",{ref:o.address,"r:id":o.rId,tooltip:o.tooltip})}parseOpen(i){return i.name==="hyperlink"&&(this.model={address:i.attributes.ref,rId:i.attributes["r:id"],tooltip:i.attributes.tooltip},i.attributes.location&&(this.model.target=i.attributes.location),!0)}parseText(){}parseClose(){return!1}isInternalLink(i){return i.target&&/^[^!]+![a-zA-Z]+[\d]+$/.test(i.target)}}},{"../base-xform":32}],99:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"mergeCell"}render(i,o){i.leafNode("mergeCell",{ref:o})}parseOpen(i){return i.name==="mergeCell"&&(this.model=i.attributes.ref,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],100:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../../../doc/range"),o=t("../../../utils/col-cache"),r=t("../../../doc/enums");h.exports=class{constructor(){this.merges={}}add(e){if(this.merges[e.master])this.merges[e.master].expandToAddress(e.address);else{const n=`${e.master}:${e.address}`;this.merges[e.master]=new i(n)}}get mergeCells(){return l.map(this.merges,e=>e.range)}reconcile(e,n){l.each(e,c=>{const a=o.decode(c);for(let s=a.top;s<=a.bottom;s++){const f=n[s-1];for(let p=a.left;p<=a.right;p++){const u=f.cells[p-1];u?u.type===r.ValueType.Merge&&(u.master=a.tl):f.cells[p]={type:r.ValueType.Null,address:o.encodeAddress(s,p)}}}})}getMasterAddress(e){const n=this.hash[e];return n&&n.tl}}},{"../../../doc/enums":7,"../../../doc/range":10,"../../../utils/col-cache":19,"../../../utils/under-dash":26}],101:[function(t,h,d){const l=t("../base-xform"),i=o=>o!==void 0;h.exports=class extends l{get tag(){return"outlinePr"}render(o,r){return!(!r||!i(r.summaryBelow)&&!i(r.summaryRight))&&(o.leafNode(this.tag,{summaryBelow:i(r.summaryBelow)?Number(r.summaryBelow):void 0,summaryRight:i(r.summaryRight)?Number(r.summaryRight):void 0}),!0)}parseOpen(o){return o.name===this.tag&&(this.model={summaryBelow:i(o.attributes.summaryBelow)?!!Number(o.attributes.summaryBelow):void 0,summaryRight:i(o.attributes.summaryRight)?!!Number(o.attributes.summaryRight):void 0},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],102:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"brk"}render(i,o){i.leafNode("brk",o)}parseOpen(i){return i.name==="brk"&&(this.model=i.attributes.ref,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],103:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../base-xform");h.exports=class extends i{get tag(){return"pageMargins"}render(o,r){if(r){const e={left:r.left,right:r.right,top:r.top,bottom:r.bottom,header:r.header,footer:r.footer};l.some(e,n=>n!==void 0)&&o.leafNode(this.tag,e)}}parseOpen(o){switch(o.name){case this.tag:return this.model={left:parseFloat(o.attributes.left||.7),right:parseFloat(o.attributes.right||.7),top:parseFloat(o.attributes.top||.75),bottom:parseFloat(o.attributes.bottom||.75),header:parseFloat(o.attributes.header||.3),footer:parseFloat(o.attributes.footer||.3)},!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],104:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"pageSetUpPr"}render(i,o){return!(!o||!o.fitToPage)&&(i.leafNode(this.tag,{fitToPage:o.fitToPage?"1":void 0}),!0)}parseOpen(i){return i.name===this.tag&&(this.model={fitToPage:i.attributes.fitToPage==="1"},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],105:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../base-xform");function o(c){return c?"1":void 0}function r(c){switch(c){case"overThenDown":return c;default:return}}function e(c){switch(c){case"atEnd":case"asDisplyed":return c;default:return}}function n(c){switch(c){case"dash":case"blank":case"NA":return c;default:return}}h.exports=class extends i{get tag(){return"pageSetup"}render(c,a){if(a){const s={paperSize:a.paperSize,orientation:a.orientation,horizontalDpi:a.horizontalDpi,verticalDpi:a.verticalDpi,pageOrder:r(a.pageOrder),blackAndWhite:o(a.blackAndWhite),draft:o(a.draft),cellComments:e(a.cellComments),errors:n(a.errors),scale:a.scale,fitToWidth:a.fitToWidth,fitToHeight:a.fitToHeight,firstPageNumber:a.firstPageNumber,useFirstPageNumber:o(a.firstPageNumber),usePrinterDefaults:o(a.usePrinterDefaults),copies:a.copies};l.some(s,f=>f!==void 0)&&c.leafNode(this.tag,s)}}parseOpen(c){switch(c.name){case this.tag:return this.model={paperSize:(a=c.attributes.paperSize,a!==void 0?parseInt(a,10):void 0),orientation:c.attributes.orientation||"portrait",horizontalDpi:parseInt(c.attributes.horizontalDpi||"4294967295",10),verticalDpi:parseInt(c.attributes.verticalDpi||"4294967295",10),pageOrder:c.attributes.pageOrder||"downThenOver",blackAndWhite:c.attributes.blackAndWhite==="1",draft:c.attributes.draft==="1",cellComments:c.attributes.cellComments||"None",errors:c.attributes.errors||"displayed",scale:parseInt(c.attributes.scale||"100",10),fitToWidth:parseInt(c.attributes.fitToWidth||"1",10),fitToHeight:parseInt(c.attributes.fitToHeight||"1",10),firstPageNumber:parseInt(c.attributes.firstPageNumber||"1",10),useFirstPageNumber:c.attributes.useFirstPageNumber==="1",usePrinterDefaults:c.attributes.usePrinterDefaults==="1",copies:parseInt(c.attributes.copies||"1",10)},!0;default:return!1}var a}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],106:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"picture"}render(i,o){o&&i.leafNode(this.tag,{"r:id":o.rId})}parseOpen(i){switch(i.name){case this.tag:return this.model={rId:i.attributes["r:id"]},!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],107:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../base-xform");function o(r){return r?"1":void 0}h.exports=class extends i{get tag(){return"printOptions"}render(r,e){if(e){const n={headings:o(e.showRowColHeaders),gridLines:o(e.showGridLines),horizontalCentered:o(e.horizontalCentered),verticalCentered:o(e.verticalCentered)};l.some(n,c=>c!==void 0)&&r.leafNode(this.tag,n)}}parseOpen(r){switch(r.name){case this.tag:return this.model={showRowColHeaders:r.attributes.headings==="1",showGridLines:r.attributes.gridLines==="1",horizontalCentered:r.attributes.horizontalCentered==="1",verticalCentered:r.attributes.verticalCentered==="1"},!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],108:[function(t,h,d){const l=t("./page-breaks-xform"),i=t("../list-xform");h.exports=class extends i{constructor(){super({tag:"rowBreaks",count:!0,childXform:new l})}render(o,r){if(r&&r.length){o.openNode(this.tag,this.$),this.count&&(o.addAttribute(this.$count,r.length),o.addAttribute("manualBreakCount",r.length));const{childXform:e}=this;r.forEach(n=>{e.render(o,n)}),o.closeNode()}else this.empty&&o.leafNode(this.tag)}}},{"../list-xform":71,"./page-breaks-xform":102}],109:[function(t,h,d){const l=t("../base-xform"),i=t("../../../utils/utils"),o=t("./cell-xform");h.exports=class extends l{constructor(r){super(),this.maxItems=r&&r.maxItems,this.map={c:new o}}get tag(){return"row"}prepare(r,e){const n=e.styles.addStyleModel(r.style);n&&(r.styleId=n);const c=this.map.c;r.cells.forEach(a=>{c.prepare(a,e)})}render(r,e,n){r.openNode("row"),r.addAttribute("r",e.number),e.height&&(r.addAttribute("ht",e.height),r.addAttribute("customHeight","1")),e.hidden&&r.addAttribute("hidden","1"),e.min>0&&e.max>0&&e.min<=e.max&&r.addAttribute("spans",`${e.min}:${e.max}`),e.styleId&&(r.addAttribute("s",e.styleId),r.addAttribute("customFormat","1")),r.addAttribute("x14ac:dyDescent","0.25"),e.outlineLevel&&r.addAttribute("outlineLevel",e.outlineLevel),e.collapsed&&r.addAttribute("collapsed","1");const c=this.map.c;e.cells.forEach(a=>{c.render(r,a,n)}),r.closeNode()}parseOpen(r){if(this.parser)return this.parser.parseOpen(r),!0;if(r.name==="row"){this.numRowsSeen+=1;const e=r.attributes.spans?r.attributes.spans.split(":").map(c=>parseInt(c,10)):[void 0,void 0],n=this.model={number:parseInt(r.attributes.r,10),min:e[0],max:e[1],cells:[]};return r.attributes.s&&(n.styleId=parseInt(r.attributes.s,10)),i.parseBoolean(r.attributes.hidden)&&(n.hidden=!0),i.parseBoolean(r.attributes.bestFit)&&(n.bestFit=!0),r.attributes.ht&&(n.height=parseFloat(r.attributes.ht)),r.attributes.outlineLevel&&(n.outlineLevel=parseInt(r.attributes.outlineLevel,10)),i.parseBoolean(r.attributes.collapsed)&&(n.collapsed=!0),!0}return this.parser=this.map[r.name],!!this.parser&&(this.parser.parseOpen(r),!0)}parseText(r){this.parser&&this.parser.parseText(r)}parseClose(r){if(this.parser){if(!this.parser.parseClose(r)){if(this.model.cells.push(this.parser.model),this.maxItems&&this.model.cells.length>this.maxItems)throw new Error(`Max column count (${this.maxItems}) exceeded`);this.parser=void 0}return!0}return!1}reconcile(r,e){r.style=r.styleId?e.styles.getStyleModel(r.styleId):{},r.styleId!==void 0&&(r.styleId=void 0);const n=this.map.c;r.cells.forEach(c=>{n.reconcile(c,e)})}}},{"../../../utils/utils":27,"../base-xform":32,"./cell-xform":73}],110:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../base-xform");h.exports=class extends i{get tag(){return"sheetFormatPr"}render(o,r){if(r){const e={defaultRowHeight:r.defaultRowHeight,outlineLevelRow:r.outlineLevelRow,outlineLevelCol:r.outlineLevelCol,"x14ac:dyDescent":r.dyDescent};r.defaultColWidth&&(e.defaultColWidth=r.defaultColWidth),r.defaultRowHeight&&r.defaultRowHeight===15||(e.customHeight="1"),l.some(e,n=>n!==void 0)&&o.leafNode("sheetFormatPr",e)}}parseOpen(o){return o.name==="sheetFormatPr"&&(this.model={defaultRowHeight:parseFloat(o.attributes.defaultRowHeight||"0"),dyDescent:parseFloat(o.attributes["x14ac:dyDescent"]||"0"),outlineLevelRow:parseInt(o.attributes.outlineLevelRow||"0",10),outlineLevelCol:parseInt(o.attributes.outlineLevelCol||"0",10)},o.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(o.attributes.defaultColWidth)),!0)}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],111:[function(t,h,d){const l=t("../base-xform"),i=t("../style/color-xform"),o=t("./page-setup-properties-xform"),r=t("./outline-properties-xform");h.exports=class extends l{constructor(){super(),this.map={tabColor:new i("tabColor"),pageSetUpPr:new o,outlinePr:new r}}get tag(){return"sheetPr"}render(e,n){if(n){e.addRollback(),e.openNode("sheetPr");let c=!1;c=this.map.tabColor.render(e,n.tabColor)||c,c=this.map.pageSetUpPr.render(e,n.pageSetup)||c,c=this.map.outlinePr.render(e,n.outlineProperties)||c,c?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):!!this.map[e.name]&&(this.parser=this.map[e.name],this.parser.parseOpen(e),!0)}parseText(e){return!!this.parser&&(this.parser.parseText(e),!0)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(this.map.tabColor.model||this.map.pageSetUpPr.model||this.map.outlinePr.model?(this.model={},this.map.tabColor.model&&(this.model.tabColor=this.map.tabColor.model),this.map.pageSetUpPr.model&&(this.model.pageSetup=this.map.pageSetUpPr.model),this.map.outlinePr.model&&(this.model.outlineProperties=this.map.outlinePr.model)):this.model=null,!1)}}},{"../base-xform":32,"../style/color-xform":128,"./outline-properties-xform":101,"./page-setup-properties-xform":104}],112:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../base-xform");function o(e,n){return e?n:void 0}function r(e,n){return e===n||void 0}h.exports=class extends i{get tag(){return"sheetProtection"}render(e,n){if(n){const c={sheet:o(n.sheet,"1"),selectLockedCells:n.selectLockedCells===!1?"1":void 0,selectUnlockedCells:n.selectUnlockedCells===!1?"1":void 0,formatCells:o(n.formatCells,"0"),formatColumns:o(n.formatColumns,"0"),formatRows:o(n.formatRows,"0"),insertColumns:o(n.insertColumns,"0"),insertRows:o(n.insertRows,"0"),insertHyperlinks:o(n.insertHyperlinks,"0"),deleteColumns:o(n.deleteColumns,"0"),deleteRows:o(n.deleteRows,"0"),sort:o(n.sort,"0"),autoFilter:o(n.autoFilter,"0"),pivotTables:o(n.pivotTables,"0")};n.sheet&&(c.algorithmName=n.algorithmName,c.hashValue=n.hashValue,c.saltValue=n.saltValue,c.spinCount=n.spinCount,c.objects=o(n.objects===!1,"1"),c.scenarios=o(n.scenarios===!1,"1")),l.some(c,a=>a!==void 0)&&e.leafNode(this.tag,c)}}parseOpen(e){switch(e.name){case this.tag:return this.model={sheet:r(e.attributes.sheet,"1"),objects:e.attributes.objects!=="1"&&void 0,scenarios:e.attributes.scenarios!=="1"&&void 0,selectLockedCells:e.attributes.selectLockedCells!=="1"&&void 0,selectUnlockedCells:e.attributes.selectUnlockedCells!=="1"&&void 0,formatCells:r(e.attributes.formatCells,"0"),formatColumns:r(e.attributes.formatColumns,"0"),formatRows:r(e.attributes.formatRows,"0"),insertColumns:r(e.attributes.insertColumns,"0"),insertRows:r(e.attributes.insertRows,"0"),insertHyperlinks:r(e.attributes.insertHyperlinks,"0"),deleteColumns:r(e.attributes.deleteColumns,"0"),deleteRows:r(e.attributes.deleteRows,"0"),sort:r(e.attributes.sort,"0"),autoFilter:r(e.attributes.autoFilter,"0"),pivotTables:r(e.attributes.pivotTables,"0")},e.attributes.algorithmName&&(this.model.algorithmName=e.attributes.algorithmName,this.model.hashValue=e.attributes.hashValue,this.model.saltValue=e.attributes.saltValue,this.model.spinCount=parseInt(e.attributes.spinCount,10)),!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../../../utils/under-dash":26,"../base-xform":32}],113:[function(t,h,d){const l=t("../../../utils/col-cache"),i=t("../base-xform"),o={frozen:"frozen",frozenSplit:"frozen",split:"split"};h.exports=class extends i{get tag(){return"sheetView"}prepare(r){switch(r.state){case"frozen":case"split":break;default:r.state="normal"}}render(r,e){r.openNode("sheetView",{workbookViewId:e.workbookViewId||0});const n=function(p,u,g){g&&r.addAttribute(p,u)};let c,a,s,f;switch(n("rightToLeft","1",e.rightToLeft===!0),n("tabSelected","1",e.tabSelected),n("showRuler","0",e.showRuler===!1),n("showRowColHeaders","0",e.showRowColHeaders===!1),n("showGridLines","0",e.showGridLines===!1),n("zoomScale",e.zoomScale,e.zoomScale),n("zoomScaleNormal",e.zoomScaleNormal,e.zoomScaleNormal),n("view",e.style,e.style),e.state){case"frozen":a=e.xSplit||0,s=e.ySplit||0,c=e.topLeftCell||l.getAddress(s+1,a+1).address,f=(e.xSplit&&e.ySplit?"bottomRight":e.xSplit&&"topRight")||"bottomLeft",r.leafNode("pane",{xSplit:e.xSplit||void 0,ySplit:e.ySplit||void 0,topLeftCell:c,activePane:f,state:"frozen"}),r.leafNode("selection",{pane:f,activeCell:e.activeCell,sqref:e.activeCell});break;case"split":e.activePane==="topLeft"&&(e.activePane=void 0),r.leafNode("pane",{xSplit:e.xSplit||void 0,ySplit:e.ySplit||void 0,topLeftCell:e.topLeftCell,activePane:e.activePane}),r.leafNode("selection",{pane:e.activePane,activeCell:e.activeCell,sqref:e.activeCell});break;case"normal":e.activeCell&&r.leafNode("selection",{activeCell:e.activeCell,sqref:e.activeCell})}r.closeNode()}parseOpen(r){switch(r.name){case"sheetView":return this.sheetView={workbookViewId:parseInt(r.attributes.workbookViewId,10),rightToLeft:r.attributes.rightToLeft==="1",tabSelected:r.attributes.tabSelected==="1",showRuler:r.attributes.showRuler!=="0",showRowColHeaders:r.attributes.showRowColHeaders!=="0",showGridLines:r.attributes.showGridLines!=="0",zoomScale:parseInt(r.attributes.zoomScale||"100",10),zoomScaleNormal:parseInt(r.attributes.zoomScaleNormal||"100",10),style:r.attributes.view},this.pane=void 0,this.selections={},!0;case"pane":return this.pane={xSplit:parseInt(r.attributes.xSplit||"0",10),ySplit:parseInt(r.attributes.ySplit||"0",10),topLeftCell:r.attributes.topLeftCell,activePane:r.attributes.activePane||"topLeft",state:r.attributes.state},!0;case"selection":{const e=r.attributes.pane||"topLeft";return this.selections[e]={pane:e,activeCell:r.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(r){let e,n;switch(r){case"sheetView":return this.sheetView&&this.pane?(e=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:o[this.pane.state]||"split",xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state==="split"&&(e.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(e.activeCell=n.activeCell),this.sheetView.style&&(e.style=this.sheetView.style)):(e=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:"normal",showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(e.activeCell=n.activeCell),this.sheetView.style&&(e.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}}},{"../../../utils/col-cache":19,"../base-xform":32}],114:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"tablePart"}render(i,o){o&&i.leafNode(this.tag,{"r:id":o.rId})}parseOpen(i){switch(i.name){case this.tag:return this.model={rId:i.attributes["r:id"]},!0;default:return!1}}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],115:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../../../utils/col-cache"),o=t("../../../utils/xml-stream"),r=t("../../rel-type"),e=t("./merges"),n=t("../base-xform"),c=t("../list-xform"),a=t("./row-xform"),s=t("./col-xform"),f=t("./dimension-xform"),p=t("./hyperlink-xform"),u=t("./merge-cell-xform"),g=t("./data-validations-xform"),m=t("./sheet-properties-xform"),v=t("./sheet-format-properties-xform"),S=t("./sheet-view-xform"),R=t("./sheet-protection-xform"),I=t("./page-margins-xform"),F=t("./page-setup-xform"),j=t("./print-options-xform"),L=t("./auto-filter-xform"),$=t("./picture-xform"),V=t("./drawing-xform"),z=t("./table-part-xform"),E=t("./row-breaks-xform"),A=t("./header-footer-xform"),k=t("./cf/conditional-formattings-xform"),b=t("./ext-lst-xform"),y=(x,M)=>{if(!M||!M.length)return x;if(!x||!x.length)return M;const B={},P={};return x.forEach(H=>{B[H.ref]=H,H.rules.forEach(W=>{const{x14Id:K}=W;K&&(P[K]=W)})}),M.forEach(H=>{H.rules.forEach(W=>{const K=P[W.x14Id];K?((D,X)=>{Object.keys(X).forEach(O=>{const N=D[O],U=X[O];N===void 0&&U!==void 0&&(D[O]=U)})})(K,W):B[H.ref]?B[H.ref].rules.push(W):x.push({ref:H.ref,rules:[W]})})}),x};class _ extends n{constructor(M){super();const{maxRows:B,maxCols:P,ignoreNodes:H}=M||{};this.ignoreNodes=H||[],this.map={sheetPr:new m,dimension:new f,sheetViews:new c({tag:"sheetViews",count:!1,childXform:new S}),sheetFormatPr:new v,cols:new c({tag:"cols",count:!1,childXform:new s}),sheetData:new c({tag:"sheetData",count:!1,empty:!0,childXform:new a({maxItems:P}),maxItems:B}),autoFilter:new L,mergeCells:new c({tag:"mergeCells",count:!0,childXform:new u}),rowBreaks:new E,hyperlinks:new c({tag:"hyperlinks",count:!1,childXform:new p}),pageMargins:new I,dataValidations:new g,pageSetup:new F,headerFooter:new A,printOptions:new j,picture:new $,drawing:new V,sheetProtection:new R,tableParts:new c({tag:"tableParts",count:!0,childXform:new z}),conditionalFormatting:new k,extLst:new b}}prepare(M,B){B.merges=new e,M.hyperlinks=B.hyperlinks=[],M.comments=B.comments=[],B.formulae={},B.siFormulae=0,this.map.cols.prepare(M.cols,B),this.map.sheetData.prepare(M.rows,B),this.map.conditionalFormatting.prepare(M.conditionalFormattings,B),M.mergeCells=B.merges.mergeCells;const P=M.rels=[];function H(D){return"rId"+(D.length+1)}if(M.hyperlinks.forEach(D=>{const X=H(P);D.rId=X,P.push({Id:X,Type:r.Hyperlink,Target:D.target,TargetMode:"External"})}),M.comments.length>0){const D={Id:H(P),Type:r.Comments,Target:`../comments${M.id}.xml`};P.push(D);const X={Id:H(P),Type:r.VmlDrawing,Target:`../drawings/vmlDrawing${M.id}.vml`};P.push(X),M.comments.forEach(O=>{O.refAddress=i.decodeAddress(O.ref)}),B.commentRefs.push({commentName:"comments"+M.id,vmlDrawing:"vmlDrawing"+M.id})}const W=[];let K;M.media.forEach(D=>{if(D.type==="background"){const X=H(P);K=B.media[D.imageId],P.push({Id:X,Type:r.Image,Target:`../media/${K.name}.${K.extension}`}),M.background={rId:X},M.image=B.media[D.imageId]}else if(D.type==="image"){let{drawing:X}=M;K=B.media[D.imageId],X||(X=M.drawing={rId:H(P),name:"drawing"+ ++B.drawingsCount,anchors:[],rels:[]},B.drawings.push(X),P.push({Id:X.rId,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:`../drawings/${X.name}.xml`}));let O=this.preImageId===D.imageId?W[D.imageId]:W[X.rels.length];O||(O=H(X.rels),W[X.rels.length]=O,X.rels.push({Id:O,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/${K.name}.${K.extension}`}));const N={picture:{rId:O},range:D.range};if(D.hyperlinks&&D.hyperlinks.hyperlink){const U=H(X.rels);W[X.rels.length]=U,N.picture.hyperlinks={tooltip:D.hyperlinks.tooltip,rId:U},X.rels.push({Id:U,Type:r.Hyperlink,Target:D.hyperlinks.hyperlink,TargetMode:"External"})}this.preImageId=D.imageId,X.anchors.push(N)}}),M.tables.forEach(D=>{const X=H(P);D.rId=X,P.push({Id:X,Type:r.Table,Target:"../tables/"+D.target}),D.columns.forEach(O=>{const{style:N}=O;N&&(O.dxfId=B.styles.addDxfStyle(N))})}),this.map.extLst.prepare(M,B)}render(M,B){M.openXml(o.StdDocAttributes),M.openNode("worksheet",_.WORKSHEET_ATTRIBUTES);const P=B.properties?{defaultRowHeight:B.properties.defaultRowHeight,dyDescent:B.properties.dyDescent,outlineLevelCol:B.properties.outlineLevelCol,outlineLevelRow:B.properties.outlineLevelRow}:void 0;B.properties&&B.properties.defaultColWidth&&(P.defaultColWidth=B.properties.defaultColWidth);const H={outlineProperties:B.properties&&B.properties.outlineProperties,tabColor:B.properties&&B.properties.tabColor,pageSetup:B.pageSetup&&B.pageSetup.fitToPage?{fitToPage:B.pageSetup.fitToPage}:void 0},W=B.pageSetup&&B.pageSetup.margins,K={showRowColHeaders:B.pageSetup&&B.pageSetup.showRowColHeaders,showGridLines:B.pageSetup&&B.pageSetup.showGridLines,horizontalCentered:B.pageSetup&&B.pageSetup.horizontalCentered,verticalCentered:B.pageSetup&&B.pageSetup.verticalCentered},D=B.sheetProtection;this.map.sheetPr.render(M,H),this.map.dimension.render(M,B.dimensions),this.map.sheetViews.render(M,B.views),this.map.sheetFormatPr.render(M,P),this.map.cols.render(M,B.cols),this.map.sheetData.render(M,B.rows),this.map.sheetProtection.render(M,D),this.map.autoFilter.render(M,B.autoFilter),this.map.mergeCells.render(M,B.mergeCells),this.map.conditionalFormatting.render(M,B.conditionalFormattings),this.map.dataValidations.render(M,B.dataValidations),this.map.hyperlinks.render(M,B.hyperlinks),this.map.printOptions.render(M,K),this.map.pageMargins.render(M,W),this.map.pageSetup.render(M,B.pageSetup),this.map.headerFooter.render(M,B.headerFooter),this.map.rowBreaks.render(M,B.rowBreaks),this.map.drawing.render(M,B.drawing),this.map.picture.render(M,B.background),this.map.tableParts.render(M,B.tables),this.map.extLst.render(M,B),B.rels&&B.rels.forEach(X=>{X.Type===r.VmlDrawing&&M.leafNode("legacyDrawing",{"r:id":X.Id})}),M.closeNode()}parseOpen(M){return this.parser?(this.parser.parseOpen(M),!0):M.name==="worksheet"?(l.each(this.map,B=>{B.reset()}),!0):(this.map[M.name]&&!this.ignoreNodes.includes(M.name)&&(this.parser=this.map[M.name],this.parser.parseOpen(M)),!0)}parseText(M){this.parser&&this.parser.parseText(M)}parseClose(M){if(this.parser)return this.parser.parseClose(M)||(this.parser=void 0),!0;switch(M){case"worksheet":{const B=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(B.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(B.outlineProperties=this.map.sheetPr.model.outlineProperties);const P={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},H=Object.assign(P,this.map.pageSetup.model,this.map.printOptions.model),W=y(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model["x14:conditionalFormattings"]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:B,views:this.map.sheetViews.model,pageSetup:H,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:W},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(M,B){const P=(M.relationships||[]).reduce((W,K)=>{if(W[K.Id]=K,K.Type===r.Comments&&(M.comments=B.comments[K.Target].comments),K.Type===r.VmlDrawing&&M.comments&&M.comments.length){const D=B.vmlDrawings[K.Target].comments;M.comments.forEach((X,O)=>{X.note=Object.assign({},X.note,D[O])})}return W},{});if(B.commentsMap=(M.comments||[]).reduce((W,K)=>(K.ref&&(W[K.ref]=K),W),{}),B.hyperlinkMap=(M.hyperlinks||[]).reduce((W,K)=>(K.rId&&(W[K.address]=P[K.rId].Target),W),{}),B.formulae={},M.rows=M.rows&&M.rows.filter(Boolean)||[],M.rows.forEach(W=>{W.cells=W.cells&&W.cells.filter(Boolean)||[]}),this.map.cols.reconcile(M.cols,B),this.map.sheetData.reconcile(M.rows,B),this.map.conditionalFormatting.reconcile(M.conditionalFormattings,B),M.media=[],M.drawing){const W=P[M.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(W){const K=W[1];B.drawings[K].anchors.forEach(D=>{if(D.medium){const X={type:"image",imageId:D.medium.index,range:D.range,hyperlinks:D.picture.hyperlinks};M.media.push(X)}})}}const H=M.background&&P[M.background.rId];if(H){const W=H.Target.split("/media/")[1],K=B.mediaIndex&&B.mediaIndex[W];K!==void 0&&M.media.push({type:"background",imageId:K})}M.tables=(M.tables||[]).map(W=>{const K=P[W.rId];return B.tables[K.Target]}),delete M.relationships,delete M.hyperlinks,delete M.comments}}_.WORKSHEET_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x14ac","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"},h.exports=_},{"../../../utils/col-cache":19,"../../../utils/under-dash":26,"../../../utils/xml-stream":28,"../../rel-type":31,"../base-xform":32,"../list-xform":71,"./auto-filter-xform":72,"./cf/conditional-formattings-xform":87,"./col-xform":92,"./data-validations-xform":93,"./dimension-xform":94,"./drawing-xform":95,"./ext-lst-xform":96,"./header-footer-xform":97,"./hyperlink-xform":98,"./merge-cell-xform":99,"./merges":100,"./page-margins-xform":103,"./page-setup-xform":105,"./picture-xform":106,"./print-options-xform":107,"./row-breaks-xform":108,"./row-xform":109,"./sheet-format-properties-xform":110,"./sheet-properties-xform":111,"./sheet-protection-xform":112,"./sheet-view-xform":113,"./table-part-xform":114}],116:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{constructor(i){super(),this.tag=i.tag,this.attr=i.attr}render(i,o){o&&(i.openNode(this.tag),i.closeNode())}parseOpen(i){i.name===this.tag&&(this.model=!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],117:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{constructor(i){super(),this.tag=i.tag,this.attr=i.attr,this.attrs=i.attrs,this._format=i.format||function(o){try{return Number.isNaN(o.getTime())?"":o.toISOString()}catch{return""}},this._parse=i.parse||function(o){return new Date(o)}}render(i,o){o&&(i.openNode(this.tag),this.attrs&&i.addAttributes(this.attrs),this.attr?i.addAttribute(this.attr,this._format(o)):i.writeText(this._format(o)),i.closeNode())}parseOpen(i){i.name===this.tag&&(this.attr?this.model=this._parse(i.attributes[this.attr]):this.text=[])}parseText(i){this.attr||this.text.push(i)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(""))),!1}}},{"../base-xform":32}],118:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{constructor(i){super(),this.tag=i.tag,this.attr=i.attr,this.attrs=i.attrs,this.zero=i.zero}render(i,o){(o||this.zero)&&(i.openNode(this.tag),this.attrs&&i.addAttributes(this.attrs),this.attr?i.addAttribute(this.attr,o):i.writeText(o),i.closeNode())}parseOpen(i){return i.name===this.tag&&(this.attr?this.model=parseInt(i.attributes[this.attr],10):this.text=[],!0)}parseText(i){this.attr||this.text.push(i)}parseClose(){return this.attr||(this.model=parseInt(this.text.join("")||0,10)),!1}}},{"../base-xform":32}],119:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{constructor(i){super(),this.tag=i.tag,this.attr=i.attr,this.attrs=i.attrs}render(i,o){o!==void 0&&(i.openNode(this.tag),this.attrs&&i.addAttributes(this.attrs),this.attr?i.addAttribute(this.attr,o):i.writeText(o),i.closeNode())}parseOpen(i){i.name===this.tag&&(this.attr?this.model=i.attributes[this.attr]:this.text=[])}parseText(i){this.attr||this.text.push(i)}parseClose(){return this.attr||(this.model=this.text.join("")),!1}}},{"../base-xform":32}],120:[function(t,h,d){const l=t("./base-xform"),i=t("../../utils/xml-stream");h.exports=class extends l{constructor(o){super(),this._model=o}render(o){if(!this._xml){const r=new i;(function e(n,c){n.openNode(c.tag,c.$),c.c&&c.c.forEach(a=>{e(n,a)}),c.t&&n.writeText(c.t),n.closeNode()})(r,this._model),this._xml=r.xml}o.writeXml(this._xml)}parseOpen(){return!0}parseText(){}parseClose(o){switch(o){case this._model.tag:return!1;default:return!0}}}},{"../../utils/xml-stream":28,"./base-xform":32}],121:[function(t,h,d){const l=t("./text-xform"),i=t("./rich-text-xform"),o=t("../base-xform");h.exports=class extends o{constructor(){super(),this.map={r:new i,t:new l}}get tag(){return"rPh"}render(r,e){if(r.openNode(this.tag,{sb:e.sb||0,eb:e.eb||0}),e&&e.hasOwnProperty("richText")&&e.richText){const{r:n}=this.map;e.richText.forEach(c=>{n.render(r,c)})}else e&&this.map.t.render(r,e.text);r.closeNode()}parseOpen(r){const{name:e}=r;return this.parser?(this.parser.parseOpen(r),!0):e===this.tag?(this.model={sb:parseInt(r.attributes.sb,10),eb:parseInt(r.attributes.eb,10)},!0):(this.parser=this.map[e],!!this.parser&&(this.parser.parseOpen(r),!0))}parseText(r){this.parser&&this.parser.parseText(r)}parseClose(r){if(this.parser){if(!this.parser.parseClose(r)){switch(r){case"r":{let e=this.model.richText;e||(e=this.model.richText=[]),e.push(this.parser.model);break}case"t":this.model.text=this.parser.model}this.parser=void 0}return!0}switch(r){case this.tag:return!1;default:return!0}}}},{"../base-xform":32,"./rich-text-xform":122,"./text-xform":125}],122:[function(t,h,d){const l=t("./text-xform"),i=t("../style/font-xform"),o=t("../base-xform");class r extends o{constructor(n){super(),this.model=n}get tag(){return"r"}get textXform(){return this._textXform||(this._textXform=new l)}get fontXform(){return this._fontXform||(this._fontXform=new i(r.FONT_OPTIONS))}render(n,c){c=c||this.model,n.openNode("r"),c.font&&this.fontXform.render(n,c.font),this.textXform.render(n,c.text),n.closeNode()}parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case"r":return this.model={},!0;case"t":return this.parser=this.textXform,this.parser.parseOpen(n),!0;case"rPr":return this.parser=this.fontXform,this.parser.parseOpen(n),!0;default:return!1}}parseText(n){this.parser&&this.parser.parseText(n)}parseClose(n){switch(n){case"r":return!1;case"t":return this.model.text=this.parser.model,this.parser=void 0,!0;case"rPr":return this.model.font=this.parser.model,this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(n),!0}}}r.FONT_OPTIONS={tagName:"rPr",fontNameTag:"rFont"},h.exports=r},{"../base-xform":32,"../style/font-xform":131,"./text-xform":125}],123:[function(t,h,d){const l=t("./text-xform"),i=t("./rich-text-xform"),o=t("./phonetic-text-xform"),r=t("../base-xform");h.exports=class extends r{constructor(e){super(),this.model=e,this.map={r:new i,t:new l,rPh:new o}}get tag(){return"si"}render(e,n){e.openNode(this.tag),n&&n.hasOwnProperty("richText")&&n.richText?n.richText.length?n.richText.forEach(c=>{this.map.r.render(e,c)}):this.map.t.render(e,""):n!=null&&this.map.t.render(e,n),e.closeNode()}parseOpen(e){const{name:n}=e;return this.parser?(this.parser.parseOpen(e),!0):n===this.tag?(this.model={},!0):(this.parser=this.map[n],!!this.parser&&(this.parser.parseOpen(e),!0))}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case"r":{let n=this.model.richText;n||(n=this.model.richText=[]),n.push(this.parser.model);break}case"t":this.model=this.parser.model}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}}},{"../base-xform":32,"./phonetic-text-xform":121,"./rich-text-xform":122,"./text-xform":125}],124:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform"),o=t("./shared-string-xform");h.exports=class extends i{constructor(r){super(),this.model=r||{values:[],count:0},this.hash=Object.create(null),this.rich=Object.create(null)}get sharedStringXform(){return this._sharedStringXform||(this._sharedStringXform=new o)}get values(){return this.model.values}get uniqueCount(){return this.model.values.length}get count(){return this.model.count}getString(r){return this.model.values[r]}add(r){return r.richText?this.addRichText(r):this.addText(r)}addText(r){let e=this.hash[r];return e===void 0&&(e=this.hash[r]=this.model.values.length,this.model.values.push(r)),this.model.count++,e}addRichText(r){const e=this.sharedStringXform.toXml(r);let n=this.rich[e];return n===void 0&&(n=this.rich[e]=this.model.values.length,this.model.values.push(r)),this.model.count++,n}render(r,e){e=e||this._values,r.openXml(l.StdDocAttributes),r.openNode("sst",{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:e.count,uniqueCount:e.values.length});const n=this.sharedStringXform;e.values.forEach(c=>{n.render(r,c)}),r.closeNode()}parseOpen(r){if(this.parser)return this.parser.parseOpen(r),!0;switch(r.name){case"sst":return!0;case"si":return this.parser=this.sharedStringXform,this.parser.parseOpen(r),!0;default:throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(r))}}parseText(r){this.parser&&this.parser.parseText(r)}parseClose(r){if(this.parser)return this.parser.parseClose(r)||(this.model.values.push(this.parser.model),this.model.count++,this.parser=void 0),!0;switch(r){case"sst":return!1;default:throw new Error("Unexpected xml node in parseClose: "+r)}}}},{"../../../utils/xml-stream":28,"../base-xform":32,"./shared-string-xform":123}],125:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"t"}render(i,o){i.openNode("t"),/^\s|\n|\s$/.test(o)&&i.addAttribute("xml:space","preserve"),i.writeText(o),i.closeNode()}get model(){return this._text.join("").replace(/_x([0-9A-F]{4})_/g,(i,o)=>String.fromCharCode(parseInt(o,16)))}parseOpen(i){switch(i.name){case"t":return this._text=[],!0;default:return!1}}parseText(i){this._text.push(i)}parseClose(){return!1}}},{"../base-xform":32}],126:[function(t,h,d){const l=t("../../../doc/enums"),i=t("../../../utils/utils"),o=t("../base-xform"),r={horizontalValues:["left","center","right","fill","centerContinuous","distributed","justify"].reduce((n,c)=>(n[c]=!0,n),{}),horizontal(n){return this.horizontalValues[n]?n:void 0},verticalValues:["top","middle","bottom","distributed","justify"].reduce((n,c)=>(n[c]=!0,n),{}),vertical(n){return n==="middle"?"center":this.verticalValues[n]?n:void 0},wrapText:n=>!!n||void 0,shrinkToFit:n=>!!n||void 0,textRotation(n){switch(n){case"vertical":return n;default:return(n=i.validInt(n))>=-90&&n<=90?n:void 0}},indent:n=>(n=i.validInt(n),Math.max(0,n)),readingOrder(n){switch(n){case"ltr":return l.ReadingOrder.LeftToRight;case"rtl":return l.ReadingOrder.RightToLeft;default:return}}},e={toXml(n){if(n=r.textRotation(n)){if(n==="vertical")return 255;const c=Math.round(n);if(c>=0&&c<=90)return c;if(c<0&&c>=-90)return 90-c}},toModel(n){const c=i.validInt(n);if(c!==void 0){if(c===255)return"vertical";if(c>=0&&c<=90)return c;if(c>90&&c<=180)return 90-c}}};h.exports=class extends o{get tag(){return"alignment"}render(n,c){n.addRollback(),n.openNode("alignment");let a=!1;function s(f,p){p&&(n.addAttribute(f,p),a=!0)}s("horizontal",r.horizontal(c.horizontal)),s("vertical",r.vertical(c.vertical)),s("wrapText",!!r.wrapText(c.wrapText)&&"1"),s("shrinkToFit",!!r.shrinkToFit(c.shrinkToFit)&&"1"),s("indent",r.indent(c.indent)),s("textRotation",e.toXml(c.textRotation)),s("readingOrder",r.readingOrder(c.readingOrder)),n.closeNode(),a?n.commit():n.rollback()}parseOpen(n){const c={};let a=!1;function s(f,p,u){f&&(c[p]=u,a=!0)}s(n.attributes.horizontal,"horizontal",n.attributes.horizontal),s(n.attributes.vertical,"vertical",n.attributes.vertical==="center"?"middle":n.attributes.vertical),s(n.attributes.wrapText,"wrapText",i.parseBoolean(n.attributes.wrapText)),s(n.attributes.shrinkToFit,"shrinkToFit",i.parseBoolean(n.attributes.shrinkToFit)),s(n.attributes.indent,"indent",parseInt(n.attributes.indent,10)),s(n.attributes.textRotation,"textRotation",e.toModel(n.attributes.textRotation)),s(n.attributes.readingOrder,"readingOrder",n.attributes.readingOrder==="2"?"rtl":"ltr"),this.model=a?c:null}parseText(){}parseClose(){return!1}}},{"../../../doc/enums":7,"../../../utils/utils":27,"../base-xform":32}],127:[function(t,h,d){const l=t("../base-xform"),i=t("../../../utils/utils"),o=t("./color-xform");class r extends l{constructor(n){super(),this.name=n,this.map={color:new o}}get tag(){return this.name}render(n,c,a){const s=c&&c.color||a||this.defaultColor;n.openNode(this.name),c&&c.style&&(n.addAttribute("style",c.style),s&&this.map.color.render(n,s)),n.closeNode()}parseOpen(n){if(this.parser)return this.parser.parseOpen(n),!0;switch(n.name){case this.name:{const{style:c}=n.attributes;return this.model=c?{style:c}:void 0,!0}case"color":return this.parser=this.map.color,this.parser.parseOpen(n),!0;default:return!1}}parseText(n){this.parser&&this.parser.parseText(n)}parseClose(n){return this.parser?(this.parser.parseClose(n)||(this.parser=void 0),!0):(n===this.name&&this.map.color.model&&(this.model||(this.model={}),this.model.color=this.map.color.model),!1)}validStyle(n){return r.validStyleValues[n]}}r.validStyleValues=["thin","dashed","dotted","dashDot","hair","dashDotDot","slantDashDot","mediumDashed","mediumDashDotDot","mediumDashDot","medium","double","thick"].reduce((e,n)=>(e[n]=!0,e),{}),h.exports=class extends l{constructor(){super(),this.map={top:new r("top"),left:new r("left"),bottom:new r("bottom"),right:new r("right"),diagonal:new r("diagonal")}}render(e,n){const{color:c}=n;function a(s,f){s&&!s.color&&n.color&&(s={...s,color:n.color}),f.render(e,s,c)}e.openNode("border"),n.diagonal&&n.diagonal.style&&(n.diagonal.up&&e.addAttribute("diagonalUp","1"),n.diagonal.down&&e.addAttribute("diagonalDown","1")),a(n.left,this.map.left),a(n.right,this.map.right),a(n.top,this.map.top),a(n.bottom,this.map.bottom),a(n.diagonal,this.map.diagonal),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case"border":return this.reset(),this.diagonalUp=i.parseBoolean(e.attributes.diagonalUp),this.diagonalDown=i.parseBoolean(e.attributes.diagonalDown),!0;default:return this.parser=this.map[e.name],!!this.parser&&(this.parser.parseOpen(e),!0)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e==="border"){const n=this.model={},c=function(a,s,f){s&&(f&&Object.assign(s,f),n[a]=s)};c("left",this.map.left.model),c("right",this.map.right.model),c("top",this.map.top.model),c("bottom",this.map.bottom.model),c("diagonal",this.map.diagonal.model,{up:this.diagonalUp,down:this.diagonalDown})}return!1}}},{"../../../utils/utils":27,"../base-xform":32,"./color-xform":128}],128:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{constructor(i){super(),this.name=i||"color"}get tag(){return this.name}render(i,o){return!!o&&(i.openNode(this.name),o.argb?i.addAttribute("rgb",o.argb):o.theme!==void 0?(i.addAttribute("theme",o.theme),o.tint!==void 0&&i.addAttribute("tint",o.tint)):o.indexed!==void 0?i.addAttribute("indexed",o.indexed):i.addAttribute("auto","1"),i.closeNode(),!0)}parseOpen(i){return i.name===this.name&&(i.attributes.rgb?this.model={argb:i.attributes.rgb}:i.attributes.theme?(this.model={theme:parseInt(i.attributes.theme,10)},i.attributes.tint&&(this.model.tint=parseFloat(i.attributes.tint))):i.attributes.indexed?this.model={indexed:parseInt(i.attributes.indexed,10)}:this.model=void 0,!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],129:[function(t,h,d){const l=t("../base-xform"),i=t("./alignment-xform"),o=t("./border-xform"),r=t("./fill-xform"),e=t("./font-xform"),n=t("./numfmt-xform"),c=t("./protection-xform");h.exports=class extends l{constructor(){super(),this.map={alignment:new i,border:new o,fill:new r,font:new e,numFmt:new n,protection:new c}}get tag(){return"dxf"}render(a,s){if(a.openNode(this.tag),s.font&&this.map.font.render(a,s.font),s.numFmt&&s.numFmtId){const f={id:s.numFmtId,formatCode:s.numFmt};this.map.numFmt.render(a,f)}s.fill&&this.map.fill.render(a,s.fill),s.alignment&&this.map.alignment.render(a,s.alignment),s.border&&this.map.border.render(a,s.border),s.protection&&this.map.protection.render(a,s.protection),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case this.tag:return this.reset(),!0;default:return this.parser=this.map[a.name],this.parser&&this.parser.parseOpen(a),!0}}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){return this.parser?(this.parser.parseClose(a)||(this.parser=void 0),!0):a!==this.tag||(this.model={alignment:this.map.alignment.model,border:this.map.border.model,fill:this.map.fill.model,font:this.map.font.model,numFmt:this.map.numFmt.model,protection:this.map.protection.model},!1)}}},{"../base-xform":32,"./alignment-xform":126,"./border-xform":127,"./fill-xform":130,"./font-xform":131,"./numfmt-xform":132,"./protection-xform":133}],130:[function(t,h,d){const l=t("../base-xform"),i=t("./color-xform");class o extends l{constructor(){super(),this.map={color:new i}}get tag(){return"stop"}render(a,s){a.openNode("stop"),a.addAttribute("position",s.position),this.map.color.render(a,s.color),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case"stop":return this.model={position:parseFloat(a.attributes.position)},!0;case"color":return this.parser=this.map.color,this.parser.parseOpen(a),!0;default:return!1}}parseText(){}parseClose(a){return!!this.parser&&(this.parser.parseClose(a)||(this.model.color=this.parser.model,this.parser=void 0),!0)}}class r extends l{constructor(){super(),this.map={fgColor:new i("fgColor"),bgColor:new i("bgColor")}}get name(){return"pattern"}get tag(){return"patternFill"}render(a,s){a.openNode("patternFill"),a.addAttribute("patternType",s.pattern),s.fgColor&&this.map.fgColor.render(a,s.fgColor),s.bgColor&&this.map.bgColor.render(a,s.bgColor),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case"patternFill":return this.model={type:"pattern",pattern:a.attributes.patternType},!0;default:return this.parser=this.map[a.name],!!this.parser&&(this.parser.parseOpen(a),!0)}}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){return!!this.parser&&(this.parser.parseClose(a)||(this.parser.model&&(this.model[a]=this.parser.model),this.parser=void 0),!0)}}class e extends l{constructor(){super(),this.map={stop:new o}}get name(){return"gradient"}get tag(){return"gradientFill"}render(a,s){switch(a.openNode("gradientFill"),s.gradient){case"angle":a.addAttribute("degree",s.degree);break;case"path":a.addAttribute("type","path"),s.center.left&&(a.addAttribute("left",s.center.left),s.center.right===void 0&&a.addAttribute("right",s.center.left)),s.center.right&&a.addAttribute("right",s.center.right),s.center.top&&(a.addAttribute("top",s.center.top),s.center.bottom===void 0&&a.addAttribute("bottom",s.center.top)),s.center.bottom&&a.addAttribute("bottom",s.center.bottom)}const f=this.map.stop;s.stops.forEach(p=>{f.render(a,p)}),a.closeNode()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case"gradientFill":{const s=this.model={stops:[]};return a.attributes.degree?(s.gradient="angle",s.degree=parseInt(a.attributes.degree,10)):a.attributes.type==="path"&&(s.gradient="path",s.center={left:a.attributes.left?parseFloat(a.attributes.left):0,top:a.attributes.top?parseFloat(a.attributes.top):0},a.attributes.right!==a.attributes.left&&(s.center.right=a.attributes.right?parseFloat(a.attributes.right):0),a.attributes.bottom!==a.attributes.top&&(s.center.bottom=a.attributes.bottom?parseFloat(a.attributes.bottom):0)),!0}case"stop":return this.parser=this.map.stop,this.parser.parseOpen(a),!0;default:return!1}}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){return!!this.parser&&(this.parser.parseClose(a)||(this.model.stops.push(this.parser.model),this.parser=void 0),!0)}}class n extends l{constructor(){super(),this.map={patternFill:new r,gradientFill:new e}}get tag(){return"fill"}render(a,s){switch(a.addRollback(),a.openNode("fill"),s.type){case"pattern":this.map.patternFill.render(a,s);break;case"gradient":this.map.gradientFill.render(a,s);break;default:return void a.rollback()}a.closeNode(),a.commit()}parseOpen(a){if(this.parser)return this.parser.parseOpen(a),!0;switch(a.name){case"fill":return this.model={},!0;default:return this.parser=this.map[a.name],!!this.parser&&(this.parser.parseOpen(a),!0)}}parseText(a){this.parser&&this.parser.parseText(a)}parseClose(a){return!!this.parser&&(this.parser.parseClose(a)||(this.model=this.parser.model,this.model.type=this.parser.name,this.parser=void 0),!0)}validStyle(a){return n.validPatternValues[a]}}n.validPatternValues=["none","solid","darkVertical","darkGray","mediumGray","lightGray","gray125","gray0625","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","lightGrid"].reduce((c,a)=>(c[a]=!0,c),{}),n.StopXform=o,n.PatternFillXform=r,n.GradientFillXform=e,h.exports=n},{"../base-xform":32,"./color-xform":128}],131:[function(t,h,d){const l=t("./color-xform"),i=t("../simple/boolean-xform"),o=t("../simple/integer-xform"),r=t("../simple/string-xform"),e=t("./underline-xform"),n=t("../../../utils/under-dash"),c=t("../base-xform");class a extends c{constructor(f){super(),this.options=f||a.OPTIONS,this.map={b:{prop:"bold",xform:new i({tag:"b",attr:"val"})},i:{prop:"italic",xform:new i({tag:"i",attr:"val"})},u:{prop:"underline",xform:new e},charset:{prop:"charset",xform:new o({tag:"charset",attr:"val"})},color:{prop:"color",xform:new l},condense:{prop:"condense",xform:new i({tag:"condense",attr:"val"})},extend:{prop:"extend",xform:new i({tag:"extend",attr:"val"})},family:{prop:"family",xform:new o({tag:"family",attr:"val"})},outline:{prop:"outline",xform:new i({tag:"outline",attr:"val"})},vertAlign:{prop:"vertAlign",xform:new r({tag:"vertAlign",attr:"val"})},scheme:{prop:"scheme",xform:new r({tag:"scheme",attr:"val"})},shadow:{prop:"shadow",xform:new i({tag:"shadow",attr:"val"})},strike:{prop:"strike",xform:new i({tag:"strike",attr:"val"})},sz:{prop:"size",xform:new o({tag:"sz",attr:"val"})}},this.map[this.options.fontNameTag]={prop:"name",xform:new r({tag:this.options.fontNameTag,attr:"val"})}}get tag(){return this.options.tagName}render(f,p){const{map:u}=this;f.openNode(this.options.tagName),n.each(this.map,(g,m)=>{u[m].xform.render(f,p[g.prop])}),f.closeNode()}parseOpen(f){if(this.parser)return this.parser.parseOpen(f),!0;if(this.map[f.name])return this.parser=this.map[f.name].xform,this.parser.parseOpen(f);switch(f.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(f){this.parser&&this.parser.parseText(f)}parseClose(f){if(this.parser&&!this.parser.parseClose(f)){const p=this.map[f];return this.parser.model&&(this.model[p.prop]=this.parser.model),this.parser=void 0,!0}switch(f){case this.options.tagName:return!1;default:return!0}}}a.OPTIONS={tagName:"font",fontNameTag:"name"},h.exports=a},{"../../../utils/under-dash":26,"../base-xform":32,"../simple/boolean-xform":116,"../simple/integer-xform":118,"../simple/string-xform":119,"./color-xform":128,"./underline-xform":136}],132:[function(t,h,d){const l=t("../../../utils/under-dash"),i=t("../../defaultnumformats"),o=t("../base-xform"),r=function(){const n={};return l.each(i,(c,a)=>{c.f&&(n[c.f]=parseInt(a,10))}),n}();class e extends o{constructor(c,a){super(),this.id=c,this.formatCode=a}get tag(){return"numFmt"}render(c,a){c.leafNode("numFmt",{numFmtId:a.id,formatCode:a.formatCode})}parseOpen(c){switch(c.name){case"numFmt":return this.model={id:parseInt(c.attributes.numFmtId,10),formatCode:c.attributes.formatCode.replace(/[\\](.)/g,"$1")},!0;default:return!1}}parseText(){}parseClose(){return!1}}e.getDefaultFmtId=function(n){return r[n]},e.getDefaultFmtCode=function(n){return i[n]&&i[n].f},h.exports=e},{"../../../utils/under-dash":26,"../../defaultnumformats":30,"../base-xform":32}],133:[function(t,h,d){const l=t("../base-xform"),i={boolean:(o,r)=>o===void 0?r:o};h.exports=class extends l{get tag(){return"protection"}render(o,r){o.addRollback(),o.openNode("protection");let e=!1;function n(c,a){a!==void 0&&(o.addAttribute(c,a),e=!0)}n("locked",i.boolean(r.locked,!0)?void 0:"0"),n("hidden",i.boolean(r.hidden,!1)?"1":void 0),o.closeNode(),e?o.commit():o.rollback()}parseOpen(o){const r={locked:o.attributes.locked!=="0",hidden:o.attributes.hidden==="1"},e=!r.locked||r.hidden;this.model=e?r:null}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],134:[function(t,h,d){const l=t("../base-xform"),i=t("./alignment-xform"),o=t("./protection-xform");h.exports=class extends l{constructor(r){super(),this.xfId=!(!r||!r.xfId),this.map={alignment:new i,protection:new o}}get tag(){return"xf"}render(r,e){r.openNode("xf",{numFmtId:e.numFmtId||0,fontId:e.fontId||0,fillId:e.fillId||0,borderId:e.borderId||0}),this.xfId&&r.addAttribute("xfId",e.xfId||0),e.numFmtId&&r.addAttribute("applyNumberFormat","1"),e.fontId&&r.addAttribute("applyFont","1"),e.fillId&&r.addAttribute("applyFill","1"),e.borderId&&r.addAttribute("applyBorder","1"),e.alignment&&r.addAttribute("applyAlignment","1"),e.protection&&r.addAttribute("applyProtection","1"),e.alignment&&this.map.alignment.render(r,e.alignment),e.protection&&this.map.protection.render(r,e.protection),r.closeNode()}parseOpen(r){if(this.parser)return this.parser.parseOpen(r),!0;switch(r.name){case"xf":return this.model={numFmtId:parseInt(r.attributes.numFmtId,10),fontId:parseInt(r.attributes.fontId,10),fillId:parseInt(r.attributes.fillId,10),borderId:parseInt(r.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(r.attributes.xfId,10)),!0;case"alignment":return this.parser=this.map.alignment,this.parser.parseOpen(r),!0;case"protection":return this.parser=this.map.protection,this.parser.parseOpen(r),!0;default:return!1}}parseText(r){this.parser&&this.parser.parseText(r)}parseClose(r){return this.parser?(this.parser.parseClose(r)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):r!=="xf"}}},{"../base-xform":32,"./alignment-xform":126,"./protection-xform":133}],135:[function(t,h,d){const l=t("../../../doc/enums"),i=t("../../../utils/xml-stream"),o=t("../base-xform"),r=t("../static-xform"),e=t("../list-xform"),n=t("./font-xform"),c=t("./fill-xform"),a=t("./border-xform"),s=t("./numfmt-xform"),f=t("./style-xform"),p=t("./dxf-xform");class u extends o{constructor(m){super(),this.map={numFmts:new e({tag:"numFmts",count:!0,childXform:new s}),fonts:new e({tag:"fonts",count:!0,childXform:new n,$:{"x14ac:knownFonts":1}}),fills:new e({tag:"fills",count:!0,childXform:new c}),borders:new e({tag:"borders",count:!0,childXform:new a}),cellStyleXfs:new e({tag:"cellStyleXfs",count:!0,childXform:new f}),cellXfs:new e({tag:"cellXfs",count:!0,childXform:new f({xfId:!0})}),dxfs:new e({tag:"dxfs",always:!0,count:!0,childXform:new p}),numFmt:new s,font:new n,fill:new c,border:new a,style:new f({xfId:!0}),cellStyles:u.STATIC_XFORMS.cellStyles,tableStyles:u.STATIC_XFORMS.tableStyles,extLst:u.STATIC_XFORMS.extLst},m&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:"pattern",pattern:"none"}),this._addFill({type:"pattern",pattern:"gray125"}),this.weakMap=new WeakMap}render(m,v){v=v||this.model,m.openXml(i.StdDocAttributes),m.openNode("styleSheet",u.STYLESHEET_ATTRIBUTES),this.index?(v.numFmts&&v.numFmts.length&&(m.openNode("numFmts",{count:v.numFmts.length}),v.numFmts.forEach(S=>{m.writeXml(S)}),m.closeNode()),v.fonts.length||this._addFont({size:11,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}),m.openNode("fonts",{count:v.fonts.length,"x14ac:knownFonts":1}),v.fonts.forEach(S=>{m.writeXml(S)}),m.closeNode(),m.openNode("fills",{count:v.fills.length}),v.fills.forEach(S=>{m.writeXml(S)}),m.closeNode(),m.openNode("borders",{count:v.borders.length}),v.borders.forEach(S=>{m.writeXml(S)}),m.closeNode(),this.map.cellStyleXfs.render(m,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),m.openNode("cellXfs",{count:v.styles.length}),v.styles.forEach(S=>{m.writeXml(S)}),m.closeNode()):(this.map.numFmts.render(m,v.numFmts),this.map.fonts.render(m,v.fonts),this.map.fills.render(m,v.fills),this.map.borders.render(m,v.borders),this.map.cellStyleXfs.render(m,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(m,v.styles)),u.STATIC_XFORMS.cellStyles.render(m),this.map.dxfs.render(m,v.dxfs),u.STATIC_XFORMS.tableStyles.render(m),u.STATIC_XFORMS.extLst.render(m),m.closeNode()}parseOpen(m){if(this.parser)return this.parser.parseOpen(m),!0;switch(m.name){case"styleSheet":return this.initIndex(),!0;default:return this.parser=this.map[m.name],this.parser&&this.parser.parseOpen(m),!0}}parseText(m){this.parser&&this.parser.parseText(m)}parseClose(m){if(this.parser)return this.parser.parseClose(m)||(this.parser=void 0),!0;switch(m){case"styleSheet":{this.model={};const v=(S,R)=>{R.model&&R.model.length&&(this.model[S]=R.model)};if(v("numFmts",this.map.numFmts),v("fonts",this.map.fonts),v("fills",this.map.fills),v("borders",this.map.borders),v("styles",this.map.cellXfs),v("dxfs",this.map.dxfs),this.index={model:[],numFmt:[]},this.model.numFmts){const S=this.index.numFmt;this.model.numFmts.forEach(R=>{S[R.id]=R.formatCode})}return!1}default:return!0}}addStyleModel(m,v){if(!m)return 0;if(this.model.fonts.length||this._addFont({size:11,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}),this.weakMap&&this.weakMap.has(m))return this.weakMap.get(m);const S={};if(v=v||l.ValueType.Number,m.numFmt)S.numFmtId=this._addNumFmtStr(m.numFmt);else switch(v){case l.ValueType.Number:S.numFmtId=this._addNumFmtStr("General");break;case l.ValueType.Date:S.numFmtId=this._addNumFmtStr("mm-dd-yy")}m.font&&(S.fontId=this._addFont(m.font)),m.border&&(S.borderId=this._addBorder(m.border)),m.fill&&(S.fillId=this._addFill(m.fill)),m.alignment&&(S.alignment=m.alignment),m.protection&&(S.protection=m.protection);const R=this._addStyle(S);return this.weakMap&&this.weakMap.set(m,R),R}getStyleModel(m){const v=this.model.styles[m];if(!v)return null;let S=this.index.model[m];if(S)return S;if(S=this.index.model[m]={},v.numFmtId){const I=this.index.numFmt[v.numFmtId]||s.getDefaultFmtCode(v.numFmtId);I&&(S.numFmt=I)}function R(I,F,j){if(j||j===0){const L=F[j];L&&(S[I]=L)}}return R("font",this.model.fonts,v.fontId),R("border",this.model.borders,v.borderId),R("fill",this.model.fills,v.fillId),v.alignment&&(S.alignment=v.alignment),v.protection&&(S.protection=v.protection),S}addDxfStyle(m){return m.numFmt&&(m.numFmtId=this._addNumFmtStr(m.numFmt)),this.model.dxfs.push(m),this.model.dxfs.length-1}getDxfStyle(m){return this.model.dxfs[m]}_addStyle(m){const v=this.map.style.toXml(m);let S=this.index.style[v];return S===void 0&&(S=this.index.style[v]=this.model.styles.length,this.model.styles.push(v)),S}_addNumFmtStr(m){let v=s.getDefaultFmtId(m);if(v!==void 0||(v=this.index.numFmt[m],v!==void 0))return v;v=this.index.numFmt[m]=164+this.model.numFmts.length;const S=this.map.numFmt.toXml({id:v,formatCode:m});return this.model.numFmts.push(S),v}_addFont(m){const v=this.map.font.toXml(m);let S=this.index.font[v];return S===void 0&&(S=this.index.font[v]=this.model.fonts.length,this.model.fonts.push(v)),S}_addBorder(m){const v=this.map.border.toXml(m);let S=this.index.border[v];return S===void 0&&(S=this.index.border[v]=this.model.borders.length,this.model.borders.push(v)),S}_addFill(m){const v=this.map.fill.toXml(m);let S=this.index.fill[v];return S===void 0&&(S=this.index.fill[v]=this.model.fills.length,this.model.fills.push(v)),S}}u.STYLESHEET_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"x14ac x16r2","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac","xmlns:x16r2":"http://schemas.microsoft.com/office/spreadsheetml/2015/02/main"},u.STATIC_XFORMS={cellStyles:new r({tag:"cellStyles",$:{count:1},c:[{tag:"cellStyle",$:{name:"Normal",xfId:0,builtinId:0}}]}),dxfs:new r({tag:"dxfs",$:{count:0}}),tableStyles:new r({tag:"tableStyles",$:{count:0,defaultTableStyle:"TableStyleMedium2",defaultPivotStyle:"PivotStyleLight16"}}),extLst:new r({tag:"extLst",c:[{tag:"ext",$:{uri:"{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}","xmlns:x14":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"},c:[{tag:"x14:slicerStyles",$:{defaultSlicerStyle:"SlicerStyleLight1"}}]},{tag:"ext",$:{uri:"{9260A510-F301-46a8-8635-F512D64BE5F5}","xmlns:x15":"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"},c:[{tag:"x15:timelineStyles",$:{defaultTimelineStyle:"TimeSlicerStyleLight1"}}]}]})},u.Mock=class extends u{constructor(){super(),this.model={styles:[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}],numFmts:[],fonts:[{size:11,color:{theme:1},name:"Calibri",family:2,scheme:"minor"}],borders:[{}],fills:[{type:"pattern",pattern:"none"},{type:"pattern",pattern:"gray125"}]}}parseStream(g){return g.autodrain(),Promise.resolve()}addStyleModel(g,m){switch(m){case l.ValueType.Date:return this.dateStyleId;default:return 0}}get dateStyleId(){if(!this._dateStyleId){const g={numFmtId:s.getDefaultFmtId("mm-dd-yy")};this._dateStyleId=this.model.styles.length,this.model.styles.push(g)}return this._dateStyleId}getStyleModel(){return{}}},h.exports=u},{"../../../doc/enums":7,"../../../utils/xml-stream":28,"../base-xform":32,"../list-xform":71,"../static-xform":120,"./border-xform":127,"./dxf-xform":129,"./fill-xform":130,"./font-xform":131,"./numfmt-xform":132,"./style-xform":134}],136:[function(t,h,d){const l=t("../base-xform");class i extends l{constructor(r){super(),this.model=r}get tag(){return"u"}render(r,e){if((e=e||this.model)===!0)r.leafNode("u");else{const n=i.Attributes[e];n&&r.leafNode("u",n)}}parseOpen(r){r.name==="u"&&(this.model=r.attributes.val||!0)}parseText(){}parseClose(){return!1}}i.Attributes={single:{},double:{val:"double"},singleAccounting:{val:"singleAccounting"},doubleAccounting:{val:"doubleAccounting"}},h.exports=i},{"../base-xform":32}],137:[function(t,h,d){const l=t("../base-xform"),i=t("./filter-column-xform");h.exports=class extends l{constructor(){super(),this.map={filterColumn:new i}}get tag(){return"autoFilter"}prepare(o){o.columns.forEach((r,e)=>{this.map.filterColumn.prepare(r,{index:e})})}render(o,r){return o.openNode(this.tag,{ref:r.autoFilterRef}),r.columns.forEach(e=>{this.map.filterColumn.render(o,e)}),o.closeNode(),!0}parseOpen(o){if(this.parser)return this.parser.parseOpen(o),!0;switch(o.name){case this.tag:return this.model={autoFilterRef:o.attributes.ref,columns:[]},!0;default:if(this.parser=this.map[o.name],this.parser)return this.parseOpen(o),!0;throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(o))}}parseText(o){this.parser&&this.parser.parseText(o)}parseClose(o){if(this.parser)return this.parser.parseClose(o)||(this.model.columns.push(this.parser.model),this.parser=void 0),!0;switch(o){case this.tag:return!1;default:throw new Error("Unexpected xml node in parseClose: "+o)}}}},{"../base-xform":32,"./filter-column-xform":139}],138:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"customFilter"}render(i,o){i.leafNode(this.tag,{val:o.val,operator:o.operator})}parseOpen(i){return i.name===this.tag&&(this.model={val:i.attributes.val,operator:i.attributes.operator},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],139:[function(t,h,d){const l=t("../base-xform"),i=t("../list-xform"),o=t("./custom-filter-xform"),r=t("./filter-xform");h.exports=class extends l{constructor(){super(),this.map={customFilters:new i({tag:"customFilters",count:!1,empty:!0,childXform:new o}),filters:new i({tag:"filters",count:!1,empty:!0,childXform:new r})}}get tag(){return"filterColumn"}prepare(e,n){e.colId=n.index.toString()}render(e,n){return n.customFilters?(e.openNode(this.tag,{colId:n.colId,hiddenButton:n.filterButton?"0":"1"}),this.map.customFilters.render(e,n.customFilters),e.closeNode(),!0):(e.leafNode(this.tag,{colId:n.colId,hiddenButton:n.filterButton?"0":"1"}),!0)}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;const{attributes:n}=e;switch(e.name){case this.tag:return this.model={filterButton:n.hiddenButton==="0"},!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw new Error("Unexpected xml node in parseOpen: "+JSON.stringify(e))}}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.customFilters=this.map.customFilters.model,!1;default:return!0}}}},{"../base-xform":32,"../list-xform":71,"./custom-filter-xform":138,"./filter-xform":140}],140:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"filter"}render(i,o){i.leafNode(this.tag,{val:o.val})}parseOpen(i){return i.name===this.tag&&(this.model={val:i.attributes.val},!0)}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],141:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"tableColumn"}prepare(i,o){i.id=o.index+1}render(i,o){return i.leafNode(this.tag,{id:o.id.toString(),name:o.name,totalsRowLabel:o.totalsRowLabel,totalsRowFunction:o.totalsRowFunction,dxfId:o.dxfId}),!0}parseOpen(i){if(i.name===this.tag){const{attributes:o}=i;return this.model={name:o.name,totalsRowLabel:o.totalsRowLabel,totalsRowFunction:o.totalsRowFunction,dxfId:o.dxfId},!0}return!1}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],142:[function(t,h,d){const l=t("../base-xform");h.exports=class extends l{get tag(){return"tableStyleInfo"}render(i,o){return i.leafNode(this.tag,{name:o.theme?o.theme:void 0,showFirstColumn:o.showFirstColumn?"1":"0",showLastColumn:o.showLastColumn?"1":"0",showRowStripes:o.showRowStripes?"1":"0",showColumnStripes:o.showColumnStripes?"1":"0"}),!0}parseOpen(i){if(i.name===this.tag){const{attributes:o}=i;return this.model={theme:o.name?o.name:null,showFirstColumn:o.showFirstColumn==="1",showLastColumn:o.showLastColumn==="1",showRowStripes:o.showRowStripes==="1",showColumnStripes:o.showColumnStripes==="1"},!0}return!1}parseText(){}parseClose(){return!1}}},{"../base-xform":32}],143:[function(t,h,d){const l=t("../../../utils/xml-stream"),i=t("../base-xform"),o=t("../list-xform"),r=t("./auto-filter-xform"),e=t("./table-column-xform"),n=t("./table-style-info-xform");class c extends i{constructor(){super(),this.map={autoFilter:new r,tableColumns:new o({tag:"tableColumns",count:!0,empty:!0,childXform:new e}),tableStyleInfo:new n}}prepare(s,f){this.map.autoFilter.prepare(s),this.map.tableColumns.prepare(s.columns,f)}get tag(){return"table"}render(s,f){s.openXml(l.StdDocAttributes),s.openNode(this.tag,{...c.TABLE_ATTRIBUTES,id:f.id,name:f.name,displayName:f.displayName||f.name,ref:f.tableRef,totalsRowCount:f.totalsRow?"1":void 0,totalsRowShown:f.totalsRow?void 0:"1",headerRowCount:f.headerRow?"1":"0"}),this.map.autoFilter.render(s,f),this.map.tableColumns.render(s,f.columns),this.map.tableStyleInfo.render(s,f.style),s.closeNode()}parseOpen(s){if(this.parser)return this.parser.parseOpen(s),!0;const{name:f,attributes:p}=s;switch(f){case this.tag:this.reset(),this.model={name:p.name,displayName:p.displayName||p.name,tableRef:p.ref,totalsRow:p.totalsRowCount==="1",headerRow:p.headerRowCount==="1"};break;default:this.parser=this.map[s.name],this.parser&&this.parser.parseOpen(s)}return!0}parseText(s){this.parser&&this.parser.parseText(s)}parseClose(s){if(this.parser)return this.parser.parseClose(s)||(this.parser=void 0),!0;switch(s){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((f,p)=>{this.model.columns[p].filterButton=f.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(s,f){s.columns.forEach(p=>{p.dxfId!==void 0&&(p.style=f.styles.getDxfStyle(p.dxfId))})}}c.TABLE_ATTRIBUTES={xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"xr xr3","xmlns:xr":"http://schemas.microsoft.com/office/spreadsheetml/2014/revision","xmlns:xr3":"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3"},h.exports=c},{"../../../utils/xml-stream":28,"../base-xform":32,"../list-xform":71,"./auto-filter-xform":137,"./table-column-xform":141,"./table-style-info-xform":142}],144:[function(t,h,d){(function(l,i){(function(){const o=t("fs"),r=t("jszip"),{PassThrough:e}=t("readable-stream"),n=t("../utils/zip-stream"),c=t("../utils/stream-buf"),a=t("../utils/utils"),s=t("../utils/xml-stream"),{bufferToString:f}=t("../utils/browser-buffer-decode"),p=t("./xform/style/styles-xform"),u=t("./xform/core/core-xform"),g=t("./xform/strings/shared-strings-xform"),m=t("./xform/core/relationships-xform"),v=t("./xform/core/content-types-xform"),S=t("./xform/core/app-xform"),R=t("./xform/book/workbook-xform"),I=t("./xform/sheet/worksheet-xform"),F=t("./xform/drawing/drawing-xform"),j=t("./xform/table/table-xform"),L=t("./xform/comment/comments-xform"),$=t("./xform/comment/vml-notes-xform"),V=t("./xml/theme1");class z{constructor(A){this.workbook=A}async readFile(A,k){if(!await a.fs.exists(A))throw new Error("File not found: "+A);const b=o.createReadStream(A);try{const y=await this.read(b,k);return b.close(),y}catch(y){throw b.close(),y}}parseRels(A){return new m().parseStream(A)}parseWorkbook(A){return new R().parseStream(A)}parseSharedStrings(A){return new g().parseStream(A)}reconcile(A,k){const b=new R,y=new I(k),_=new F,x=new j;b.reconcile(A);const M={media:A.media,mediaIndex:A.mediaIndex};Object.keys(A.drawings).forEach(H=>{const W=A.drawings[H],K=A.drawingRels[H];K&&(M.rels=K.reduce((D,X)=>(D[X.Id]=X,D),{}),(W.anchors||[]).forEach(D=>{const X=D.picture&&D.picture.hyperlinks;X&&M.rels[X.rId]&&(X.hyperlink=M.rels[X.rId].Target,delete X.rId)}),_.reconcile(W,M))});const B={styles:A.styles};Object.values(A.tables).forEach(H=>{x.reconcile(H,B)});const P={styles:A.styles,sharedStrings:A.sharedStrings,media:A.media,mediaIndex:A.mediaIndex,date1904:A.properties&&A.properties.date1904,drawings:A.drawings,comments:A.comments,tables:A.tables,vmlDrawings:A.vmlDrawings};A.worksheets.forEach(H=>{H.relationships=A.worksheetRels[H.sheetNo],y.reconcile(H,P)}),delete A.worksheetHash,delete A.worksheetRels,delete A.globalRels,delete A.sharedStrings,delete A.workbookRels,delete A.sheetDefs,delete A.styles,delete A.mediaIndex,delete A.drawings,delete A.drawingRels,delete A.vmlDrawings}async _processWorksheetEntry(A,k,b,y,_){const x=new I(y),M=await x.parseStream(A);M.sheetNo=b,k.worksheetHash[_]=M,k.worksheets.push(M)}async _processCommentEntry(A,k,b){const y=new L,_=await y.parseStream(A);k.comments[`../${b}.xml`]=_}async _processTableEntry(A,k,b){const y=new j,_=await y.parseStream(A);k.tables[`../tables/${b}.xml`]=_}async _processWorksheetRelsEntry(A,k,b){const y=new m,_=await y.parseStream(A);k.worksheetRels[b]=_}async _processMediaEntry(A,k,b){const y=b.lastIndexOf(".");if(y>=1){const _=b.substr(y+1),x=b.substr(0,y);await new Promise((M,B)=>{const P=new c;P.on("finish",()=>{k.mediaIndex[b]=k.media.length,k.mediaIndex[x]=k.media.length;const H={type:"image",name:x,extension:_,buffer:P.toBuffer()};k.media.push(H),M()}),A.on("error",H=>{B(H)}),A.pipe(P)})}}async _processDrawingEntry(A,k,b){const y=new F,_=await y.parseStream(A);k.drawings[b]=_}async _processDrawingRelsEntry(A,k,b){const y=new m,_=await y.parseStream(A);k.drawingRels[b]=_}async _processVmlDrawingEntry(A,k,b){const y=new $,_=await y.parseStream(A);k.vmlDrawings[`../drawings/${b}.vml`]=_}async _processThemeEntry(A,k,b){await new Promise((y,_)=>{const x=new c;A.on("error",_),x.on("error",_),x.on("finish",()=>{k.themes[b]=x.read().toString(),y()}),A.pipe(x)})}createInputStream(){throw new Error("`XLSX#createInputStream` is deprecated. You should use `XLSX#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}async read(A,k){!A[Symbol.asyncIterator]&&A.pipe&&(A=A.pipe(new e));const b=[];for await(const y of A)b.push(y);return this.load(i.concat(b),k)}async load(A,k){let b;b=k&&k.base64?i.from(A.toString(),"base64"):A;const y={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{}},_=await r.loadAsync(b);for(const x of Object.values(_.files))if(!x.dir){let M,B=x.name;if(B[0]==="/"&&(B=B.substr(1)),B.match(/xl\/media\//)||B.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/))M=new e,M.write(await x.async("nodebuffer"));else{let P;M=new e({writableObjectMode:!0,readableObjectMode:!0}),P=l.browser?f(await x.async("nodebuffer")):await x.async("string");const H=16384;for(let W=0;W<P.length;W+=H)M.write(P.substring(W,W+H))}switch(M.end(),B){case"_rels/.rels":y.globalRels=await this.parseRels(M);break;case"xl/workbook.xml":{const P=await this.parseWorkbook(M);y.sheets=P.sheets,y.definedNames=P.definedNames,y.views=P.views,y.properties=P.properties,y.calcProperties=P.calcProperties;break}case"xl/_rels/workbook.xml.rels":y.workbookRels=await this.parseRels(M);break;case"xl/sharedStrings.xml":y.sharedStrings=new g,await y.sharedStrings.parseStream(M);break;case"xl/styles.xml":y.styles=new p,await y.styles.parseStream(M);break;case"docProps/app.xml":{const P=new S,H=await P.parseStream(M);y.company=H.company,y.manager=H.manager;break}case"docProps/core.xml":{const P=new u,H=await P.parseStream(M);Object.assign(y,H);break}default:{let P=B.match(/xl\/worksheets\/sheet(\d+)[.]xml/);if(P){await this._processWorksheetEntry(M,y,P[1],k,B);break}if(P=B.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml.rels/),P){await this._processWorksheetRelsEntry(M,y,P[1]);break}if(P=B.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/),P){await this._processThemeEntry(M,y,P[1]);break}if(P=B.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/),P){await this._processMediaEntry(M,y,P[1]);break}if(P=B.match(/xl\/drawings\/([a-zA-Z0-9]+)[.]xml/),P){await this._processDrawingEntry(M,y,P[1]);break}if(P=B.match(/xl\/(comments\d+)[.]xml/),P){await this._processCommentEntry(M,y,P[1]);break}if(P=B.match(/xl\/tables\/(table\d+)[.]xml/),P){await this._processTableEntry(M,y,P[1]);break}if(P=B.match(/xl\/drawings\/_rels\/([a-zA-Z0-9]+)[.]xml[.]rels/),P){await this._processDrawingRelsEntry(M,y,P[1]);break}if(P=B.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/),P){await this._processVmlDrawingEntry(M,y,P[1]);break}}}}return this.reconcile(y,k),this.workbook.model=y,this.workbook}async addMedia(A,k){await Promise.all(k.media.map(async b=>{if(b.type==="image"){const y=`xl/media/${b.name}.${b.extension}`;if(b.filename){const _=await function(x,M){return new Promise((B,P)=>{o.readFile(x,M,(H,W)=>{H?P(H):B(W)})})}(b.filename);return A.append(_,{name:y})}if(b.buffer)return A.append(b.buffer,{name:y});if(b.base64){const _=b.base64,x=_.substring(_.indexOf(",")+1);return A.append(x,{name:y,base64:!0})}}throw new Error("Unsupported media")}))}addDrawings(A,k){const b=new F,y=new m;k.worksheets.forEach(_=>{const{drawing:x}=_;if(x){b.prepare(x,{});let M=b.toXml(x);A.append(M,{name:`xl/drawings/${x.name}.xml`}),M=y.toXml(x.rels),A.append(M,{name:`xl/drawings/_rels/${x.name}.xml.rels`})}})}addTables(A,k){const b=new j;k.worksheets.forEach(y=>{const{tables:_}=y;_.forEach(x=>{b.prepare(x,{});const M=b.toXml(x);A.append(M,{name:"xl/tables/"+x.target})})})}async addContentTypes(A,k){const b=new v().toXml(k);A.append(b,{name:"[Content_Types].xml"})}async addApp(A,k){const b=new S().toXml(k);A.append(b,{name:"docProps/app.xml"})}async addCore(A,k){const b=new u;A.append(b.toXml(k),{name:"docProps/core.xml"})}async addThemes(A,k){const b=k.themes||{theme1:V};Object.keys(b).forEach(y=>{const _=b[y],x=`xl/theme/${y}.xml`;A.append(_,{name:x})})}async addOfficeRels(A){const k=new m().toXml([{Id:"rId1",Type:z.RelType.OfficeDocument,Target:"xl/workbook.xml"},{Id:"rId2",Type:z.RelType.CoreProperties,Target:"docProps/core.xml"},{Id:"rId3",Type:z.RelType.ExtenderProperties,Target:"docProps/app.xml"}]);A.append(k,{name:"_rels/.rels"})}async addWorkbookRels(A,k){let b=1;const y=[{Id:"rId"+b++,Type:z.RelType.Styles,Target:"styles.xml"},{Id:"rId"+b++,Type:z.RelType.Theme,Target:"theme/theme1.xml"}];k.sharedStrings.count&&y.push({Id:"rId"+b++,Type:z.RelType.SharedStrings,Target:"sharedStrings.xml"}),k.worksheets.forEach(x=>{x.rId="rId"+b++,y.push({Id:x.rId,Type:z.RelType.Worksheet,Target:`worksheets/sheet${x.id}.xml`})});const _=new m().toXml(y);A.append(_,{name:"xl/_rels/workbook.xml.rels"})}async addSharedStrings(A,k){k.sharedStrings&&k.sharedStrings.count&&A.append(k.sharedStrings.xml,{name:"xl/sharedStrings.xml"})}async addStyles(A,k){const{xml:b}=k.styles;b&&A.append(b,{name:"xl/styles.xml"})}async addWorkbook(A,k){const b=new R;A.append(b.toXml(k),{name:"xl/workbook.xml"})}async addWorksheets(A,k){const b=new I,y=new m,_=new L,x=new $;k.worksheets.forEach(M=>{let B=new s;b.render(B,M),A.append(B.xml,{name:`xl/worksheets/sheet${M.id}.xml`}),M.rels&&M.rels.length&&(B=new s,y.render(B,M.rels),A.append(B.xml,{name:`xl/worksheets/_rels/sheet${M.id}.xml.rels`})),M.comments.length>0&&(B=new s,_.render(B,M),A.append(B.xml,{name:`xl/comments${M.id}.xml`}),B=new s,x.render(B,M),A.append(B.xml,{name:`xl/drawings/vmlDrawing${M.id}.vml`}))})}_finalize(A){return new Promise((k,b)=>{A.on("finish",()=>{k(this)}),A.on("error",b),A.finalize()})}prepareModel(A,k){A.creator=A.creator||"ExcelJS",A.lastModifiedBy=A.lastModifiedBy||"ExcelJS",A.created=A.created||new Date,A.modified=A.modified||new Date,A.useSharedStrings=k.useSharedStrings===void 0||k.useSharedStrings,A.useStyles=k.useStyles===void 0||k.useStyles,A.sharedStrings=new g,A.styles=A.useStyles?new p(!0):new p.Mock;const b=new R,y=new I;b.prepare(A);const _={sharedStrings:A.sharedStrings,styles:A.styles,date1904:A.properties.date1904,drawingsCount:0,media:A.media};_.drawings=A.drawings=[],_.commentRefs=A.commentRefs=[];let x=0;A.tables=[],A.worksheets.forEach(M=>{M.tables.forEach(B=>{x++,B.target=`table${x}.xml`,B.id=x,A.tables.push(B)}),y.prepare(M,_)})}async write(A,k){k=k||{};const{model:b}=this.workbook,y=new n.ZipWriter(k.zip);return y.pipe(A),this.prepareModel(b,k),await this.addContentTypes(y,b),await this.addOfficeRels(y,b),await this.addWorkbookRels(y,b),await this.addWorksheets(y,b),await this.addSharedStrings(y,b),await this.addDrawings(y,b),await this.addTables(y,b),await Promise.all([this.addThemes(y,b),this.addStyles(y,b)]),await this.addMedia(y,b),await Promise.all([this.addApp(y,b),this.addCore(y,b)]),await this.addWorkbook(y,b),this._finalize(y)}writeFile(A,k){const b=o.createWriteStream(A);return new Promise((y,_)=>{b.on("finish",()=>{y()}),b.on("error",x=>{_(x)}),this.write(b,k).then(()=>{b.end()}).catch(x=>{_(x)})})}async writeBuffer(A){const k=new c;return await this.write(k,A),k.read()}}z.RelType=t("./rel-type"),h.exports=z}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{"../utils/browser-buffer-decode":16,"../utils/stream-buf":24,"../utils/utils":27,"../utils/xml-stream":28,"../utils/zip-stream":29,"./rel-type":31,"./xform/book/workbook-xform":38,"./xform/comment/comments-xform":40,"./xform/comment/vml-notes-xform":45,"./xform/core/app-xform":51,"./xform/core/content-types-xform":52,"./xform/core/core-xform":53,"./xform/core/relationships-xform":55,"./xform/drawing/drawing-xform":62,"./xform/sheet/worksheet-xform":115,"./xform/strings/shared-strings-xform":124,"./xform/style/styles-xform":135,"./xform/table/table-xform":143,"./xml/theme1":145,_process:467,buffer:220,fs:216,jszip:441,"readable-stream":491}],145:[function(t,h,d){h.exports=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20
20
  <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`},{}],146:[function(t,h,d){(function(l){(function(){Object.defineProperty(d,"__esModule",{value:!0}),d.CsvFormatterStream=void 0;const i=t("stream"),o=t("./formatter");class r extends i.Transform{constructor(n){super({writableObjectMode:n.objectMode}),this.hasWrittenBOM=!1,this.formatterOptions=n,this.rowFormatter=new o.RowFormatter(n),this.hasWrittenBOM=!n.writeBOM}transform(n){return this.rowFormatter.rowTransform=n,this}_transform(n,c,a){let s=!1;try{this.hasWrittenBOM||(this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0),this.rowFormatter.format(n,(f,p)=>f?(s=!0,a(f)):(p&&p.forEach(u=>{this.push(l.from(u,"utf8"))}),s=!0,a()))}catch(f){if(s)throw f;a(f)}}_flush(n){this.rowFormatter.finish((c,a)=>c?n(c):(a&&a.forEach(s=>{this.push(l.from(s,"utf8"))}),n()))}}d.CsvFormatterStream=r}).call(this)}).call(this,t("buffer").Buffer)},{"./formatter":150,buffer:220,stream:505}],147:[function(t,h,d){Object.defineProperty(d,"__esModule",{value:!0}),d.FormatterOptions=void 0,d.FormatterOptions=class{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var i;this.objectMode=!0,this.delimiter=",",this.rowDelimiter=`
21
21
  `,this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\uFEFF",this.alwaysWriteHeaders=!1,Object.assign(this,l||{}),(l==null?void 0:l.quoteHeaders)===void 0&&(this.quoteHeaders=this.quoteColumns),(l==null?void 0:l.quote)===!0?this.quote='"':(l==null?void 0:l.quote)===!1&&(this.quote=""),typeof(l==null?void 0:l.escape)!="string"&&(this.escape=this.quote),this.shouldWriteHeaders=!!this.headers&&((i=l.writeHeaders)===null||i===void 0||i),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}},{}],148:[function(t,h,d){var l=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.FieldFormatter=void 0;const i=l(t("lodash.isboolean")),o=l(t("lodash.isnil")),r=l(t("lodash.escaperegexp"));d.FieldFormatter=class{constructor(e){this._headers=null,this.formatterOptions=e,e.headers!==null&&(this.headers=e.headers),this.REPLACE_REGEXP=new RegExp(e.quote,"g");const n=`[${e.delimiter}${r.default(e.rowDelimiter)}|\r|
@@ -71,7 +71,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=t("safe-buffer"),e=t("random
71
71
  * @author Louis-Dominique Dubeau
72
72
  * @license MIT
73
73
  * @copyright Louis-Dominique Dubeau
74
- */function l(i){return i>=65&&i<=90||i===95||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=65536&&i<=983039}Object.defineProperty(d,"__esModule",{value:!0}),d.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",d.NC_NAME_CHAR="-"+d.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",d.NC_NAME_START_CHAR_RE=new RegExp("^["+d.NC_NAME_START_CHAR+"]$","u"),d.NC_NAME_CHAR_RE=new RegExp("^["+d.NC_NAME_CHAR+"]$","u"),d.NC_NAME_RE=new RegExp("^["+d.NC_NAME_START_CHAR+"]["+d.NC_NAME_CHAR+"]*$","u"),d.isNCNameStartChar=l,d.isNCNameChar=function(i){return l(i)||i===45||i===46||i>=48&&i<=57||i===183||i>=768&&i<=879||i>=8255&&i<=8256}},{}]},{},[15])(15)})})(jl);var Tf=jl.exports;const Mf=Cf(Tf),Af={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},Rf={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Nf={class:"vfp-text-center"},Of={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},jf={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},If={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},Bf={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-green-500 vfp-via-emerald-500 vfp-to-teal-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},Pf={class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"},Ff={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},Df=["href"],Lf=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(null);let i=null,o=null,r=null,e={width:0,height:0};const n=()=>{if(!l.value)return{width:800,height:600};const s=l.value.clientWidth,f=l.value.clientHeight,p=s>100?s:800,u=f>100?f:600;return{width:p,height:u}},c=()=>{if(!l.value||!i)return;l.value.innerHTML="";const{width:s,height:f}=n(),p=s<640;new uu(l.value,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:p?80:100,indexWidth:p?40:60,minWidth:p?40:60},view:{height:()=>f,width:()=>s}}).loadData(i)},a=async()=>{if(l.value){h.value=!0,d.value=null;try{const s=await fetch(w.url,{mode:"cors",credentials:"omit",redirect:"follow"});if(!s.ok)throw s.status===404?new Error(t.value("xlsx.not_found")):s.status===403?new Error("无权限访问此文件"):new Error(`文件加载失败 (${s.status})`);const f=await s.arrayBuffer();if(f.byteLength===0)throw new Error("文件为空");const p=new Mf.Workbook;await p.xlsx.load(f),i=Wu(p),c(),h.value=!1}catch(s){console.error("Excel 解析错误:",s);let f=t.value("xlsx.parse_failed");s instanceof Error&&(f=s.message),d.value=f,h.value=!1}}};return T.onMounted(()=>{if(!l.value)return;let s=!0;o=new ResizeObserver(()=>{if(s){s=!1,e=n();return}const f=n(),p=Math.abs(e.width-f.width),u=Math.abs(e.height-f.height);p<10&&u<10||(e=f,r!==null&&clearTimeout(r),r=window.setTimeout(()=>{i&&c()},500))}),o.observe(l.value),setTimeout(()=>{requestAnimationFrame(()=>a())},100)}),T.watch(()=>w.url,()=>{a()}),T.onBeforeUnmount(()=>{o&&o.disconnect(),r!==null&&clearTimeout(r),i=null,l.value&&(l.value.innerHTML="")}),(s,f)=>(T.openBlock(),T.createElementBlock("div",Af,[h.value?(T.openBlock(),T.createElementBlock("div",Rf,[T.createElementVNode("div",Nf,[f[0]||(f[0]=T.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",Of,T.toDisplayString(T.unref(t)("xlsx.loading")),1)])])):T.createCommentVNode("",!0),d.value&&!h.value?(T.openBlock(),T.createElementBlock("div",jf,[T.createElementVNode("div",If,[T.createElementVNode("div",Bf,[T.createVNode(T.unref(Ot.FileSpreadsheet),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),T.createElementVNode("p",Pf,T.toDisplayString(T.unref(t)("xlsx.load_failed")),1),T.createElementVNode("p",Ff,T.toDisplayString(d.value),1),T.createElementVNode("a",{href:C.url,download:"",class:"vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-white vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"}," 下载文件 ",8,Df),f[1]||(f[1]=T.createElementVNode("p",{class:"vfp-text-xs vfp-text-white/40 vfp-mt-3 md:vfp-mt-4"},"提示:可以使用 Microsoft Excel 或 WPS 打开",-1))])])):T.createCommentVNode("",!0),d.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:2,ref_key:"containerRef",ref:l,class:"xlsx-spreadsheet-container vfp-w-full vfp-h-full",style:T.normalizeStyle({opacity:h.value?0:1})},null,4))]))}}),zf={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},$f={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Vf={class:"vfp-text-center"},Uf={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},Hf={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Wf={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},qf={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-orange-500 vfp-via-red-500 vfp-to-pink-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},Xf={class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"},Zf={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},Gf=["href"],Kf=T.defineComponent({__name:"index",props:{url:{},tiled:{type:Boolean,default:!0}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(0),i=T.ref(null);let o=null,r=null,e=null,n=null,c={width:0,height:0};const a=()=>{var v;if(!i.value)return{width:960,height:540};const p=i.value.clientWidth,u=((v=i.value.parentElement)==null?void 0:v.clientWidth)||0,g=p>100?p:u>100?u:300,m=Math.floor(g*9/16);return{width:g,height:m}},s=async()=>{if(!(!i.value||!e||l.value===0))try{if(o)try{o.destroy()}catch{}i.value.innerHTML="";const p=a();o=mo.init(i.value,{width:p.width,height:w.tiled?p.height*l.value:p.height,mode:w.tiled?"list":"slide"}),await o.preview(e)}catch{}},f=async()=>{if(!i.value)return;h.value=!0,d.value=null;let p=window.setTimeout(()=>{d.value=t.value("pptx.timeout"),h.value=!1},3e4);try{const u=await fetch(w.url,{mode:"cors",credentials:"omit",redirect:"follow"});if(!u.ok)throw u.status===404?new Error(t.value("pptx.not_found")):u.status===403?new Error("无权限访问此文件"):u.status>=500?new Error("服务器错误,请稍后重试"):new Error(`文件加载失败 (${u.status})`);const g=await u.arrayBuffer();if(g.byteLength===0)throw new Error("文件为空");e=g;const m=document.createElement("div");m.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden",document.body.appendChild(m);try{const v=mo.init(m,{width:100,height:100,mode:"slide"});try{await v.preview(g)}catch{throw new Error(t.value("pptx.invalid_format"))}const S=v.slideCount;if(!S||S===0)throw new Error(t.value("pptx.no_pages"));v.destroy(),l.value=S,i.value&&(i.value.innerHTML="");const R=a();o=mo.init(i.value,{width:R.width,height:w.tiled?R.height*S:R.height,mode:w.tiled?"list":"slide"}),await o.preview(g),p!==null&&(clearTimeout(p),p=null),h.value=!1}finally{document.body.contains(m)&&document.body.removeChild(m)}}catch(u){p!==null&&clearTimeout(p);let g=t.value("pptx.parse_failed");u instanceof Error?g=u.message:typeof u=="string"&&(g=u),d.value=g,h.value=!1}};return T.onMounted(()=>{if(!i.value)return;let p=!0;r=new ResizeObserver(()=>{if(p){p=!1,c=a();return}const u=a(),g=Math.abs(c.width-u.width),m=Math.abs(c.height-u.height);g<10&&m<10||(c=u,n!==null&&clearTimeout(n),n=window.setTimeout(()=>{o&&e&&s()},800))}),r.observe(i.value),setTimeout(()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>f()))},150)}),T.watch(()=>w.url,()=>{f()}),T.onBeforeUnmount(()=>{if(r&&r.disconnect(),n!==null&&clearTimeout(n),e=null,l.value=0,o)try{o.destroy()}catch{}o=null}),(p,u)=>(T.openBlock(),T.createElementBlock("div",zf,[h.value?(T.openBlock(),T.createElementBlock("div",$f,[T.createElementVNode("div",Vf,[u[0]||(u[0]=T.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",Uf,T.toDisplayString(T.unref(t)("pptx.loading")),1)])])):T.createCommentVNode("",!0),d.value&&!h.value?(T.openBlock(),T.createElementBlock("div",Hf,[T.createElementVNode("div",Wf,[T.createElementVNode("div",qf,[T.createVNode(T.unref(Ot.Presentation),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),T.createElementVNode("p",Xf,T.toDisplayString(T.unref(t)("pptx.load_failed")),1),T.createElementVNode("p",Zf,T.toDisplayString(d.value),1),T.createElementVNode("a",{href:C.url,download:"",class:"vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-white vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"}," 下载文件 ",8,Gf),u[1]||(u[1]=T.createElementVNode("p",{class:"vfp-text-xs vfp-text-white/40 vfp-mt-3 md:vfp-mt-4"}," 提示:可以使用 Microsoft PowerPoint 或 WPS 打开 ",-1))])])):T.createCommentVNode("",!0),d.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:2,ref_key:"containerRef",ref:i,class:"pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",style:T.normalizeStyle({opacity:h.value?0:1})},null,4))]))}}),Yf={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Jf={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Qf={class:"vfp-text-white/70 vfp-text-center"},th={class:"vfp-text-lg"},eh={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"}},rh={class:"msg-container"},nh={class:"msg-header"},ih={class:"msg-subject"},sh={class:"msg-meta"},oh={key:0,class:"msg-row"},ah={class:"msg-icon-wrap"},lh={class:"msg-row-content"},ch={class:"msg-value"},uh={key:1,class:"msg-row"},fh={class:"msg-icon-wrap"},hh={class:"msg-row-content"},dh={class:"msg-value"},ph={key:2,class:"msg-row"},mh={class:"msg-icon-wrap"},gh={class:"msg-row-content"},bh={class:"msg-value"},vh={key:3,class:"msg-row"},yh={class:"msg-icon-wrap"},wh={class:"msg-row-content"},_h={class:"msg-value"},xh={key:4,class:"msg-row"},kh={class:"msg-icon-wrap"},Sh={class:"msg-row-content"},Eh={class:"msg-value"},Ch={key:5,class:"msg-row"},Th={class:"msg-icon-wrap"},Mh={class:"msg-row-content"},Ah={class:"msg-value"},Rh={key:6,class:"msg-row"},Nh={class:"msg-icon-wrap"},Oh={class:"msg-row-content"},jh={class:"msg-value"},Ih={key:7,class:"msg-row"},Bh={class:"msg-icon-wrap"},Ph={class:"msg-row-content"},Fh={key:8,class:"msg-row"},Dh={class:"msg-icon-wrap"},Lh={class:"msg-row-content"},zh={class:"msg-value"},$h={key:9,class:"msg-row"},Vh={class:"msg-icon-wrap"},Uh={class:"msg-row-content"},Hh={class:"msg-value"},Wh={key:10,class:"msg-row msg-row-bordered"},qh={class:"msg-icon-wrap"},Xh={class:"msg-row-content"},Zh={class:"msg-value msg-attachments"},Gh={key:0,class:"msg-attachment-size"},Kh={class:"msg-icon-wrap"},Yh={class:"msg-row-content"},Jh={class:"msg-value msg-id"},Qh={key:12,class:"msg-row"},td={class:"msg-icon-wrap"},ed={class:"msg-row-content"},rd={class:"msg-value msg-id"},nd=["innerHTML"],id=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(null);function i(E,A){return E?E.filter(k=>k.recipType===A).map(k=>{const b=k.name||"",y=k.smtpAddress||k.email||"";return b&&y&&b!==y?`${b} <${y}>`:b||y}).filter(Boolean).join("; "):""}function o(E){if(!E)return"";try{const A=new Date(E);return isNaN(A.getTime())?E:A.toLocaleString()}catch{return E}}function r(E,A){if(E.bodyHtml)return E.bodyHtml;if(E.html)try{return new TextDecoder("utf-8").decode(E.html)}catch{}return E.body?`<pre style="white-space: pre-wrap; word-wrap: break-word; font-family: system-ui, sans-serif;">${E.body.replace(/&/g,"&amp;").replace(/\x3c/g,"&lt;").replace(/>/g,"&gt;")}</pre>`:`<p style="color: #999;">${A}</p>`}function e(E){return E?{"IPM.Note":"Email","IPM.Note.SMIME":"Encrypted Email","IPM.Note.SMIME.MultipartSigned":"Signed Email","IPM.Appointment":"Appointment","IPM.Schedule.Meeting.Request":"Meeting Request","IPM.Schedule.Meeting.Canceled":"Meeting Cancellation","IPM.Contact":"Contact","IPM.Task":"Task","IPM.StickyNote":"Sticky Note"}[E]||E:""}const n=async()=>{h.value=!0,d.value=null,l.value=null;try{const E=await fetch(w.url);if(!E.ok)throw new Error("文件加载失败");const A=await E.arrayBuffer(),k=new fu(A);l.value=k.getFileData()}catch(E){console.error("MSG 解析错误:",E),d.value=t.value("msg.parse_failed")}finally{h.value=!1}};T.watch(()=>w.url,n,{immediate:!0});const c=T.computed(()=>{var E;return((E=l.value)==null?void 0:E.subject)||"(无主题)"}),a=T.computed(()=>{if(!l.value)return"";const E=l.value.senderName||"",A=l.value.senderSmtpAddress||l.value.senderEmail||"";return E&&A&&E!==A?`${E} <${A}>`:E||A}),s=T.computed(()=>{var E;return i((E=l.value)==null?void 0:E.recipients,"to")}),f=T.computed(()=>{var E;return i((E=l.value)==null?void 0:E.recipients,"cc")}),p=T.computed(()=>{var E;return i((E=l.value)==null?void 0:E.recipients,"bcc")}),u=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.clientSubmitTime)}),g=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.messageDeliveryTime)}),m=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.creationTime)}),v=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.lastModificationTime)}),S=T.computed(()=>{var E;return(((E=l.value)==null?void 0:E.attachments)||[]).filter(A=>!A.attachmentHidden)}),R=T.computed(()=>l.value?r(l.value,t.value("msg.empty_body")):""),I=T.computed(()=>{var E;return e((E=l.value)==null?void 0:E.messageClass)}),F=T.computed(()=>{var E;return((E=l.value)==null?void 0:E.messageId)||""}),j=T.computed(()=>{const E=l.value;return E&&typeof E.importance=="number"?E.importance:void 0}),L=T.computed(()=>j.value===2?"High":j.value===0?"Low":""),$=T.computed(()=>{const E=l.value;return E&&typeof E.sensitivity=="number"?E.sensitivity:void 0}),V=T.computed(()=>$.value===void 0||$.value===0?"":{1:"Personal",2:"Private",3:"Confidential"}[$.value]||""),z=E=>E?E>1048576?`${(E/1048576).toFixed(1)} MB`:E>1024?`${(E/1024).toFixed(0)} KB`:`${E} B`:"";return(E,A)=>h.value?(T.openBlock(),T.createElementBlock("div",Yf,[...A[0]||(A[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):d.value||!l.value?(T.openBlock(),T.createElementBlock("div",Jf,[T.createElementVNode("div",Qf,[T.createElementVNode("p",th,T.toDisplayString(d.value||T.unref(t)("msg.parse_failed_short")),1)])])):(T.openBlock(),T.createElementBlock("div",eh,[T.createElementVNode("div",rh,[T.createElementVNode("div",nh,[T.createElementVNode("h2",ih,T.toDisplayString(c.value),1),T.createElementVNode("div",sh,[a.value?(T.openBlock(),T.createElementBlock("div",oh,[T.createElementVNode("span",ah,[T.createVNode(T.unref(Ot.User),{size:16,class:"msg-icon"})]),T.createElementVNode("div",lh,[A[1]||(A[1]=T.createElementVNode("span",{class:"msg-label"},"From",-1)),T.createElementVNode("span",ch,T.toDisplayString(a.value),1)])])):T.createCommentVNode("",!0),s.value?(T.openBlock(),T.createElementBlock("div",uh,[T.createElementVNode("span",fh,[T.createVNode(T.unref(Ot.Users),{size:16,class:"msg-icon"})]),T.createElementVNode("div",hh,[A[2]||(A[2]=T.createElementVNode("span",{class:"msg-label"},"To",-1)),T.createElementVNode("span",dh,T.toDisplayString(s.value),1)])])):T.createCommentVNode("",!0),f.value?(T.openBlock(),T.createElementBlock("div",ph,[T.createElementVNode("span",mh,[T.createVNode(T.unref(Ot.Users),{size:16,class:"msg-icon"})]),T.createElementVNode("div",gh,[A[3]||(A[3]=T.createElementVNode("span",{class:"msg-label"},"Cc",-1)),T.createElementVNode("span",bh,T.toDisplayString(f.value),1)])])):T.createCommentVNode("",!0),p.value?(T.openBlock(),T.createElementBlock("div",vh,[T.createElementVNode("span",yh,[T.createVNode(T.unref(Ot.Users),{size:16,class:"msg-icon"})]),T.createElementVNode("div",wh,[A[4]||(A[4]=T.createElementVNode("span",{class:"msg-label"},"Bcc",-1)),T.createElementVNode("span",_h,T.toDisplayString(p.value),1)])])):T.createCommentVNode("",!0),u.value?(T.openBlock(),T.createElementBlock("div",xh,[T.createElementVNode("span",kh,[T.createVNode(T.unref(Ot.Calendar),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Sh,[A[5]||(A[5]=T.createElementVNode("span",{class:"msg-label"},"Sent",-1)),T.createElementVNode("span",Eh,T.toDisplayString(u.value),1)])])):T.createCommentVNode("",!0),g.value&&g.value!==u.value?(T.openBlock(),T.createElementBlock("div",Ch,[T.createElementVNode("span",Th,[T.createVNode(T.unref(Ot.Clock),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Mh,[A[6]||(A[6]=T.createElementVNode("span",{class:"msg-label"},"Received",-1)),T.createElementVNode("span",Ah,T.toDisplayString(g.value),1)])])):T.createCommentVNode("",!0),!u.value&&!g.value&&m.value?(T.openBlock(),T.createElementBlock("div",Rh,[T.createElementVNode("span",Nh,[T.createVNode(T.unref(Ot.Calendar),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Oh,[A[7]||(A[7]=T.createElementVNode("span",{class:"msg-label"},"Date",-1)),T.createElementVNode("span",jh,T.toDisplayString(m.value),1)])])):T.createCommentVNode("",!0),L.value?(T.openBlock(),T.createElementBlock("div",Ih,[T.createElementVNode("span",Bh,[T.createVNode(T.unref(Ot.Tag),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Ph,[A[8]||(A[8]=T.createElementVNode("span",{class:"msg-label"},"Importance",-1)),T.createElementVNode("span",{class:"msg-value",style:T.normalizeStyle({color:j.value===2?"#dc2626":"#2563eb",fontWeight:500})},T.toDisplayString(L.value),5)])])):T.createCommentVNode("",!0),V.value?(T.openBlock(),T.createElementBlock("div",Fh,[T.createElementVNode("span",Dh,[T.createVNode(T.unref(Ot.Tag),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Lh,[A[9]||(A[9]=T.createElementVNode("span",{class:"msg-label"},"Sensitivity",-1)),T.createElementVNode("span",zh,T.toDisplayString(V.value),1)])])):T.createCommentVNode("",!0),I.value&&I.value!=="Email"?(T.openBlock(),T.createElementBlock("div",$h,[T.createElementVNode("span",Vh,[T.createVNode(T.unref(Ot.Mail),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Uh,[A[10]||(A[10]=T.createElementVNode("span",{class:"msg-label"},"Type",-1)),T.createElementVNode("span",Hh,T.toDisplayString(I.value),1)])])):T.createCommentVNode("",!0),S.value.length>0?(T.openBlock(),T.createElementBlock("div",Wh,[T.createElementVNode("span",qh,[T.createVNode(T.unref(Ot.Paperclip),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Xh,[A[11]||(A[11]=T.createElementVNode("span",{class:"msg-label"},"Attachments",-1)),T.createElementVNode("div",Zh,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(S.value,(k,b)=>(T.openBlock(),T.createElementBlock("span",{key:b,class:"msg-attachment"},[T.createTextVNode(T.toDisplayString(k.fileName||k.name||"未知文件")+" ",1),z(k.contentLength)?(T.openBlock(),T.createElementBlock("span",Gh," ("+T.toDisplayString(z(k.contentLength))+") ",1)):T.createCommentVNode("",!0)]))),128))])])])):T.createCommentVNode("",!0),F.value?(T.openBlock(),T.createElementBlock("div",{key:11,class:T.normalizeClass(["msg-row",{"msg-row-bordered":S.value.length===0}])},[T.createElementVNode("span",Kh,[T.createVNode(T.unref(Ot.Hash),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Yh,[A[12]||(A[12]=T.createElementVNode("span",{class:"msg-label"},"Message-ID",-1)),T.createElementVNode("span",Jh,T.toDisplayString(F.value),1)])],2)):T.createCommentVNode("",!0),v.value&&v.value!==u.value&&v.value!==g.value?(T.openBlock(),T.createElementBlock("div",Qh,[T.createElementVNode("span",td,[T.createVNode(T.unref(Ot.Clock),{size:16,class:"msg-icon"})]),T.createElementVNode("div",ed,[A[13]||(A[13]=T.createElementVNode("span",{class:"msg-label"},"Modified",-1)),T.createElementVNode("span",rd,T.toDisplayString(v.value),1)])])):T.createCommentVNode("",!0)])]),T.createElementVNode("div",{class:"msg-body",innerHTML:R.value},null,8,nd)])]))}}),Er=(C,w)=>{const t=C.__vccOpts||C;for(const[h,d]of w)t[h]=d;return t},sd=Er(id,[["__scopeId","data-v-0e5296d9"]]),od={class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-overflow-hidden",style:{background:"#f5f5f0"}},ad={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70 vfp-text-center"},ld={class:"vfp-text-lg"},cd={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-z-10"},ud={class:"vfp-flex vfp-items-center vfp-justify-between vfp-flex-shrink-0",style:{padding:"12px 16px","border-bottom":"1px solid rgba(255,255,255,0.1)"}},fd={style:{color:"white","font-weight":"500","font-size":"14px"}},hd={class:"vfp-flex-1 vfp-overflow-y-auto",style:{padding:"8px 4px"}},dd=["title","onClick","onMouseenter","onMouseleave"],pd=["title","onClick","onMouseenter","onMouseleave"],md=794,gd=T.defineComponent({__name:"index",props:{url:{}},emits:["chapterChange","fullWidthChange"],setup(C,{expose:w,emit:t}){const h=C,{t:d}=Te(),l=t,i=T.ref(null),o=T.ref(!0),r=T.ref(null),e=T.ref(!1),n=T.ref([]),c=T.ref(!1),a=T.ref("");let s=null,f=null,p=0,u=null;const g=()=>{var E;try{(E=f==null?void 0:f.destroy)==null||E.call(f)}catch{}try{s==null||s.destroy()}catch{}f=null,s=null,p=0,u=null},m=()=>{f==null||f.prev()},v=()=>{f==null||f.next()},S=()=>{e.value=!e.value,l("fullWidthChange",e.value),setTimeout(()=>{i.value&&f&&(f.resize(i.value.offsetWidth,i.value.offsetHeight),u&&f.display(u),z())},350)},R=()=>{c.value=!c.value},I=E=>{a.value=E,f==null||f.display(E),c.value=!1},F=E=>E===a.value;w({prevPage:m,nextPage:v,toggleFullWidth:S,toggleToc:R});const j=async()=>{if(i.value){o.value=!0,r.value=null,n.value=[],c.value=!1,i.value.innerHTML="",g();try{let E=h.url;h.url.startsWith("blob:")&&(E=await(await fetch(h.url)).arrayBuffer()),s=hu(E),f=s.renderTo(i.value,{manager:"continuous",flow:"scrolled",width:"100%",height:"100%"}),f.themes.register("default",{body:{background:"#ffffff !important",color:"#1a1a1a !important","font-family":'"Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif !important',"font-size":"16px !important","line-height":"2 !important",padding:"40px 60px !important","max-width":"100% !important","box-sizing":"border-box !important","word-break":"break-word !important","overflow-wrap":"break-word !important"},p:{"text-indent":"2em !important",margin:"0.8em 0 !important"},h1:{"text-align":"center !important",margin:"1.5em 0 1em !important"},h2:{margin:"1.2em 0 0.8em !important"},h3:{margin:"1em 0 0.6em !important"},img:{"max-width":"100% !important",height:"auto !important"},a:{color:"#2563eb !important","text-decoration":"none !important"}}),f.themes.select("default"),await s.ready,s.locations.generate(1024).then(()=>{var y;if(!s)return;p=s.locations.length();const k=f==null?void 0:f.currentLocation(),b=((y=k==null?void 0:k.start)==null?void 0:y.location)??0;l("chapterChange",b+1,p)}).catch(()=>{});const A=await s.loaded.navigation;Array.isArray(A==null?void 0:A.toc)&&(n.value=A.toc),await f.display(),o.value=!1,l("chapterChange",1,p||1),f.on("relocated",k=>{var _,x,M;const b=k;if((_=b==null?void 0:b.start)!=null&&_.cfi&&(u=b.start.cfi),(x=b==null?void 0:b.start)!=null&&x.href){const B=b.start.href,P=[],H=W=>{for(const K of W){const D=K.href.split("#")[0];D&&(B===D||B.endsWith("/"+D)||B.endsWith(D))&&P.push(K.href),K.subitems&&H(K.subitems)}};H(n.value),P.length===1&&(a.value=P[0])}const y=(M=b==null?void 0:b.start)==null?void 0:M.location;typeof y=="number"&&p>0&&l("chapterChange",y+1,p)})}catch(E){console.error("EPUB 加载错误:",E),r.value=d.value("epub.load_failed"),o.value=!1}}},L=()=>{!i.value||!f||f.resize(i.value.offsetWidth,i.value.offsetHeight)};let $=null;const V=()=>{var A;if(!$)return;const E=$;if(E.scrollTop+E.clientHeight>=E.scrollHeight-200)try{const k=f==null?void 0:f.manager;(A=k==null?void 0:k.check)==null||A.call(k,500,500)}catch{}},z=()=>{$&&($.removeEventListener("scroll",V),$=null);const E=()=>{var A;$=((A=i.value)==null?void 0:A.querySelector(".epub-container"))??null,$?$.addEventListener("scroll",V,{passive:!0}):requestAnimationFrame(E)};requestAnimationFrame(E)};return T.onMounted(()=>{j(),window.addEventListener("resize",L),z()}),T.watch(()=>h.url,()=>j()),T.onBeforeUnmount(()=>{window.removeEventListener("resize",L),$==null||$.removeEventListener("scroll",V),g()}),(E,A)=>(T.openBlock(),T.createElementBlock("div",od,[r.value?(T.openBlock(),T.createElementBlock("div",ad,[T.createElementVNode("p",ld,T.toDisplayString(r.value),1)])):T.createCommentVNode("",!0),o.value&&!r.value?(T.openBlock(),T.createElementBlock("div",cd,[...A[2]||(A[2]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),n.value.length>0?(T.openBlock(),T.createElementBlock("div",{key:2,class:"vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex",style:T.normalizeStyle({opacity:c.value?1:0,pointerEvents:c.value?"auto":"none",transition:"opacity 0.3s"})},[T.createElementVNode("div",{class:"vfp-w-72 vfp-h-full vfp-flex vfp-flex-col",style:T.normalizeStyle({maxWidth:"80%",background:"rgba(0,0,0,0.9)",backdropFilter:"blur(12px)",borderRight:"1px solid rgba(255,255,255,0.1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)",transform:c.value?"translateX(0)":"translateX(-100%)",transition:"transform 0.3s ease"})},[T.createElementVNode("div",ud,[T.createElementVNode("span",fd,T.toDisplayString(T.unref(d)("toolbar.toc")),1),T.createElementVNode("button",{style:{color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer",padding:"4px"},onClick:A[0]||(A[0]=k=>c.value=!1)},[T.createVNode(T.unref(Ot.X),{style:{width:"16px",height:"16px"}})])]),T.createElementVNode("div",hd,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(n.value,(k,b)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:`${k.href}-${b}`},[T.createElementVNode("button",{style:T.normalizeStyle({width:"100%",textAlign:"left",padding:"8px 12px",fontSize:"14px",color:F(k.href)?"white":"rgba(255,255,255,0.7)",fontWeight:F(k.href)?"500":"400",background:F(k.href)?"rgba(255,255,255,0.15)":"none",border:"none",cursor:"pointer",borderRadius:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",transition:"all 0.15s"}),title:k.label,onClick:y=>I(k.href),onMouseenter:y=>!F(k.href)&&(y.target.style.background="rgba(255,255,255,0.1)"),onMouseleave:y=>!F(k.href)&&(y.target.style.background="none")},T.toDisplayString(k.label.trim()),45,dd),k.subitems&&k.subitems.length>0?(T.openBlock(!0),T.createElementBlock(T.Fragment,{key:0},T.renderList(k.subitems,(y,_)=>(T.openBlock(),T.createElementBlock("button",{key:`${y.href}-${_}`,style:T.normalizeStyle({width:"100%",textAlign:"left",padding:"8px 12px 8px 28px",fontSize:"13px",color:F(y.href)?"white":"rgba(255,255,255,0.6)",fontWeight:F(y.href)?"500":"400",background:F(y.href)?"rgba(255,255,255,0.15)":"none",border:"none",cursor:"pointer",borderRadius:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",transition:"all 0.15s"}),title:y.label,onClick:x=>I(y.href),onMouseenter:x=>!F(y.href)&&(x.target.style.background="rgba(255,255,255,0.1)"),onMouseleave:x=>!F(y.href)&&(x.target.style.background="none")},T.toDisplayString(y.label.trim()),45,pd))),128)):T.createCommentVNode("",!0)],64))),128))])],4),T.createElementVNode("div",{class:"vfp-flex-1",style:T.normalizeStyle({background:c.value?"rgba(0,0,0,0.3)":"transparent",transition:"background 0.3s"}),onClick:A[1]||(A[1]=k=>c.value=!1)},null,4)],4)):T.createCommentVNode("",!0),r.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:3,ref_key:"viewerRef",ref:i,class:"vfp-h-full vfp-bg-white",style:T.normalizeStyle({width:e.value?"100%":`${md}px`,maxWidth:"100%",transition:"width 0.3s ease",boxShadow:"0 1px 3px rgba(0,0,0,0.12)",overflow:"hidden"})},null,4))]))}}),bd=(C,w)=>C.map((t,h,d)=>w(t,h,d)?h:null).filter(t=>t!=null),Il=(C,w)=>[-1,...w,C.length].reduce(({xs:t,a:h},d)=>({xs:(t==null?void 0:t.concat([C.slice(h+1,d)]))??[],a:d}),{}).xs,vd=(C,w)=>C.slice(0,-1).concat([C[C.length-1].concat(w[0])]).concat(w.slice(1)),vo=/\d/,lo=/^epubcfi\((.*)\)$/,Aa=C=>C.replace(/[\^[\](),;=]/g,"^$&"),Bl=C=>lo.test(C)?C:`epubcfi(${C})`,yd=C=>{var w;return((w=C.match(lo))==null?void 0:w[1])??C},wd=C=>(...w)=>`epubcfi(${C(...w.map(t=>{var h;return((h=t.match(lo))==null?void 0:h[1])??t}))})`,_d=wd((...C)=>C.join("!")),xd=C=>{const w=[];let t,h,d="";const l=o=>(w.push(o),t=null,d=""),i=o=>(d+=o,h=!1);for(const o of Array.from(C.trim()).concat("")){if(o==="^"&&!h){h=!0;continue}if(t==="!")l(["!"]);else if(t===",")l([","]);else if(t==="/"||t===":")if(vo.test(o)){i(o);continue}else l([t,parseInt(d)]);else if(t==="~")if(vo.test(o)||o==="."){i(o);continue}else l(["~",parseFloat(d)]);else if(t==="@"){if(o===":"){l(["@",parseFloat(d)]),t="@";continue}if(vo.test(o)||o==="."){i(o);continue}else l(["@",parseFloat(d)])}else if(t==="["){o===";"&&!h?(l(["[",d]),t=";"):o===","&&!h?(l(["[",d]),t="["):o==="]"&&!h?l(["[",d]):i(o);continue}else if(t!=null&&t.startsWith(";")){o==="="&&!h?(t=`;${d}`,d=""):o===";"&&!h?(l([t,d]),t=";"):o==="]"&&!h?l([t,d]):i(o);continue}(o==="/"||o===":"||o==="~"||o==="@"||o==="["||o==="!"||o===",")&&(t=o)}return w},Pl=(C,w)=>bd(C,([t])=>t===w),kd=C=>{const w=[];let t;for(const[h,d]of C){if(h==="/")w.push({index:d});else{const l=w[w.length-1];if(h===":")l.offset=d;else if(h==="~")l.temporal=d;else if(h==="@")l.spatial=(l.spatial??[]).concat(d);else if(h===";s")l.side=d;else if(h==="[")if(t==="/"&&d)l.id=d;else{l.text=(l.text??[]).concat(d);continue}}t=h}return w},Ra=C=>Il(C,Pl(C,"!")).map(kd),Bi=C=>{const w=xd(yd(C)),t=Pl(w,",");if(!t.length)return Ra(w);const[h,d,l]=Il(w,t).map(Ra);return{parent:h,start:d,end:l}},Sd=({index:C,id:w,offset:t,temporal:h,spatial:d,text:l,side:i})=>{var r;const o=i?`;s=${i}`:"";return`/${C}`+(w?`[${Aa(w)}${o}]`:"")+(t!=null&&C%2?`:${t}`:"")+(h?`~${h}`:"")+(d?`@${d.join(":")}`:"")+(l||!w&&i?"["+(((r=l==null?void 0:l.map(Aa))==null?void 0:r.join(","))??"")+o+"]":"")},Fl=C=>C.parent?[C.parent,C.start,C.end].map(Fl).join(","):C.map(w=>w.map(Sd).join("")).join("!"),co=C=>Bl(Fl(C)),xi=(C,w)=>typeof C=="string"?co(xi(Bi(C),w)):C.parent?vd(C.parent,C[w?"end":"start"]):C,Ed=(C,w)=>{typeof C=="string"&&(C=Bi(C)),typeof w=="string"&&(w=Bi(w)),C=xi(C),w=xi(w,!0);const t=C[C.length-1],h=w[w.length-1],d=[],l=[],i=[];let o=!0;const r=Math.max(t.length,h.length);for(let n=0;n<r;n++){const c=t[n],a=h[n];o&&(o=(c==null?void 0:c.index)===(a==null?void 0:a.index)&&!(c!=null&&c.offset)&&!(a!=null&&a.offset)),o?d.push(c):(c&&l.push(c),a&&i.push(a))}const e=C.slice(0,-1).concat([d]);return co({parent:e,start:[l],end:[i]})},Ao=({nodeType:C})=>C===3||C===4,js=({nodeType:C})=>C===1,Dl=(C,w)=>{const t=Array.from(C.childNodes).filter(h=>Ao(h)||js(h));return w?t.map(h=>{const d=w(h);return d===NodeFilter.FILTER_REJECT?null:d===NodeFilter.FILTER_SKIP?Dl(h,w):h}).flat().filter(h=>h):t},aa=(C,w)=>{const t=Dl(C,w).reduce((h,d)=>{let l=h[h.length-1];return l?Ao(d)?Array.isArray(l)?l.push(d):Ao(l)?h[h.length-1]=[l,d]:h.push(d):js(l)?h.push(null,d):h.push(d):h.push(d),h},[]);return js(t[0])&&t.unshift("first"),js(t[t.length-1])&&t.push("last"),t.unshift("before"),t.push("after"),t},Ro=(C,w,t)=>{const{id:h}=w[w.length-1];if(h){const i=C.ownerDocument.getElementById(h);if(i)return{node:i,offset:0}}for(const{index:i}of w){const o=C?aa(C,t)[i]:null;if(o==="first")return{node:C.firstChild??C};if(o==="last")return{node:C.lastChild??C};if(o==="before")return{node:C,before:!0};if(o==="after")return{node:C,after:!0};C=o}const{offset:d}=w[w.length-1];if(!Array.isArray(C))return{node:C,offset:d};let l=0;for(const i of C){const{length:o}=i.nodeValue;if(l+o>=d)return{node:i,offset:d-l};l+=o}},Xs=(C,w,t)=>{const{parentNode:h,id:d}=C,l=aa(h,t),i=l.findIndex(e=>Array.isArray(e)?e.some(n=>n===C):e===C),o=l[i];if(Array.isArray(o)){let e=0;for(const n of o)if(n===C){e+=w;break}else e+=n.nodeValue.length;w=e}const r={id:d,index:i,offset:w};return(h!==C.ownerDocument.documentElement?Xs(h,null,t).concat(r):[r]).filter(e=>e.index!==-1)},Cd=(C,w)=>{const{startContainer:t,startOffset:h,endContainer:d,endOffset:l}=C,i=Xs(t,h,w);if(C.collapsed)return co([i]);const o=Xs(d,l,w);return Ed([i],[o])},Ll=(C,w,t)=>{const h=xi(w),d=xi(w,!0),l=C.documentElement,i=Ro(l,h[0],t),o=Ro(l,d[0],t),r=C.createRange();return i.before?r.setStartBefore(i.node):i.after?r.setStartAfter(i.node):r.setStart(i.node,i.offset),o.before?r.setEndBefore(o.node):o.after?r.setEndAfter(o.node):r.setEnd(o.node,o.offset),r},Td=C=>{const w=[],{parentNode:t}=C[0],h=Xs(t);for(const[d,l]of aa(t).entries()){const i=C[w.length];l===i&&w.push(co([h.concat({id:i.id,index:d})]))}return w},Na=(C,w)=>Ro(C.documentElement,xi(w)).node,Oa={fromIndex:C=>Bl(`/6/${(C+1)*2}`),toIndex:C=>(C==null?void 0:C.at(-1).index)/2-1},Md=C=>{let w=0;const t=h=>{if(h.id=w++,h.subitems)for(const d of h.subitems)t(d)};for(const h of C)t(h);return C},zl=C=>C.map(w=>{var t;return(t=w.subitems)!=null&&t.length?[w,zl(w.subitems)].flat():w}).flat();class ja{async init({toc:w,ids:t,splitHref:h,getFragment:d}){Md(w);const l=zl(w),i=new Map;for(const[r,e]of l.entries()){const[n,c]=await h(e==null?void 0:e.href)??[],a={fragment:c,item:e};i.has(n)?i.get(n).items.push(a):i.set(n,{prev:l[r-1],items:[a]})}const o=new Map;for(const[r,e]of t.entries())i.has(e)?o.set(e,i.get(e)):o.set(e,o.get(t[r-1]));this.ids=t,this.map=o,this.getFragment=d}getProgress(w,t){var r;if(!this.ids)return;const h=this.ids[w],d=this.map.get(h);if(!d)return null;const{prev:l,items:i}=d;if(!i)return l;if(!t||i.length===1&&!i[0].fragment)return i[0].item;const o=t.startContainer.getRootNode();for(const[e,{fragment:n}]of i.entries()){const c=this.getFragment(o,n);if(c&&t.comparePoint(c,0)>0)return((r=i[e-1])==null?void 0:r.item)??l}return i[i.length-1].item}}var ro,$l;class Ad{constructor(w,t,h){mt(this,ro);this.sizes=w.map(d=>d.linear!="no"&&d.size>0?d.size:0),this.sizePerLoc=t,this.sizePerTimeUnit=h,this.sizeTotal=this.sizes.reduce((d,l)=>d+l,0),this.sectionFractions=ht(this,ro,$l).call(this)}getProgress(w,t,h=0){const{sizes:d,sizePerLoc:l,sizePerTimeUnit:i,sizeTotal:o}=this,r=d[w]??0,n=d.slice(0,w).reduce((f,p)=>f+p,0)+t*r,c=n+h*r,a=o-n,s=(1-t)*r;return{fraction:c/o,section:{current:w,total:d.length},location:{current:Math.floor(n/l),next:Math.floor(c/l),total:Math.ceil(o/l)},time:{section:s/i,total:a/i}}}getSection(w){if(w<=0)return[0,0];if(w>=1)return[this.sizes.length-1,1];w=w+Number.EPSILON;const{sizeTotal:t}=this;let h=this.sectionFractions.findIndex(l=>l>w)-1;if(h<0)return[0,0];for(;!this.sizes[h];)h++;const d=(w-this.sectionFractions[h])/(this.sizes[h]/t);return[h,d]}}ro=new WeakSet,$l=function(){const{sizeTotal:w}=this,t=[0];let h=0;for(const d of this.sizes)t.push((h+=d)/w);return t};const Ve=C=>document.createElementNS("http://www.w3.org/2000/svg",C);var Cr,Tr,Li,_n,No,Oo;class Ia{constructor(w){mt(this,_n);mt(this,Cr,Ve("svg"));mt(this,Tr,new Map);mt(this,Li,null);gt(this,Li,w),Object.assign(Z(this,Cr).style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"})}get element(){return Z(this,Cr)}add(w,t,h,d){Z(this,Tr).has(w)&&this.remove(w),typeof t=="function"&&(t=t(Z(this,Cr).getRootNode()));const l=Z(this,_n,No);let i=[];ht(this,_n,Oo).call(this,t).forEach(r=>{const e=Array.from(r.getClientRects()).map(n=>({left:n.left*l,top:n.top*l,right:n.right*l,bottom:n.bottom*l,width:n.width*l,height:n.height*l}));i=i.concat(e)});const o=h(i,d);Z(this,Cr).append(o),Z(this,Tr).set(w,{range:t,draw:h,options:d,element:o,rects:i})}remove(w){Z(this,Tr).has(w)&&(Z(this,Cr).removeChild(Z(this,Tr).get(w).element),Z(this,Tr).delete(w))}redraw(){for(const w of Z(this,Tr).values()){const{range:t,draw:h,options:d,element:l}=w;Z(this,Cr).removeChild(l);const i=Z(this,_n,No);let o=[];ht(this,_n,Oo).call(this,t).forEach(e=>{const n=Array.from(e.getClientRects()).map(c=>({left:c.left*i,top:c.top*i,right:c.right*i,bottom:c.bottom*i,width:c.width*i,height:c.height*i}));o=o.concat(n)});const r=h(o,d);Z(this,Cr).append(r),w.element=r,w.rects=o}}hitTest({x:w,y:t}){const h=Array.from(Z(this,Tr).entries());for(let d=h.length-1;d>=0;d--){const[l,i]=h[d];for(const{left:o,top:r,right:e,bottom:n}of i.rects)if(r<=t&&o<=w&&n>t&&e>w)return[l,i.range]}return[]}static underline(w,t={}){const{color:h="red",width:d=2,padding:l=0,writingMode:i}=t,o=Ve("g");if(o.setAttribute("fill",h),i==="vertical-rl"||i==="vertical-lr")for(const{right:r,top:e,height:n}of w){const c=Ve("rect");c.setAttribute("x",r-d/2+l),c.setAttribute("y",e),c.setAttribute("height",n),c.setAttribute("width",d),o.append(c)}else for(const{left:r,bottom:e,width:n}of w){const c=Ve("rect");c.setAttribute("x",r),c.setAttribute("y",e-d/2+l),c.setAttribute("height",d),c.setAttribute("width",n),o.append(c)}return o}static strikethrough(w,t={}){const{color:h="red",width:d=2,writingMode:l}=t,i=Ve("g");if(i.setAttribute("fill",h),l==="vertical-rl"||l==="vertical-lr")for(const{right:o,left:r,top:e,height:n}of w){const c=Ve("rect");c.setAttribute("x",(o+r)/2),c.setAttribute("y",e),c.setAttribute("height",n),c.setAttribute("width",d),i.append(c)}else for(const{left:o,top:r,bottom:e,width:n}of w){const c=Ve("rect");c.setAttribute("x",o),c.setAttribute("y",(r+e)/2),c.setAttribute("height",d),c.setAttribute("width",n),i.append(c)}return i}static squiggly(w,t={}){const{color:h="red",width:d=2,padding:l=0,writingMode:i}=t,o=Ve("g");o.setAttribute("fill","none"),o.setAttribute("stroke",h),o.setAttribute("stroke-width",d);const r=d*1.5;if(i==="vertical-rl"||i==="vertical-lr")for(const{right:e,top:n,height:c}of w){const a=Ve("path"),s=Math.round(c/r/1.5),f=c/s,p=Array.from({length:s},(u,g)=>`l${g%2?-r:r} ${f}`).join("");a.setAttribute("d",`M${e-d/2+l} ${n}${p}`),o.append(a)}else for(const{left:e,bottom:n,width:c}of w){const a=Ve("path"),s=Math.round(c/r/1.5),f=c/s,p=Array.from({length:s},(u,g)=>`l${f} ${g%2?r:-r}`).join("");a.setAttribute("d",`M${e} ${n+d/2+l}${p}`),o.append(a)}return o}static highlight(w,t={}){const{color:h="red",padding:d=0}=t,l=Ve("g");l.setAttribute("fill",h),l.style.opacity="var(--overlayer-highlight-opacity, .3)",l.style.mixBlendMode="var(--overlayer-highlight-blend-mode, normal)";for(const{left:i,top:o,height:r,width:e}of w){const n=Ve("rect");n.setAttribute("x",i-d),n.setAttribute("y",o-d),n.setAttribute("height",r+d*2),n.setAttribute("width",e+d*2),l.append(n)}return l}static outline(w,t={}){const{color:h="red",width:d=3,padding:l=0,radius:i=3}=t,o=Ve("g");o.setAttribute("fill","none"),o.setAttribute("stroke",h),o.setAttribute("stroke-width",d);for(const{left:r,top:e,height:n,width:c}of w){const a=Ve("rect");a.setAttribute("x",r-l),a.setAttribute("y",e-l),a.setAttribute("height",n+l*2),a.setAttribute("width",c+l*2),a.setAttribute("rx",i),o.append(a)}return o}static copyImage([w],t={}){const{src:h}=t,d=Ve("image"),{left:l,top:i,height:o,width:r}=w;return d.setAttribute("href",h),d.setAttribute("x",l),d.setAttribute("y",i),d.setAttribute("height",o),d.setAttribute("width",r),d}}Cr=new WeakMap,Tr=new WeakMap,Li=new WeakMap,_n=new WeakSet,No=function(){return/^((?!chrome|android).)*AppleWebKit/i.test(navigator.userAgent)&&!window.chrome&&window.getComputedStyle(Z(this,Li).body).zoom||1},Oo=function(w){var l;const t=w.commonAncestorContainer,h=Array.from(((l=t.querySelectorAll)==null?void 0:l.call(t,"p"))||[]);if(h.length===0)return[w];const d=[];return h.forEach(i=>{const o=document.createRange();w.intersectsNode(i)&&(o.selectNodeContents(i),o.compareBoundaryPoints(Range.START_TO_START,w)<0&&o.setStart(w.startContainer,w.startOffset),o.compareBoundaryPoints(Range.END_TO_END,w)>0&&o.setEnd(w.endContainer,w.endOffset),d.push(o))}),d};const Rd=(C,w)=>{const t=[];for(let h=w.currentNode;h;h=w.nextNode()){const d=C.comparePoint(h,0);if(d===0)t.push(h);else if(d>0)break}return t},Nd=(C,w)=>{const t=[];for(let h=w.nextNode();h;h=w.nextNode())t.push(h);return t},Od=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_CDATA_SECTION,jd=C=>{if(C.nodeType===1){const w=C.tagName.toLowerCase();return w==="script"||w==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_ACCEPT},Ba=function*(C,w){const t=C.commonAncestorContainer??C.body??C,h=document.createTreeWalker(t,Od,{acceptNode:jd}),l=(C.commonAncestorContainer?Rd:Nd)(C,h),i=l.map(r=>r.nodeValue??""),o=(r,e,n,c)=>{const a=document.createRange();return a.setStart(l[r],e),a.setEnd(l[n],c),a};for(const r of w(i,o))yield r},Ci="foliate-search:",Id=async C=>{const w=new Uint8Array(await C.slice(0,4).arrayBuffer());return w[0]===80&&w[1]===75&&w[2]===3&&w[3]===4},Bd=({name:C,type:w})=>w==="application/vnd.comicbook+zip"||C.endsWith(".cbz"),Pd=({name:C,type:w})=>w==="application/x-fictionbook+xml"||C.endsWith(".fb2"),Fd=({name:C,type:w})=>w==="application/x-zip-compressed-fb2"||C.endsWith(".fb2.zip")||C.endsWith(".fbz"),Dd=async C=>{const{configure:w,ZipReader:t,BlobReader:h,TextWriter:d,BlobWriter:l}=await Promise.resolve().then(()=>Q1);w({useWebWorkers:!1});const o=await new t(new h(C)).getEntries(),r=new Map(o.map(s=>[s.filename,s])),e=s=>(f,...p)=>r.has(f)?s(r.get(f),...p):null,n=e(s=>s.getData(new d)),c=e((s,f)=>s.getData(new l(f)));return{entries:o,loadText:n,loadBlob:c,getSize:s=>{var f;return((f=r.get(s))==null?void 0:f.uncompressedSize)??0}}},Vl=async C=>C.isFile?C:(await Promise.all(Array.from(await new Promise((w,t)=>C.createReader().readEntries(h=>w(h),h=>t(h))),Vl))).flat(),Ld=async C=>{const w=await Vl(C),t=await Promise.all(w.map(n=>new Promise((c,a)=>n.file(s=>c([s,n.fullPath]),s=>a(s))))),h=new Map(t.map(([n,c])=>[c.replace(C.fullPath+"/",""),n])),d=new TextDecoder,l=n=>n?d.decode(n):null,i=n=>{var c;return((c=h.get(n))==null?void 0:c.arrayBuffer())??null};return{loadText:async n=>l(await i(n)),loadBlob:n=>h.get(n),getSize:n=>{var c;return((c=h.get(n))==null?void 0:c.size)??0}}};class zd extends Error{}class $d extends Error{}class Vd extends Error{}const Ud=async C=>{const w=await fetch(C);if(!w.ok)throw new zd(`${w.status} ${w.statusText}`,{cause:w});return new File([await w.blob()],new URL(w.url).pathname)},Hd=async C=>{typeof C=="string"&&(C=await Ud(C));let w;if(C.isDirectory){const t=await Ld(C),{EPUB:h}=await Promise.resolve().then(()=>cl);w=await new h(t).init()}else if(C.size)if(await Id(C)){const t=await Dd(C);if(Bd(C)){const{makeComicBook:h}=await Promise.resolve().then(()=>Sg);w=h(t,C)}else if(Fd(C)){const{makeFB2:h}=await Promise.resolve().then(()=>ul),{entries:d}=t,l=d.find(o=>o.filename.endsWith(".fb2")),i=await t.loadBlob((l??d[0]).filename);w=await h(i)}else{const{EPUB:h}=await Promise.resolve().then(()=>cl);w=await new h(t).init()}}else{const{isMOBI:t,MOBI:h}=await Promise.resolve().then(()=>ub);if(await t(C)){const d=await Promise.resolve().then(()=>xb);w=await new h({unzlib:d.unzlibSync}).open(C)}else if(Pd(C)){const{makeFB2:d}=await Promise.resolve().then(()=>ul);w=await d(C)}}else throw new $d("File not found");if(!w)throw new Vd("File type not supported");return w};var si,On,zi,or;const pa=class pa{constructor(w,t,h={}){mt(this,si);mt(this,On);mt(this,zi);mt(this,or);gt(this,On,w),gt(this,zi,t),gt(this,or,h),Z(this,or).hidden&&this.hide(),Z(this,On).addEventListener("mousemove",({screenX:d,screenY:l})=>{d===Z(this,or).x&&l===Z(this,or).y||(Z(this,or).x=d,Z(this,or).y=l,this.show(),Z(this,si)&&clearTimeout(Z(this,si)),t()&&gt(this,si,setTimeout(this.hide.bind(this),1e3)))},!1)}cloneFor(w){return new pa(w,Z(this,zi),Z(this,or))}hide(){Z(this,On).style.cursor="none",Z(this,or).hidden=!0}show(){Z(this,On).style.removeProperty("cursor"),Z(this,or).hidden=!1}};si=new WeakMap,On=new WeakMap,zi=new WeakMap,or=new WeakMap;let jo=pa;var ar,Ke;class Wd extends EventTarget{constructor(){super(...arguments);mt(this,ar,[]);mt(this,Ke,-1)}pushState(t){const h=Z(this,ar)[Z(this,Ke)];h===t||h!=null&&h.fraction&&h.fraction===t.fraction||(Z(this,ar)[++Ei(this,Ke)._]=t,Z(this,ar).length=Z(this,Ke)+1,this.dispatchEvent(new Event("index-change")))}replaceState(t){const h=Z(this,Ke);Z(this,ar)[h]=t}back(){const t=Z(this,Ke);if(t<=0)return;const h={state:Z(this,ar)[t-1]};gt(this,Ke,t-1),this.dispatchEvent(new CustomEvent("popstate",{detail:h})),this.dispatchEvent(new Event("index-change"))}forward(){const t=Z(this,Ke);if(t>=Z(this,ar).length-1)return;const h={state:Z(this,ar)[t+1]};gt(this,Ke,t+1),this.dispatchEvent(new CustomEvent("popstate",{detail:h})),this.dispatchEvent(new Event("index-change"))}get canGoBack(){return Z(this,Ke)>0}get canGoForward(){return Z(this,Ke)<Z(this,ar).length-1}clear(){gt(this,ar,[]),gt(this,Ke,-1)}}ar=new WeakMap,Ke=new WeakMap;const qd=C=>{var w,t;if(!C)return{};try{const h=Intl.getCanonicalLocales(C)[0],d=new Intl.Locale(h),l=["zh","ja","kr"].includes(d.language),i=(t=((w=d.getTextInfo)==null?void 0:w.call(d))??d.textInfo)==null?void 0:t.direction;return{canonical:h,locale:d,isCJK:l,direction:i}}catch(h){return console.warn(h),{}}};var no,Lr,vr,sn,zr,io,we,Pr,Ul,Hl,Wl,Is,ql,Xl,Zl,Tl;let Xd=(Tl=class extends HTMLElement{constructor(){super();mt(this,we);mt(this,no,this.attachShadow({mode:"closed"}));mt(this,Lr);mt(this,vr);mt(this,sn);mt(this,zr,new Map);mt(this,io,new jo(this,()=>this.hasAttribute("autohide-cursor")));De(this,"isFixedLayout",!1);De(this,"lastLocation");De(this,"history",new Wd);this.history.addEventListener("popstate",({detail:t})=>{const h=this.resolveNavigation(t.state);this.renderer.goTo(h)})}async open(t){var h,d;if((typeof t=="string"||typeof t.arrayBuffer=="function"||t.isDirectory)&&(t=await Hd(t)),this.book=t,this.language=qd((h=t.metadata)==null?void 0:h.language),t.splitTOCHref&&t.getTOCFragment){const l=t.sections.map(r=>r.id);gt(this,Lr,new Ad(t.sections,1500,1600));const i=t.splitTOCHref.bind(t),o=t.getTOCFragment.bind(t);gt(this,vr,new ja),await Z(this,vr).init({toc:t.toc??[],ids:l,splitHref:i,getFragment:o}),gt(this,sn,new ja),await Z(this,sn).init({toc:t.pageList??[],ids:l,splitHref:i,getFragment:o})}if(this.isFixedLayout=((d=this.book.rendition)==null?void 0:d.layout)==="pre-paginated",this.isFixedLayout?(await Promise.resolve().then(()=>Sb),this.renderer=document.createElement("foliate-fxl")):(await Promise.resolve().then(()=>Fb),this.renderer=document.createElement("foliate-paginator")),this.renderer.setAttribute("exportparts","head,foot,filter,container"),this.renderer.addEventListener("load",l=>ht(this,we,Hl).call(this,l.detail)),this.renderer.addEventListener("relocate",l=>ht(this,we,Ul).call(this,l.detail)),this.renderer.addEventListener("create-overlayer",l=>l.detail.attach(ht(this,we,ql).call(this,l.detail))),this.renderer.open(t),Z(this,no).append(this.renderer),t.sections.some(l=>l.mediaOverlay)){const l=t.media.activeClass,i=t.media.playbackActiveClass;this.mediaOverlay=t.getMediaOverlay();let o;this.mediaOverlay.addEventListener("highlight",r=>{const e=this.resolveNavigation(r.detail.text);this.renderer.goTo(e).then(()=>{const{doc:n}=this.renderer.getContents().find(a=>a.index=e.index),c=e.anchor(n);c.classList.add(l),i&&c.ownerDocument.documentElement.classList.add(i),o=new WeakRef(c)})}),this.mediaOverlay.addEventListener("unhighlight",()=>{const r=o==null?void 0:o.deref();r&&(r.classList.remove(l),i&&r.ownerDocument.documentElement.classList.remove(i))})}}close(){var t,h;(t=this.renderer)==null||t.destroy(),(h=this.renderer)==null||h.remove(),gt(this,Lr,null),gt(this,vr,null),gt(this,sn,null),gt(this,zr,new Map),this.lastLocation=null,this.history.clear(),this.tts=null,this.mediaOverlay=null}goToTextStart(){var t,h;return this.goTo(((h=(t=this.book.landmarks)==null?void 0:t.find(d=>d.type.includes("bodymatter")||d.type.includes("text")))==null?void 0:h.href)??this.book.sections.findIndex(d=>d.linear!=="no"))}async init({lastLocation:t,showTextStart:h}){const d=t?this.resolveNavigation(t):null;d?(await this.renderer.goTo(d),this.history.pushState(t)):h?await this.goToTextStart():(this.history.pushState(0),await this.next())}async addAnnotation(t,h){var e;const{value:d}=t;if(d.startsWith(Ci)){const n=d.replace(Ci,""),{index:c,anchor:a}=await this.resolveNavigation(n),s=ht(this,we,Is).call(this,c);if(s){const{overlayer:f,doc:p}=s;if(h){f.remove(d);return}const u=p?a(p):a;f.add(d,u,Ia.outline)}return}const{index:l,anchor:i}=await this.resolveNavigation(d),o=ht(this,we,Is).call(this,l);if(o){const{overlayer:n,doc:c}=o;if(n.remove(d),!h){const a=c?i(c):i,s=(f,p)=>n.add(d,a,f,p);ht(this,we,Pr).call(this,"draw-annotation",{draw:s,annotation:t,doc:c,range:a})}}const r=((e=Z(this,vr).getProgress(l))==null?void 0:e.label)??"";return{index:l,label:r}}deleteAnnotation(t){return this.addAnnotation(t,!0)}async showAnnotation(t){const{value:h}=t,d=await this.goTo(h);if(d){const{index:l,anchor:i}=d,{doc:o}=ht(this,we,Is).call(this,l),r=i(o);ht(this,we,Pr).call(this,"show-annotation",{value:h,index:l,range:r})}}getCFI(t,h){const d=this.book.sections[t].cfi??Oa.fromIndex(t);return h?_d(d,Cd(h)):d}resolveCFI(t){if(this.book.resolveCFI)return this.book.resolveCFI(t);{const h=Bi(t);return{index:Oa.toIndex((h.parent??h).shift()),anchor:i=>Ll(i,h)}}}resolveNavigation(t){try{if(typeof t=="number")return{index:t};if(typeof t.fraction=="number"){const[h,d]=Z(this,Lr).getSection(t.fraction);return{index:h,anchor:d}}return lo.test(t)?this.resolveCFI(t):this.book.resolveHref(t)}catch(h){console.error(h),console.error(`Could not resolve target ${t}`)}}async goTo(t){const h=this.resolveNavigation(t);try{return await this.renderer.goTo(h),this.history.pushState(t),h}catch(d){console.error(d),console.error(`Could not go to ${t}`)}}async goToFraction(t){const[h,d]=Z(this,Lr).getSection(t);await this.renderer.goTo({index:h,anchor:d}),this.history.pushState({fraction:t})}async select(t){try{const h=await this.resolveNavigation(t);await this.renderer.goTo({...h,select:!0}),this.history.pushState(t)}catch(h){console.error(h),console.error(`Could not go to ${t}`)}}deselect(){for(const{doc:t}of this.renderer.getContents())t.defaultView.getSelection().removeAllRanges()}getSectionFractions(){var t;return(((t=Z(this,Lr))==null?void 0:t.sectionFractions)??[]).map(h=>h+Number.EPSILON)}getProgressOf(t,h){var i,o;const d=(i=Z(this,vr))==null?void 0:i.getProgress(t,h),l=(o=Z(this,sn))==null?void 0:o.getProgress(t,h);return{tocItem:d,pageItem:l}}async getTOCItemOf(t){try{const{index:h,anchor:d}=await this.resolveNavigation(t),l=await this.book.sections[h].createDocument(),i=d(l),o=i instanceof Range,r=o?i:l.createRange();return o||r.selectNodeContents(i),Z(this,vr).getProgress(h,r)}catch(h){console.error(h),console.error(`Could not get ${t}`)}}async prev(t){await this.renderer.prev(t)}async next(t){await this.renderer.next(t)}goLeft(){return this.book.dir==="rtl"?this.next():this.prev()}goRight(){return this.book.dir==="rtl"?this.prev():this.next()}async*search(t){var e;this.clearSearch();const{searchMatcher:h}=await Promise.resolve().then(()=>$b),{query:d,index:l}=t,i=h(Ba,{defaultLocale:this.language,...t}),o=l!=null?ht(this,we,Xl).call(this,i,d,l):ht(this,we,Zl).call(this,i,d),r=[];Z(this,zr).set(l,r);for await(const n of o)if(n.subitems){const c=n.subitems.map(({cfi:a})=>({value:Ci+a}));Z(this,zr).set(n.index,c);for(const a of c)this.addAnnotation(a);yield{label:((e=Z(this,vr).getProgress(n.index))==null?void 0:e.label)??"",subitems:n.subitems}}else{if(n.cfi){const c={value:Ci+n.cfi};r.push(c),this.addAnnotation(c)}yield n}yield"done"}clearSearch(){for(const t of Z(this,zr).values())for(const h of t)this.deleteAnnotation(h);Z(this,zr).clear()}async initTTS(t="word"){const h=this.renderer.getContents()[0].doc;if(this.tts&&this.tts.doc===h)return;const{TTS:d}=await Promise.resolve().then(()=>Gb);this.tts=new d(h,Ba,l=>this.renderer.scrollToAnchor(l,!0),t)}startMediaOverlay(){const{index:t}=this.renderer.getContents()[0];return this.mediaOverlay.start(t)}},no=new WeakMap,Lr=new WeakMap,vr=new WeakMap,sn=new WeakMap,zr=new WeakMap,io=new WeakMap,we=new WeakSet,Pr=function(t,h,d){return this.dispatchEvent(new CustomEvent(t,{detail:h,cancelable:d}))},Ul=function({reason:t,range:h,index:d,fraction:l,size:i}){var c,a,s;const o=((c=Z(this,Lr))==null?void 0:c.getProgress(d,l,i))??{},r=(a=Z(this,vr))==null?void 0:a.getProgress(d,h),e=(s=Z(this,sn))==null?void 0:s.getProgress(d,h),n=this.getCFI(d,h);this.lastLocation={...o,tocItem:r,pageItem:e,cfi:n,range:h},(t==="snap"||t==="page"||t==="scroll")&&this.history.replaceState(n),ht(this,we,Pr).call(this,"relocate",this.lastLocation)},Hl=function({doc:t,index:h}){var d,l;(d=t.documentElement).lang||(d.lang=this.language.canonical??""),this.language.isCJK||(l=t.documentElement).dir||(l.dir=this.language.direction??""),ht(this,we,Wl).call(this,t,h),Z(this,io).cloneFor(t.documentElement),ht(this,we,Pr).call(this,"load",{doc:t,index:h})},Wl=function(t,h){const{book:d}=this,l=d.sections[h];t.addEventListener("click",i=>{var n,c;const o=i.target.closest("a[href]");if(!o)return;i.preventDefault();const r=o.getAttribute("href"),e=((n=l==null?void 0:l.resolveHref)==null?void 0:n.call(l,r))??r;(c=d==null?void 0:d.isExternal)!=null&&c.call(d,e)?Promise.resolve(ht(this,we,Pr).call(this,"external-link",{a:o,href:e},!0)).then(a=>a?globalThis.open(e,"_blank"):null).catch(a=>console.error(a)):Promise.resolve(ht(this,we,Pr).call(this,"link",{a:o,href:e},!0)).then(a=>a?this.goTo(e):null).catch(a=>console.error(a))})},Is=function(t){return this.renderer.getContents().find(h=>h.index===t&&h.overlayer)},ql=function({doc:t,index:h}){const d=new Ia(t);t.addEventListener("click",i=>{const[o,r]=d.hitTest(i);o&&!o.startsWith(Ci)&&ht(this,we,Pr).call(this,"show-annotation",{value:o,index:h,range:r})},!1);const l=Z(this,zr).get(h);if(l)for(const i of l)this.addAnnotation(i);return ht(this,we,Pr).call(this,"create-overlay",{index:h}),d},Xl=async function*(t,h,d){const l=await this.book.sections[d].createDocument();for(const{range:i,excerpt:o}of t(l,h))yield{cfi:this.getCFI(d,i),excerpt:o}},Zl=async function*(t,h){const{sections:d}=this.book;for(const[l,{createDocument:i}]of d.entries()){if(!i)continue;const o=await i(),r=Array.from(t(o,h),({range:n,excerpt:c})=>({cfi:this.getCFI(l,n),excerpt:c}));yield{progress:(l+1)/d.length},r.length&&(yield{index:l,subitems:r})}},Tl);customElements.define("foliate-view",Xd);const Zd={class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-overflow-hidden",style:{background:"#f5f5f0"}},Gd={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70 vfp-text-center vfp-p-6"},Kd={class:"vfp-text-lg"},Yd={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-z-10"},Jd={class:"vfp-flex vfp-items-center vfp-justify-between vfp-px-4 vfp-py-3 vfp-border-b vfp-border-white/10 vfp-flex-shrink-0"},Qd={class:"vfp-text-white vfp-font-medium vfp-text-sm"},tp={class:"vfp-flex-1 vfp-overflow-y-auto vfp-py-4 vfp-px-1"},Gl=T.defineComponent({name:"MobiTocList",props:{items:{type:Array,required:!0},activeHref:{type:String,default:""},depth:{type:Number,default:0}},emits:["select"],render(){return T.h("ul",{style:{listStyle:"none",padding:0,margin:this.depth>0?"0 0 0 16px":0}},this.items.map((C,w)=>{var t,h,d;return T.h("li",{key:`${C.href??C.label}-${w}`},[C.href?T.h("button",{onClick:()=>this.$emit("select",C.href),class:["vfp-w-full vfp-text-left vfp-py-2 vfp-px-3 vfp-text-sm vfp-rounded vfp-transition-all vfp-truncate",this.activeHref===C.href?"vfp-text-white vfp-bg-white/15 vfp-font-medium":"vfp-text-white/70 hover:vfp-text-white hover:vfp-bg-white/10"],title:C.label,style:"background: none; border: none; cursor: pointer"},(t=C.label)==null?void 0:t.trim()):T.h("div",{class:"vfp-w-full vfp-py-2 vfp-px-3 vfp-text-sm vfp-text-white/50 vfp-truncate"},(h=C.label)==null?void 0:h.trim()),(d=C.subitems)!=null&&d.length?T.h(Gl,{items:C.subitems,activeHref:this.activeHref,depth:this.depth+1,onSelect:l=>this.$emit("select",l)}):null])}))}}),ep={name:"MobiRenderer"},rp=T.defineComponent({...ep,props:{url:{}},emits:["chapterChange","fullWidthChange"],setup(C,{expose:w,emit:t}){const h=`
74
+ */function l(i){return i>=65&&i<=90||i===95||i>=97&&i<=122||i>=192&&i<=214||i>=216&&i<=246||i>=248&&i<=767||i>=880&&i<=893||i>=895&&i<=8191||i>=8204&&i<=8205||i>=8304&&i<=8591||i>=11264&&i<=12271||i>=12289&&i<=55295||i>=63744&&i<=64975||i>=65008&&i<=65533||i>=65536&&i<=983039}Object.defineProperty(d,"__esModule",{value:!0}),d.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",d.NC_NAME_CHAR="-"+d.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",d.NC_NAME_START_CHAR_RE=new RegExp("^["+d.NC_NAME_START_CHAR+"]$","u"),d.NC_NAME_CHAR_RE=new RegExp("^["+d.NC_NAME_CHAR+"]$","u"),d.NC_NAME_RE=new RegExp("^["+d.NC_NAME_START_CHAR+"]["+d.NC_NAME_CHAR+"]*$","u"),d.isNCNameStartChar=l,d.isNCNameChar=function(i){return l(i)||i===45||i===46||i>=48&&i<=57||i===183||i>=768&&i<=879||i>=8255&&i<=8256}},{}]},{},[15])(15)})})(Il);var Mf=Il.exports;const Af=Tf(Mf),Rf={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},Nf={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Of={class:"vfp-text-center"},jf={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},If={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Bf={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},Pf={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-green-500 vfp-via-emerald-500 vfp-to-teal-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},Ff={class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"},Df={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},Lf=["href"],zf=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(null);let i=null,o=null,r=null,e={width:0,height:0};const n=()=>{if(!l.value)return{width:800,height:600};const s=l.value.clientWidth,f=l.value.clientHeight,p=s>100?s:800,u=f>100?f:600;return{width:p,height:u}},c=()=>{if(!l.value||!i)return;l.value.innerHTML="";const{width:s,height:f}=n(),p=s<640;new Ml(l.value,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:p?80:100,indexWidth:p?40:60,minWidth:p?40:60},view:{height:()=>f,width:()=>s}}).loadData(i)},a=async()=>{if(l.value){h.value=!0,d.value=null;try{const s=await fetch(w.url,{mode:"cors",credentials:"omit",redirect:"follow"});if(!s.ok)throw s.status===404?new Error(t.value("xlsx.not_found")):s.status===403?new Error("无权限访问此文件"):new Error(`文件加载失败 (${s.status})`);const f=await s.arrayBuffer();if(f.byteLength===0)throw new Error("文件为空");const p=new Af.Workbook;await p.xlsx.load(f),i=Wu(p),c(),h.value=!1}catch(s){console.error("Excel 解析错误:",s);let f=t.value("xlsx.parse_failed");s instanceof Error&&(f=s.message),d.value=f,h.value=!1}}};return T.onMounted(()=>{if(!l.value)return;let s=!0;o=new ResizeObserver(()=>{if(s){s=!1,e=n();return}const f=n(),p=Math.abs(e.width-f.width),u=Math.abs(e.height-f.height);p<10&&u<10||(e=f,r!==null&&clearTimeout(r),r=window.setTimeout(()=>{i&&c()},500))}),o.observe(l.value),setTimeout(()=>{requestAnimationFrame(()=>a())},100)}),T.watch(()=>w.url,()=>{a()}),T.onBeforeUnmount(()=>{o&&o.disconnect(),r!==null&&clearTimeout(r),i=null,l.value&&(l.value.innerHTML="")}),(s,f)=>(T.openBlock(),T.createElementBlock("div",Rf,[h.value?(T.openBlock(),T.createElementBlock("div",Nf,[T.createElementVNode("div",Of,[f[0]||(f[0]=T.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",jf,T.toDisplayString(T.unref(t)("xlsx.loading")),1)])])):T.createCommentVNode("",!0),d.value&&!h.value?(T.openBlock(),T.createElementBlock("div",If,[T.createElementVNode("div",Bf,[T.createElementVNode("div",Pf,[T.createVNode(T.unref(Ot.FileSpreadsheet),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),T.createElementVNode("p",Ff,T.toDisplayString(T.unref(t)("xlsx.load_failed")),1),T.createElementVNode("p",Df,T.toDisplayString(d.value),1),T.createElementVNode("a",{href:C.url,download:"",class:"vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-white vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"}," 下载文件 ",8,Lf),f[1]||(f[1]=T.createElementVNode("p",{class:"vfp-text-xs vfp-text-white/40 vfp-mt-3 md:vfp-mt-4"},"提示:可以使用 Microsoft Excel 或 WPS 打开",-1))])])):T.createCommentVNode("",!0),d.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:2,ref_key:"containerRef",ref:l,class:"xlsx-spreadsheet-container vfp-w-full vfp-h-full",style:T.normalizeStyle({opacity:h.value?0:1})},null,4))]))}}),$f={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},Vf={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},Uf={class:"vfp-text-center"},Hf={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},Wf={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},qf={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},Xf={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-orange-500 vfp-via-red-500 vfp-to-pink-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},Zf={class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"},Gf={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},Kf=["href"],Yf=T.defineComponent({__name:"index",props:{url:{},tiled:{type:Boolean,default:!0}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(0),i=T.ref(null);let o=null,r=null,e=null,n=null,c={width:0,height:0};const a=()=>{var v;if(!i.value)return{width:960,height:540};const p=i.value.clientWidth,u=((v=i.value.parentElement)==null?void 0:v.clientWidth)||0,g=p>100?p:u>100?u:300,m=Math.floor(g*9/16);return{width:g,height:m}},s=async()=>{if(!(!i.value||!e||l.value===0))try{if(o)try{o.destroy()}catch{}i.value.innerHTML="";const p=a();o=mo.init(i.value,{width:p.width,height:w.tiled?p.height*l.value:p.height,mode:w.tiled?"list":"slide"}),await o.preview(e)}catch{}},f=async()=>{if(!i.value)return;h.value=!0,d.value=null;let p=window.setTimeout(()=>{d.value=t.value("pptx.timeout"),h.value=!1},3e4);try{const u=await fetch(w.url,{mode:"cors",credentials:"omit",redirect:"follow"});if(!u.ok)throw u.status===404?new Error(t.value("pptx.not_found")):u.status===403?new Error("无权限访问此文件"):u.status>=500?new Error("服务器错误,请稍后重试"):new Error(`文件加载失败 (${u.status})`);const g=await u.arrayBuffer();if(g.byteLength===0)throw new Error("文件为空");e=g;const m=document.createElement("div");m.style.cssText="position:absolute;left:-9999px;top:-9999px;visibility:hidden",document.body.appendChild(m);try{const v=mo.init(m,{width:100,height:100,mode:"slide"});try{await v.preview(g)}catch{throw new Error(t.value("pptx.invalid_format"))}const S=v.slideCount;if(!S||S===0)throw new Error(t.value("pptx.no_pages"));v.destroy(),l.value=S,i.value&&(i.value.innerHTML="");const R=a();o=mo.init(i.value,{width:R.width,height:w.tiled?R.height*S:R.height,mode:w.tiled?"list":"slide"}),await o.preview(g),p!==null&&(clearTimeout(p),p=null),h.value=!1}finally{document.body.contains(m)&&document.body.removeChild(m)}}catch(u){p!==null&&clearTimeout(p);let g=t.value("pptx.parse_failed");u instanceof Error?g=u.message:typeof u=="string"&&(g=u),d.value=g,h.value=!1}};return T.onMounted(()=>{if(!i.value)return;let p=!0;r=new ResizeObserver(()=>{if(p){p=!1,c=a();return}const u=a(),g=Math.abs(c.width-u.width),m=Math.abs(c.height-u.height);g<10&&m<10||(c=u,n!==null&&clearTimeout(n),n=window.setTimeout(()=>{o&&e&&s()},800))}),r.observe(i.value),setTimeout(()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>f()))},150)}),T.watch(()=>w.url,()=>{f()}),T.onBeforeUnmount(()=>{if(r&&r.disconnect(),n!==null&&clearTimeout(n),e=null,l.value=0,o)try{o.destroy()}catch{}o=null}),(p,u)=>(T.openBlock(),T.createElementBlock("div",$f,[h.value?(T.openBlock(),T.createElementBlock("div",Vf,[T.createElementVNode("div",Uf,[u[0]||(u[0]=T.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",Hf,T.toDisplayString(T.unref(t)("pptx.loading")),1)])])):T.createCommentVNode("",!0),d.value&&!h.value?(T.openBlock(),T.createElementBlock("div",Wf,[T.createElementVNode("div",qf,[T.createElementVNode("div",Xf,[T.createVNode(T.unref(Ot.Presentation),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),T.createElementVNode("p",Zf,T.toDisplayString(T.unref(t)("pptx.load_failed")),1),T.createElementVNode("p",Gf,T.toDisplayString(d.value),1),T.createElementVNode("a",{href:C.url,download:"",class:"vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-white vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"}," 下载文件 ",8,Kf),u[1]||(u[1]=T.createElementVNode("p",{class:"vfp-text-xs vfp-text-white/40 vfp-mt-3 md:vfp-mt-4"}," 提示:可以使用 Microsoft PowerPoint 或 WPS 打开 ",-1))])])):T.createCommentVNode("",!0),d.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:2,ref_key:"containerRef",ref:i,class:"pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",style:T.normalizeStyle({opacity:h.value?0:1})},null,4))]))}}),Jf={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Qf={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},th={class:"vfp-text-white/70 vfp-text-center"},eh={class:"vfp-text-lg"},rh={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"rgba(0, 0, 0, 0.15)"}},nh={class:"msg-container"},ih={class:"msg-header"},sh={class:"msg-subject"},oh={class:"msg-meta"},ah={key:0,class:"msg-row"},lh={class:"msg-icon-wrap"},ch={class:"msg-row-content"},uh={class:"msg-value"},fh={key:1,class:"msg-row"},hh={class:"msg-icon-wrap"},dh={class:"msg-row-content"},ph={class:"msg-value"},mh={key:2,class:"msg-row"},gh={class:"msg-icon-wrap"},bh={class:"msg-row-content"},vh={class:"msg-value"},yh={key:3,class:"msg-row"},wh={class:"msg-icon-wrap"},_h={class:"msg-row-content"},xh={class:"msg-value"},kh={key:4,class:"msg-row"},Sh={class:"msg-icon-wrap"},Eh={class:"msg-row-content"},Ch={class:"msg-value"},Th={key:5,class:"msg-row"},Mh={class:"msg-icon-wrap"},Ah={class:"msg-row-content"},Rh={class:"msg-value"},Nh={key:6,class:"msg-row"},Oh={class:"msg-icon-wrap"},jh={class:"msg-row-content"},Ih={class:"msg-value"},Bh={key:7,class:"msg-row"},Ph={class:"msg-icon-wrap"},Fh={class:"msg-row-content"},Dh={key:8,class:"msg-row"},Lh={class:"msg-icon-wrap"},zh={class:"msg-row-content"},$h={class:"msg-value"},Vh={key:9,class:"msg-row"},Uh={class:"msg-icon-wrap"},Hh={class:"msg-row-content"},Wh={class:"msg-value"},qh={key:10,class:"msg-row msg-row-bordered"},Xh={class:"msg-icon-wrap"},Zh={class:"msg-row-content"},Gh={class:"msg-value msg-attachments"},Kh={key:0,class:"msg-attachment-size"},Yh={class:"msg-icon-wrap"},Jh={class:"msg-row-content"},Qh={class:"msg-value msg-id"},td={key:12,class:"msg-row"},ed={class:"msg-icon-wrap"},rd={class:"msg-row-content"},nd={class:"msg-value msg-id"},id=["innerHTML"],sd=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(null);function i(E,A){return E?E.filter(k=>k.recipType===A).map(k=>{const b=k.name||"",y=k.smtpAddress||k.email||"";return b&&y&&b!==y?`${b} <${y}>`:b||y}).filter(Boolean).join("; "):""}function o(E){if(!E)return"";try{const A=new Date(E);return isNaN(A.getTime())?E:A.toLocaleString()}catch{return E}}function r(E,A){if(E.bodyHtml)return E.bodyHtml;if(E.html)try{return new TextDecoder("utf-8").decode(E.html)}catch{}return E.body?`<pre style="white-space: pre-wrap; word-wrap: break-word; font-family: system-ui, sans-serif;">${E.body.replace(/&/g,"&amp;").replace(/\x3c/g,"&lt;").replace(/>/g,"&gt;")}</pre>`:`<p style="color: #999;">${A}</p>`}function e(E){return E?{"IPM.Note":"Email","IPM.Note.SMIME":"Encrypted Email","IPM.Note.SMIME.MultipartSigned":"Signed Email","IPM.Appointment":"Appointment","IPM.Schedule.Meeting.Request":"Meeting Request","IPM.Schedule.Meeting.Canceled":"Meeting Cancellation","IPM.Contact":"Contact","IPM.Task":"Task","IPM.StickyNote":"Sticky Note"}[E]||E:""}const n=async()=>{h.value=!0,d.value=null,l.value=null;try{const E=await fetch(w.url);if(!E.ok)throw new Error("文件加载失败");const A=await E.arrayBuffer(),k=new fu(A);l.value=k.getFileData()}catch(E){console.error("MSG 解析错误:",E),d.value=t.value("msg.parse_failed")}finally{h.value=!1}};T.watch(()=>w.url,n,{immediate:!0});const c=T.computed(()=>{var E;return((E=l.value)==null?void 0:E.subject)||"(无主题)"}),a=T.computed(()=>{if(!l.value)return"";const E=l.value.senderName||"",A=l.value.senderSmtpAddress||l.value.senderEmail||"";return E&&A&&E!==A?`${E} <${A}>`:E||A}),s=T.computed(()=>{var E;return i((E=l.value)==null?void 0:E.recipients,"to")}),f=T.computed(()=>{var E;return i((E=l.value)==null?void 0:E.recipients,"cc")}),p=T.computed(()=>{var E;return i((E=l.value)==null?void 0:E.recipients,"bcc")}),u=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.clientSubmitTime)}),g=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.messageDeliveryTime)}),m=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.creationTime)}),v=T.computed(()=>{var E;return o((E=l.value)==null?void 0:E.lastModificationTime)}),S=T.computed(()=>{var E;return(((E=l.value)==null?void 0:E.attachments)||[]).filter(A=>!A.attachmentHidden)}),R=T.computed(()=>l.value?r(l.value,t.value("msg.empty_body")):""),I=T.computed(()=>{var E;return e((E=l.value)==null?void 0:E.messageClass)}),F=T.computed(()=>{var E;return((E=l.value)==null?void 0:E.messageId)||""}),j=T.computed(()=>{const E=l.value;return E&&typeof E.importance=="number"?E.importance:void 0}),L=T.computed(()=>j.value===2?"High":j.value===0?"Low":""),$=T.computed(()=>{const E=l.value;return E&&typeof E.sensitivity=="number"?E.sensitivity:void 0}),V=T.computed(()=>$.value===void 0||$.value===0?"":{1:"Personal",2:"Private",3:"Confidential"}[$.value]||""),z=E=>E?E>1048576?`${(E/1048576).toFixed(1)} MB`:E>1024?`${(E/1024).toFixed(0)} KB`:`${E} B`:"";return(E,A)=>h.value?(T.openBlock(),T.createElementBlock("div",Jf,[...A[0]||(A[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):d.value||!l.value?(T.openBlock(),T.createElementBlock("div",Qf,[T.createElementVNode("div",th,[T.createElementVNode("p",eh,T.toDisplayString(d.value||T.unref(t)("msg.parse_failed_short")),1)])])):(T.openBlock(),T.createElementBlock("div",rh,[T.createElementVNode("div",nh,[T.createElementVNode("div",ih,[T.createElementVNode("h2",sh,T.toDisplayString(c.value),1),T.createElementVNode("div",oh,[a.value?(T.openBlock(),T.createElementBlock("div",ah,[T.createElementVNode("span",lh,[T.createVNode(T.unref(Ot.User),{size:16,class:"msg-icon"})]),T.createElementVNode("div",ch,[A[1]||(A[1]=T.createElementVNode("span",{class:"msg-label"},"From",-1)),T.createElementVNode("span",uh,T.toDisplayString(a.value),1)])])):T.createCommentVNode("",!0),s.value?(T.openBlock(),T.createElementBlock("div",fh,[T.createElementVNode("span",hh,[T.createVNode(T.unref(Ot.Users),{size:16,class:"msg-icon"})]),T.createElementVNode("div",dh,[A[2]||(A[2]=T.createElementVNode("span",{class:"msg-label"},"To",-1)),T.createElementVNode("span",ph,T.toDisplayString(s.value),1)])])):T.createCommentVNode("",!0),f.value?(T.openBlock(),T.createElementBlock("div",mh,[T.createElementVNode("span",gh,[T.createVNode(T.unref(Ot.Users),{size:16,class:"msg-icon"})]),T.createElementVNode("div",bh,[A[3]||(A[3]=T.createElementVNode("span",{class:"msg-label"},"Cc",-1)),T.createElementVNode("span",vh,T.toDisplayString(f.value),1)])])):T.createCommentVNode("",!0),p.value?(T.openBlock(),T.createElementBlock("div",yh,[T.createElementVNode("span",wh,[T.createVNode(T.unref(Ot.Users),{size:16,class:"msg-icon"})]),T.createElementVNode("div",_h,[A[4]||(A[4]=T.createElementVNode("span",{class:"msg-label"},"Bcc",-1)),T.createElementVNode("span",xh,T.toDisplayString(p.value),1)])])):T.createCommentVNode("",!0),u.value?(T.openBlock(),T.createElementBlock("div",kh,[T.createElementVNode("span",Sh,[T.createVNode(T.unref(Ot.Calendar),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Eh,[A[5]||(A[5]=T.createElementVNode("span",{class:"msg-label"},"Sent",-1)),T.createElementVNode("span",Ch,T.toDisplayString(u.value),1)])])):T.createCommentVNode("",!0),g.value&&g.value!==u.value?(T.openBlock(),T.createElementBlock("div",Th,[T.createElementVNode("span",Mh,[T.createVNode(T.unref(Ot.Clock),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Ah,[A[6]||(A[6]=T.createElementVNode("span",{class:"msg-label"},"Received",-1)),T.createElementVNode("span",Rh,T.toDisplayString(g.value),1)])])):T.createCommentVNode("",!0),!u.value&&!g.value&&m.value?(T.openBlock(),T.createElementBlock("div",Nh,[T.createElementVNode("span",Oh,[T.createVNode(T.unref(Ot.Calendar),{size:16,class:"msg-icon"})]),T.createElementVNode("div",jh,[A[7]||(A[7]=T.createElementVNode("span",{class:"msg-label"},"Date",-1)),T.createElementVNode("span",Ih,T.toDisplayString(m.value),1)])])):T.createCommentVNode("",!0),L.value?(T.openBlock(),T.createElementBlock("div",Bh,[T.createElementVNode("span",Ph,[T.createVNode(T.unref(Ot.Tag),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Fh,[A[8]||(A[8]=T.createElementVNode("span",{class:"msg-label"},"Importance",-1)),T.createElementVNode("span",{class:"msg-value",style:T.normalizeStyle({color:j.value===2?"#dc2626":"#2563eb",fontWeight:500})},T.toDisplayString(L.value),5)])])):T.createCommentVNode("",!0),V.value?(T.openBlock(),T.createElementBlock("div",Dh,[T.createElementVNode("span",Lh,[T.createVNode(T.unref(Ot.Tag),{size:16,class:"msg-icon"})]),T.createElementVNode("div",zh,[A[9]||(A[9]=T.createElementVNode("span",{class:"msg-label"},"Sensitivity",-1)),T.createElementVNode("span",$h,T.toDisplayString(V.value),1)])])):T.createCommentVNode("",!0),I.value&&I.value!=="Email"?(T.openBlock(),T.createElementBlock("div",Vh,[T.createElementVNode("span",Uh,[T.createVNode(T.unref(Ot.Mail),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Hh,[A[10]||(A[10]=T.createElementVNode("span",{class:"msg-label"},"Type",-1)),T.createElementVNode("span",Wh,T.toDisplayString(I.value),1)])])):T.createCommentVNode("",!0),S.value.length>0?(T.openBlock(),T.createElementBlock("div",qh,[T.createElementVNode("span",Xh,[T.createVNode(T.unref(Ot.Paperclip),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Zh,[A[11]||(A[11]=T.createElementVNode("span",{class:"msg-label"},"Attachments",-1)),T.createElementVNode("div",Gh,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(S.value,(k,b)=>(T.openBlock(),T.createElementBlock("span",{key:b,class:"msg-attachment"},[T.createTextVNode(T.toDisplayString(k.fileName||k.name||"未知文件")+" ",1),z(k.contentLength)?(T.openBlock(),T.createElementBlock("span",Kh," ("+T.toDisplayString(z(k.contentLength))+") ",1)):T.createCommentVNode("",!0)]))),128))])])])):T.createCommentVNode("",!0),F.value?(T.openBlock(),T.createElementBlock("div",{key:11,class:T.normalizeClass(["msg-row",{"msg-row-bordered":S.value.length===0}])},[T.createElementVNode("span",Yh,[T.createVNode(T.unref(Ot.Hash),{size:16,class:"msg-icon"})]),T.createElementVNode("div",Jh,[A[12]||(A[12]=T.createElementVNode("span",{class:"msg-label"},"Message-ID",-1)),T.createElementVNode("span",Qh,T.toDisplayString(F.value),1)])],2)):T.createCommentVNode("",!0),v.value&&v.value!==u.value&&v.value!==g.value?(T.openBlock(),T.createElementBlock("div",td,[T.createElementVNode("span",ed,[T.createVNode(T.unref(Ot.Clock),{size:16,class:"msg-icon"})]),T.createElementVNode("div",rd,[A[13]||(A[13]=T.createElementVNode("span",{class:"msg-label"},"Modified",-1)),T.createElementVNode("span",nd,T.toDisplayString(v.value),1)])])):T.createCommentVNode("",!0)])]),T.createElementVNode("div",{class:"msg-body",innerHTML:R.value},null,8,id)])]))}}),Ir=(C,w)=>{const t=C.__vccOpts||C;for(const[h,d]of w)t[h]=d;return t},od=Ir(sd,[["__scopeId","data-v-0e5296d9"]]),ad={class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-overflow-hidden",style:{background:"#f5f5f0"}},ld={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70 vfp-text-center"},cd={class:"vfp-text-lg"},ud={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-z-10"},fd={class:"vfp-flex vfp-items-center vfp-justify-between vfp-flex-shrink-0",style:{padding:"12px 16px","border-bottom":"1px solid rgba(255,255,255,0.1)"}},hd={style:{color:"white","font-weight":"500","font-size":"14px"}},dd={class:"vfp-flex-1 vfp-overflow-y-auto",style:{padding:"8px 4px"}},pd=["title","onClick","onMouseenter","onMouseleave"],md=["title","onClick","onMouseenter","onMouseleave"],gd=794,bd=T.defineComponent({__name:"index",props:{url:{}},emits:["chapterChange","fullWidthChange"],setup(C,{expose:w,emit:t}){const h=C,{t:d}=Te(),l=t,i=T.ref(null),o=T.ref(!0),r=T.ref(null),e=T.ref(!1),n=T.ref([]),c=T.ref(!1),a=T.ref("");let s=null,f=null,p=0,u=null;const g=()=>{var E;try{(E=f==null?void 0:f.destroy)==null||E.call(f)}catch{}try{s==null||s.destroy()}catch{}f=null,s=null,p=0,u=null},m=()=>{f==null||f.prev()},v=()=>{f==null||f.next()},S=()=>{e.value=!e.value,l("fullWidthChange",e.value),setTimeout(()=>{i.value&&f&&(f.resize(i.value.offsetWidth,i.value.offsetHeight),u&&f.display(u),z())},350)},R=()=>{c.value=!c.value},I=E=>{a.value=E,f==null||f.display(E),c.value=!1},F=E=>E===a.value;w({prevPage:m,nextPage:v,toggleFullWidth:S,toggleToc:R});const j=async()=>{if(i.value){o.value=!0,r.value=null,n.value=[],c.value=!1,i.value.innerHTML="",g();try{let E=h.url;h.url.startsWith("blob:")&&(E=await(await fetch(h.url)).arrayBuffer()),s=hu(E),f=s.renderTo(i.value,{manager:"continuous",flow:"scrolled",width:"100%",height:"100%"}),f.themes.register("default",{body:{background:"#ffffff !important",color:"#1a1a1a !important","font-family":'"Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif !important',"font-size":"16px !important","line-height":"2 !important",padding:"40px 60px !important","max-width":"100% !important","box-sizing":"border-box !important","word-break":"break-word !important","overflow-wrap":"break-word !important"},p:{"text-indent":"2em !important",margin:"0.8em 0 !important"},h1:{"text-align":"center !important",margin:"1.5em 0 1em !important"},h2:{margin:"1.2em 0 0.8em !important"},h3:{margin:"1em 0 0.6em !important"},img:{"max-width":"100% !important",height:"auto !important"},a:{color:"#2563eb !important","text-decoration":"none !important"}}),f.themes.select("default"),await s.ready,s.locations.generate(1024).then(()=>{var y;if(!s)return;p=s.locations.length();const k=f==null?void 0:f.currentLocation(),b=((y=k==null?void 0:k.start)==null?void 0:y.location)??0;l("chapterChange",b+1,p)}).catch(()=>{});const A=await s.loaded.navigation;Array.isArray(A==null?void 0:A.toc)&&(n.value=A.toc),await f.display(),o.value=!1,l("chapterChange",1,p||1),f.on("relocated",k=>{var _,x,M;const b=k;if((_=b==null?void 0:b.start)!=null&&_.cfi&&(u=b.start.cfi),(x=b==null?void 0:b.start)!=null&&x.href){const B=b.start.href,P=[],H=W=>{for(const K of W){const D=K.href.split("#")[0];D&&(B===D||B.endsWith("/"+D)||B.endsWith(D))&&P.push(K.href),K.subitems&&H(K.subitems)}};H(n.value),P.length===1&&(a.value=P[0])}const y=(M=b==null?void 0:b.start)==null?void 0:M.location;typeof y=="number"&&p>0&&l("chapterChange",y+1,p)})}catch(E){console.error("EPUB 加载错误:",E),r.value=d.value("epub.load_failed"),o.value=!1}}},L=()=>{!i.value||!f||f.resize(i.value.offsetWidth,i.value.offsetHeight)};let $=null;const V=()=>{var A;if(!$)return;const E=$;if(E.scrollTop+E.clientHeight>=E.scrollHeight-200)try{const k=f==null?void 0:f.manager;(A=k==null?void 0:k.check)==null||A.call(k,500,500)}catch{}},z=()=>{$&&($.removeEventListener("scroll",V),$=null);const E=()=>{var A;$=((A=i.value)==null?void 0:A.querySelector(".epub-container"))??null,$?$.addEventListener("scroll",V,{passive:!0}):requestAnimationFrame(E)};requestAnimationFrame(E)};return T.onMounted(()=>{j(),window.addEventListener("resize",L),z()}),T.watch(()=>h.url,()=>j()),T.onBeforeUnmount(()=>{window.removeEventListener("resize",L),$==null||$.removeEventListener("scroll",V),g()}),(E,A)=>(T.openBlock(),T.createElementBlock("div",ad,[r.value?(T.openBlock(),T.createElementBlock("div",ld,[T.createElementVNode("p",cd,T.toDisplayString(r.value),1)])):T.createCommentVNode("",!0),o.value&&!r.value?(T.openBlock(),T.createElementBlock("div",ud,[...A[2]||(A[2]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),n.value.length>0?(T.openBlock(),T.createElementBlock("div",{key:2,class:"vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex",style:T.normalizeStyle({opacity:c.value?1:0,pointerEvents:c.value?"auto":"none",transition:"opacity 0.3s"})},[T.createElementVNode("div",{class:"vfp-w-72 vfp-h-full vfp-flex vfp-flex-col",style:T.normalizeStyle({maxWidth:"80%",background:"rgba(0,0,0,0.9)",backdropFilter:"blur(12px)",borderRight:"1px solid rgba(255,255,255,0.1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)",transform:c.value?"translateX(0)":"translateX(-100%)",transition:"transform 0.3s ease"})},[T.createElementVNode("div",fd,[T.createElementVNode("span",hd,T.toDisplayString(T.unref(d)("toolbar.toc")),1),T.createElementVNode("button",{style:{color:"rgba(255,255,255,0.6)",background:"none",border:"none",cursor:"pointer",padding:"4px"},onClick:A[0]||(A[0]=k=>c.value=!1)},[T.createVNode(T.unref(Ot.X),{style:{width:"16px",height:"16px"}})])]),T.createElementVNode("div",dd,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(n.value,(k,b)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:`${k.href}-${b}`},[T.createElementVNode("button",{style:T.normalizeStyle({width:"100%",textAlign:"left",padding:"8px 12px",fontSize:"14px",color:F(k.href)?"white":"rgba(255,255,255,0.7)",fontWeight:F(k.href)?"500":"400",background:F(k.href)?"rgba(255,255,255,0.15)":"none",border:"none",cursor:"pointer",borderRadius:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",transition:"all 0.15s"}),title:k.label,onClick:y=>I(k.href),onMouseenter:y=>!F(k.href)&&(y.target.style.background="rgba(255,255,255,0.1)"),onMouseleave:y=>!F(k.href)&&(y.target.style.background="none")},T.toDisplayString(k.label.trim()),45,pd),k.subitems&&k.subitems.length>0?(T.openBlock(!0),T.createElementBlock(T.Fragment,{key:0},T.renderList(k.subitems,(y,_)=>(T.openBlock(),T.createElementBlock("button",{key:`${y.href}-${_}`,style:T.normalizeStyle({width:"100%",textAlign:"left",padding:"8px 12px 8px 28px",fontSize:"13px",color:F(y.href)?"white":"rgba(255,255,255,0.6)",fontWeight:F(y.href)?"500":"400",background:F(y.href)?"rgba(255,255,255,0.15)":"none",border:"none",cursor:"pointer",borderRadius:"4px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",transition:"all 0.15s"}),title:y.label,onClick:x=>I(y.href),onMouseenter:x=>!F(y.href)&&(x.target.style.background="rgba(255,255,255,0.1)"),onMouseleave:x=>!F(y.href)&&(x.target.style.background="none")},T.toDisplayString(y.label.trim()),45,md))),128)):T.createCommentVNode("",!0)],64))),128))])],4),T.createElementVNode("div",{class:"vfp-flex-1",style:T.normalizeStyle({background:c.value?"rgba(0,0,0,0.3)":"transparent",transition:"background 0.3s"}),onClick:A[1]||(A[1]=k=>c.value=!1)},null,4)],4)):T.createCommentVNode("",!0),r.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:3,ref_key:"viewerRef",ref:i,class:"vfp-h-full vfp-bg-white",style:T.normalizeStyle({width:e.value?"100%":`${gd}px`,maxWidth:"100%",transition:"width 0.3s ease",boxShadow:"0 1px 3px rgba(0,0,0,0.12)",overflow:"hidden"})},null,4))]))}}),vd=(C,w)=>C.map((t,h,d)=>w(t,h,d)?h:null).filter(t=>t!=null),Bl=(C,w)=>[-1,...w,C.length].reduce(({xs:t,a:h},d)=>({xs:(t==null?void 0:t.concat([C.slice(h+1,d)]))??[],a:d}),{}).xs,yd=(C,w)=>C.slice(0,-1).concat([C[C.length-1].concat(w[0])]).concat(w.slice(1)),vo=/\d/,lo=/^epubcfi\((.*)\)$/,Aa=C=>C.replace(/[\^[\](),;=]/g,"^$&"),Pl=C=>lo.test(C)?C:`epubcfi(${C})`,wd=C=>{var w;return((w=C.match(lo))==null?void 0:w[1])??C},_d=C=>(...w)=>`epubcfi(${C(...w.map(t=>{var h;return((h=t.match(lo))==null?void 0:h[1])??t}))})`,xd=_d((...C)=>C.join("!")),kd=C=>{const w=[];let t,h,d="";const l=o=>(w.push(o),t=null,d=""),i=o=>(d+=o,h=!1);for(const o of Array.from(C.trim()).concat("")){if(o==="^"&&!h){h=!0;continue}if(t==="!")l(["!"]);else if(t===",")l([","]);else if(t==="/"||t===":")if(vo.test(o)){i(o);continue}else l([t,parseInt(d)]);else if(t==="~")if(vo.test(o)||o==="."){i(o);continue}else l(["~",parseFloat(d)]);else if(t==="@"){if(o===":"){l(["@",parseFloat(d)]),t="@";continue}if(vo.test(o)||o==="."){i(o);continue}else l(["@",parseFloat(d)])}else if(t==="["){o===";"&&!h?(l(["[",d]),t=";"):o===","&&!h?(l(["[",d]),t="["):o==="]"&&!h?l(["[",d]):i(o);continue}else if(t!=null&&t.startsWith(";")){o==="="&&!h?(t=`;${d}`,d=""):o===";"&&!h?(l([t,d]),t=";"):o==="]"&&!h?l([t,d]):i(o);continue}(o==="/"||o===":"||o==="~"||o==="@"||o==="["||o==="!"||o===",")&&(t=o)}return w},Fl=(C,w)=>vd(C,([t])=>t===w),Sd=C=>{const w=[];let t;for(const[h,d]of C){if(h==="/")w.push({index:d});else{const l=w[w.length-1];if(h===":")l.offset=d;else if(h==="~")l.temporal=d;else if(h==="@")l.spatial=(l.spatial??[]).concat(d);else if(h===";s")l.side=d;else if(h==="[")if(t==="/"&&d)l.id=d;else{l.text=(l.text??[]).concat(d);continue}}t=h}return w},Ra=C=>Bl(C,Fl(C,"!")).map(Sd),Bi=C=>{const w=kd(wd(C)),t=Fl(w,",");if(!t.length)return Ra(w);const[h,d,l]=Bl(w,t).map(Ra);return{parent:h,start:d,end:l}},Ed=({index:C,id:w,offset:t,temporal:h,spatial:d,text:l,side:i})=>{var r;const o=i?`;s=${i}`:"";return`/${C}`+(w?`[${Aa(w)}${o}]`:"")+(t!=null&&C%2?`:${t}`:"")+(h?`~${h}`:"")+(d?`@${d.join(":")}`:"")+(l||!w&&i?"["+(((r=l==null?void 0:l.map(Aa))==null?void 0:r.join(","))??"")+o+"]":"")},Dl=C=>C.parent?[C.parent,C.start,C.end].map(Dl).join(","):C.map(w=>w.map(Ed).join("")).join("!"),co=C=>Pl(Dl(C)),xi=(C,w)=>typeof C=="string"?co(xi(Bi(C),w)):C.parent?yd(C.parent,C[w?"end":"start"]):C,Cd=(C,w)=>{typeof C=="string"&&(C=Bi(C)),typeof w=="string"&&(w=Bi(w)),C=xi(C),w=xi(w,!0);const t=C[C.length-1],h=w[w.length-1],d=[],l=[],i=[];let o=!0;const r=Math.max(t.length,h.length);for(let n=0;n<r;n++){const c=t[n],a=h[n];o&&(o=(c==null?void 0:c.index)===(a==null?void 0:a.index)&&!(c!=null&&c.offset)&&!(a!=null&&a.offset)),o?d.push(c):(c&&l.push(c),a&&i.push(a))}const e=C.slice(0,-1).concat([d]);return co({parent:e,start:[l],end:[i]})},Ao=({nodeType:C})=>C===3||C===4,js=({nodeType:C})=>C===1,Ll=(C,w)=>{const t=Array.from(C.childNodes).filter(h=>Ao(h)||js(h));return w?t.map(h=>{const d=w(h);return d===NodeFilter.FILTER_REJECT?null:d===NodeFilter.FILTER_SKIP?Ll(h,w):h}).flat().filter(h=>h):t},aa=(C,w)=>{const t=Ll(C,w).reduce((h,d)=>{let l=h[h.length-1];return l?Ao(d)?Array.isArray(l)?l.push(d):Ao(l)?h[h.length-1]=[l,d]:h.push(d):js(l)?h.push(null,d):h.push(d):h.push(d),h},[]);return js(t[0])&&t.unshift("first"),js(t[t.length-1])&&t.push("last"),t.unshift("before"),t.push("after"),t},Ro=(C,w,t)=>{const{id:h}=w[w.length-1];if(h){const i=C.ownerDocument.getElementById(h);if(i)return{node:i,offset:0}}for(const{index:i}of w){const o=C?aa(C,t)[i]:null;if(o==="first")return{node:C.firstChild??C};if(o==="last")return{node:C.lastChild??C};if(o==="before")return{node:C,before:!0};if(o==="after")return{node:C,after:!0};C=o}const{offset:d}=w[w.length-1];if(!Array.isArray(C))return{node:C,offset:d};let l=0;for(const i of C){const{length:o}=i.nodeValue;if(l+o>=d)return{node:i,offset:d-l};l+=o}},Xs=(C,w,t)=>{const{parentNode:h,id:d}=C,l=aa(h,t),i=l.findIndex(e=>Array.isArray(e)?e.some(n=>n===C):e===C),o=l[i];if(Array.isArray(o)){let e=0;for(const n of o)if(n===C){e+=w;break}else e+=n.nodeValue.length;w=e}const r={id:d,index:i,offset:w};return(h!==C.ownerDocument.documentElement?Xs(h,null,t).concat(r):[r]).filter(e=>e.index!==-1)},Td=(C,w)=>{const{startContainer:t,startOffset:h,endContainer:d,endOffset:l}=C,i=Xs(t,h,w);if(C.collapsed)return co([i]);const o=Xs(d,l,w);return Cd([i],[o])},zl=(C,w,t)=>{const h=xi(w),d=xi(w,!0),l=C.documentElement,i=Ro(l,h[0],t),o=Ro(l,d[0],t),r=C.createRange();return i.before?r.setStartBefore(i.node):i.after?r.setStartAfter(i.node):r.setStart(i.node,i.offset),o.before?r.setEndBefore(o.node):o.after?r.setEndAfter(o.node):r.setEnd(o.node,o.offset),r},Md=C=>{const w=[],{parentNode:t}=C[0],h=Xs(t);for(const[d,l]of aa(t).entries()){const i=C[w.length];l===i&&w.push(co([h.concat({id:i.id,index:d})]))}return w},Na=(C,w)=>Ro(C.documentElement,xi(w)).node,Oa={fromIndex:C=>Pl(`/6/${(C+1)*2}`),toIndex:C=>(C==null?void 0:C.at(-1).index)/2-1},Ad=C=>{let w=0;const t=h=>{if(h.id=w++,h.subitems)for(const d of h.subitems)t(d)};for(const h of C)t(h);return C},$l=C=>C.map(w=>{var t;return(t=w.subitems)!=null&&t.length?[w,$l(w.subitems)].flat():w}).flat();class ja{async init({toc:w,ids:t,splitHref:h,getFragment:d}){Ad(w);const l=$l(w),i=new Map;for(const[r,e]of l.entries()){const[n,c]=await h(e==null?void 0:e.href)??[],a={fragment:c,item:e};i.has(n)?i.get(n).items.push(a):i.set(n,{prev:l[r-1],items:[a]})}const o=new Map;for(const[r,e]of t.entries())i.has(e)?o.set(e,i.get(e)):o.set(e,o.get(t[r-1]));this.ids=t,this.map=o,this.getFragment=d}getProgress(w,t){var r;if(!this.ids)return;const h=this.ids[w],d=this.map.get(h);if(!d)return null;const{prev:l,items:i}=d;if(!i)return l;if(!t||i.length===1&&!i[0].fragment)return i[0].item;const o=t.startContainer.getRootNode();for(const[e,{fragment:n}]of i.entries()){const c=this.getFragment(o,n);if(c&&t.comparePoint(c,0)>0)return((r=i[e-1])==null?void 0:r.item)??l}return i[i.length-1].item}}var ro,Vl;class Rd{constructor(w,t,h){mt(this,ro);this.sizes=w.map(d=>d.linear!="no"&&d.size>0?d.size:0),this.sizePerLoc=t,this.sizePerTimeUnit=h,this.sizeTotal=this.sizes.reduce((d,l)=>d+l,0),this.sectionFractions=ht(this,ro,Vl).call(this)}getProgress(w,t,h=0){const{sizes:d,sizePerLoc:l,sizePerTimeUnit:i,sizeTotal:o}=this,r=d[w]??0,n=d.slice(0,w).reduce((f,p)=>f+p,0)+t*r,c=n+h*r,a=o-n,s=(1-t)*r;return{fraction:c/o,section:{current:w,total:d.length},location:{current:Math.floor(n/l),next:Math.floor(c/l),total:Math.ceil(o/l)},time:{section:s/i,total:a/i}}}getSection(w){if(w<=0)return[0,0];if(w>=1)return[this.sizes.length-1,1];w=w+Number.EPSILON;const{sizeTotal:t}=this;let h=this.sectionFractions.findIndex(l=>l>w)-1;if(h<0)return[0,0];for(;!this.sizes[h];)h++;const d=(w-this.sectionFractions[h])/(this.sizes[h]/t);return[h,d]}}ro=new WeakSet,Vl=function(){const{sizeTotal:w}=this,t=[0];let h=0;for(const d of this.sizes)t.push((h+=d)/w);return t};const Ve=C=>document.createElementNS("http://www.w3.org/2000/svg",C);var Er,Cr,Li,_n,No,Oo;class Ia{constructor(w){mt(this,_n);mt(this,Er,Ve("svg"));mt(this,Cr,new Map);mt(this,Li,null);gt(this,Li,w),Object.assign(Z(this,Er).style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"})}get element(){return Z(this,Er)}add(w,t,h,d){Z(this,Cr).has(w)&&this.remove(w),typeof t=="function"&&(t=t(Z(this,Er).getRootNode()));const l=Z(this,_n,No);let i=[];ht(this,_n,Oo).call(this,t).forEach(r=>{const e=Array.from(r.getClientRects()).map(n=>({left:n.left*l,top:n.top*l,right:n.right*l,bottom:n.bottom*l,width:n.width*l,height:n.height*l}));i=i.concat(e)});const o=h(i,d);Z(this,Er).append(o),Z(this,Cr).set(w,{range:t,draw:h,options:d,element:o,rects:i})}remove(w){Z(this,Cr).has(w)&&(Z(this,Er).removeChild(Z(this,Cr).get(w).element),Z(this,Cr).delete(w))}redraw(){for(const w of Z(this,Cr).values()){const{range:t,draw:h,options:d,element:l}=w;Z(this,Er).removeChild(l);const i=Z(this,_n,No);let o=[];ht(this,_n,Oo).call(this,t).forEach(e=>{const n=Array.from(e.getClientRects()).map(c=>({left:c.left*i,top:c.top*i,right:c.right*i,bottom:c.bottom*i,width:c.width*i,height:c.height*i}));o=o.concat(n)});const r=h(o,d);Z(this,Er).append(r),w.element=r,w.rects=o}}hitTest({x:w,y:t}){const h=Array.from(Z(this,Cr).entries());for(let d=h.length-1;d>=0;d--){const[l,i]=h[d];for(const{left:o,top:r,right:e,bottom:n}of i.rects)if(r<=t&&o<=w&&n>t&&e>w)return[l,i.range]}return[]}static underline(w,t={}){const{color:h="red",width:d=2,padding:l=0,writingMode:i}=t,o=Ve("g");if(o.setAttribute("fill",h),i==="vertical-rl"||i==="vertical-lr")for(const{right:r,top:e,height:n}of w){const c=Ve("rect");c.setAttribute("x",r-d/2+l),c.setAttribute("y",e),c.setAttribute("height",n),c.setAttribute("width",d),o.append(c)}else for(const{left:r,bottom:e,width:n}of w){const c=Ve("rect");c.setAttribute("x",r),c.setAttribute("y",e-d/2+l),c.setAttribute("height",d),c.setAttribute("width",n),o.append(c)}return o}static strikethrough(w,t={}){const{color:h="red",width:d=2,writingMode:l}=t,i=Ve("g");if(i.setAttribute("fill",h),l==="vertical-rl"||l==="vertical-lr")for(const{right:o,left:r,top:e,height:n}of w){const c=Ve("rect");c.setAttribute("x",(o+r)/2),c.setAttribute("y",e),c.setAttribute("height",n),c.setAttribute("width",d),i.append(c)}else for(const{left:o,top:r,bottom:e,width:n}of w){const c=Ve("rect");c.setAttribute("x",o),c.setAttribute("y",(r+e)/2),c.setAttribute("height",d),c.setAttribute("width",n),i.append(c)}return i}static squiggly(w,t={}){const{color:h="red",width:d=2,padding:l=0,writingMode:i}=t,o=Ve("g");o.setAttribute("fill","none"),o.setAttribute("stroke",h),o.setAttribute("stroke-width",d);const r=d*1.5;if(i==="vertical-rl"||i==="vertical-lr")for(const{right:e,top:n,height:c}of w){const a=Ve("path"),s=Math.round(c/r/1.5),f=c/s,p=Array.from({length:s},(u,g)=>`l${g%2?-r:r} ${f}`).join("");a.setAttribute("d",`M${e-d/2+l} ${n}${p}`),o.append(a)}else for(const{left:e,bottom:n,width:c}of w){const a=Ve("path"),s=Math.round(c/r/1.5),f=c/s,p=Array.from({length:s},(u,g)=>`l${f} ${g%2?r:-r}`).join("");a.setAttribute("d",`M${e} ${n+d/2+l}${p}`),o.append(a)}return o}static highlight(w,t={}){const{color:h="red",padding:d=0}=t,l=Ve("g");l.setAttribute("fill",h),l.style.opacity="var(--overlayer-highlight-opacity, .3)",l.style.mixBlendMode="var(--overlayer-highlight-blend-mode, normal)";for(const{left:i,top:o,height:r,width:e}of w){const n=Ve("rect");n.setAttribute("x",i-d),n.setAttribute("y",o-d),n.setAttribute("height",r+d*2),n.setAttribute("width",e+d*2),l.append(n)}return l}static outline(w,t={}){const{color:h="red",width:d=3,padding:l=0,radius:i=3}=t,o=Ve("g");o.setAttribute("fill","none"),o.setAttribute("stroke",h),o.setAttribute("stroke-width",d);for(const{left:r,top:e,height:n,width:c}of w){const a=Ve("rect");a.setAttribute("x",r-l),a.setAttribute("y",e-l),a.setAttribute("height",n+l*2),a.setAttribute("width",c+l*2),a.setAttribute("rx",i),o.append(a)}return o}static copyImage([w],t={}){const{src:h}=t,d=Ve("image"),{left:l,top:i,height:o,width:r}=w;return d.setAttribute("href",h),d.setAttribute("x",l),d.setAttribute("y",i),d.setAttribute("height",o),d.setAttribute("width",r),d}}Er=new WeakMap,Cr=new WeakMap,Li=new WeakMap,_n=new WeakSet,No=function(){return/^((?!chrome|android).)*AppleWebKit/i.test(navigator.userAgent)&&!window.chrome&&window.getComputedStyle(Z(this,Li).body).zoom||1},Oo=function(w){var l;const t=w.commonAncestorContainer,h=Array.from(((l=t.querySelectorAll)==null?void 0:l.call(t,"p"))||[]);if(h.length===0)return[w];const d=[];return h.forEach(i=>{const o=document.createRange();w.intersectsNode(i)&&(o.selectNodeContents(i),o.compareBoundaryPoints(Range.START_TO_START,w)<0&&o.setStart(w.startContainer,w.startOffset),o.compareBoundaryPoints(Range.END_TO_END,w)>0&&o.setEnd(w.endContainer,w.endOffset),d.push(o))}),d};const Nd=(C,w)=>{const t=[];for(let h=w.currentNode;h;h=w.nextNode()){const d=C.comparePoint(h,0);if(d===0)t.push(h);else if(d>0)break}return t},Od=(C,w)=>{const t=[];for(let h=w.nextNode();h;h=w.nextNode())t.push(h);return t},jd=NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_CDATA_SECTION,Id=C=>{if(C.nodeType===1){const w=C.tagName.toLowerCase();return w==="script"||w==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_ACCEPT},Ba=function*(C,w){const t=C.commonAncestorContainer??C.body??C,h=document.createTreeWalker(t,jd,{acceptNode:Id}),l=(C.commonAncestorContainer?Nd:Od)(C,h),i=l.map(r=>r.nodeValue??""),o=(r,e,n,c)=>{const a=document.createRange();return a.setStart(l[r],e),a.setEnd(l[n],c),a};for(const r of w(i,o))yield r},Ci="foliate-search:",Bd=async C=>{const w=new Uint8Array(await C.slice(0,4).arrayBuffer());return w[0]===80&&w[1]===75&&w[2]===3&&w[3]===4},Pd=({name:C,type:w})=>w==="application/vnd.comicbook+zip"||C.endsWith(".cbz"),Fd=({name:C,type:w})=>w==="application/x-fictionbook+xml"||C.endsWith(".fb2"),Dd=({name:C,type:w})=>w==="application/x-zip-compressed-fb2"||C.endsWith(".fb2.zip")||C.endsWith(".fbz"),Ld=async C=>{const{configure:w,ZipReader:t,BlobReader:h,TextWriter:d,BlobWriter:l}=await Promise.resolve().then(()=>q1);w({useWebWorkers:!1});const o=await new t(new h(C)).getEntries(),r=new Map(o.map(s=>[s.filename,s])),e=s=>(f,...p)=>r.has(f)?s(r.get(f),...p):null,n=e(s=>s.getData(new d)),c=e((s,f)=>s.getData(new l(f)));return{entries:o,loadText:n,loadBlob:c,getSize:s=>{var f;return((f=r.get(s))==null?void 0:f.uncompressedSize)??0}}},Ul=async C=>C.isFile?C:(await Promise.all(Array.from(await new Promise((w,t)=>C.createReader().readEntries(h=>w(h),h=>t(h))),Ul))).flat(),zd=async C=>{const w=await Ul(C),t=await Promise.all(w.map(n=>new Promise((c,a)=>n.file(s=>c([s,n.fullPath]),s=>a(s))))),h=new Map(t.map(([n,c])=>[c.replace(C.fullPath+"/",""),n])),d=new TextDecoder,l=n=>n?d.decode(n):null,i=n=>{var c;return((c=h.get(n))==null?void 0:c.arrayBuffer())??null};return{loadText:async n=>l(await i(n)),loadBlob:n=>h.get(n),getSize:n=>{var c;return((c=h.get(n))==null?void 0:c.size)??0}}};class $d extends Error{}class Vd extends Error{}class Ud extends Error{}const Hd=async C=>{const w=await fetch(C);if(!w.ok)throw new $d(`${w.status} ${w.statusText}`,{cause:w});return new File([await w.blob()],new URL(w.url).pathname)},Wd=async C=>{typeof C=="string"&&(C=await Hd(C));let w;if(C.isDirectory){const t=await zd(C),{EPUB:h}=await Promise.resolve().then(()=>cl);w=await new h(t).init()}else if(C.size)if(await Bd(C)){const t=await Ld(C);if(Pd(C)){const{makeComicBook:h}=await Promise.resolve().then(()=>bg);w=h(t,C)}else if(Dd(C)){const{makeFB2:h}=await Promise.resolve().then(()=>ul),{entries:d}=t,l=d.find(o=>o.filename.endsWith(".fb2")),i=await t.loadBlob((l??d[0]).filename);w=await h(i)}else{const{EPUB:h}=await Promise.resolve().then(()=>cl);w=await new h(t).init()}}else{const{isMOBI:t,MOBI:h}=await Promise.resolve().then(()=>nb);if(await t(C)){const d=await Promise.resolve().then(()=>mb);w=await new h({unzlib:d.unzlibSync}).open(C)}else if(Fd(C)){const{makeFB2:d}=await Promise.resolve().then(()=>ul);w=await d(C)}}else throw new Vd("File not found");if(!w)throw new Ud("File type not supported");return w};var si,On,zi,or;const pa=class pa{constructor(w,t,h={}){mt(this,si);mt(this,On);mt(this,zi);mt(this,or);gt(this,On,w),gt(this,zi,t),gt(this,or,h),Z(this,or).hidden&&this.hide(),Z(this,On).addEventListener("mousemove",({screenX:d,screenY:l})=>{d===Z(this,or).x&&l===Z(this,or).y||(Z(this,or).x=d,Z(this,or).y=l,this.show(),Z(this,si)&&clearTimeout(Z(this,si)),t()&&gt(this,si,setTimeout(this.hide.bind(this),1e3)))},!1)}cloneFor(w){return new pa(w,Z(this,zi),Z(this,or))}hide(){Z(this,On).style.cursor="none",Z(this,or).hidden=!0}show(){Z(this,On).style.removeProperty("cursor"),Z(this,or).hidden=!1}};si=new WeakMap,On=new WeakMap,zi=new WeakMap,or=new WeakMap;let jo=pa;var ar,Ke;class qd extends EventTarget{constructor(){super(...arguments);mt(this,ar,[]);mt(this,Ke,-1)}pushState(t){const h=Z(this,ar)[Z(this,Ke)];h===t||h!=null&&h.fraction&&h.fraction===t.fraction||(Z(this,ar)[++Ei(this,Ke)._]=t,Z(this,ar).length=Z(this,Ke)+1,this.dispatchEvent(new Event("index-change")))}replaceState(t){const h=Z(this,Ke);Z(this,ar)[h]=t}back(){const t=Z(this,Ke);if(t<=0)return;const h={state:Z(this,ar)[t-1]};gt(this,Ke,t-1),this.dispatchEvent(new CustomEvent("popstate",{detail:h})),this.dispatchEvent(new Event("index-change"))}forward(){const t=Z(this,Ke);if(t>=Z(this,ar).length-1)return;const h={state:Z(this,ar)[t+1]};gt(this,Ke,t+1),this.dispatchEvent(new CustomEvent("popstate",{detail:h})),this.dispatchEvent(new Event("index-change"))}get canGoBack(){return Z(this,Ke)>0}get canGoForward(){return Z(this,Ke)<Z(this,ar).length-1}clear(){gt(this,ar,[]),gt(this,Ke,-1)}}ar=new WeakMap,Ke=new WeakMap;const Xd=C=>{var w,t;if(!C)return{};try{const h=Intl.getCanonicalLocales(C)[0],d=new Intl.Locale(h),l=["zh","ja","kr"].includes(d.language),i=(t=((w=d.getTextInfo)==null?void 0:w.call(d))??d.textInfo)==null?void 0:t.direction;return{canonical:h,locale:d,isCJK:l,direction:i}}catch(h){return console.warn(h),{}}};var no,Lr,vr,sn,zr,io,we,Pr,Hl,Wl,ql,Is,Xl,Zl,Gl,Tl;let Zd=(Tl=class extends HTMLElement{constructor(){super();mt(this,we);mt(this,no,this.attachShadow({mode:"closed"}));mt(this,Lr);mt(this,vr);mt(this,sn);mt(this,zr,new Map);mt(this,io,new jo(this,()=>this.hasAttribute("autohide-cursor")));De(this,"isFixedLayout",!1);De(this,"lastLocation");De(this,"history",new qd);this.history.addEventListener("popstate",({detail:t})=>{const h=this.resolveNavigation(t.state);this.renderer.goTo(h)})}async open(t){var h,d;if((typeof t=="string"||typeof t.arrayBuffer=="function"||t.isDirectory)&&(t=await Wd(t)),this.book=t,this.language=Xd((h=t.metadata)==null?void 0:h.language),t.splitTOCHref&&t.getTOCFragment){const l=t.sections.map(r=>r.id);gt(this,Lr,new Rd(t.sections,1500,1600));const i=t.splitTOCHref.bind(t),o=t.getTOCFragment.bind(t);gt(this,vr,new ja),await Z(this,vr).init({toc:t.toc??[],ids:l,splitHref:i,getFragment:o}),gt(this,sn,new ja),await Z(this,sn).init({toc:t.pageList??[],ids:l,splitHref:i,getFragment:o})}if(this.isFixedLayout=((d=this.book.rendition)==null?void 0:d.layout)==="pre-paginated",this.isFixedLayout?(await Promise.resolve().then(()=>bb),this.renderer=document.createElement("foliate-fxl")):(await Promise.resolve().then(()=>Rb),this.renderer=document.createElement("foliate-paginator")),this.renderer.setAttribute("exportparts","head,foot,filter,container"),this.renderer.addEventListener("load",l=>ht(this,we,Wl).call(this,l.detail)),this.renderer.addEventListener("relocate",l=>ht(this,we,Hl).call(this,l.detail)),this.renderer.addEventListener("create-overlayer",l=>l.detail.attach(ht(this,we,Xl).call(this,l.detail))),this.renderer.open(t),Z(this,no).append(this.renderer),t.sections.some(l=>l.mediaOverlay)){const l=t.media.activeClass,i=t.media.playbackActiveClass;this.mediaOverlay=t.getMediaOverlay();let o;this.mediaOverlay.addEventListener("highlight",r=>{const e=this.resolveNavigation(r.detail.text);this.renderer.goTo(e).then(()=>{const{doc:n}=this.renderer.getContents().find(a=>a.index=e.index),c=e.anchor(n);c.classList.add(l),i&&c.ownerDocument.documentElement.classList.add(i),o=new WeakRef(c)})}),this.mediaOverlay.addEventListener("unhighlight",()=>{const r=o==null?void 0:o.deref();r&&(r.classList.remove(l),i&&r.ownerDocument.documentElement.classList.remove(i))})}}close(){var t,h;(t=this.renderer)==null||t.destroy(),(h=this.renderer)==null||h.remove(),gt(this,Lr,null),gt(this,vr,null),gt(this,sn,null),gt(this,zr,new Map),this.lastLocation=null,this.history.clear(),this.tts=null,this.mediaOverlay=null}goToTextStart(){var t,h;return this.goTo(((h=(t=this.book.landmarks)==null?void 0:t.find(d=>d.type.includes("bodymatter")||d.type.includes("text")))==null?void 0:h.href)??this.book.sections.findIndex(d=>d.linear!=="no"))}async init({lastLocation:t,showTextStart:h}){const d=t?this.resolveNavigation(t):null;d?(await this.renderer.goTo(d),this.history.pushState(t)):h?await this.goToTextStart():(this.history.pushState(0),await this.next())}async addAnnotation(t,h){var e;const{value:d}=t;if(d.startsWith(Ci)){const n=d.replace(Ci,""),{index:c,anchor:a}=await this.resolveNavigation(n),s=ht(this,we,Is).call(this,c);if(s){const{overlayer:f,doc:p}=s;if(h){f.remove(d);return}const u=p?a(p):a;f.add(d,u,Ia.outline)}return}const{index:l,anchor:i}=await this.resolveNavigation(d),o=ht(this,we,Is).call(this,l);if(o){const{overlayer:n,doc:c}=o;if(n.remove(d),!h){const a=c?i(c):i,s=(f,p)=>n.add(d,a,f,p);ht(this,we,Pr).call(this,"draw-annotation",{draw:s,annotation:t,doc:c,range:a})}}const r=((e=Z(this,vr).getProgress(l))==null?void 0:e.label)??"";return{index:l,label:r}}deleteAnnotation(t){return this.addAnnotation(t,!0)}async showAnnotation(t){const{value:h}=t,d=await this.goTo(h);if(d){const{index:l,anchor:i}=d,{doc:o}=ht(this,we,Is).call(this,l),r=i(o);ht(this,we,Pr).call(this,"show-annotation",{value:h,index:l,range:r})}}getCFI(t,h){const d=this.book.sections[t].cfi??Oa.fromIndex(t);return h?xd(d,Td(h)):d}resolveCFI(t){if(this.book.resolveCFI)return this.book.resolveCFI(t);{const h=Bi(t);return{index:Oa.toIndex((h.parent??h).shift()),anchor:i=>zl(i,h)}}}resolveNavigation(t){try{if(typeof t=="number")return{index:t};if(typeof t.fraction=="number"){const[h,d]=Z(this,Lr).getSection(t.fraction);return{index:h,anchor:d}}return lo.test(t)?this.resolveCFI(t):this.book.resolveHref(t)}catch(h){console.error(h),console.error(`Could not resolve target ${t}`)}}async goTo(t){const h=this.resolveNavigation(t);try{return await this.renderer.goTo(h),this.history.pushState(t),h}catch(d){console.error(d),console.error(`Could not go to ${t}`)}}async goToFraction(t){const[h,d]=Z(this,Lr).getSection(t);await this.renderer.goTo({index:h,anchor:d}),this.history.pushState({fraction:t})}async select(t){try{const h=await this.resolveNavigation(t);await this.renderer.goTo({...h,select:!0}),this.history.pushState(t)}catch(h){console.error(h),console.error(`Could not go to ${t}`)}}deselect(){for(const{doc:t}of this.renderer.getContents())t.defaultView.getSelection().removeAllRanges()}getSectionFractions(){var t;return(((t=Z(this,Lr))==null?void 0:t.sectionFractions)??[]).map(h=>h+Number.EPSILON)}getProgressOf(t,h){var i,o;const d=(i=Z(this,vr))==null?void 0:i.getProgress(t,h),l=(o=Z(this,sn))==null?void 0:o.getProgress(t,h);return{tocItem:d,pageItem:l}}async getTOCItemOf(t){try{const{index:h,anchor:d}=await this.resolveNavigation(t),l=await this.book.sections[h].createDocument(),i=d(l),o=i instanceof Range,r=o?i:l.createRange();return o||r.selectNodeContents(i),Z(this,vr).getProgress(h,r)}catch(h){console.error(h),console.error(`Could not get ${t}`)}}async prev(t){await this.renderer.prev(t)}async next(t){await this.renderer.next(t)}goLeft(){return this.book.dir==="rtl"?this.next():this.prev()}goRight(){return this.book.dir==="rtl"?this.prev():this.next()}async*search(t){var e;this.clearSearch();const{searchMatcher:h}=await Promise.resolve().then(()=>Ib),{query:d,index:l}=t,i=h(Ba,{defaultLocale:this.language,...t}),o=l!=null?ht(this,we,Zl).call(this,i,d,l):ht(this,we,Gl).call(this,i,d),r=[];Z(this,zr).set(l,r);for await(const n of o)if(n.subitems){const c=n.subitems.map(({cfi:a})=>({value:Ci+a}));Z(this,zr).set(n.index,c);for(const a of c)this.addAnnotation(a);yield{label:((e=Z(this,vr).getProgress(n.index))==null?void 0:e.label)??"",subitems:n.subitems}}else{if(n.cfi){const c={value:Ci+n.cfi};r.push(c),this.addAnnotation(c)}yield n}yield"done"}clearSearch(){for(const t of Z(this,zr).values())for(const h of t)this.deleteAnnotation(h);Z(this,zr).clear()}async initTTS(t="word"){const h=this.renderer.getContents()[0].doc;if(this.tts&&this.tts.doc===h)return;const{TTS:d}=await Promise.resolve().then(()=>Vb);this.tts=new d(h,Ba,l=>this.renderer.scrollToAnchor(l,!0),t)}startMediaOverlay(){const{index:t}=this.renderer.getContents()[0];return this.mediaOverlay.start(t)}},no=new WeakMap,Lr=new WeakMap,vr=new WeakMap,sn=new WeakMap,zr=new WeakMap,io=new WeakMap,we=new WeakSet,Pr=function(t,h,d){return this.dispatchEvent(new CustomEvent(t,{detail:h,cancelable:d}))},Hl=function({reason:t,range:h,index:d,fraction:l,size:i}){var c,a,s;const o=((c=Z(this,Lr))==null?void 0:c.getProgress(d,l,i))??{},r=(a=Z(this,vr))==null?void 0:a.getProgress(d,h),e=(s=Z(this,sn))==null?void 0:s.getProgress(d,h),n=this.getCFI(d,h);this.lastLocation={...o,tocItem:r,pageItem:e,cfi:n,range:h},(t==="snap"||t==="page"||t==="scroll")&&this.history.replaceState(n),ht(this,we,Pr).call(this,"relocate",this.lastLocation)},Wl=function({doc:t,index:h}){var d,l;(d=t.documentElement).lang||(d.lang=this.language.canonical??""),this.language.isCJK||(l=t.documentElement).dir||(l.dir=this.language.direction??""),ht(this,we,ql).call(this,t,h),Z(this,io).cloneFor(t.documentElement),ht(this,we,Pr).call(this,"load",{doc:t,index:h})},ql=function(t,h){const{book:d}=this,l=d.sections[h];t.addEventListener("click",i=>{var n,c;const o=i.target.closest("a[href]");if(!o)return;i.preventDefault();const r=o.getAttribute("href"),e=((n=l==null?void 0:l.resolveHref)==null?void 0:n.call(l,r))??r;(c=d==null?void 0:d.isExternal)!=null&&c.call(d,e)?Promise.resolve(ht(this,we,Pr).call(this,"external-link",{a:o,href:e},!0)).then(a=>a?globalThis.open(e,"_blank"):null).catch(a=>console.error(a)):Promise.resolve(ht(this,we,Pr).call(this,"link",{a:o,href:e},!0)).then(a=>a?this.goTo(e):null).catch(a=>console.error(a))})},Is=function(t){return this.renderer.getContents().find(h=>h.index===t&&h.overlayer)},Xl=function({doc:t,index:h}){const d=new Ia(t);t.addEventListener("click",i=>{const[o,r]=d.hitTest(i);o&&!o.startsWith(Ci)&&ht(this,we,Pr).call(this,"show-annotation",{value:o,index:h,range:r})},!1);const l=Z(this,zr).get(h);if(l)for(const i of l)this.addAnnotation(i);return ht(this,we,Pr).call(this,"create-overlay",{index:h}),d},Zl=async function*(t,h,d){const l=await this.book.sections[d].createDocument();for(const{range:i,excerpt:o}of t(l,h))yield{cfi:this.getCFI(d,i),excerpt:o}},Gl=async function*(t,h){const{sections:d}=this.book;for(const[l,{createDocument:i}]of d.entries()){if(!i)continue;const o=await i(),r=Array.from(t(o,h),({range:n,excerpt:c})=>({cfi:this.getCFI(l,n),excerpt:c}));yield{progress:(l+1)/d.length},r.length&&(yield{index:l,subitems:r})}},Tl);customElements.define("foliate-view",Zd);const Gd={class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-overflow-hidden",style:{background:"#f5f5f0"}},Kd={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70 vfp-text-center vfp-p-6"},Yd={class:"vfp-text-lg"},Jd={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-z-10"},Qd={class:"vfp-flex vfp-items-center vfp-justify-between vfp-px-4 vfp-py-3 vfp-border-b vfp-border-white/10 vfp-flex-shrink-0"},tp={class:"vfp-text-white vfp-font-medium vfp-text-sm"},ep={class:"vfp-flex-1 vfp-overflow-y-auto vfp-py-4 vfp-px-1"},Kl=T.defineComponent({name:"MobiTocList",props:{items:{type:Array,required:!0},activeHref:{type:String,default:""},depth:{type:Number,default:0}},emits:["select"],render(){return T.h("ul",{style:{listStyle:"none",padding:0,margin:this.depth>0?"0 0 0 16px":0}},this.items.map((C,w)=>{var t,h,d;return T.h("li",{key:`${C.href??C.label}-${w}`},[C.href?T.h("button",{onClick:()=>this.$emit("select",C.href),class:["vfp-w-full vfp-text-left vfp-py-2 vfp-px-3 vfp-text-sm vfp-rounded vfp-transition-all vfp-truncate",this.activeHref===C.href?"vfp-text-white vfp-bg-white/15 vfp-font-medium":"vfp-text-white/70 hover:vfp-text-white hover:vfp-bg-white/10"],title:C.label,style:"background: none; border: none; cursor: pointer"},(t=C.label)==null?void 0:t.trim()):T.h("div",{class:"vfp-w-full vfp-py-2 vfp-px-3 vfp-text-sm vfp-text-white/50 vfp-truncate"},(h=C.label)==null?void 0:h.trim()),(d=C.subitems)!=null&&d.length?T.h(Kl,{items:C.subitems,activeHref:this.activeHref,depth:this.depth+1,onSelect:l=>this.$emit("select",l)}):null])}))}}),rp={name:"MobiRenderer"},np=T.defineComponent({...rp,props:{url:{}},emits:["chapterChange","fullWidthChange"],setup(C,{expose:w,emit:t}){const h=`
75
75
  @namespace epub "http://www.idpf.org/2007/ops";
76
76
  html { color-scheme: light; }
77
77
  body {
@@ -93,7 +93,7 @@ use chrome, FireFox or Internet Explorer 11`)}var r=t("safe-buffer"),e=t("random
93
93
  img { max-width: 100% !important; height: auto !important; }
94
94
  a { color: #2563eb; text-decoration: none; }
95
95
  pre { white-space: pre-wrap !important; }
96
- `,l=C,i=t,{t:o}=Te(),r=T.ref(null);let e=null,n=1;const c=T.ref(!0),a=T.ref(null),s=T.ref([]),f=T.ref(!1),p=T.ref(""),u=T.ref(!1),g=(j,L)=>{L>0&&(n=L),i("chapterChange",Math.max(1,j+1),n)},m=()=>{e==null||e.prev().catch(()=>{})},v=()=>{e==null||e.next().catch(()=>{})},S=()=>{f.value=!f.value},R=()=>{u.value=!u.value,i("fullWidthChange",u.value),e!=null&&e.renderer&&e.renderer.setAttribute("max-inline-size",u.value?"9999":"720")},I=j=>{p.value=j,f.value=!1,e==null||e.goTo(j).catch(()=>{})};w({prevPage:m,nextPage:v,toggleFullWidth:R,toggleToc:S});const F=async()=>{var L,$,V,z;const j=r.value;if(j){c.value=!0,a.value=null,s.value=[],f.value=!1,p.value="",j.replaceChildren(),e=null;try{const E=document.createElement("foliate-view");j.appendChild(E),e=E,E.addEventListener("relocate",_=>{var P;const x=_.detail;if(!x)return;const M=x.location;if(M&&typeof M.current=="number"&&typeof M.total=="number")g(M.current,M.total);else{const H=((P=e==null?void 0:e.book)==null?void 0:P.sections)??[],W=x.index??0,K=x.fraction??0,D=Math.max(H.length,1);g(Math.round((W+K)/D*D),D)}const B=x.tocItem;B!=null&&B.href&&(p.value=B.href)});const A=await fetch(l.url);if(!A.ok)throw new Error(`请求失败: ${A.status}`);const k=await A.blob();let b="book.mobi";try{const x=new URL(l.url,window.location.href).pathname.split("/").pop();x&&(b=decodeURIComponent(x))}catch{}await E.open(new File([k],b));const y=E.renderer;y&&(y.setAttribute("animated",""),y.setAttribute("max-inline-size","720"),y.setAttribute("margin","48"),y.setAttribute("gap","5%"),(L=y.setStyles)==null||L.call(y,h),await(($=y.next)==null?void 0:$.call(y))),s.value=((V=E.book)==null?void 0:V.toc)??[],c.value=!1,g(0,((z=E.book)==null?void 0:z.sections.length)??1)}catch(E){console.error("MOBI/AZW3 加载错误:",E),a.value=o.value("mobi.load_failed"),c.value=!1}}};return T.watch(()=>l.url,()=>F(),{immediate:!0}),T.onBeforeUnmount(()=>{var j,L,$;try{(L=(j=e==null?void 0:e.book)==null?void 0:j.destroy)==null||L.call(j)}catch{}e=null,($=r.value)==null||$.replaceChildren()}),(j,L)=>(T.openBlock(),T.createElementBlock("div",Zd,[a.value?(T.openBlock(),T.createElementBlock("div",Gd,[T.createElementVNode("p",Kd,T.toDisplayString(a.value),1)])):T.createCommentVNode("",!0),c.value&&!a.value?(T.openBlock(),T.createElementBlock("div",Yd,[...L[2]||(L[2]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),s.value.length>0?(T.openBlock(),T.createElementBlock("div",{key:2,class:"vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex vfp-transition-opacity vfp-duration-300",style:T.normalizeStyle({opacity:f.value?1:0,pointerEvents:f.value?"auto":"none"})},[T.createElementVNode("div",{class:"vfp-w-72 vfp-max-w-[80%] vfp-h-full vfp-bg-black/90 vfp-backdrop-blur-xl vfp-border-r vfp-border-white/10 vfp-flex vfp-flex-col vfp-shadow-2xl vfp-transition-transform vfp-duration-300",style:T.normalizeStyle({transform:f.value?"translateX(0)":"translateX(-100%)"})},[T.createElementVNode("div",Jd,[T.createElementVNode("span",Qd,T.toDisplayString(T.unref(o)("toolbar.toc")),1),T.createElementVNode("button",{class:"toc-close-btn",onClick:L[0]||(L[0]=$=>f.value=!1)},[T.createVNode(T.unref(Ot.X),{class:"vfp-w-4 vfp-h-4"})])]),T.createElementVNode("div",tp,[T.createVNode(T.unref(Gl),{items:s.value,"active-href":p.value,onSelect:I},null,8,["items","active-href"])])],4),T.createElementVNode("div",{class:"vfp-flex-1 vfp-transition-opacity vfp-duration-300",style:T.normalizeStyle({background:f.value?"rgba(0,0,0,0.3)":"transparent"}),onClick:L[1]||(L[1]=$=>f.value=!1)},null,4)],4)):T.createCommentVNode("",!0),a.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:3,ref_key:"hostRef",ref:r,class:"vfp-h-full vfp-bg-white vfp-shadow-lg",style:T.normalizeStyle({width:u.value?"100%":"794px",maxWidth:"100%",transition:"width 0.3s ease"})},null,4))]))}}),np=Er(rp,[["__scopeId","data-v-63bbaaf3"]]),ip={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},sp={class:"vfp-text-center"},op={class:"vfp-text-lg vfp-font-medium vfp-text-white/90 vfp-mb-2"},ap={class:"vfp-text-sm vfp-text-white/60"},lp={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},cp={class:"vfp-w-full vfp-h-full vfp-relative"},up={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/20 vfp-backdrop-blur-sm vfp-rounded-2xl vfp-z-10"},fp={class:"vfp-text-center"},hp={class:"vfp-text-sm vfp-text-white/70 vfp-font-medium"},dp=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(null),d=T.ref(!0),l=T.ref(null);let i=null;const o=()=>{if(!l.value||i)return;const r=document.createElement("video-js");r.classList.add("vjs-big-play-centered","vjs-theme-apple"),l.value.appendChild(r);const e=ya(w.url),n=e==="video/quicktime"?[{src:w.url,type:"video/quicktime"},{src:w.url,type:"video/mp4"}]:[{src:w.url,type:e}];i=du(r,{controls:!0,fill:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:n});const c=i.el().querySelector("video");c&&(c.style.objectFit="contain"),i.on("loadeddata",()=>{d.value=!1}),i.on("error",()=>{const a=i==null?void 0:i.error();console.error("Video.js error:",a),h.value=t.value("video.load_failed_with_error",{error:(a==null?void 0:a.message)||t.value("common.unknown_error")}),d.value=!1})};return T.onMounted(o),T.watch(()=>w.url,()=>{i&&!i.isDisposed()&&i.src({src:w.url,type:ya(w.url)})}),T.onBeforeUnmount(()=>{i&&!i.isDisposed()&&(i.dispose(),i=null)}),(r,e)=>h.value?(T.openBlock(),T.createElementBlock("div",ip,[T.createElementVNode("div",sp,[e[0]||(e[0]=T.createElementVNode("div",{class:"vfp-w-16 vfp-h-16 vfp-mx-auto vfp-mb-4 vfp-rounded-full vfp-bg-red-500/10 vfp-flex vfp-items-center vfp-justify-center"},[T.createElementVNode("svg",{class:"vfp-w-8 vfp-h-8 vfp-text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[T.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})])],-1)),T.createElementVNode("p",op,T.toDisplayString(T.unref(t)("video.load_failed")),1),T.createElementVNode("p",ap,T.toDisplayString(h.value),1)])])):(T.openBlock(),T.createElementBlock("div",lp,[T.createElementVNode("div",cp,[d.value?(T.openBlock(),T.createElementBlock("div",up,[T.createElementVNode("div",fp,[e[1]||(e[1]=T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",hp,T.toDisplayString(T.unref(t)("video.loading")),1)])])):T.createCommentVNode("",!0),T.createElementVNode("div",{ref_key:"videoContainerRef",ref:l,class:"vfp-overflow-hidden vfp-w-full vfp-h-full",style:{"box-shadow":"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}},null,512)])]))}});function pp(C){const w=T.ref(null),t=T.ref(!1),h=T.ref(!0),d=T.ref(0),l=T.ref(0),i=T.ref(1),o=T.ref(!1),r=T.ref(!1),e=T.ref(null);let n=null;const c=()=>{const m=w.value;if(!m)return;h.value=!0,e.value=null;const v=()=>{isNaN(m.currentTime)||(d.value=m.currentTime)},S=()=>{!isNaN(m.duration)&&isFinite(m.duration)&&(l.value=m.duration)},R=()=>{h.value=!1,S()},I=()=>{h.value=!0},F=()=>{h.value=!1,t.value=!0},j=()=>{t.value=!0},L=()=>{t.value=!1},$=()=>{t.value=!1},V=()=>{e.value="音频加载失败",h.value=!1};m.addEventListener("timeupdate",v),m.addEventListener("loadedmetadata",S),m.addEventListener("durationchange",S),m.addEventListener("canplay",R),m.addEventListener("waiting",I),m.addEventListener("playing",F),m.addEventListener("play",j),m.addEventListener("pause",L),m.addEventListener("ended",$),m.addEventListener("error",V),m.readyState>=3?(h.value=!1,S()):m.readyState>=1&&S(),n=()=>{m.removeEventListener("timeupdate",v),m.removeEventListener("loadedmetadata",S),m.removeEventListener("durationchange",S),m.removeEventListener("canplay",R),m.removeEventListener("waiting",I),m.removeEventListener("playing",F),m.removeEventListener("play",j),m.removeEventListener("pause",L),m.removeEventListener("ended",$),m.removeEventListener("error",V)}};return T.watch(C,()=>{n==null||n(),n=null,requestAnimationFrame(()=>c())},{flush:"post"}),T.watch(w,m=>{m&&c()},{flush:"post"}),T.onUnmounted(()=>{n==null||n(),n=null}),{audioRef:w,isPlaying:t,isLoading:h,isLoop:r,currentTime:d,duration:l,volume:i,isMuted:o,error:e,togglePlay:()=>{const m=w.value;m&&(m.paused?m.play().catch(()=>{}):m.pause())},seek:m=>{const v=w.value;v&&(v.currentTime=m,d.value=m)},skip:m=>{const v=w.value;v&&(v.currentTime=Math.max(0,Math.min(v.currentTime+m,v.duration||1/0)))},setVolume:m=>{const v=w.value;if(!v)return;const S=Math.max(0,Math.min(1,m));v.volume=S,i.value=S,S>0&&(v.muted=!1,o.value=!1)},toggleMute:()=>{const m=w.value;m&&(m.muted=!m.muted,o.value=m.muted)},toggleLoop:()=>{const m=w.value;if(!m)return;const v=!m.loop;m.loop=v,r.value=v},formatTime:wu}}const mp={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},gp={class:"vfp-text-white/70 vfp-text-center"},bp={class:"vfp-text-lg"},vp={key:1,class:"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-4 md:vfp-p-8 vfp-gap-5 md:vfp-gap-8 vfp-select-none"},yp={class:"vfp-relative",style:{width:"260px",height:"240px"}},wp={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},_p={class:"vfp-text-lg md:vfp-text-xl vfp-font-medium vfp-mb-1 vfp-truncate",style:{color:"#e0dff0"}},xp={class:"vfp-w-full vfp-max-w-sm md:vfp-max-w-md vfp-rounded-2xl vfp-p-4 md:vfp-p-6 vfp-border",style:{background:"rgba(255,255,255,0.04)",backdropFilter:"blur(16px)",borderColor:"rgba(129,140,248,0.12)"}},kp={class:"vfp-mb-5"},Sp={class:"vfp-relative vfp-h-4 vfp-flex vfp-items-center"},Ep=["max","value","disabled","aria-label"],Cp={class:"vfp-flex vfp-justify-between vfp-text-xs vfp-mt-2.5",style:{color:"rgba(129,140,248,0.5)"}},Tp={style:{"font-variant-numeric":"tabular-nums"}},Mp={style:{"font-variant-numeric":"tabular-nums"}},Ap={class:"vfp-flex vfp-items-center vfp-justify-center vfp-gap-3"},Rp=["aria-label"],Np=["aria-label"],Op=["aria-label"],jp=["aria-label"],Ip=["aria-label"],Bp={class:"vfp-flex vfp-flex-col vfp-items-center vfp-gap-2",style:{height:"100px"}},Pp={class:"vfp-relative vfp-flex vfp-items-center vfp-justify-center",style:{width:"24px",height:"80px"}},Fp=["value","aria-label"],Dp={class:"vfp-text-[10px] vfp-tabular-nums",style:{color:"rgba(129,140,248,0.5)"}},Lp=["src"],zp=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,t=T.toRef(w,"url"),{t:h}=Te(),{audioRef:d,isPlaying:l,isLoop:i,currentTime:o,duration:r,volume:e,isMuted:n,error:c,togglePlay:a,seek:s,skip:f,setVolume:p,toggleMute:u,toggleLoop:g,formatTime:m}=pp(t),v=T.ref(!1);let S=null;const R=T.ref(null),I=T.computed(()=>r.value>0?o.value/r.value:0),F=T.computed(()=>n.value||e.value===0?Ot.VolumeX:e.value<.5?Ot.Volume1:Ot.Volume2),j=V=>{R.value&&!R.value.contains(V.target)&&(v.value=!1)};T.onMounted(()=>{document.addEventListener("mousedown",j)}),T.onBeforeUnmount(()=>{document.removeEventListener("mousedown",j),S!==null&&clearTimeout(S)});const L=()=>{S!==null&&clearTimeout(S),v.value=!0},$=()=>{S=window.setTimeout(()=>{v.value=!1},300)};return(V,z)=>T.unref(c)?(T.openBlock(),T.createElementBlock("div",mp,[T.createElementVNode("div",gp,[T.createElementVNode("p",bp,T.toDisplayString(T.unref(c)),1)])])):(T.openBlock(),T.createElementBlock("div",vp,[T.createElementVNode("div",yp,[T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:T.normalizeStyle({width:"220px",height:"220px",top:"18px",left:"8px",background:"radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)",opacity:T.unref(l)?.7:.2,transition:"opacity 0.5s"})},null,4),T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full vfp-overflow-hidden",style:T.normalizeStyle({width:"200px",height:"200px",top:"28px",left:"18px",background:`
96
+ `,l=C,i=t,{t:o}=Te(),r=T.ref(null);let e=null,n=1;const c=T.ref(!0),a=T.ref(null),s=T.ref([]),f=T.ref(!1),p=T.ref(""),u=T.ref(!1),g=(j,L)=>{L>0&&(n=L),i("chapterChange",Math.max(1,j+1),n)},m=()=>{e==null||e.prev().catch(()=>{})},v=()=>{e==null||e.next().catch(()=>{})},S=()=>{f.value=!f.value},R=()=>{u.value=!u.value,i("fullWidthChange",u.value),e!=null&&e.renderer&&e.renderer.setAttribute("max-inline-size",u.value?"9999":"720")},I=j=>{p.value=j,f.value=!1,e==null||e.goTo(j).catch(()=>{})};w({prevPage:m,nextPage:v,toggleFullWidth:R,toggleToc:S});const F=async()=>{var L,$,V,z;const j=r.value;if(j){c.value=!0,a.value=null,s.value=[],f.value=!1,p.value="",j.replaceChildren(),e=null;try{const E=document.createElement("foliate-view");j.appendChild(E),e=E,E.addEventListener("relocate",_=>{var P;const x=_.detail;if(!x)return;const M=x.location;if(M&&typeof M.current=="number"&&typeof M.total=="number")g(M.current,M.total);else{const H=((P=e==null?void 0:e.book)==null?void 0:P.sections)??[],W=x.index??0,K=x.fraction??0,D=Math.max(H.length,1);g(Math.round((W+K)/D*D),D)}const B=x.tocItem;B!=null&&B.href&&(p.value=B.href)});const A=await fetch(l.url);if(!A.ok)throw new Error(`请求失败: ${A.status}`);const k=await A.blob();let b="book.mobi";try{const x=new URL(l.url,window.location.href).pathname.split("/").pop();x&&(b=decodeURIComponent(x))}catch{}await E.open(new File([k],b));const y=E.renderer;y&&(y.setAttribute("animated",""),y.setAttribute("max-inline-size","720"),y.setAttribute("margin","48"),y.setAttribute("gap","5%"),(L=y.setStyles)==null||L.call(y,h),await(($=y.next)==null?void 0:$.call(y))),s.value=((V=E.book)==null?void 0:V.toc)??[],c.value=!1,g(0,((z=E.book)==null?void 0:z.sections.length)??1)}catch(E){console.error("MOBI/AZW3 加载错误:",E),a.value=o.value("mobi.load_failed"),c.value=!1}}};return T.watch(()=>l.url,()=>F(),{immediate:!0}),T.onBeforeUnmount(()=>{var j,L,$;try{(L=(j=e==null?void 0:e.book)==null?void 0:j.destroy)==null||L.call(j)}catch{}e=null,($=r.value)==null||$.replaceChildren()}),(j,L)=>(T.openBlock(),T.createElementBlock("div",Gd,[a.value?(T.openBlock(),T.createElementBlock("div",Kd,[T.createElementVNode("p",Yd,T.toDisplayString(a.value),1)])):T.createCommentVNode("",!0),c.value&&!a.value?(T.openBlock(),T.createElementBlock("div",Jd,[...L[2]||(L[2]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):T.createCommentVNode("",!0),s.value.length>0?(T.openBlock(),T.createElementBlock("div",{key:2,class:"vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex vfp-transition-opacity vfp-duration-300",style:T.normalizeStyle({opacity:f.value?1:0,pointerEvents:f.value?"auto":"none"})},[T.createElementVNode("div",{class:"vfp-w-72 vfp-max-w-[80%] vfp-h-full vfp-bg-black/90 vfp-backdrop-blur-xl vfp-border-r vfp-border-white/10 vfp-flex vfp-flex-col vfp-shadow-2xl vfp-transition-transform vfp-duration-300",style:T.normalizeStyle({transform:f.value?"translateX(0)":"translateX(-100%)"})},[T.createElementVNode("div",Qd,[T.createElementVNode("span",tp,T.toDisplayString(T.unref(o)("toolbar.toc")),1),T.createElementVNode("button",{class:"toc-close-btn",onClick:L[0]||(L[0]=$=>f.value=!1)},[T.createVNode(T.unref(Ot.X),{class:"vfp-w-4 vfp-h-4"})])]),T.createElementVNode("div",ep,[T.createVNode(T.unref(Kl),{items:s.value,"active-href":p.value,onSelect:I},null,8,["items","active-href"])])],4),T.createElementVNode("div",{class:"vfp-flex-1 vfp-transition-opacity vfp-duration-300",style:T.normalizeStyle({background:f.value?"rgba(0,0,0,0.3)":"transparent"}),onClick:L[1]||(L[1]=$=>f.value=!1)},null,4)],4)):T.createCommentVNode("",!0),a.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:3,ref_key:"hostRef",ref:r,class:"vfp-h-full vfp-bg-white vfp-shadow-lg",style:T.normalizeStyle({width:u.value?"100%":"794px",maxWidth:"100%",transition:"width 0.3s ease"})},null,4))]))}}),ip=Ir(np,[["__scopeId","data-v-63bbaaf3"]]),sp={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},op={class:"vfp-text-center"},ap={class:"vfp-text-lg vfp-font-medium vfp-text-white/90 vfp-mb-2"},lp={class:"vfp-text-sm vfp-text-white/60"},cp={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},up={class:"vfp-w-full vfp-h-full vfp-relative"},fp={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/20 vfp-backdrop-blur-sm vfp-rounded-2xl vfp-z-10"},hp={class:"vfp-text-center"},dp={class:"vfp-text-sm vfp-text-white/70 vfp-font-medium"},pp=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(null),d=T.ref(!0),l=T.ref(null);let i=null;const o=()=>{if(!l.value||i)return;const r=document.createElement("video-js");r.classList.add("vjs-big-play-centered","vjs-theme-apple"),l.value.appendChild(r);const e=ya(w.url),n=e==="video/quicktime"?[{src:w.url,type:"video/quicktime"},{src:w.url,type:"video/mp4"}]:[{src:w.url,type:e}];i=du(r,{controls:!0,fill:!0,preload:"auto",controlBar:{children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],volumePanel:{inline:!1}},html5:{vhs:{overrideNative:!0},nativeVideoTracks:!1,nativeAudioTracks:!1,nativeTextTracks:!1},sources:n});const c=i.el().querySelector("video");c&&(c.style.objectFit="contain"),i.on("loadeddata",()=>{d.value=!1}),i.on("error",()=>{const a=i==null?void 0:i.error();console.error("Video.js error:",a),h.value=t.value("video.load_failed_with_error",{error:(a==null?void 0:a.message)||t.value("common.unknown_error")}),d.value=!1})};return T.onMounted(o),T.watch(()=>w.url,()=>{i&&!i.isDisposed()&&i.src({src:w.url,type:ya(w.url)})}),T.onBeforeUnmount(()=>{i&&!i.isDisposed()&&(i.dispose(),i=null)}),(r,e)=>h.value?(T.openBlock(),T.createElementBlock("div",sp,[T.createElementVNode("div",op,[e[0]||(e[0]=T.createElementVNode("div",{class:"vfp-w-16 vfp-h-16 vfp-mx-auto vfp-mb-4 vfp-rounded-full vfp-bg-red-500/10 vfp-flex vfp-items-center vfp-justify-center"},[T.createElementVNode("svg",{class:"vfp-w-8 vfp-h-8 vfp-text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[T.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})])],-1)),T.createElementVNode("p",ap,T.toDisplayString(T.unref(t)("video.load_failed")),1),T.createElementVNode("p",lp,T.toDisplayString(h.value),1)])])):(T.openBlock(),T.createElementBlock("div",cp,[T.createElementVNode("div",up,[d.value?(T.openBlock(),T.createElementBlock("div",fp,[T.createElementVNode("div",hp,[e[1]||(e[1]=T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",dp,T.toDisplayString(T.unref(t)("video.loading")),1)])])):T.createCommentVNode("",!0),T.createElementVNode("div",{ref_key:"videoContainerRef",ref:l,class:"vfp-overflow-hidden vfp-w-full vfp-h-full",style:{"box-shadow":"0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)"}},null,512)])]))}});function mp(C){const w=T.ref(null),t=T.ref(!1),h=T.ref(!0),d=T.ref(0),l=T.ref(0),i=T.ref(1),o=T.ref(!1),r=T.ref(!1),e=T.ref(null);let n=null;const c=()=>{const m=w.value;if(!m)return;h.value=!0,e.value=null;const v=()=>{isNaN(m.currentTime)||(d.value=m.currentTime)},S=()=>{!isNaN(m.duration)&&isFinite(m.duration)&&(l.value=m.duration)},R=()=>{h.value=!1,S()},I=()=>{h.value=!0},F=()=>{h.value=!1,t.value=!0},j=()=>{t.value=!0},L=()=>{t.value=!1},$=()=>{t.value=!1},V=()=>{e.value="音频加载失败",h.value=!1};m.addEventListener("timeupdate",v),m.addEventListener("loadedmetadata",S),m.addEventListener("durationchange",S),m.addEventListener("canplay",R),m.addEventListener("waiting",I),m.addEventListener("playing",F),m.addEventListener("play",j),m.addEventListener("pause",L),m.addEventListener("ended",$),m.addEventListener("error",V),m.readyState>=3?(h.value=!1,S()):m.readyState>=1&&S(),n=()=>{m.removeEventListener("timeupdate",v),m.removeEventListener("loadedmetadata",S),m.removeEventListener("durationchange",S),m.removeEventListener("canplay",R),m.removeEventListener("waiting",I),m.removeEventListener("playing",F),m.removeEventListener("play",j),m.removeEventListener("pause",L),m.removeEventListener("ended",$),m.removeEventListener("error",V)}};return T.watch(C,()=>{n==null||n(),n=null,requestAnimationFrame(()=>c())},{flush:"post"}),T.watch(w,m=>{m&&c()},{flush:"post"}),T.onUnmounted(()=>{n==null||n(),n=null}),{audioRef:w,isPlaying:t,isLoading:h,isLoop:r,currentTime:d,duration:l,volume:i,isMuted:o,error:e,togglePlay:()=>{const m=w.value;m&&(m.paused?m.play().catch(()=>{}):m.pause())},seek:m=>{const v=w.value;v&&(v.currentTime=m,d.value=m)},skip:m=>{const v=w.value;v&&(v.currentTime=Math.max(0,Math.min(v.currentTime+m,v.duration||1/0)))},setVolume:m=>{const v=w.value;if(!v)return;const S=Math.max(0,Math.min(1,m));v.volume=S,i.value=S,S>0&&(v.muted=!1,o.value=!1)},toggleMute:()=>{const m=w.value;m&&(m.muted=!m.muted,o.value=m.muted)},toggleLoop:()=>{const m=w.value;if(!m)return;const v=!m.loop;m.loop=v,r.value=v},formatTime:wu}}const gp={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},bp={class:"vfp-text-white/70 vfp-text-center"},vp={class:"vfp-text-lg"},yp={key:1,class:"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-4 md:vfp-p-8 vfp-gap-5 md:vfp-gap-8 vfp-select-none"},wp={class:"vfp-relative",style:{width:"260px",height:"240px"}},_p={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},xp={class:"vfp-text-lg md:vfp-text-xl vfp-font-medium vfp-mb-1 vfp-truncate",style:{color:"#e0dff0"}},kp={class:"vfp-w-full vfp-max-w-sm md:vfp-max-w-md vfp-rounded-2xl vfp-p-4 md:vfp-p-6 vfp-border",style:{background:"rgba(255,255,255,0.04)",backdropFilter:"blur(16px)",borderColor:"rgba(129,140,248,0.12)"}},Sp={class:"vfp-mb-5"},Ep={class:"vfp-relative vfp-h-4 vfp-flex vfp-items-center"},Cp=["max","value","disabled","aria-label"],Tp={class:"vfp-flex vfp-justify-between vfp-text-xs vfp-mt-2.5",style:{color:"rgba(129,140,248,0.5)"}},Mp={style:{"font-variant-numeric":"tabular-nums"}},Ap={style:{"font-variant-numeric":"tabular-nums"}},Rp={class:"vfp-flex vfp-items-center vfp-justify-center vfp-gap-3"},Np=["aria-label"],Op=["aria-label"],jp=["aria-label"],Ip=["aria-label"],Bp=["aria-label"],Pp={class:"vfp-flex vfp-flex-col vfp-items-center vfp-gap-2",style:{height:"100px"}},Fp={class:"vfp-relative vfp-flex vfp-items-center vfp-justify-center",style:{width:"24px",height:"80px"}},Dp=["value","aria-label"],Lp={class:"vfp-text-[10px] vfp-tabular-nums",style:{color:"rgba(129,140,248,0.5)"}},zp=["src"],$p=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,t=T.toRef(w,"url"),{t:h}=Te(),{audioRef:d,isPlaying:l,isLoop:i,currentTime:o,duration:r,volume:e,isMuted:n,error:c,togglePlay:a,seek:s,skip:f,setVolume:p,toggleMute:u,toggleLoop:g,formatTime:m}=mp(t),v=T.ref(!1);let S=null;const R=T.ref(null),I=T.computed(()=>r.value>0?o.value/r.value:0),F=T.computed(()=>n.value||e.value===0?Ot.VolumeX:e.value<.5?Ot.Volume1:Ot.Volume2),j=V=>{R.value&&!R.value.contains(V.target)&&(v.value=!1)};T.onMounted(()=>{document.addEventListener("mousedown",j)}),T.onBeforeUnmount(()=>{document.removeEventListener("mousedown",j),S!==null&&clearTimeout(S)});const L=()=>{S!==null&&clearTimeout(S),v.value=!0},$=()=>{S=window.setTimeout(()=>{v.value=!1},300)};return(V,z)=>T.unref(c)?(T.openBlock(),T.createElementBlock("div",gp,[T.createElementVNode("div",bp,[T.createElementVNode("p",vp,T.toDisplayString(T.unref(c)),1)])])):(T.openBlock(),T.createElementBlock("div",yp,[T.createElementVNode("div",wp,[T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:T.normalizeStyle({width:"220px",height:"220px",top:"18px",left:"8px",background:"radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)",opacity:T.unref(l)?.7:.2,transition:"opacity 0.5s"})},null,4),T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full vfp-overflow-hidden",style:T.normalizeStyle({width:"200px",height:"200px",top:"28px",left:"18px",background:`
97
97
  radial-gradient(circle at center, transparent 95%, rgba(30,30,30,0.8) 95.5%, #111 97%),
98
98
  radial-gradient(circle at center, transparent 38%, rgba(50,50,50,0.5) 38.15%, transparent 38.4%),
99
99
  radial-gradient(circle at center, transparent 45%, rgba(50,50,50,0.3) 45.15%, transparent 45.4%),
@@ -104,17 +104,17 @@ use chrome, FireFox or Internet Explorer 11`)}var r=t("safe-buffer"),e=t("random
104
104
  radial-gradient(circle at center, transparent 80%, rgba(50,50,50,0.4) 80.15%, transparent 80.4%),
105
105
  radial-gradient(circle at center, transparent 87%, rgba(50,50,50,0.3) 87.15%, transparent 87.4%),
106
106
  conic-gradient(from 0deg, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c, #212121, #1a1a1a, #252525, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c)
107
- `,boxShadow:T.unref(l)?"0 0 36px rgba(129,140,248,0.1), 0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)":"0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)",animation:"vfp-vinyl-spin 8s linear infinite",animationPlayState:T.unref(l)?"running":"paused"})},[...z[7]||(z[7]=[T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"34%",height:"34%",top:"33%",left:"33%",background:"radial-gradient(circle at 40% 38%, #818cf8, #6366f1, #4f46e5, #4338ca)",boxShadow:"inset 0 1px 3px rgba(255,255,255,0.25), inset 0 -1px 3px rgba(0,0,0,0.3), 0 0 8px rgba(0,0,0,0.3)"}},[T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"14%",height:"14%",top:"43%",left:"43%",background:"radial-gradient(circle at 40% 40%, #333, #0d0d0d)",boxShadow:"inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)"}})],-1)])],4),T.createElementVNode("div",{class:"vfp-absolute",style:T.normalizeStyle({top:"-6px",right:"2px",width:"100px",height:"120px",transformOrigin:"76px 16px",zIndex:5,transform:T.unref(l)?"rotate(16deg)":"rotate(0deg)",transition:"transform 0.8s cubic-bezier(0.4, 0, 0.2, 1)"})},[...z[8]||(z[8]=[T.createStaticVNode('<svg width="100" height="120" viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="76" cy="16" r="13" fill="rgba(0,0,0,0.3)"></circle><circle cx="76" cy="16" r="11" fill="url(#vfp-baseGrad)"></circle><circle cx="76" cy="16" r="6" fill="url(#vfp-baseInnerGrad)"></circle><circle cx="76" cy="16" r="2.5" fill="#222" stroke="#555" stroke-width="0.5"></circle><path d="M74 22 L56 88" stroke="url(#vfp-armGrad)" stroke-width="3.5" stroke-linecap="round"></path><rect x="50" y="86" width="12" height="7" rx="1.5" fill="url(#vfp-headGrad)"></rect><rect x="52.5" y="92" width="7" height="9" rx="1" fill="url(#vfp-cartridgeGrad)"></rect><line x1="56" y1="101" x2="56" y2="105" stroke="#bbb" stroke-width="1.2" stroke-linecap="round"></line><circle cx="56" cy="105.5" r="0.8" fill="#ddd"></circle><defs><radialGradient id="vfp-baseGrad" cx="40%" cy="35%"><stop offset="0%" stop-color="#555"></stop><stop offset="100%" stop-color="#1a1a1a"></stop></radialGradient><radialGradient id="vfp-baseInnerGrad" cx="40%" cy="35%"><stop offset="0%" stop-color="#666"></stop><stop offset="100%" stop-color="#333"></stop></radialGradient><linearGradient id="vfp-armGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#555"></stop><stop offset="50%" stop-color="#444"></stop><stop offset="100%" stop-color="#333"></stop></linearGradient><linearGradient id="vfp-headGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#555"></stop><stop offset="100%" stop-color="#333"></stop></linearGradient><linearGradient id="vfp-cartridgeGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#444"></stop><stop offset="100%" stop-color="#222"></stop></linearGradient></defs></svg>',1)])],4)]),T.createElementVNode("div",wp,[T.createElementVNode("div",_p,T.toDisplayString(C.fileName),1),z[9]||(z[9]=T.createElementVNode("p",{class:"vfp-text-xs vfp-tracking-widest vfp-uppercase",style:{color:"rgba(129,140,248,0.5)"}},"Audio",-1))]),T.createElementVNode("div",xp,[T.createElementVNode("div",kp,[T.createElementVNode("div",Sp,[z[10]||(z[10]=T.createElementVNode("div",{class:"vfp-absolute vfp-w-full vfp-h-[5px] vfp-rounded-full",style:{background:"rgba(255,255,255,0.08)"}},null,-1)),T.createElementVNode("div",{class:"vfp-absolute vfp-h-[5px] vfp-rounded-full vfp-pointer-events-none",style:T.normalizeStyle({width:`${I.value*100}%`,background:"linear-gradient(90deg, #6366f1, #818cf8)",boxShadow:T.unref(l)?"0 0 8px rgba(129,140,248,0.4)":"none",transition:"width 0.1s linear"})},null,4),T.createElementVNode("input",{type:"range",min:"0",max:T.unref(r)>0?T.unref(r):T.unref(o)||100,step:"any",value:T.unref(o),disabled:T.unref(r)<=0,"aria-label":T.unref(h)("audio.aria.progress"),class:"audio-slider vfp-absolute vfp-w-full",onInput:z[0]||(z[0]=E=>T.unref(s)(parseFloat(E.target.value)))},null,40,Ep)]),T.createElementVNode("div",Cp,[T.createElementVNode("span",Tp,T.toDisplayString(T.unref(m)(T.unref(o))),1),T.createElementVNode("span",Mp,T.toDisplayString(T.unref(r)>0?T.unref(m)(T.unref(r)):"--:--"),1)])]),T.createElementVNode("div",Ap,[T.createElementVNode("button",{class:"vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:T.normalizeStyle({background:T.unref(i)?"rgba(129,140,248,0.15)":"rgba(255,255,255,0.06)",color:T.unref(i)?"#818cf8":"rgba(224,223,240,0.4)",border:0,cursor:"pointer"}),"aria-label":T.unref(i)?T.unref(h)("audio.aria.loop_off"):T.unref(h)("audio.aria.loop_on"),onClick:z[1]||(z[1]=(...E)=>T.unref(g)&&T.unref(g)(...E))},[T.createVNode(T.unref(Ot.Repeat),{class:"vfp-w-4 vfp-h-4"})],12,Rp),T.createElementVNode("button",{class:"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(224,223,240,0.7)",border:0,cursor:"pointer"},"aria-label":T.unref(h)("audio.aria.backward_10"),onClick:z[2]||(z[2]=E=>T.unref(f)(-10))},[T.createVNode(T.unref(Ot.SkipBack),{class:"vfp-w-[18px] vfp-h-[18px]"})],8,Np),T.createElementVNode("button",{class:"vfp-w-14 vfp-h-14 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center",style:{background:"linear-gradient(135deg, #818cf8, #6366f1)",color:"#fff",boxShadow:"0 4px 20px rgba(99,102,241,0.35)",border:0,cursor:"pointer"},"aria-label":T.unref(l)?T.unref(h)("audio.aria.pause"):T.unref(h)("audio.aria.play"),onClick:z[3]||(z[3]=(...E)=>T.unref(a)&&T.unref(a)(...E))},[T.unref(l)?(T.openBlock(),T.createBlock(T.unref(Ot.Pause),{key:0,class:"vfp-w-6 vfp-h-6"})):(T.openBlock(),T.createBlock(T.unref(Ot.Play),{key:1,class:"vfp-w-6 vfp-h-6 vfp-ml-0.5"}))],8,Op),T.createElementVNode("button",{class:"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(224,223,240,0.7)",border:0,cursor:"pointer"},"aria-label":T.unref(h)("audio.aria.forward_10"),onClick:z[4]||(z[4]=E=>T.unref(f)(10))},[T.createVNode(T.unref(Ot.SkipForward),{class:"vfp-w-[18px] vfp-h-[18px]"})],8,jp),T.createElementVNode("div",{ref_key:"volumeRef",ref:R,class:"vfp-relative",onMouseenter:L,onMouseleave:$},[T.createElementVNode("button",{class:"vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:T.normalizeStyle({background:v.value?"rgba(129,140,248,0.15)":"rgba(255,255,255,0.06)",color:"rgba(129,140,248,0.6)",border:0,cursor:"pointer"}),"aria-label":T.unref(n)?T.unref(h)("audio.aria.unmute"):T.unref(h)("audio.aria.mute"),onClick:z[5]||(z[5]=(...E)=>T.unref(u)&&T.unref(u)(...E))},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(F.value),{class:"vfp-w-4 vfp-h-4"}))],12,Ip),T.createVNode(T.Transition,{name:"vfp-fade"},{default:T.withCtx(()=>[v.value?(T.openBlock(),T.createElementBlock("div",{key:0,class:"vfp-absolute vfp-bottom-full vfp-mb-2 vfp-rounded-xl vfp-p-3 vfp-border",style:{left:"50%",marginLeft:"-27px",background:"rgba(20,20,20,0.95)",backdropFilter:"blur(16px)",borderColor:"rgba(129,140,248,0.15)"},onMouseenter:L,onMouseleave:$},[T.createElementVNode("div",Bp,[T.createElementVNode("div",Pp,[z[11]||(z[11]=T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"3px",height:"100%",background:"rgba(255,255,255,0.1)"}},null,-1)),T.createElementVNode("div",{class:"vfp-absolute vfp-bottom-0 vfp-rounded-full vfp-pointer-events-none",style:T.normalizeStyle({width:"3px",height:`${(T.unref(n)?0:T.unref(e))*100}%`,background:"#818cf8",transition:"height 0.1s linear"})},null,4),T.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01",value:T.unref(n)?0:T.unref(e),"aria-label":T.unref(h)("audio.aria.volume"),class:"volume-slider-vertical vfp-absolute",style:{width:"80px",height:"24px",transform:"rotate(-90deg)","transform-origin":"center center"},onInput:z[6]||(z[6]=E=>T.unref(p)(parseFloat(E.target.value)))},null,40,Fp)]),T.createElementVNode("span",Dp,T.toDisplayString(Math.round((T.unref(n)?0:T.unref(e))*100)),1)])],32)):T.createCommentVNode("",!0)]),_:1})],544)])]),T.createElementVNode("audio",{ref_key:"audioRef",ref:d,src:C.url,class:"vfp-hidden"},null,8,Lp)]))}}),$p={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Vp={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Up={class:"vfp-text-white/70 vfp-text-center"},Hp={class:"vfp-text-lg"},Wp={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-p-4 md:vfp-p-8"},qp={class:"vfp-max-w-full md:vfp-max-w-4xl vfp-mx-auto vfp-bg-white"},Xp=["innerHTML"],Zp=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=T.ref(null),r=new pu({html:!1,linkify:!0,typographer:!1,breaks:!1});r.renderer.rules.fence=(f,p)=>{const u=f[p],m=(u.info?u.info.trim():"")||"text",v=u.content,S=btoa(unescape(encodeURIComponent(v))),R=t.value("markdown.copy_code");return`<div class="code-block-wrapper">
107
+ `,boxShadow:T.unref(l)?"0 0 36px rgba(129,140,248,0.1), 0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)":"0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)",animation:"vfp-vinyl-spin 8s linear infinite",animationPlayState:T.unref(l)?"running":"paused"})},[...z[7]||(z[7]=[T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"34%",height:"34%",top:"33%",left:"33%",background:"radial-gradient(circle at 40% 38%, #818cf8, #6366f1, #4f46e5, #4338ca)",boxShadow:"inset 0 1px 3px rgba(255,255,255,0.25), inset 0 -1px 3px rgba(0,0,0,0.3), 0 0 8px rgba(0,0,0,0.3)"}},[T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"14%",height:"14%",top:"43%",left:"43%",background:"radial-gradient(circle at 40% 40%, #333, #0d0d0d)",boxShadow:"inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)"}})],-1)])],4),T.createElementVNode("div",{class:"vfp-absolute",style:T.normalizeStyle({top:"-6px",right:"2px",width:"100px",height:"120px",transformOrigin:"76px 16px",zIndex:5,transform:T.unref(l)?"rotate(16deg)":"rotate(0deg)",transition:"transform 0.8s cubic-bezier(0.4, 0, 0.2, 1)"})},[...z[8]||(z[8]=[T.createStaticVNode('<svg width="100" height="120" viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="76" cy="16" r="13" fill="rgba(0,0,0,0.3)"></circle><circle cx="76" cy="16" r="11" fill="url(#vfp-baseGrad)"></circle><circle cx="76" cy="16" r="6" fill="url(#vfp-baseInnerGrad)"></circle><circle cx="76" cy="16" r="2.5" fill="#222" stroke="#555" stroke-width="0.5"></circle><path d="M74 22 L56 88" stroke="url(#vfp-armGrad)" stroke-width="3.5" stroke-linecap="round"></path><rect x="50" y="86" width="12" height="7" rx="1.5" fill="url(#vfp-headGrad)"></rect><rect x="52.5" y="92" width="7" height="9" rx="1" fill="url(#vfp-cartridgeGrad)"></rect><line x1="56" y1="101" x2="56" y2="105" stroke="#bbb" stroke-width="1.2" stroke-linecap="round"></line><circle cx="56" cy="105.5" r="0.8" fill="#ddd"></circle><defs><radialGradient id="vfp-baseGrad" cx="40%" cy="35%"><stop offset="0%" stop-color="#555"></stop><stop offset="100%" stop-color="#1a1a1a"></stop></radialGradient><radialGradient id="vfp-baseInnerGrad" cx="40%" cy="35%"><stop offset="0%" stop-color="#666"></stop><stop offset="100%" stop-color="#333"></stop></radialGradient><linearGradient id="vfp-armGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#555"></stop><stop offset="50%" stop-color="#444"></stop><stop offset="100%" stop-color="#333"></stop></linearGradient><linearGradient id="vfp-headGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#555"></stop><stop offset="100%" stop-color="#333"></stop></linearGradient><linearGradient id="vfp-cartridgeGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#444"></stop><stop offset="100%" stop-color="#222"></stop></linearGradient></defs></svg>',1)])],4)]),T.createElementVNode("div",_p,[T.createElementVNode("div",xp,T.toDisplayString(C.fileName),1),z[9]||(z[9]=T.createElementVNode("p",{class:"vfp-text-xs vfp-tracking-widest vfp-uppercase",style:{color:"rgba(129,140,248,0.5)"}},"Audio",-1))]),T.createElementVNode("div",kp,[T.createElementVNode("div",Sp,[T.createElementVNode("div",Ep,[z[10]||(z[10]=T.createElementVNode("div",{class:"vfp-absolute vfp-w-full vfp-h-[5px] vfp-rounded-full",style:{background:"rgba(255,255,255,0.08)"}},null,-1)),T.createElementVNode("div",{class:"vfp-absolute vfp-h-[5px] vfp-rounded-full vfp-pointer-events-none",style:T.normalizeStyle({width:`${I.value*100}%`,background:"linear-gradient(90deg, #6366f1, #818cf8)",boxShadow:T.unref(l)?"0 0 8px rgba(129,140,248,0.4)":"none",transition:"width 0.1s linear"})},null,4),T.createElementVNode("input",{type:"range",min:"0",max:T.unref(r)>0?T.unref(r):T.unref(o)||100,step:"any",value:T.unref(o),disabled:T.unref(r)<=0,"aria-label":T.unref(h)("audio.aria.progress"),class:"audio-slider vfp-absolute vfp-w-full",onInput:z[0]||(z[0]=E=>T.unref(s)(parseFloat(E.target.value)))},null,40,Cp)]),T.createElementVNode("div",Tp,[T.createElementVNode("span",Mp,T.toDisplayString(T.unref(m)(T.unref(o))),1),T.createElementVNode("span",Ap,T.toDisplayString(T.unref(r)>0?T.unref(m)(T.unref(r)):"--:--"),1)])]),T.createElementVNode("div",Rp,[T.createElementVNode("button",{class:"vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:T.normalizeStyle({background:T.unref(i)?"rgba(129,140,248,0.15)":"rgba(255,255,255,0.06)",color:T.unref(i)?"#818cf8":"rgba(224,223,240,0.4)",border:0,cursor:"pointer"}),"aria-label":T.unref(i)?T.unref(h)("audio.aria.loop_off"):T.unref(h)("audio.aria.loop_on"),onClick:z[1]||(z[1]=(...E)=>T.unref(g)&&T.unref(g)(...E))},[T.createVNode(T.unref(Ot.Repeat),{class:"vfp-w-4 vfp-h-4"})],12,Np),T.createElementVNode("button",{class:"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(224,223,240,0.7)",border:0,cursor:"pointer"},"aria-label":T.unref(h)("audio.aria.backward_10"),onClick:z[2]||(z[2]=E=>T.unref(f)(-10))},[T.createVNode(T.unref(Ot.SkipBack),{class:"vfp-w-[18px] vfp-h-[18px]"})],8,Op),T.createElementVNode("button",{class:"vfp-w-14 vfp-h-14 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center",style:{background:"linear-gradient(135deg, #818cf8, #6366f1)",color:"#fff",boxShadow:"0 4px 20px rgba(99,102,241,0.35)",border:0,cursor:"pointer"},"aria-label":T.unref(l)?T.unref(h)("audio.aria.pause"):T.unref(h)("audio.aria.play"),onClick:z[3]||(z[3]=(...E)=>T.unref(a)&&T.unref(a)(...E))},[T.unref(l)?(T.openBlock(),T.createBlock(T.unref(Ot.Pause),{key:0,class:"vfp-w-6 vfp-h-6"})):(T.openBlock(),T.createBlock(T.unref(Ot.Play),{key:1,class:"vfp-w-6 vfp-h-6 vfp-ml-0.5"}))],8,jp),T.createElementVNode("button",{class:"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:{background:"rgba(255,255,255,0.06)",color:"rgba(224,223,240,0.7)",border:0,cursor:"pointer"},"aria-label":T.unref(h)("audio.aria.forward_10"),onClick:z[4]||(z[4]=E=>T.unref(f)(10))},[T.createVNode(T.unref(Ot.SkipForward),{class:"vfp-w-[18px] vfp-h-[18px]"})],8,Ip),T.createElementVNode("div",{ref_key:"volumeRef",ref:R,class:"vfp-relative",onMouseenter:L,onMouseleave:$},[T.createElementVNode("button",{class:"vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors",style:T.normalizeStyle({background:v.value?"rgba(129,140,248,0.15)":"rgba(255,255,255,0.06)",color:"rgba(129,140,248,0.6)",border:0,cursor:"pointer"}),"aria-label":T.unref(n)?T.unref(h)("audio.aria.unmute"):T.unref(h)("audio.aria.mute"),onClick:z[5]||(z[5]=(...E)=>T.unref(u)&&T.unref(u)(...E))},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(F.value),{class:"vfp-w-4 vfp-h-4"}))],12,Bp),T.createVNode(T.Transition,{name:"vfp-fade"},{default:T.withCtx(()=>[v.value?(T.openBlock(),T.createElementBlock("div",{key:0,class:"vfp-absolute vfp-bottom-full vfp-mb-2 vfp-rounded-xl vfp-p-3 vfp-border",style:{left:"50%",marginLeft:"-27px",background:"rgba(20,20,20,0.95)",backdropFilter:"blur(16px)",borderColor:"rgba(129,140,248,0.15)"},onMouseenter:L,onMouseleave:$},[T.createElementVNode("div",Pp,[T.createElementVNode("div",Fp,[z[11]||(z[11]=T.createElementVNode("div",{class:"vfp-absolute vfp-rounded-full",style:{width:"3px",height:"100%",background:"rgba(255,255,255,0.1)"}},null,-1)),T.createElementVNode("div",{class:"vfp-absolute vfp-bottom-0 vfp-rounded-full vfp-pointer-events-none",style:T.normalizeStyle({width:"3px",height:`${(T.unref(n)?0:T.unref(e))*100}%`,background:"#818cf8",transition:"height 0.1s linear"})},null,4),T.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01",value:T.unref(n)?0:T.unref(e),"aria-label":T.unref(h)("audio.aria.volume"),class:"volume-slider-vertical vfp-absolute",style:{width:"80px",height:"24px",transform:"rotate(-90deg)","transform-origin":"center center"},onInput:z[6]||(z[6]=E=>T.unref(p)(parseFloat(E.target.value)))},null,40,Dp)]),T.createElementVNode("span",Lp,T.toDisplayString(Math.round((T.unref(n)?0:T.unref(e))*100)),1)])],32)):T.createCommentVNode("",!0)]),_:1})],544)])]),T.createElementVNode("audio",{ref_key:"audioRef",ref:d,src:C.url,class:"vfp-hidden"},null,8,zp)]))}}),Vp={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Up={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Hp={class:"vfp-text-white/70 vfp-text-center"},Wp={class:"vfp-text-lg"},qp={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-p-4 md:vfp-p-8"},Xp={class:"vfp-max-w-full md:vfp-max-w-4xl vfp-mx-auto vfp-bg-white"},Zp=["innerHTML"],Gp=T.defineComponent({__name:"index",props:{url:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=T.ref(null),r=new pu({html:!1,linkify:!0,typographer:!1,breaks:!1});r.renderer.rules.fence=(f,p)=>{const u=f[p],m=(u.info?u.info.trim():"")||"text",v=u.content,S=btoa(unescape(encodeURIComponent(v))),R=t.value("markdown.copy_code");return`<div class="code-block-wrapper">
108
108
  <div class="code-block-header">
109
109
  <span>${m}</span>
110
110
  <button class="code-copy-btn" type="button" data-code="${S}" title="${R}">${R}</button>
111
111
  </div>
112
112
  <pre data-shiki-pending="1" data-lang="${m}"><code>${r.utils.escapeHtml(v)}</code></pre>
113
- </div>`};const e=r.renderer.rules.table_open||((f,p,u,g,m)=>m.renderToken(f,p,u));r.renderer.rules.table_open=(f,p,u,g,m)=>'<div class="table-wrapper">'+e(f,p,u,g,m);const n=r.renderer.rules.table_close||((f,p,u,g,m)=>m.renderToken(f,p,u));r.renderer.rules.table_close=(f,p,u,g,m)=>n(f,p,u,g,m)+"</div>";const c=async()=>{l.value=!0,i.value=null;try{const f=await ki(w.url);h.value=f,d.value=r.render(f)}catch(f){console.error(f),i.value=t.value("markdown.load_failed")}finally{l.value=!1}},a=async()=>{if(!o.value)return;const f=o.value.querySelectorAll('pre[data-shiki-pending="1"]');for(const p of f){const u=p.getAttribute("data-lang")||"text",g=p.querySelector("code"),m=(g==null?void 0:g.textContent)||"";try{const v=await ra.codeToHtml(m,{lang:u,theme:"github-light"});p.outerHTML=v}catch{p.removeAttribute("data-shiki-pending")}}},s=async f=>{const p=f.target.closest(".code-copy-btn");if(!p)return;f.preventDefault();const u=p.getAttribute("data-code")||"";try{const g=decodeURIComponent(escape(atob(u)));await navigator.clipboard.writeText(g);const m=p.textContent;p.textContent=t.value("markdown.copied"),setTimeout(()=>{p.textContent=m},2e3)}catch{}};return T.onMounted(()=>{document.addEventListener("click",s)}),T.onBeforeUnmount(()=>{document.removeEventListener("click",s)}),T.watch(()=>w.url,c,{immediate:!0}),T.watch(d,async()=>{d.value&&(await T.nextTick(),a())}),(f,p)=>l.value?(T.openBlock(),T.createElementBlock("div",$p,[...p[0]||(p[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",Vp,[T.createElementVNode("div",Up,[T.createElementVNode("p",Hp,T.toDisplayString(i.value),1)])])):(T.openBlock(),T.createElementBlock("div",Wp,[T.createElementVNode("div",qp,[T.createElementVNode("div",{ref_key:"containerRef",ref:o,class:"markdown-body vfp-p-6 md:vfp-p-10",innerHTML:d.value},null,8,Xp)])]))}}),Gp=Er(Zp,[["__scopeId","data-v-3ae21e99"]]),Kp={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Yp={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Jp={class:"vfp-text-white/70 vfp-text-center"},Qp={class:"vfp-text-lg"},tm={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-3 vfp-pr-4",style:{background:"#1e1e1e"}},em=T.defineComponent({name:"JsonRenderer"});function rm(C){return C===null?T.h("span",{class:"json-null"},"null"):C===void 0?T.h("span",{class:"json-null"},"undefined"):typeof C=="boolean"?T.h("span",{class:"json-bool"},String(C)):typeof C=="number"?T.h("span",{class:"json-number"},String(C)):typeof C=="string"?T.h("span",{class:"json-string"},`"${C}"`):T.h("span",{class:"json-bracket"},String(C))}function Pa(C,w,t,h){return T.h("div",{class:"json-row",style:{paddingLeft:`${t}px`}},[T.h("span",{class:"json-arrow-placeholder"}),C!==void 0?T.h("span",{class:"json-key"},[`"${C}"`,T.h("span",{class:"json-colon"},": ")]):null,h?T.h("span",{class:"json-bracket"},h):rm(w)])}const Io=T.defineComponent({name:"JsonNode",props:{keyName:{type:String,default:void 0},value:{type:null,required:!0},depth:{type:Number,required:!0},defaultExpanded:{type:Boolean,default:!1}},setup(C){const w=T.ref(C.defaultExpanded),t=()=>{w.value=!w.value},h=T.inject(ao,null),d=T.computed(()=>(h==null?void 0:h.t.value)??oa({locale:"zh-CN"}));return{expanded:w,toggle:t,tFunc:d}},render(){const{keyName:C,value:w,depth:t,expanded:h,toggle:d,tFunc:l}=this,i=t*20;if(w==null||typeof w!="object")return Pa(C,w,i);const o=Array.isArray(w),e=(o?w:Object.entries(w)).length,n=o?"[":"{",c=o?"]":"}";if(e===0)return Pa(C,null,i,`${n}${c}`);const a=[];return a.push(T.h("div",{class:"json-row json-toggle",style:{paddingLeft:`${i}px`},onClick:d},[T.h("span",{class:"json-arrow"},[T.h(h?Ot.ChevronDown:Ot.ChevronRight,{class:"vfp-w-3.5 vfp-h-3.5"})]),C!==void 0?T.h("span",{class:"json-key"},[`"${C}"`,T.h("span",{class:"json-colon"},": ")]):null,T.h("span",{class:"json-bracket"},n),h?null:T.h("span",{class:"json-collapsed"},[o?`${e} ${l("json.items")}`:`${e} ${l("json.keys")}`,T.h("span",{class:"json-bracket"},` ${c}`)])])),h&&(o?w.forEach((s,f)=>{a.push(T.h(Io,{key:f,value:s,depth:t+1,defaultExpanded:t<1}))}):Object.entries(w).forEach(([s,f])=>{a.push(T.h(Io,{key:s,keyName:s,value:f,depth:t+1,defaultExpanded:t<1}))}),a.push(T.h("div",{class:"json-row",style:{paddingLeft:`${i+20}px`}},[T.h("span",{class:"json-bracket"},c)]))),T.h("div",null,a)}}),nm=T.defineComponent({...em,props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(null),d=T.ref(!0),l=T.ref(null),i=async()=>{d.value=!0,l.value=null;try{const o=await ki(w.url);h.value=JSON.parse(o)}catch(o){console.error(o),l.value=t.value("json.load_failed")}finally{d.value=!1}};return T.watch(()=>w.url,i,{immediate:!0}),(o,r)=>d.value?(T.openBlock(),T.createElementBlock("div",Kp,[...r[0]||(r[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.value?(T.openBlock(),T.createElementBlock("div",Yp,[T.createElementVNode("div",Jp,[T.createElementVNode("p",Qp,T.toDisplayString(l.value),1)])])):(T.openBlock(),T.createElementBlock("div",tm,[T.createVNode(T.unref(Io),{value:h.value,depth:0,"default-expanded":!0},null,8,["value"])]))}}),im=Er(nm,[["__scopeId","data-v-6417b14e"]]),sm={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},om={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},am={class:"vfp-text-white/70 vfp-text-center"},lm={class:"vfp-text-lg"},cm={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-p-4 md:vfp-p-8"},um={class:"vfp-max-w-full md:vfp-max-w-6xl vfp-mx-auto vfp-bg-white/5 vfp-backdrop-blur-sm vfp-rounded-2xl vfp-border vfp-border-white/10 vfp-overflow-hidden"},fm={class:"vfp-flex vfp-items-center vfp-gap-2 md:vfp-gap-3 vfp-px-4 vfp-py-3 md:vfp-px-6 md:vfp-py-4 vfp-bg-white/5 vfp-border-b vfp-border-white/10"},hm={class:"vfp-text-white vfp-font-medium vfp-text-sm md:vfp-text-base vfp-truncate"},dm={class:"vfp-ml-auto vfp-text-xs vfp-text-white/50 vfp-uppercase vfp-flex-shrink-0"},pm={class:"vfp-overflow-auto vfp-text-sm vfp-text-white/90"},mm={class:"csv-table"},gm={key:0},bm=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(!0),l=T.ref(null),i=async()=>{d.value=!0,l.value=null;try{h.value=await ki(w.url)}catch(c){console.error(c),l.value=t.value("csv.load_failed")}finally{d.value=!1}};T.watch(()=>w.url,i,{immediate:!0});const o=T.computed(()=>{if(!h.value)return null;try{return xu(h.value,{delimiter:_u(w.fileName)})}catch(c){return console.error(c),null}}),r=T.computed(()=>{var c;return((c=o.value)==null?void 0:c.delimiter)===" "?"TSV":"CSV"}),e=T.computed(()=>o.value?Array.from({length:o.value.columnCount},(c,a)=>a):[]),n=T.computed(()=>{var c;return!!((c=o.value)!=null&&c.header.length)});return(c,a)=>d.value?(T.openBlock(),T.createElementBlock("div",sm,[...a[0]||(a[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.value||!o.value?(T.openBlock(),T.createElementBlock("div",om,[T.createElementVNode("div",am,[T.createElementVNode("p",lm,T.toDisplayString(l.value||T.unref(t)("csv.parse_failed")),1)])])):(T.openBlock(),T.createElementBlock("div",cm,[T.createElementVNode("div",um,[T.createElementVNode("div",fm,[T.createVNode(T.unref(Ot.FileSpreadsheet),{class:"vfp-w-4 vfp-h-4 md:vfp-w-5 md:vfp-h-5 vfp-text-white/70 vfp-flex-shrink-0"}),T.createElementVNode("span",hm,T.toDisplayString(C.fileName),1),T.createElementVNode("span",dm,T.toDisplayString(r.value)+" · "+T.toDisplayString(o.value.rows.length)+" rows · "+T.toDisplayString(o.value.columnCount)+" cols ",1)]),T.createElementVNode("div",pm,[T.createElementVNode("table",mm,[n.value?(T.openBlock(),T.createElementBlock("thead",gm,[T.createElementVNode("tr",null,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(e.value,s=>(T.openBlock(),T.createElementBlock("th",{key:"h-"+s},T.toDisplayString(o.value.header[s]??""),1))),128))])])):T.createCommentVNode("",!0),T.createElementVNode("tbody",null,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(o.value.rows,(s,f)=>(T.openBlock(),T.createElementBlock("tr",{key:"r-"+f,class:T.normalizeClass({odd:f%2===1})},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(e.value,p=>(T.openBlock(),T.createElementBlock("td",{key:"c-"+f+"-"+p},T.toDisplayString(s[p]??""),1))),128))],2))),128))])])])])]))}}),vm=Er(bm,[["__scopeId","data-v-fe9d478c"]]),ym={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},wm={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},_m={class:"vfp-text-white/70 vfp-text-center"},xm={class:"vfp-text-lg"},km={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-p-4 md:vfp-p-8"},Sm={class:"vfp-max-w-full md:vfp-max-w-6xl vfp-mx-auto vfp-bg-white/5 vfp-backdrop-blur-sm vfp-rounded-2xl vfp-border vfp-border-white/10 vfp-overflow-hidden"},Em={class:"vfp-flex vfp-items-center vfp-gap-2 md:vfp-gap-3 vfp-px-4 vfp-py-3 md:vfp-px-6 md:vfp-py-4 vfp-bg-white/5 vfp-border-b vfp-border-white/10"},Cm={class:"vfp-text-white vfp-font-medium vfp-text-sm md:vfp-text-base vfp-truncate"},Tm={class:"vfp-text-sm"},Mm={key:0,class:"vfp-p-6 vfp-text-white/90 vfp-font-mono vfp-whitespace-pre-wrap vfp-break-words"},Am=["innerHTML"],Rm=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=n=>{const c=" ",a=/(>)(<)(\/*)/g,s=n.replace(a,`$1
113
+ </div>`};const e=r.renderer.rules.table_open||((f,p,u,g,m)=>m.renderToken(f,p,u));r.renderer.rules.table_open=(f,p,u,g,m)=>'<div class="table-wrapper">'+e(f,p,u,g,m);const n=r.renderer.rules.table_close||((f,p,u,g,m)=>m.renderToken(f,p,u));r.renderer.rules.table_close=(f,p,u,g,m)=>n(f,p,u,g,m)+"</div>";const c=async()=>{l.value=!0,i.value=null;try{const f=await ki(w.url);h.value=f,d.value=r.render(f)}catch(f){console.error(f),i.value=t.value("markdown.load_failed")}finally{l.value=!1}},a=async()=>{if(!o.value)return;const f=o.value.querySelectorAll('pre[data-shiki-pending="1"]');for(const p of f){const u=p.getAttribute("data-lang")||"text",g=p.querySelector("code"),m=(g==null?void 0:g.textContent)||"";try{const v=await ra.codeToHtml(m,{lang:u,theme:"github-light"});p.outerHTML=v}catch{p.removeAttribute("data-shiki-pending")}}},s=async f=>{const p=f.target.closest(".code-copy-btn");if(!p)return;f.preventDefault();const u=p.getAttribute("data-code")||"";try{const g=decodeURIComponent(escape(atob(u)));await navigator.clipboard.writeText(g);const m=p.textContent;p.textContent=t.value("markdown.copied"),setTimeout(()=>{p.textContent=m},2e3)}catch{}};return T.onMounted(()=>{document.addEventListener("click",s)}),T.onBeforeUnmount(()=>{document.removeEventListener("click",s)}),T.watch(()=>w.url,c,{immediate:!0}),T.watch(d,async()=>{d.value&&(await T.nextTick(),a())}),(f,p)=>l.value?(T.openBlock(),T.createElementBlock("div",Vp,[...p[0]||(p[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",Up,[T.createElementVNode("div",Hp,[T.createElementVNode("p",Wp,T.toDisplayString(i.value),1)])])):(T.openBlock(),T.createElementBlock("div",qp,[T.createElementVNode("div",Xp,[T.createElementVNode("div",{ref_key:"containerRef",ref:o,class:"markdown-body vfp-p-6 md:vfp-p-10",innerHTML:d.value},null,8,Zp)])]))}}),Kp=Ir(Gp,[["__scopeId","data-v-3ae21e99"]]),Yp={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Jp={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},Qp={class:"vfp-text-white/70 vfp-text-center"},tm={class:"vfp-text-lg"},em={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-3 vfp-pr-4",style:{background:"#1e1e1e"}},rm=T.defineComponent({name:"JsonRenderer"});function nm(C){return C===null?T.h("span",{class:"json-null"},"null"):C===void 0?T.h("span",{class:"json-null"},"undefined"):typeof C=="boolean"?T.h("span",{class:"json-bool"},String(C)):typeof C=="number"?T.h("span",{class:"json-number"},String(C)):typeof C=="string"?T.h("span",{class:"json-string"},`"${C}"`):T.h("span",{class:"json-bracket"},String(C))}function Pa(C,w,t,h){return T.h("div",{class:"json-row",style:{paddingLeft:`${t}px`}},[T.h("span",{class:"json-arrow-placeholder"}),C!==void 0?T.h("span",{class:"json-key"},[`"${C}"`,T.h("span",{class:"json-colon"},": ")]):null,h?T.h("span",{class:"json-bracket"},h):nm(w)])}const Io=T.defineComponent({name:"JsonNode",props:{keyName:{type:String,default:void 0},value:{type:null,required:!0},depth:{type:Number,required:!0},defaultExpanded:{type:Boolean,default:!1}},setup(C){const w=T.ref(C.defaultExpanded),t=()=>{w.value=!w.value},h=T.inject(ao,null),d=T.computed(()=>(h==null?void 0:h.t.value)??oa({locale:"zh-CN"}));return{expanded:w,toggle:t,tFunc:d}},render(){const{keyName:C,value:w,depth:t,expanded:h,toggle:d,tFunc:l}=this,i=t*20;if(w==null||typeof w!="object")return Pa(C,w,i);const o=Array.isArray(w),e=(o?w:Object.entries(w)).length,n=o?"[":"{",c=o?"]":"}";if(e===0)return Pa(C,null,i,`${n}${c}`);const a=[];return a.push(T.h("div",{class:"json-row json-toggle",style:{paddingLeft:`${i}px`},onClick:d},[T.h("span",{class:"json-arrow"},[T.h(h?Ot.ChevronDown:Ot.ChevronRight,{class:"vfp-w-3.5 vfp-h-3.5"})]),C!==void 0?T.h("span",{class:"json-key"},[`"${C}"`,T.h("span",{class:"json-colon"},": ")]):null,T.h("span",{class:"json-bracket"},n),h?null:T.h("span",{class:"json-collapsed"},[o?`${e} ${l("json.items")}`:`${e} ${l("json.keys")}`,T.h("span",{class:"json-bracket"},` ${c}`)])])),h&&(o?w.forEach((s,f)=>{a.push(T.h(Io,{key:f,value:s,depth:t+1,defaultExpanded:t<1}))}):Object.entries(w).forEach(([s,f])=>{a.push(T.h(Io,{key:s,keyName:s,value:f,depth:t+1,defaultExpanded:t<1}))}),a.push(T.h("div",{class:"json-row",style:{paddingLeft:`${i+20}px`}},[T.h("span",{class:"json-bracket"},c)]))),T.h("div",null,a)}}),im=T.defineComponent({...rm,props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(null),d=T.ref(!0),l=T.ref(null),i=async()=>{d.value=!0,l.value=null;try{const o=await ki(w.url);h.value=JSON.parse(o)}catch(o){console.error(o),l.value=t.value("json.load_failed")}finally{d.value=!1}};return T.watch(()=>w.url,i,{immediate:!0}),(o,r)=>d.value?(T.openBlock(),T.createElementBlock("div",Yp,[...r[0]||(r[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.value?(T.openBlock(),T.createElementBlock("div",Jp,[T.createElementVNode("div",Qp,[T.createElementVNode("p",tm,T.toDisplayString(l.value),1)])])):(T.openBlock(),T.createElementBlock("div",em,[T.createVNode(T.unref(Io),{value:h.value,depth:0,"default-expanded":!0},null,8,["value"])]))}}),sm=Ir(im,[["__scopeId","data-v-6417b14e"]]),om={class:"vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full"},am={key:0,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},lm={class:"vfp-text-center"},cm={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/70 vfp-font-medium"},um={key:1,class:"vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/50 vfp-backdrop-blur-sm vfp-z-10 vfp-rounded-xl md:vfp-rounded-2xl"},fm={class:"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4"},hm={class:"vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-green-500 vfp-via-emerald-500 vfp-to-teal-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl"},dm={class:"vfp-text-lg md:vfp-text-xl vfp-text-white/90 vfp-mb-2 md:vfp-mb-3 vfp-font-medium"},pm={class:"vfp-text-xs md:vfp-text-sm vfp-text-white/60 vfp-mb-4 md:vfp-mb-6"},mm=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(!0),d=T.ref(null),l=T.ref(null);let i=null,o=null,r=null,e={width:0,height:0};const n=()=>{if(!l.value)return{width:800,height:600};const s=l.value.clientWidth,f=l.value.clientHeight,p=s>100?s:800,u=f>100?f:600;return{width:p,height:u}},c=()=>{if(!l.value||!i)return;l.value.innerHTML="";const{width:s,height:f}=n(),p=s<640;new Ml(l.value,{mode:"read",showToolbar:!1,showContextmenu:!1,showGrid:!0,row:{len:100,height:25},col:{len:26,width:p?80:100,indexWidth:p?40:60,minWidth:p?40:60},view:{height:()=>f,width:()=>s}}).loadData(i)},a=async()=>{if(l.value){h.value=!0,d.value=null;try{const s=await ki(w.url),f=xu(s,{delimiter:_u(w.fileName)});i=qu(f.header,f.rows,w.fileName),c(),h.value=!1}catch(s){console.error("CSV 解析错误:",s),d.value=t.value("csv.load_failed"),h.value=!1}}};return T.onMounted(()=>{if(!l.value)return;let s=!0;o=new ResizeObserver(()=>{if(s){s=!1,e=n();return}const f=n(),p=Math.abs(e.width-f.width),u=Math.abs(e.height-f.height);p<10&&u<10||(e=f,r!==null&&clearTimeout(r),r=window.setTimeout(()=>{i&&c()},500))}),o.observe(l.value),setTimeout(()=>{requestAnimationFrame(()=>a())},100)}),T.watch(()=>w.url,()=>{a()}),T.onBeforeUnmount(()=>{o&&o.disconnect(),r!==null&&clearTimeout(r),i=null,l.value&&(l.value.innerHTML="")}),(s,f)=>(T.openBlock(),T.createElementBlock("div",om,[h.value?(T.openBlock(),T.createElementBlock("div",am,[T.createElementVNode("div",lm,[f[0]||(f[0]=T.createElementVNode("div",{class:"vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)),T.createElementVNode("p",cm,T.toDisplayString(T.unref(t)("csv.loading")),1)])])):T.createCommentVNode("",!0),d.value&&!h.value?(T.openBlock(),T.createElementBlock("div",um,[T.createElementVNode("div",fm,[T.createElementVNode("div",hm,[T.createVNode(T.unref(Ot.FileSpreadsheet),{class:"vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-white"})]),T.createElementVNode("p",dm,T.toDisplayString(T.unref(t)("csv.load_failed")),1),T.createElementVNode("p",pm,T.toDisplayString(d.value),1)])])):T.createCommentVNode("",!0),d.value?T.createCommentVNode("",!0):(T.openBlock(),T.createElementBlock("div",{key:2,ref_key:"containerRef",ref:l,class:"xlsx-spreadsheet-container vfp-w-full vfp-h-full",style:T.normalizeStyle({opacity:h.value?0:1})},null,4))]))}}),gm={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},bm={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},vm={class:"vfp-text-white/70 vfp-text-center"},ym={class:"vfp-text-lg"},wm={key:2,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"#1e1e1e"}},_m={key:0,class:"vfp-p-6 vfp-text-white/90 vfp-font-mono vfp-text-sm vfp-whitespace-pre-wrap vfp-break-words"},xm=["innerHTML"],km=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=n=>{const c=" ",a=/(>)(<)(\/*)/g,s=n.replace(a,`$1
114
114
  $2$3`);let f=0;return s.split(`
115
115
  `).map(p=>{let u=0;/^<\/\w/.test(p)?f=Math.max(f-1,0):/^<\w[^>]*[^/]>.*$/.test(p)&&!/<.+<\/.+>$/.test(p)&&(u=1);const g=c.repeat(f)+p;return f+=u,g}).join(`
116
- `)},r=n=>{try{const a=new DOMParser().parseFromString(n,"application/xml");if(a.querySelector("parsererror"))return n;const f=new XMLSerializer().serializeToString(a);return o(f)}catch{return n}},e=async()=>{l.value=!0,i.value=null;try{const n=await ki(w.url);h.value=r(n);try{d.value=await ra.codeToHtml(h.value,{lang:"xml",theme:"dark-plus"})}catch{d.value=""}}catch(n){console.error(n),i.value=t.value("xml.load_failed")}finally{l.value=!1}};return T.watch(()=>w.url,e,{immediate:!0}),(n,c)=>l.value?(T.openBlock(),T.createElementBlock("div",ym,[...c[0]||(c[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",wm,[T.createElementVNode("div",_m,[T.createElementVNode("p",xm,T.toDisplayString(i.value),1)])])):(T.openBlock(),T.createElementBlock("div",km,[T.createElementVNode("div",Sm,[T.createElementVNode("div",Em,[T.createVNode(T.unref(Ot.Code),{class:"vfp-w-4 vfp-h-4 md:vfp-w-5 md:vfp-h-5 vfp-text-white/70 vfp-flex-shrink-0"}),T.createElementVNode("span",Cm,T.toDisplayString(C.fileName),1),c[1]||(c[1]=T.createElementVNode("span",{class:"vfp-ml-auto vfp-text-xs vfp-text-white/50 vfp-uppercase vfp-flex-shrink-0"},"XML",-1))]),T.createElementVNode("div",Tm,[d.value?(T.openBlock(),T.createElementBlock("div",{key:1,class:"shiki-wrapper",innerHTML:d.value},null,8,Am)):(T.openBlock(),T.createElementBlock("pre",Mm,T.toDisplayString(h.value),1))])])]))}}),Nm=Er(Rm,[["__scopeId","data-v-21dc7ce6"]]),Om={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-bg-[#0f0f12]"},jm={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-bg-[#0f0f12]"},Im={class:"vfp-text-white/70 vfp-text-center"},Bm={class:"vfp-text-lg"},Pm={class:"content-scroll"},Fm={class:"timeline"},Dm={class:"cues"},Lm={class:"cue-meta"},zm={class:"cue-time"},$m={class:"cue-time"},Vm={class:"cue-id"},Um={key:0,class:"cue-style"},Hm={key:0,class:"cue-words"},Wm=["title"],qm={class:"cue-word-time"},Xm={class:"cue-word-text"},Zm={class:"status-pill"},Gm=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(!0),l=T.ref(null),i={srt:"srt",vtt:"vtt",lrc:"lrc",elrc:"elrc",ass:"ass",ssa:"ssa",ttml:"ttml",dfxp:"ttml"},o=s=>{var p;const f=((p=s.split(".").pop())==null?void 0:p.toLowerCase())||"";return i[f]},r=async()=>{d.value=!0,l.value=null;try{h.value=await ki(w.url)}catch(s){console.error(s),l.value=t.value("subtitle.load_failed")}finally{d.value=!1}};T.watch(()=>w.url,r,{immediate:!0});const e=T.computed(()=>{if(!h.value)return null;try{return Au(h.value,o(w.fileName))}catch(s){return console.error(s),null}}),n=T.computed(()=>{var s,f;return((s=e.value)==null?void 0:s.format)==="lrc"||((f=e.value)==null?void 0:f.format)==="elrc"}),c=T.computed(()=>{var s;return((s=e.value)==null?void 0:s.metadata)??{}}),a=s=>_s(s).slice(3,8);return(s,f)=>d.value?(T.openBlock(),T.createElementBlock("div",Om,[...f[0]||(f[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.value||!e.value?(T.openBlock(),T.createElementBlock("div",jm,[T.createElementVNode("div",Im,[T.createElementVNode("p",Bm,T.toDisplayString(l.value||T.unref(t)("subtitle.parse_failed")),1)])])):(T.openBlock(),T.createElementBlock("div",{key:2,class:T.normalizeClass(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]",n.value?"flavor-lyric":"flavor-subtitle"])},[T.createElementVNode("div",Pm,[T.createElementVNode("div",Fm,[f[3]||(f[3]=T.createElementVNode("div",{class:"timeline-line"},null,-1)),T.createElementVNode("ol",Dm,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(e.value.cues,(p,u)=>(T.openBlock(),T.createElementBlock("li",{key:"cue-"+u,class:"cue-row"},[f[2]||(f[2]=T.createElementVNode("div",{class:"cue-dot"},null,-1)),T.createElementVNode("div",Lm,[T.createElementVNode("span",zm,T.toDisplayString(T.unref(_s)(p.start)),1),f[1]||(f[1]=T.createElementVNode("span",{class:"cue-arrow"},"→",-1)),T.createElementVNode("span",$m,T.toDisplayString(T.unref(_s)(p.end)),1),T.createElementVNode("span",Vm,"#"+T.toDisplayString(p.id??u+1),1),p.style?(T.openBlock(),T.createElementBlock("span",Um,T.toDisplayString(p.style),1)):T.createCommentVNode("",!0)]),p.words&&p.words.length>0?(T.openBlock(),T.createElementBlock("div",Hm,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(p.words,(g,m)=>(T.openBlock(),T.createElementBlock("span",{key:"w-"+m,class:"cue-word",title:T.unref(_s)(g.start)},[T.createElementVNode("span",qm,T.toDisplayString(a(g.start)),1),T.createElementVNode("span",Xm,T.toDisplayString(g.text),1)],8,Wm))),128))])):(T.openBlock(),T.createElementBlock("p",{key:1,class:T.normalizeClass(["cue-text",{lyric:n.value}])},T.toDisplayString(p.text),3))]))),128))])])]),T.createElementVNode("div",Zm,[T.createElementVNode("span",null,T.toDisplayString(e.value.cues.length)+" "+T.toDisplayString(n.value?T.unref(t)("subtitle.lines"):T.unref(t)("subtitle.cues")),1),c.value.length?(T.openBlock(),T.createElementBlock(T.Fragment,{key:0},[f[4]||(f[4]=T.createElementVNode("span",{class:"dot"},"·",-1)),T.createElementVNode("span",null,T.toDisplayString(c.value.length),1)],64)):T.createCommentVNode("",!0)])],2))}}),Km=Er(Gm,[["__scopeId","data-v-1ebcbb6d"]]),Ym={class:"vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden"},Jm=T.defineComponent({name:"ResizableSplit",__name:"ResizableSplit",props:{initialLeftWidth:{default:280},minLeftWidth:{default:160},maxLeftWidth:{default:640},minRightWidth:{default:200},storageKey:{},desktopMedia:{default:"(min-width: 768px)"}},setup(C){const w=C,t=T.ref(null),h=T.ref((()=>{if(w.storageKey&&typeof window<"u"){const a=Number(window.localStorage.getItem(w.storageKey));if(!isNaN(a)&&a>0)return a}return w.initialLeftWidth})()),d=T.ref(!1),l=T.ref(!1);let i=null;const o=()=>{i&&(l.value=i.matches)},r=T.computed(()=>l.value?{width:`${h.value}px`}:void 0),e=a=>{if(!t.value)return;const s=t.value.getBoundingClientRect(),f=a.clientX-s.left,p=s.width-w.minRightWidth-6,u=Math.min(w.maxLeftWidth,p);h.value=Math.max(w.minLeftWidth,Math.min(u,f))},n=()=>{if(d.value&&(d.value=!1,window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n),document.body.style.cursor="",document.body.style.userSelect="",w.storageKey))try{window.localStorage.setItem(w.storageKey,String(h.value))}catch{}},c=a=>{a.preventDefault(),d.value=!0,window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),document.body.style.cursor="col-resize",document.body.style.userSelect="none"};return T.onMounted(()=>{typeof window<"u"&&(i=window.matchMedia(w.desktopMedia),o(),i.addEventListener("change",o))}),T.onBeforeUnmount(()=>{i&&i.removeEventListener("change",o),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n),d.value&&(document.body.style.cursor="",document.body.style.userSelect="")}),T.watch(()=>w.initialLeftWidth,a=>{w.storageKey||(h.value=a)}),(a,s)=>(T.openBlock(),T.createElementBlock("div",{ref_key:"containerRef",ref:t,class:"vfp-w-full vfp-h-full vfp-flex vfp-flex-col md:vfp-flex-row vfp-min-h-0 vfp-min-w-0"},[T.createElementVNode("div",{class:"vfp-min-h-0 vfp-min-w-0 vfp-flex-shrink-0 vfp-w-full vfp-max-h-60 md:vfp-h-full md:vfp-max-h-none",style:T.normalizeStyle(r.value)},[T.renderSlot(a.$slots,"left",{},void 0,!0)],4),T.createElementVNode("div",{role:"separator","aria-orientation":"vertical",class:T.normalizeClass(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors",d.value?"dragging":""]),onMousedown:c},[...s[0]||(s[0]=[T.createElementVNode("span",{class:"vfp-absolute vfp-inset-y-0 hit-area"},null,-1)])],34),T.createElementVNode("div",Ym,[T.renderSlot(a.$slots,"right",{},void 0,!0)])],512))}}),Qm=Er(Jm,[["__scopeId","data-v-790c366f"]]),t0={key:0},e0={class:"vfp-truncate vfp-flex-1 vfp-min-w-0"},r0={class:"vfp-flex-1 vfp-truncate vfp-min-w-0"},n0={class:"vfp-text-xs vfp-text-white/30 vfp-flex-shrink-0 vfp-ml-2"},i0={name:"ZipTreeItem"},s0=T.defineComponent({...i0,props:{node:{},depth:{},selectedPath:{},expanded:{}},emits:["toggle","select","hover","leave"],setup(C,{emit:w}){const t=C,h=w,d=T.computed(()=>({paddingLeft:`${t.depth*14+10}px`})),l=T.computed(()=>t.expanded.has(t.node.path)),i=T.computed(()=>t.selectedPath===t.node.path),o=T.computed(()=>{const n=na({name:t.node.name,type:""});return n==="image"?Ot.FileImage:n==="text"||n==="markdown"||n==="json"||n==="csv"||n==="xml"||n==="subtitle"?t.node.name.endsWith(".md")||t.node.name.endsWith(".markdown")?Ot.FileText:Ot.FileCode:Ot.File}),r=n=>{const c=n.currentTarget.getBoundingClientRect();h("hover",t.node.name||"/",c)},e=()=>h("leave");return(n,c)=>{const a=T.resolveComponent("ZipTreeItem");return C.node.isDir?(T.openBlock(),T.createElementBlock("div",t0,[T.createElementVNode("button",{type:"button",class:"tree-row dir-row",style:T.normalizeStyle(d.value),onClick:c[0]||(c[0]=s=>h("toggle",C.node.path)),onMouseenter:r,onMouseleave:e},[T.createVNode(T.unref(Ot.ChevronRight),{class:T.normalizeClass(["vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0 vfp-transition-transform",{"vfp-rotate-90":l.value}])},null,8,["class"]),(T.openBlock(),T.createBlock(T.resolveDynamicComponent(l.value?T.unref(Ot.FolderOpen):T.unref(Ot.Folder)),{class:"vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80"})),T.createElementVNode("span",e0,T.toDisplayString(C.node.name||"/"),1)],36),l.value&&C.node.children?(T.openBlock(!0),T.createElementBlock(T.Fragment,{key:0},T.renderList(C.node.children,s=>(T.openBlock(),T.createBlock(a,{key:s.path,node:s,depth:C.depth+1,"selected-path":C.selectedPath,expanded:C.expanded,onToggle:c[1]||(c[1]=f=>h("toggle",f)),onSelect:c[2]||(c[2]=f=>h("select",f)),onHover:c[3]||(c[3]=(f,p)=>h("hover",f,p)),onLeave:c[4]||(c[4]=f=>h("leave"))},null,8,["node","depth","selected-path","expanded"]))),128)):T.createCommentVNode("",!0)])):(T.openBlock(),T.createElementBlock("button",{key:1,type:"button",class:T.normalizeClass(["tree-row file-row",{selected:i.value}]),style:T.normalizeStyle(d.value),onClick:c[5]||(c[5]=s=>h("select",C.node)),onMouseenter:r,onMouseleave:e},[c[6]||(c[6]=T.createElementVNode("span",{class:"vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0"},null,-1)),(T.openBlock(),T.createBlock(T.resolveDynamicComponent(o.value),{class:"vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-white/50"})),T.createElementVNode("span",r0,T.toDisplayString(C.node.name),1),T.createElementVNode("span",n0,T.toDisplayString(T.unref(ia)(C.node.size)),1)],38))}}}),o0=Er(s0,[["__scopeId","data-v-5385318d"]]),a0={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},l0={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},c0={class:"vfp-text-white/70 vfp-text-center"},u0={class:"vfp-text-lg"},f0={class:"vfp-w-full vfp-h-full vfp-overflow-auto"},h0={class:"vfp-w-full vfp-h-full vfp-flex vfp-flex-col"},d0={key:0,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/40 vfp-text-sm vfp-p-6"},p0={key:1,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center"},m0={key:2,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70"},g0={key:3,class:"vfp-flex-1 vfp-min-h-0 vfp-overflow-hidden vfp-flex"},b0=T.defineComponent({__name:"index",props:{url:{},nestingDepth:{default:0}},emits:["statsChange"],setup(C,{emit:w}){const t=T.defineAsyncComponent(()=>Promise.resolve().then(()=>K0)),h=C,d=w,{t:l}=Te(),i=T.ref(null),o=T.ref(null),r=T.ref(!0),e=T.ref(null),n=T.ref(new Set([""])),c=T.ref(null),a=T.ref(!1),s=T.ref(null),f=T.ref(null),p=()=>{var F;(F=c.value)!=null&&F.blobUrl&&URL.revokeObjectURL(c.value.blobUrl)},u=async()=>{p(),c.value=null,r.value=!0,e.value=null;try{const F=await fetch(h.url);if(!F.ok)throw new Error("加载失败");const j=await F.arrayBuffer(),L=await Ru(j),$=Nu(L),V=Ou($);i.value=L,o.value=V;const z=new Set([""]);if(V.children)for(const E of V.children)E.isDir&&z.add(E.path);n.value=z}catch(F){console.error(F),e.value=l.value("zip.load_failed")}finally{r.value=!1}};T.watch(()=>h.url,u,{immediate:!0}),T.onBeforeUnmount(()=>{p()});const g=T.computed(()=>{if(!o.value)return null;let F=0,j=0,L=0;const $=V=>{var z;V.isDir?(V.path&&j++,(z=V.children)==null||z.forEach($)):(F++,L+=V.size)};return $(o.value),{files:F,dirs:j,size:L}});T.watch(g,F=>d("statsChange",F),{immediate:!0}),T.onBeforeUnmount(()=>d("statsChange",null));const m=F=>{const j=new Set(n.value);j.has(F)?j.delete(F):j.add(F),n.value=j},v=(F,j)=>{f.value={text:F,x:j.right+8,y:j.top+j.height/2}},S=()=>{f.value=null},R=async F=>{if(!(!i.value||F.isDir)){p(),a.value=!0,s.value=null;try{const j=Oi(F.name),L=await ju(i.value,F.path,j!=="application/octet-stream"?j:void 0),$=URL.createObjectURL(L);c.value={path:F.path,name:F.name,size:F.size,blobUrl:$}}catch(j){console.error(j),s.value="条目读取失败"}finally{a.value=!1}}},I=T.computed(()=>c.value?[{name:c.value.name,url:c.value.blobUrl,type:Oi(c.value.name)}]:[]);return(F,j)=>r.value?(T.openBlock(),T.createElementBlock("div",a0,[...j[0]||(j[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):e.value||!o.value?(T.openBlock(),T.createElementBlock("div",l0,[T.createElementVNode("div",c0,[T.createElementVNode("p",u0,T.toDisplayString(e.value||T.unref(l)("zip.parse_failed")),1)])])):(T.openBlock(),T.createElementBlock(T.Fragment,{key:2},[T.createVNode(Qm,{"initial-left-width":280,"min-left-width":180,"max-left-width":560,"storage-key":"vfp-zip-split-left"},{left:T.withCtx(()=>[T.createElementVNode("div",f0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(o.value.children||[],L=>{var $;return T.openBlock(),T.createBlock(o0,{key:L.path,node:L,depth:0,"selected-path":(($=c.value)==null?void 0:$.path)??null,expanded:n.value,onToggle:m,onSelect:R,onHover:v,onLeave:S},null,8,["node","selected-path","expanded"])}),128))])]),right:T.withCtx(()=>[T.createElementVNode("div",h0,[c.value?a.value?(T.openBlock(),T.createElementBlock("div",p0,[...j[1]||(j[1]=[T.createElementVNode("div",{class:"vfp-w-8 vfp-h-8 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):s.value?(T.openBlock(),T.createElementBlock("div",m0,T.toDisplayString(s.value),1)):(T.openBlock(),T.createElementBlock("div",g0,[T.createVNode(T.unref(t),{mode:"embed",files:I.value,"current-index":0,"zip-nesting-depth":C.nestingDepth+1},null,8,["files","zip-nesting-depth"])])):(T.openBlock(),T.createElementBlock("div",d0," 从左侧选择一个文件以预览 "))])]),_:1}),(T.openBlock(),T.createBlock(T.Teleport,{to:"body"},[f.value?(T.openBlock(),T.createElementBlock("div",{key:0,class:"vfp-zip-tip",style:T.normalizeStyle({left:f.value.x+"px",top:f.value.y+"px"})},T.toDisplayString(f.value.text),5)):T.createCommentVNode("",!0)]))],64))}}),v0={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},y0={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},w0={class:"vfp-text-white/70 vfp-text-center"},_0={class:"vfp-text-lg"},x0={key:2,class:"vfp-w-full vfp-h-full vfp-bg-white"},k0=["srcdoc","title"],S0={key:3,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"#1e1e1e"}},E0=["innerHTML"],C0=T.defineComponent({__name:"index",props:{url:{},fileName:{},wordWrap:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=T.computed(()=>yu(w.fileName)),r=async()=>{l.value=!0,i.value=null;try{const e=await ki(w.url);if(h.value=e,o.value!=="text")try{d.value=await ra.codeToHtml(e,{lang:o.value,theme:"dark-plus"})}catch{d.value=""}else d.value=""}catch(e){console.error(e),i.value=t.value("text.load_failed")}finally{l.value=!1}};return T.watch(()=>w.url,r,{immediate:!0}),(e,n)=>l.value?(T.openBlock(),T.createElementBlock("div",v0,[...n[0]||(n[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",y0,[T.createElementVNode("div",w0,[T.createElementVNode("p",_0,T.toDisplayString(i.value),1)])])):C.htmlPreview&&o.value==="html"?(T.openBlock(),T.createElementBlock("div",x0,[T.createElementVNode("iframe",{srcdoc:h.value,sandbox:"allow-same-origin",class:"vfp-w-full vfp-h-full vfp-border-0",title:C.fileName},null,8,k0)])):(T.openBlock(),T.createElementBlock("div",S0,[d.value?(T.openBlock(),T.createElementBlock("div",{key:1,class:T.normalizeClass(["shiki-wrapper",{"no-wrap":!C.wordWrap}]),innerHTML:d.value},null,10,E0)):(T.openBlock(),T.createElementBlock("pre",{key:0,class:T.normalizeClass(["vfp-p-6 vfp-text-white/90 vfp-font-mono vfp-text-sm",C.wordWrap?"vfp-whitespace-pre-wrap vfp-break-words":"vfp-whitespace-pre"])},T.toDisplayString(h.value),3))]))}}),T0=Er(C0,[["__scopeId","data-v-82d3d091"]]),M0={class:"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-8 vfp-gap-6"},A0={class:"vfp-w-32 vfp-h-32 vfp-rounded-full vfp-bg-white/10 vfp-flex vfp-items-center vfp-justify-center"},R0={class:"vfp-text-white vfp-text-center"},N0={class:"vfp-text-xl vfp-font-medium vfp-mb-2"},O0={class:"vfp-text-white/70"},Fa=T.defineComponent({__name:"index",props:{fileName:{},fileType:{}},emits:["download"],setup(C,{emit:w}){const{t}=Te(),h=w;return(d,l)=>(T.openBlock(),T.createElementBlock("div",M0,[T.createElementVNode("div",A0,[T.createVNode(T.unref(Ot.FileQuestion),{class:"vfp-w-16 vfp-h-16 vfp-text-white/70"})]),T.createElementVNode("div",R0,[T.createElementVNode("p",N0,T.toDisplayString(C.fileName),1),T.createElementVNode("p",O0,T.toDisplayString(T.unref(t)("common.unsupported_preview",{type:C.fileType})),1)]),T.createElementVNode("button",{class:"vfp-flex vfp-items-center vfp-gap-2 vfp-px-6 vfp-py-3 vfp-bg-white/10 hover:vfp-bg-white/20 vfp-backdrop-blur-sm vfp-rounded-lg vfp-text-white vfp-font-medium vfp-transition-all",onClick:l[0]||(l[0]=i=>h("download"))},[T.createVNode(T.unref(Ot.Download),{class:"vfp-w-5 vfp-h-5"}),T.createTextVNode(" "+T.toDisplayString(T.unref(t)("common.download")),1)])]))}}),j0=["tabindex"],I0={class:"vfp-flex-shrink-0 vfp-z-10 vfp-bg-black/50 vfp-backdrop-blur-md vfp-border-b vfp-border-white/10",style:{"padding-top":"env(safe-area-inset-top, 0px)"}},B0={class:"vfp-flex vfp-items-center vfp-justify-between vfp-px-3 md:vfp-px-5 vfp-py-1.5 md:vfp-py-2.5"},P0={class:"vfp-flex vfp-items-center vfp-flex-1 vfp-min-w-0 vfp-mr-2 md:vfp-mr-3"},F0={class:"vfp-text-white/90 vfp-font-medium vfp-text-xs md:vfp-text-sm vfp-truncate"},D0={class:"vfp-text-white/40 vfp-text-xs vfp-ml-2 vfp-flex-shrink-0"},L0={class:"vfp-flex vfp-items-center vfp-gap-1 md:vfp-hidden vfp-flex-shrink-0"},z0=["data-tooltip","disabled","onClick"],$0={class:"vfp-hidden md:vfp-flex vfp-items-center vfp-gap-1 vfp-flex-shrink-0"},V0=["data-tooltip","disabled","onClick"],U0=["data-tooltip","disabled","onClick"],H0={key:0,class:"vfp-flex vfp-items-center vfp-gap-1 vfp-px-3 vfp-pb-1.5 vfp-overflow-x-auto scrollbar-hide md:vfp-hidden"},W0={key:0,class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-0.5"},q0=["data-tooltip","disabled","onClick"],X0=3,Z0=2e3,G0=T.defineComponent({__name:"FilePreviewContent",props:{files:{},currentIndex:{},customRenderers:{default:()=>[]},mode:{default:"modal"},zipNestingDepth:{default:0},locale:{default:void 0},messages:{default:void 0}},emits:["navigate","close"],setup(C,{emit:w}){const t=C,h=w;Ol(T.toRef(t,"locale"),T.toRef(t,"messages"));const{t:d}=Te(),l=T.ref(1),i=T.ref(0),o=T.ref(1),r=T.ref(1),e=T.ref(0),n=T.ref(0),c=T.ref(0),a=T.ref(null),s=T.ref(null),f=T.ref(!0);let p=null;const u=()=>{f.value=!0,p!==null&&clearTimeout(p),p=window.setTimeout(()=>{f.value=!1},Z0)},g=()=>u(),m=T.computed(()=>Al(t.files)),v=T.computed(()=>m.value[t.currentIndex]),S=T.computed(()=>v.value&&t.customRenderers.find(rt=>rt.test(v.value))||null),R=T.computed(()=>!S.value||!v.value?null:S.value.render(v.value)),I=T.computed(()=>v.value?na(v.value):"unsupported");T.watch(()=>t.currentIndex,()=>{l.value=1,i.value=0,o.value=1,r.value=1,e.value=0,n.value=0,f.value=!0,p!==null&&clearTimeout(p)}),T.watch([I,e,n],()=>{if(I.value==="image"&&e.value>0&&n.value>0&&a.value){const rt=a.value.clientWidth,it=a.value.clientHeight,J=rt/e.value,et=it/n.value,nt=Math.min(J,et);l.value=Math.max(.01,Math.min(10,nt))}}),T.watch(()=>m.value.length,rt=>{rt>1&&u()},{immediate:!0});const F=rt=>{rt.key==="Escape"&&t.mode==="modal"?h("close"):rt.key==="ArrowLeft"&&t.currentIndex>0?h("navigate",t.currentIndex-1):rt.key==="ArrowRight"&&t.currentIndex<m.value.length-1&&h("navigate",t.currentIndex+1)};T.onMounted(()=>{t.mode==="modal"?window.addEventListener("keydown",F):s.value&&s.value.addEventListener("keydown",F)}),T.onBeforeUnmount(()=>{p!==null&&clearTimeout(p),t.mode==="modal"?window.removeEventListener("keydown",F):s.value&&s.value.removeEventListener("keydown",F)});const j=()=>{l.value=Math.min(l.value+.1,10)},L=()=>{l.value=Math.max(l.value-.1,.01)},$=()=>{i.value=i.value+90},V=()=>{i.value=i.value-90},z=()=>{if(a.value&&e.value>0&&n.value>0){const rt=a.value.clientWidth,it=a.value.clientHeight,J=rt/e.value,et=it/n.value,nt=Math.min(J,et);l.value=Math.max(.01,Math.min(10,nt))}else l.value=1;i.value=0,c.value++},E=()=>{l.value=1,i.value=0,c.value++},A=rt=>{l.value=rt},k=()=>{l.value=1,i.value=0,c.value++},b=()=>{if(!v.value)return;const rt=document.createElement("a");rt.href=v.value.url,rt.download=v.value.name,rt.click()},y=T.computed(()=>t.mode==="modal"),_=T.ref(null),x=T.ref(0),M=T.ref(0),B=T.ref(!1),P=T.ref(null),H=T.ref(0),W=T.ref(0),K=T.ref(!1),D=(rt,it)=>{x.value=rt,M.value=it},X=(rt,it)=>{H.value=rt,W.value=it},O=T.ref(null),N=rt=>{O.value=rt},U=T.ref(!0),q=T.ref(!1),Y=T.computed(()=>{var rt;if(I.value==="image")return Ju({zoom:l.value,onZoomIn:j,onZoomOut:L,onFitToWidth:z,onOriginalSize:E,onRotateLeft:V,onRotateRight:$,onReset:k,t:d.value});if(I.value==="pdf")return Qu({zoom:l.value,onZoomIn:j,onZoomOut:L,onReset:k,t:d.value});if(I.value==="epub")return tf({epubRef:_.value,current:x.value,total:M.value,fullWidth:B.value,t:d.value});if(I.value==="mobi")return ef({mobiRef:P.value,current:H.value,total:W.value,fullWidth:K.value,t:d.value});if(I.value==="zip")return rf({stats:O.value,t:d.value});if(I.value==="text"){const it=((rt=v.value.name.split(".").pop())==null?void 0:rt.toLowerCase())||"";return nf({wordWrap:U.value,onToggleWrap:()=>{U.value=!U.value},isHtml:it==="html"||it==="htm",htmlPreview:q.value,onToggleHtmlPreview:()=>{q.value=!q.value},t:d.value})}return[]}),G=T.computed(()=>{const rt=[{items:[{type:"button",icon:Ot.Download,tooltip:d.value("common.download"),action:b}]}];return y.value&&rt.push({items:[{type:"button",icon:Ot.X,tooltip:d.value("common.close"),action:()=>h("close")}]}),rt}),Q=T.computed(()=>Y.value.length>0);return(rt,it)=>{var J;return T.openBlock(),T.createElementBlock("div",{ref_key:"rootRef",ref:s,tabindex:C.mode==="embed"?0:-1,class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-flex-col vfp-overflow-hidden vfp-outline-none"},[T.createElementVNode("div",I0,[T.createElementVNode("div",B0,[T.createElementVNode("div",P0,[T.createElementVNode("h2",F0,T.toDisplayString((J=v.value)==null?void 0:J.name),1),T.createElementVNode("span",D0,T.toDisplayString(C.currentIndex+1)+"/"+T.toDisplayString(m.value.length),1)]),T.createElementVNode("div",L0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(G.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-action-"+nt},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-action-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,z0)):T.createCommentVNode("",!0)],64))),128))],64))),128))]),T.createElementVNode("div",$0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(Y.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-tool-"+nt},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-tool-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,V0)):ot.type==="text"?(T.openBlock(),T.createElementBlock("span",{key:1,class:"vfp-text-white/60 vfp-text-xs vfp-text-center vfp-font-medium vfp-tabular-nums",style:T.normalizeStyle({minWidth:ot.minWidth||"auto"})},T.toDisplayString(ot.content),5)):T.createCommentVNode("",!0)],64))),128)),it[11]||(it[11]=T.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1))],64))),128)),(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(G.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-action-"+nt},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-action-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,U0)):T.createCommentVNode("",!0)],64))),128))],64))),128))])]),Q.value?(T.openBlock(),T.createElementBlock("div",H0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(Y.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-tool-"+nt},[nt>0?(T.openBlock(),T.createElementBlock("div",W0)):T.createCommentVNode("",!0),(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-tool-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,q0)):ot.type==="text"?(T.openBlock(),T.createElementBlock("span",{key:1,class:"vfp-text-white/60 vfp-text-xs vfp-text-center vfp-font-medium vfp-tabular-nums",style:T.normalizeStyle({minWidth:ot.minWidth||"auto"})},T.toDisplayString(ot.content),5)):T.createCommentVNode("",!0)],64))),128))],64))),128))])):T.createCommentVNode("",!0)]),T.createElementVNode("div",{ref_key:"contentRef",ref:a,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-overflow-auto",onMousemove:g},[v.value?(T.openBlock(),T.createElementBlock(T.Fragment,{key:0},[R.value?(T.openBlock(),T.createBlock(T.resolveDynamicComponent(R.value),{key:0,file:v.value},null,8,["file"])):(T.openBlock(),T.createElementBlock(T.Fragment,{key:1},[I.value==="image"?(T.openBlock(),T.createBlock(uf,{key:0,url:v.value.url,zoom:l.value,rotation:i.value,"reset-key":c.value,"file-size":v.value.size,onZoomChange:A,onNaturalWidthChange:it[0]||(it[0]=et=>e.value=et),onNaturalHeightChange:it[1]||(it[1]=et=>n.value=et)},null,8,["url","zoom","rotation","reset-key","file-size"])):I.value==="pdf"?(T.openBlock(),T.createBlock(gf,{key:1,url:v.value.url,zoom:l.value,"current-page":o.value,onPageChange:it[2]||(it[2]=et=>o.value=et),onTotalPagesChange:it[3]||(it[3]=et=>r.value=et),onPageWidthChange:it[4]||(it[4]=et=>e.value=et)},null,8,["url","zoom","current-page"])):I.value==="docx"?(T.openBlock(),T.createBlock(Ef,{key:2,url:v.value.url},null,8,["url"])):I.value==="xlsx"?(T.openBlock(),T.createBlock(Lf,{key:3,url:v.value.url},null,8,["url"])):I.value==="pptx"?(T.openBlock(),T.createBlock(Kf,{key:4,url:v.value.url},null,8,["url"])):I.value==="msg"?(T.openBlock(),T.createBlock(sd,{key:5,url:v.value.url},null,8,["url"])):I.value==="epub"?(T.openBlock(),T.createBlock(gd,{key:6,ref_key:"epubRef",ref:_,url:v.value.url,onChapterChange:D,onFullWidthChange:it[5]||(it[5]=et=>B.value=et)},null,8,["url"])):I.value==="mobi"?(T.openBlock(),T.createBlock(np,{key:7,ref_key:"mobiRef",ref:P,url:v.value.url,onChapterChange:X,onFullWidthChange:it[6]||(it[6]=et=>K.value=et)},null,8,["url"])):I.value==="video"?(T.openBlock(),T.createBlock(dp,{key:8,url:v.value.url},null,8,["url"])):I.value==="audio"?(T.openBlock(),T.createBlock(zp,{key:9,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="markdown"?(T.openBlock(),T.createBlock(Gp,{key:10,url:v.value.url},null,8,["url"])):I.value==="json"?(T.openBlock(),T.createBlock(im,{key:11,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="csv"?(T.openBlock(),T.createBlock(vm,{key:12,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="xml"?(T.openBlock(),T.createBlock(Nm,{key:13,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="subtitle"?(T.openBlock(),T.createBlock(Km,{key:14,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="zip"&&t.zipNestingDepth>=X0?(T.openBlock(),T.createBlock(Fa,{key:15,"file-name":v.value.name,"file-type":v.value.type,onDownload:b},null,8,["file-name","file-type"])):I.value==="zip"?(T.openBlock(),T.createBlock(b0,{key:16,url:v.value.url,"nesting-depth":t.zipNestingDepth,onStatsChange:N},null,8,["url","nesting-depth"])):I.value==="text"?(T.openBlock(),T.createBlock(T0,{key:17,url:v.value.url,"file-name":v.value.name,"word-wrap":U.value,"html-preview":q.value},null,8,["url","file-name","word-wrap","html-preview"])):(T.openBlock(),T.createBlock(Fa,{key:18,"file-name":v.value.name,"file-type":v.value.type,onDownload:b},null,8,["file-name","file-type"]))],64))],64)):T.createCommentVNode("",!0)],544),m.value.length>1?(T.openBlock(),T.createElementBlock(T.Fragment,{key:0},[C.currentIndex>0?(T.openBlock(),T.createElementBlock("button",{key:0,style:T.normalizeStyle({opacity:f.value?1:0,transform:f.value?"translateY(-50%)":"translateY(-50%) translateX(-20px)",pointerEvents:f.value?"auto":"none",transition:"opacity 0.2s, transform 0.2s"}),class:"vfp-absolute vfp-z-20 vfp-left-2 md:vfp-left-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-bg-black/40 vfp-backdrop-blur-xl vfp-border vfp-border-white/10 vfp-flex vfp-items-center vfp-justify-center vfp-text-white hover:vfp-bg-black/60 vfp-transition-colors vfp-shadow-2xl",onClick:it[7]||(it[7]=et=>h("navigate",C.currentIndex-1)),onMouseenter:it[8]||(it[8]=et=>f.value=!0)},[T.createVNode(T.unref(Ot.ChevronLeft),{class:"vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6"})],36)):T.createCommentVNode("",!0),C.currentIndex<m.value.length-1?(T.openBlock(),T.createElementBlock("button",{key:1,style:T.normalizeStyle({opacity:f.value?1:0,transform:f.value?"translateY(-50%)":"translateY(-50%) translateX(20px)",pointerEvents:f.value?"auto":"none",transition:"opacity 0.2s, transform 0.2s"}),class:"vfp-absolute vfp-z-20 vfp-right-2 md:vfp-right-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-bg-black/40 vfp-backdrop-blur-xl vfp-border vfp-border-white/10 vfp-flex vfp-items-center vfp-justify-center vfp-text-white hover:vfp-bg-black/60 vfp-transition-colors vfp-shadow-2xl",onClick:it[9]||(it[9]=et=>h("navigate",C.currentIndex+1)),onMouseenter:it[10]||(it[10]=et=>f.value=!0)},[T.createVNode(T.unref(Ot.ChevronRight),{class:"vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6"})],36)):T.createCommentVNode("",!0)],64)):T.createCommentVNode("",!0)],8,j0)}}}),uo=Er(G0,[["__scopeId","data-v-829ecc7c"]]),K0=Object.freeze(Object.defineProperty({__proto__:null,default:uo},Symbol.toStringTag,{value:"Module"}));function Y0(C){let w="",t="",h=!1;const d=()=>{if(h||typeof document>"u")return;w=document.body.style.overflow,t=document.body.style.paddingRight;const i=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",i>0&&(document.body.style.paddingRight=`${i}px`),h=!0},l=()=>{!h||typeof document>"u"||(document.body.style.overflow=w,document.body.style.paddingRight=t,h=!1)};return T.onMounted(()=>{C()&&d()}),T.onUnmounted(()=>{l()}),{lock:d,unlock:l}}const J0={key:0,class:"vfp-root"},Q0=T.defineComponent({__name:"FilePreviewModal",props:{files:{},currentIndex:{},isOpen:{type:Boolean},customRenderers:{default:()=>[]},locale:{default:void 0},messages:{default:void 0}},emits:["close","navigate"],setup(C,{emit:w}){const t=C,h=w,{lock:d,unlock:l}=Y0(()=>t.isOpen);T.watch(()=>t.isOpen,e=>{e?d():l()});const i=()=>h("close"),o=e=>e.stopPropagation(),r=e=>e.stopPropagation();return(e,n)=>(T.openBlock(),T.createBlock(T.Teleport,{to:"body"},[T.createVNode(T.Transition,{name:"vfp-fade"},{default:T.withCtx(()=>[C.isOpen?(T.openBlock(),T.createElementBlock("div",J0,[T.createElementVNode("div",{class:"vfp-fixed vfp-inset-0 vfp-z-[9999] vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/80 vfp-backdrop-blur-md vfp-overflow-hidden",onClick:i,onWheel:r},[T.createElementVNode("div",{class:"vfp-relative vfp-w-full vfp-h-full",onClick:o},[T.createVNode(uo,{mode:"modal",files:C.files,"current-index":C.currentIndex,"custom-renderers":C.customRenderers,locale:C.locale,messages:C.messages,onClose:n[0]||(n[0]=c=>h("close")),onNavigate:n[1]||(n[1]=c=>h("navigate",c))},null,8,["files","current-index","custom-renderers","locale","messages"])])],32)])):T.createCommentVNode("",!0)]),_:1})]))}}),t1={class:"vfp-relative vfp-w-full vfp-h-full vfp-overflow-hidden vfp-bg-black/80"},e1=T.defineComponent({__name:"FilePreviewEmbed",props:{files:{},currentIndex:{default:0},customRenderers:{default:()=>[]},width:{default:"100%"},height:{default:"100%"},locale:{default:void 0},messages:{default:void 0}},emits:["navigate"],setup(C,{emit:w}){const t=C,h=w,d={width:typeof t.width=="number"?`${t.width}px`:t.width,height:typeof t.height=="number"?`${t.height}px`:t.height};return(l,i)=>(T.openBlock(),T.createElementBlock("div",{class:"vfp-root",style:d},[T.createElementVNode("div",t1,[T.createVNode(uo,{mode:"embed",files:C.files,"current-index":C.currentIndex,"custom-renderers":C.customRenderers,locale:C.locale,messages:C.messages,onNavigate:i[0]||(i[0]=o=>h("navigate",o))},null,8,["files","current-index","custom-renderers","locale","messages"])])]))}}),r1=bu.version,Qe=-2,_e=-3,Zr=-5,er=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],n1=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],i1=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],s1=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o1=[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,112,112],a1=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],l1=[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],Ss=15;function Bo(){let C,w,t,h,d,l;function i(r,e,n,c,a,s,f,p,u,g,m){let v,S,R,I,F,j,L,$,V,z,E,A,k,b,y;z=0,F=n;do t[r[e+z]]++,z++,F--;while(F!==0);if(t[0]==n)return f[0]=-1,p[0]=0,0;for($=p[0],j=1;j<=Ss&&t[j]===0;j++);for(L=j,$<j&&($=j),F=Ss;F!==0&&t[F]===0;F--);for(R=F,$>F&&($=F),p[0]=$,b=1<<j;j<F;j++,b<<=1)if((b-=t[j])<0)return _e;if((b-=t[F])<0)return _e;for(t[F]+=b,l[1]=j=0,z=1,k=2;--F!=0;)l[k]=j+=t[z],k++,z++;F=0,z=0;do(j=r[e+z])!==0&&(m[l[j]++]=F),z++;while(++F<n);for(n=l[R],l[0]=F=0,z=0,I=-1,A=-$,d[0]=0,E=0,y=0;L<=R;L++)for(v=t[L];v--!=0;){for(;L>A+$;){if(I++,A+=$,y=R-A,y=y>$?$:y,(S=1<<(j=L-A))>v+1&&(S-=v+1,k=L,j<y))for(;++j<y&&!((S<<=1)<=t[++k]);)S-=t[k];if(y=1<<j,g[0]+y>1440)return _e;d[I]=E=g[0],g[0]+=y,I!==0?(l[I]=F,h[0]=j,h[1]=$,j=F>>>A-$,h[2]=E-d[I-1]-j,u.set(h,3*(d[I-1]+j))):f[0]=E}for(h[1]=L-A,z>=n?h[0]=192:m[z]<c?(h[0]=m[z]<256?0:96,h[2]=m[z++]):(h[0]=s[m[z]-c]+16+64,h[2]=a[m[z++]-c]),S=1<<L-A,j=F>>>A;j<y;j+=S)u.set(h,3*(E+j));for(j=1<<L-1;F&j;j>>>=1)F^=j;for(F^=j,V=(1<<A)-1;(F&V)!=l[I];)I--,A-=$,V=(1<<A)-1}return b!==0&&R!=1?Zr:0}function o(r){let e;for(C||(C=[],w=[],t=new Int32Array(16),h=[],d=new Int32Array(Ss),l=new Int32Array(16)),w.length<r&&(w=[]),e=0;e<r;e++)w[e]=0;for(e=0;e<16;e++)t[e]=0;for(e=0;e<3;e++)h[e]=0;d.set(t.subarray(0,Ss),0),l.set(t.subarray(0,16),0)}this.inflate_trees_bits=function(r,e,n,c,a){let s;return o(19),C[0]=0,s=i(r,0,19,19,null,null,n,e,c,C,w),s==_e?a.msg="oversubscribed dynamic bit lengths tree":s!=Zr&&e[0]!==0||(a.msg="incomplete dynamic bit lengths tree",s=_e),s},this.inflate_trees_dynamic=function(r,e,n,c,a,s,f,p,u){let g;return o(288),C[0]=0,g=i(n,0,r,257,s1,o1,s,c,p,C,w),g!=0||c[0]===0?(g==_e?u.msg="oversubscribed literal/length tree":g!=-4&&(u.msg="incomplete literal/length tree",g=_e),g):(o(288),g=i(n,r,e,0,a1,l1,f,a,p,C,w),g!=0||a[0]===0&&r>257?(g==_e?u.msg="oversubscribed distance tree":g==Zr?(u.msg="incomplete distance tree",g=_e):g!=-4&&(u.msg="empty distance tree with lengths",g=_e),g):0)}}Bo.inflate_trees_fixed=function(C,w,t,h){return C[0]=9,w[0]=5,t[0]=n1,h[0]=i1,0};function c1(){const C=this;let w,t,h,d,l=0,i=0,o=0,r=0,e=0,n=0,c=0,a=0,s=0,f=0;function p(u,g,m,v,S,R,I,F){let j,L,$,V,z,E,A,k,b,y,_,x,M,B,P,H;A=F.next_in_index,k=F.avail_in,z=I.bitb,E=I.bitk,b=I.write,y=b<I.read?I.read-b-1:I.end-b,_=er[u],x=er[g];do{for(;E<20;)k--,z|=(255&F.read_byte(A++))<<E,E+=8;if(j=z&_,L=m,$=v,H=3*($+j),(V=L[H])!==0)for(;;){if(z>>=L[H+1],E-=L[H+1],16&V){for(V&=15,M=L[H+2]+(z&er[V]),z>>=V,E-=V;E<15;)k--,z|=(255&F.read_byte(A++))<<E,E+=8;for(j=z&x,L=S,$=R,H=3*($+j),V=L[H];;){if(z>>=L[H+1],E-=L[H+1],16&V){for(V&=15;E<V;)k--,z|=(255&F.read_byte(A++))<<E,E+=8;if(B=L[H+2]+(z&er[V]),z>>=V,E-=V,y-=M,b>=B)P=b-B,b-P>0&&2>b-P?(I.win[b++]=I.win[P++],I.win[b++]=I.win[P++],M-=2):(I.win.set(I.win.subarray(P,P+2),b),b+=2,P+=2,M-=2);else{P=b-B;do P+=I.end;while(P<0);if(V=I.end-P,M>V){if(M-=V,b-P>0&&V>b-P)do I.win[b++]=I.win[P++];while(--V!=0);else I.win.set(I.win.subarray(P,P+V),b),b+=V,P+=V,V=0;P=0}}if(b-P>0&&M>b-P)do I.win[b++]=I.win[P++];while(--M!=0);else I.win.set(I.win.subarray(P,P+M),b),b+=M,P+=M,M=0;break}if(64&V)return F.msg="invalid distance code",M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,_e;j+=L[H+2],j+=z&er[V],H=3*($+j),V=L[H]}break}if(64&V)return 32&V?(M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,1):(F.msg="invalid literal/length code",M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,_e);if(j+=L[H+2],j+=z&er[V],H=3*($+j),(V=L[H])===0){z>>=L[H+1],E-=L[H+1],I.win[b++]=L[H+2],y--;break}}else z>>=L[H+1],E-=L[H+1],I.win[b++]=L[H+2],y--}while(y>=258&&k>=10);return M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,0}C.init=function(u,g,m,v,S,R){w=0,c=u,a=g,h=m,s=v,d=S,f=R,t=null},C.proc=function(u,g,m){let v,S,R,I,F,j,L,$=0,V=0,z=0;for(z=g.next_in_index,I=g.avail_in,$=u.bitb,V=u.bitk,F=u.write,j=F<u.read?u.read-F-1:u.end-F;;)switch(w){case 0:if(j>=258&&I>=10&&(u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,m=p(c,a,h,s,d,f,u,g),z=g.next_in_index,I=g.avail_in,$=u.bitb,V=u.bitk,F=u.write,j=F<u.read?u.read-F-1:u.end-F,m!=0)){w=m==1?7:9;break}o=c,t=h,i=s,w=1;case 1:for(v=o;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}if(S=3*(i+($&er[v])),$>>>=t[S+1],V-=t[S+1],R=t[S],R===0){r=t[S+2],w=6;break}if(16&R){e=15&R,l=t[S+2],w=2;break}if(!(64&R)){o=R,i=S/3+t[S+2];break}if(32&R){w=7;break}return w=9,g.msg="invalid literal/length code",m=_e,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);case 2:for(v=e;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}l+=$&er[v],$>>=v,V-=v,o=a,t=d,i=f,w=3;case 3:for(v=o;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}if(S=3*(i+($&er[v])),$>>=t[S+1],V-=t[S+1],R=t[S],16&R){e=15&R,n=t[S+2],w=4;break}if(!(64&R)){o=R,i=S/3+t[S+2];break}return w=9,g.msg="invalid distance code",m=_e,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);case 4:for(v=e;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}n+=$&er[v],$>>=v,V-=v,w=5;case 5:for(L=F-n;L<0;)L+=u.end;for(;l!==0;){if(j===0&&(F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0&&(u.write=F,m=u.inflate_flush(g,m),F=u.write,j=F<u.read?u.read-F-1:u.end-F,F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0)))return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);u.win[F++]=u.win[L++],j--,L==u.end&&(L=0),l--}w=0;break;case 6:if(j===0&&(F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0&&(u.write=F,m=u.inflate_flush(g,m),F=u.write,j=F<u.read?u.read-F-1:u.end-F,F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0)))return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,u.win[F++]=r,j--,w=0;break;case 7:if(V>7&&(V-=8,I++,z--),u.write=F,m=u.inflate_flush(g,m),F=u.write,j=F<u.read?u.read-F-1:u.end-F,u.read!=u.write)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);w=8;case 8:return m=1,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);case 9:return m=_e,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);default:return m=Qe,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m)}},C.free=function(){}}const Da=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function u1(C,w){const t=this;let h,d=0,l=0,i=0,o=0;const r=[0],e=[0],n=new c1;let c=0,a=new Int32Array(4320);const s=new Bo;t.bitk=0,t.bitb=0,t.win=new Uint8Array(w),t.end=w,t.read=0,t.write=0,t.reset=function(f,p){p&&(p[0]=0),d==6&&n.free(f),d=0,t.bitk=0,t.bitb=0,t.read=t.write=0},t.reset(C,null),t.inflate_flush=function(f,p){let u,g,m;return g=f.next_out_index,m=t.read,u=(m<=t.write?t.write:t.end)-m,u>f.avail_out&&(u=f.avail_out),u!==0&&p==Zr&&(p=0),f.avail_out-=u,f.total_out+=u,f.next_out.set(t.win.subarray(m,m+u),g),g+=u,m+=u,m==t.end&&(m=0,t.write==t.end&&(t.write=0),u=t.write-m,u>f.avail_out&&(u=f.avail_out),u!==0&&p==Zr&&(p=0),f.avail_out-=u,f.total_out+=u,f.next_out.set(t.win.subarray(m,m+u),g),g+=u,m+=u),f.next_out_index=g,t.read=m,p},t.proc=function(f,p){let u,g,m,v,S,R,I,F;for(v=f.next_in_index,S=f.avail_in,g=t.bitb,m=t.bitk,R=t.write,I=R<t.read?t.read-R-1:t.end-R;;){let j,L,$,V,z,E,A,k;switch(d){case 0:for(;m<3;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}switch(u=7&g,c=1&u,u>>>1){case 0:g>>>=3,m-=3,u=7&m,g>>>=u,m-=u,d=1;break;case 1:j=[],L=[],$=[[]],V=[[]],Bo.inflate_trees_fixed(j,L,$,V),n.init(j[0],L[0],$[0],0,V[0],0),g>>>=3,m-=3,d=6;break;case 2:g>>>=3,m-=3,d=3;break;case 3:return g>>>=3,m-=3,d=9,f.msg="invalid block type",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p)}break;case 1:for(;m<32;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if((~g>>>16&65535)!=(65535&g))return d=9,f.msg="invalid stored block lengths",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);l=65535&g,g=m=0,d=l!==0?2:c!==0?7:0;break;case 2:if(S===0||I===0&&(R==t.end&&t.read!==0&&(R=0,I=R<t.read?t.read-R-1:t.end-R),I===0&&(t.write=R,p=t.inflate_flush(f,p),R=t.write,I=R<t.read?t.read-R-1:t.end-R,R==t.end&&t.read!==0&&(R=0,I=R<t.read?t.read-R-1:t.end-R),I===0)))return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);if(p=0,u=l,u>S&&(u=S),u>I&&(u=I),t.win.set(f.read_buf(v,u),R),v+=u,S-=u,R+=u,I-=u,(l-=u)!=0)break;d=c!==0?7:0;break;case 3:for(;m<14;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if(i=u=16383&g,(31&u)>29||(u>>5&31)>29)return d=9,f.msg="too many length or distance symbols",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);if(u=258+(31&u)+(u>>5&31),!h||h.length<u)h=[];else for(F=0;F<u;F++)h[F]=0;g>>>=14,m-=14,o=0,d=4;case 4:for(;o<4+(i>>>10);){for(;m<3;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}h[Da[o++]]=7&g,g>>>=3,m-=3}for(;o<19;)h[Da[o++]]=0;if(r[0]=7,u=s.inflate_trees_bits(h,r,e,a,f),u!=0)return(p=u)==_e&&(h=null,d=9),t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);o=0,d=5;case 5:for(;u=i,!(o>=258+(31&u)+(u>>5&31));){let b,y;for(u=r[0];m<u;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if(u=a[3*(e[0]+(g&er[u]))+1],y=a[3*(e[0]+(g&er[u]))+2],y<16)g>>>=u,m-=u,h[o++]=y;else{for(F=y==18?7:y-14,b=y==18?11:3;m<u+F;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if(g>>>=u,m-=u,b+=g&er[F],g>>>=F,m-=F,F=o,u=i,F+b>258+(31&u)+(u>>5&31)||y==16&&F<1)return h=null,d=9,f.msg="invalid bit length repeat",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);y=y==16?h[F-1]:0;do h[F++]=y;while(--b!=0);o=F}}if(e[0]=-1,z=[],E=[],A=[],k=[],z[0]=9,E[0]=6,u=i,u=s.inflate_trees_dynamic(257+(31&u),1+(u>>5&31),h,z,E,A,k,a,f),u!=0)return u==_e&&(h=null,d=9),p=u,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);n.init(z[0],E[0],a,A[0],a,k[0]),d=6;case 6:if(t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,(p=n.proc(t,f,p))!=1)return t.inflate_flush(f,p);if(p=0,n.free(f),v=f.next_in_index,S=f.avail_in,g=t.bitb,m=t.bitk,R=t.write,I=R<t.read?t.read-R-1:t.end-R,c===0){d=0;break}d=7;case 7:if(t.write=R,p=t.inflate_flush(f,p),R=t.write,I=R<t.read?t.read-R-1:t.end-R,t.read!=t.write)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);d=8;case 8:return p=1,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);case 9:return p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);default:return p=Qe,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p)}}},t.free=function(f){t.reset(f,null),t.win=null,a=null},t.set_dictionary=function(f,p,u){t.win.set(f.subarray(p,p+u),0),t.read=t.write=u},t.sync_point=function(){return d==1?1:0}}const Qr=13,f1=[0,0,255,255];function h1(){const C=this;function w(t){return t&&t.istate?(t.total_in=t.total_out=0,t.msg=null,t.istate.mode=7,t.istate.blocks.reset(t,null),0):Qe}C.mode=0,C.method=0,C.was=[0],C.need=0,C.marker=0,C.wbits=0,C.inflateEnd=function(t){return C.blocks&&C.blocks.free(t),C.blocks=null,0},C.inflateInit=function(t,h){return t.msg=null,C.blocks=null,h<8||h>15?(C.inflateEnd(t),Qe):(C.wbits=h,t.istate.blocks=new u1(t,1<<h),w(t),0)},C.inflate=function(t,h){let d,l;if(!t||!t.istate||!t.next_in)return Qe;const i=t.istate;for(h=h==4?Zr:0,d=Zr;;)switch(i.mode){case 0:if(t.avail_in===0)return d;if(d=h,t.avail_in--,t.total_in++,(15&(i.method=t.read_byte(t.next_in_index++)))!=8){i.mode=Qr,t.msg="unknown compression method",i.marker=5;break}if(8+(i.method>>4)>i.wbits){i.mode=Qr,t.msg="invalid win size",i.marker=5;break}i.mode=1;case 1:if(t.avail_in===0)return d;if(d=h,t.avail_in--,t.total_in++,l=255&t.read_byte(t.next_in_index++),((i.method<<8)+l)%31!=0){i.mode=Qr,t.msg="incorrect header check",i.marker=5;break}if(!(32&l)){i.mode=7;break}i.mode=2;case 2:if(t.avail_in===0)return d;d=h,t.avail_in--,t.total_in++,i.need=(255&t.read_byte(t.next_in_index++))<<24&4278190080,i.mode=3;case 3:if(t.avail_in===0)return d;d=h,t.avail_in--,t.total_in++,i.need+=(255&t.read_byte(t.next_in_index++))<<16&16711680,i.mode=4;case 4:if(t.avail_in===0)return d;d=h,t.avail_in--,t.total_in++,i.need+=(255&t.read_byte(t.next_in_index++))<<8&65280,i.mode=5;case 5:return t.avail_in===0?d:(d=h,t.avail_in--,t.total_in++,i.need+=255&t.read_byte(t.next_in_index++),i.mode=6,2);case 6:return i.mode=Qr,t.msg="need dictionary",i.marker=0,Qe;case 7:if(d=i.blocks.proc(t,d),d==_e){i.mode=Qr,i.marker=0;break}if(d==0&&(d=h),d!=1)return d;d=h,i.blocks.reset(t,i.was),i.mode=12;case 12:return t.avail_in=0,1;case Qr:return _e;default:return Qe}},C.inflateSetDictionary=function(t,h,d){let l=0,i=d;if(!t||!t.istate||t.istate.mode!=6)return Qe;const o=t.istate;return i>=1<<o.wbits&&(i=(1<<o.wbits)-1,l=d-i),o.blocks.set_dictionary(h,l,i),o.mode=7,0},C.inflateSync=function(t){let h,d,l,i,o;if(!t||!t.istate)return Qe;const r=t.istate;if(r.mode!=Qr&&(r.mode=Qr,r.marker=0),(h=t.avail_in)===0)return Zr;for(d=t.next_in_index,l=r.marker;h!==0&&l<4;)t.read_byte(d)==f1[l]?l++:l=t.read_byte(d)!==0?0:4-l,d++,h--;return t.total_in+=d-t.next_in_index,t.next_in_index=d,t.avail_in=h,r.marker=l,l!=4?_e:(i=t.total_in,o=t.total_out,w(t),t.total_in=i,t.total_out=o,r.mode=7,0)},C.inflateSyncPoint=function(t){return t&&t.istate&&t.istate.blocks?t.istate.blocks.sync_point():Qe}}function Kl(){}Kl.prototype={inflateInit(C){const w=this;return w.istate=new h1,C||(C=15),w.istate.inflateInit(w,C)},inflate(C){const w=this;return w.istate?w.istate.inflate(w,C):Qe},inflateEnd(){const C=this;if(!C.istate)return Qe;const w=C.istate.inflateEnd(C);return C.istate=null,w},inflateSync(){const C=this;return C.istate?C.istate.inflateSync(C):Qe},inflateSetDictionary(C,w){const t=this;return t.istate?t.istate.inflateSetDictionary(t,C,w):Qe},read_byte(C){return this.next_in[C]},read_buf(C,w){return this.next_in.subarray(C,C+w)}};const Un=4294967295,Nn=65535,La=33639248,za=101075792,Gn=22,Fe=void 0,wn="undefined",us="function";let $a=class{constructor(w){return class extends TransformStream{constructor(t,h){const d=new w(h);super({transform(l,i){i.enqueue(d.append(l))},flush(l){const i=d.flush();i&&l.enqueue(i)}})}}}},Yl=2;try{typeof navigator!=wn&&navigator.hardwareConcurrency&&(Yl=navigator.hardwareConcurrency)}catch{}const d1={chunkSize:524288,maxWorkers:Yl,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:Fe,CompressionStreamNative:typeof CompressionStream!=wn&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=wn&&DecompressionStream},nn=Object.assign({},d1);function Jl(C){const{baseURL:w,chunkSize:t,maxWorkers:h,terminateWorkerTimeout:d,useCompressionStream:l,useWebWorkers:i,Deflate:o,Inflate:r,CompressionStream:e,DecompressionStream:n,workerScripts:c}=C;if(tn("baseURL",w),tn("chunkSize",t),tn("maxWorkers",h),tn("terminateWorkerTimeout",d),tn("useCompressionStream",l),tn("useWebWorkers",i),o&&(nn.CompressionStream=new $a(o)),r&&(nn.DecompressionStream=new $a(r)),tn("CompressionStream",e),tn("DecompressionStream",n),c!==Fe){const{deflate:a,inflate:s}=c;if((a||s)&&(nn.workerScripts||(nn.workerScripts={})),a){if(!Array.isArray(a))throw new Error("workerScripts.deflate must be an array");nn.workerScripts.deflate=a}if(s){if(!Array.isArray(s))throw new Error("workerScripts.inflate must be an array");nn.workerScripts.inflate=s}}}function tn(C,w){w!==Fe&&(nn[C]=w)}const Ql=[];for(let C=0;C<256;C++){let w=C;for(let t=0;t<8;t++)1&w?w=w>>>1^3988292384:w>>>=1;Ql[C]=w}class Zs{constructor(w){this.crc=w||-1}append(w){let t=0|this.crc;for(let h=0,d=0|w.length;h<d;h++)t=t>>>8^Ql[255&(t^w[h])];this.crc=t}get(){return~this.crc}}class tc extends TransformStream{constructor(){let w;const t=new Zs;super({transform(h,d){t.append(h),d.enqueue(h)},flush(){const h=new Uint8Array(4);new DataView(h.buffer).setUint32(0,t.get()),w.value=h}}),w=this}}const qe={concat(C,w){if(C.length===0||w.length===0)return C.concat(w);const t=C[C.length-1],h=qe.getPartial(t);return h===32?C.concat(w):qe._shiftRight(w,h,0|t,C.slice(0,C.length-1))},bitLength(C){const w=C.length;if(w===0)return 0;const t=C[w-1];return 32*(w-1)+qe.getPartial(t)},clamp(C,w){if(32*C.length<w)return C;const t=(C=C.slice(0,Math.ceil(w/32))).length;return w&=31,t>0&&w&&(C[t-1]=qe.partial(w,C[t-1]&2147483648>>w-1,1)),C},partial:(C,w,t)=>C===32?w:(t?0|w:w<<32-C)+1099511627776*C,getPartial:C=>Math.round(C/1099511627776)||32,_shiftRight(C,w,t,h){for(h===void 0&&(h=[]);w>=32;w-=32)h.push(t),t=0;if(w===0)return h.concat(C);for(let i=0;i<C.length;i++)h.push(t|C[i]>>>w),t=C[i]<<32-w;const d=C.length?C[C.length-1]:0,l=qe.getPartial(d);return h.push(qe.partial(w+l&31,w+l>32?t:h.pop(),1)),h}},Gs={bytes:{fromBits(C){const w=qe.bitLength(C)/8,t=new Uint8Array(w);let h;for(let d=0;d<w;d++)3&d||(h=C[d/4]),t[d]=h>>>24,h<<=8;return t},toBits(C){const w=[];let t,h=0;for(t=0;t<C.length;t++)h=h<<8|C[t],3&~t||(w.push(h),h=0);return 3&t&&w.push(qe.partial(8*(3&t),h)),w}}},p1={sha1:class{constructor(C){const w=this;w.blockSize=512,w._init=[1732584193,4023233417,2562383102,271733878,3285377520],w._key=[1518500249,1859775393,2400959708,3395469782],C?(w._h=C._h.slice(0),w._buffer=C._buffer.slice(0),w._length=C._length):w.reset()}reset(){const C=this;return C._h=C._init.slice(0),C._buffer=[],C._length=0,C}update(C){const w=this;typeof C=="string"&&(C=Gs.utf8String.toBits(C));const t=w._buffer=qe.concat(w._buffer,C),h=w._length,d=w._length=h+qe.bitLength(C);if(d>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const l=new Uint32Array(t);let i=0;for(let o=w.blockSize+h-(w.blockSize+h&w.blockSize-1);o<=d;o+=w.blockSize)w._block(l.subarray(16*i,16*(i+1))),i+=1;return t.splice(0,16*i),w}finalize(){const C=this;let w=C._buffer;const t=C._h;w=qe.concat(w,[qe.partial(1,1)]);for(let h=w.length+2;15&h;h++)w.push(0);for(w.push(Math.floor(C._length/4294967296)),w.push(0|C._length);w.length;)C._block(w.splice(0,16));return C.reset(),t}_f(C,w,t,h){return C<=19?w&t|~w&h:C<=39?w^t^h:C<=59?w&t|w&h|t&h:C<=79?w^t^h:void 0}_S(C,w){return w<<C|w>>>32-C}_block(C){const w=this,t=w._h,h=Array(80);for(let e=0;e<16;e++)h[e]=C[e];let d=t[0],l=t[1],i=t[2],o=t[3],r=t[4];for(let e=0;e<=79;e++){e>=16&&(h[e]=w._S(1,h[e-3]^h[e-8]^h[e-14]^h[e-16]));const n=w._S(5,d)+w._f(e,l,i,o)+r+h[e]+w._key[Math.floor(e/20)]|0;r=o,o=i,i=w._S(30,l),l=d,d=n}t[0]=t[0]+d|0,t[1]=t[1]+l|0,t[2]=t[2]+i|0,t[3]=t[3]+o|0,t[4]=t[4]+r|0}}},m1={aes:class{constructor(C){const w=this;w._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],w._tables[0][0][0]||w._precompute();const t=w._tables[0][4],h=w._tables[1],d=C.length;let l,i,o,r=1;if(d!==4&&d!==6&&d!==8)throw new Error("invalid aes key size");for(w._key=[i=C.slice(0),o=[]],l=d;l<4*d+28;l++){let e=i[l-1];(l%d==0||d===8&&l%d==4)&&(e=t[e>>>24]<<24^t[e>>16&255]<<16^t[e>>8&255]<<8^t[255&e],l%d==0&&(e=e<<8^e>>>24^r<<24,r=r<<1^283*(r>>7))),i[l]=i[l-d]^e}for(let e=0;l;e++,l--){const n=i[3&e?l:l-4];o[e]=l<=4||e<4?n:h[0][t[n>>>24]]^h[1][t[n>>16&255]]^h[2][t[n>>8&255]]^h[3][t[255&n]]}}encrypt(C){return this._crypt(C,0)}decrypt(C){return this._crypt(C,1)}_precompute(){const C=this._tables[0],w=this._tables[1],t=C[4],h=w[4],d=[],l=[];let i,o,r,e;for(let n=0;n<256;n++)l[(d[n]=n<<1^283*(n>>7))^n]=n;for(let n=i=0;!t[n];n^=o||1,i=l[i]||1){let c=i^i<<1^i<<2^i<<3^i<<4;c=c>>8^255&c^99,t[n]=c,h[c]=n,e=d[r=d[o=d[n]]];let a=16843009*e^65537*r^257*o^16843008*n,s=257*d[c]^16843008*c;for(let f=0;f<4;f++)C[f][n]=s=s<<24^s>>>8,w[f][c]=a=a<<24^a>>>8}for(let n=0;n<5;n++)C[n]=C[n].slice(0),w[n]=w[n].slice(0)}_crypt(C,w){if(C.length!==4)throw new Error("invalid aes block size");const t=this._key[w],h=t.length/4-2,d=[0,0,0,0],l=this._tables[w],i=l[0],o=l[1],r=l[2],e=l[3],n=l[4];let c,a,s,f=C[0]^t[0],p=C[w?3:1]^t[1],u=C[2]^t[2],g=C[w?1:3]^t[3],m=4;for(let v=0;v<h;v++)c=i[f>>>24]^o[p>>16&255]^r[u>>8&255]^e[255&g]^t[m],a=i[p>>>24]^o[u>>16&255]^r[g>>8&255]^e[255&f]^t[m+1],s=i[u>>>24]^o[g>>16&255]^r[f>>8&255]^e[255&p]^t[m+2],g=i[g>>>24]^o[f>>16&255]^r[p>>8&255]^e[255&u]^t[m+3],m+=4,f=c,p=a,u=s;for(let v=0;v<4;v++)d[w?3&-v:v]=n[f>>>24]<<24^n[p>>16&255]<<16^n[u>>8&255]<<8^n[255&g]^t[m++],c=f,f=p,p=u,u=g,g=c;return d}}},g1={getRandomValues(C){const w=new Uint32Array(C.buffer),t=h=>{let d=987654321;const l=4294967295;return function(){return d=36969*(65535&d)+(d>>16)&l,(((d<<16)+(h=18e3*(65535&h)+(h>>16)&l)&l)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let h,d=0;d<C.length;d+=4){const l=t(4294967296*(h||Math.random()));h=987654071*l(),w[d/4]=4294967296*l()|0}return C}},b1={ctrGladman:class{constructor(C,w){this._prf=C,this._initIv=w,this._iv=w}reset(){this._iv=this._initIv}update(C){return this.calculate(this._prf,C,this._iv)}incWord(C){if(255&~(C>>24))C+=1<<24;else{let w=C>>16&255,t=C>>8&255,h=255&C;w===255?(w=0,t===255?(t=0,h===255?h=0:++h):++t):++w,C=0,C+=w<<16,C+=t<<8,C+=h}return C}incCounter(C){(C[0]=this.incWord(C[0]))===0&&(C[1]=this.incWord(C[1]))}calculate(C,w,t){let h;if(!(h=w.length))return[];const d=qe.bitLength(w);for(let l=0;l<h;l+=4){this.incCounter(t);const i=C.encrypt(t);w[l]^=i[0],w[l+1]^=i[1],w[l+2]^=i[2],w[l+3]^=i[3]}return qe.clamp(w,d)}}},ei={importKey:C=>new ei.hmacSha1(Gs.bytes.toBits(C)),pbkdf2(C,w,t,h){if(t=t||1e4,h<0||t<0)throw new Error("invalid params to pbkdf2");const d=1+(h>>5)<<2;let l,i,o,r,e;const n=new ArrayBuffer(d),c=new DataView(n);let a=0;const s=qe;for(w=Gs.bytes.toBits(w),e=1;a<(d||1);e++){for(l=i=C.encrypt(s.concat(w,[e])),o=1;o<t;o++)for(i=C.encrypt(i),r=0;r<i.length;r++)l[r]^=i[r];for(o=0;a<(d||1)&&o<l.length;o++)c.setInt32(a,l[o]),a+=4}return n.slice(0,h/8)},hmacSha1:class{constructor(C){const w=this,t=w._hash=p1.sha1,h=[[],[]];w._baseHash=[new t,new t];const d=w._baseHash[0].blockSize/32;C.length>d&&(C=new t().update(C).finalize());for(let l=0;l<d;l++)h[0][l]=909522486^C[l],h[1][l]=1549556828^C[l];w._baseHash[0].update(h[0]),w._baseHash[1].update(h[1]),w._resultHash=new t(w._baseHash[0])}reset(){const C=this;C._resultHash=new C._hash(C._baseHash[0]),C._updated=!1}update(C){this._updated=!0,this._resultHash.update(C)}digest(){const C=this,w=C._resultHash.finalize(),t=new C._hash(C._baseHash[1]).update(w).finalize();return C.reset(),t}encrypt(C){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(C),this.digest(C)}}},v1=typeof crypto!=wn&&typeof crypto.getRandomValues==us,ec="Invalid password",rc="Invalid signature",la="zipjs-abort-check-password";function nc(C){return v1?crypto.getRandomValues(C):g1.getRandomValues(C)}const ri=16,ic={name:"PBKDF2"},y1=Object.assign({hash:{name:"HMAC"}},ic),yo=Object.assign({iterations:1e3,hash:{name:"SHA-1"}},ic),w1=["deriveBits"],Ai=[8,12,16],Ti=[16,24,32],en=10,_1=[0,0,0,0],fo=typeof crypto!=wn,Pi=fo&&crypto.subtle,sc=fo&&typeof Pi!=wn,jr=Gs.bytes,x1=m1.aes,k1=b1.ctrGladman,S1=ei.hmacSha1;let Va=fo&&sc&&typeof Pi.importKey==us,Ua=fo&&sc&&typeof Pi.deriveBits==us;class E1 extends TransformStream{constructor({password:w,rawPassword:t,signed:h,encryptionStrength:d,checkPasswordOnly:l}){super({start(){Object.assign(this,{ready:new Promise(i=>this.resolveReady=i),password:lc(w,t),signed:h,strength:d-1,pending:new Uint8Array})},async transform(i,o){const r=this,{password:e,strength:n,resolveReady:c,ready:a}=r;e?(await async function(f,p,u,g){const m=await ac(f,p,u,fr(g,0,Ai[p])),v=fr(g,Ai[p]);if(m[0]!=v[0]||m[1]!=v[1])throw new Error(ec)}(r,n,e,fr(i,0,Ai[n]+2)),i=fr(i,Ai[n]+2),l?o.error(new Error(la)):c()):await a;const s=new Uint8Array(i.length-en-(i.length-en)%ri);o.enqueue(oc(r,i,s,0,en,!0))},async flush(i){const{signed:o,ctr:r,hmac:e,pending:n,ready:c}=this;if(e&&r){await c;const a=fr(n,0,n.length-en),s=fr(n,n.length-en);let f=new Uint8Array;if(a.length){const p=Di(jr,a);e.update(p);const u=r.update(p);f=Fi(jr,u)}if(o){const p=fr(Fi(jr,e.digest()),0,en);for(let u=0;u<en;u++)if(p[u]!=s[u])throw new Error(rc)}i.enqueue(f)}}})}}class C1 extends TransformStream{constructor({password:w,rawPassword:t,encryptionStrength:h}){let d;super({start(){Object.assign(this,{ready:new Promise(l=>this.resolveReady=l),password:lc(w,t),strength:h-1,pending:new Uint8Array})},async transform(l,i){const o=this,{password:r,strength:e,resolveReady:n,ready:c}=o;let a=new Uint8Array;r?(a=await async function(f,p,u){const g=nc(new Uint8Array(Ai[p])),m=await ac(f,p,u,g);return Po(g,m)}(o,e,r),n()):await c;const s=new Uint8Array(a.length+l.length-l.length%ri);s.set(a,0),i.enqueue(oc(o,l,s,a.length,0))},async flush(l){const{ctr:i,hmac:o,pending:r,ready:e}=this;if(o&&i){await e;let n=new Uint8Array;if(r.length){const c=i.update(Di(jr,r));o.update(c),n=Fi(jr,c)}d.signature=Fi(jr,o.digest()).slice(0,en),l.enqueue(Po(n,d.signature))}}}),d=this}}function oc(C,w,t,h,d,l){const{ctr:i,hmac:o,pending:r}=C,e=w.length-d;let n;for(r.length&&(w=Po(r,w),t=function(c,a){if(a&&a>c.length){const s=c;(c=new Uint8Array(a)).set(s,0)}return c}(t,e-e%ri)),n=0;n<=e-ri;n+=ri){const c=Di(jr,fr(w,n,n+ri));l&&o.update(c);const a=i.update(c);l||o.update(a),t.set(Fi(jr,a),n+h)}return C.pending=fr(w,n),t}async function ac(C,w,t,h){C.password=null;const d=await async function(n,c,a,s,f){if(!Va)return ei.importKey(c);try{return await Pi.importKey(n,c,a,s,f)}catch{return Va=!1,ei.importKey(c)}}("raw",t,y1,!1,w1),l=await async function(n,c,a){if(!Ua)return ei.pbkdf2(c,n.salt,yo.iterations,a);try{return await Pi.deriveBits(n,c,a)}catch{return Ua=!1,ei.pbkdf2(c,n.salt,yo.iterations,a)}}(Object.assign({salt:h},yo),d,8*(2*Ti[w]+2)),i=new Uint8Array(l),o=Di(jr,fr(i,0,Ti[w])),r=Di(jr,fr(i,Ti[w],2*Ti[w])),e=fr(i,2*Ti[w]);return Object.assign(C,{keys:{key:o,authentication:r,passwordVerification:e},ctr:new k1(new x1(o),Array.from(_1)),hmac:new S1(r)}),e}function lc(C,w){return w===Fe?function(t){if(typeof TextEncoder==wn){t=unescape(encodeURIComponent(t));const h=new Uint8Array(t.length);for(let d=0;d<h.length;d++)h[d]=t.charCodeAt(d);return h}return new TextEncoder().encode(t)}(C):w}function Po(C,w){let t=C;return C.length+w.length&&(t=new Uint8Array(C.length+w.length),t.set(C,0),t.set(w,C.length)),t}function fr(C,w,t){return C.subarray(w,t)}function Fi(C,w){return C.fromBits(w)}function Di(C,w){return C.toBits(w)}const Ks=12;class T1 extends TransformStream{constructor({password:w,passwordVerification:t,checkPasswordOnly:h}){super({start(){Object.assign(this,{password:w,passwordVerification:t}),cc(this,w)},transform(d,l){const i=this;if(i.password){const o=Ha(i,d.subarray(0,Ks));if(i.password=null,o[11]!=i.passwordVerification)throw new Error(ec);d=d.subarray(Ks)}h?l.error(new Error(la)):l.enqueue(Ha(i,d))}})}}class M1 extends TransformStream{constructor({password:w,passwordVerification:t}){super({start(){Object.assign(this,{password:w,passwordVerification:t}),cc(this,w)},transform(h,d){const l=this;let i,o;if(l.password){l.password=null;const r=nc(new Uint8Array(Ks));r[11]=l.passwordVerification,i=new Uint8Array(h.length+r.length),i.set(Wa(l,r),0),o=Ks}else i=new Uint8Array(h.length),o=0;i.set(Wa(l,h),o),d.enqueue(i)}})}}function Ha(C,w){const t=new Uint8Array(w.length);for(let h=0;h<w.length;h++)t[h]=uc(C)^w[h],ca(C,t[h]);return t}function Wa(C,w){const t=new Uint8Array(w.length);for(let h=0;h<w.length;h++)t[h]=uc(C)^w[h],ca(C,w[h]);return t}function cc(C,w){const t=[305419896,591751049,878082192];Object.assign(C,{keys:t,crcKey0:new Zs(t[0]),crcKey2:new Zs(t[2])});for(let h=0;h<w.length;h++)ca(C,w.charCodeAt(h))}function ca(C,w){let[t,h,d]=C.keys;C.crcKey0.append([w]),t=~C.crcKey0.get(),h=qa(Math.imul(qa(h+fc(t)),134775813)+1),C.crcKey2.append([h>>>24]),d=~C.crcKey2.get(),C.keys=[t,h,d]}function uc(C){const w=2|C.keys[2];return fc(Math.imul(w,1^w)>>>8)}function fc(C){return 255&C}function qa(C){return 4294967295&C}const Xa="deflate-raw";class A1 extends TransformStream{constructor(w,{chunkSize:t,CompressionStream:h,CompressionStreamNative:d}){super({});const{compressed:l,encrypted:i,useCompressionStream:o,zipCrypto:r,signed:e,level:n}=w,c=this;let a,s,f=hc(super.readable);i&&!r||!e||(a=new tc,f=Ir(f,a)),l&&(f=pc(f,o,{level:n,chunkSize:t},d,h)),i&&(r?f=Ir(f,new M1(w)):(s=new C1(w),f=Ir(f,s))),dc(c,f,()=>{let p;i&&!r&&(p=s.signature),i&&!r||!e||(p=new DataView(a.value.buffer).getUint32(0)),c.signature=p})}}class R1 extends TransformStream{constructor(w,{chunkSize:t,DecompressionStream:h,DecompressionStreamNative:d}){super({});const{zipCrypto:l,encrypted:i,signed:o,signature:r,compressed:e,useCompressionStream:n}=w;let c,a,s=hc(super.readable);i&&(l?s=Ir(s,new T1(w)):(a=new E1(w),s=Ir(s,a))),e&&(s=pc(s,n,{chunkSize:t},d,h)),i&&!l||!o||(c=new tc,s=Ir(s,c)),dc(this,s,()=>{if((!i||l)&&o){const f=new DataView(c.value.buffer);if(r!=f.getUint32(0,!1))throw new Error(rc)}})}}function hc(C){return Ir(C,new TransformStream({transform(w,t){w&&w.length&&t.enqueue(w)}}))}function dc(C,w,t){w=Ir(w,new TransformStream({flush:t})),Object.defineProperty(C,"readable",{get:()=>w})}function pc(C,w,t,h,d){try{C=Ir(C,new(w&&h?h:d)(Xa,t))}catch{if(!w)return C;try{C=Ir(C,new d(Xa,t))}catch{return C}}return C}function Ir(C,w){return C.pipeThrough(w)}const N1="message",O1="start",j1="pull",Za="data",Ga="close",mc="inflate";class I1 extends TransformStream{constructor(w,t){super({});const h=this,{codecType:d}=w;let l;d.startsWith("deflate")?l=A1:d.startsWith(mc)&&(l=R1);let i=0,o=0;const r=new l(w,t),e=super.readable,n=new TransformStream({transform(a,s){a&&a.length&&(o+=a.length,s.enqueue(a))},flush(){Object.assign(h,{inputSize:o})}}),c=new TransformStream({transform(a,s){a&&a.length&&(i+=a.length,s.enqueue(a))},flush(){const{signature:a}=r;Object.assign(h,{signature:a,outputSize:i,inputSize:o})}});Object.defineProperty(h,"readable",{get:()=>e.pipeThrough(n).pipeThrough(r).pipeThrough(c)})}}class B1 extends TransformStream{constructor(w){let t;super({transform:function h(d,l){if(t){const i=new Uint8Array(t.length+d.length);i.set(t),i.set(d,t.length),d=i,t=null}d.length>w?(l.enqueue(d.slice(0,w)),h(d.slice(w),l)):t=d},flush(h){t&&t.length&&h.enqueue(t)}})}}let gc=typeof Worker!=wn;class wo{constructor(w,{readable:t,writable:h},{options:d,config:l,streamOptions:i,useWebWorkers:o,transferStreams:r,scripts:e},n){const{signal:c}=i;return Object.assign(w,{busy:!0,readable:t.pipeThrough(new B1(l.chunkSize)).pipeThrough(new P1(t,i),{signal:c}),writable:h,options:Object.assign({},d),scripts:e,transferStreams:r,terminate:()=>new Promise(a=>{const{worker:s,busy:f}=w;s?(f?w.resolveTerminated=a:(s.terminate(),a()),w.interface=null):a()}),onTaskFinished(){const{resolveTerminated:a}=w;a&&(w.resolveTerminated=null,w.terminated=!0,w.worker.terminate(),a()),w.busy=!1,n(w)}}),(o&&gc?F1:bc)(w,l)}}class P1 extends TransformStream{constructor(w,{onstart:t,onprogress:h,size:d,onend:l}){let i=0;super({async start(){t&&await _o(t,d)},async transform(o,r){i+=o.length,h&&await _o(h,i,d),r.enqueue(o)},async flush(){w.size=i,l&&await _o(l,i)}})}}async function _o(C,...w){try{await C(...w)}catch{}}function bc(C,w){return{run:()=>async function({options:t,readable:h,writable:d,onTaskFinished:l},i){try{const o=new I1(t,i);await h.pipeThrough(o).pipeTo(d,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:e,outputSize:n}=o;return{signature:r,inputSize:e,outputSize:n}}finally{l()}}(C,w)}}function F1(C,w){const{baseURL:t,chunkSize:h}=w;if(!C.interface){let d;try{d=function(l,i,o){const r={type:"module"};let e,n;typeof l==us&&(l=l());try{e=new URL(l,i)}catch{e=l}if(Ka)try{n=new Worker(e)}catch{Ka=!1,n=new Worker(e,r)}else n=new Worker(e,r);return n.addEventListener(N1,c=>async function({data:a},s){const{type:f,value:p,messageId:u,result:g,error:m}=a,{reader:v,writer:S,resolveResult:R,rejectResult:I,onTaskFinished:F}=s;try{if(m){const{message:L,stack:$,code:V,name:z}=m,E=new Error(L);Object.assign(E,{stack:$,code:V,name:z}),j(E)}else{if(f==j1){const{value:L,done:$}=await v.read();Es({type:Za,value:L,done:$,messageId:u},s)}f==Za&&(await S.ready,await S.write(new Uint8Array(p)),Es({type:"ack",messageId:u},s)),f==Ga&&j(null,g)}}catch(L){Es({type:Ga,messageId:u},s),j(L)}function j(L,$){L?I(L):R($),S&&S.releaseLock(),F()}}(c,o)),n}(C.scripts[0],t,C)}catch{return gc=!1,bc(C,w)}Object.assign(C,{worker:d,interface:{run:()=>async function(l,i){let o,r;const e=new Promise((g,m)=>{o=g,r=m});Object.assign(l,{reader:null,writer:null,resolveResult:o,rejectResult:r,result:e});const{readable:n,options:c,scripts:a}=l,{writable:s,closed:f}=function(g){let m;const v=new Promise(R=>m=R);return{writable:new WritableStream({async write(R){const I=g.getWriter();await I.ready,await I.write(R),I.releaseLock()},close(){m()},abort:R=>g.getWriter().abort(R)}),closed:v}}(l.writable),p=Es({type:O1,scripts:a.slice(1),options:c,config:i,readable:n,writable:s},l);p||Object.assign(l,{reader:n.getReader(),writer:s.getWriter()});const u=await e;return p||await s.getWriter().close(),await f,u}(C,{chunkSize:h})}})}return C.interface}let Ka=!0,Ya=!0;function Es(C,{worker:w,writer:t,onTaskFinished:h,transferStreams:d}){try{const{value:l,readable:i,writable:o}=C,r=[];if(l&&(l.byteLength<l.buffer.byteLength?C.value=l.buffer.slice(0,l.byteLength):C.value=l.buffer,r.push(C.value)),d&&Ya?(i&&r.push(i),o&&r.push(o)):C.readable=C.writable=null,r.length)try{return w.postMessage(C,r),!0}catch{Ya=!1,C.readable=C.writable=null,w.postMessage(C)}else w.postMessage(C)}catch(l){throw t&&t.releaseLock(),h(),l}}let Sn=[];const xo=[];let Ja=0;async function D1(C,w){const{options:t,config:h}=w,{transferStreams:d,useWebWorkers:l,useCompressionStream:i,codecType:o,compressed:r,signed:e,encrypted:n}=t,{workerScripts:c,maxWorkers:a}=h;w.transferStreams=d||d===Fe;const s=!(r||e||n||w.transferStreams);return w.useWebWorkers=!s&&(l||l===Fe&&h.useWebWorkers),w.scripts=w.useWebWorkers&&c?c[o]:[],t.useCompressionStream=i||i===Fe&&h.useCompressionStream,(await async function(){const p=Sn.find(u=>!u.busy);if(p)return Qa(p),new wo(p,C,w,f);if(Sn.length<a){const u={indexWorker:Ja};return Ja++,Sn.push(u),new wo(u,C,w,f)}return new Promise(u=>xo.push({resolve:u,stream:C,workerOptions:w}))}()).run();function f(p){if(xo.length){const[{resolve:u,stream:g,workerOptions:m}]=xo.splice(0,1);u(new wo(p,g,m,f))}else p.worker?(Qa(p),function(u,g){const{config:m}=g,{terminateWorkerTimeout:v}=m;Number.isFinite(v)&&v>=0&&(u.terminated?u.terminated=!1:u.terminateTimeout=setTimeout(async()=>{Sn=Sn.filter(S=>S!=u);try{await u.terminate()}catch{}},v))}(p,w)):Sn=Sn.filter(u=>u!=p)}}function Qa(C){const{terminateTimeout:w}=C;w&&(clearTimeout(w),C.terminateTimeout=null)}const L1=65536,vc="writable";class ua{constructor(){this.size=0}init(){this.initialized=!0}}class yc extends ua{get readable(){const w=this,{chunkSize:t=L1}=w,h=new ReadableStream({start(){this.chunkOffset=0},async pull(d){const{offset:l=0,size:i,diskNumberStart:o}=h,{chunkOffset:r}=this,e=i===Fe?t:Math.min(t,i-r),n=await ze(w,l+r,e,o);d.enqueue(n),r+t>i||i===Fe&&!n.length&&e?d.close():this.chunkOffset+=t}});return h}}class wc extends yc{constructor(w){super(),Object.assign(this,{blob:w,size:w.size})}async readUint8Array(w,t){const h=this,d=w+t;let i=await(w||d<h.size?h.blob.slice(w,d):h.blob).arrayBuffer();return i.byteLength>t&&(i=i.slice(w,d)),new Uint8Array(i)}}class _c extends ua{constructor(w){super();const t=new TransformStream,h=[];w&&h.push(["Content-Type",w]),Object.defineProperty(this,vc,{get:()=>t.writable}),this.blob=new Response(t.readable,{headers:h}).blob()}getData(){return this.blob}}class z1 extends _c{constructor(w){super(w),Object.assign(this,{encoding:w,utf8:!w||w.toLowerCase()=="utf-8"})}async getData(){const{encoding:w,utf8:t}=this,h=await super.getData();if(h.text&&t)return h.text();{const d=new FileReader;return new Promise((l,i)=>{Object.assign(d,{onload:({target:o})=>l(o.result),onerror:()=>i(d.error)}),d.readAsText(h,w)})}}}class $1 extends yc{constructor(w){super(),this.readers=w}async init(){const w=this,{readers:t}=w;w.lastDiskNumber=0,w.lastDiskOffset=0,await Promise.all(t.map(async(h,d)=>{await h.init(),d!=t.length-1&&(w.lastDiskOffset+=h.size),w.size+=h.size})),super.init()}async readUint8Array(w,t,h=0){const d=this,{readers:l}=this;let i,o=h;o==-1&&(o=l.length-1);let r=w;for(;r>=l[o].size;)r-=l[o].size,o++;const e=l[o],n=e.size;if(r+t<=n)i=await ze(e,r,t);else{const c=n-r;i=new Uint8Array(t),i.set(await ze(e,r,c)),i.set(await d.readUint8Array(w+c,t-c,h),c)}return d.lastDiskNumber=Math.max(o,d.lastDiskNumber),i}}class tl extends ua{constructor(w,t=4294967295){super();const h=this;let d,l,i;Object.assign(h,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});const o=new WritableStream({async write(n){const{availableSize:c}=h;if(i)n.length>=c?(await r(n.slice(0,c)),await e(),h.diskOffset+=d.size,h.diskNumber++,i=null,await this.write(n.slice(c))):await r(n);else{const{value:a,done:s}=await w.next();if(s&&!a)throw new Error("Writer iterator completed too soon");d=a,d.size=0,d.maxSize&&(h.maxSize=d.maxSize),h.availableSize=h.maxSize,await Ys(d),l=a.writable,i=l.getWriter(),await this.write(n)}},async close(){await i.ready,await e()}});async function r(n){const c=n.length;c&&(await i.ready,await i.write(n),d.size+=c,h.size+=c,h.availableSize-=c)}async function e(){l.size=d.size,await i.close()}Object.defineProperty(h,vc,{get:()=>o})}}async function Ys(C,w){if(!C.init||C.initialized)return Promise.resolve();await C.init(w)}function V1(C){return Array.isArray(C)&&(C=new $1(C)),C instanceof ReadableStream&&(C={readable:C}),C}function ze(C,w,t,h){return C.readUint8Array(w,t,h)}const xc="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),U1=xc.length==256;function Bs(C,w){return w&&w.trim().toLowerCase()=="cp437"?function(t){if(U1){let h="";for(let d=0;d<t.length;d++)h+=xc[t[d]];return h}return new TextDecoder().decode(t)}(C):new TextDecoder(w).decode(C)}const kc="filename",Sc="rawFilename",Ec="comment",Cc="rawComment",Tc="uncompressedSize",Mc="compressedSize",Ac="offset",Fo="diskNumberStart",Do="lastModDate",Lo="rawLastModDate",Rc="lastAccessDate",H1="rawLastAccessDate",Nc="creationDate",W1="rawCreationDate",q1=[kc,Sc,Mc,Tc,Do,Lo,Ec,Cc,Rc,Nc,Ac,Fo,Fo,"internalFileAttribute","internalFileAttributes","externalFileAttribute","externalFileAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","bitFlag","signature","filenameUTF8","commentUTF8","compressionMethod","extraField","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class el{constructor(w){q1.forEach(t=>this[t]=w[t])}}const ko="File format is not recognized",X1="Zip64 extra field not found",rl="Compression method not supported",nl="Split zip file",il="utf-8",sl="cp437",Z1=[[Tc,Un],[Mc,Un],[Ac,Un],[Fo,Nn]],G1={[Nn]:{getValue:Ce,bytes:4},[Un]:{getValue:Ps,bytes:8}};class K1{constructor(w,t={}){Object.assign(this,{reader:V1(w),options:t,config:nn})}async*getEntriesGenerator(w={}){const t=this;let{reader:h}=t;const{config:d}=t;if(await Ys(h),h.size!==Fe&&h.readUint8Array||(h=new wc(await new Response(h.readable).blob()),await Ys(h)),h.size<Gn)throw new Error(ko);h.chunkSize=function($){return Math.max($.chunkSize,64)}(d);const l=await async function($,V,z,E,A){const k=new Uint8Array(4);(function(_,x,M){_.setUint32(x,M,!0)})(Ie(k),0,V);const b=E+A;return await y(E)||await y(Math.min(b,z));async function y(_){const x=z-_,M=await ze($,x,_);for(let B=M.length-E;B>=0;B--)if(M[B]==k[0]&&M[B+1]==k[1]&&M[B+2]==k[2]&&M[B+3]==k[3])return{offset:x+B,buffer:M.slice(B,B+E).buffer}}}(h,101010256,h.size,Gn,1048560);if(!l)throw Ce(Ie(await ze(h,0,4)))==134695760?new Error(nl):new Error("End of central directory not found");const i=Ie(l);let o=Ce(i,12),r=Ce(i,16);const e=l.offset,n=Be(i,20),c=e+Gn+n;let a=Be(i,4);const s=h.lastDiskNumber||0;let f=Be(i,6),p=Be(i,8),u=0,g=0;if(r==Un||o==Un||p==Nn||f==Nn){const $=Ie(await ze(h,l.offset-20,20));if(Ce($,0)==117853008){r=Ps($,8);let V=await ze(h,r,56,-1),z=Ie(V);const E=l.offset-20-56;if(Ce(z,0)!=za&&r!=E){const A=r;r=E,u=r-A,V=await ze(h,r,56,-1),z=Ie(V)}if(Ce(z,0)!=za)throw new Error("End of Zip64 central directory locator not found");a==Nn&&(a=Ce(z,16)),f==Nn&&(f=Ce(z,20)),p==Nn&&(p=Ps(z,32)),o==Un&&(o=Ps(z,40)),r-=o}}if(r>=h.size&&(u=h.size-r-o-Gn,r=h.size-o-Gn),s!=a)throw new Error(nl);if(r<0)throw new Error(ko);let m=0,v=await ze(h,r,o,f),S=Ie(v);if(o){const $=l.offset-o;if(Ce(S,m)!=La&&r!=$){const V=r;r=$,u+=r-V,v=await ze(h,r,o,f),S=Ie(v)}}const R=l.offset-r-(h.lastDiskOffset||0);if(o!=R&&R>=0&&(o=R,v=await ze(h,r,o,f),S=Ie(v)),r<0||r>=h.size)throw new Error(ko);const I=We(t,w,"filenameEncoding"),F=We(t,w,"commentEncoding");for(let $=0;$<p;$++){const V=new Y1(h,d,t.options);if(Ce(S,m)!=La)throw new Error("Central directory header not found");Oc(V,S,m+6);const z=!!V.bitFlag.languageEncodingFlag,E=m+46,A=E+V.filenameLength,k=A+V.extraFieldLength,b=Be(S,m+4),y=!(b>>8),_=b>>8==3,x=v.subarray(E,A),M=Be(S,m+32),B=k+M,P=v.subarray(k,B),H=z,W=z,K=Ce(S,m+38),D=y&&!(16&~ni(S,m+38))||_&&!(16384&~(K>>16))||x.length&&x[x.length-1]==47,X=_&&!(73&~(K>>16)),O=Ce(S,m+42)+u;Object.assign(V,{versionMadeBy:b,msDosCompatible:y,compressedSize:0,uncompressedSize:0,commentLength:M,directory:D,offset:O,diskNumberStart:Be(S,m+34),internalFileAttributes:Be(S,m+36),externalFileAttributes:K,rawFilename:x,filenameUTF8:H,commentUTF8:W,rawExtraField:v.subarray(A,k),executable:X}),V.internalFileAttribute=V.internalFileAttributes,V.externalFileAttribute=V.externalFileAttributes;const N=We(t,w,"decodeText")||Bs,U=H?il:I||sl,q=W?il:F||sl;let Y=N(x,U);Y===Fe&&(Y=Bs(x,U));let G=N(P,q);G===Fe&&(G=Bs(P,q)),Object.assign(V,{rawComment:P,filename:Y,comment:G,directory:D||Y.endsWith("/")}),g=Math.max(O,g),jc(V,V,S,m+6),V.zipCrypto=V.encrypted&&!V.extraFieldAES;const Q=new el(V);Q.getData=(it,J)=>V.getData(it,Q,J),m=B;const{onprogress:rt}=w;if(rt)try{await rt($+1,p,new el(V))}catch{}yield Q}const j=We(t,w,"extractPrependedData"),L=We(t,w,"extractAppendedData");return j&&(t.prependedData=g>0?await ze(h,0,g):new Uint8Array),t.comment=n?await ze(h,e+Gn,n):new Uint8Array,L&&(t.appendedData=c<h.size?await ze(h,c,h.size-c):new Uint8Array),!0}async getEntries(w={}){const t=[];for await(const h of this.getEntriesGenerator(w))t.push(h);return t}async close(){}}class Y1{constructor(w,t,h){Object.assign(this,{reader:w,config:t,options:h})}async getData(w,t,h={}){const d=this,{reader:l,offset:i,diskNumberStart:o,extraFieldAES:r,compressionMethod:e,config:n,bitFlag:c,signature:a,rawLastModDate:s,uncompressedSize:f,compressedSize:p}=d,u=t.localDirectory={},g=Ie(await ze(l,i,30,o));let m=We(d,h,"password"),v=We(d,h,"rawPassword");const S=We(d,h,"passThrough");if(m=m&&m.length&&m,v=v&&v.length&&v,r&&r.originalCompressionMethod!=99)throw new Error(rl);if(e!=0&&e!=8&&!S)throw new Error(rl);if(Ce(g,0)!=67324752)throw new Error("Local file header not found");Oc(u,g,4),u.rawExtraField=u.extraFieldLength?await ze(l,i+30+u.filenameLength,u.extraFieldLength,o):new Uint8Array,jc(d,u,g,4,!0),Object.assign(t,{lastAccessDate:u.lastAccessDate,creationDate:u.creationDate});const R=d.encrypted&&u.encrypted&&!S,I=R&&!r;if(S||(t.zipCrypto=I),R){if(!I&&r.strength===Fe)throw new Error("Encryption method not supported");if(!m&&!v)throw new Error("File contains encrypted entry")}const F=i+30+u.filenameLength+u.extraFieldLength,j=p,L=l.readable;Object.assign(L,{diskNumberStart:o,offset:F,size:j});const $=We(d,h,"signal"),V=We(d,h,"checkPasswordOnly");V&&(w=new WritableStream),w=function(_){_.writable===Fe&&typeof _.next==us&&(_=new tl(_)),_ instanceof WritableStream&&(_={writable:_});const{writable:x}=_;return x.size===Fe&&(x.size=0),_ instanceof tl||Object.assign(_,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),_}(w),await Ys(w,S?p:f);const{writable:z}=w,{onstart:E,onprogress:A,onend:k}=h,b={options:{codecType:mc,password:m,rawPassword:v,zipCrypto:I,encryptionStrength:r&&r.strength,signed:We(d,h,"checkSignature")&&!S,passwordVerification:I&&(c.dataDescriptor?s>>>8&255:a>>>24&255),signature:a,compressed:e!=0&&!S,encrypted:d.encrypted&&!S,useWebWorkers:We(d,h,"useWebWorkers"),useCompressionStream:We(d,h,"useCompressionStream"),transferStreams:We(d,h,"transferStreams"),checkPasswordOnly:V},config:n,streamOptions:{signal:$,size:j,onstart:E,onprogress:A,onend:k}};let y=0;try{({outputSize:y}=await D1({readable:L,writable:z},b))}catch(_){if(!V||_.message!=la)throw _}finally{const _=We(d,h,"preventClose");z.size+=y,_||z.locked||await z.getWriter().close()}return V?Fe:w.getData?w.getData():z}}function Oc(C,w,t){const h=C.rawBitFlag=Be(w,t+2),d=!(1&~h),l=Ce(w,t+6);Object.assign(C,{encrypted:d,version:Be(w,t),bitFlag:{level:(6&h)>>1,dataDescriptor:!(8&~h),languageEncodingFlag:!(2048&~h)},rawLastModDate:l,lastModDate:J1(l),filenameLength:Be(w,t+22),extraFieldLength:Be(w,t+24)})}function jc(C,w,t,h,d){const{rawExtraField:l}=w,i=w.extraField=new Map,o=Ie(new Uint8Array(l));let r=0;try{for(;r<l.length;){const g=Be(o,r),m=Be(o,r+2);i.set(g,{type:g,data:l.slice(r+4,r+4+m)}),r+=4+m}}catch{}const e=Be(t,h+4);Object.assign(w,{signature:Ce(t,h+10),uncompressedSize:Ce(t,h+18),compressedSize:Ce(t,h+14)});const n=i.get(1);n&&(function(g,m){m.zip64=!0;const v=Ie(g.data),S=Z1.filter(([R,I])=>m[R]==I);for(let R=0,I=0;R<S.length;R++){const[F,j]=S[R];if(m[F]==j){const L=G1[j];m[F]=g[F]=L.getValue(v,I),I+=L.bytes}else if(g[F])throw new Error(X1)}}(n,w),w.extraFieldZip64=n);const c=i.get(28789);c&&(ol(c,kc,Sc,w,C),w.extraFieldUnicodePath=c);const a=i.get(25461);a&&(ol(a,Ec,Cc,w,C),w.extraFieldUnicodeComment=a);const s=i.get(39169);s?(function(g,m,v){const S=Ie(g.data),R=ni(S,4);Object.assign(g,{vendorVersion:ni(S,0),vendorId:ni(S,2),strength:R,originalCompressionMethod:v,compressionMethod:Be(S,5)}),m.compressionMethod=g.compressionMethod}(s,w,e),w.extraFieldAES=s):w.compressionMethod=e;const f=i.get(10);f&&(function(g,m){const v=Ie(g.data);let S,R=4;try{for(;R<g.data.length&&!S;){const I=Be(v,R),F=Be(v,R+2);I==1&&(S=g.data.slice(R+4,R+4+F)),R+=4+F}}catch{}try{if(S&&S.length==24){const I=Ie(S),F=I.getBigUint64(0,!0),j=I.getBigUint64(8,!0),L=I.getBigUint64(16,!0);Object.assign(g,{rawLastModDate:F,rawLastAccessDate:j,rawCreationDate:L});const $=So(F),V=So(j),z={lastModDate:$,lastAccessDate:V,creationDate:So(L)};Object.assign(g,z),Object.assign(m,z)}}catch{}}(f,w),w.extraFieldNTFS=f);const p=i.get(21589);p&&(function(g,m,v){const S=Ie(g.data),R=ni(S,0),I=[],F=[];v?(1&~R||(I.push(Do),F.push(Lo)),2&~R||(I.push(Rc),F.push(H1)),4&~R||(I.push(Nc),F.push(W1))):g.data.length>=5&&(I.push(Do),F.push(Lo));let j=1;I.forEach((L,$)=>{if(g.data.length>=j+4){const V=Ce(S,j);m[L]=g[L]=new Date(1e3*V);const z=F[$];g[z]=V}j+=4})}(p,w,d),w.extraFieldExtendedTimestamp=p);const u=i.get(6534);u&&(w.extraFieldUSDZ=u)}function ol(C,w,t,h,d){const l=Ie(C.data),i=new Zs;i.append(d[t]);const o=Ie(new Uint8Array(4));o.setUint32(0,i.get(),!0);const r=Ce(l,1);Object.assign(C,{version:ni(l,0),[w]:Bs(C.data.subarray(5)),valid:!d.bitFlag.languageEncodingFlag&&r==Ce(o,0)}),C.valid&&(h[w]=C[w],h[w+"UTF8"]=!0)}function We(C,w,t){return w[t]===Fe?C.options[t]:w[t]}function J1(C){const w=(4294901760&C)>>16,t=65535&C;try{return new Date(1980+((65024&w)>>9),((480&w)>>5)-1,31&w,(63488&t)>>11,(2016&t)>>5,2*(31&t),0)}catch{}}function So(C){return new Date(Number(C/BigInt(1e4)-BigInt(116444736e5)))}function ni(C,w){return C.getUint8(w)}function Be(C,w){return C.getUint16(w,!0)}function Ce(C,w){return C.getUint32(w,!0)}function Ps(C,w){return Number(C.getBigUint64(w,!0))}function Ie(C){return new DataView(C.buffer)}Jl({Inflate:function(C){const w=new Kl,t=C&&C.chunkSize?Math.floor(2*C.chunkSize):131072,h=new Uint8Array(t);let d=!1;w.inflateInit(),w.next_out=h,this.append=function(l,i){const o=[];let r,e,n=0,c=0,a=0;if(l.length!==0){w.next_in_index=0,w.next_in=l,w.avail_in=l.length;do{if(w.next_out_index=0,w.avail_out=t,w.avail_in!==0||d||(w.next_in_index=0,d=!0),r=w.inflate(0),d&&r===Zr){if(w.avail_in!==0)throw new Error("inflating: bad input")}else if(r!==0&&r!==1)throw new Error("inflating: "+w.msg);if((d||r===1)&&w.avail_in===l.length)throw new Error("inflating: bad input");w.next_out_index&&(w.next_out_index===t?o.push(new Uint8Array(h)):o.push(h.subarray(0,w.next_out_index))),a+=w.next_out_index,i&&w.next_in_index>0&&w.next_in_index!=n&&(i(w.next_in_index),n=w.next_in_index)}while(w.avail_in>0||w.avail_out===0);return o.length>1?(e=new Uint8Array(a),o.forEach(function(s){e.set(s,c),c+=s.length})):e=o[0]?new Uint8Array(o[0]):new Uint8Array,e}},this.flush=function(){w.inflateEnd()}}});const Q1=Object.freeze(Object.defineProperty({__proto__:null,BlobReader:wc,BlobWriter:_c,TextWriter:z1,ZipReader:K1,configure:Jl},Symbol.toStringTag,{value:"Module"})),Re={CONTAINER:"urn:oasis:names:tc:opendocument:xmlns:container",XHTML:"http://www.w3.org/1999/xhtml",OPF:"http://www.idpf.org/2007/opf",EPUB:"http://www.idpf.org/2007/ops",DC:"http://purl.org/dc/elements/1.1/",ENC:"http://www.w3.org/2001/04/xmlenc#",NCX:"http://www.daisy.org/z3986/2005/ncx/",XLINK:"http://www.w3.org/1999/xlink",SMIL:"http://www.w3.org/ns/SMIL"},Ue={XML:"application/xml",NCX:"application/x-dtbncx+xml",XHTML:"application/xhtml+xml",HTML:"text/html",CSS:"text/css",SVG:"image/svg+xml",JS:/\/(x-)?(javascript|ecmascript)/},rn={a11y:"http://www.idpf.org/epub/vocab/package/a11y/#",dcterms:"http://purl.org/dc/terms/",marc:"http://id.loc.gov/vocabulary/",media:"http://www.idpf.org/epub/vocab/overlays/#",onix:"http://www.editeur.org/ONIX/book/codelists/current.html#",rendition:"http://www.idpf.org/vocab/rendition/#",schema:"http://schema.org/",xsd:"http://www.w3.org/2001/XMLSchema#",msv:"http://www.idpf.org/epub/vocab/structure/magazine/#",prism:"http://www.prismstandard.org/specifications/3.0/PRISM_CV_Spec_3.0.htm#"},tg={art:"artist",aut:"author",clr:"colorist",edt:"editor",ill:"illustrator",nrt:"narrator",trl:"translator",pbl:"publisher"},eg={"02":"isbn","06":"doi",15:"isbn",26:"doi",34:"issn"},zo=C=>C.toLowerCase().replace(/[-:](.)/g,(w,t)=>t.toUpperCase()),rg=C=>C?C.replace(/[\t\n\f\r ]+/g," ").replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,""):"",ng=(C,w,t)=>t?h=>{var d,l;return(l=(d=h.getAttribute(C))==null?void 0:d.split(/\s/))==null?void 0:l.includes(w)}:typeof w=="function"?h=>w(h.getAttribute(C)):h=>h.getAttribute(C)===w,Fs=(...C)=>w=>w?Object.fromEntries(C.map(t=>[zo(t),w.getAttribute(t)])):null,Gr=C=>rg(C==null?void 0:C.textContent),fs=(C,w)=>{const t=C.lookupNamespaceURI(null)===w||C.lookupPrefix(w),h=t?(d,l)=>i=>i.namespaceURI===w&&i.localName===l:(d,l)=>i=>i.localName===l;return{$:(d,l)=>[...d.children].find(h(d,l)),$$:(d,l)=>[...d.children].filter(h(d,l)),$$$:t?(d,l)=>[...d.getElementsByTagNameNS(w,l)]:(d,l)=>[...d.getElementsByTagName(l)]}},ii=(C,w)=>{try{if(C=C.replace(/%2c/,","),w.includes(":")&&!w.startsWith("OEBPS"))return new URL(C,w);const t="https://invalid.invalid/",h=new URL(C,t+w);return h.search="",decodeURI(h.href.replace(t,""))}catch(t){return console.warn(t),C}},Ic=C=>/^(?!blob)\w+:/i.test(C),ig=(C,w)=>{if(!C)return w;const t=C.replace(/\/$/,"").split("/"),h=w.replace(/\/$/,"").split("/"),d=(t.length>h.length?t:h).findIndex((l,i)=>t[i]!==h[i]);return d<0?"":Array(t.length-d).fill("..").concat(h.slice(d)).join("/")},sg=C=>C.slice(0,C.lastIndexOf("/")+1),Cs=async(C,w,t)=>{const h=[];C.replace(w,(...l)=>(h.push(l),null));const d=[];for(const l of h)d.push(await t(...l));return C.replace(w,()=>d.shift())},og=C=>C.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),$o=C=>{for(const[t,h]of Object.entries(C))h==null?delete C[t]:Array.isArray(h)?(C[t]=h.filter(d=>d).map(d=>typeof d=="object"&&!Array.isArray(d)?$o(d):d),C[t].length?C[t].length===1&&(C[t]=C[t][0]):delete C[t]):typeof h=="object"&&(C[t]=$o(h),Object.keys(h).length||delete C[t]);const w=Object.keys(C);return w.length===1&&w[0]==="name"?C[w[0]]:C},ag=C=>{const w=new Map(Object.entries(rn)),t=C.documentElement.getAttributeNS(Re.EPUB,"prefix")||C.documentElement.getAttribute("prefix");if(t)for(const[,h,d]of t.matchAll(/(.+): +(.+)[ \t\r\n]*/g))w.set(h,d);return w},al=(C,w)=>{if(!C)return null;const[t,h]=C.split(":"),d=h?t:null,l=h||t,i=w.get(d);return i?i+l:null},lg=C=>{var j,L,$,V,z,E,A,k,b,y,_,x,M,B,P,H,W,K,D,X,O,N,U;const{$:w}=fs(C,Re.OPF),t=w(C.documentElement,"metadata"),h=Object.groupBy(t.children,q=>q.namespaceURI===Re.DC?"dc":q.namespaceURI===Re.OPF&&q.localName==="meta"?q.hasAttribute("name")?"legacyMeta":"meta":""),d=t.getAttribute("xml:lang")??C.documentElement.getAttribute("xml:lang")??"und",l=ag(C),i=q=>{const Y=q.getAttribute("property"),G=q.getAttribute("scheme");return{property:al(Y,l)??Y,scheme:al(G,l)??G,lang:q.getAttribute("xml:lang"),value:Gr(q),props:r(q),attrs:Object.fromEntries(Array.from(q.attributes).filter(Q=>Q.namespaceURI===Re.OPF).map(Q=>[Q.localName,Q.value]))}},o=Map.groupBy(h.meta??[],q=>q.getAttribute("refines")),r=q=>{const Y=o.get(q?"#"+q.getAttribute("id"):null);return Y?Object.groupBy(Y.map(i),G=>G.property):null},e=Object.fromEntries(Object.entries(Object.groupBy(h.dc||[],q=>q.localName)).map(([q,Y])=>[q,Y.map(i)])),n=r()??{},c=Object.fromEntries(((j=h.legacyMeta)==null?void 0:j.map(q=>[q.getAttribute("name"),q.getAttribute("content")]))??[]),a=q=>{var Y;return(Y=q==null?void 0:q[0])==null?void 0:Y.value},s=(q,Y)=>{var G;return a((G=q==null?void 0:q.props)==null?void 0:G[Y])},f=q=>{var rt,it;if(!q)return null;const Y=((rt=q.props)==null?void 0:rt["alternate-script"])??[],G=q.attrs["alt-rep"];if(!Y.length&&(!q.lang||q.lang===d)&&!G)return q.value;const Q={[q.lang??d]:q.value};G&&(Q[q.attrs["alt-rep-lang"]]=G);for(const J of Y)Q[it=J.lang]??(Q[it]=J.value);return Q},p=q=>{var Y,G,Q,rt,it;return q?{name:f(q),sortAs:f((G=(Y=q.props)==null?void 0:Y["file-as"])==null?void 0:G[0])??q.attrs["file-as"],role:((it=(rt=(Q=q.props)==null?void 0:Q.role)==null?void 0:rt.filter(J=>J.scheme===rn.marc+"relators"))==null?void 0:it.map(J=>J.value))??[q.attrs.role],code:s(q,"term")??q.attrs.term,scheme:s(q,"authority")??q.attrs.authority}:null},u=q=>{var Y;return{name:f(q),position:a((Y=q.props)==null?void 0:Y["group-position"])}},g=q=>{var Q;const{value:Y}=q;if(/^urn:/i.test(Y))return Y;if(/^doi:/i.test(Y))return`urn:${Y}`;const G=(Q=q.props)==null?void 0:Q["identifier-type"];if(!G){const rt=q.attrs.scheme;return rt?/^(doi|isbn|uuid)$/i.test(rt)?`urn:${rt}:${Y}`:{scheme:rt,value:Y}:Y}if(G.scheme===rn.onix+"codelist5"){const rt=eg[G.value];if(rt)return`urn:${rt}:${Y}`}return Y},m=Object.groupBy(n["belongs-to-collection"]??[],q=>s(q,"collection-type")==="series"?"series":"collection"),v=((L=e.title)==null?void 0:L.find(q=>s(q,"title-type")==="main"))??(($=e.title)==null?void 0:$[0]),S={identifier:Pc(C),title:f(v),sortAs:f((z=(V=v==null?void 0:v.props)==null?void 0:V["file-as"])==null?void 0:z[0])??((E=v==null?void 0:v.attrs)==null?void 0:E["file-as"])??(c==null?void 0:c["calibre:title_sort"]),subtitle:(k=(A=e.title)==null?void 0:A.find(q=>s(q,"title-type")==="subtitle"))==null?void 0:k.value,language:(b=e.language)==null?void 0:b.map(q=>q.value),description:a(e.description),publisher:p((y=e.publisher)==null?void 0:y[0]),published:((x=(_=e.date)==null?void 0:_.find(q=>q.attrs.event==="publication"))==null?void 0:x.value)??a(e.date),modified:a(n[rn.dcterms+"modified"])??((B=(M=e.date)==null?void 0:M.find(q=>q.attrs.event==="modification"))==null?void 0:B.value),subject:(P=e.subject)==null?void 0:P.map(p),belongsTo:{collection:(H=m.collection)==null?void 0:H.map(u),series:((W=m.series)==null?void 0:W.map(u))??(c==null?void 0:c["calibre:series"])?{name:c==null?void 0:c["calibre:series"],position:parseFloat(c==null?void 0:c["calibre:series_index"])}:null},altIdentifier:(K=e.identifier)==null?void 0:K.map(g),source:(D=e.source)==null?void 0:D.map(g),rights:a(e.rights)},R=q=>Y=>{var Q;const G=new Set((Q=Y.role)==null?void 0:Q.map(rt=>tg[rt]??q));return[G.size?G:[q],Y]};for(const[q,Y]of[].concat(((O=(X=e.creator)==null?void 0:X.map(p))==null?void 0:O.map(R("author")))??[],((U=(N=e.contributor)==null?void 0:N.map(p))==null?void 0:U.map(R("contributor")))??[]))for(const G of q)S[G]?S[G].push(Y):S[G]=[Y];$o(S),S.altIdentifier===S.identifier&&delete S.altIdentifier;const I={},F={};for(const[q,Y]of Object.entries(n))q.startsWith(rn.rendition)?I[zo(q.replace(rn.rendition,""))]=a(Y):q.startsWith(rn.media)&&(F[zo(q.replace(rn.media,""))]=a(Y));return F.duration&&(F.duration=Vo(F.duration)),{metadata:S,rendition:I,media:F}},cg=(C,w=t=>t)=>{var f;const{$:t,$$:h,$$$:d}=fs(C,Re.XHTML),l=p=>p?decodeURI(w(p)):null,i=p=>u=>{var I;const g=t(u,"a")??t(u,"span"),m=t(u,"ol"),v=l(g==null?void 0:g.getAttribute("href")),R={label:Gr(g)||(g==null?void 0:g.getAttribute("title")),href:v,subitems:o(m)};return p&&(R.type=(I=g==null?void 0:g.getAttributeNS(Re.EPUB,"type"))==null?void 0:I.split(/\s/)),R},o=(p,u)=>p?h(p,"li").map(i(u)):null,r=(p,u)=>o(t(p,"ol"),u),e=d(C,"nav");let n=null,c=null,a=null,s=[];for(const p of e){const u=((f=p.getAttributeNS(Re.EPUB,"type"))==null?void 0:f.split(/\s/))??[];u.includes("toc")?n??(n=r(p)):u.includes("page-list")?c??(c=r(p)):u.includes("landmarks")?a??(a=r(p,!0)):s.push({label:Gr(p.firstElementChild),type:u,list:r(p)})}return{toc:n,pageList:c,landmarks:a,others:s}},ug=(C,w=t=>t)=>{const{$:t,$$:h}=fs(C,Re.NCX),d=r=>r?decodeURI(w(r)):null,l=r=>{const e=t(r,"navLabel"),n=t(r,"content"),c=Gr(e),a=d(n.getAttribute("src"));if(r.localName==="navPoint"){const s=h(r,"navPoint");return{label:c,href:a,subitems:s.length?s.map(l):null}}return{label:c,href:a}},i=(r,e)=>h(r,e).map(l),o=(r,e)=>{const n=t(C.documentElement,r);return n?i(n,e):null};return{toc:o("navMap","navPoint"),pageList:o("pageList","pageTarget"),others:h(C.documentElement,"navList").map(r=>({label:Gr(t(r,"navLabel")),list:i(r,"navTarget")}))}},Vo=C=>{if(!C)return;const w=C.split(":").map(i=>parseFloat(i));if(w.length===3){const[i,o,r]=w;return i*60*60+o*60+r}if(w.length===2){const[i,o]=w;return i*60+o}const[t,h]=C.split(/(?=[^\d.])/),d=parseFloat(t),l=h==="h"?60*60:h==="min"?60:h==="ms"?.001:1;return d*l};var on,$i,jn,lr,Ye,Le,Vi,Ui,an,te,Bc,Ds,Cn,Tn,Ls,zs,Mn,Uo;class fg extends EventTarget{constructor(t,h){super();mt(this,te);mt(this,on);mt(this,$i);mt(this,jn);mt(this,lr);mt(this,Ye);mt(this,Le);mt(this,Vi,1);mt(this,Ui,1);mt(this,an);this.book=t,this.loadXML=h}async start(t,h=()=>!0){var o;(o=Z(this,Le))==null||o.pause();const d=this.book.sections[t],l=d==null?void 0:d.id;if(!l)return;const{mediaOverlay:i}=d;if(!i)return this.start(t+1);gt(this,jn,t),await ht(this,te,Bc).call(this,i);for(let r=0;r<Z(this,on).length;r++){const{items:e}=Z(this,on)[r];for(let n=0;n<e.length;n++)if(e[n].text.split("#")[0]===l&&h(e[n],n,e))return ht(this,te,Mn).call(this,r,n).catch(c=>ht(this,te,Tn).call(this,c))}}pause(){var t;gt(this,an,"paused"),(t=Z(this,Le))==null||t.pause()}resume(){var t;gt(this,an,"playing"),(t=Z(this,Le))==null||t.play().catch(h=>ht(this,te,Tn).call(this,h))}stop(){gt(this,an,"stopped"),ht(this,te,Uo).call(this)}prev(){Z(this,Ye)>0?ht(this,te,Mn).call(this,Z(this,lr),Z(this,Ye)-1):Z(this,lr)>0?ht(this,te,Mn).call(this,Z(this,lr)-1,Z(this,on)[Z(this,lr)-1].items.length-1):Z(this,jn)>0&&this.start(Z(this,jn)-1,(t,h,d)=>h===d.length-1)}next(){ht(this,te,Mn).call(this,Z(this,lr),Z(this,Ye)+1)}setVolume(t){gt(this,Vi,t),Z(this,Le)&&(Z(this,Le).volume=t)}setRate(t){gt(this,Ui,t),Z(this,Le)&&(Z(this,Le).playbackRate=t)}}on=new WeakMap,$i=new WeakMap,jn=new WeakMap,lr=new WeakMap,Ye=new WeakMap,Le=new WeakMap,Vi=new WeakMap,Ui=new WeakMap,an=new WeakMap,te=new WeakSet,Bc=async function(t){if(Z(this,$i)===t)return;const h=await this.loadXML(t.href),d=o=>o?ii(o,t.href):null,{$:l,$$$:i}=fs(h,Re.SMIL);gt(this,lr,-1),gt(this,Ye,-1),gt(this,on,i(h,"par").reduce((o,r)=>{var p;const e=d((p=l(r,"text"))==null?void 0:p.getAttribute("src")),n=l(r,"audio");if(!e||!n)return o;const c=d(n.getAttribute("src")),a=Vo(n.getAttribute("clipBegin")),s=Vo(n.getAttribute("clipEnd")),f=o.at(-1);return(f==null?void 0:f.src)===c?f.items.push({text:e,begin:a,end:s}):o.push({src:c,items:[{text:e,begin:a,end:s}]}),o},[])),gt(this,$i,t)},Ds=function(){return Z(this,on)[Z(this,lr)]},Cn=function(){var t,h;return(h=(t=Z(this,te,Ds))==null?void 0:t.items)==null?void 0:h[Z(this,Ye)]},Tn=function(t){console.error(t),this.dispatchEvent(new CustomEvent("error",{detail:t}))},Ls=function(){this.dispatchEvent(new CustomEvent("highlight",{detail:Z(this,te,Cn)}))},zs=function(){this.dispatchEvent(new CustomEvent("unhighlight",{detail:Z(this,te,Cn)}))},Mn=async function(t,h){var o;ht(this,te,Uo).call(this),gt(this,lr,t),gt(this,Ye,h);const d=(o=Z(this,te,Ds))==null?void 0:o.src;if(!d||!Z(this,te,Cn))return this.start(Z(this,jn)+1);const l=URL.createObjectURL(await this.book.loadBlob(d)),i=new Audio(l);gt(this,Le,i),i.volume=Z(this,Vi),i.playbackRate=Z(this,Ui),i.addEventListener("timeupdate",()=>{var c,a;if(i.paused)return;const r=i.currentTime,{items:e}=Z(this,te,Ds);if(r>((c=Z(this,te,Cn))==null?void 0:c.end)&&(ht(this,te,zs).call(this),Z(this,Ye)===e.length-1)){ht(this,te,Mn).call(this,Z(this,lr)+1,0).catch(s=>ht(this,te,Tn).call(this,s));return}const n=Z(this,Ye);for(;((a=e[Z(this,Ye)+1])==null?void 0:a.begin)<=r;)Ei(this,Ye)._++;Z(this,Ye)!==n&&ht(this,te,Ls).call(this)}),i.addEventListener("error",()=>ht(this,te,Tn).call(this,new Error(`Failed to load ${d}`))),i.addEventListener("playing",()=>ht(this,te,Ls).call(this)),i.addEventListener("ended",()=>{ht(this,te,zs).call(this),URL.revokeObjectURL(l),gt(this,Le,null),ht(this,te,Mn).call(this,t+1,0).catch(r=>ht(this,te,Tn).call(this,r))}),Z(this,an)==="paused"?(ht(this,te,Ls).call(this),i.currentTime=Z(this,te,Cn).begin??0):i.addEventListener("canplaythrough",()=>{i.currentTime=Z(this,te,Cn).begin??0,gt(this,an,"playing"),i.play().catch(r=>ht(this,te,Tn).call(this,r))},{once:!0})},Uo=function(){Z(this,Le)&&(Z(this,Le).pause(),URL.revokeObjectURL(Z(this,Le).src),gt(this,Le,null),ht(this,te,zs).call(this))};const hg=/([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})/,dg=C=>{for(const w of C.getElementsByTagNameNS(Re.DC,"identifier")){const[t]=Gr(w).split(":").slice(-1);if(hg.test(t))return t}return""},Pc=C=>Gr(C.getElementById(C.documentElement.getAttribute("unique-identifier"))??C.getElementsByTagNameNS(Re.DC,"identifier")[0]),ll=async(C,w,t)=>{const h=new Uint8Array(await t.slice(0,w).arrayBuffer());w=Math.min(w,h.length);for(var d=0;d<w;d++)h[d]=h[d]^C[d%C.length];return new Blob([h,t.slice(w)],{type:t.type})},pg=async C=>{const w=new TextEncoder().encode(C),t=await globalThis.crypto.subtle.digest("SHA-1",w);return new Uint8Array(t)},mg=(C=pg)=>({"http://www.idpf.org/2008/embedding":{key:w=>C(Pc(w).replaceAll(/[\u0020\u0009\u000d\u000a]/g,"")),decode:(w,t)=>ll(w,1040,t)},"http://ns.adobe.com/pdf/enc#RC":{key:w=>{const t=dg(w).replaceAll("-","");return Uint8Array.from({length:16},(h,d)=>parseInt(t.slice(d*2,d*2+2),16))},decode:(w,t)=>ll(w,1024,t)}});var Hi,oi,Wi;class gg{constructor(w){mt(this,Hi,new Map);mt(this,oi,new Map);mt(this,Wi);gt(this,Wi,w)}async init(w,t){if(!w)return;const h=Array.from(w.getElementsByTagNameNS(Re.ENC,"EncryptedData"),d=>{var l,i;return{algorithm:(l=d.getElementsByTagNameNS(Re.ENC,"EncryptionMethod")[0])==null?void 0:l.getAttribute("Algorithm"),uri:(i=d.getElementsByTagNameNS(Re.ENC,"CipherReference")[0])==null?void 0:i.getAttribute("URI")}});for(const{algorithm:d,uri:l}of h){if(!Z(this,oi).has(d)){const i=Z(this,Wi)[d];if(!i){console.warn("Unknown encryption algorithm");continue}const o=await i.key(t);Z(this,oi).set(d,r=>i.decode(o,r))}Z(this,Hi).set(l,d)}}getDecoder(w){return Z(this,oi).get(Z(this,Hi).get(w))??(t=>t)}}Hi=new WeakMap,oi=new WeakMap,Wi=new WeakMap;class bg{constructor({opf:w,resolveHref:t}){var n,c,a,s,f;this.opf=w;const{$:h,$$:d,$$$:l}=fs(w,Re.OPF),i=h(w.documentElement,"manifest"),o=h(w.documentElement,"spine"),r=d(o,"itemref");this.manifest=d(i,"item").map(Fs("href","id","media-type","properties","media-overlay")).map(p=>{var u;return p.href=t(p.href),p.properties=(u=p.properties)==null?void 0:u.split(/\s/),p}),this.spine=r.map(Fs("idref","id","linear","properties")).map(p=>{var u;return p.properties=(u=p.properties)==null?void 0:u.split(/\s/),p}),this.pageProgressionDirection=o.getAttribute("page-progression-direction"),this.navPath=(n=this.getItemByProperty("nav"))==null?void 0:n.href,this.ncxPath=(c=this.getItemByID(o.getAttribute("toc"))??this.manifest.find(p=>p.mediaType===Ue.NCX))==null?void 0:c.href;const e=h(w.documentElement,"guide");e&&(this.guide=d(e,"reference").map(Fs("type","title","href")).map(({type:p,title:u,href:g})=>({label:u,type:p.split(/\s/),href:t(g)}))),this.cover=this.getItemByProperty("cover-image")??this.getItemByID((a=l(w,"meta").find(ng("name","cover")))==null?void 0:a.getAttribute("content"))??this.manifest.find(p=>p.href.includes("cover")&&p.mediaType.startsWith("image"))??this.getItemByHref((f=(s=this.guide)==null?void 0:s.find(p=>p.type.includes("cover")))==null?void 0:f.href),this.cfis=Td(r)}getItemByID(w){return this.manifest.find(t=>t.id===w)}getItemByHref(w){return this.manifest.find(t=>t.href===w)}getItemByProperty(w){return this.manifest.find(t=>{var h;return(h=t.properties)==null?void 0:h.includes(w)})}resolveCFI(w){const t=Bi(w),h=(t.parent??t).shift();let d=Na(this.opf,h);d&&d.nodeName!=="idref"&&(h.at(-1).id=null,d=Na(this.opf,h));const l=d==null?void 0:d.getAttribute("idref");return{index:this.spine.findIndex(r=>r.idref===l),anchor:r=>Ll(r,t)}}}var $r,Vr,Mr;class vg{constructor({loadText:w,loadBlob:t,resources:h}){mt(this,$r,new Map);mt(this,Vr,new Map);mt(this,Mr,new Map);De(this,"allowScript",!1);De(this,"eventTarget",new EventTarget);this.loadText=w,this.loadBlob=t,this.manifest=h.manifest,this.assets=h.manifest}async createURL(w,t,h,d){if(!t)return"";const l={data:t,type:h};Object.defineProperty(l,"name",{value:w});const i=new CustomEvent("data",{detail:l});this.eventTarget.dispatchEvent(i);const o=await i.detail.data,r=await i.detail.type,e=URL.createObjectURL(new Blob([o],{type:r}));if(Z(this,$r).set(w,e),Z(this,Mr).set(w,1),d){const n=Z(this,Vr).get(d);n?n.push(w):Z(this,Vr).set(d,[w])}return e}ref(w,t){const h=Z(this,Vr).get(t);return h!=null&&h.includes(w)||(Z(this,Mr).set(w,Z(this,Mr).get(w)+1),h?h.push(w):Z(this,Vr).set(t,[w])),Z(this,$r).get(w)}unref(w){if(!Z(this,Mr).has(w))return;const t=Z(this,Mr).get(w)-1;if(t<1){URL.revokeObjectURL(Z(this,$r).get(w)),Z(this,$r).delete(w),Z(this,Mr).delete(w);const h=Z(this,Vr).get(w);if(h)for(;h.length;)this.unref(h.pop());Z(this,Vr).delete(w)}else Z(this,Mr).set(w,t)}async loadItem(w,t=[]){if(!w)return null;const{href:h,mediaType:d}=w,l=Ue.JS.test(w.mediaType);if(l&&!this.allowScript)return null;const i=t.at(-1);if(Z(this,$r).has(h))return this.ref(h,i);if((l||[Ue.XHTML,Ue.HTML,Ue.CSS,Ue.SVG].includes(d))&&t.every(e=>e!==h))return this.loadReplaced(w,t);const r=Promise.resolve().then(()=>this.loadBlob(h));return this.createURL(h,r,d,i)}async loadHref(w,t,h=[]){if(Ic(w))return w;const d=ii(w,t),l=this.manifest.find(i=>i.href===d);return l?this.loadItem(l,h.concat(t)):w}async loadReplaced(w,t=[]){var r,e;const{href:h,mediaType:d}=w,l=t.at(-1);let i="";try{i=await this.loadText(h)}catch(n){return this.createURL(h,Promise.reject(n),d,l)}if(!i)return null;if([Ue.XHTML,Ue.HTML,Ue.SVG].includes(d)){let n=new DOMParser().parseFromString(i,d);if(d===Ue.XHTML&&(n.querySelector("parsererror")||!((r=n.documentElement)!=null&&r.namespaceURI))&&(console.warn(((e=n.querySelector("parsererror"))==null?void 0:e.innerText)??"Invalid XHTML"),w.mediaType=Ue.HTML,n=new DOMParser().parseFromString(i,w.mediaType)),[Ue.XHTML,Ue.SVG].includes(w.mediaType)){let s=n.firstChild;for(;s instanceof ProcessingInstruction;){if(s.data){const f=await Cs(s.data,/(?:^|\s*)(href\s*=\s*['"])([^'"]*)(['"])/i,(p,u,g,m)=>this.loadHref(g,h,t).then(v=>`${u}${v}${m}`));s.replaceWith(n.createProcessingInstruction(s.target,f))}s=s.nextSibling}}const c=async(s,f)=>s.setAttribute(f,await this.loadHref(s.getAttribute(f),h,t));for(const s of n.querySelectorAll("link[href]"))await c(s,"href");for(const s of n.querySelectorAll("[src]"))await c(s,"src");for(const s of n.querySelectorAll("[poster]"))await c(s,"poster");for(const s of n.querySelectorAll("object[data]"))await c(s,"data");for(const s of n.querySelectorAll("[*|href]:not([href])"))s.setAttributeNS(Re.XLINK,"href",await this.loadHref(s.getAttributeNS(Re.XLINK,"href"),h,t));for(const s of n.querySelectorAll("style"))s.textContent&&(s.textContent=await this.replaceCSS(s.textContent,h,t));for(const s of n.querySelectorAll("[style]"))s.setAttribute("style",await this.replaceCSS(s.getAttribute("style"),h,t));const a=new XMLSerializer().serializeToString(n);return this.createURL(h,a,w.mediaType,l)}const o=d===Ue.CSS?await this.replaceCSS(i,h,t):await this.replaceString(i,h,t);return this.createURL(h,o,d,l)}async replaceCSS(w,t,h=[]){const d=await Cs(w,/url\(\s*["']?([^'"\n]*?)\s*["']?\s*\)/gi,(l,i)=>this.loadHref(i,t,h).then(o=>`url("${o}")`));return Cs(d,/@import\s*["']([^"'\n]*?)["']/gi,(l,i)=>this.loadHref(i,t,h).then(o=>`@import "${o}"`))}replaceString(w,t,h=[]){const d=new Map,l=this.assets.map(o=>{if(o.href===t)return;const r=ig(sg(t),o.href),e=encodeURI(r),n="/"+o.href,c=encodeURI(n),a=new Set([r,e,n,c]);for(const s of a)d.set(s,o);return Array.from(a)}).flat().filter(o=>o);if(!l.length)return w;const i=new RegExp(l.map(og).join("|"),"g");return Cs(w,i,async o=>this.loadItem(d.get(o.replace(/^\//,"")),h.concat(t)))}unloadItem(w){this.unref(w==null?void 0:w.href)}destroy(){for(const w of Z(this,$r).values())URL.revokeObjectURL(w)}}$r=new WeakMap,Vr=new WeakMap,Mr=new WeakMap;const yg=(C,w)=>C.getElementById(w)??C.querySelector(`[name="${CSS.escape(w)}"]`),wg=C=>{for(const w of C){if(w==="page-spread-left"||w==="rendition:page-spread-left")return"left";if(w==="page-spread-right"||w==="rendition:page-spread-right")return"right";if(w==="rendition:page-spread-center")return"center"}},_g=C=>C?{fixedLayout:Gr(C.querySelector('option[name="fixed-layout"]')),openToSpread:Gr(C.querySelector('option[name="open-to-spread"]'))}:null;var ln,ai,yr,Fr;class xg{constructor({loadText:w,loadBlob:t,getSize:h,sha1:d}){mt(this,yr);De(this,"parser",new DOMParser);mt(this,ln);mt(this,ai);this.loadText=w,this.loadBlob=t,this.getSize=h,gt(this,ai,new gg(mg(d)))}async init(){var a,s;const w=await ht(this,yr,Fr).call(this,"META-INF/container.xml");if(!w)throw new Error("Failed to load container file");const t=Array.from(w.getElementsByTagNameNS(Re.CONTAINER,"rootfile"),Fs("full-path","media-type")).filter(f=>f.mediaType==="application/oebps-package+xml");if(!t.length)throw new Error("No package document defined in container");const h=t[0].fullPath,d=await ht(this,yr,Fr).call(this,h);if(!d)throw new Error("Failed to load package document");const l=await ht(this,yr,Fr).call(this,"META-INF/encryption.xml");await Z(this,ai).init(l,d),this.resources=new bg({opf:d,resolveHref:f=>ii(f,h)}),gt(this,ln,new vg({loadText:this.loadText,loadBlob:f=>Promise.resolve(this.loadBlob(f)).then(Z(this,ai).getDecoder(f)),resources:this.resources})),this.transformTarget=Z(this,ln).eventTarget,this.sections=this.resources.spine.map((f,p)=>{const{idref:u,linear:g,properties:m=[]}=f,v=this.resources.getItemByID(u);return v?{id:v.href,load:()=>Z(this,ln).loadItem(v),unload:()=>Z(this,ln).unloadItem(v),createDocument:()=>this.loadDocument(v),size:this.getSize(v.href),cfi:this.resources.cfis[p],linear:g,pageSpread:wg(m),resolveHref:S=>ii(S,v.href),mediaOverlay:v.mediaOverlay?this.resources.getItemByID(v.mediaOverlay):null}:(console.warn(`Could not find item with ID "${u}" in manifest`),null)}).filter(f=>f);const{navPath:i,ncxPath:o}=this.resources;if(i)try{const f=u=>ii(u,i),p=cg(await ht(this,yr,Fr).call(this,i),f);this.toc=p.toc,this.pageList=p.pageList,this.landmarks=p.landmarks}catch(f){console.warn(f)}if(!this.toc&&o)try{const f=u=>ii(u,o),p=ug(await ht(this,yr,Fr).call(this,o),f);this.toc=p.toc,this.pageList=p.pageList}catch(f){console.warn(f)}this.landmarks??(this.landmarks=this.resources.guide);const{metadata:r,rendition:e,media:n}=lg(d);this.metadata=r,this.rendition=e,this.media=n,this.dir=this.resources.pageProgressionDirection;const c=_g(await ht(this,yr,Fr).call(this,"META-INF/com.apple.ibooks.display-options.xml")??await ht(this,yr,Fr).call(this,"META-INF/com.kobobooks.display-options.xml"));return c&&(c.fixedLayout==="true"&&((a=this.rendition).layout??(a.layout="pre-paginated")),c.openToSpread==="false"&&((s=this.sections.find(f=>f.linear!=="no")).pageSpread??(s.pageSpread=this.dir==="rtl"?"left":"right"))),this}async loadDocument(w){const t=await this.loadText(w.href);return this.parser.parseFromString(t,w.mediaType)}getMediaOverlay(){return new fg(this,ht(this,yr,Fr).bind(this))}resolveCFI(w){return this.resources.resolveCFI(w)}resolveHref(w){const[t,h]=w.split("#"),d=this.resources.getItemByHref(decodeURI(t));return d?{index:this.resources.spine.findIndex(({idref:o})=>o===d.id),anchor:h?o=>yg(o,h):()=>0}:null}splitTOCHref(w){return(w==null?void 0:w.split("#"))??[]}getTOCFragment(w,t){return w.getElementById(t)??w.querySelector(`[name="${CSS.escape(t)}"]`)}isExternal(w){return Ic(w)}async getCover(){var t;const w=(t=this.resources)==null?void 0:t.cover;return w!=null&&w.href?new Blob([await this.loadBlob(w.href)],{type:w.mediaType}):null}async getCalibreBookmarks(){const w=await this.loadText("META-INF/calibre_bookmarks.txt"),t="encoding=json+base64:";if(w!=null&&w.startsWith(t)){const h=atob(w.slice(t.length));return JSON.parse(h)}}destroy(){var w;(w=Z(this,ln))==null||w.destroy()}}ln=new WeakMap,ai=new WeakMap,yr=new WeakSet,Fr=async function(w){const t=await this.loadText(w);if(!t)return null;const h=this.parser.parseFromString(t,Ue.XML);if(h.querySelector("parsererror"))throw new Error(`XML parsing error: ${w}
117
- ${h.querySelector("parsererror").innerText}`);return h};const cl=Object.freeze(Object.defineProperty({__proto__:null,EPUB:xg},Symbol.toStringTag,{value:"Module"})),kg=async({entries:C,loadBlob:w,getSize:t,getComment:h},d)=>{const l=new Map,i=new Map,o=async a=>{if(l.has(a))return l.get(a);const s=URL.createObjectURL(await w(a)),f=URL.createObjectURL(new Blob([`<body style="margin: 0"><img src="${s}">`],{type:"text/html"}));return i.set(a,[s,f]),l.set(a,f),f},r=a=>{var s,f;(f=(s=i.get(a))==null?void 0:s.forEach)==null||f.call(s,p=>URL.revokeObjectURL(p)),i.delete(a),l.delete(a)},e=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".jxl",".avif"],n=C.map(a=>a.filename).filter(a=>e.some(s=>a.endsWith(s))).sort();if(!n.length)throw new Error("No supported image files in archive");const c={};try{const s=JSON.parse(await h()||"")["ComicBookInfo/1.0"];if(s){const f=s.publicationYear,p=s.publicationMonth,u=p&&p>=1&&p<=12?String(p).padStart(2,"0"):null;c.metadata={title:s.title||d.name,publisher:s.publisher,language:s.language||s.lang,author:s.credits?s.credits.map(g=>`${g.person} (${g.role})`).join(", "):"",published:f&&p?`${f}-${u}`:void 0}}else c.metadata={title:d.name}}catch{c.metadata={title:d.name}}return c.getCover=()=>w(n[0]),c.sections=n.map(a=>({id:a,load:()=>o(a),unload:()=>r(a),size:t(a)})),c.toc=n.map(a=>({label:a,href:a})),c.rendition={layout:"pre-paginated"},c.resolveHref=a=>({index:c.sections.findIndex(s=>s.id===a)}),c.splitTOCHref=a=>[a,null],c.getTOCFragment=a=>a.documentElement,c.destroy=()=>{for(const a of i.values())for(const s of a)URL.revokeObjectURL(s)},c},Sg=Object.freeze(Object.defineProperty({__proto__:null,makeComicBook:kg},Symbol.toStringTag,{value:"Module"})),Fc=C=>C?C.replace(/[\t\n\f\r ]+/g," ").replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,""):"",sr=C=>Fc(C==null?void 0:C.textContent),Ts={XLINK:"http://www.w3.org/1999/xlink",EPUB:"http://www.idpf.org/2007/ops"},Js={XML:"application/xml",XHTML:"application/xhtml+xml"},ir={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"},Eg={tr:["tr",{th:["th",ir,["colspan","rowspan","align","valign"]],td:["td",ir,["colspan","rowspan","align","valign"]]},["align"]]},Dc={epigraph:["blockquote"],subtitle:["h2",ir],"text-author":["p",ir],date:["p",ir],stanza:"stanza"},Qs={title:["header",{p:["h1",ir],"empty-line":["br"]}],epigraph:["blockquote","self"],image:"image",annotation:["aside"],section:["section","self"],p:["p",ir],poem:["blockquote",Dc],subtitle:["h2",ir],cite:["blockquote","self"],"empty-line":["br"],table:["table",Eg],"text-author":["p",ir]};Dc.epigraph.push(Qs);const Cg={image:"image",title:["section",{p:["h1",ir],"empty-line":["br"]}],epigraph:["section",Qs],section:["section",Qs]};class Tg{constructor(w){this.fb2=w,this.doc=document.implementation.createDocument(Ts.XHTML,"html"),this.bins=new Map(Array.from(this.fb2.getElementsByTagName("binary"),t=>[t.id,t]))}getImageSrc(w){const t=w.getAttributeNS(Ts.XLINK,"href");if(!t)return"data:,";const[,h]=t.split("#");if(!h)return t;const d=this.bins.get(h);return d?`data:${d.getAttribute("content-type")};base64,${d.textContent}`:t}image(w){const t=this.doc.createElement("img");return t.alt=w.getAttribute("alt"),t.title=w.getAttribute("title"),t.setAttribute("src",this.getImageSrc(w)),t}anchor(w){const t=this.convert(w,{a:["a",ir]});return t.setAttribute("href",w.getAttributeNS(Ts.XLINK,"href")),w.getAttribute("type")==="note"&&t.setAttributeNS(Ts.EPUB,"epub:type","noteref"),t}stanza(w){const t=this.convert(w,{stanza:["p",{title:["header",{p:["strong",ir],"empty-line":["br"]}],subtitle:["p",ir]}]});for(const h of w.children)h.nodeName==="v"&&(t.append(this.doc.createTextNode(h.textContent)),t.append(this.doc.createElement("br")));return t}convert(w,t){if(w.nodeType===3)return this.doc.createTextNode(w.textContent);if(w.nodeType===4)return this.doc.createCDATASection(w.textContent);if(w.nodeType===8)return this.doc.createComment(w.textContent);const h=t==null?void 0:t[w.nodeName];if(!h)return null;if(typeof h=="string")return this[h](w);const[d,l,i]=h,o=this.doc.createElement(d);if(w.id&&(o.id=w.id),o.classList.add(w.nodeName),Array.isArray(i))for(const n of i){const c=w.getAttribute(n);c&&o.setAttribute(n,c)}const r=l==="self"?t:l;let e=w.firstChild;for(;e;){const n=this.convert(e,r);n&&o.append(n),e=e.nextSibling}return o}}const Mg=async C=>{var i;const w=await C.arrayBuffer(),t=new TextDecoder("utf-8").decode(w),h=new DOMParser,d=h.parseFromString(t,Js.XML),l=d.xmlEncoding||((i=t.match(/^<\?xml\s+version\s*=\s*["']1.\d+"\s+encoding\s*=\s*["']([A-Za-z0-9._-]*)["']/))==null?void 0:i[1]);if(l&&l.toLowerCase()!=="utf-8"){const o=new TextDecoder(l).decode(w);return h.parseFromString(o,Js.XML)}return d},Ag=URL.createObjectURL(new Blob([`
116
+ `)},r=n=>{try{const a=new DOMParser().parseFromString(n,"application/xml");if(a.querySelector("parsererror"))return n;const f=new XMLSerializer().serializeToString(a);return o(f)}catch{return n}},e=async()=>{l.value=!0,i.value=null;try{const n=await ki(w.url);h.value=r(n);try{d.value=await ra.codeToHtml(h.value,{lang:"xml",theme:"dark-plus"})}catch{d.value=""}}catch(n){console.error(n),i.value=t.value("xml.load_failed")}finally{l.value=!1}};return T.watch(()=>w.url,e,{immediate:!0}),(n,c)=>l.value?(T.openBlock(),T.createElementBlock("div",gm,[...c[0]||(c[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",bm,[T.createElementVNode("div",vm,[T.createElementVNode("p",ym,T.toDisplayString(i.value),1)])])):(T.openBlock(),T.createElementBlock("div",wm,[d.value?(T.openBlock(),T.createElementBlock("div",{key:1,class:"shiki-wrapper",innerHTML:d.value},null,8,xm)):(T.openBlock(),T.createElementBlock("pre",_m,T.toDisplayString(h.value),1))]))}}),Sm=Ir(km,[["__scopeId","data-v-805043d3"]]),Em={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-bg-[#0f0f12]"},Cm={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-bg-[#0f0f12]"},Tm={class:"vfp-text-white/70 vfp-text-center"},Mm={class:"vfp-text-lg"},Am={class:"content-scroll"},Rm={class:"timeline"},Nm={class:"cues"},Om={class:"cue-meta"},jm={class:"cue-time"},Im={class:"cue-time"},Bm={class:"cue-id"},Pm={key:0,class:"cue-style"},Fm={key:0,class:"cue-words"},Dm=["title"],Lm={class:"cue-word-time"},zm={class:"cue-word-text"},$m={class:"status-pill"},Vm=T.defineComponent({__name:"index",props:{url:{},fileName:{}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(!0),l=T.ref(null),i={srt:"srt",vtt:"vtt",lrc:"lrc",elrc:"elrc",ass:"ass",ssa:"ssa",ttml:"ttml",dfxp:"ttml"},o=s=>{var p;const f=((p=s.split(".").pop())==null?void 0:p.toLowerCase())||"";return i[f]},r=async()=>{d.value=!0,l.value=null;try{h.value=await ki(w.url)}catch(s){console.error(s),l.value=t.value("subtitle.load_failed")}finally{d.value=!1}};T.watch(()=>w.url,r,{immediate:!0});const e=T.computed(()=>{if(!h.value)return null;try{return Au(h.value,o(w.fileName))}catch(s){return console.error(s),null}}),n=T.computed(()=>{var s,f;return((s=e.value)==null?void 0:s.format)==="lrc"||((f=e.value)==null?void 0:f.format)==="elrc"}),c=T.computed(()=>{var s;return((s=e.value)==null?void 0:s.metadata)??{}}),a=s=>_s(s).slice(3,8);return(s,f)=>d.value?(T.openBlock(),T.createElementBlock("div",Em,[...f[0]||(f[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):l.value||!e.value?(T.openBlock(),T.createElementBlock("div",Cm,[T.createElementVNode("div",Tm,[T.createElementVNode("p",Mm,T.toDisplayString(l.value||T.unref(t)("subtitle.parse_failed")),1)])])):(T.openBlock(),T.createElementBlock("div",{key:2,class:T.normalizeClass(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]",n.value?"flavor-lyric":"flavor-subtitle"])},[T.createElementVNode("div",Am,[T.createElementVNode("div",Rm,[f[3]||(f[3]=T.createElementVNode("div",{class:"timeline-line"},null,-1)),T.createElementVNode("ol",Nm,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(e.value.cues,(p,u)=>(T.openBlock(),T.createElementBlock("li",{key:"cue-"+u,class:"cue-row"},[f[2]||(f[2]=T.createElementVNode("div",{class:"cue-dot"},null,-1)),T.createElementVNode("div",Om,[T.createElementVNode("span",jm,T.toDisplayString(T.unref(_s)(p.start)),1),f[1]||(f[1]=T.createElementVNode("span",{class:"cue-arrow"},"→",-1)),T.createElementVNode("span",Im,T.toDisplayString(T.unref(_s)(p.end)),1),T.createElementVNode("span",Bm,"#"+T.toDisplayString(p.id??u+1),1),p.style?(T.openBlock(),T.createElementBlock("span",Pm,T.toDisplayString(p.style),1)):T.createCommentVNode("",!0)]),p.words&&p.words.length>0?(T.openBlock(),T.createElementBlock("div",Fm,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(p.words,(g,m)=>(T.openBlock(),T.createElementBlock("span",{key:"w-"+m,class:"cue-word",title:T.unref(_s)(g.start)},[T.createElementVNode("span",Lm,T.toDisplayString(a(g.start)),1),T.createElementVNode("span",zm,T.toDisplayString(g.text),1)],8,Dm))),128))])):(T.openBlock(),T.createElementBlock("p",{key:1,class:T.normalizeClass(["cue-text",{lyric:n.value}])},T.toDisplayString(p.text),3))]))),128))])])]),T.createElementVNode("div",$m,[T.createElementVNode("span",null,T.toDisplayString(e.value.cues.length)+" "+T.toDisplayString(n.value?T.unref(t)("subtitle.lines"):T.unref(t)("subtitle.cues")),1),c.value.length?(T.openBlock(),T.createElementBlock(T.Fragment,{key:0},[f[4]||(f[4]=T.createElementVNode("span",{class:"dot"},"·",-1)),T.createElementVNode("span",null,T.toDisplayString(c.value.length),1)],64)):T.createCommentVNode("",!0)])],2))}}),Um=Ir(Vm,[["__scopeId","data-v-1ebcbb6d"]]),Hm={class:"vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden"},Wm=T.defineComponent({name:"ResizableSplit",__name:"ResizableSplit",props:{initialLeftWidth:{default:280},minLeftWidth:{default:160},maxLeftWidth:{default:640},minRightWidth:{default:200},storageKey:{},desktopMedia:{default:"(min-width: 768px)"}},setup(C){const w=C,t=T.ref(null),h=T.ref((()=>{if(w.storageKey&&typeof window<"u"){const a=Number(window.localStorage.getItem(w.storageKey));if(!isNaN(a)&&a>0)return a}return w.initialLeftWidth})()),d=T.ref(!1),l=T.ref(!1);let i=null;const o=()=>{i&&(l.value=i.matches)},r=T.computed(()=>l.value?{width:`${h.value}px`}:void 0),e=a=>{if(!t.value)return;const s=t.value.getBoundingClientRect(),f=a.clientX-s.left,p=s.width-w.minRightWidth-6,u=Math.min(w.maxLeftWidth,p);h.value=Math.max(w.minLeftWidth,Math.min(u,f))},n=()=>{if(d.value&&(d.value=!1,window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n),document.body.style.cursor="",document.body.style.userSelect="",w.storageKey))try{window.localStorage.setItem(w.storageKey,String(h.value))}catch{}},c=a=>{a.preventDefault(),d.value=!0,window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),document.body.style.cursor="col-resize",document.body.style.userSelect="none"};return T.onMounted(()=>{typeof window<"u"&&(i=window.matchMedia(w.desktopMedia),o(),i.addEventListener("change",o))}),T.onBeforeUnmount(()=>{i&&i.removeEventListener("change",o),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n),d.value&&(document.body.style.cursor="",document.body.style.userSelect="")}),T.watch(()=>w.initialLeftWidth,a=>{w.storageKey||(h.value=a)}),(a,s)=>(T.openBlock(),T.createElementBlock("div",{ref_key:"containerRef",ref:t,class:"vfp-w-full vfp-h-full vfp-flex vfp-flex-col md:vfp-flex-row vfp-min-h-0 vfp-min-w-0"},[T.createElementVNode("div",{class:"vfp-min-h-0 vfp-min-w-0 vfp-flex-shrink-0 vfp-w-full vfp-max-h-60 md:vfp-h-full md:vfp-max-h-none",style:T.normalizeStyle(r.value)},[T.renderSlot(a.$slots,"left",{},void 0,!0)],4),T.createElementVNode("div",{role:"separator","aria-orientation":"vertical",class:T.normalizeClass(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors",d.value?"dragging":""]),onMousedown:c},[...s[0]||(s[0]=[T.createElementVNode("span",{class:"vfp-absolute vfp-inset-y-0 hit-area"},null,-1)])],34),T.createElementVNode("div",Hm,[T.renderSlot(a.$slots,"right",{},void 0,!0)])],512))}}),qm=Ir(Wm,[["__scopeId","data-v-790c366f"]]),Xm={key:0},Zm={class:"vfp-truncate vfp-flex-1 vfp-min-w-0"},Gm={class:"vfp-flex-1 vfp-truncate vfp-min-w-0"},Km={class:"vfp-text-xs vfp-text-white/30 vfp-flex-shrink-0 vfp-ml-2"},Ym={name:"ZipTreeItem"},Jm=T.defineComponent({...Ym,props:{node:{},depth:{},selectedPath:{},expanded:{}},emits:["toggle","select","hover","leave"],setup(C,{emit:w}){const t=C,h=w,d=T.computed(()=>({paddingLeft:`${t.depth*14+10}px`})),l=T.computed(()=>t.expanded.has(t.node.path)),i=T.computed(()=>t.selectedPath===t.node.path),o=T.computed(()=>{const n=na({name:t.node.name,type:""});return n==="image"?Ot.FileImage:n==="text"||n==="markdown"||n==="json"||n==="csv"||n==="xml"||n==="subtitle"?t.node.name.endsWith(".md")||t.node.name.endsWith(".markdown")?Ot.FileText:Ot.FileCode:Ot.File}),r=n=>{const c=n.currentTarget.getBoundingClientRect();h("hover",t.node.name||"/",c)},e=()=>h("leave");return(n,c)=>{const a=T.resolveComponent("ZipTreeItem");return C.node.isDir?(T.openBlock(),T.createElementBlock("div",Xm,[T.createElementVNode("button",{type:"button",class:"tree-row dir-row",style:T.normalizeStyle(d.value),onClick:c[0]||(c[0]=s=>h("toggle",C.node.path)),onMouseenter:r,onMouseleave:e},[T.createVNode(T.unref(Ot.ChevronRight),{class:T.normalizeClass(["vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0 vfp-transition-transform",{"vfp-rotate-90":l.value}])},null,8,["class"]),(T.openBlock(),T.createBlock(T.resolveDynamicComponent(l.value?T.unref(Ot.FolderOpen):T.unref(Ot.Folder)),{class:"vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80"})),T.createElementVNode("span",Zm,T.toDisplayString(C.node.name||"/"),1)],36),l.value&&C.node.children?(T.openBlock(!0),T.createElementBlock(T.Fragment,{key:0},T.renderList(C.node.children,s=>(T.openBlock(),T.createBlock(a,{key:s.path,node:s,depth:C.depth+1,"selected-path":C.selectedPath,expanded:C.expanded,onToggle:c[1]||(c[1]=f=>h("toggle",f)),onSelect:c[2]||(c[2]=f=>h("select",f)),onHover:c[3]||(c[3]=(f,p)=>h("hover",f,p)),onLeave:c[4]||(c[4]=f=>h("leave"))},null,8,["node","depth","selected-path","expanded"]))),128)):T.createCommentVNode("",!0)])):(T.openBlock(),T.createElementBlock("button",{key:1,type:"button",class:T.normalizeClass(["tree-row file-row",{selected:i.value}]),style:T.normalizeStyle(d.value),onClick:c[5]||(c[5]=s=>h("select",C.node)),onMouseenter:r,onMouseleave:e},[c[6]||(c[6]=T.createElementVNode("span",{class:"vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0"},null,-1)),(T.openBlock(),T.createBlock(T.resolveDynamicComponent(o.value),{class:"vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-white/50"})),T.createElementVNode("span",Gm,T.toDisplayString(C.node.name),1),T.createElementVNode("span",Km,T.toDisplayString(T.unref(ia)(C.node.size)),1)],38))}}}),Qm=Ir(Jm,[["__scopeId","data-v-5385318d"]]),t0={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},e0={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},r0={class:"vfp-text-white/70 vfp-text-center"},n0={class:"vfp-text-lg"},i0={class:"vfp-w-full vfp-h-full vfp-overflow-auto"},s0={class:"vfp-w-full vfp-h-full vfp-flex vfp-flex-col"},o0={key:0,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/40 vfp-text-sm vfp-p-6"},a0={key:1,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center"},l0={key:2,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-white/70"},c0={key:3,class:"vfp-flex-1 vfp-min-h-0 vfp-overflow-hidden vfp-flex"},u0=T.defineComponent({__name:"index",props:{url:{},nestingDepth:{default:0}},emits:["statsChange"],setup(C,{emit:w}){const t=T.defineAsyncComponent(()=>Promise.resolve().then(()=>U0)),h=C,d=w,{t:l}=Te(),i=T.ref(null),o=T.ref(null),r=T.ref(!0),e=T.ref(null),n=T.ref(new Set([""])),c=T.ref(null),a=T.ref(!1),s=T.ref(null),f=T.ref(null),p=()=>{var F;(F=c.value)!=null&&F.blobUrl&&URL.revokeObjectURL(c.value.blobUrl)},u=async()=>{p(),c.value=null,r.value=!0,e.value=null;try{const F=await fetch(h.url);if(!F.ok)throw new Error("加载失败");const j=await F.arrayBuffer(),L=await Ru(j),$=Nu(L),V=Ou($);i.value=L,o.value=V;const z=new Set([""]);if(V.children)for(const E of V.children)E.isDir&&z.add(E.path);n.value=z}catch(F){console.error(F),e.value=l.value("zip.load_failed")}finally{r.value=!1}};T.watch(()=>h.url,u,{immediate:!0}),T.onBeforeUnmount(()=>{p()});const g=T.computed(()=>{if(!o.value)return null;let F=0,j=0,L=0;const $=V=>{var z;V.isDir?(V.path&&j++,(z=V.children)==null||z.forEach($)):(F++,L+=V.size)};return $(o.value),{files:F,dirs:j,size:L}});T.watch(g,F=>d("statsChange",F),{immediate:!0}),T.onBeforeUnmount(()=>d("statsChange",null));const m=F=>{const j=new Set(n.value);j.has(F)?j.delete(F):j.add(F),n.value=j},v=(F,j)=>{f.value={text:F,x:j.right+8,y:j.top+j.height/2}},S=()=>{f.value=null},R=async F=>{if(!(!i.value||F.isDir)){p(),a.value=!0,s.value=null;try{const j=Oi(F.name),L=await ju(i.value,F.path,j!=="application/octet-stream"?j:void 0),$=URL.createObjectURL(L);c.value={path:F.path,name:F.name,size:F.size,blobUrl:$}}catch(j){console.error(j),s.value="条目读取失败"}finally{a.value=!1}}},I=T.computed(()=>c.value?[{name:c.value.name,url:c.value.blobUrl,type:Oi(c.value.name)}]:[]);return(F,j)=>r.value?(T.openBlock(),T.createElementBlock("div",t0,[...j[0]||(j[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):e.value||!o.value?(T.openBlock(),T.createElementBlock("div",e0,[T.createElementVNode("div",r0,[T.createElementVNode("p",n0,T.toDisplayString(e.value||T.unref(l)("zip.parse_failed")),1)])])):(T.openBlock(),T.createElementBlock(T.Fragment,{key:2},[T.createVNode(qm,{"initial-left-width":280,"min-left-width":180,"max-left-width":560,"storage-key":"vfp-zip-split-left"},{left:T.withCtx(()=>[T.createElementVNode("div",i0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(o.value.children||[],L=>{var $;return T.openBlock(),T.createBlock(Qm,{key:L.path,node:L,depth:0,"selected-path":(($=c.value)==null?void 0:$.path)??null,expanded:n.value,onToggle:m,onSelect:R,onHover:v,onLeave:S},null,8,["node","selected-path","expanded"])}),128))])]),right:T.withCtx(()=>[T.createElementVNode("div",s0,[c.value?a.value?(T.openBlock(),T.createElementBlock("div",a0,[...j[1]||(j[1]=[T.createElementVNode("div",{class:"vfp-w-8 vfp-h-8 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):s.value?(T.openBlock(),T.createElementBlock("div",l0,T.toDisplayString(s.value),1)):(T.openBlock(),T.createElementBlock("div",c0,[T.createVNode(T.unref(t),{mode:"embed",files:I.value,"current-index":0,"zip-nesting-depth":C.nestingDepth+1},null,8,["files","zip-nesting-depth"])])):(T.openBlock(),T.createElementBlock("div",o0," 从左侧选择一个文件以预览 "))])]),_:1}),(T.openBlock(),T.createBlock(T.Teleport,{to:"body"},[f.value?(T.openBlock(),T.createElementBlock("div",{key:0,class:"vfp-zip-tip",style:T.normalizeStyle({left:f.value.x+"px",top:f.value.y+"px"})},T.toDisplayString(f.value.text),5)):T.createCommentVNode("",!0)]))],64))}}),f0={key:0,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},h0={key:1,class:"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"},d0={class:"vfp-text-white/70 vfp-text-center"},p0={class:"vfp-text-lg"},m0={key:2,class:"vfp-w-full vfp-h-full vfp-bg-white"},g0=["srcdoc","title"],b0={key:3,class:"vfp-w-full vfp-h-full vfp-overflow-auto",style:{background:"#1e1e1e"}},v0=["innerHTML"],y0=T.defineComponent({__name:"index",props:{url:{},fileName:{},wordWrap:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1}},setup(C){const w=C,{t}=Te(),h=T.ref(""),d=T.ref(""),l=T.ref(!0),i=T.ref(null),o=T.computed(()=>yu(w.fileName)),r=async()=>{l.value=!0,i.value=null;try{const e=await ki(w.url);if(h.value=e,o.value!=="text")try{d.value=await ra.codeToHtml(e,{lang:o.value,theme:"dark-plus"})}catch{d.value=""}else d.value=""}catch(e){console.error(e),i.value=t.value("text.load_failed")}finally{l.value=!1}};return T.watch(()=>w.url,r,{immediate:!0}),(e,n)=>l.value?(T.openBlock(),T.createElementBlock("div",f0,[...n[0]||(n[0]=[T.createElementVNode("div",{class:"vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-white/20 vfp-border-t-white vfp-rounded-full vfp-animate-spin"},null,-1)])])):i.value?(T.openBlock(),T.createElementBlock("div",h0,[T.createElementVNode("div",d0,[T.createElementVNode("p",p0,T.toDisplayString(i.value),1)])])):C.htmlPreview&&o.value==="html"?(T.openBlock(),T.createElementBlock("div",m0,[T.createElementVNode("iframe",{srcdoc:h.value,sandbox:"allow-same-origin",class:"vfp-w-full vfp-h-full vfp-border-0",title:C.fileName},null,8,g0)])):(T.openBlock(),T.createElementBlock("div",b0,[d.value?(T.openBlock(),T.createElementBlock("div",{key:1,class:T.normalizeClass(["shiki-wrapper",{"no-wrap":!C.wordWrap}]),innerHTML:d.value},null,10,v0)):(T.openBlock(),T.createElementBlock("pre",{key:0,class:T.normalizeClass(["vfp-p-6 vfp-text-white/90 vfp-font-mono vfp-text-sm",C.wordWrap?"vfp-whitespace-pre-wrap vfp-break-words":"vfp-whitespace-pre"])},T.toDisplayString(h.value),3))]))}}),w0=Ir(y0,[["__scopeId","data-v-82d3d091"]]),_0={class:"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-8 vfp-gap-6"},x0={class:"vfp-w-32 vfp-h-32 vfp-rounded-full vfp-bg-white/10 vfp-flex vfp-items-center vfp-justify-center"},k0={class:"vfp-text-white vfp-text-center"},S0={class:"vfp-text-xl vfp-font-medium vfp-mb-2"},E0={class:"vfp-text-white/70"},Fa=T.defineComponent({__name:"index",props:{fileName:{},fileType:{}},emits:["download"],setup(C,{emit:w}){const{t}=Te(),h=w;return(d,l)=>(T.openBlock(),T.createElementBlock("div",_0,[T.createElementVNode("div",x0,[T.createVNode(T.unref(Ot.FileQuestion),{class:"vfp-w-16 vfp-h-16 vfp-text-white/70"})]),T.createElementVNode("div",k0,[T.createElementVNode("p",S0,T.toDisplayString(C.fileName),1),T.createElementVNode("p",E0,T.toDisplayString(T.unref(t)("common.unsupported_preview",{type:C.fileType})),1)]),T.createElementVNode("button",{class:"vfp-flex vfp-items-center vfp-gap-2 vfp-px-6 vfp-py-3 vfp-bg-white/10 hover:vfp-bg-white/20 vfp-backdrop-blur-sm vfp-rounded-lg vfp-text-white vfp-font-medium vfp-transition-all",onClick:l[0]||(l[0]=i=>h("download"))},[T.createVNode(T.unref(Ot.Download),{class:"vfp-w-5 vfp-h-5"}),T.createTextVNode(" "+T.toDisplayString(T.unref(t)("common.download")),1)])]))}}),C0=["tabindex"],T0={class:"vfp-flex-shrink-0 vfp-z-10 vfp-bg-black/50 vfp-backdrop-blur-md vfp-border-b vfp-border-white/10",style:{"padding-top":"env(safe-area-inset-top, 0px)"}},M0={class:"vfp-flex vfp-items-center vfp-justify-between vfp-px-3 md:vfp-px-5 vfp-py-1.5 md:vfp-py-2.5"},A0={class:"vfp-flex vfp-items-center vfp-flex-1 vfp-min-w-0 vfp-mr-2 md:vfp-mr-3"},R0={class:"vfp-text-white/90 vfp-font-medium vfp-text-xs md:vfp-text-sm vfp-truncate"},N0={class:"vfp-text-white/40 vfp-text-xs vfp-ml-2 vfp-flex-shrink-0"},O0={class:"vfp-flex vfp-items-center vfp-gap-1 md:vfp-hidden vfp-flex-shrink-0"},j0=["data-tooltip","disabled","onClick"],I0={class:"vfp-hidden md:vfp-flex vfp-items-center vfp-gap-1 vfp-flex-shrink-0"},B0=["data-tooltip","disabled","onClick"],P0=["data-tooltip","disabled","onClick"],F0={key:0,class:"vfp-flex vfp-items-center vfp-gap-1 vfp-px-3 vfp-pb-1.5 vfp-overflow-x-auto scrollbar-hide md:vfp-hidden"},D0={key:0,class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-0.5"},L0=["data-tooltip","disabled","onClick"],z0=3,$0=2e3,V0=T.defineComponent({__name:"FilePreviewContent",props:{files:{},currentIndex:{},customRenderers:{default:()=>[]},mode:{default:"modal"},zipNestingDepth:{default:0},locale:{default:void 0},messages:{default:void 0}},emits:["navigate","close"],setup(C,{emit:w}){const t=C,h=w;jl(T.toRef(t,"locale"),T.toRef(t,"messages"));const{t:d}=Te(),l=T.ref(1),i=T.ref(0),o=T.ref(1),r=T.ref(1),e=T.ref(0),n=T.ref(0),c=T.ref(0),a=T.ref(null),s=T.ref(null),f=T.ref(!0);let p=null;const u=()=>{f.value=!0,p!==null&&clearTimeout(p),p=window.setTimeout(()=>{f.value=!1},$0)},g=()=>u(),m=T.computed(()=>Rl(t.files)),v=T.computed(()=>m.value[t.currentIndex]),S=T.computed(()=>v.value&&t.customRenderers.find(rt=>rt.test(v.value))||null),R=T.computed(()=>!S.value||!v.value?null:S.value.render(v.value)),I=T.computed(()=>v.value?na(v.value):"unsupported");T.watch(()=>t.currentIndex,()=>{l.value=1,i.value=0,o.value=1,r.value=1,e.value=0,n.value=0,f.value=!0,p!==null&&clearTimeout(p)}),T.watch([I,e,n],()=>{if(I.value==="image"&&e.value>0&&n.value>0&&a.value){const rt=a.value.clientWidth,it=a.value.clientHeight,J=rt/e.value,et=it/n.value,nt=Math.min(J,et);l.value=Math.max(.01,Math.min(10,nt))}}),T.watch(()=>m.value.length,rt=>{rt>1&&u()},{immediate:!0});const F=rt=>{rt.key==="Escape"&&t.mode==="modal"?h("close"):rt.key==="ArrowLeft"&&t.currentIndex>0?h("navigate",t.currentIndex-1):rt.key==="ArrowRight"&&t.currentIndex<m.value.length-1&&h("navigate",t.currentIndex+1)};T.onMounted(()=>{t.mode==="modal"?window.addEventListener("keydown",F):s.value&&s.value.addEventListener("keydown",F)}),T.onBeforeUnmount(()=>{p!==null&&clearTimeout(p),t.mode==="modal"?window.removeEventListener("keydown",F):s.value&&s.value.removeEventListener("keydown",F)});const j=()=>{l.value=Math.min(l.value+.1,10)},L=()=>{l.value=Math.max(l.value-.1,.01)},$=()=>{i.value=i.value+90},V=()=>{i.value=i.value-90},z=()=>{if(a.value&&e.value>0&&n.value>0){const rt=a.value.clientWidth,it=a.value.clientHeight,J=rt/e.value,et=it/n.value,nt=Math.min(J,et);l.value=Math.max(.01,Math.min(10,nt))}else l.value=1;i.value=0,c.value++},E=()=>{l.value=1,i.value=0,c.value++},A=rt=>{l.value=rt},k=()=>{l.value=1,i.value=0,c.value++},b=()=>{if(!v.value)return;const rt=document.createElement("a");rt.href=v.value.url,rt.download=v.value.name,rt.click()},y=T.computed(()=>t.mode==="modal"),_=T.ref(null),x=T.ref(0),M=T.ref(0),B=T.ref(!1),P=T.ref(null),H=T.ref(0),W=T.ref(0),K=T.ref(!1),D=(rt,it)=>{x.value=rt,M.value=it},X=(rt,it)=>{H.value=rt,W.value=it},O=T.ref(null),N=rt=>{O.value=rt},U=T.ref(!0),q=T.ref(!1),Y=T.computed(()=>{var rt;if(I.value==="image")return Qu({zoom:l.value,onZoomIn:j,onZoomOut:L,onFitToWidth:z,onOriginalSize:E,onRotateLeft:V,onRotateRight:$,onReset:k,t:d.value});if(I.value==="pdf")return tf({zoom:l.value,onZoomIn:j,onZoomOut:L,onReset:k,t:d.value});if(I.value==="epub")return ef({epubRef:_.value,current:x.value,total:M.value,fullWidth:B.value,t:d.value});if(I.value==="mobi")return rf({mobiRef:P.value,current:H.value,total:W.value,fullWidth:K.value,t:d.value});if(I.value==="zip")return nf({stats:O.value,t:d.value});if(I.value==="text"){const it=((rt=v.value.name.split(".").pop())==null?void 0:rt.toLowerCase())||"";return sf({wordWrap:U.value,onToggleWrap:()=>{U.value=!U.value},isHtml:it==="html"||it==="htm",htmlPreview:q.value,onToggleHtmlPreview:()=>{q.value=!q.value},t:d.value})}return[]}),G=T.computed(()=>{const rt=[{items:[{type:"button",icon:Ot.Download,tooltip:d.value("common.download"),action:b}]}];return y.value&&rt.push({items:[{type:"button",icon:Ot.X,tooltip:d.value("common.close"),action:()=>h("close")}]}),rt}),Q=T.computed(()=>Y.value.length>0);return(rt,it)=>{var J;return T.openBlock(),T.createElementBlock("div",{ref_key:"rootRef",ref:s,tabindex:C.mode==="embed"?0:-1,class:"vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-flex-col vfp-overflow-hidden vfp-outline-none"},[T.createElementVNode("div",T0,[T.createElementVNode("div",M0,[T.createElementVNode("div",A0,[T.createElementVNode("h2",R0,T.toDisplayString((J=v.value)==null?void 0:J.name),1),T.createElementVNode("span",N0,T.toDisplayString(C.currentIndex+1)+"/"+T.toDisplayString(m.value.length),1)]),T.createElementVNode("div",O0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(G.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-action-"+nt},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-action-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,j0)):T.createCommentVNode("",!0)],64))),128))],64))),128))]),T.createElementVNode("div",I0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(Y.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-tool-"+nt},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-tool-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,B0)):ot.type==="text"?(T.openBlock(),T.createElementBlock("span",{key:1,class:"vfp-text-white/60 vfp-text-xs vfp-text-center vfp-font-medium vfp-tabular-nums",style:T.normalizeStyle({minWidth:ot.minWidth||"auto"})},T.toDisplayString(ot.content),5)):T.createCommentVNode("",!0)],64))),128)),it[11]||(it[11]=T.createElementVNode("div",{class:"vfp-w-px vfp-h-4 vfp-bg-white/10 vfp-mx-1"},null,-1))],64))),128)),(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(G.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-action-"+nt},[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"d-action-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,P0)):T.createCommentVNode("",!0)],64))),128))],64))),128))])]),Q.value?(T.openBlock(),T.createElementBlock("div",F0,[(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(Y.value,(et,nt)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-tool-"+nt},[nt>0?(T.openBlock(),T.createElementBlock("div",D0)):T.createCommentVNode("",!0),(T.openBlock(!0),T.createElementBlock(T.Fragment,null,T.renderList(et.items,(ot,at)=>(T.openBlock(),T.createElementBlock(T.Fragment,{key:"m-tool-"+nt+"-"+at},[ot.type==="button"?(T.openBlock(),T.createElementBlock("button",{key:0,class:"toolbar-btn","data-tooltip":ot.tooltip,disabled:ot.disabled,onClick:ot.action},[(T.openBlock(),T.createBlock(T.resolveDynamicComponent(ot.icon),{class:"vfp-w-4 vfp-h-4"}))],8,L0)):ot.type==="text"?(T.openBlock(),T.createElementBlock("span",{key:1,class:"vfp-text-white/60 vfp-text-xs vfp-text-center vfp-font-medium vfp-tabular-nums",style:T.normalizeStyle({minWidth:ot.minWidth||"auto"})},T.toDisplayString(ot.content),5)):T.createCommentVNode("",!0)],64))),128))],64))),128))])):T.createCommentVNode("",!0)]),T.createElementVNode("div",{ref_key:"contentRef",ref:a,class:"vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-overflow-auto",onMousemove:g},[v.value?(T.openBlock(),T.createElementBlock(T.Fragment,{key:0},[R.value?(T.openBlock(),T.createBlock(T.resolveDynamicComponent(R.value),{key:0,file:v.value},null,8,["file"])):(T.openBlock(),T.createElementBlock(T.Fragment,{key:1},[I.value==="image"?(T.openBlock(),T.createBlock(ff,{key:0,url:v.value.url,zoom:l.value,rotation:i.value,"reset-key":c.value,"file-size":v.value.size,onZoomChange:A,onNaturalWidthChange:it[0]||(it[0]=et=>e.value=et),onNaturalHeightChange:it[1]||(it[1]=et=>n.value=et)},null,8,["url","zoom","rotation","reset-key","file-size"])):I.value==="pdf"?(T.openBlock(),T.createBlock(bf,{key:1,url:v.value.url,zoom:l.value,"current-page":o.value,onPageChange:it[2]||(it[2]=et=>o.value=et),onTotalPagesChange:it[3]||(it[3]=et=>r.value=et),onPageWidthChange:it[4]||(it[4]=et=>e.value=et)},null,8,["url","zoom","current-page"])):I.value==="docx"?(T.openBlock(),T.createBlock(Cf,{key:2,url:v.value.url},null,8,["url"])):I.value==="xlsx"?(T.openBlock(),T.createBlock(zf,{key:3,url:v.value.url},null,8,["url"])):I.value==="pptx"?(T.openBlock(),T.createBlock(Yf,{key:4,url:v.value.url},null,8,["url"])):I.value==="msg"?(T.openBlock(),T.createBlock(od,{key:5,url:v.value.url},null,8,["url"])):I.value==="epub"?(T.openBlock(),T.createBlock(bd,{key:6,ref_key:"epubRef",ref:_,url:v.value.url,onChapterChange:D,onFullWidthChange:it[5]||(it[5]=et=>B.value=et)},null,8,["url"])):I.value==="mobi"?(T.openBlock(),T.createBlock(ip,{key:7,ref_key:"mobiRef",ref:P,url:v.value.url,onChapterChange:X,onFullWidthChange:it[6]||(it[6]=et=>K.value=et)},null,8,["url"])):I.value==="video"?(T.openBlock(),T.createBlock(pp,{key:8,url:v.value.url},null,8,["url"])):I.value==="audio"?(T.openBlock(),T.createBlock($p,{key:9,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="markdown"?(T.openBlock(),T.createBlock(Kp,{key:10,url:v.value.url},null,8,["url"])):I.value==="json"?(T.openBlock(),T.createBlock(sm,{key:11,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="csv"?(T.openBlock(),T.createBlock(mm,{key:12,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="xml"?(T.openBlock(),T.createBlock(Sm,{key:13,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="subtitle"?(T.openBlock(),T.createBlock(Um,{key:14,url:v.value.url,"file-name":v.value.name},null,8,["url","file-name"])):I.value==="zip"&&t.zipNestingDepth>=z0?(T.openBlock(),T.createBlock(Fa,{key:15,"file-name":v.value.name,"file-type":v.value.type,onDownload:b},null,8,["file-name","file-type"])):I.value==="zip"?(T.openBlock(),T.createBlock(u0,{key:16,url:v.value.url,"nesting-depth":t.zipNestingDepth,onStatsChange:N},null,8,["url","nesting-depth"])):I.value==="text"?(T.openBlock(),T.createBlock(w0,{key:17,url:v.value.url,"file-name":v.value.name,"word-wrap":U.value,"html-preview":q.value},null,8,["url","file-name","word-wrap","html-preview"])):(T.openBlock(),T.createBlock(Fa,{key:18,"file-name":v.value.name,"file-type":v.value.type,onDownload:b},null,8,["file-name","file-type"]))],64))],64)):T.createCommentVNode("",!0)],544),m.value.length>1?(T.openBlock(),T.createElementBlock(T.Fragment,{key:0},[C.currentIndex>0?(T.openBlock(),T.createElementBlock("button",{key:0,style:T.normalizeStyle({opacity:f.value?1:0,transform:f.value?"translateY(-50%)":"translateY(-50%) translateX(-20px)",pointerEvents:f.value?"auto":"none",transition:"opacity 0.2s, transform 0.2s"}),class:"vfp-absolute vfp-z-20 vfp-left-2 md:vfp-left-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-bg-black/40 vfp-backdrop-blur-xl vfp-border vfp-border-white/10 vfp-flex vfp-items-center vfp-justify-center vfp-text-white hover:vfp-bg-black/60 vfp-transition-colors vfp-shadow-2xl",onClick:it[7]||(it[7]=et=>h("navigate",C.currentIndex-1)),onMouseenter:it[8]||(it[8]=et=>f.value=!0)},[T.createVNode(T.unref(Ot.ChevronLeft),{class:"vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6"})],36)):T.createCommentVNode("",!0),C.currentIndex<m.value.length-1?(T.openBlock(),T.createElementBlock("button",{key:1,style:T.normalizeStyle({opacity:f.value?1:0,transform:f.value?"translateY(-50%)":"translateY(-50%) translateX(20px)",pointerEvents:f.value?"auto":"none",transition:"opacity 0.2s, transform 0.2s"}),class:"vfp-absolute vfp-z-20 vfp-right-2 md:vfp-right-4 vfp-top-1/2 vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-rounded-full vfp-bg-black/40 vfp-backdrop-blur-xl vfp-border vfp-border-white/10 vfp-flex vfp-items-center vfp-justify-center vfp-text-white hover:vfp-bg-black/60 vfp-transition-colors vfp-shadow-2xl",onClick:it[9]||(it[9]=et=>h("navigate",C.currentIndex+1)),onMouseenter:it[10]||(it[10]=et=>f.value=!0)},[T.createVNode(T.unref(Ot.ChevronRight),{class:"vfp-w-5 vfp-h-5 md:vfp-w-6 md:vfp-h-6"})],36)):T.createCommentVNode("",!0)],64)):T.createCommentVNode("",!0)],8,C0)}}}),uo=Ir(V0,[["__scopeId","data-v-829ecc7c"]]),U0=Object.freeze(Object.defineProperty({__proto__:null,default:uo},Symbol.toStringTag,{value:"Module"}));function H0(C){let w="",t="",h=!1;const d=()=>{if(h||typeof document>"u")return;w=document.body.style.overflow,t=document.body.style.paddingRight;const i=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",i>0&&(document.body.style.paddingRight=`${i}px`),h=!0},l=()=>{!h||typeof document>"u"||(document.body.style.overflow=w,document.body.style.paddingRight=t,h=!1)};return T.onMounted(()=>{C()&&d()}),T.onUnmounted(()=>{l()}),{lock:d,unlock:l}}const W0={key:0,class:"vfp-root"},q0=T.defineComponent({__name:"FilePreviewModal",props:{files:{},currentIndex:{},isOpen:{type:Boolean},customRenderers:{default:()=>[]},locale:{default:void 0},messages:{default:void 0}},emits:["close","navigate"],setup(C,{emit:w}){const t=C,h=w,{lock:d,unlock:l}=H0(()=>t.isOpen);T.watch(()=>t.isOpen,e=>{e?d():l()});const i=()=>h("close"),o=e=>e.stopPropagation(),r=e=>e.stopPropagation();return(e,n)=>(T.openBlock(),T.createBlock(T.Teleport,{to:"body"},[T.createVNode(T.Transition,{name:"vfp-fade"},{default:T.withCtx(()=>[C.isOpen?(T.openBlock(),T.createElementBlock("div",W0,[T.createElementVNode("div",{class:"vfp-fixed vfp-inset-0 vfp-z-[9999] vfp-flex vfp-items-center vfp-justify-center vfp-bg-black/80 vfp-backdrop-blur-md vfp-overflow-hidden",onClick:i,onWheel:r},[T.createElementVNode("div",{class:"vfp-relative vfp-w-full vfp-h-full",onClick:o},[T.createVNode(uo,{mode:"modal",files:C.files,"current-index":C.currentIndex,"custom-renderers":C.customRenderers,locale:C.locale,messages:C.messages,onClose:n[0]||(n[0]=c=>h("close")),onNavigate:n[1]||(n[1]=c=>h("navigate",c))},null,8,["files","current-index","custom-renderers","locale","messages"])])],32)])):T.createCommentVNode("",!0)]),_:1})]))}}),X0={class:"vfp-relative vfp-w-full vfp-h-full vfp-overflow-hidden vfp-bg-black/80"},Z0=T.defineComponent({__name:"FilePreviewEmbed",props:{files:{},currentIndex:{default:0},customRenderers:{default:()=>[]},width:{default:"100%"},height:{default:"100%"},locale:{default:void 0},messages:{default:void 0}},emits:["navigate"],setup(C,{emit:w}){const t=C,h=w,d={width:typeof t.width=="number"?`${t.width}px`:t.width,height:typeof t.height=="number"?`${t.height}px`:t.height};return(l,i)=>(T.openBlock(),T.createElementBlock("div",{class:"vfp-root",style:d},[T.createElementVNode("div",X0,[T.createVNode(uo,{mode:"embed",files:C.files,"current-index":C.currentIndex,"custom-renderers":C.customRenderers,locale:C.locale,messages:C.messages,onNavigate:i[0]||(i[0]=o=>h("navigate",o))},null,8,["files","current-index","custom-renderers","locale","messages"])])]))}}),G0=bu.version,Qe=-2,_e=-3,Zr=-5,er=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],K0=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],Y0=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],J0=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Q0=[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,112,112],t1=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],e1=[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],Ss=15;function Bo(){let C,w,t,h,d,l;function i(r,e,n,c,a,s,f,p,u,g,m){let v,S,R,I,F,j,L,$,V,z,E,A,k,b,y;z=0,F=n;do t[r[e+z]]++,z++,F--;while(F!==0);if(t[0]==n)return f[0]=-1,p[0]=0,0;for($=p[0],j=1;j<=Ss&&t[j]===0;j++);for(L=j,$<j&&($=j),F=Ss;F!==0&&t[F]===0;F--);for(R=F,$>F&&($=F),p[0]=$,b=1<<j;j<F;j++,b<<=1)if((b-=t[j])<0)return _e;if((b-=t[F])<0)return _e;for(t[F]+=b,l[1]=j=0,z=1,k=2;--F!=0;)l[k]=j+=t[z],k++,z++;F=0,z=0;do(j=r[e+z])!==0&&(m[l[j]++]=F),z++;while(++F<n);for(n=l[R],l[0]=F=0,z=0,I=-1,A=-$,d[0]=0,E=0,y=0;L<=R;L++)for(v=t[L];v--!=0;){for(;L>A+$;){if(I++,A+=$,y=R-A,y=y>$?$:y,(S=1<<(j=L-A))>v+1&&(S-=v+1,k=L,j<y))for(;++j<y&&!((S<<=1)<=t[++k]);)S-=t[k];if(y=1<<j,g[0]+y>1440)return _e;d[I]=E=g[0],g[0]+=y,I!==0?(l[I]=F,h[0]=j,h[1]=$,j=F>>>A-$,h[2]=E-d[I-1]-j,u.set(h,3*(d[I-1]+j))):f[0]=E}for(h[1]=L-A,z>=n?h[0]=192:m[z]<c?(h[0]=m[z]<256?0:96,h[2]=m[z++]):(h[0]=s[m[z]-c]+16+64,h[2]=a[m[z++]-c]),S=1<<L-A,j=F>>>A;j<y;j+=S)u.set(h,3*(E+j));for(j=1<<L-1;F&j;j>>>=1)F^=j;for(F^=j,V=(1<<A)-1;(F&V)!=l[I];)I--,A-=$,V=(1<<A)-1}return b!==0&&R!=1?Zr:0}function o(r){let e;for(C||(C=[],w=[],t=new Int32Array(16),h=[],d=new Int32Array(Ss),l=new Int32Array(16)),w.length<r&&(w=[]),e=0;e<r;e++)w[e]=0;for(e=0;e<16;e++)t[e]=0;for(e=0;e<3;e++)h[e]=0;d.set(t.subarray(0,Ss),0),l.set(t.subarray(0,16),0)}this.inflate_trees_bits=function(r,e,n,c,a){let s;return o(19),C[0]=0,s=i(r,0,19,19,null,null,n,e,c,C,w),s==_e?a.msg="oversubscribed dynamic bit lengths tree":s!=Zr&&e[0]!==0||(a.msg="incomplete dynamic bit lengths tree",s=_e),s},this.inflate_trees_dynamic=function(r,e,n,c,a,s,f,p,u){let g;return o(288),C[0]=0,g=i(n,0,r,257,J0,Q0,s,c,p,C,w),g!=0||c[0]===0?(g==_e?u.msg="oversubscribed literal/length tree":g!=-4&&(u.msg="incomplete literal/length tree",g=_e),g):(o(288),g=i(n,r,e,0,t1,e1,f,a,p,C,w),g!=0||a[0]===0&&r>257?(g==_e?u.msg="oversubscribed distance tree":g==Zr?(u.msg="incomplete distance tree",g=_e):g!=-4&&(u.msg="empty distance tree with lengths",g=_e),g):0)}}Bo.inflate_trees_fixed=function(C,w,t,h){return C[0]=9,w[0]=5,t[0]=K0,h[0]=Y0,0};function r1(){const C=this;let w,t,h,d,l=0,i=0,o=0,r=0,e=0,n=0,c=0,a=0,s=0,f=0;function p(u,g,m,v,S,R,I,F){let j,L,$,V,z,E,A,k,b,y,_,x,M,B,P,H;A=F.next_in_index,k=F.avail_in,z=I.bitb,E=I.bitk,b=I.write,y=b<I.read?I.read-b-1:I.end-b,_=er[u],x=er[g];do{for(;E<20;)k--,z|=(255&F.read_byte(A++))<<E,E+=8;if(j=z&_,L=m,$=v,H=3*($+j),(V=L[H])!==0)for(;;){if(z>>=L[H+1],E-=L[H+1],16&V){for(V&=15,M=L[H+2]+(z&er[V]),z>>=V,E-=V;E<15;)k--,z|=(255&F.read_byte(A++))<<E,E+=8;for(j=z&x,L=S,$=R,H=3*($+j),V=L[H];;){if(z>>=L[H+1],E-=L[H+1],16&V){for(V&=15;E<V;)k--,z|=(255&F.read_byte(A++))<<E,E+=8;if(B=L[H+2]+(z&er[V]),z>>=V,E-=V,y-=M,b>=B)P=b-B,b-P>0&&2>b-P?(I.win[b++]=I.win[P++],I.win[b++]=I.win[P++],M-=2):(I.win.set(I.win.subarray(P,P+2),b),b+=2,P+=2,M-=2);else{P=b-B;do P+=I.end;while(P<0);if(V=I.end-P,M>V){if(M-=V,b-P>0&&V>b-P)do I.win[b++]=I.win[P++];while(--V!=0);else I.win.set(I.win.subarray(P,P+V),b),b+=V,P+=V,V=0;P=0}}if(b-P>0&&M>b-P)do I.win[b++]=I.win[P++];while(--M!=0);else I.win.set(I.win.subarray(P,P+M),b),b+=M,P+=M,M=0;break}if(64&V)return F.msg="invalid distance code",M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,_e;j+=L[H+2],j+=z&er[V],H=3*($+j),V=L[H]}break}if(64&V)return 32&V?(M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,1):(F.msg="invalid literal/length code",M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,_e);if(j+=L[H+2],j+=z&er[V],H=3*($+j),(V=L[H])===0){z>>=L[H+1],E-=L[H+1],I.win[b++]=L[H+2],y--;break}}else z>>=L[H+1],E-=L[H+1],I.win[b++]=L[H+2],y--}while(y>=258&&k>=10);return M=F.avail_in-k,M=E>>3<M?E>>3:M,k+=M,A-=M,E-=M<<3,I.bitb=z,I.bitk=E,F.avail_in=k,F.total_in+=A-F.next_in_index,F.next_in_index=A,I.write=b,0}C.init=function(u,g,m,v,S,R){w=0,c=u,a=g,h=m,s=v,d=S,f=R,t=null},C.proc=function(u,g,m){let v,S,R,I,F,j,L,$=0,V=0,z=0;for(z=g.next_in_index,I=g.avail_in,$=u.bitb,V=u.bitk,F=u.write,j=F<u.read?u.read-F-1:u.end-F;;)switch(w){case 0:if(j>=258&&I>=10&&(u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,m=p(c,a,h,s,d,f,u,g),z=g.next_in_index,I=g.avail_in,$=u.bitb,V=u.bitk,F=u.write,j=F<u.read?u.read-F-1:u.end-F,m!=0)){w=m==1?7:9;break}o=c,t=h,i=s,w=1;case 1:for(v=o;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}if(S=3*(i+($&er[v])),$>>>=t[S+1],V-=t[S+1],R=t[S],R===0){r=t[S+2],w=6;break}if(16&R){e=15&R,l=t[S+2],w=2;break}if(!(64&R)){o=R,i=S/3+t[S+2];break}if(32&R){w=7;break}return w=9,g.msg="invalid literal/length code",m=_e,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);case 2:for(v=e;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}l+=$&er[v],$>>=v,V-=v,o=a,t=d,i=f,w=3;case 3:for(v=o;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}if(S=3*(i+($&er[v])),$>>=t[S+1],V-=t[S+1],R=t[S],16&R){e=15&R,n=t[S+2],w=4;break}if(!(64&R)){o=R,i=S/3+t[S+2];break}return w=9,g.msg="invalid distance code",m=_e,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);case 4:for(v=e;V<v;){if(I===0)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,I--,$|=(255&g.read_byte(z++))<<V,V+=8}n+=$&er[v],$>>=v,V-=v,w=5;case 5:for(L=F-n;L<0;)L+=u.end;for(;l!==0;){if(j===0&&(F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0&&(u.write=F,m=u.inflate_flush(g,m),F=u.write,j=F<u.read?u.read-F-1:u.end-F,F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0)))return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);u.win[F++]=u.win[L++],j--,L==u.end&&(L=0),l--}w=0;break;case 6:if(j===0&&(F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0&&(u.write=F,m=u.inflate_flush(g,m),F=u.write,j=F<u.read?u.read-F-1:u.end-F,F==u.end&&u.read!==0&&(F=0,j=F<u.read?u.read-F-1:u.end-F),j===0)))return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);m=0,u.win[F++]=r,j--,w=0;break;case 7:if(V>7&&(V-=8,I++,z--),u.write=F,m=u.inflate_flush(g,m),F=u.write,j=F<u.read?u.read-F-1:u.end-F,u.read!=u.write)return u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);w=8;case 8:return m=1,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);case 9:return m=_e,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m);default:return m=Qe,u.bitb=$,u.bitk=V,g.avail_in=I,g.total_in+=z-g.next_in_index,g.next_in_index=z,u.write=F,u.inflate_flush(g,m)}},C.free=function(){}}const Da=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function n1(C,w){const t=this;let h,d=0,l=0,i=0,o=0;const r=[0],e=[0],n=new r1;let c=0,a=new Int32Array(4320);const s=new Bo;t.bitk=0,t.bitb=0,t.win=new Uint8Array(w),t.end=w,t.read=0,t.write=0,t.reset=function(f,p){p&&(p[0]=0),d==6&&n.free(f),d=0,t.bitk=0,t.bitb=0,t.read=t.write=0},t.reset(C,null),t.inflate_flush=function(f,p){let u,g,m;return g=f.next_out_index,m=t.read,u=(m<=t.write?t.write:t.end)-m,u>f.avail_out&&(u=f.avail_out),u!==0&&p==Zr&&(p=0),f.avail_out-=u,f.total_out+=u,f.next_out.set(t.win.subarray(m,m+u),g),g+=u,m+=u,m==t.end&&(m=0,t.write==t.end&&(t.write=0),u=t.write-m,u>f.avail_out&&(u=f.avail_out),u!==0&&p==Zr&&(p=0),f.avail_out-=u,f.total_out+=u,f.next_out.set(t.win.subarray(m,m+u),g),g+=u,m+=u),f.next_out_index=g,t.read=m,p},t.proc=function(f,p){let u,g,m,v,S,R,I,F;for(v=f.next_in_index,S=f.avail_in,g=t.bitb,m=t.bitk,R=t.write,I=R<t.read?t.read-R-1:t.end-R;;){let j,L,$,V,z,E,A,k;switch(d){case 0:for(;m<3;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}switch(u=7&g,c=1&u,u>>>1){case 0:g>>>=3,m-=3,u=7&m,g>>>=u,m-=u,d=1;break;case 1:j=[],L=[],$=[[]],V=[[]],Bo.inflate_trees_fixed(j,L,$,V),n.init(j[0],L[0],$[0],0,V[0],0),g>>>=3,m-=3,d=6;break;case 2:g>>>=3,m-=3,d=3;break;case 3:return g>>>=3,m-=3,d=9,f.msg="invalid block type",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p)}break;case 1:for(;m<32;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if((~g>>>16&65535)!=(65535&g))return d=9,f.msg="invalid stored block lengths",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);l=65535&g,g=m=0,d=l!==0?2:c!==0?7:0;break;case 2:if(S===0||I===0&&(R==t.end&&t.read!==0&&(R=0,I=R<t.read?t.read-R-1:t.end-R),I===0&&(t.write=R,p=t.inflate_flush(f,p),R=t.write,I=R<t.read?t.read-R-1:t.end-R,R==t.end&&t.read!==0&&(R=0,I=R<t.read?t.read-R-1:t.end-R),I===0)))return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);if(p=0,u=l,u>S&&(u=S),u>I&&(u=I),t.win.set(f.read_buf(v,u),R),v+=u,S-=u,R+=u,I-=u,(l-=u)!=0)break;d=c!==0?7:0;break;case 3:for(;m<14;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if(i=u=16383&g,(31&u)>29||(u>>5&31)>29)return d=9,f.msg="too many length or distance symbols",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);if(u=258+(31&u)+(u>>5&31),!h||h.length<u)h=[];else for(F=0;F<u;F++)h[F]=0;g>>>=14,m-=14,o=0,d=4;case 4:for(;o<4+(i>>>10);){for(;m<3;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}h[Da[o++]]=7&g,g>>>=3,m-=3}for(;o<19;)h[Da[o++]]=0;if(r[0]=7,u=s.inflate_trees_bits(h,r,e,a,f),u!=0)return(p=u)==_e&&(h=null,d=9),t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);o=0,d=5;case 5:for(;u=i,!(o>=258+(31&u)+(u>>5&31));){let b,y;for(u=r[0];m<u;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if(u=a[3*(e[0]+(g&er[u]))+1],y=a[3*(e[0]+(g&er[u]))+2],y<16)g>>>=u,m-=u,h[o++]=y;else{for(F=y==18?7:y-14,b=y==18?11:3;m<u+F;){if(S===0)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);p=0,S--,g|=(255&f.read_byte(v++))<<m,m+=8}if(g>>>=u,m-=u,b+=g&er[F],g>>>=F,m-=F,F=o,u=i,F+b>258+(31&u)+(u>>5&31)||y==16&&F<1)return h=null,d=9,f.msg="invalid bit length repeat",p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);y=y==16?h[F-1]:0;do h[F++]=y;while(--b!=0);o=F}}if(e[0]=-1,z=[],E=[],A=[],k=[],z[0]=9,E[0]=6,u=i,u=s.inflate_trees_dynamic(257+(31&u),1+(u>>5&31),h,z,E,A,k,a,f),u!=0)return u==_e&&(h=null,d=9),p=u,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);n.init(z[0],E[0],a,A[0],a,k[0]),d=6;case 6:if(t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,(p=n.proc(t,f,p))!=1)return t.inflate_flush(f,p);if(p=0,n.free(f),v=f.next_in_index,S=f.avail_in,g=t.bitb,m=t.bitk,R=t.write,I=R<t.read?t.read-R-1:t.end-R,c===0){d=0;break}d=7;case 7:if(t.write=R,p=t.inflate_flush(f,p),R=t.write,I=R<t.read?t.read-R-1:t.end-R,t.read!=t.write)return t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);d=8;case 8:return p=1,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);case 9:return p=_e,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p);default:return p=Qe,t.bitb=g,t.bitk=m,f.avail_in=S,f.total_in+=v-f.next_in_index,f.next_in_index=v,t.write=R,t.inflate_flush(f,p)}}},t.free=function(f){t.reset(f,null),t.win=null,a=null},t.set_dictionary=function(f,p,u){t.win.set(f.subarray(p,p+u),0),t.read=t.write=u},t.sync_point=function(){return d==1?1:0}}const Qr=13,i1=[0,0,255,255];function s1(){const C=this;function w(t){return t&&t.istate?(t.total_in=t.total_out=0,t.msg=null,t.istate.mode=7,t.istate.blocks.reset(t,null),0):Qe}C.mode=0,C.method=0,C.was=[0],C.need=0,C.marker=0,C.wbits=0,C.inflateEnd=function(t){return C.blocks&&C.blocks.free(t),C.blocks=null,0},C.inflateInit=function(t,h){return t.msg=null,C.blocks=null,h<8||h>15?(C.inflateEnd(t),Qe):(C.wbits=h,t.istate.blocks=new n1(t,1<<h),w(t),0)},C.inflate=function(t,h){let d,l;if(!t||!t.istate||!t.next_in)return Qe;const i=t.istate;for(h=h==4?Zr:0,d=Zr;;)switch(i.mode){case 0:if(t.avail_in===0)return d;if(d=h,t.avail_in--,t.total_in++,(15&(i.method=t.read_byte(t.next_in_index++)))!=8){i.mode=Qr,t.msg="unknown compression method",i.marker=5;break}if(8+(i.method>>4)>i.wbits){i.mode=Qr,t.msg="invalid win size",i.marker=5;break}i.mode=1;case 1:if(t.avail_in===0)return d;if(d=h,t.avail_in--,t.total_in++,l=255&t.read_byte(t.next_in_index++),((i.method<<8)+l)%31!=0){i.mode=Qr,t.msg="incorrect header check",i.marker=5;break}if(!(32&l)){i.mode=7;break}i.mode=2;case 2:if(t.avail_in===0)return d;d=h,t.avail_in--,t.total_in++,i.need=(255&t.read_byte(t.next_in_index++))<<24&4278190080,i.mode=3;case 3:if(t.avail_in===0)return d;d=h,t.avail_in--,t.total_in++,i.need+=(255&t.read_byte(t.next_in_index++))<<16&16711680,i.mode=4;case 4:if(t.avail_in===0)return d;d=h,t.avail_in--,t.total_in++,i.need+=(255&t.read_byte(t.next_in_index++))<<8&65280,i.mode=5;case 5:return t.avail_in===0?d:(d=h,t.avail_in--,t.total_in++,i.need+=255&t.read_byte(t.next_in_index++),i.mode=6,2);case 6:return i.mode=Qr,t.msg="need dictionary",i.marker=0,Qe;case 7:if(d=i.blocks.proc(t,d),d==_e){i.mode=Qr,i.marker=0;break}if(d==0&&(d=h),d!=1)return d;d=h,i.blocks.reset(t,i.was),i.mode=12;case 12:return t.avail_in=0,1;case Qr:return _e;default:return Qe}},C.inflateSetDictionary=function(t,h,d){let l=0,i=d;if(!t||!t.istate||t.istate.mode!=6)return Qe;const o=t.istate;return i>=1<<o.wbits&&(i=(1<<o.wbits)-1,l=d-i),o.blocks.set_dictionary(h,l,i),o.mode=7,0},C.inflateSync=function(t){let h,d,l,i,o;if(!t||!t.istate)return Qe;const r=t.istate;if(r.mode!=Qr&&(r.mode=Qr,r.marker=0),(h=t.avail_in)===0)return Zr;for(d=t.next_in_index,l=r.marker;h!==0&&l<4;)t.read_byte(d)==i1[l]?l++:l=t.read_byte(d)!==0?0:4-l,d++,h--;return t.total_in+=d-t.next_in_index,t.next_in_index=d,t.avail_in=h,r.marker=l,l!=4?_e:(i=t.total_in,o=t.total_out,w(t),t.total_in=i,t.total_out=o,r.mode=7,0)},C.inflateSyncPoint=function(t){return t&&t.istate&&t.istate.blocks?t.istate.blocks.sync_point():Qe}}function Yl(){}Yl.prototype={inflateInit(C){const w=this;return w.istate=new s1,C||(C=15),w.istate.inflateInit(w,C)},inflate(C){const w=this;return w.istate?w.istate.inflate(w,C):Qe},inflateEnd(){const C=this;if(!C.istate)return Qe;const w=C.istate.inflateEnd(C);return C.istate=null,w},inflateSync(){const C=this;return C.istate?C.istate.inflateSync(C):Qe},inflateSetDictionary(C,w){const t=this;return t.istate?t.istate.inflateSetDictionary(t,C,w):Qe},read_byte(C){return this.next_in[C]},read_buf(C,w){return this.next_in.subarray(C,C+w)}};const Un=4294967295,Nn=65535,La=33639248,za=101075792,Gn=22,Fe=void 0,wn="undefined",us="function";let $a=class{constructor(w){return class extends TransformStream{constructor(t,h){const d=new w(h);super({transform(l,i){i.enqueue(d.append(l))},flush(l){const i=d.flush();i&&l.enqueue(i)}})}}}},Jl=2;try{typeof navigator!=wn&&navigator.hardwareConcurrency&&(Jl=navigator.hardwareConcurrency)}catch{}const o1={chunkSize:524288,maxWorkers:Jl,terminateWorkerTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,workerScripts:Fe,CompressionStreamNative:typeof CompressionStream!=wn&&CompressionStream,DecompressionStreamNative:typeof DecompressionStream!=wn&&DecompressionStream},nn=Object.assign({},o1);function Ql(C){const{baseURL:w,chunkSize:t,maxWorkers:h,terminateWorkerTimeout:d,useCompressionStream:l,useWebWorkers:i,Deflate:o,Inflate:r,CompressionStream:e,DecompressionStream:n,workerScripts:c}=C;if(tn("baseURL",w),tn("chunkSize",t),tn("maxWorkers",h),tn("terminateWorkerTimeout",d),tn("useCompressionStream",l),tn("useWebWorkers",i),o&&(nn.CompressionStream=new $a(o)),r&&(nn.DecompressionStream=new $a(r)),tn("CompressionStream",e),tn("DecompressionStream",n),c!==Fe){const{deflate:a,inflate:s}=c;if((a||s)&&(nn.workerScripts||(nn.workerScripts={})),a){if(!Array.isArray(a))throw new Error("workerScripts.deflate must be an array");nn.workerScripts.deflate=a}if(s){if(!Array.isArray(s))throw new Error("workerScripts.inflate must be an array");nn.workerScripts.inflate=s}}}function tn(C,w){w!==Fe&&(nn[C]=w)}const tc=[];for(let C=0;C<256;C++){let w=C;for(let t=0;t<8;t++)1&w?w=w>>>1^3988292384:w>>>=1;tc[C]=w}class Zs{constructor(w){this.crc=w||-1}append(w){let t=0|this.crc;for(let h=0,d=0|w.length;h<d;h++)t=t>>>8^tc[255&(t^w[h])];this.crc=t}get(){return~this.crc}}class ec extends TransformStream{constructor(){let w;const t=new Zs;super({transform(h,d){t.append(h),d.enqueue(h)},flush(){const h=new Uint8Array(4);new DataView(h.buffer).setUint32(0,t.get()),w.value=h}}),w=this}}const qe={concat(C,w){if(C.length===0||w.length===0)return C.concat(w);const t=C[C.length-1],h=qe.getPartial(t);return h===32?C.concat(w):qe._shiftRight(w,h,0|t,C.slice(0,C.length-1))},bitLength(C){const w=C.length;if(w===0)return 0;const t=C[w-1];return 32*(w-1)+qe.getPartial(t)},clamp(C,w){if(32*C.length<w)return C;const t=(C=C.slice(0,Math.ceil(w/32))).length;return w&=31,t>0&&w&&(C[t-1]=qe.partial(w,C[t-1]&2147483648>>w-1,1)),C},partial:(C,w,t)=>C===32?w:(t?0|w:w<<32-C)+1099511627776*C,getPartial:C=>Math.round(C/1099511627776)||32,_shiftRight(C,w,t,h){for(h===void 0&&(h=[]);w>=32;w-=32)h.push(t),t=0;if(w===0)return h.concat(C);for(let i=0;i<C.length;i++)h.push(t|C[i]>>>w),t=C[i]<<32-w;const d=C.length?C[C.length-1]:0,l=qe.getPartial(d);return h.push(qe.partial(w+l&31,w+l>32?t:h.pop(),1)),h}},Gs={bytes:{fromBits(C){const w=qe.bitLength(C)/8,t=new Uint8Array(w);let h;for(let d=0;d<w;d++)3&d||(h=C[d/4]),t[d]=h>>>24,h<<=8;return t},toBits(C){const w=[];let t,h=0;for(t=0;t<C.length;t++)h=h<<8|C[t],3&~t||(w.push(h),h=0);return 3&t&&w.push(qe.partial(8*(3&t),h)),w}}},a1={sha1:class{constructor(C){const w=this;w.blockSize=512,w._init=[1732584193,4023233417,2562383102,271733878,3285377520],w._key=[1518500249,1859775393,2400959708,3395469782],C?(w._h=C._h.slice(0),w._buffer=C._buffer.slice(0),w._length=C._length):w.reset()}reset(){const C=this;return C._h=C._init.slice(0),C._buffer=[],C._length=0,C}update(C){const w=this;typeof C=="string"&&(C=Gs.utf8String.toBits(C));const t=w._buffer=qe.concat(w._buffer,C),h=w._length,d=w._length=h+qe.bitLength(C);if(d>9007199254740991)throw new Error("Cannot hash more than 2^53 - 1 bits");const l=new Uint32Array(t);let i=0;for(let o=w.blockSize+h-(w.blockSize+h&w.blockSize-1);o<=d;o+=w.blockSize)w._block(l.subarray(16*i,16*(i+1))),i+=1;return t.splice(0,16*i),w}finalize(){const C=this;let w=C._buffer;const t=C._h;w=qe.concat(w,[qe.partial(1,1)]);for(let h=w.length+2;15&h;h++)w.push(0);for(w.push(Math.floor(C._length/4294967296)),w.push(0|C._length);w.length;)C._block(w.splice(0,16));return C.reset(),t}_f(C,w,t,h){return C<=19?w&t|~w&h:C<=39?w^t^h:C<=59?w&t|w&h|t&h:C<=79?w^t^h:void 0}_S(C,w){return w<<C|w>>>32-C}_block(C){const w=this,t=w._h,h=Array(80);for(let e=0;e<16;e++)h[e]=C[e];let d=t[0],l=t[1],i=t[2],o=t[3],r=t[4];for(let e=0;e<=79;e++){e>=16&&(h[e]=w._S(1,h[e-3]^h[e-8]^h[e-14]^h[e-16]));const n=w._S(5,d)+w._f(e,l,i,o)+r+h[e]+w._key[Math.floor(e/20)]|0;r=o,o=i,i=w._S(30,l),l=d,d=n}t[0]=t[0]+d|0,t[1]=t[1]+l|0,t[2]=t[2]+i|0,t[3]=t[3]+o|0,t[4]=t[4]+r|0}}},l1={aes:class{constructor(C){const w=this;w._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],w._tables[0][0][0]||w._precompute();const t=w._tables[0][4],h=w._tables[1],d=C.length;let l,i,o,r=1;if(d!==4&&d!==6&&d!==8)throw new Error("invalid aes key size");for(w._key=[i=C.slice(0),o=[]],l=d;l<4*d+28;l++){let e=i[l-1];(l%d==0||d===8&&l%d==4)&&(e=t[e>>>24]<<24^t[e>>16&255]<<16^t[e>>8&255]<<8^t[255&e],l%d==0&&(e=e<<8^e>>>24^r<<24,r=r<<1^283*(r>>7))),i[l]=i[l-d]^e}for(let e=0;l;e++,l--){const n=i[3&e?l:l-4];o[e]=l<=4||e<4?n:h[0][t[n>>>24]]^h[1][t[n>>16&255]]^h[2][t[n>>8&255]]^h[3][t[255&n]]}}encrypt(C){return this._crypt(C,0)}decrypt(C){return this._crypt(C,1)}_precompute(){const C=this._tables[0],w=this._tables[1],t=C[4],h=w[4],d=[],l=[];let i,o,r,e;for(let n=0;n<256;n++)l[(d[n]=n<<1^283*(n>>7))^n]=n;for(let n=i=0;!t[n];n^=o||1,i=l[i]||1){let c=i^i<<1^i<<2^i<<3^i<<4;c=c>>8^255&c^99,t[n]=c,h[c]=n,e=d[r=d[o=d[n]]];let a=16843009*e^65537*r^257*o^16843008*n,s=257*d[c]^16843008*c;for(let f=0;f<4;f++)C[f][n]=s=s<<24^s>>>8,w[f][c]=a=a<<24^a>>>8}for(let n=0;n<5;n++)C[n]=C[n].slice(0),w[n]=w[n].slice(0)}_crypt(C,w){if(C.length!==4)throw new Error("invalid aes block size");const t=this._key[w],h=t.length/4-2,d=[0,0,0,0],l=this._tables[w],i=l[0],o=l[1],r=l[2],e=l[3],n=l[4];let c,a,s,f=C[0]^t[0],p=C[w?3:1]^t[1],u=C[2]^t[2],g=C[w?1:3]^t[3],m=4;for(let v=0;v<h;v++)c=i[f>>>24]^o[p>>16&255]^r[u>>8&255]^e[255&g]^t[m],a=i[p>>>24]^o[u>>16&255]^r[g>>8&255]^e[255&f]^t[m+1],s=i[u>>>24]^o[g>>16&255]^r[f>>8&255]^e[255&p]^t[m+2],g=i[g>>>24]^o[f>>16&255]^r[p>>8&255]^e[255&u]^t[m+3],m+=4,f=c,p=a,u=s;for(let v=0;v<4;v++)d[w?3&-v:v]=n[f>>>24]<<24^n[p>>16&255]<<16^n[u>>8&255]<<8^n[255&g]^t[m++],c=f,f=p,p=u,u=g,g=c;return d}}},c1={getRandomValues(C){const w=new Uint32Array(C.buffer),t=h=>{let d=987654321;const l=4294967295;return function(){return d=36969*(65535&d)+(d>>16)&l,(((d<<16)+(h=18e3*(65535&h)+(h>>16)&l)&l)/4294967296+.5)*(Math.random()>.5?1:-1)}};for(let h,d=0;d<C.length;d+=4){const l=t(4294967296*(h||Math.random()));h=987654071*l(),w[d/4]=4294967296*l()|0}return C}},u1={ctrGladman:class{constructor(C,w){this._prf=C,this._initIv=w,this._iv=w}reset(){this._iv=this._initIv}update(C){return this.calculate(this._prf,C,this._iv)}incWord(C){if(255&~(C>>24))C+=1<<24;else{let w=C>>16&255,t=C>>8&255,h=255&C;w===255?(w=0,t===255?(t=0,h===255?h=0:++h):++t):++w,C=0,C+=w<<16,C+=t<<8,C+=h}return C}incCounter(C){(C[0]=this.incWord(C[0]))===0&&(C[1]=this.incWord(C[1]))}calculate(C,w,t){let h;if(!(h=w.length))return[];const d=qe.bitLength(w);for(let l=0;l<h;l+=4){this.incCounter(t);const i=C.encrypt(t);w[l]^=i[0],w[l+1]^=i[1],w[l+2]^=i[2],w[l+3]^=i[3]}return qe.clamp(w,d)}}},ei={importKey:C=>new ei.hmacSha1(Gs.bytes.toBits(C)),pbkdf2(C,w,t,h){if(t=t||1e4,h<0||t<0)throw new Error("invalid params to pbkdf2");const d=1+(h>>5)<<2;let l,i,o,r,e;const n=new ArrayBuffer(d),c=new DataView(n);let a=0;const s=qe;for(w=Gs.bytes.toBits(w),e=1;a<(d||1);e++){for(l=i=C.encrypt(s.concat(w,[e])),o=1;o<t;o++)for(i=C.encrypt(i),r=0;r<i.length;r++)l[r]^=i[r];for(o=0;a<(d||1)&&o<l.length;o++)c.setInt32(a,l[o]),a+=4}return n.slice(0,h/8)},hmacSha1:class{constructor(C){const w=this,t=w._hash=a1.sha1,h=[[],[]];w._baseHash=[new t,new t];const d=w._baseHash[0].blockSize/32;C.length>d&&(C=new t().update(C).finalize());for(let l=0;l<d;l++)h[0][l]=909522486^C[l],h[1][l]=1549556828^C[l];w._baseHash[0].update(h[0]),w._baseHash[1].update(h[1]),w._resultHash=new t(w._baseHash[0])}reset(){const C=this;C._resultHash=new C._hash(C._baseHash[0]),C._updated=!1}update(C){this._updated=!0,this._resultHash.update(C)}digest(){const C=this,w=C._resultHash.finalize(),t=new C._hash(C._baseHash[1]).update(w).finalize();return C.reset(),t}encrypt(C){if(this._updated)throw new Error("encrypt on already updated hmac called!");return this.update(C),this.digest(C)}}},f1=typeof crypto!=wn&&typeof crypto.getRandomValues==us,rc="Invalid password",nc="Invalid signature",la="zipjs-abort-check-password";function ic(C){return f1?crypto.getRandomValues(C):c1.getRandomValues(C)}const ri=16,sc={name:"PBKDF2"},h1=Object.assign({hash:{name:"HMAC"}},sc),yo=Object.assign({iterations:1e3,hash:{name:"SHA-1"}},sc),d1=["deriveBits"],Ai=[8,12,16],Ti=[16,24,32],en=10,p1=[0,0,0,0],fo=typeof crypto!=wn,Pi=fo&&crypto.subtle,oc=fo&&typeof Pi!=wn,Or=Gs.bytes,m1=l1.aes,g1=u1.ctrGladman,b1=ei.hmacSha1;let Va=fo&&oc&&typeof Pi.importKey==us,Ua=fo&&oc&&typeof Pi.deriveBits==us;class v1 extends TransformStream{constructor({password:w,rawPassword:t,signed:h,encryptionStrength:d,checkPasswordOnly:l}){super({start(){Object.assign(this,{ready:new Promise(i=>this.resolveReady=i),password:cc(w,t),signed:h,strength:d-1,pending:new Uint8Array})},async transform(i,o){const r=this,{password:e,strength:n,resolveReady:c,ready:a}=r;e?(await async function(f,p,u,g){const m=await lc(f,p,u,fr(g,0,Ai[p])),v=fr(g,Ai[p]);if(m[0]!=v[0]||m[1]!=v[1])throw new Error(rc)}(r,n,e,fr(i,0,Ai[n]+2)),i=fr(i,Ai[n]+2),l?o.error(new Error(la)):c()):await a;const s=new Uint8Array(i.length-en-(i.length-en)%ri);o.enqueue(ac(r,i,s,0,en,!0))},async flush(i){const{signed:o,ctr:r,hmac:e,pending:n,ready:c}=this;if(e&&r){await c;const a=fr(n,0,n.length-en),s=fr(n,n.length-en);let f=new Uint8Array;if(a.length){const p=Di(Or,a);e.update(p);const u=r.update(p);f=Fi(Or,u)}if(o){const p=fr(Fi(Or,e.digest()),0,en);for(let u=0;u<en;u++)if(p[u]!=s[u])throw new Error(nc)}i.enqueue(f)}}})}}class y1 extends TransformStream{constructor({password:w,rawPassword:t,encryptionStrength:h}){let d;super({start(){Object.assign(this,{ready:new Promise(l=>this.resolveReady=l),password:cc(w,t),strength:h-1,pending:new Uint8Array})},async transform(l,i){const o=this,{password:r,strength:e,resolveReady:n,ready:c}=o;let a=new Uint8Array;r?(a=await async function(f,p,u){const g=ic(new Uint8Array(Ai[p])),m=await lc(f,p,u,g);return Po(g,m)}(o,e,r),n()):await c;const s=new Uint8Array(a.length+l.length-l.length%ri);s.set(a,0),i.enqueue(ac(o,l,s,a.length,0))},async flush(l){const{ctr:i,hmac:o,pending:r,ready:e}=this;if(o&&i){await e;let n=new Uint8Array;if(r.length){const c=i.update(Di(Or,r));o.update(c),n=Fi(Or,c)}d.signature=Fi(Or,o.digest()).slice(0,en),l.enqueue(Po(n,d.signature))}}}),d=this}}function ac(C,w,t,h,d,l){const{ctr:i,hmac:o,pending:r}=C,e=w.length-d;let n;for(r.length&&(w=Po(r,w),t=function(c,a){if(a&&a>c.length){const s=c;(c=new Uint8Array(a)).set(s,0)}return c}(t,e-e%ri)),n=0;n<=e-ri;n+=ri){const c=Di(Or,fr(w,n,n+ri));l&&o.update(c);const a=i.update(c);l||o.update(a),t.set(Fi(Or,a),n+h)}return C.pending=fr(w,n),t}async function lc(C,w,t,h){C.password=null;const d=await async function(n,c,a,s,f){if(!Va)return ei.importKey(c);try{return await Pi.importKey(n,c,a,s,f)}catch{return Va=!1,ei.importKey(c)}}("raw",t,h1,!1,d1),l=await async function(n,c,a){if(!Ua)return ei.pbkdf2(c,n.salt,yo.iterations,a);try{return await Pi.deriveBits(n,c,a)}catch{return Ua=!1,ei.pbkdf2(c,n.salt,yo.iterations,a)}}(Object.assign({salt:h},yo),d,8*(2*Ti[w]+2)),i=new Uint8Array(l),o=Di(Or,fr(i,0,Ti[w])),r=Di(Or,fr(i,Ti[w],2*Ti[w])),e=fr(i,2*Ti[w]);return Object.assign(C,{keys:{key:o,authentication:r,passwordVerification:e},ctr:new g1(new m1(o),Array.from(p1)),hmac:new b1(r)}),e}function cc(C,w){return w===Fe?function(t){if(typeof TextEncoder==wn){t=unescape(encodeURIComponent(t));const h=new Uint8Array(t.length);for(let d=0;d<h.length;d++)h[d]=t.charCodeAt(d);return h}return new TextEncoder().encode(t)}(C):w}function Po(C,w){let t=C;return C.length+w.length&&(t=new Uint8Array(C.length+w.length),t.set(C,0),t.set(w,C.length)),t}function fr(C,w,t){return C.subarray(w,t)}function Fi(C,w){return C.fromBits(w)}function Di(C,w){return C.toBits(w)}const Ks=12;class w1 extends TransformStream{constructor({password:w,passwordVerification:t,checkPasswordOnly:h}){super({start(){Object.assign(this,{password:w,passwordVerification:t}),uc(this,w)},transform(d,l){const i=this;if(i.password){const o=Ha(i,d.subarray(0,Ks));if(i.password=null,o[11]!=i.passwordVerification)throw new Error(rc);d=d.subarray(Ks)}h?l.error(new Error(la)):l.enqueue(Ha(i,d))}})}}class _1 extends TransformStream{constructor({password:w,passwordVerification:t}){super({start(){Object.assign(this,{password:w,passwordVerification:t}),uc(this,w)},transform(h,d){const l=this;let i,o;if(l.password){l.password=null;const r=ic(new Uint8Array(Ks));r[11]=l.passwordVerification,i=new Uint8Array(h.length+r.length),i.set(Wa(l,r),0),o=Ks}else i=new Uint8Array(h.length),o=0;i.set(Wa(l,h),o),d.enqueue(i)}})}}function Ha(C,w){const t=new Uint8Array(w.length);for(let h=0;h<w.length;h++)t[h]=fc(C)^w[h],ca(C,t[h]);return t}function Wa(C,w){const t=new Uint8Array(w.length);for(let h=0;h<w.length;h++)t[h]=fc(C)^w[h],ca(C,w[h]);return t}function uc(C,w){const t=[305419896,591751049,878082192];Object.assign(C,{keys:t,crcKey0:new Zs(t[0]),crcKey2:new Zs(t[2])});for(let h=0;h<w.length;h++)ca(C,w.charCodeAt(h))}function ca(C,w){let[t,h,d]=C.keys;C.crcKey0.append([w]),t=~C.crcKey0.get(),h=qa(Math.imul(qa(h+hc(t)),134775813)+1),C.crcKey2.append([h>>>24]),d=~C.crcKey2.get(),C.keys=[t,h,d]}function fc(C){const w=2|C.keys[2];return hc(Math.imul(w,1^w)>>>8)}function hc(C){return 255&C}function qa(C){return 4294967295&C}const Xa="deflate-raw";class x1 extends TransformStream{constructor(w,{chunkSize:t,CompressionStream:h,CompressionStreamNative:d}){super({});const{compressed:l,encrypted:i,useCompressionStream:o,zipCrypto:r,signed:e,level:n}=w,c=this;let a,s,f=dc(super.readable);i&&!r||!e||(a=new ec,f=jr(f,a)),l&&(f=mc(f,o,{level:n,chunkSize:t},d,h)),i&&(r?f=jr(f,new _1(w)):(s=new y1(w),f=jr(f,s))),pc(c,f,()=>{let p;i&&!r&&(p=s.signature),i&&!r||!e||(p=new DataView(a.value.buffer).getUint32(0)),c.signature=p})}}class k1 extends TransformStream{constructor(w,{chunkSize:t,DecompressionStream:h,DecompressionStreamNative:d}){super({});const{zipCrypto:l,encrypted:i,signed:o,signature:r,compressed:e,useCompressionStream:n}=w;let c,a,s=dc(super.readable);i&&(l?s=jr(s,new w1(w)):(a=new v1(w),s=jr(s,a))),e&&(s=mc(s,n,{chunkSize:t},d,h)),i&&!l||!o||(c=new ec,s=jr(s,c)),pc(this,s,()=>{if((!i||l)&&o){const f=new DataView(c.value.buffer);if(r!=f.getUint32(0,!1))throw new Error(nc)}})}}function dc(C){return jr(C,new TransformStream({transform(w,t){w&&w.length&&t.enqueue(w)}}))}function pc(C,w,t){w=jr(w,new TransformStream({flush:t})),Object.defineProperty(C,"readable",{get:()=>w})}function mc(C,w,t,h,d){try{C=jr(C,new(w&&h?h:d)(Xa,t))}catch{if(!w)return C;try{C=jr(C,new d(Xa,t))}catch{return C}}return C}function jr(C,w){return C.pipeThrough(w)}const S1="message",E1="start",C1="pull",Za="data",Ga="close",gc="inflate";class T1 extends TransformStream{constructor(w,t){super({});const h=this,{codecType:d}=w;let l;d.startsWith("deflate")?l=x1:d.startsWith(gc)&&(l=k1);let i=0,o=0;const r=new l(w,t),e=super.readable,n=new TransformStream({transform(a,s){a&&a.length&&(o+=a.length,s.enqueue(a))},flush(){Object.assign(h,{inputSize:o})}}),c=new TransformStream({transform(a,s){a&&a.length&&(i+=a.length,s.enqueue(a))},flush(){const{signature:a}=r;Object.assign(h,{signature:a,outputSize:i,inputSize:o})}});Object.defineProperty(h,"readable",{get:()=>e.pipeThrough(n).pipeThrough(r).pipeThrough(c)})}}class M1 extends TransformStream{constructor(w){let t;super({transform:function h(d,l){if(t){const i=new Uint8Array(t.length+d.length);i.set(t),i.set(d,t.length),d=i,t=null}d.length>w?(l.enqueue(d.slice(0,w)),h(d.slice(w),l)):t=d},flush(h){t&&t.length&&h.enqueue(t)}})}}let bc=typeof Worker!=wn;class wo{constructor(w,{readable:t,writable:h},{options:d,config:l,streamOptions:i,useWebWorkers:o,transferStreams:r,scripts:e},n){const{signal:c}=i;return Object.assign(w,{busy:!0,readable:t.pipeThrough(new M1(l.chunkSize)).pipeThrough(new A1(t,i),{signal:c}),writable:h,options:Object.assign({},d),scripts:e,transferStreams:r,terminate:()=>new Promise(a=>{const{worker:s,busy:f}=w;s?(f?w.resolveTerminated=a:(s.terminate(),a()),w.interface=null):a()}),onTaskFinished(){const{resolveTerminated:a}=w;a&&(w.resolveTerminated=null,w.terminated=!0,w.worker.terminate(),a()),w.busy=!1,n(w)}}),(o&&bc?R1:vc)(w,l)}}class A1 extends TransformStream{constructor(w,{onstart:t,onprogress:h,size:d,onend:l}){let i=0;super({async start(){t&&await _o(t,d)},async transform(o,r){i+=o.length,h&&await _o(h,i,d),r.enqueue(o)},async flush(){w.size=i,l&&await _o(l,i)}})}}async function _o(C,...w){try{await C(...w)}catch{}}function vc(C,w){return{run:()=>async function({options:t,readable:h,writable:d,onTaskFinished:l},i){try{const o=new T1(t,i);await h.pipeThrough(o).pipeTo(d,{preventClose:!0,preventAbort:!0});const{signature:r,inputSize:e,outputSize:n}=o;return{signature:r,inputSize:e,outputSize:n}}finally{l()}}(C,w)}}function R1(C,w){const{baseURL:t,chunkSize:h}=w;if(!C.interface){let d;try{d=function(l,i,o){const r={type:"module"};let e,n;typeof l==us&&(l=l());try{e=new URL(l,i)}catch{e=l}if(Ka)try{n=new Worker(e)}catch{Ka=!1,n=new Worker(e,r)}else n=new Worker(e,r);return n.addEventListener(S1,c=>async function({data:a},s){const{type:f,value:p,messageId:u,result:g,error:m}=a,{reader:v,writer:S,resolveResult:R,rejectResult:I,onTaskFinished:F}=s;try{if(m){const{message:L,stack:$,code:V,name:z}=m,E=new Error(L);Object.assign(E,{stack:$,code:V,name:z}),j(E)}else{if(f==C1){const{value:L,done:$}=await v.read();Es({type:Za,value:L,done:$,messageId:u},s)}f==Za&&(await S.ready,await S.write(new Uint8Array(p)),Es({type:"ack",messageId:u},s)),f==Ga&&j(null,g)}}catch(L){Es({type:Ga,messageId:u},s),j(L)}function j(L,$){L?I(L):R($),S&&S.releaseLock(),F()}}(c,o)),n}(C.scripts[0],t,C)}catch{return bc=!1,vc(C,w)}Object.assign(C,{worker:d,interface:{run:()=>async function(l,i){let o,r;const e=new Promise((g,m)=>{o=g,r=m});Object.assign(l,{reader:null,writer:null,resolveResult:o,rejectResult:r,result:e});const{readable:n,options:c,scripts:a}=l,{writable:s,closed:f}=function(g){let m;const v=new Promise(R=>m=R);return{writable:new WritableStream({async write(R){const I=g.getWriter();await I.ready,await I.write(R),I.releaseLock()},close(){m()},abort:R=>g.getWriter().abort(R)}),closed:v}}(l.writable),p=Es({type:E1,scripts:a.slice(1),options:c,config:i,readable:n,writable:s},l);p||Object.assign(l,{reader:n.getReader(),writer:s.getWriter()});const u=await e;return p||await s.getWriter().close(),await f,u}(C,{chunkSize:h})}})}return C.interface}let Ka=!0,Ya=!0;function Es(C,{worker:w,writer:t,onTaskFinished:h,transferStreams:d}){try{const{value:l,readable:i,writable:o}=C,r=[];if(l&&(l.byteLength<l.buffer.byteLength?C.value=l.buffer.slice(0,l.byteLength):C.value=l.buffer,r.push(C.value)),d&&Ya?(i&&r.push(i),o&&r.push(o)):C.readable=C.writable=null,r.length)try{return w.postMessage(C,r),!0}catch{Ya=!1,C.readable=C.writable=null,w.postMessage(C)}else w.postMessage(C)}catch(l){throw t&&t.releaseLock(),h(),l}}let Sn=[];const xo=[];let Ja=0;async function N1(C,w){const{options:t,config:h}=w,{transferStreams:d,useWebWorkers:l,useCompressionStream:i,codecType:o,compressed:r,signed:e,encrypted:n}=t,{workerScripts:c,maxWorkers:a}=h;w.transferStreams=d||d===Fe;const s=!(r||e||n||w.transferStreams);return w.useWebWorkers=!s&&(l||l===Fe&&h.useWebWorkers),w.scripts=w.useWebWorkers&&c?c[o]:[],t.useCompressionStream=i||i===Fe&&h.useCompressionStream,(await async function(){const p=Sn.find(u=>!u.busy);if(p)return Qa(p),new wo(p,C,w,f);if(Sn.length<a){const u={indexWorker:Ja};return Ja++,Sn.push(u),new wo(u,C,w,f)}return new Promise(u=>xo.push({resolve:u,stream:C,workerOptions:w}))}()).run();function f(p){if(xo.length){const[{resolve:u,stream:g,workerOptions:m}]=xo.splice(0,1);u(new wo(p,g,m,f))}else p.worker?(Qa(p),function(u,g){const{config:m}=g,{terminateWorkerTimeout:v}=m;Number.isFinite(v)&&v>=0&&(u.terminated?u.terminated=!1:u.terminateTimeout=setTimeout(async()=>{Sn=Sn.filter(S=>S!=u);try{await u.terminate()}catch{}},v))}(p,w)):Sn=Sn.filter(u=>u!=p)}}function Qa(C){const{terminateTimeout:w}=C;w&&(clearTimeout(w),C.terminateTimeout=null)}const O1=65536,yc="writable";class ua{constructor(){this.size=0}init(){this.initialized=!0}}class wc extends ua{get readable(){const w=this,{chunkSize:t=O1}=w,h=new ReadableStream({start(){this.chunkOffset=0},async pull(d){const{offset:l=0,size:i,diskNumberStart:o}=h,{chunkOffset:r}=this,e=i===Fe?t:Math.min(t,i-r),n=await ze(w,l+r,e,o);d.enqueue(n),r+t>i||i===Fe&&!n.length&&e?d.close():this.chunkOffset+=t}});return h}}class _c extends wc{constructor(w){super(),Object.assign(this,{blob:w,size:w.size})}async readUint8Array(w,t){const h=this,d=w+t;let i=await(w||d<h.size?h.blob.slice(w,d):h.blob).arrayBuffer();return i.byteLength>t&&(i=i.slice(w,d)),new Uint8Array(i)}}class xc extends ua{constructor(w){super();const t=new TransformStream,h=[];w&&h.push(["Content-Type",w]),Object.defineProperty(this,yc,{get:()=>t.writable}),this.blob=new Response(t.readable,{headers:h}).blob()}getData(){return this.blob}}class j1 extends xc{constructor(w){super(w),Object.assign(this,{encoding:w,utf8:!w||w.toLowerCase()=="utf-8"})}async getData(){const{encoding:w,utf8:t}=this,h=await super.getData();if(h.text&&t)return h.text();{const d=new FileReader;return new Promise((l,i)=>{Object.assign(d,{onload:({target:o})=>l(o.result),onerror:()=>i(d.error)}),d.readAsText(h,w)})}}}class I1 extends wc{constructor(w){super(),this.readers=w}async init(){const w=this,{readers:t}=w;w.lastDiskNumber=0,w.lastDiskOffset=0,await Promise.all(t.map(async(h,d)=>{await h.init(),d!=t.length-1&&(w.lastDiskOffset+=h.size),w.size+=h.size})),super.init()}async readUint8Array(w,t,h=0){const d=this,{readers:l}=this;let i,o=h;o==-1&&(o=l.length-1);let r=w;for(;r>=l[o].size;)r-=l[o].size,o++;const e=l[o],n=e.size;if(r+t<=n)i=await ze(e,r,t);else{const c=n-r;i=new Uint8Array(t),i.set(await ze(e,r,c)),i.set(await d.readUint8Array(w+c,t-c,h),c)}return d.lastDiskNumber=Math.max(o,d.lastDiskNumber),i}}class tl extends ua{constructor(w,t=4294967295){super();const h=this;let d,l,i;Object.assign(h,{diskNumber:0,diskOffset:0,size:0,maxSize:t,availableSize:t});const o=new WritableStream({async write(n){const{availableSize:c}=h;if(i)n.length>=c?(await r(n.slice(0,c)),await e(),h.diskOffset+=d.size,h.diskNumber++,i=null,await this.write(n.slice(c))):await r(n);else{const{value:a,done:s}=await w.next();if(s&&!a)throw new Error("Writer iterator completed too soon");d=a,d.size=0,d.maxSize&&(h.maxSize=d.maxSize),h.availableSize=h.maxSize,await Ys(d),l=a.writable,i=l.getWriter(),await this.write(n)}},async close(){await i.ready,await e()}});async function r(n){const c=n.length;c&&(await i.ready,await i.write(n),d.size+=c,h.size+=c,h.availableSize-=c)}async function e(){l.size=d.size,await i.close()}Object.defineProperty(h,yc,{get:()=>o})}}async function Ys(C,w){if(!C.init||C.initialized)return Promise.resolve();await C.init(w)}function B1(C){return Array.isArray(C)&&(C=new I1(C)),C instanceof ReadableStream&&(C={readable:C}),C}function ze(C,w,t,h){return C.readUint8Array(w,t,h)}const kc="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split(""),P1=kc.length==256;function Bs(C,w){return w&&w.trim().toLowerCase()=="cp437"?function(t){if(P1){let h="";for(let d=0;d<t.length;d++)h+=kc[t[d]];return h}return new TextDecoder().decode(t)}(C):new TextDecoder(w).decode(C)}const Sc="filename",Ec="rawFilename",Cc="comment",Tc="rawComment",Mc="uncompressedSize",Ac="compressedSize",Rc="offset",Fo="diskNumberStart",Do="lastModDate",Lo="rawLastModDate",Nc="lastAccessDate",F1="rawLastAccessDate",Oc="creationDate",D1="rawCreationDate",L1=[Sc,Ec,Ac,Mc,Do,Lo,Cc,Tc,Nc,Oc,Rc,Fo,Fo,"internalFileAttribute","internalFileAttributes","externalFileAttribute","externalFileAttributes","msDosCompatible","zip64","encrypted","version","versionMadeBy","zipCrypto","directory","executable","bitFlag","signature","filenameUTF8","commentUTF8","compressionMethod","extraField","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class el{constructor(w){L1.forEach(t=>this[t]=w[t])}}const ko="File format is not recognized",z1="Zip64 extra field not found",rl="Compression method not supported",nl="Split zip file",il="utf-8",sl="cp437",$1=[[Mc,Un],[Ac,Un],[Rc,Un],[Fo,Nn]],V1={[Nn]:{getValue:Ce,bytes:4},[Un]:{getValue:Ps,bytes:8}};class U1{constructor(w,t={}){Object.assign(this,{reader:B1(w),options:t,config:nn})}async*getEntriesGenerator(w={}){const t=this;let{reader:h}=t;const{config:d}=t;if(await Ys(h),h.size!==Fe&&h.readUint8Array||(h=new _c(await new Response(h.readable).blob()),await Ys(h)),h.size<Gn)throw new Error(ko);h.chunkSize=function($){return Math.max($.chunkSize,64)}(d);const l=await async function($,V,z,E,A){const k=new Uint8Array(4);(function(_,x,M){_.setUint32(x,M,!0)})(Ie(k),0,V);const b=E+A;return await y(E)||await y(Math.min(b,z));async function y(_){const x=z-_,M=await ze($,x,_);for(let B=M.length-E;B>=0;B--)if(M[B]==k[0]&&M[B+1]==k[1]&&M[B+2]==k[2]&&M[B+3]==k[3])return{offset:x+B,buffer:M.slice(B,B+E).buffer}}}(h,101010256,h.size,Gn,1048560);if(!l)throw Ce(Ie(await ze(h,0,4)))==134695760?new Error(nl):new Error("End of central directory not found");const i=Ie(l);let o=Ce(i,12),r=Ce(i,16);const e=l.offset,n=Be(i,20),c=e+Gn+n;let a=Be(i,4);const s=h.lastDiskNumber||0;let f=Be(i,6),p=Be(i,8),u=0,g=0;if(r==Un||o==Un||p==Nn||f==Nn){const $=Ie(await ze(h,l.offset-20,20));if(Ce($,0)==117853008){r=Ps($,8);let V=await ze(h,r,56,-1),z=Ie(V);const E=l.offset-20-56;if(Ce(z,0)!=za&&r!=E){const A=r;r=E,u=r-A,V=await ze(h,r,56,-1),z=Ie(V)}if(Ce(z,0)!=za)throw new Error("End of Zip64 central directory locator not found");a==Nn&&(a=Ce(z,16)),f==Nn&&(f=Ce(z,20)),p==Nn&&(p=Ps(z,32)),o==Un&&(o=Ps(z,40)),r-=o}}if(r>=h.size&&(u=h.size-r-o-Gn,r=h.size-o-Gn),s!=a)throw new Error(nl);if(r<0)throw new Error(ko);let m=0,v=await ze(h,r,o,f),S=Ie(v);if(o){const $=l.offset-o;if(Ce(S,m)!=La&&r!=$){const V=r;r=$,u+=r-V,v=await ze(h,r,o,f),S=Ie(v)}}const R=l.offset-r-(h.lastDiskOffset||0);if(o!=R&&R>=0&&(o=R,v=await ze(h,r,o,f),S=Ie(v)),r<0||r>=h.size)throw new Error(ko);const I=We(t,w,"filenameEncoding"),F=We(t,w,"commentEncoding");for(let $=0;$<p;$++){const V=new H1(h,d,t.options);if(Ce(S,m)!=La)throw new Error("Central directory header not found");jc(V,S,m+6);const z=!!V.bitFlag.languageEncodingFlag,E=m+46,A=E+V.filenameLength,k=A+V.extraFieldLength,b=Be(S,m+4),y=!(b>>8),_=b>>8==3,x=v.subarray(E,A),M=Be(S,m+32),B=k+M,P=v.subarray(k,B),H=z,W=z,K=Ce(S,m+38),D=y&&!(16&~ni(S,m+38))||_&&!(16384&~(K>>16))||x.length&&x[x.length-1]==47,X=_&&!(73&~(K>>16)),O=Ce(S,m+42)+u;Object.assign(V,{versionMadeBy:b,msDosCompatible:y,compressedSize:0,uncompressedSize:0,commentLength:M,directory:D,offset:O,diskNumberStart:Be(S,m+34),internalFileAttributes:Be(S,m+36),externalFileAttributes:K,rawFilename:x,filenameUTF8:H,commentUTF8:W,rawExtraField:v.subarray(A,k),executable:X}),V.internalFileAttribute=V.internalFileAttributes,V.externalFileAttribute=V.externalFileAttributes;const N=We(t,w,"decodeText")||Bs,U=H?il:I||sl,q=W?il:F||sl;let Y=N(x,U);Y===Fe&&(Y=Bs(x,U));let G=N(P,q);G===Fe&&(G=Bs(P,q)),Object.assign(V,{rawComment:P,filename:Y,comment:G,directory:D||Y.endsWith("/")}),g=Math.max(O,g),Ic(V,V,S,m+6),V.zipCrypto=V.encrypted&&!V.extraFieldAES;const Q=new el(V);Q.getData=(it,J)=>V.getData(it,Q,J),m=B;const{onprogress:rt}=w;if(rt)try{await rt($+1,p,new el(V))}catch{}yield Q}const j=We(t,w,"extractPrependedData"),L=We(t,w,"extractAppendedData");return j&&(t.prependedData=g>0?await ze(h,0,g):new Uint8Array),t.comment=n?await ze(h,e+Gn,n):new Uint8Array,L&&(t.appendedData=c<h.size?await ze(h,c,h.size-c):new Uint8Array),!0}async getEntries(w={}){const t=[];for await(const h of this.getEntriesGenerator(w))t.push(h);return t}async close(){}}class H1{constructor(w,t,h){Object.assign(this,{reader:w,config:t,options:h})}async getData(w,t,h={}){const d=this,{reader:l,offset:i,diskNumberStart:o,extraFieldAES:r,compressionMethod:e,config:n,bitFlag:c,signature:a,rawLastModDate:s,uncompressedSize:f,compressedSize:p}=d,u=t.localDirectory={},g=Ie(await ze(l,i,30,o));let m=We(d,h,"password"),v=We(d,h,"rawPassword");const S=We(d,h,"passThrough");if(m=m&&m.length&&m,v=v&&v.length&&v,r&&r.originalCompressionMethod!=99)throw new Error(rl);if(e!=0&&e!=8&&!S)throw new Error(rl);if(Ce(g,0)!=67324752)throw new Error("Local file header not found");jc(u,g,4),u.rawExtraField=u.extraFieldLength?await ze(l,i+30+u.filenameLength,u.extraFieldLength,o):new Uint8Array,Ic(d,u,g,4,!0),Object.assign(t,{lastAccessDate:u.lastAccessDate,creationDate:u.creationDate});const R=d.encrypted&&u.encrypted&&!S,I=R&&!r;if(S||(t.zipCrypto=I),R){if(!I&&r.strength===Fe)throw new Error("Encryption method not supported");if(!m&&!v)throw new Error("File contains encrypted entry")}const F=i+30+u.filenameLength+u.extraFieldLength,j=p,L=l.readable;Object.assign(L,{diskNumberStart:o,offset:F,size:j});const $=We(d,h,"signal"),V=We(d,h,"checkPasswordOnly");V&&(w=new WritableStream),w=function(_){_.writable===Fe&&typeof _.next==us&&(_=new tl(_)),_ instanceof WritableStream&&(_={writable:_});const{writable:x}=_;return x.size===Fe&&(x.size=0),_ instanceof tl||Object.assign(_,{diskNumber:0,diskOffset:0,availableSize:1/0,maxSize:1/0}),_}(w),await Ys(w,S?p:f);const{writable:z}=w,{onstart:E,onprogress:A,onend:k}=h,b={options:{codecType:gc,password:m,rawPassword:v,zipCrypto:I,encryptionStrength:r&&r.strength,signed:We(d,h,"checkSignature")&&!S,passwordVerification:I&&(c.dataDescriptor?s>>>8&255:a>>>24&255),signature:a,compressed:e!=0&&!S,encrypted:d.encrypted&&!S,useWebWorkers:We(d,h,"useWebWorkers"),useCompressionStream:We(d,h,"useCompressionStream"),transferStreams:We(d,h,"transferStreams"),checkPasswordOnly:V},config:n,streamOptions:{signal:$,size:j,onstart:E,onprogress:A,onend:k}};let y=0;try{({outputSize:y}=await N1({readable:L,writable:z},b))}catch(_){if(!V||_.message!=la)throw _}finally{const _=We(d,h,"preventClose");z.size+=y,_||z.locked||await z.getWriter().close()}return V?Fe:w.getData?w.getData():z}}function jc(C,w,t){const h=C.rawBitFlag=Be(w,t+2),d=!(1&~h),l=Ce(w,t+6);Object.assign(C,{encrypted:d,version:Be(w,t),bitFlag:{level:(6&h)>>1,dataDescriptor:!(8&~h),languageEncodingFlag:!(2048&~h)},rawLastModDate:l,lastModDate:W1(l),filenameLength:Be(w,t+22),extraFieldLength:Be(w,t+24)})}function Ic(C,w,t,h,d){const{rawExtraField:l}=w,i=w.extraField=new Map,o=Ie(new Uint8Array(l));let r=0;try{for(;r<l.length;){const g=Be(o,r),m=Be(o,r+2);i.set(g,{type:g,data:l.slice(r+4,r+4+m)}),r+=4+m}}catch{}const e=Be(t,h+4);Object.assign(w,{signature:Ce(t,h+10),uncompressedSize:Ce(t,h+18),compressedSize:Ce(t,h+14)});const n=i.get(1);n&&(function(g,m){m.zip64=!0;const v=Ie(g.data),S=$1.filter(([R,I])=>m[R]==I);for(let R=0,I=0;R<S.length;R++){const[F,j]=S[R];if(m[F]==j){const L=V1[j];m[F]=g[F]=L.getValue(v,I),I+=L.bytes}else if(g[F])throw new Error(z1)}}(n,w),w.extraFieldZip64=n);const c=i.get(28789);c&&(ol(c,Sc,Ec,w,C),w.extraFieldUnicodePath=c);const a=i.get(25461);a&&(ol(a,Cc,Tc,w,C),w.extraFieldUnicodeComment=a);const s=i.get(39169);s?(function(g,m,v){const S=Ie(g.data),R=ni(S,4);Object.assign(g,{vendorVersion:ni(S,0),vendorId:ni(S,2),strength:R,originalCompressionMethod:v,compressionMethod:Be(S,5)}),m.compressionMethod=g.compressionMethod}(s,w,e),w.extraFieldAES=s):w.compressionMethod=e;const f=i.get(10);f&&(function(g,m){const v=Ie(g.data);let S,R=4;try{for(;R<g.data.length&&!S;){const I=Be(v,R),F=Be(v,R+2);I==1&&(S=g.data.slice(R+4,R+4+F)),R+=4+F}}catch{}try{if(S&&S.length==24){const I=Ie(S),F=I.getBigUint64(0,!0),j=I.getBigUint64(8,!0),L=I.getBigUint64(16,!0);Object.assign(g,{rawLastModDate:F,rawLastAccessDate:j,rawCreationDate:L});const $=So(F),V=So(j),z={lastModDate:$,lastAccessDate:V,creationDate:So(L)};Object.assign(g,z),Object.assign(m,z)}}catch{}}(f,w),w.extraFieldNTFS=f);const p=i.get(21589);p&&(function(g,m,v){const S=Ie(g.data),R=ni(S,0),I=[],F=[];v?(1&~R||(I.push(Do),F.push(Lo)),2&~R||(I.push(Nc),F.push(F1)),4&~R||(I.push(Oc),F.push(D1))):g.data.length>=5&&(I.push(Do),F.push(Lo));let j=1;I.forEach((L,$)=>{if(g.data.length>=j+4){const V=Ce(S,j);m[L]=g[L]=new Date(1e3*V);const z=F[$];g[z]=V}j+=4})}(p,w,d),w.extraFieldExtendedTimestamp=p);const u=i.get(6534);u&&(w.extraFieldUSDZ=u)}function ol(C,w,t,h,d){const l=Ie(C.data),i=new Zs;i.append(d[t]);const o=Ie(new Uint8Array(4));o.setUint32(0,i.get(),!0);const r=Ce(l,1);Object.assign(C,{version:ni(l,0),[w]:Bs(C.data.subarray(5)),valid:!d.bitFlag.languageEncodingFlag&&r==Ce(o,0)}),C.valid&&(h[w]=C[w],h[w+"UTF8"]=!0)}function We(C,w,t){return w[t]===Fe?C.options[t]:w[t]}function W1(C){const w=(4294901760&C)>>16,t=65535&C;try{return new Date(1980+((65024&w)>>9),((480&w)>>5)-1,31&w,(63488&t)>>11,(2016&t)>>5,2*(31&t),0)}catch{}}function So(C){return new Date(Number(C/BigInt(1e4)-BigInt(116444736e5)))}function ni(C,w){return C.getUint8(w)}function Be(C,w){return C.getUint16(w,!0)}function Ce(C,w){return C.getUint32(w,!0)}function Ps(C,w){return Number(C.getBigUint64(w,!0))}function Ie(C){return new DataView(C.buffer)}Ql({Inflate:function(C){const w=new Yl,t=C&&C.chunkSize?Math.floor(2*C.chunkSize):131072,h=new Uint8Array(t);let d=!1;w.inflateInit(),w.next_out=h,this.append=function(l,i){const o=[];let r,e,n=0,c=0,a=0;if(l.length!==0){w.next_in_index=0,w.next_in=l,w.avail_in=l.length;do{if(w.next_out_index=0,w.avail_out=t,w.avail_in!==0||d||(w.next_in_index=0,d=!0),r=w.inflate(0),d&&r===Zr){if(w.avail_in!==0)throw new Error("inflating: bad input")}else if(r!==0&&r!==1)throw new Error("inflating: "+w.msg);if((d||r===1)&&w.avail_in===l.length)throw new Error("inflating: bad input");w.next_out_index&&(w.next_out_index===t?o.push(new Uint8Array(h)):o.push(h.subarray(0,w.next_out_index))),a+=w.next_out_index,i&&w.next_in_index>0&&w.next_in_index!=n&&(i(w.next_in_index),n=w.next_in_index)}while(w.avail_in>0||w.avail_out===0);return o.length>1?(e=new Uint8Array(a),o.forEach(function(s){e.set(s,c),c+=s.length})):e=o[0]?new Uint8Array(o[0]):new Uint8Array,e}},this.flush=function(){w.inflateEnd()}}});const q1=Object.freeze(Object.defineProperty({__proto__:null,BlobReader:_c,BlobWriter:xc,TextWriter:j1,ZipReader:U1,configure:Ql},Symbol.toStringTag,{value:"Module"})),Re={CONTAINER:"urn:oasis:names:tc:opendocument:xmlns:container",XHTML:"http://www.w3.org/1999/xhtml",OPF:"http://www.idpf.org/2007/opf",EPUB:"http://www.idpf.org/2007/ops",DC:"http://purl.org/dc/elements/1.1/",ENC:"http://www.w3.org/2001/04/xmlenc#",NCX:"http://www.daisy.org/z3986/2005/ncx/",XLINK:"http://www.w3.org/1999/xlink",SMIL:"http://www.w3.org/ns/SMIL"},Ue={XML:"application/xml",NCX:"application/x-dtbncx+xml",XHTML:"application/xhtml+xml",HTML:"text/html",CSS:"text/css",SVG:"image/svg+xml",JS:/\/(x-)?(javascript|ecmascript)/},rn={a11y:"http://www.idpf.org/epub/vocab/package/a11y/#",dcterms:"http://purl.org/dc/terms/",marc:"http://id.loc.gov/vocabulary/",media:"http://www.idpf.org/epub/vocab/overlays/#",onix:"http://www.editeur.org/ONIX/book/codelists/current.html#",rendition:"http://www.idpf.org/vocab/rendition/#",schema:"http://schema.org/",xsd:"http://www.w3.org/2001/XMLSchema#",msv:"http://www.idpf.org/epub/vocab/structure/magazine/#",prism:"http://www.prismstandard.org/specifications/3.0/PRISM_CV_Spec_3.0.htm#"},X1={art:"artist",aut:"author",clr:"colorist",edt:"editor",ill:"illustrator",nrt:"narrator",trl:"translator",pbl:"publisher"},Z1={"02":"isbn","06":"doi",15:"isbn",26:"doi",34:"issn"},zo=C=>C.toLowerCase().replace(/[-:](.)/g,(w,t)=>t.toUpperCase()),G1=C=>C?C.replace(/[\t\n\f\r ]+/g," ").replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,""):"",K1=(C,w,t)=>t?h=>{var d,l;return(l=(d=h.getAttribute(C))==null?void 0:d.split(/\s/))==null?void 0:l.includes(w)}:typeof w=="function"?h=>w(h.getAttribute(C)):h=>h.getAttribute(C)===w,Fs=(...C)=>w=>w?Object.fromEntries(C.map(t=>[zo(t),w.getAttribute(t)])):null,Gr=C=>G1(C==null?void 0:C.textContent),fs=(C,w)=>{const t=C.lookupNamespaceURI(null)===w||C.lookupPrefix(w),h=t?(d,l)=>i=>i.namespaceURI===w&&i.localName===l:(d,l)=>i=>i.localName===l;return{$:(d,l)=>[...d.children].find(h(d,l)),$$:(d,l)=>[...d.children].filter(h(d,l)),$$$:t?(d,l)=>[...d.getElementsByTagNameNS(w,l)]:(d,l)=>[...d.getElementsByTagName(l)]}},ii=(C,w)=>{try{if(C=C.replace(/%2c/,","),w.includes(":")&&!w.startsWith("OEBPS"))return new URL(C,w);const t="https://invalid.invalid/",h=new URL(C,t+w);return h.search="",decodeURI(h.href.replace(t,""))}catch(t){return console.warn(t),C}},Bc=C=>/^(?!blob)\w+:/i.test(C),Y1=(C,w)=>{if(!C)return w;const t=C.replace(/\/$/,"").split("/"),h=w.replace(/\/$/,"").split("/"),d=(t.length>h.length?t:h).findIndex((l,i)=>t[i]!==h[i]);return d<0?"":Array(t.length-d).fill("..").concat(h.slice(d)).join("/")},J1=C=>C.slice(0,C.lastIndexOf("/")+1),Cs=async(C,w,t)=>{const h=[];C.replace(w,(...l)=>(h.push(l),null));const d=[];for(const l of h)d.push(await t(...l));return C.replace(w,()=>d.shift())},Q1=C=>C.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),$o=C=>{for(const[t,h]of Object.entries(C))h==null?delete C[t]:Array.isArray(h)?(C[t]=h.filter(d=>d).map(d=>typeof d=="object"&&!Array.isArray(d)?$o(d):d),C[t].length?C[t].length===1&&(C[t]=C[t][0]):delete C[t]):typeof h=="object"&&(C[t]=$o(h),Object.keys(h).length||delete C[t]);const w=Object.keys(C);return w.length===1&&w[0]==="name"?C[w[0]]:C},tg=C=>{const w=new Map(Object.entries(rn)),t=C.documentElement.getAttributeNS(Re.EPUB,"prefix")||C.documentElement.getAttribute("prefix");if(t)for(const[,h,d]of t.matchAll(/(.+): +(.+)[ \t\r\n]*/g))w.set(h,d);return w},al=(C,w)=>{if(!C)return null;const[t,h]=C.split(":"),d=h?t:null,l=h||t,i=w.get(d);return i?i+l:null},eg=C=>{var j,L,$,V,z,E,A,k,b,y,_,x,M,B,P,H,W,K,D,X,O,N,U;const{$:w}=fs(C,Re.OPF),t=w(C.documentElement,"metadata"),h=Object.groupBy(t.children,q=>q.namespaceURI===Re.DC?"dc":q.namespaceURI===Re.OPF&&q.localName==="meta"?q.hasAttribute("name")?"legacyMeta":"meta":""),d=t.getAttribute("xml:lang")??C.documentElement.getAttribute("xml:lang")??"und",l=tg(C),i=q=>{const Y=q.getAttribute("property"),G=q.getAttribute("scheme");return{property:al(Y,l)??Y,scheme:al(G,l)??G,lang:q.getAttribute("xml:lang"),value:Gr(q),props:r(q),attrs:Object.fromEntries(Array.from(q.attributes).filter(Q=>Q.namespaceURI===Re.OPF).map(Q=>[Q.localName,Q.value]))}},o=Map.groupBy(h.meta??[],q=>q.getAttribute("refines")),r=q=>{const Y=o.get(q?"#"+q.getAttribute("id"):null);return Y?Object.groupBy(Y.map(i),G=>G.property):null},e=Object.fromEntries(Object.entries(Object.groupBy(h.dc||[],q=>q.localName)).map(([q,Y])=>[q,Y.map(i)])),n=r()??{},c=Object.fromEntries(((j=h.legacyMeta)==null?void 0:j.map(q=>[q.getAttribute("name"),q.getAttribute("content")]))??[]),a=q=>{var Y;return(Y=q==null?void 0:q[0])==null?void 0:Y.value},s=(q,Y)=>{var G;return a((G=q==null?void 0:q.props)==null?void 0:G[Y])},f=q=>{var rt,it;if(!q)return null;const Y=((rt=q.props)==null?void 0:rt["alternate-script"])??[],G=q.attrs["alt-rep"];if(!Y.length&&(!q.lang||q.lang===d)&&!G)return q.value;const Q={[q.lang??d]:q.value};G&&(Q[q.attrs["alt-rep-lang"]]=G);for(const J of Y)Q[it=J.lang]??(Q[it]=J.value);return Q},p=q=>{var Y,G,Q,rt,it;return q?{name:f(q),sortAs:f((G=(Y=q.props)==null?void 0:Y["file-as"])==null?void 0:G[0])??q.attrs["file-as"],role:((it=(rt=(Q=q.props)==null?void 0:Q.role)==null?void 0:rt.filter(J=>J.scheme===rn.marc+"relators"))==null?void 0:it.map(J=>J.value))??[q.attrs.role],code:s(q,"term")??q.attrs.term,scheme:s(q,"authority")??q.attrs.authority}:null},u=q=>{var Y;return{name:f(q),position:a((Y=q.props)==null?void 0:Y["group-position"])}},g=q=>{var Q;const{value:Y}=q;if(/^urn:/i.test(Y))return Y;if(/^doi:/i.test(Y))return`urn:${Y}`;const G=(Q=q.props)==null?void 0:Q["identifier-type"];if(!G){const rt=q.attrs.scheme;return rt?/^(doi|isbn|uuid)$/i.test(rt)?`urn:${rt}:${Y}`:{scheme:rt,value:Y}:Y}if(G.scheme===rn.onix+"codelist5"){const rt=Z1[G.value];if(rt)return`urn:${rt}:${Y}`}return Y},m=Object.groupBy(n["belongs-to-collection"]??[],q=>s(q,"collection-type")==="series"?"series":"collection"),v=((L=e.title)==null?void 0:L.find(q=>s(q,"title-type")==="main"))??(($=e.title)==null?void 0:$[0]),S={identifier:Fc(C),title:f(v),sortAs:f((z=(V=v==null?void 0:v.props)==null?void 0:V["file-as"])==null?void 0:z[0])??((E=v==null?void 0:v.attrs)==null?void 0:E["file-as"])??(c==null?void 0:c["calibre:title_sort"]),subtitle:(k=(A=e.title)==null?void 0:A.find(q=>s(q,"title-type")==="subtitle"))==null?void 0:k.value,language:(b=e.language)==null?void 0:b.map(q=>q.value),description:a(e.description),publisher:p((y=e.publisher)==null?void 0:y[0]),published:((x=(_=e.date)==null?void 0:_.find(q=>q.attrs.event==="publication"))==null?void 0:x.value)??a(e.date),modified:a(n[rn.dcterms+"modified"])??((B=(M=e.date)==null?void 0:M.find(q=>q.attrs.event==="modification"))==null?void 0:B.value),subject:(P=e.subject)==null?void 0:P.map(p),belongsTo:{collection:(H=m.collection)==null?void 0:H.map(u),series:((W=m.series)==null?void 0:W.map(u))??(c==null?void 0:c["calibre:series"])?{name:c==null?void 0:c["calibre:series"],position:parseFloat(c==null?void 0:c["calibre:series_index"])}:null},altIdentifier:(K=e.identifier)==null?void 0:K.map(g),source:(D=e.source)==null?void 0:D.map(g),rights:a(e.rights)},R=q=>Y=>{var Q;const G=new Set((Q=Y.role)==null?void 0:Q.map(rt=>X1[rt]??q));return[G.size?G:[q],Y]};for(const[q,Y]of[].concat(((O=(X=e.creator)==null?void 0:X.map(p))==null?void 0:O.map(R("author")))??[],((U=(N=e.contributor)==null?void 0:N.map(p))==null?void 0:U.map(R("contributor")))??[]))for(const G of q)S[G]?S[G].push(Y):S[G]=[Y];$o(S),S.altIdentifier===S.identifier&&delete S.altIdentifier;const I={},F={};for(const[q,Y]of Object.entries(n))q.startsWith(rn.rendition)?I[zo(q.replace(rn.rendition,""))]=a(Y):q.startsWith(rn.media)&&(F[zo(q.replace(rn.media,""))]=a(Y));return F.duration&&(F.duration=Vo(F.duration)),{metadata:S,rendition:I,media:F}},rg=(C,w=t=>t)=>{var f;const{$:t,$$:h,$$$:d}=fs(C,Re.XHTML),l=p=>p?decodeURI(w(p)):null,i=p=>u=>{var I;const g=t(u,"a")??t(u,"span"),m=t(u,"ol"),v=l(g==null?void 0:g.getAttribute("href")),R={label:Gr(g)||(g==null?void 0:g.getAttribute("title")),href:v,subitems:o(m)};return p&&(R.type=(I=g==null?void 0:g.getAttributeNS(Re.EPUB,"type"))==null?void 0:I.split(/\s/)),R},o=(p,u)=>p?h(p,"li").map(i(u)):null,r=(p,u)=>o(t(p,"ol"),u),e=d(C,"nav");let n=null,c=null,a=null,s=[];for(const p of e){const u=((f=p.getAttributeNS(Re.EPUB,"type"))==null?void 0:f.split(/\s/))??[];u.includes("toc")?n??(n=r(p)):u.includes("page-list")?c??(c=r(p)):u.includes("landmarks")?a??(a=r(p,!0)):s.push({label:Gr(p.firstElementChild),type:u,list:r(p)})}return{toc:n,pageList:c,landmarks:a,others:s}},ng=(C,w=t=>t)=>{const{$:t,$$:h}=fs(C,Re.NCX),d=r=>r?decodeURI(w(r)):null,l=r=>{const e=t(r,"navLabel"),n=t(r,"content"),c=Gr(e),a=d(n.getAttribute("src"));if(r.localName==="navPoint"){const s=h(r,"navPoint");return{label:c,href:a,subitems:s.length?s.map(l):null}}return{label:c,href:a}},i=(r,e)=>h(r,e).map(l),o=(r,e)=>{const n=t(C.documentElement,r);return n?i(n,e):null};return{toc:o("navMap","navPoint"),pageList:o("pageList","pageTarget"),others:h(C.documentElement,"navList").map(r=>({label:Gr(t(r,"navLabel")),list:i(r,"navTarget")}))}},Vo=C=>{if(!C)return;const w=C.split(":").map(i=>parseFloat(i));if(w.length===3){const[i,o,r]=w;return i*60*60+o*60+r}if(w.length===2){const[i,o]=w;return i*60+o}const[t,h]=C.split(/(?=[^\d.])/),d=parseFloat(t),l=h==="h"?60*60:h==="min"?60:h==="ms"?.001:1;return d*l};var on,$i,jn,lr,Ye,Le,Vi,Ui,an,te,Pc,Ds,Cn,Tn,Ls,zs,Mn,Uo;class ig extends EventTarget{constructor(t,h){super();mt(this,te);mt(this,on);mt(this,$i);mt(this,jn);mt(this,lr);mt(this,Ye);mt(this,Le);mt(this,Vi,1);mt(this,Ui,1);mt(this,an);this.book=t,this.loadXML=h}async start(t,h=()=>!0){var o;(o=Z(this,Le))==null||o.pause();const d=this.book.sections[t],l=d==null?void 0:d.id;if(!l)return;const{mediaOverlay:i}=d;if(!i)return this.start(t+1);gt(this,jn,t),await ht(this,te,Pc).call(this,i);for(let r=0;r<Z(this,on).length;r++){const{items:e}=Z(this,on)[r];for(let n=0;n<e.length;n++)if(e[n].text.split("#")[0]===l&&h(e[n],n,e))return ht(this,te,Mn).call(this,r,n).catch(c=>ht(this,te,Tn).call(this,c))}}pause(){var t;gt(this,an,"paused"),(t=Z(this,Le))==null||t.pause()}resume(){var t;gt(this,an,"playing"),(t=Z(this,Le))==null||t.play().catch(h=>ht(this,te,Tn).call(this,h))}stop(){gt(this,an,"stopped"),ht(this,te,Uo).call(this)}prev(){Z(this,Ye)>0?ht(this,te,Mn).call(this,Z(this,lr),Z(this,Ye)-1):Z(this,lr)>0?ht(this,te,Mn).call(this,Z(this,lr)-1,Z(this,on)[Z(this,lr)-1].items.length-1):Z(this,jn)>0&&this.start(Z(this,jn)-1,(t,h,d)=>h===d.length-1)}next(){ht(this,te,Mn).call(this,Z(this,lr),Z(this,Ye)+1)}setVolume(t){gt(this,Vi,t),Z(this,Le)&&(Z(this,Le).volume=t)}setRate(t){gt(this,Ui,t),Z(this,Le)&&(Z(this,Le).playbackRate=t)}}on=new WeakMap,$i=new WeakMap,jn=new WeakMap,lr=new WeakMap,Ye=new WeakMap,Le=new WeakMap,Vi=new WeakMap,Ui=new WeakMap,an=new WeakMap,te=new WeakSet,Pc=async function(t){if(Z(this,$i)===t)return;const h=await this.loadXML(t.href),d=o=>o?ii(o,t.href):null,{$:l,$$$:i}=fs(h,Re.SMIL);gt(this,lr,-1),gt(this,Ye,-1),gt(this,on,i(h,"par").reduce((o,r)=>{var p;const e=d((p=l(r,"text"))==null?void 0:p.getAttribute("src")),n=l(r,"audio");if(!e||!n)return o;const c=d(n.getAttribute("src")),a=Vo(n.getAttribute("clipBegin")),s=Vo(n.getAttribute("clipEnd")),f=o.at(-1);return(f==null?void 0:f.src)===c?f.items.push({text:e,begin:a,end:s}):o.push({src:c,items:[{text:e,begin:a,end:s}]}),o},[])),gt(this,$i,t)},Ds=function(){return Z(this,on)[Z(this,lr)]},Cn=function(){var t,h;return(h=(t=Z(this,te,Ds))==null?void 0:t.items)==null?void 0:h[Z(this,Ye)]},Tn=function(t){console.error(t),this.dispatchEvent(new CustomEvent("error",{detail:t}))},Ls=function(){this.dispatchEvent(new CustomEvent("highlight",{detail:Z(this,te,Cn)}))},zs=function(){this.dispatchEvent(new CustomEvent("unhighlight",{detail:Z(this,te,Cn)}))},Mn=async function(t,h){var o;ht(this,te,Uo).call(this),gt(this,lr,t),gt(this,Ye,h);const d=(o=Z(this,te,Ds))==null?void 0:o.src;if(!d||!Z(this,te,Cn))return this.start(Z(this,jn)+1);const l=URL.createObjectURL(await this.book.loadBlob(d)),i=new Audio(l);gt(this,Le,i),i.volume=Z(this,Vi),i.playbackRate=Z(this,Ui),i.addEventListener("timeupdate",()=>{var c,a;if(i.paused)return;const r=i.currentTime,{items:e}=Z(this,te,Ds);if(r>((c=Z(this,te,Cn))==null?void 0:c.end)&&(ht(this,te,zs).call(this),Z(this,Ye)===e.length-1)){ht(this,te,Mn).call(this,Z(this,lr)+1,0).catch(s=>ht(this,te,Tn).call(this,s));return}const n=Z(this,Ye);for(;((a=e[Z(this,Ye)+1])==null?void 0:a.begin)<=r;)Ei(this,Ye)._++;Z(this,Ye)!==n&&ht(this,te,Ls).call(this)}),i.addEventListener("error",()=>ht(this,te,Tn).call(this,new Error(`Failed to load ${d}`))),i.addEventListener("playing",()=>ht(this,te,Ls).call(this)),i.addEventListener("ended",()=>{ht(this,te,zs).call(this),URL.revokeObjectURL(l),gt(this,Le,null),ht(this,te,Mn).call(this,t+1,0).catch(r=>ht(this,te,Tn).call(this,r))}),Z(this,an)==="paused"?(ht(this,te,Ls).call(this),i.currentTime=Z(this,te,Cn).begin??0):i.addEventListener("canplaythrough",()=>{i.currentTime=Z(this,te,Cn).begin??0,gt(this,an,"playing"),i.play().catch(r=>ht(this,te,Tn).call(this,r))},{once:!0})},Uo=function(){Z(this,Le)&&(Z(this,Le).pause(),URL.revokeObjectURL(Z(this,Le).src),gt(this,Le,null),ht(this,te,zs).call(this))};const sg=/([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})/,og=C=>{for(const w of C.getElementsByTagNameNS(Re.DC,"identifier")){const[t]=Gr(w).split(":").slice(-1);if(sg.test(t))return t}return""},Fc=C=>Gr(C.getElementById(C.documentElement.getAttribute("unique-identifier"))??C.getElementsByTagNameNS(Re.DC,"identifier")[0]),ll=async(C,w,t)=>{const h=new Uint8Array(await t.slice(0,w).arrayBuffer());w=Math.min(w,h.length);for(var d=0;d<w;d++)h[d]=h[d]^C[d%C.length];return new Blob([h,t.slice(w)],{type:t.type})},ag=async C=>{const w=new TextEncoder().encode(C),t=await globalThis.crypto.subtle.digest("SHA-1",w);return new Uint8Array(t)},lg=(C=ag)=>({"http://www.idpf.org/2008/embedding":{key:w=>C(Fc(w).replaceAll(/[\u0020\u0009\u000d\u000a]/g,"")),decode:(w,t)=>ll(w,1040,t)},"http://ns.adobe.com/pdf/enc#RC":{key:w=>{const t=og(w).replaceAll("-","");return Uint8Array.from({length:16},(h,d)=>parseInt(t.slice(d*2,d*2+2),16))},decode:(w,t)=>ll(w,1024,t)}});var Hi,oi,Wi;class cg{constructor(w){mt(this,Hi,new Map);mt(this,oi,new Map);mt(this,Wi);gt(this,Wi,w)}async init(w,t){if(!w)return;const h=Array.from(w.getElementsByTagNameNS(Re.ENC,"EncryptedData"),d=>{var l,i;return{algorithm:(l=d.getElementsByTagNameNS(Re.ENC,"EncryptionMethod")[0])==null?void 0:l.getAttribute("Algorithm"),uri:(i=d.getElementsByTagNameNS(Re.ENC,"CipherReference")[0])==null?void 0:i.getAttribute("URI")}});for(const{algorithm:d,uri:l}of h){if(!Z(this,oi).has(d)){const i=Z(this,Wi)[d];if(!i){console.warn("Unknown encryption algorithm");continue}const o=await i.key(t);Z(this,oi).set(d,r=>i.decode(o,r))}Z(this,Hi).set(l,d)}}getDecoder(w){return Z(this,oi).get(Z(this,Hi).get(w))??(t=>t)}}Hi=new WeakMap,oi=new WeakMap,Wi=new WeakMap;class ug{constructor({opf:w,resolveHref:t}){var n,c,a,s,f;this.opf=w;const{$:h,$$:d,$$$:l}=fs(w,Re.OPF),i=h(w.documentElement,"manifest"),o=h(w.documentElement,"spine"),r=d(o,"itemref");this.manifest=d(i,"item").map(Fs("href","id","media-type","properties","media-overlay")).map(p=>{var u;return p.href=t(p.href),p.properties=(u=p.properties)==null?void 0:u.split(/\s/),p}),this.spine=r.map(Fs("idref","id","linear","properties")).map(p=>{var u;return p.properties=(u=p.properties)==null?void 0:u.split(/\s/),p}),this.pageProgressionDirection=o.getAttribute("page-progression-direction"),this.navPath=(n=this.getItemByProperty("nav"))==null?void 0:n.href,this.ncxPath=(c=this.getItemByID(o.getAttribute("toc"))??this.manifest.find(p=>p.mediaType===Ue.NCX))==null?void 0:c.href;const e=h(w.documentElement,"guide");e&&(this.guide=d(e,"reference").map(Fs("type","title","href")).map(({type:p,title:u,href:g})=>({label:u,type:p.split(/\s/),href:t(g)}))),this.cover=this.getItemByProperty("cover-image")??this.getItemByID((a=l(w,"meta").find(K1("name","cover")))==null?void 0:a.getAttribute("content"))??this.manifest.find(p=>p.href.includes("cover")&&p.mediaType.startsWith("image"))??this.getItemByHref((f=(s=this.guide)==null?void 0:s.find(p=>p.type.includes("cover")))==null?void 0:f.href),this.cfis=Md(r)}getItemByID(w){return this.manifest.find(t=>t.id===w)}getItemByHref(w){return this.manifest.find(t=>t.href===w)}getItemByProperty(w){return this.manifest.find(t=>{var h;return(h=t.properties)==null?void 0:h.includes(w)})}resolveCFI(w){const t=Bi(w),h=(t.parent??t).shift();let d=Na(this.opf,h);d&&d.nodeName!=="idref"&&(h.at(-1).id=null,d=Na(this.opf,h));const l=d==null?void 0:d.getAttribute("idref");return{index:this.spine.findIndex(r=>r.idref===l),anchor:r=>zl(r,t)}}}var $r,Vr,Tr;class fg{constructor({loadText:w,loadBlob:t,resources:h}){mt(this,$r,new Map);mt(this,Vr,new Map);mt(this,Tr,new Map);De(this,"allowScript",!1);De(this,"eventTarget",new EventTarget);this.loadText=w,this.loadBlob=t,this.manifest=h.manifest,this.assets=h.manifest}async createURL(w,t,h,d){if(!t)return"";const l={data:t,type:h};Object.defineProperty(l,"name",{value:w});const i=new CustomEvent("data",{detail:l});this.eventTarget.dispatchEvent(i);const o=await i.detail.data,r=await i.detail.type,e=URL.createObjectURL(new Blob([o],{type:r}));if(Z(this,$r).set(w,e),Z(this,Tr).set(w,1),d){const n=Z(this,Vr).get(d);n?n.push(w):Z(this,Vr).set(d,[w])}return e}ref(w,t){const h=Z(this,Vr).get(t);return h!=null&&h.includes(w)||(Z(this,Tr).set(w,Z(this,Tr).get(w)+1),h?h.push(w):Z(this,Vr).set(t,[w])),Z(this,$r).get(w)}unref(w){if(!Z(this,Tr).has(w))return;const t=Z(this,Tr).get(w)-1;if(t<1){URL.revokeObjectURL(Z(this,$r).get(w)),Z(this,$r).delete(w),Z(this,Tr).delete(w);const h=Z(this,Vr).get(w);if(h)for(;h.length;)this.unref(h.pop());Z(this,Vr).delete(w)}else Z(this,Tr).set(w,t)}async loadItem(w,t=[]){if(!w)return null;const{href:h,mediaType:d}=w,l=Ue.JS.test(w.mediaType);if(l&&!this.allowScript)return null;const i=t.at(-1);if(Z(this,$r).has(h))return this.ref(h,i);if((l||[Ue.XHTML,Ue.HTML,Ue.CSS,Ue.SVG].includes(d))&&t.every(e=>e!==h))return this.loadReplaced(w,t);const r=Promise.resolve().then(()=>this.loadBlob(h));return this.createURL(h,r,d,i)}async loadHref(w,t,h=[]){if(Bc(w))return w;const d=ii(w,t),l=this.manifest.find(i=>i.href===d);return l?this.loadItem(l,h.concat(t)):w}async loadReplaced(w,t=[]){var r,e;const{href:h,mediaType:d}=w,l=t.at(-1);let i="";try{i=await this.loadText(h)}catch(n){return this.createURL(h,Promise.reject(n),d,l)}if(!i)return null;if([Ue.XHTML,Ue.HTML,Ue.SVG].includes(d)){let n=new DOMParser().parseFromString(i,d);if(d===Ue.XHTML&&(n.querySelector("parsererror")||!((r=n.documentElement)!=null&&r.namespaceURI))&&(console.warn(((e=n.querySelector("parsererror"))==null?void 0:e.innerText)??"Invalid XHTML"),w.mediaType=Ue.HTML,n=new DOMParser().parseFromString(i,w.mediaType)),[Ue.XHTML,Ue.SVG].includes(w.mediaType)){let s=n.firstChild;for(;s instanceof ProcessingInstruction;){if(s.data){const f=await Cs(s.data,/(?:^|\s*)(href\s*=\s*['"])([^'"]*)(['"])/i,(p,u,g,m)=>this.loadHref(g,h,t).then(v=>`${u}${v}${m}`));s.replaceWith(n.createProcessingInstruction(s.target,f))}s=s.nextSibling}}const c=async(s,f)=>s.setAttribute(f,await this.loadHref(s.getAttribute(f),h,t));for(const s of n.querySelectorAll("link[href]"))await c(s,"href");for(const s of n.querySelectorAll("[src]"))await c(s,"src");for(const s of n.querySelectorAll("[poster]"))await c(s,"poster");for(const s of n.querySelectorAll("object[data]"))await c(s,"data");for(const s of n.querySelectorAll("[*|href]:not([href])"))s.setAttributeNS(Re.XLINK,"href",await this.loadHref(s.getAttributeNS(Re.XLINK,"href"),h,t));for(const s of n.querySelectorAll("style"))s.textContent&&(s.textContent=await this.replaceCSS(s.textContent,h,t));for(const s of n.querySelectorAll("[style]"))s.setAttribute("style",await this.replaceCSS(s.getAttribute("style"),h,t));const a=new XMLSerializer().serializeToString(n);return this.createURL(h,a,w.mediaType,l)}const o=d===Ue.CSS?await this.replaceCSS(i,h,t):await this.replaceString(i,h,t);return this.createURL(h,o,d,l)}async replaceCSS(w,t,h=[]){const d=await Cs(w,/url\(\s*["']?([^'"\n]*?)\s*["']?\s*\)/gi,(l,i)=>this.loadHref(i,t,h).then(o=>`url("${o}")`));return Cs(d,/@import\s*["']([^"'\n]*?)["']/gi,(l,i)=>this.loadHref(i,t,h).then(o=>`@import "${o}"`))}replaceString(w,t,h=[]){const d=new Map,l=this.assets.map(o=>{if(o.href===t)return;const r=Y1(J1(t),o.href),e=encodeURI(r),n="/"+o.href,c=encodeURI(n),a=new Set([r,e,n,c]);for(const s of a)d.set(s,o);return Array.from(a)}).flat().filter(o=>o);if(!l.length)return w;const i=new RegExp(l.map(Q1).join("|"),"g");return Cs(w,i,async o=>this.loadItem(d.get(o.replace(/^\//,"")),h.concat(t)))}unloadItem(w){this.unref(w==null?void 0:w.href)}destroy(){for(const w of Z(this,$r).values())URL.revokeObjectURL(w)}}$r=new WeakMap,Vr=new WeakMap,Tr=new WeakMap;const hg=(C,w)=>C.getElementById(w)??C.querySelector(`[name="${CSS.escape(w)}"]`),dg=C=>{for(const w of C){if(w==="page-spread-left"||w==="rendition:page-spread-left")return"left";if(w==="page-spread-right"||w==="rendition:page-spread-right")return"right";if(w==="rendition:page-spread-center")return"center"}},pg=C=>C?{fixedLayout:Gr(C.querySelector('option[name="fixed-layout"]')),openToSpread:Gr(C.querySelector('option[name="open-to-spread"]'))}:null;var ln,ai,yr,Fr;class mg{constructor({loadText:w,loadBlob:t,getSize:h,sha1:d}){mt(this,yr);De(this,"parser",new DOMParser);mt(this,ln);mt(this,ai);this.loadText=w,this.loadBlob=t,this.getSize=h,gt(this,ai,new cg(lg(d)))}async init(){var a,s;const w=await ht(this,yr,Fr).call(this,"META-INF/container.xml");if(!w)throw new Error("Failed to load container file");const t=Array.from(w.getElementsByTagNameNS(Re.CONTAINER,"rootfile"),Fs("full-path","media-type")).filter(f=>f.mediaType==="application/oebps-package+xml");if(!t.length)throw new Error("No package document defined in container");const h=t[0].fullPath,d=await ht(this,yr,Fr).call(this,h);if(!d)throw new Error("Failed to load package document");const l=await ht(this,yr,Fr).call(this,"META-INF/encryption.xml");await Z(this,ai).init(l,d),this.resources=new ug({opf:d,resolveHref:f=>ii(f,h)}),gt(this,ln,new fg({loadText:this.loadText,loadBlob:f=>Promise.resolve(this.loadBlob(f)).then(Z(this,ai).getDecoder(f)),resources:this.resources})),this.transformTarget=Z(this,ln).eventTarget,this.sections=this.resources.spine.map((f,p)=>{const{idref:u,linear:g,properties:m=[]}=f,v=this.resources.getItemByID(u);return v?{id:v.href,load:()=>Z(this,ln).loadItem(v),unload:()=>Z(this,ln).unloadItem(v),createDocument:()=>this.loadDocument(v),size:this.getSize(v.href),cfi:this.resources.cfis[p],linear:g,pageSpread:dg(m),resolveHref:S=>ii(S,v.href),mediaOverlay:v.mediaOverlay?this.resources.getItemByID(v.mediaOverlay):null}:(console.warn(`Could not find item with ID "${u}" in manifest`),null)}).filter(f=>f);const{navPath:i,ncxPath:o}=this.resources;if(i)try{const f=u=>ii(u,i),p=rg(await ht(this,yr,Fr).call(this,i),f);this.toc=p.toc,this.pageList=p.pageList,this.landmarks=p.landmarks}catch(f){console.warn(f)}if(!this.toc&&o)try{const f=u=>ii(u,o),p=ng(await ht(this,yr,Fr).call(this,o),f);this.toc=p.toc,this.pageList=p.pageList}catch(f){console.warn(f)}this.landmarks??(this.landmarks=this.resources.guide);const{metadata:r,rendition:e,media:n}=eg(d);this.metadata=r,this.rendition=e,this.media=n,this.dir=this.resources.pageProgressionDirection;const c=pg(await ht(this,yr,Fr).call(this,"META-INF/com.apple.ibooks.display-options.xml")??await ht(this,yr,Fr).call(this,"META-INF/com.kobobooks.display-options.xml"));return c&&(c.fixedLayout==="true"&&((a=this.rendition).layout??(a.layout="pre-paginated")),c.openToSpread==="false"&&((s=this.sections.find(f=>f.linear!=="no")).pageSpread??(s.pageSpread=this.dir==="rtl"?"left":"right"))),this}async loadDocument(w){const t=await this.loadText(w.href);return this.parser.parseFromString(t,w.mediaType)}getMediaOverlay(){return new ig(this,ht(this,yr,Fr).bind(this))}resolveCFI(w){return this.resources.resolveCFI(w)}resolveHref(w){const[t,h]=w.split("#"),d=this.resources.getItemByHref(decodeURI(t));return d?{index:this.resources.spine.findIndex(({idref:o})=>o===d.id),anchor:h?o=>hg(o,h):()=>0}:null}splitTOCHref(w){return(w==null?void 0:w.split("#"))??[]}getTOCFragment(w,t){return w.getElementById(t)??w.querySelector(`[name="${CSS.escape(t)}"]`)}isExternal(w){return Bc(w)}async getCover(){var t;const w=(t=this.resources)==null?void 0:t.cover;return w!=null&&w.href?new Blob([await this.loadBlob(w.href)],{type:w.mediaType}):null}async getCalibreBookmarks(){const w=await this.loadText("META-INF/calibre_bookmarks.txt"),t="encoding=json+base64:";if(w!=null&&w.startsWith(t)){const h=atob(w.slice(t.length));return JSON.parse(h)}}destroy(){var w;(w=Z(this,ln))==null||w.destroy()}}ln=new WeakMap,ai=new WeakMap,yr=new WeakSet,Fr=async function(w){const t=await this.loadText(w);if(!t)return null;const h=this.parser.parseFromString(t,Ue.XML);if(h.querySelector("parsererror"))throw new Error(`XML parsing error: ${w}
117
+ ${h.querySelector("parsererror").innerText}`);return h};const cl=Object.freeze(Object.defineProperty({__proto__:null,EPUB:mg},Symbol.toStringTag,{value:"Module"})),gg=async({entries:C,loadBlob:w,getSize:t,getComment:h},d)=>{const l=new Map,i=new Map,o=async a=>{if(l.has(a))return l.get(a);const s=URL.createObjectURL(await w(a)),f=URL.createObjectURL(new Blob([`<body style="margin: 0"><img src="${s}">`],{type:"text/html"}));return i.set(a,[s,f]),l.set(a,f),f},r=a=>{var s,f;(f=(s=i.get(a))==null?void 0:s.forEach)==null||f.call(s,p=>URL.revokeObjectURL(p)),i.delete(a),l.delete(a)},e=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".jxl",".avif"],n=C.map(a=>a.filename).filter(a=>e.some(s=>a.endsWith(s))).sort();if(!n.length)throw new Error("No supported image files in archive");const c={};try{const s=JSON.parse(await h()||"")["ComicBookInfo/1.0"];if(s){const f=s.publicationYear,p=s.publicationMonth,u=p&&p>=1&&p<=12?String(p).padStart(2,"0"):null;c.metadata={title:s.title||d.name,publisher:s.publisher,language:s.language||s.lang,author:s.credits?s.credits.map(g=>`${g.person} (${g.role})`).join(", "):"",published:f&&p?`${f}-${u}`:void 0}}else c.metadata={title:d.name}}catch{c.metadata={title:d.name}}return c.getCover=()=>w(n[0]),c.sections=n.map(a=>({id:a,load:()=>o(a),unload:()=>r(a),size:t(a)})),c.toc=n.map(a=>({label:a,href:a})),c.rendition={layout:"pre-paginated"},c.resolveHref=a=>({index:c.sections.findIndex(s=>s.id===a)}),c.splitTOCHref=a=>[a,null],c.getTOCFragment=a=>a.documentElement,c.destroy=()=>{for(const a of i.values())for(const s of a)URL.revokeObjectURL(s)},c},bg=Object.freeze(Object.defineProperty({__proto__:null,makeComicBook:gg},Symbol.toStringTag,{value:"Module"})),Dc=C=>C?C.replace(/[\t\n\f\r ]+/g," ").replace(/^[\t\n\f\r ]+/,"").replace(/[\t\n\f\r ]+$/,""):"",sr=C=>Dc(C==null?void 0:C.textContent),Ts={XLINK:"http://www.w3.org/1999/xlink",EPUB:"http://www.idpf.org/2007/ops"},Js={XML:"application/xml",XHTML:"application/xhtml+xml"},ir={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"},vg={tr:["tr",{th:["th",ir,["colspan","rowspan","align","valign"]],td:["td",ir,["colspan","rowspan","align","valign"]]},["align"]]},Lc={epigraph:["blockquote"],subtitle:["h2",ir],"text-author":["p",ir],date:["p",ir],stanza:"stanza"},Qs={title:["header",{p:["h1",ir],"empty-line":["br"]}],epigraph:["blockquote","self"],image:"image",annotation:["aside"],section:["section","self"],p:["p",ir],poem:["blockquote",Lc],subtitle:["h2",ir],cite:["blockquote","self"],"empty-line":["br"],table:["table",vg],"text-author":["p",ir]};Lc.epigraph.push(Qs);const yg={image:"image",title:["section",{p:["h1",ir],"empty-line":["br"]}],epigraph:["section",Qs],section:["section",Qs]};class wg{constructor(w){this.fb2=w,this.doc=document.implementation.createDocument(Ts.XHTML,"html"),this.bins=new Map(Array.from(this.fb2.getElementsByTagName("binary"),t=>[t.id,t]))}getImageSrc(w){const t=w.getAttributeNS(Ts.XLINK,"href");if(!t)return"data:,";const[,h]=t.split("#");if(!h)return t;const d=this.bins.get(h);return d?`data:${d.getAttribute("content-type")};base64,${d.textContent}`:t}image(w){const t=this.doc.createElement("img");return t.alt=w.getAttribute("alt"),t.title=w.getAttribute("title"),t.setAttribute("src",this.getImageSrc(w)),t}anchor(w){const t=this.convert(w,{a:["a",ir]});return t.setAttribute("href",w.getAttributeNS(Ts.XLINK,"href")),w.getAttribute("type")==="note"&&t.setAttributeNS(Ts.EPUB,"epub:type","noteref"),t}stanza(w){const t=this.convert(w,{stanza:["p",{title:["header",{p:["strong",ir],"empty-line":["br"]}],subtitle:["p",ir]}]});for(const h of w.children)h.nodeName==="v"&&(t.append(this.doc.createTextNode(h.textContent)),t.append(this.doc.createElement("br")));return t}convert(w,t){if(w.nodeType===3)return this.doc.createTextNode(w.textContent);if(w.nodeType===4)return this.doc.createCDATASection(w.textContent);if(w.nodeType===8)return this.doc.createComment(w.textContent);const h=t==null?void 0:t[w.nodeName];if(!h)return null;if(typeof h=="string")return this[h](w);const[d,l,i]=h,o=this.doc.createElement(d);if(w.id&&(o.id=w.id),o.classList.add(w.nodeName),Array.isArray(i))for(const n of i){const c=w.getAttribute(n);c&&o.setAttribute(n,c)}const r=l==="self"?t:l;let e=w.firstChild;for(;e;){const n=this.convert(e,r);n&&o.append(n),e=e.nextSibling}return o}}const _g=async C=>{var i;const w=await C.arrayBuffer(),t=new TextDecoder("utf-8").decode(w),h=new DOMParser,d=h.parseFromString(t,Js.XML),l=d.xmlEncoding||((i=t.match(/^<\?xml\s+version\s*=\s*["']1.\d+"\s+encoding\s*=\s*["']([A-Za-z0-9._-]*)["']/))==null?void 0:i[1]);if(l&&l.toLowerCase()!=="utf-8"){const o=new TextDecoder(l).decode(w);return h.parseFromString(o,Js.XML)}return d},xg=URL.createObjectURL(new Blob([`
118
118
  @namespace epub "http://www.idpf.org/2007/ops";
119
119
  body > img, section > img {
120
120
  display: block;
@@ -162,23 +162,23 @@ a[epub|type~="noteref"] {
162
162
  body:not(.notesBodyType) > .title, body:not(.notesBodyType) > .epigraph {
163
163
  margin: 3em 0;
164
164
  }
165
- `],{type:"text/css"})),Rg=C=>`<?xml version="1.0" encoding="utf-8"?>
165
+ `],{type:"text/css"})),kg=C=>`<?xml version="1.0" encoding="utf-8"?>
166
166
  <html xmlns="http://www.w3.org/1999/xhtml">
167
- <head><link href="${Ag}" rel="stylesheet" type="text/css"/></head>
167
+ <head><link href="${xg}" rel="stylesheet" type="text/css"/></head>
168
168
  <body>${C}</body>
169
- </html>`,Eo="data-foliate-id",Ng=async C=>{const w={},t=await Mg(C),h=new Tg(t),d=s=>t.querySelector(s),l=s=>[...t.querySelectorAll(s)],i=s=>{const f=sr(s.querySelector("nickname"));if(f)return f;const p=sr(s.querySelector("first-name")),u=sr(s.querySelector("middle-name")),g=sr(s.querySelector("last-name")),m=[p,u,g].filter(S=>S).join(" "),v=g?[g,[p,u].filter(S=>S).join(" ")].join(", "):null;return{name:m,sortAs:v}},o=s=>(s==null?void 0:s.getAttribute("value"))??sr(s),r=d("title-info annotation");if(w.metadata={title:sr(d("title-info book-title")),identifier:sr(d("document-info id")),language:sr(d("title-info lang")),author:l("title-info author").map(i),translator:l("title-info translator").map(i),contributor:l("document-info author").map(i).concat(l("document-info program-used").map(sr)).map(s=>Object.assign(typeof s=="string"?{name:s}:s,{role:"bkp"})),publisher:sr(d("publish-info publisher")),published:o(d("title-info date")),modified:o(d("document-info date")),description:r?h.convert(r,{annotation:["div",Qs]}).innerHTML:null,subject:l("title-info genre").map(sr)},d("coverpage image")){const s=h.getImageSrc(d("coverpage image"));w.getCover=()=>fetch(s).then(f=>f.blob())}else w.getCover=()=>null;const e=Array.from(t.querySelectorAll("body"),s=>{const f=h.convert(s,{body:["body",Cg]});return[Array.from(f.children,p=>{const u=[p,...p.querySelectorAll("[id]")].map(g=>g.id);return{el:p,ids:u}}),f]}),n=[],c=e[0][0].map(({el:s,ids:f})=>{const p=Array.from(s.querySelectorAll(":scope > section > .title"),(u,g)=>(u.setAttribute(Eo,g),{title:sr(u),index:g}));return{ids:f,titles:p,el:s}}).concat(e.slice(1).map(([s,f])=>{const p=s.map(u=>u.ids).flat();return f.classList.add("notesBodyType"),{ids:p,el:f,linear:"no"}})).map(({ids:s,titles:f,el:p,linear:u})=>{var R;const g=Rg(p.outerHTML),m=new Blob([g],{type:Js.XHTML}),v=URL.createObjectURL(m);n.push(v);const S=Fc(((R=p.querySelector(".title, .subtitle, p"))==null?void 0:R.textContent)??(p.classList.contains("title")?p.textContent:""));return{ids:s,title:S,titles:f,load:()=>v,createDocument:()=>new DOMParser().parseFromString(g,Js.XHTML),size:m.size-Array.from(p.querySelectorAll("[src]"),I=>{var F;return((F=I.getAttribute("src"))==null?void 0:F.length)??0}).reduce((I,F)=>I+F,0),linear:u}}),a=new Map;return w.sections=c.map((s,f)=>{const{ids:p,load:u,createDocument:g,size:m,linear:v}=s;for(const S of p)S&&a.set(S,f);return{id:f,load:u,createDocument:g,size:m,linear:v}}),w.toc=c.map(({title:s,titles:f},p)=>{const u=p.toString();return{label:s,href:u,subitems:f!=null&&f.length?f.map(({title:g,index:m})=>({label:g,href:`${u}#${m}`})):null}}).filter(s=>s),w.resolveHref=s=>{const[f,p]=s.split("#");return f?{index:Number(f),anchor:u=>u.querySelector(`[${Eo}="${p}"]`)}:{index:a.get(p),anchor:u=>u.getElementById(p)}},w.splitTOCHref=s=>{var f;return((f=s==null?void 0:s.split("#"))==null?void 0:f.map(p=>Number(p)))??[]},w.getTOCFragment=(s,f)=>s.querySelector(`[${Eo}="${f}"]`),w.destroy=()=>{for(const s of n)URL.revokeObjectURL(s)},w},ul=Object.freeze(Object.defineProperty({__proto__:null,makeFB2:Ng},Symbol.toStringTag,{value:"Module"})),An=C=>{if(!C)return"";const w=document.createElement("textarea");return w.innerHTML=C,w.value},Dr={XML:"application/xml",XHTML:"application/xhtml+xml",HTML:"text/html",CSS:"text/css",SVG:"image/svg+xml"},Og={name:[0,32,"string"],type:[60,4,"string"],creator:[64,4,"string"],numRecords:[76,2,"uint"]},jg={compression:[0,2,"uint"],numTextRecords:[8,2,"uint"],recordSize:[10,2,"uint"],encryption:[12,2,"uint"]},Ig={magic:[16,4,"string"],length:[20,4,"uint"],type:[24,4,"uint"],encoding:[28,4,"uint"],uid:[32,4,"uint"],version:[36,4,"uint"],titleOffset:[84,4,"uint"],titleLength:[88,4,"uint"],localeRegion:[94,1,"uint"],localeLanguage:[95,1,"uint"],resourceStart:[108,4,"uint"],huffcdic:[112,4,"uint"],numHuffcdic:[116,4,"uint"],exthFlag:[128,4,"uint"],trailingFlags:[240,4,"uint"],indx:[244,4,"uint"]},Bg={resourceStart:[108,4,"uint"],fdst:[192,4,"uint"],numFdst:[196,4,"uint"],frag:[248,4,"uint"],skel:[252,4,"uint"],guide:[260,4,"uint"]},Pg={magic:[0,4,"string"],length:[4,4,"uint"],count:[8,4,"uint"]},fl={magic:[0,4,"string"],length:[4,4,"uint"],type:[8,4,"uint"],idxt:[20,4,"uint"],numRecords:[24,4,"uint"],encoding:[28,4,"uint"],language:[32,4,"uint"],total:[36,4,"uint"],ordt:[40,4,"uint"],ligt:[44,4,"uint"],numLigt:[48,4,"uint"],numCncx:[52,4,"uint"]},Fg={magic:[0,4,"string"],length:[4,4,"uint"],numControlBytes:[8,4,"uint"]},Dg={magic:[0,4,"string"],offset1:[8,4,"uint"],offset2:[12,4,"uint"]},Lg={magic:[0,4,"string"],length:[4,4,"uint"],numEntries:[8,4,"uint"],codeLength:[12,4,"uint"]},zg={magic:[0,4,"string"],numEntries:[8,4,"uint"]},$g={flags:[8,4,"uint"],dataStart:[12,4,"uint"],keyLength:[16,4,"uint"],keyStart:[20,4,"uint"]},Vg={1252:"windows-1252",65001:"utf-8"},hl={100:["creator","string",!0],101:["publisher"],103:["description"],104:["isbn"],105:["subject","string",!0],106:["date"],108:["contributor","string",!0],109:["rights"],110:["subjectCode","string",!0],112:["source","string",!0],113:["asin"],121:["boundary","uint"],122:["fixedLayout"],125:["numResources","uint"],126:["originalResolution"],127:["zeroGutter"],128:["zeroMargin"],129:["coverURI"],132:["regionMagnification"],201:["coverOffset","uint"],202:["thumbnailOffset","uint"],503:["title"],524:["language","string",!0],527:["pageProgressionDirection"]},Ug={1:["ar","ar-SA","ar-IQ","ar-EG","ar-LY","ar-DZ","ar-MA","ar-TN","ar-OM","ar-YE","ar-SY","ar-JO","ar-LB","ar-KW","ar-AE","ar-BH","ar-QA"],2:["bg"],3:["ca"],4:["zh","zh-TW","zh-CN","zh-HK","zh-SG"],5:["cs"],6:["da"],7:["de","de-DE","de-CH","de-AT","de-LU","de-LI"],8:["el"],9:["en","en-US","en-GB","en-AU","en-CA","en-NZ","en-IE","en-ZA","en-JM",null,"en-BZ","en-TT","en-ZW","en-PH"],10:["es","es-ES","es-MX",null,"es-GT","es-CR","es-PA","es-DO","es-VE","es-CO","es-PE","es-AR","es-EC","es-CL","es-UY","es-PY","es-BO","es-SV","es-HN","es-NI","es-PR"],11:["fi"],12:["fr","fr-FR","fr-BE","fr-CA","fr-CH","fr-LU","fr-MC"],13:["he"],14:["hu"],15:["is"],16:["it","it-IT","it-CH"],17:["ja"],18:["ko"],19:["nl","nl-NL","nl-BE"],20:["no","nb","nn"],21:["pl"],22:["pt","pt-BR","pt-PT"],23:["rm"],24:["ro"],25:["ru"],26:["hr",null,"sr"],27:["sk"],28:["sq"],29:["sv","sv-SE","sv-FI"],30:["th"],31:["tr"],32:["ur"],33:["id"],34:["uk"],35:["be"],36:["sl"],37:["et"],38:["lv"],39:["lt"],41:["fa"],42:["vi"],43:["hy"],44:["az"],45:["eu"],46:["hsb"],47:["mk"],48:["st"],49:["ts"],50:["tn"],52:["xh"],53:["zu"],54:["af"],55:["ka"],56:["fo"],57:["hi"],58:["mt"],59:["se"],62:["ms"],63:["kk"],65:["sw"],67:["uz",null,"uz-UZ"],68:["tt"],69:["bn"],70:["pa"],71:["gu"],72:["or"],73:["ta"],74:["te"],75:["kn"],76:["ml"],77:["as"],78:["mr"],79:["sa"],82:["cy","cy-GB"],83:["gl","gl-ES"],87:["kok"],97:["ne"],98:["fy"]},to=(C,w)=>{const t=new C.constructor(C.length+w.length);return t.set(C),t.set(w,C.length),t},Lc=(C,w,t)=>{const h=new C.constructor(C.length+w.length+t.length);return h.set(C),h.set(w,C.length),h.set(t,C.length+w.length),h},Hg=new TextDecoder,hs=C=>Hg.decode(C),Xe=C=>{if(!C)return;const w=C.byteLength,t=w===4?"getUint32":w===2?"getUint16":"getUint8";return new DataView(C)[t](0)},pr=(C,w)=>Object.fromEntries(Array.from(Object.entries(C)).map(([t,[h,d,l]])=>[t,(l==="string"?hs:Xe)(w.slice(h,h+d))])),fa=C=>new TextDecoder(Vg[C]),Ms=(C,w=0)=>{let t=0,h=0;for(const d of C.subarray(w,w+4))if(t=t<<7|(d&127)>>>0,h++,d&128)break;return{value:t,length:h}},Wg=C=>{let w=0;for(const t of C.subarray(-4))t&128&&(w=0),w=w<<7|t&127;return w},zc=C=>{let w=0;for(;C>0;C=C>>1)(C&1)===1&&w++;return w},qg=C=>{let w=0;for(;!(C&1);)C=C>>1,w++;return w},Xg=C=>{let w=[];for(let t=0;t<C.length;t++){const h=C[t];if(h===0)w.push(0);else if(h<=8)for(const d of C.subarray(t+1,(t+=h)+1))w.push(d);else if(h<=127)w.push(h);else if(h<=191){const d=h<<8|C[t+++1],l=(d&16383)>>>3,i=(d&7)+3;for(let o=0;o<i;o++)w.push(w[w.length-l])}else w.push(32,h^128)}return Uint8Array.from(w)},Zg=(C,w)=>{const t=w>>3,h=w+32,d=h>>3;let l=0n;for(let i=t;i<=d;i++)l=l<<8n|BigInt(C[i]??0);return l>>8n-BigInt(h&7)&0xffffffffn},Gg=async(C,w)=>{const t=await w(C.huffcdic),{magic:h,offset1:d,offset2:l}=pr(Dg,t);if(h!=="HUFF")throw new Error("Invalid HUFF record");const i=Array.from({length:256},(n,c)=>d+c*4).map(n=>Xe(t.slice(n,n+4))).map(n=>[n&128,n&31,n>>>8]),o=[null].concat(Array.from({length:32},(n,c)=>l+c*8).map(n=>[Xe(t.slice(n,n+4)),Xe(t.slice(n+4,n+8))])),r=[];for(let n=1;n<C.numHuffcdic;n++){const c=await w(C.huffcdic+n),a=pr(Lg,c);if(a.magic!=="CDIC")throw new Error("Invalid CDIC record");const s=Math.min(1<<a.codeLength,a.numEntries-r.length),f=c.slice(a.length);for(let p=0;p<s;p++){const u=Xe(f.slice(p*2,p*2+2)),g=Xe(f.slice(u,u+2)),m=g&32767,v=g&32768,S=new Uint8Array(f.slice(u+2,u+2+m));r.push([S,v])}}const e=n=>{let c=new Uint8Array;const a=n.byteLength*8;for(let s=0;s<a;){const f=Number(Zg(n,s));let[p,u,g]=i[f>>>24];if(!p){for(;f>>>32-u<o[u][0];)u+=1;g=o[u][1]}if((s+=u)>a)break;const m=g-(f>>>32-u);let[v,S]=r[m];S||(v=e(v),r[m]=[v,!0]),c=to(c,v)}return c};return e},$s=async(C,w)=>{const t=await w(C),h=pr(fl,t);if(h.magic!=="INDX")throw new Error("Invalid INDX record");const d=fa(h.encoding),l=t.slice(h.length),i=pr(Fg,l);if(i.magic!=="TAGX")throw new Error("Invalid TAGX section");const o=(i.length-12)/4,r=Array.from({length:o},(a,s)=>new Uint8Array(l.slice(12+s*4,12+s*4+4))),e={};let n=0;for(let a=0;a<h.numCncx;a++){const s=await w(C+h.numRecords+a+1),f=new Uint8Array(s);for(let p=0;p<f.byteLength;){const u=p,{value:g,length:m}=Ms(f,p);p+=m;const v=s.slice(p,p+g);p+=g,e[n+u]=d.decode(v)}n+=65536}const c=[];for(let a=0;a<h.numRecords;a++){const s=await w(C+1+a),f=new Uint8Array(s),p=pr(fl,s);if(p.magic!=="INDX")throw new Error("Invalid INDX record");for(let u=0;u<p.numRecords;u++){const g=p.idxt+4+2*u,m=Xe(s.slice(g,g+2)),v=Xe(s.slice(m,m+1)),S=hs(s.slice(m+1,m+1+v)),R=[],I=m+1+v;let F=0,j=I+i.numControlBytes;for(const[$,V,z,E]of r){if(E&1){F++;continue}const A=I+F,k=Xe(s.slice(A,A+1))&z;if(k===z)if(zc(z)>1){const{value:b,length:y}=Ms(f,j);R.push([$,null,b,V]),j+=y}else R.push([$,1,null,V]);else R.push([$,k>>qg(z),null,V])}const L={};for(const[$,V,z,E]of R){const A=[];if(V!=null)for(let k=0;k<V*E;k++){const{value:b,length:y}=Ms(f,j);A.push(b),j+=y}else{let k=0;for(;k<z;){const{value:b,length:y}=Ms(f,j);A.push(b),j+=y,k+=y}}L[$]=A}c.push({name:S,tagMap:L})}}return{table:c,cncx:e}},Kg=async(C,w)=>{const{table:t,cncx:h}=await $s(C,w),d=t.map(({tagMap:i},o)=>{var r,e,n,c,a,s;return{index:o,offset:(r=i[1])==null?void 0:r[0],size:(e=i[2])==null?void 0:e[0],label:h[i[3]]??"",headingLevel:(n=i[4])==null?void 0:n[0],pos:i[6],parent:(c=i[21])==null?void 0:c[0],firstChild:(a=i[22])==null?void 0:a[0],lastChild:(s=i[23])==null?void 0:s[0]}}),l=i=>(i.firstChild==null||(i.children=d.filter(o=>o.parent===i.index).map(l)),i);return d.filter(i=>i.headingLevel===0).map(l)},Yg=(C,w)=>{const{magic:t,count:h}=pr(Pg,C);if(t!=="EXTH")throw new Error("Invalid EXTH header");const d=fa(w),l={};let i=12;for(let o=0;o<h;o++){const r=Xe(C.slice(i,i+4)),e=Xe(C.slice(i+4,i+8));if(r in hl){const[n,c,a]=hl[r],s=C.slice(i+8,i+e),f=c==="uint"?Xe(s):d.decode(s);a?(l[n]??(l[n]=[]),l[n].push(f)):l[n]=f}i+=e}return l},Jg=async(C,w)=>{const{flags:t,dataStart:h,keyLength:d,keyStart:l}=pr($g,C),i=new Uint8Array(C.slice(h));if(t&2){const r=d===16?1024:1040,e=new Uint8Array(C.slice(l,l+d)),n=Math.min(r,i.length);for(var o=0;o<n;o++)i[o]=i[o]^e[o%e.length]}if(t&1)try{return await w(i)}catch(r){console.warn(r),console.warn("Failed to decompress font")}return i},Qg=async C=>hs(await C.slice(60,68).arrayBuffer())==="BOOKMOBI";var li,ci;class tb{constructor(){mt(this,li);mt(this,ci);De(this,"pdb")}async open(w){gt(this,li,w);const t=pr(Og,await w.slice(0,78).arrayBuffer());this.pdb=t;const h=await w.slice(78,78+t.numRecords*8).arrayBuffer();gt(this,ci,Array.from({length:t.numRecords},(d,l)=>Xe(h.slice(l*8,l*8+4))).map((d,l,i)=>[d,i[l+1]]))}loadRecord(w){const t=Z(this,ci)[w];if(!t)throw new RangeError("Record index out of bounds");return Z(this,li).slice(...t).arrayBuffer()}async loadMagic(w){const t=Z(this,ci)[w][0];return hs(await Z(this,li).slice(t,t+4).arrayBuffer())}}li=new WeakMap,ci=new WeakMap;var ui,qi,Xi,Zi,fi,Gi,Hn,Ho,$c;class eb extends tb{constructor({unzlib:t}){super();mt(this,Hn);mt(this,ui,0);mt(this,qi);mt(this,Xi);mt(this,Zi);mt(this,fi);mt(this,Gi);this.unzlib=t}async open(t){var d;await super.open(t),this.headers=ht(this,Hn,Ho).call(this,await super.loadRecord(0)),gt(this,qi,this.headers.mobi.resourceStart);let h=this.headers.mobi.version>=8;if(!h){const l=(d=this.headers.exth)==null?void 0:d.boundary;if(l<4294967295)try{this.headers=ht(this,Hn,Ho).call(this,await super.loadRecord(l)),gt(this,ui,l),h=!0}catch(i){console.warn(i),console.warn("Failed to open KF8; falling back to MOBI")}}return await ht(this,Hn,$c).call(this),h?new cb(this).init():new ib(this).init()}decode(...t){return Z(this,Xi).decode(...t)}encode(...t){return Z(this,Zi).encode(...t)}loadRecord(t){return super.loadRecord(Z(this,ui)+t)}loadMagic(t){return super.loadMagic(Z(this,ui)+t)}loadText(t){return this.loadRecord(t+1).then(h=>new Uint8Array(h)).then(Z(this,Gi)).then(Z(this,fi))}async loadResource(t){const h=await super.loadRecord(Z(this,qi)+t),d=hs(h.slice(0,4));return d==="FONT"?Jg(h,this.unzlib):d==="VIDE"||d==="AUDI"?h.slice(12):h}getNCX(){const t=this.headers.mobi.indx;if(t<4294967295)return Kg(t,this.loadRecord.bind(this))}getMetadata(){var d,l;const{mobi:t,exth:h}=this.headers;return{identifier:t.uid.toString(),title:An((h==null?void 0:h.title)||this.decode(t.title)),author:(d=h==null?void 0:h.creator)==null?void 0:d.map(An),publisher:An(h==null?void 0:h.publisher),language:(h==null?void 0:h.language)??t.language,published:h==null?void 0:h.date,description:An(h==null?void 0:h.description),subject:(l=h==null?void 0:h.subject)==null?void 0:l.map(An),rights:An(h==null?void 0:h.rights),contributor:h==null?void 0:h.contributor}}async getCover(){const{exth:t}=this.headers,h=(t==null?void 0:t.coverOffset)<4294967295?t==null?void 0:t.coverOffset:(t==null?void 0:t.thumbnailOffset)<4294967295?t==null?void 0:t.thumbnailOffset:null;if(h!=null){const d=await this.loadResource(h);return new Blob([d])}}}ui=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,fi=new WeakMap,Gi=new WeakMap,Hn=new WeakSet,Ho=function(t){const h=pr(jg,t),d=pr(Ig,t);if(d.magic!=="MOBI")throw new Error("Missing MOBI header");const{titleOffset:l,titleLength:i,localeLanguage:o,localeRegion:r}=d;d.title=t.slice(l,l+i);const e=Ug[o];d.language=(e==null?void 0:e[r>>2])??(e==null?void 0:e[0]);const n=d.exthFlag&64?Yg(t.slice(d.length+16),d.encoding):null,c=d.version>=8?pr(Bg,t):null;return{palmdoc:h,mobi:d,exth:n,kf8:c}},$c=async function(){const{palmdoc:t,mobi:h}=this.headers;gt(this,Xi,fa(h.encoding)),gt(this,Zi,new TextEncoder);const{compression:d}=t;if(gt(this,fi,d===1?r=>r:d===2?Xg:d===17480?await Gg(h,this.loadRecord.bind(this)):null),!Z(this,fi))throw new Error("Unknown compression type");const{trailingFlags:l}=h,i=l&1,o=zc(l>>>1);gt(this,Gi,r=>{for(let e=0;e<o;e++){const n=Wg(r);r=r.subarray(0,-n)}if(i){const e=(r[r.length-1]&3)+1;r=r.subarray(0,-e)}return r})};const dl=/<\s*(?:mbp:)?pagebreak[^>]*>/gi,rb=/<[^<>]+filepos=['"]{0,1}(\d+)[^<>]*>/gi,nb=C=>{let w=0;for(;C;){const t=C.parentElement;if(t){const h=t.tagName.toLowerCase();h==="p"?w+=1.5:h==="blockquote"&&(w+=2)}C=t}return w};var In,hi,Bn,cn,Ki,Yi;class ib{constructor(w){De(this,"parser",new DOMParser);De(this,"serializer",new XMLSerializer);mt(this,In,new Map);mt(this,hi,new Map);mt(this,Bn,new Map);mt(this,cn);mt(this,Ki,[]);mt(this,Yi,Dr.HTML);this.mobi=w}async init(){var h;let w=new Uint8Array;for(let d=0;d<this.mobi.headers.palmdoc.numTextRecords;d++)w=to(w,await this.mobi.loadText(d));const t=Array.from(new Uint8Array(w),d=>String.fromCharCode(d)).join("");gt(this,cn,[0].concat(Array.from(t.matchAll(dl),d=>d.index)).map((d,l,i)=>t.slice(d,i[l+1])).map(d=>Uint8Array.from(d,l=>l.charCodeAt(0))).map(d=>({book:this,raw:d})).reduce((d,l)=>{const i=d[d.length-1];return l.start=(i==null?void 0:i.end)??0,l.end=l.start+l.raw.byteLength,d.concat(l)},[])),this.sections=Z(this,cn).map((d,l)=>({id:l,load:()=>this.loadSection(d),createDocument:()=>this.createDocument(d),size:d.end-d.start}));try{this.landmarks=await this.getGuide();const d=(h=this.landmarks.find(({type:l})=>l==null?void 0:l.includes("toc")))==null?void 0:h.href;if(d){const{index:l}=this.resolveHref(d),i=await this.sections[l].createDocument();let o,r=0,e=0;const n=new Map,c=new Map;this.toc=Array.from(i.querySelectorAll("a[filepos]")).reduce((a,s)=>{var g;const f=nb(s),p={label:((g=s.innerText)==null?void 0:g.trim())??"",href:`filepos:${s.getAttribute("filepos")}`},u=f>e?r+1:f===e?r:n.get(f)??Math.max(0,r-1);if(u>r)o?(o.subitems??(o.subitems=[]),o.subitems.push(p),c.set(u,o)):a.push(p);else{const m=c.get(u);m?m.subitems.push(p):a.push(p)}return o=p,r=u,e=f,n.set(f,u),a},[])}}catch(d){console.warn(d)}return gt(this,Ki,[...new Set(Array.from(t.matchAll(rb),d=>d[1]))].map(d=>({filepos:d,number:Number(d)})).sort((d,l)=>d.number-l.number)),this.metadata=this.mobi.getMetadata(),this.getCover=this.mobi.getCover.bind(this.mobi),this}async getGuide(){const w=await this.createDocument(Z(this,cn)[0]);return Array.from(w.getElementsByTagName("reference"),t=>{var h;return{label:t.getAttribute("title"),type:(h=t.getAttribute("type"))==null?void 0:h.split(/\s/),href:`filepos:${t.getAttribute("filepos")}`}})}async loadResource(w){if(Z(this,In).has(w))return Z(this,In).get(w);const t=await this.mobi.loadResource(w),h=URL.createObjectURL(new Blob([t]));return Z(this,In).set(w,h),h}async loadRecindex(w){return this.loadResource(Number(w)-1)}async replaceResources(w){for(const t of w.querySelectorAll("img[recindex]")){const h=t.getAttribute("recindex");try{t.src=await this.loadRecindex(h)}catch{console.warn(`Failed to load image ${h}`)}}for(const t of w.querySelectorAll("[mediarecindex]")){const h=t.getAttribute("mediarecindex"),d=t.getAttribute("recindex");try{t.src=await this.loadRecindex(h),d&&(t.poster=await this.loadRecindex(d))}catch{console.warn(`Failed to load media ${h}`)}}for(const t of w.querySelectorAll("[filepos]")){const h=t.getAttribute("filepos");t.href=`filepos:${h}`}}async loadText(w){if(Z(this,hi).has(w))return Z(this,hi).get(w);const{raw:t}=w,h=Z(this,Ki).filter(({number:i})=>i>=w.start&&i<w.end).map(i=>({...i,offset:i.number-w.start}));let d=t;h.length&&(d=t.subarray(0,h[0].offset),h.forEach(({filepos:i,offset:o},r)=>{const e=h[r+1],n=this.mobi.encode(`<a id="filepos${i}"></a>`);d=Lc(d,n,t.subarray(o,e==null?void 0:e.offset))}));const l=this.mobi.decode(d).replaceAll(dl,"");return Z(this,hi).set(w,l),l}async createDocument(w){const t=await this.loadText(w);return this.parser.parseFromString(t,Z(this,Yi))}async loadSection(w){if(Z(this,Bn).has(w))return Z(this,Bn).get(w);const t=await this.createDocument(w),h=t.createElement("style");t.head.append(h),h.append(t.createTextNode(`blockquote {
169
+ </html>`,Eo="data-foliate-id",Sg=async C=>{const w={},t=await _g(C),h=new wg(t),d=s=>t.querySelector(s),l=s=>[...t.querySelectorAll(s)],i=s=>{const f=sr(s.querySelector("nickname"));if(f)return f;const p=sr(s.querySelector("first-name")),u=sr(s.querySelector("middle-name")),g=sr(s.querySelector("last-name")),m=[p,u,g].filter(S=>S).join(" "),v=g?[g,[p,u].filter(S=>S).join(" ")].join(", "):null;return{name:m,sortAs:v}},o=s=>(s==null?void 0:s.getAttribute("value"))??sr(s),r=d("title-info annotation");if(w.metadata={title:sr(d("title-info book-title")),identifier:sr(d("document-info id")),language:sr(d("title-info lang")),author:l("title-info author").map(i),translator:l("title-info translator").map(i),contributor:l("document-info author").map(i).concat(l("document-info program-used").map(sr)).map(s=>Object.assign(typeof s=="string"?{name:s}:s,{role:"bkp"})),publisher:sr(d("publish-info publisher")),published:o(d("title-info date")),modified:o(d("document-info date")),description:r?h.convert(r,{annotation:["div",Qs]}).innerHTML:null,subject:l("title-info genre").map(sr)},d("coverpage image")){const s=h.getImageSrc(d("coverpage image"));w.getCover=()=>fetch(s).then(f=>f.blob())}else w.getCover=()=>null;const e=Array.from(t.querySelectorAll("body"),s=>{const f=h.convert(s,{body:["body",yg]});return[Array.from(f.children,p=>{const u=[p,...p.querySelectorAll("[id]")].map(g=>g.id);return{el:p,ids:u}}),f]}),n=[],c=e[0][0].map(({el:s,ids:f})=>{const p=Array.from(s.querySelectorAll(":scope > section > .title"),(u,g)=>(u.setAttribute(Eo,g),{title:sr(u),index:g}));return{ids:f,titles:p,el:s}}).concat(e.slice(1).map(([s,f])=>{const p=s.map(u=>u.ids).flat();return f.classList.add("notesBodyType"),{ids:p,el:f,linear:"no"}})).map(({ids:s,titles:f,el:p,linear:u})=>{var R;const g=kg(p.outerHTML),m=new Blob([g],{type:Js.XHTML}),v=URL.createObjectURL(m);n.push(v);const S=Dc(((R=p.querySelector(".title, .subtitle, p"))==null?void 0:R.textContent)??(p.classList.contains("title")?p.textContent:""));return{ids:s,title:S,titles:f,load:()=>v,createDocument:()=>new DOMParser().parseFromString(g,Js.XHTML),size:m.size-Array.from(p.querySelectorAll("[src]"),I=>{var F;return((F=I.getAttribute("src"))==null?void 0:F.length)??0}).reduce((I,F)=>I+F,0),linear:u}}),a=new Map;return w.sections=c.map((s,f)=>{const{ids:p,load:u,createDocument:g,size:m,linear:v}=s;for(const S of p)S&&a.set(S,f);return{id:f,load:u,createDocument:g,size:m,linear:v}}),w.toc=c.map(({title:s,titles:f},p)=>{const u=p.toString();return{label:s,href:u,subitems:f!=null&&f.length?f.map(({title:g,index:m})=>({label:g,href:`${u}#${m}`})):null}}).filter(s=>s),w.resolveHref=s=>{const[f,p]=s.split("#");return f?{index:Number(f),anchor:u=>u.querySelector(`[${Eo}="${p}"]`)}:{index:a.get(p),anchor:u=>u.getElementById(p)}},w.splitTOCHref=s=>{var f;return((f=s==null?void 0:s.split("#"))==null?void 0:f.map(p=>Number(p)))??[]},w.getTOCFragment=(s,f)=>s.querySelector(`[${Eo}="${f}"]`),w.destroy=()=>{for(const s of n)URL.revokeObjectURL(s)},w},ul=Object.freeze(Object.defineProperty({__proto__:null,makeFB2:Sg},Symbol.toStringTag,{value:"Module"})),An=C=>{if(!C)return"";const w=document.createElement("textarea");return w.innerHTML=C,w.value},Dr={XML:"application/xml",XHTML:"application/xhtml+xml",HTML:"text/html",CSS:"text/css",SVG:"image/svg+xml"},Eg={name:[0,32,"string"],type:[60,4,"string"],creator:[64,4,"string"],numRecords:[76,2,"uint"]},Cg={compression:[0,2,"uint"],numTextRecords:[8,2,"uint"],recordSize:[10,2,"uint"],encryption:[12,2,"uint"]},Tg={magic:[16,4,"string"],length:[20,4,"uint"],type:[24,4,"uint"],encoding:[28,4,"uint"],uid:[32,4,"uint"],version:[36,4,"uint"],titleOffset:[84,4,"uint"],titleLength:[88,4,"uint"],localeRegion:[94,1,"uint"],localeLanguage:[95,1,"uint"],resourceStart:[108,4,"uint"],huffcdic:[112,4,"uint"],numHuffcdic:[116,4,"uint"],exthFlag:[128,4,"uint"],trailingFlags:[240,4,"uint"],indx:[244,4,"uint"]},Mg={resourceStart:[108,4,"uint"],fdst:[192,4,"uint"],numFdst:[196,4,"uint"],frag:[248,4,"uint"],skel:[252,4,"uint"],guide:[260,4,"uint"]},Ag={magic:[0,4,"string"],length:[4,4,"uint"],count:[8,4,"uint"]},fl={magic:[0,4,"string"],length:[4,4,"uint"],type:[8,4,"uint"],idxt:[20,4,"uint"],numRecords:[24,4,"uint"],encoding:[28,4,"uint"],language:[32,4,"uint"],total:[36,4,"uint"],ordt:[40,4,"uint"],ligt:[44,4,"uint"],numLigt:[48,4,"uint"],numCncx:[52,4,"uint"]},Rg={magic:[0,4,"string"],length:[4,4,"uint"],numControlBytes:[8,4,"uint"]},Ng={magic:[0,4,"string"],offset1:[8,4,"uint"],offset2:[12,4,"uint"]},Og={magic:[0,4,"string"],length:[4,4,"uint"],numEntries:[8,4,"uint"],codeLength:[12,4,"uint"]},jg={magic:[0,4,"string"],numEntries:[8,4,"uint"]},Ig={flags:[8,4,"uint"],dataStart:[12,4,"uint"],keyLength:[16,4,"uint"],keyStart:[20,4,"uint"]},Bg={1252:"windows-1252",65001:"utf-8"},hl={100:["creator","string",!0],101:["publisher"],103:["description"],104:["isbn"],105:["subject","string",!0],106:["date"],108:["contributor","string",!0],109:["rights"],110:["subjectCode","string",!0],112:["source","string",!0],113:["asin"],121:["boundary","uint"],122:["fixedLayout"],125:["numResources","uint"],126:["originalResolution"],127:["zeroGutter"],128:["zeroMargin"],129:["coverURI"],132:["regionMagnification"],201:["coverOffset","uint"],202:["thumbnailOffset","uint"],503:["title"],524:["language","string",!0],527:["pageProgressionDirection"]},Pg={1:["ar","ar-SA","ar-IQ","ar-EG","ar-LY","ar-DZ","ar-MA","ar-TN","ar-OM","ar-YE","ar-SY","ar-JO","ar-LB","ar-KW","ar-AE","ar-BH","ar-QA"],2:["bg"],3:["ca"],4:["zh","zh-TW","zh-CN","zh-HK","zh-SG"],5:["cs"],6:["da"],7:["de","de-DE","de-CH","de-AT","de-LU","de-LI"],8:["el"],9:["en","en-US","en-GB","en-AU","en-CA","en-NZ","en-IE","en-ZA","en-JM",null,"en-BZ","en-TT","en-ZW","en-PH"],10:["es","es-ES","es-MX",null,"es-GT","es-CR","es-PA","es-DO","es-VE","es-CO","es-PE","es-AR","es-EC","es-CL","es-UY","es-PY","es-BO","es-SV","es-HN","es-NI","es-PR"],11:["fi"],12:["fr","fr-FR","fr-BE","fr-CA","fr-CH","fr-LU","fr-MC"],13:["he"],14:["hu"],15:["is"],16:["it","it-IT","it-CH"],17:["ja"],18:["ko"],19:["nl","nl-NL","nl-BE"],20:["no","nb","nn"],21:["pl"],22:["pt","pt-BR","pt-PT"],23:["rm"],24:["ro"],25:["ru"],26:["hr",null,"sr"],27:["sk"],28:["sq"],29:["sv","sv-SE","sv-FI"],30:["th"],31:["tr"],32:["ur"],33:["id"],34:["uk"],35:["be"],36:["sl"],37:["et"],38:["lv"],39:["lt"],41:["fa"],42:["vi"],43:["hy"],44:["az"],45:["eu"],46:["hsb"],47:["mk"],48:["st"],49:["ts"],50:["tn"],52:["xh"],53:["zu"],54:["af"],55:["ka"],56:["fo"],57:["hi"],58:["mt"],59:["se"],62:["ms"],63:["kk"],65:["sw"],67:["uz",null,"uz-UZ"],68:["tt"],69:["bn"],70:["pa"],71:["gu"],72:["or"],73:["ta"],74:["te"],75:["kn"],76:["ml"],77:["as"],78:["mr"],79:["sa"],82:["cy","cy-GB"],83:["gl","gl-ES"],87:["kok"],97:["ne"],98:["fy"]},to=(C,w)=>{const t=new C.constructor(C.length+w.length);return t.set(C),t.set(w,C.length),t},zc=(C,w,t)=>{const h=new C.constructor(C.length+w.length+t.length);return h.set(C),h.set(w,C.length),h.set(t,C.length+w.length),h},Fg=new TextDecoder,hs=C=>Fg.decode(C),Xe=C=>{if(!C)return;const w=C.byteLength,t=w===4?"getUint32":w===2?"getUint16":"getUint8";return new DataView(C)[t](0)},pr=(C,w)=>Object.fromEntries(Array.from(Object.entries(C)).map(([t,[h,d,l]])=>[t,(l==="string"?hs:Xe)(w.slice(h,h+d))])),fa=C=>new TextDecoder(Bg[C]),Ms=(C,w=0)=>{let t=0,h=0;for(const d of C.subarray(w,w+4))if(t=t<<7|(d&127)>>>0,h++,d&128)break;return{value:t,length:h}},Dg=C=>{let w=0;for(const t of C.subarray(-4))t&128&&(w=0),w=w<<7|t&127;return w},$c=C=>{let w=0;for(;C>0;C=C>>1)(C&1)===1&&w++;return w},Lg=C=>{let w=0;for(;!(C&1);)C=C>>1,w++;return w},zg=C=>{let w=[];for(let t=0;t<C.length;t++){const h=C[t];if(h===0)w.push(0);else if(h<=8)for(const d of C.subarray(t+1,(t+=h)+1))w.push(d);else if(h<=127)w.push(h);else if(h<=191){const d=h<<8|C[t+++1],l=(d&16383)>>>3,i=(d&7)+3;for(let o=0;o<i;o++)w.push(w[w.length-l])}else w.push(32,h^128)}return Uint8Array.from(w)},$g=(C,w)=>{const t=w>>3,h=w+32,d=h>>3;let l=0n;for(let i=t;i<=d;i++)l=l<<8n|BigInt(C[i]??0);return l>>8n-BigInt(h&7)&0xffffffffn},Vg=async(C,w)=>{const t=await w(C.huffcdic),{magic:h,offset1:d,offset2:l}=pr(Ng,t);if(h!=="HUFF")throw new Error("Invalid HUFF record");const i=Array.from({length:256},(n,c)=>d+c*4).map(n=>Xe(t.slice(n,n+4))).map(n=>[n&128,n&31,n>>>8]),o=[null].concat(Array.from({length:32},(n,c)=>l+c*8).map(n=>[Xe(t.slice(n,n+4)),Xe(t.slice(n+4,n+8))])),r=[];for(let n=1;n<C.numHuffcdic;n++){const c=await w(C.huffcdic+n),a=pr(Og,c);if(a.magic!=="CDIC")throw new Error("Invalid CDIC record");const s=Math.min(1<<a.codeLength,a.numEntries-r.length),f=c.slice(a.length);for(let p=0;p<s;p++){const u=Xe(f.slice(p*2,p*2+2)),g=Xe(f.slice(u,u+2)),m=g&32767,v=g&32768,S=new Uint8Array(f.slice(u+2,u+2+m));r.push([S,v])}}const e=n=>{let c=new Uint8Array;const a=n.byteLength*8;for(let s=0;s<a;){const f=Number($g(n,s));let[p,u,g]=i[f>>>24];if(!p){for(;f>>>32-u<o[u][0];)u+=1;g=o[u][1]}if((s+=u)>a)break;const m=g-(f>>>32-u);let[v,S]=r[m];S||(v=e(v),r[m]=[v,!0]),c=to(c,v)}return c};return e},$s=async(C,w)=>{const t=await w(C),h=pr(fl,t);if(h.magic!=="INDX")throw new Error("Invalid INDX record");const d=fa(h.encoding),l=t.slice(h.length),i=pr(Rg,l);if(i.magic!=="TAGX")throw new Error("Invalid TAGX section");const o=(i.length-12)/4,r=Array.from({length:o},(a,s)=>new Uint8Array(l.slice(12+s*4,12+s*4+4))),e={};let n=0;for(let a=0;a<h.numCncx;a++){const s=await w(C+h.numRecords+a+1),f=new Uint8Array(s);for(let p=0;p<f.byteLength;){const u=p,{value:g,length:m}=Ms(f,p);p+=m;const v=s.slice(p,p+g);p+=g,e[n+u]=d.decode(v)}n+=65536}const c=[];for(let a=0;a<h.numRecords;a++){const s=await w(C+1+a),f=new Uint8Array(s),p=pr(fl,s);if(p.magic!=="INDX")throw new Error("Invalid INDX record");for(let u=0;u<p.numRecords;u++){const g=p.idxt+4+2*u,m=Xe(s.slice(g,g+2)),v=Xe(s.slice(m,m+1)),S=hs(s.slice(m+1,m+1+v)),R=[],I=m+1+v;let F=0,j=I+i.numControlBytes;for(const[$,V,z,E]of r){if(E&1){F++;continue}const A=I+F,k=Xe(s.slice(A,A+1))&z;if(k===z)if($c(z)>1){const{value:b,length:y}=Ms(f,j);R.push([$,null,b,V]),j+=y}else R.push([$,1,null,V]);else R.push([$,k>>Lg(z),null,V])}const L={};for(const[$,V,z,E]of R){const A=[];if(V!=null)for(let k=0;k<V*E;k++){const{value:b,length:y}=Ms(f,j);A.push(b),j+=y}else{let k=0;for(;k<z;){const{value:b,length:y}=Ms(f,j);A.push(b),j+=y,k+=y}}L[$]=A}c.push({name:S,tagMap:L})}}return{table:c,cncx:e}},Ug=async(C,w)=>{const{table:t,cncx:h}=await $s(C,w),d=t.map(({tagMap:i},o)=>{var r,e,n,c,a,s;return{index:o,offset:(r=i[1])==null?void 0:r[0],size:(e=i[2])==null?void 0:e[0],label:h[i[3]]??"",headingLevel:(n=i[4])==null?void 0:n[0],pos:i[6],parent:(c=i[21])==null?void 0:c[0],firstChild:(a=i[22])==null?void 0:a[0],lastChild:(s=i[23])==null?void 0:s[0]}}),l=i=>(i.firstChild==null||(i.children=d.filter(o=>o.parent===i.index).map(l)),i);return d.filter(i=>i.headingLevel===0).map(l)},Hg=(C,w)=>{const{magic:t,count:h}=pr(Ag,C);if(t!=="EXTH")throw new Error("Invalid EXTH header");const d=fa(w),l={};let i=12;for(let o=0;o<h;o++){const r=Xe(C.slice(i,i+4)),e=Xe(C.slice(i+4,i+8));if(r in hl){const[n,c,a]=hl[r],s=C.slice(i+8,i+e),f=c==="uint"?Xe(s):d.decode(s);a?(l[n]??(l[n]=[]),l[n].push(f)):l[n]=f}i+=e}return l},Wg=async(C,w)=>{const{flags:t,dataStart:h,keyLength:d,keyStart:l}=pr(Ig,C),i=new Uint8Array(C.slice(h));if(t&2){const r=d===16?1024:1040,e=new Uint8Array(C.slice(l,l+d)),n=Math.min(r,i.length);for(var o=0;o<n;o++)i[o]=i[o]^e[o%e.length]}if(t&1)try{return await w(i)}catch(r){console.warn(r),console.warn("Failed to decompress font")}return i},qg=async C=>hs(await C.slice(60,68).arrayBuffer())==="BOOKMOBI";var li,ci;class Xg{constructor(){mt(this,li);mt(this,ci);De(this,"pdb")}async open(w){gt(this,li,w);const t=pr(Eg,await w.slice(0,78).arrayBuffer());this.pdb=t;const h=await w.slice(78,78+t.numRecords*8).arrayBuffer();gt(this,ci,Array.from({length:t.numRecords},(d,l)=>Xe(h.slice(l*8,l*8+4))).map((d,l,i)=>[d,i[l+1]]))}loadRecord(w){const t=Z(this,ci)[w];if(!t)throw new RangeError("Record index out of bounds");return Z(this,li).slice(...t).arrayBuffer()}async loadMagic(w){const t=Z(this,ci)[w][0];return hs(await Z(this,li).slice(t,t+4).arrayBuffer())}}li=new WeakMap,ci=new WeakMap;var ui,qi,Xi,Zi,fi,Gi,Hn,Ho,Vc;class Zg extends Xg{constructor({unzlib:t}){super();mt(this,Hn);mt(this,ui,0);mt(this,qi);mt(this,Xi);mt(this,Zi);mt(this,fi);mt(this,Gi);this.unzlib=t}async open(t){var d;await super.open(t),this.headers=ht(this,Hn,Ho).call(this,await super.loadRecord(0)),gt(this,qi,this.headers.mobi.resourceStart);let h=this.headers.mobi.version>=8;if(!h){const l=(d=this.headers.exth)==null?void 0:d.boundary;if(l<4294967295)try{this.headers=ht(this,Hn,Ho).call(this,await super.loadRecord(l)),gt(this,ui,l),h=!0}catch(i){console.warn(i),console.warn("Failed to open KF8; falling back to MOBI")}}return await ht(this,Hn,Vc).call(this),h?new rb(this).init():new Yg(this).init()}decode(...t){return Z(this,Xi).decode(...t)}encode(...t){return Z(this,Zi).encode(...t)}loadRecord(t){return super.loadRecord(Z(this,ui)+t)}loadMagic(t){return super.loadMagic(Z(this,ui)+t)}loadText(t){return this.loadRecord(t+1).then(h=>new Uint8Array(h)).then(Z(this,Gi)).then(Z(this,fi))}async loadResource(t){const h=await super.loadRecord(Z(this,qi)+t),d=hs(h.slice(0,4));return d==="FONT"?Wg(h,this.unzlib):d==="VIDE"||d==="AUDI"?h.slice(12):h}getNCX(){const t=this.headers.mobi.indx;if(t<4294967295)return Ug(t,this.loadRecord.bind(this))}getMetadata(){var d,l;const{mobi:t,exth:h}=this.headers;return{identifier:t.uid.toString(),title:An((h==null?void 0:h.title)||this.decode(t.title)),author:(d=h==null?void 0:h.creator)==null?void 0:d.map(An),publisher:An(h==null?void 0:h.publisher),language:(h==null?void 0:h.language)??t.language,published:h==null?void 0:h.date,description:An(h==null?void 0:h.description),subject:(l=h==null?void 0:h.subject)==null?void 0:l.map(An),rights:An(h==null?void 0:h.rights),contributor:h==null?void 0:h.contributor}}async getCover(){const{exth:t}=this.headers,h=(t==null?void 0:t.coverOffset)<4294967295?t==null?void 0:t.coverOffset:(t==null?void 0:t.thumbnailOffset)<4294967295?t==null?void 0:t.thumbnailOffset:null;if(h!=null){const d=await this.loadResource(h);return new Blob([d])}}}ui=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,fi=new WeakMap,Gi=new WeakMap,Hn=new WeakSet,Ho=function(t){const h=pr(Cg,t),d=pr(Tg,t);if(d.magic!=="MOBI")throw new Error("Missing MOBI header");const{titleOffset:l,titleLength:i,localeLanguage:o,localeRegion:r}=d;d.title=t.slice(l,l+i);const e=Pg[o];d.language=(e==null?void 0:e[r>>2])??(e==null?void 0:e[0]);const n=d.exthFlag&64?Hg(t.slice(d.length+16),d.encoding):null,c=d.version>=8?pr(Mg,t):null;return{palmdoc:h,mobi:d,exth:n,kf8:c}},Vc=async function(){const{palmdoc:t,mobi:h}=this.headers;gt(this,Xi,fa(h.encoding)),gt(this,Zi,new TextEncoder);const{compression:d}=t;if(gt(this,fi,d===1?r=>r:d===2?zg:d===17480?await Vg(h,this.loadRecord.bind(this)):null),!Z(this,fi))throw new Error("Unknown compression type");const{trailingFlags:l}=h,i=l&1,o=$c(l>>>1);gt(this,Gi,r=>{for(let e=0;e<o;e++){const n=Dg(r);r=r.subarray(0,-n)}if(i){const e=(r[r.length-1]&3)+1;r=r.subarray(0,-e)}return r})};const dl=/<\s*(?:mbp:)?pagebreak[^>]*>/gi,Gg=/<[^<>]+filepos=['"]{0,1}(\d+)[^<>]*>/gi,Kg=C=>{let w=0;for(;C;){const t=C.parentElement;if(t){const h=t.tagName.toLowerCase();h==="p"?w+=1.5:h==="blockquote"&&(w+=2)}C=t}return w};var In,hi,Bn,cn,Ki,Yi;class Yg{constructor(w){De(this,"parser",new DOMParser);De(this,"serializer",new XMLSerializer);mt(this,In,new Map);mt(this,hi,new Map);mt(this,Bn,new Map);mt(this,cn);mt(this,Ki,[]);mt(this,Yi,Dr.HTML);this.mobi=w}async init(){var h;let w=new Uint8Array;for(let d=0;d<this.mobi.headers.palmdoc.numTextRecords;d++)w=to(w,await this.mobi.loadText(d));const t=Array.from(new Uint8Array(w),d=>String.fromCharCode(d)).join("");gt(this,cn,[0].concat(Array.from(t.matchAll(dl),d=>d.index)).map((d,l,i)=>t.slice(d,i[l+1])).map(d=>Uint8Array.from(d,l=>l.charCodeAt(0))).map(d=>({book:this,raw:d})).reduce((d,l)=>{const i=d[d.length-1];return l.start=(i==null?void 0:i.end)??0,l.end=l.start+l.raw.byteLength,d.concat(l)},[])),this.sections=Z(this,cn).map((d,l)=>({id:l,load:()=>this.loadSection(d),createDocument:()=>this.createDocument(d),size:d.end-d.start}));try{this.landmarks=await this.getGuide();const d=(h=this.landmarks.find(({type:l})=>l==null?void 0:l.includes("toc")))==null?void 0:h.href;if(d){const{index:l}=this.resolveHref(d),i=await this.sections[l].createDocument();let o,r=0,e=0;const n=new Map,c=new Map;this.toc=Array.from(i.querySelectorAll("a[filepos]")).reduce((a,s)=>{var g;const f=Kg(s),p={label:((g=s.innerText)==null?void 0:g.trim())??"",href:`filepos:${s.getAttribute("filepos")}`},u=f>e?r+1:f===e?r:n.get(f)??Math.max(0,r-1);if(u>r)o?(o.subitems??(o.subitems=[]),o.subitems.push(p),c.set(u,o)):a.push(p);else{const m=c.get(u);m?m.subitems.push(p):a.push(p)}return o=p,r=u,e=f,n.set(f,u),a},[])}}catch(d){console.warn(d)}return gt(this,Ki,[...new Set(Array.from(t.matchAll(Gg),d=>d[1]))].map(d=>({filepos:d,number:Number(d)})).sort((d,l)=>d.number-l.number)),this.metadata=this.mobi.getMetadata(),this.getCover=this.mobi.getCover.bind(this.mobi),this}async getGuide(){const w=await this.createDocument(Z(this,cn)[0]);return Array.from(w.getElementsByTagName("reference"),t=>{var h;return{label:t.getAttribute("title"),type:(h=t.getAttribute("type"))==null?void 0:h.split(/\s/),href:`filepos:${t.getAttribute("filepos")}`}})}async loadResource(w){if(Z(this,In).has(w))return Z(this,In).get(w);const t=await this.mobi.loadResource(w),h=URL.createObjectURL(new Blob([t]));return Z(this,In).set(w,h),h}async loadRecindex(w){return this.loadResource(Number(w)-1)}async replaceResources(w){for(const t of w.querySelectorAll("img[recindex]")){const h=t.getAttribute("recindex");try{t.src=await this.loadRecindex(h)}catch{console.warn(`Failed to load image ${h}`)}}for(const t of w.querySelectorAll("[mediarecindex]")){const h=t.getAttribute("mediarecindex"),d=t.getAttribute("recindex");try{t.src=await this.loadRecindex(h),d&&(t.poster=await this.loadRecindex(d))}catch{console.warn(`Failed to load media ${h}`)}}for(const t of w.querySelectorAll("[filepos]")){const h=t.getAttribute("filepos");t.href=`filepos:${h}`}}async loadText(w){if(Z(this,hi).has(w))return Z(this,hi).get(w);const{raw:t}=w,h=Z(this,Ki).filter(({number:i})=>i>=w.start&&i<w.end).map(i=>({...i,offset:i.number-w.start}));let d=t;h.length&&(d=t.subarray(0,h[0].offset),h.forEach(({filepos:i,offset:o},r)=>{const e=h[r+1],n=this.mobi.encode(`<a id="filepos${i}"></a>`);d=zc(d,n,t.subarray(o,e==null?void 0:e.offset))}));const l=this.mobi.decode(d).replaceAll(dl,"");return Z(this,hi).set(w,l),l}async createDocument(w){const t=await this.loadText(w);return this.parser.parseFromString(t,Z(this,Yi))}async loadSection(w){if(Z(this,Bn).has(w))return Z(this,Bn).get(w);const t=await this.createDocument(w),h=t.createElement("style");t.head.append(h),h.append(t.createTextNode(`blockquote {
170
170
  margin-block-start: 0;
171
171
  margin-block-end: 0;
172
172
  margin-inline-start: 1em;
173
173
  margin-inline-end: 0;
174
- }`)),await this.replaceResources(t);const d=this.serializer.serializeToString(t),l=URL.createObjectURL(new Blob([d],{type:Z(this,Yi)}));return Z(this,Bn).set(w,l),l}resolveHref(w){const t=w.match(/filepos:(.*)/)[1],h=Number(t);return{index:Z(this,cn).findIndex(i=>i.end>h),anchor:i=>i.getElementById(`filepos${t}`)}}splitTOCHref(w){const t=w.match(/filepos:(.*)/)[1],h=Number(t);return[Z(this,cn).findIndex(l=>l.end>h),`filepos${t}`]}getTOCFragment(w,t){return w.getElementById(t)}isExternal(w){return/^(?!blob|filepos)\w+:/i.test(w)}destroy(){for(const w of Z(this,In).values())URL.revokeObjectURL(w);for(const w of Z(this,Bn).values())URL.revokeObjectURL(w)}}In=new WeakMap,hi=new WeakMap,Bn=new WeakMap,cn=new WeakMap,Ki=new WeakMap,Yi=new WeakMap;const Vc=/kindle:(flow|embed):(\w+)(?:\?mime=(\w+\/[-+.\w]+))?/,sb=/kindle:pos:fid:(\w+):off:(\w+)/,ob=C=>{const[w,t,h]=C.match(Vc).slice(1);return{resourceType:w,id:parseInt(t,32),type:h}},pl=C=>{const[w,t]=C.match(sb).slice(1);return{fid:parseInt(w,32),off:parseInt(t,32)}},ml=(C=0,w=0)=>`kindle:pos:fid:${C.toString(32).toUpperCase().padStart(4,"0")}:off:${w.toString(32).toUpperCase().padStart(10,"0")}`,gl=C=>{const w=C.match(/\s(id|name|aid)\s*=\s*['"]([^'"]*)['"]/i);if(!w)return;const[,t,h]=w;return`[${t}="${CSS.escape(h)}"]`},ab=async(C,w,t)=>{const h=[];C.replace(w,(...l)=>(h.push(l),null));const d=[];for(const l of h)d.push(await t(...l));return C.replace(w,()=>d.shift())},lb=C=>{for(const w of C){if(w==="page-spread-left"||w==="rendition:page-spread-left")return"left";if(w==="page-spread-right"||w==="rendition:page-spread-right")return"right";if(w==="rendition:page-spread-center")return"center"}};var Ar,di,Pn,Fn,Dn,un,fn,Ur,so,oo,hn,Ji,Qi,Wo;class cb{constructor(w){mt(this,Qi);De(this,"parser",new DOMParser);De(this,"serializer",new XMLSerializer);mt(this,Ar,new Map);mt(this,di,new Map);mt(this,Pn,new Map);mt(this,Fn,{});mt(this,Dn);mt(this,un);mt(this,fn,new Uint8Array);mt(this,Ur,new Uint8Array);mt(this,so,-1);mt(this,oo,-1);mt(this,hn,Dr.XHTML);mt(this,Ji,new Map);this.mobi=w}async init(){var e,n,c,a;const w=this.mobi.loadRecord.bind(this.mobi),{kf8:t}=this.mobi.headers;try{const s=await w(t.fdst),f=pr(zg,s);if(f.magic!=="FDST")throw new Error("Missing FDST record");const p=Array.from({length:f.numEntries},(u,g)=>12+g*8).map(u=>[Xe(s.slice(u,u+4)),Xe(s.slice(u+4,u+8))]);Z(this,Fn).fdstTable=p,gt(this,un,p[p.length-1][1])}catch{}const h=(await $s(t.skel,w)).table.map(({name:s,tagMap:f},p)=>({index:p,name:s,numFrag:f[1][0],offset:f[6][0],length:f[6][1]})),d=await $s(t.frag,w),l=d.table.map(({name:s,tagMap:f})=>({insertOffset:parseInt(s),selector:d.cncx[f[2][0]],index:f[4][0],offset:f[6][0],length:f[6][1]}));Z(this,Fn).skelTable=h,Z(this,Fn).fragTable=l,gt(this,Dn,h.reduce((s,f)=>{const p=s[s.length-1],u=(p==null?void 0:p.fragEnd)??0,g=u+f.numFrag,m=l.slice(u,g),v=f.length+m.map(R=>R.length).reduce((R,I)=>R+I),S=((p==null?void 0:p.totalLength)??0)+v;return s.concat({skel:f,frags:m,fragEnd:g,length:v,totalLength:S})},[]));const i=await this.getResourcesByMagic(["RESC","PAGE"]),o=new Map;if(i.RESC){const s=await this.mobi.loadRecord(i.RESC),f=this.mobi.decode(s.slice(16)).replace(/\0/g,""),p=f.search(/\?>/),u=`<package>${f.slice(p)}</package>`,g=this.parser.parseFromString(u,Dr.XML);for(const m of g.querySelectorAll("spine > itemref")){const v=parseInt(m.getAttribute("skelid"));o.set(v,lb(((e=m.getAttribute("properties"))==null?void 0:e.split(" "))??[]))}}this.sections=Z(this,Dn).map((s,f)=>s.frags.length?{id:f,load:()=>this.loadSection(s),createDocument:()=>this.createDocument(s),size:s.length,pageSpread:o.get(f)}:{linear:"no"});try{const s=await this.mobi.getNCX(),f=({label:p,pos:u,children:g})=>{const[m,v]=u,S=ml(m,v),R=Z(this,di).get(m);return R?R.push(v):Z(this,di).set(m,[v]),{label:An(p),href:S,subitems:g==null?void 0:g.map(f)}};this.toc=s==null?void 0:s.map(f),this.landmarks=await this.getGuide()}catch(s){console.warn(s)}const{exth:r}=this.mobi.headers;return this.dir=r.pageProgressionDirection,this.rendition={layout:r.fixedLayout==="true"?"pre-paginated":"reflowable",viewport:Object.fromEntries(((a=(c=(n=r.originalResolution)==null?void 0:n.split("x"))==null?void 0:c.slice(0,2))==null?void 0:a.map((s,f)=>[f?"height":"width",s]))??[])},this.metadata=this.mobi.getMetadata(),this.getCover=this.mobi.getCover.bind(this.mobi),this}async getResourcesByMagic(w){const t={},h=this.mobi.headers.kf8.resourceStart,d=this.mobi.pdb.numRecords;for(let l=h;l<d;l++)try{const i=await this.mobi.loadMagic(l),o=w.find(r=>r===i);o&&(t[o]=l)}catch{}return t}async getGuide(){const w=this.mobi.headers.kf8.guide;if(w<4294967295){const t=this.mobi.loadRecord.bind(this.mobi),{table:h,cncx:d}=await $s(w,t);return h.map(({name:l,tagMap:i})=>{var o,r;return{label:d[i[1][0]]??"",type:l==null?void 0:l.split(/\s/),href:ml(((o=i[6])==null?void 0:o[0])??((r=i[3])==null?void 0:r[0]))}})}}async loadResourceBlob(w){var r;const{resourceType:t,id:h,type:d}=ob(w),l=t==="flow"?await this.loadFlow(h):await this.mobi.loadResource(h-1),i=[Dr.XHTML,Dr.HTML,Dr.CSS,Dr.SVG].includes(d)?await this.replaceResources(this.mobi.decode(l)):l,o=d===Dr.SVG?this.parser.parseFromString(i,d):null;return[new Blob([i],{type:d}),(r=o==null?void 0:o.getElementsByTagNameNS("http://www.w3.org/2000/svg","image"))!=null&&r.length?o.documentElement:null]}async loadResource(w){if(Z(this,Ar).has(w))return Z(this,Ar).get(w);const[t,h]=await this.loadResourceBlob(w),d=h?w:URL.createObjectURL(t);return h&&Z(this,Ji).set(d,h),Z(this,Ar).set(w,d),d}replaceResources(w){const t=new RegExp(Vc,"g");return ab(w,t,this.loadResource.bind(this))}async loadRaw(w,t){const h=t-Z(this,fn).length,d=Z(this,un)==null?1/0:Z(this,un)-Z(this,Ur).length-w;if(h<0||h<d){for(;Z(this,fn).length<t;){const i=++Ei(this,so)._,o=await this.mobi.loadText(i);gt(this,fn,to(Z(this,fn),o))}return Z(this,fn).slice(w,t)}for(;Z(this,un)-Z(this,Ur).length>w;){const i=this.mobi.headers.palmdoc.numTextRecords-1-++Ei(this,oo)._,o=await this.mobi.loadText(i);gt(this,Ur,to(o,Z(this,Ur)))}const l=Z(this,un)-Z(this,Ur).length;return Z(this,Ur).slice(w-l,t-l)}loadFlow(w){if(w<4294967295)return this.loadRaw(...Z(this,Fn).fdstTable[w])}async loadText(w){const{skel:t,frags:h,length:d}=w,l=await this.loadRaw(t.offset,t.offset+d);let i=l.slice(0,t.length);for(const o of h){const r=o.insertOffset-t.offset,e=t.length+o.offset,n=l.slice(e,e+o.length);i=Lc(i.slice(0,r),n,i.slice(r));const c=Z(this,di).get(o.index);if(c)for(const a of c){const s=this.mobi.decode(n).slice(a),f=gl(s);ht(this,Qi,Wo).call(this,o.index,a,f)}}return this.mobi.decode(i)}async createDocument(w){const t=await this.loadText(w);return this.parser.parseFromString(t,Z(this,hn))}async loadSection(w){var i;if(Z(this,Ar).has(w))return Z(this,Ar).get(w);const t=await this.loadText(w),h=await this.replaceResources(t);let d=this.parser.parseFromString(h,Z(this,hn));(d.querySelector("parsererror")||!((i=d.documentElement)!=null&&i.namespaceURI))&&(gt(this,hn,Dr.HTML),d=this.parser.parseFromString(h,Z(this,hn)));for(const[o,r]of Z(this,Ji))for(const e of d.querySelectorAll(`img[src="${o}"]`))e.replaceWith(r);const l=URL.createObjectURL(new Blob([this.serializer.serializeToString(d)],{type:Z(this,hn)}));return Z(this,Ar).set(w,l),l}getIndexByFID(w){return Z(this,Dn).findIndex(t=>t.frags.some(h=>h.index===w))}async resolveHref(w){var f;const{fid:t,off:h}=pl(w),d=this.getIndexByFID(t);if(d<0)return;const l=(f=Z(this,Pn).get(t))==null?void 0:f.get(h);if(l)return{index:d,anchor:p=>p.querySelector(l)};const{skel:i,frags:o}=Z(this,Dn)[d],r=o.find(p=>p.index===t),e=i.offset+i.length+r.offset,n=await this.loadRaw(e,e+r.length),c=this.mobi.decode(n).slice(h),a=gl(c);return ht(this,Qi,Wo).call(this,t,h,a),{index:d,anchor:p=>p.querySelector(a)}}splitTOCHref(w){const t=pl(w);return[this.getIndexByFID(t.fid),t]}getTOCFragment(w,{fid:t,off:h}){var l;const d=(l=Z(this,Pn).get(t))==null?void 0:l.get(h);return w.querySelector(d)}isExternal(w){return/^(?!blob|kindle)\w+:/i.test(w)}destroy(){for(const w of Z(this,Ar).values())URL.revokeObjectURL(w)}}Ar=new WeakMap,di=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,un=new WeakMap,fn=new WeakMap,Ur=new WeakMap,so=new WeakMap,oo=new WeakMap,hn=new WeakMap,Ji=new WeakMap,Qi=new WeakSet,Wo=function(w,t,h){const d=Z(this,Pn).get(w);if(d)d.set(t,h);else{const l=new Map;Z(this,Pn).set(w,l),l.set(t,h)}};const ub=Object.freeze(Object.defineProperty({__proto__:null,MOBI:eb,isMOBI:Qg},Symbol.toStringTag,{value:"Module"}));var hr=Uint8Array,ji=Uint16Array,fb=Int32Array,Uc=new hr([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]),Hc=new hr([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]),hb=new hr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wc=function(C,w){for(var t=new ji(31),h=0;h<31;++h)t[h]=w+=1<<C[h-1];var d=new fb(t[30]);for(h=1;h<30;++h)for(var l=t[h];l<t[h+1];++l)d[l]=l-t[h]<<5|h;return{b:t,r:d}},qc=Wc(Uc,2),Xc=qc.b,db=qc.r;Xc[28]=258,db[258]=28;for(var pb=Wc(Hc,0).b,Zc=new ji(32768),xe=0;xe<32768;++xe){var En=(43690&xe)>>1|(21845&xe)<<1;En=(61680&(En=(52428&En)>>2|(13107&En)<<2))>>4|(3855&En)<<4,Zc[xe]=((65280&En)>>8|(255&En)<<8)>>1}var Ii=function(C,w,t){for(var h=C.length,d=0,l=new ji(w);d<h;++d)C[d]&&++l[C[d]-1];var i,o=new ji(w);for(d=1;d<w;++d)o[d]=o[d-1]+l[d-1]<<1;{i=new ji(1<<w);var r=15-w;for(d=0;d<h;++d)if(C[d])for(var e=d<<4|C[d],n=w-C[d],c=o[C[d]-1]++<<n,a=c|(1<<n)-1;c<=a;++c)i[Zc[c]>>r]=e}return i},ds=new hr(288);for(xe=0;xe<144;++xe)ds[xe]=8;for(xe=144;xe<256;++xe)ds[xe]=9;for(xe=256;xe<280;++xe)ds[xe]=7;for(xe=280;xe<288;++xe)ds[xe]=8;var Gc=new hr(32);for(xe=0;xe<32;++xe)Gc[xe]=5;var mb=Ii(ds,9),gb=Ii(Gc,5),Co=function(C){for(var w=C[0],t=1;t<C.length;++t)C[t]>w&&(w=C[t]);return w},gr=function(C,w,t){var h=w/8|0;return(C[h]|C[h+1]<<8)>>(7&w)&t},To=function(C,w){var t=w/8|0;return(C[t]|C[t+1]<<8|C[t+2]<<16)>>(7&w)},bb=["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"],br=function(C,w,t){var h=new Error(w||bb[C]);if(h.code=C,Error.captureStackTrace&&Error.captureStackTrace(h,br),!t)throw h;return h},vb=function(C,w,t,h){var d=C.length,l=h?h.length:0;if(!d||w.f&&!w.l)return t||new hr(0);var i=!t,o=i||w.i!=2,r=w.i;i&&(t=new hr(3*d));var e=function(q){var Y=t.length;if(q>Y){var G=new hr(Math.max(2*Y,q));G.set(t),t=G}},n=w.f||0,c=w.p||0,a=w.b||0,s=w.l,f=w.d,p=w.m,u=w.n,g=8*d;do{if(!s){n=gr(C,c,1);var m=gr(C,c+1,3);if(c+=3,!m){var v=C[(A=4+((c+7)/8|0))-4]|C[A-3]<<8,S=A+v;if(S>d){r&&br(0);break}o&&e(a+v),t.set(C.subarray(A,S),a),w.b=a+=v,w.p=c=8*S,w.f=n;continue}if(m==1)s=mb,f=gb,p=9,u=5;else if(m==2){var R=gr(C,c,31)+257,I=gr(C,c+10,15)+4,F=R+gr(C,c+5,31)+1;c+=14;for(var j=new hr(F),L=new hr(19),$=0;$<I;++$)L[hb[$]]=gr(C,c+3*$,7);c+=3*I;var V=Co(L),z=(1<<V)-1,E=Ii(L,V);for($=0;$<F;){var A,k=E[gr(C,c,z)];if(c+=15&k,(A=k>>4)<16)j[$++]=A;else{var b=0,y=0;for(A==16?(y=3+gr(C,c,3),c+=2,b=j[$-1]):A==17?(y=3+gr(C,c,7),c+=3):A==18&&(y=11+gr(C,c,127),c+=7);y--;)j[$++]=b}}var _=j.subarray(0,R),x=j.subarray(R);p=Co(_),u=Co(x),s=Ii(_,p),f=Ii(x,u)}else br(1);if(c>g){r&&br(0);break}}o&&e(a+131072);for(var M=(1<<p)-1,B=(1<<u)-1,P=c;;P=c){var H=(b=s[To(C,c)&M])>>4;if((c+=15&b)>g){r&&br(0);break}if(b||br(2),H<256)t[a++]=H;else{if(H==256){P=c,s=null;break}var W=H-254;if(H>264){var K=Uc[$=H-257];W=gr(C,c,(1<<K)-1)+Xc[$],c+=K}var D=f[To(C,c)&B],X=D>>4;if(D||br(3),c+=15&D,x=pb[X],X>3&&(K=Hc[X],x+=To(C,c)&(1<<K)-1,c+=K),c>g){r&&br(0);break}o&&e(a+131072);var O=a+W;if(a<x){var N=l-x,U=Math.min(x,O);for(N+a<0&&br(3);a<U;++a)t[a]=h[N+a]}for(;a<O;++a)t[a]=t[a-x]}}w.l=s,w.p=P,w.b=a,w.f=n,s&&(n=1,w.m=p,w.d=f,w.n=u)}while(!n);return a!=t.length&&i?function(q,Y,G){return(G==null||G>q.length)&&(G=q.length),new hr(q.subarray(Y,G))}(t,0,a):t.subarray(0,a)},yb=new hr(0);function wb(C,w){return vb(C.subarray((t=C,h=w&&w.dictionary,((15&t[0])!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&br(6,"invalid zlib data"),(t[1]>>5&1)==+!h&&br(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)),-4),{i:2},w&&w.out,w&&w.dictionary);var t,h}var _b=typeof TextDecoder<"u"&&new TextDecoder;try{_b.decode(yb,{stream:!0})}catch{}const xb=Object.freeze(Object.defineProperty({__proto__:null,unzlibSync:wb},Symbol.toStringTag,{value:"Module"}));(function(){if(typeof document>"u"||"adoptedStyleSheets"in document)return;var C="ShadyCSS"in window&&!ShadyCSS.nativeShadow,w=document.implementation.createHTMLDocument(""),t=new WeakMap,h=typeof DOMException=="object"?Error:DOMException,d=Object.defineProperty,l=Array.prototype.forEach,i=/@import.+?;?$/gm;function o(O){var N=O.replace(i,"");return N!==O&&console.warn("@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418"),N.trim()}function r(O){return"isConnected"in O?O.isConnected:document.contains(O)}function e(O){return O.filter(function(N,U){return O.indexOf(N)===U})}function n(O,N){return O.filter(function(U){return N.indexOf(U)===-1})}function c(O){O.parentNode.removeChild(O)}function a(O){return O.shadowRoot||t.get(O)}var s=["addRule","deleteRule","insertRule","removeRule"],f=CSSStyleSheet,p=f.prototype;p.replace=function(){return Promise.reject(new h("Can't call replace on non-constructed CSSStyleSheets."))},p.replaceSync=function(){throw new h("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.")};function u(O){return typeof O=="object"?z.isPrototypeOf(O)||p.isPrototypeOf(O):!1}function g(O){return typeof O=="object"?p.isPrototypeOf(O):!1}var m=new WeakMap,v=new WeakMap,S=new WeakMap,R=new WeakMap;function I(O,N){var U=document.createElement("style");return S.get(O).set(N,U),v.get(O).push(N),U}function F(O,N){return S.get(O).get(N)}function j(O,N){S.get(O).delete(N),v.set(O,v.get(O).filter(function(U){return U!==N}))}function L(O,N){requestAnimationFrame(function(){N.textContent=m.get(O).textContent,R.get(O).forEach(function(U){return N.sheet[U.method].apply(N.sheet,U.args)})})}function $(O){if(!m.has(O))throw new TypeError("Illegal invocation")}function V(){var O=this,N=document.createElement("style");w.body.appendChild(N),m.set(O,N),v.set(O,[]),S.set(O,new WeakMap),R.set(O,[])}var z=V.prototype;z.replace=function(N){try{return this.replaceSync(N),Promise.resolve(this)}catch(U){return Promise.reject(U)}},z.replaceSync=function(N){if($(this),typeof N=="string"){var U=this;m.get(U).textContent=o(N),R.set(U,[]),v.get(U).forEach(function(q){q.isConnected()&&L(U,F(U,q))})}},d(z,"cssRules",{configurable:!0,enumerable:!0,get:function(){return $(this),m.get(this).sheet.cssRules}}),d(z,"media",{configurable:!0,enumerable:!0,get:function(){return $(this),m.get(this).sheet.media}}),s.forEach(function(O){z[O]=function(){var N=this;$(N);var U=arguments;R.get(N).push({method:O,args:U}),v.get(N).forEach(function(Y){if(Y.isConnected()){var G=F(N,Y).sheet;G[O].apply(G,U)}});var q=m.get(N).sheet;return q[O].apply(q,U)}}),d(V,Symbol.hasInstance,{configurable:!0,value:u});var E={childList:!0,subtree:!0},A=new WeakMap;function k(O){var N=A.get(O);return N||(N=new W(O),A.set(O,N)),N}function b(O){d(O.prototype,"adoptedStyleSheets",{configurable:!0,enumerable:!0,get:function(){return k(this).sheets},set:function(N){k(this).update(N)}})}function y(O,N){for(var U=document.createNodeIterator(O,NodeFilter.SHOW_ELEMENT,function(Y){return a(Y)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},null,!1),q=void 0;q=U.nextNode();)N(a(q))}var _=new WeakMap,x=new WeakMap,M=new WeakMap;function B(O,N){return N instanceof HTMLStyleElement&&x.get(O).some(function(U){return F(U,O)})}function P(O){var N=_.get(O);return N instanceof Document?N.body:N}function H(O){var N=document.createDocumentFragment(),U=x.get(O),q=M.get(O),Y=P(O);q.disconnect(),U.forEach(function(G){N.appendChild(F(G,O)||I(G,O))}),Y.insertBefore(N,null),q.observe(Y,E),U.forEach(function(G){L(G,F(G,O))})}function W(O){var N=this;N.sheets=[],_.set(N,O),x.set(N,[]),M.set(N,new MutationObserver(function(U,q){if(!document){q.disconnect();return}U.forEach(function(Y){C||l.call(Y.addedNodes,function(G){G instanceof Element&&y(G,function(Q){k(Q).connect()})}),l.call(Y.removedNodes,function(G){G instanceof Element&&(B(N,G)&&H(N),C||y(G,function(Q){k(Q).disconnect()}))})})}))}if(W.prototype={isConnected:function(){var O=_.get(this);return O instanceof Document?O.readyState!=="loading":r(O.host)},connect:function(){var O=P(this);M.get(this).observe(O,E),x.get(this).length>0&&H(this),y(O,function(N){k(N).connect()})},disconnect:function(){M.get(this).disconnect()},update:function(O){var N=this,U=_.get(N)===document?"Document":"ShadowRoot";if(!Array.isArray(O))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+U+": Iterator getter is not callable.");if(!O.every(u))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+U+": Failed to convert value to 'CSSStyleSheet'");if(O.some(g))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+U+": Can't adopt non-constructed stylesheets");N.sheets=O;var q=x.get(N),Y=e(O),G=n(q,Y);G.forEach(function(Q){c(F(Q,N)),j(Q,N)}),x.set(N,Y),N.isConnected()&&Y.length>0&&H(N)}},window.CSSStyleSheet=V,b(Document),"ShadowRoot"in window){b(ShadowRoot);var K=Element.prototype,D=K.attachShadow;K.attachShadow=function(N){var U=D.call(this,N);return N.mode==="closed"&&t.set(this,U),U}}var X=k(document);X.isConnected()?X.connect():document.addEventListener("DOMContentLoaded",X.connect.bind(X))})();const bl=C=>{var w,t;return(t=(w=C==null?void 0:C.split(/[,;\s]/))==null?void 0:w.filter(h=>h))==null?void 0:t.map(h=>h.split("=").map(d=>d.trim()))},kb=(C,w)=>{var d,l;if(C.documentElement.localName==="svg"){const[,,i,o]=((d=C.documentElement.getAttribute("viewBox"))==null?void 0:d.split(/\s/))??[];return{width:i,height:o}}const t=bl((l=C.querySelector('meta[name="viewport"]'))==null?void 0:l.getAttribute("content"));if(t)return Object.fromEntries(t);if(typeof w=="string")return bl(w);if(w)return w;const h=C.querySelector("img");return h?{width:h.naturalWidth,height:h.naturalHeight}:(console.warn(new Error("Missing viewport properties")),{width:1e3,height:2e3})};var Ln,ts,Hr,dn,pi,wr,_r,cr,pn,mn,ke,Vs,Kn,qo,Xo,Zo,Us;class ha extends HTMLElement{constructor(){super();mt(this,ke);mt(this,Ln,this.attachShadow({mode:"closed"}));mt(this,ts,new ResizeObserver(()=>ht(this,ke,Kn).call(this)));mt(this,Hr);mt(this,dn,-1);De(this,"defaultViewport");De(this,"spread");mt(this,pi,!1);mt(this,wr);mt(this,_r);mt(this,cr);mt(this,pn);mt(this,mn);const t=new CSSStyleSheet;Z(this,Ln).adoptedStyleSheets=[t],t.replaceSync(`:host {
174
+ }`)),await this.replaceResources(t);const d=this.serializer.serializeToString(t),l=URL.createObjectURL(new Blob([d],{type:Z(this,Yi)}));return Z(this,Bn).set(w,l),l}resolveHref(w){const t=w.match(/filepos:(.*)/)[1],h=Number(t);return{index:Z(this,cn).findIndex(i=>i.end>h),anchor:i=>i.getElementById(`filepos${t}`)}}splitTOCHref(w){const t=w.match(/filepos:(.*)/)[1],h=Number(t);return[Z(this,cn).findIndex(l=>l.end>h),`filepos${t}`]}getTOCFragment(w,t){return w.getElementById(t)}isExternal(w){return/^(?!blob|filepos)\w+:/i.test(w)}destroy(){for(const w of Z(this,In).values())URL.revokeObjectURL(w);for(const w of Z(this,Bn).values())URL.revokeObjectURL(w)}}In=new WeakMap,hi=new WeakMap,Bn=new WeakMap,cn=new WeakMap,Ki=new WeakMap,Yi=new WeakMap;const Uc=/kindle:(flow|embed):(\w+)(?:\?mime=(\w+\/[-+.\w]+))?/,Jg=/kindle:pos:fid:(\w+):off:(\w+)/,Qg=C=>{const[w,t,h]=C.match(Uc).slice(1);return{resourceType:w,id:parseInt(t,32),type:h}},pl=C=>{const[w,t]=C.match(Jg).slice(1);return{fid:parseInt(w,32),off:parseInt(t,32)}},ml=(C=0,w=0)=>`kindle:pos:fid:${C.toString(32).toUpperCase().padStart(4,"0")}:off:${w.toString(32).toUpperCase().padStart(10,"0")}`,gl=C=>{const w=C.match(/\s(id|name|aid)\s*=\s*['"]([^'"]*)['"]/i);if(!w)return;const[,t,h]=w;return`[${t}="${CSS.escape(h)}"]`},tb=async(C,w,t)=>{const h=[];C.replace(w,(...l)=>(h.push(l),null));const d=[];for(const l of h)d.push(await t(...l));return C.replace(w,()=>d.shift())},eb=C=>{for(const w of C){if(w==="page-spread-left"||w==="rendition:page-spread-left")return"left";if(w==="page-spread-right"||w==="rendition:page-spread-right")return"right";if(w==="rendition:page-spread-center")return"center"}};var Mr,di,Pn,Fn,Dn,un,fn,Ur,so,oo,hn,Ji,Qi,Wo;class rb{constructor(w){mt(this,Qi);De(this,"parser",new DOMParser);De(this,"serializer",new XMLSerializer);mt(this,Mr,new Map);mt(this,di,new Map);mt(this,Pn,new Map);mt(this,Fn,{});mt(this,Dn);mt(this,un);mt(this,fn,new Uint8Array);mt(this,Ur,new Uint8Array);mt(this,so,-1);mt(this,oo,-1);mt(this,hn,Dr.XHTML);mt(this,Ji,new Map);this.mobi=w}async init(){var e,n,c,a;const w=this.mobi.loadRecord.bind(this.mobi),{kf8:t}=this.mobi.headers;try{const s=await w(t.fdst),f=pr(jg,s);if(f.magic!=="FDST")throw new Error("Missing FDST record");const p=Array.from({length:f.numEntries},(u,g)=>12+g*8).map(u=>[Xe(s.slice(u,u+4)),Xe(s.slice(u+4,u+8))]);Z(this,Fn).fdstTable=p,gt(this,un,p[p.length-1][1])}catch{}const h=(await $s(t.skel,w)).table.map(({name:s,tagMap:f},p)=>({index:p,name:s,numFrag:f[1][0],offset:f[6][0],length:f[6][1]})),d=await $s(t.frag,w),l=d.table.map(({name:s,tagMap:f})=>({insertOffset:parseInt(s),selector:d.cncx[f[2][0]],index:f[4][0],offset:f[6][0],length:f[6][1]}));Z(this,Fn).skelTable=h,Z(this,Fn).fragTable=l,gt(this,Dn,h.reduce((s,f)=>{const p=s[s.length-1],u=(p==null?void 0:p.fragEnd)??0,g=u+f.numFrag,m=l.slice(u,g),v=f.length+m.map(R=>R.length).reduce((R,I)=>R+I),S=((p==null?void 0:p.totalLength)??0)+v;return s.concat({skel:f,frags:m,fragEnd:g,length:v,totalLength:S})},[]));const i=await this.getResourcesByMagic(["RESC","PAGE"]),o=new Map;if(i.RESC){const s=await this.mobi.loadRecord(i.RESC),f=this.mobi.decode(s.slice(16)).replace(/\0/g,""),p=f.search(/\?>/),u=`<package>${f.slice(p)}</package>`,g=this.parser.parseFromString(u,Dr.XML);for(const m of g.querySelectorAll("spine > itemref")){const v=parseInt(m.getAttribute("skelid"));o.set(v,eb(((e=m.getAttribute("properties"))==null?void 0:e.split(" "))??[]))}}this.sections=Z(this,Dn).map((s,f)=>s.frags.length?{id:f,load:()=>this.loadSection(s),createDocument:()=>this.createDocument(s),size:s.length,pageSpread:o.get(f)}:{linear:"no"});try{const s=await this.mobi.getNCX(),f=({label:p,pos:u,children:g})=>{const[m,v]=u,S=ml(m,v),R=Z(this,di).get(m);return R?R.push(v):Z(this,di).set(m,[v]),{label:An(p),href:S,subitems:g==null?void 0:g.map(f)}};this.toc=s==null?void 0:s.map(f),this.landmarks=await this.getGuide()}catch(s){console.warn(s)}const{exth:r}=this.mobi.headers;return this.dir=r.pageProgressionDirection,this.rendition={layout:r.fixedLayout==="true"?"pre-paginated":"reflowable",viewport:Object.fromEntries(((a=(c=(n=r.originalResolution)==null?void 0:n.split("x"))==null?void 0:c.slice(0,2))==null?void 0:a.map((s,f)=>[f?"height":"width",s]))??[])},this.metadata=this.mobi.getMetadata(),this.getCover=this.mobi.getCover.bind(this.mobi),this}async getResourcesByMagic(w){const t={},h=this.mobi.headers.kf8.resourceStart,d=this.mobi.pdb.numRecords;for(let l=h;l<d;l++)try{const i=await this.mobi.loadMagic(l),o=w.find(r=>r===i);o&&(t[o]=l)}catch{}return t}async getGuide(){const w=this.mobi.headers.kf8.guide;if(w<4294967295){const t=this.mobi.loadRecord.bind(this.mobi),{table:h,cncx:d}=await $s(w,t);return h.map(({name:l,tagMap:i})=>{var o,r;return{label:d[i[1][0]]??"",type:l==null?void 0:l.split(/\s/),href:ml(((o=i[6])==null?void 0:o[0])??((r=i[3])==null?void 0:r[0]))}})}}async loadResourceBlob(w){var r;const{resourceType:t,id:h,type:d}=Qg(w),l=t==="flow"?await this.loadFlow(h):await this.mobi.loadResource(h-1),i=[Dr.XHTML,Dr.HTML,Dr.CSS,Dr.SVG].includes(d)?await this.replaceResources(this.mobi.decode(l)):l,o=d===Dr.SVG?this.parser.parseFromString(i,d):null;return[new Blob([i],{type:d}),(r=o==null?void 0:o.getElementsByTagNameNS("http://www.w3.org/2000/svg","image"))!=null&&r.length?o.documentElement:null]}async loadResource(w){if(Z(this,Mr).has(w))return Z(this,Mr).get(w);const[t,h]=await this.loadResourceBlob(w),d=h?w:URL.createObjectURL(t);return h&&Z(this,Ji).set(d,h),Z(this,Mr).set(w,d),d}replaceResources(w){const t=new RegExp(Uc,"g");return tb(w,t,this.loadResource.bind(this))}async loadRaw(w,t){const h=t-Z(this,fn).length,d=Z(this,un)==null?1/0:Z(this,un)-Z(this,Ur).length-w;if(h<0||h<d){for(;Z(this,fn).length<t;){const i=++Ei(this,so)._,o=await this.mobi.loadText(i);gt(this,fn,to(Z(this,fn),o))}return Z(this,fn).slice(w,t)}for(;Z(this,un)-Z(this,Ur).length>w;){const i=this.mobi.headers.palmdoc.numTextRecords-1-++Ei(this,oo)._,o=await this.mobi.loadText(i);gt(this,Ur,to(o,Z(this,Ur)))}const l=Z(this,un)-Z(this,Ur).length;return Z(this,Ur).slice(w-l,t-l)}loadFlow(w){if(w<4294967295)return this.loadRaw(...Z(this,Fn).fdstTable[w])}async loadText(w){const{skel:t,frags:h,length:d}=w,l=await this.loadRaw(t.offset,t.offset+d);let i=l.slice(0,t.length);for(const o of h){const r=o.insertOffset-t.offset,e=t.length+o.offset,n=l.slice(e,e+o.length);i=zc(i.slice(0,r),n,i.slice(r));const c=Z(this,di).get(o.index);if(c)for(const a of c){const s=this.mobi.decode(n).slice(a),f=gl(s);ht(this,Qi,Wo).call(this,o.index,a,f)}}return this.mobi.decode(i)}async createDocument(w){const t=await this.loadText(w);return this.parser.parseFromString(t,Z(this,hn))}async loadSection(w){var i;if(Z(this,Mr).has(w))return Z(this,Mr).get(w);const t=await this.loadText(w),h=await this.replaceResources(t);let d=this.parser.parseFromString(h,Z(this,hn));(d.querySelector("parsererror")||!((i=d.documentElement)!=null&&i.namespaceURI))&&(gt(this,hn,Dr.HTML),d=this.parser.parseFromString(h,Z(this,hn)));for(const[o,r]of Z(this,Ji))for(const e of d.querySelectorAll(`img[src="${o}"]`))e.replaceWith(r);const l=URL.createObjectURL(new Blob([this.serializer.serializeToString(d)],{type:Z(this,hn)}));return Z(this,Mr).set(w,l),l}getIndexByFID(w){return Z(this,Dn).findIndex(t=>t.frags.some(h=>h.index===w))}async resolveHref(w){var f;const{fid:t,off:h}=pl(w),d=this.getIndexByFID(t);if(d<0)return;const l=(f=Z(this,Pn).get(t))==null?void 0:f.get(h);if(l)return{index:d,anchor:p=>p.querySelector(l)};const{skel:i,frags:o}=Z(this,Dn)[d],r=o.find(p=>p.index===t),e=i.offset+i.length+r.offset,n=await this.loadRaw(e,e+r.length),c=this.mobi.decode(n).slice(h),a=gl(c);return ht(this,Qi,Wo).call(this,t,h,a),{index:d,anchor:p=>p.querySelector(a)}}splitTOCHref(w){const t=pl(w);return[this.getIndexByFID(t.fid),t]}getTOCFragment(w,{fid:t,off:h}){var l;const d=(l=Z(this,Pn).get(t))==null?void 0:l.get(h);return w.querySelector(d)}isExternal(w){return/^(?!blob|kindle)\w+:/i.test(w)}destroy(){for(const w of Z(this,Mr).values())URL.revokeObjectURL(w)}}Mr=new WeakMap,di=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,un=new WeakMap,fn=new WeakMap,Ur=new WeakMap,so=new WeakMap,oo=new WeakMap,hn=new WeakMap,Ji=new WeakMap,Qi=new WeakSet,Wo=function(w,t,h){const d=Z(this,Pn).get(w);if(d)d.set(t,h);else{const l=new Map;Z(this,Pn).set(w,l),l.set(t,h)}};const nb=Object.freeze(Object.defineProperty({__proto__:null,MOBI:Zg,isMOBI:qg},Symbol.toStringTag,{value:"Module"}));var hr=Uint8Array,ji=Uint16Array,ib=Int32Array,Hc=new hr([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]),Wc=new hr([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]),sb=new hr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qc=function(C,w){for(var t=new ji(31),h=0;h<31;++h)t[h]=w+=1<<C[h-1];var d=new ib(t[30]);for(h=1;h<30;++h)for(var l=t[h];l<t[h+1];++l)d[l]=l-t[h]<<5|h;return{b:t,r:d}},Xc=qc(Hc,2),Zc=Xc.b,ob=Xc.r;Zc[28]=258,ob[258]=28;for(var ab=qc(Wc,0).b,Gc=new ji(32768),xe=0;xe<32768;++xe){var En=(43690&xe)>>1|(21845&xe)<<1;En=(61680&(En=(52428&En)>>2|(13107&En)<<2))>>4|(3855&En)<<4,Gc[xe]=((65280&En)>>8|(255&En)<<8)>>1}var Ii=function(C,w,t){for(var h=C.length,d=0,l=new ji(w);d<h;++d)C[d]&&++l[C[d]-1];var i,o=new ji(w);for(d=1;d<w;++d)o[d]=o[d-1]+l[d-1]<<1;{i=new ji(1<<w);var r=15-w;for(d=0;d<h;++d)if(C[d])for(var e=d<<4|C[d],n=w-C[d],c=o[C[d]-1]++<<n,a=c|(1<<n)-1;c<=a;++c)i[Gc[c]>>r]=e}return i},ds=new hr(288);for(xe=0;xe<144;++xe)ds[xe]=8;for(xe=144;xe<256;++xe)ds[xe]=9;for(xe=256;xe<280;++xe)ds[xe]=7;for(xe=280;xe<288;++xe)ds[xe]=8;var Kc=new hr(32);for(xe=0;xe<32;++xe)Kc[xe]=5;var lb=Ii(ds,9),cb=Ii(Kc,5),Co=function(C){for(var w=C[0],t=1;t<C.length;++t)C[t]>w&&(w=C[t]);return w},gr=function(C,w,t){var h=w/8|0;return(C[h]|C[h+1]<<8)>>(7&w)&t},To=function(C,w){var t=w/8|0;return(C[t]|C[t+1]<<8|C[t+2]<<16)>>(7&w)},ub=["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"],br=function(C,w,t){var h=new Error(w||ub[C]);if(h.code=C,Error.captureStackTrace&&Error.captureStackTrace(h,br),!t)throw h;return h},fb=function(C,w,t,h){var d=C.length,l=h?h.length:0;if(!d||w.f&&!w.l)return t||new hr(0);var i=!t,o=i||w.i!=2,r=w.i;i&&(t=new hr(3*d));var e=function(q){var Y=t.length;if(q>Y){var G=new hr(Math.max(2*Y,q));G.set(t),t=G}},n=w.f||0,c=w.p||0,a=w.b||0,s=w.l,f=w.d,p=w.m,u=w.n,g=8*d;do{if(!s){n=gr(C,c,1);var m=gr(C,c+1,3);if(c+=3,!m){var v=C[(A=4+((c+7)/8|0))-4]|C[A-3]<<8,S=A+v;if(S>d){r&&br(0);break}o&&e(a+v),t.set(C.subarray(A,S),a),w.b=a+=v,w.p=c=8*S,w.f=n;continue}if(m==1)s=lb,f=cb,p=9,u=5;else if(m==2){var R=gr(C,c,31)+257,I=gr(C,c+10,15)+4,F=R+gr(C,c+5,31)+1;c+=14;for(var j=new hr(F),L=new hr(19),$=0;$<I;++$)L[sb[$]]=gr(C,c+3*$,7);c+=3*I;var V=Co(L),z=(1<<V)-1,E=Ii(L,V);for($=0;$<F;){var A,k=E[gr(C,c,z)];if(c+=15&k,(A=k>>4)<16)j[$++]=A;else{var b=0,y=0;for(A==16?(y=3+gr(C,c,3),c+=2,b=j[$-1]):A==17?(y=3+gr(C,c,7),c+=3):A==18&&(y=11+gr(C,c,127),c+=7);y--;)j[$++]=b}}var _=j.subarray(0,R),x=j.subarray(R);p=Co(_),u=Co(x),s=Ii(_,p),f=Ii(x,u)}else br(1);if(c>g){r&&br(0);break}}o&&e(a+131072);for(var M=(1<<p)-1,B=(1<<u)-1,P=c;;P=c){var H=(b=s[To(C,c)&M])>>4;if((c+=15&b)>g){r&&br(0);break}if(b||br(2),H<256)t[a++]=H;else{if(H==256){P=c,s=null;break}var W=H-254;if(H>264){var K=Hc[$=H-257];W=gr(C,c,(1<<K)-1)+Zc[$],c+=K}var D=f[To(C,c)&B],X=D>>4;if(D||br(3),c+=15&D,x=ab[X],X>3&&(K=Wc[X],x+=To(C,c)&(1<<K)-1,c+=K),c>g){r&&br(0);break}o&&e(a+131072);var O=a+W;if(a<x){var N=l-x,U=Math.min(x,O);for(N+a<0&&br(3);a<U;++a)t[a]=h[N+a]}for(;a<O;++a)t[a]=t[a-x]}}w.l=s,w.p=P,w.b=a,w.f=n,s&&(n=1,w.m=p,w.d=f,w.n=u)}while(!n);return a!=t.length&&i?function(q,Y,G){return(G==null||G>q.length)&&(G=q.length),new hr(q.subarray(Y,G))}(t,0,a):t.subarray(0,a)},hb=new hr(0);function db(C,w){return fb(C.subarray((t=C,h=w&&w.dictionary,((15&t[0])!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&br(6,"invalid zlib data"),(t[1]>>5&1)==+!h&&br(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)),-4),{i:2},w&&w.out,w&&w.dictionary);var t,h}var pb=typeof TextDecoder<"u"&&new TextDecoder;try{pb.decode(hb,{stream:!0})}catch{}const mb=Object.freeze(Object.defineProperty({__proto__:null,unzlibSync:db},Symbol.toStringTag,{value:"Module"}));(function(){if(typeof document>"u"||"adoptedStyleSheets"in document)return;var C="ShadyCSS"in window&&!ShadyCSS.nativeShadow,w=document.implementation.createHTMLDocument(""),t=new WeakMap,h=typeof DOMException=="object"?Error:DOMException,d=Object.defineProperty,l=Array.prototype.forEach,i=/@import.+?;?$/gm;function o(O){var N=O.replace(i,"");return N!==O&&console.warn("@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418"),N.trim()}function r(O){return"isConnected"in O?O.isConnected:document.contains(O)}function e(O){return O.filter(function(N,U){return O.indexOf(N)===U})}function n(O,N){return O.filter(function(U){return N.indexOf(U)===-1})}function c(O){O.parentNode.removeChild(O)}function a(O){return O.shadowRoot||t.get(O)}var s=["addRule","deleteRule","insertRule","removeRule"],f=CSSStyleSheet,p=f.prototype;p.replace=function(){return Promise.reject(new h("Can't call replace on non-constructed CSSStyleSheets."))},p.replaceSync=function(){throw new h("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.")};function u(O){return typeof O=="object"?z.isPrototypeOf(O)||p.isPrototypeOf(O):!1}function g(O){return typeof O=="object"?p.isPrototypeOf(O):!1}var m=new WeakMap,v=new WeakMap,S=new WeakMap,R=new WeakMap;function I(O,N){var U=document.createElement("style");return S.get(O).set(N,U),v.get(O).push(N),U}function F(O,N){return S.get(O).get(N)}function j(O,N){S.get(O).delete(N),v.set(O,v.get(O).filter(function(U){return U!==N}))}function L(O,N){requestAnimationFrame(function(){N.textContent=m.get(O).textContent,R.get(O).forEach(function(U){return N.sheet[U.method].apply(N.sheet,U.args)})})}function $(O){if(!m.has(O))throw new TypeError("Illegal invocation")}function V(){var O=this,N=document.createElement("style");w.body.appendChild(N),m.set(O,N),v.set(O,[]),S.set(O,new WeakMap),R.set(O,[])}var z=V.prototype;z.replace=function(N){try{return this.replaceSync(N),Promise.resolve(this)}catch(U){return Promise.reject(U)}},z.replaceSync=function(N){if($(this),typeof N=="string"){var U=this;m.get(U).textContent=o(N),R.set(U,[]),v.get(U).forEach(function(q){q.isConnected()&&L(U,F(U,q))})}},d(z,"cssRules",{configurable:!0,enumerable:!0,get:function(){return $(this),m.get(this).sheet.cssRules}}),d(z,"media",{configurable:!0,enumerable:!0,get:function(){return $(this),m.get(this).sheet.media}}),s.forEach(function(O){z[O]=function(){var N=this;$(N);var U=arguments;R.get(N).push({method:O,args:U}),v.get(N).forEach(function(Y){if(Y.isConnected()){var G=F(N,Y).sheet;G[O].apply(G,U)}});var q=m.get(N).sheet;return q[O].apply(q,U)}}),d(V,Symbol.hasInstance,{configurable:!0,value:u});var E={childList:!0,subtree:!0},A=new WeakMap;function k(O){var N=A.get(O);return N||(N=new W(O),A.set(O,N)),N}function b(O){d(O.prototype,"adoptedStyleSheets",{configurable:!0,enumerable:!0,get:function(){return k(this).sheets},set:function(N){k(this).update(N)}})}function y(O,N){for(var U=document.createNodeIterator(O,NodeFilter.SHOW_ELEMENT,function(Y){return a(Y)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT},null,!1),q=void 0;q=U.nextNode();)N(a(q))}var _=new WeakMap,x=new WeakMap,M=new WeakMap;function B(O,N){return N instanceof HTMLStyleElement&&x.get(O).some(function(U){return F(U,O)})}function P(O){var N=_.get(O);return N instanceof Document?N.body:N}function H(O){var N=document.createDocumentFragment(),U=x.get(O),q=M.get(O),Y=P(O);q.disconnect(),U.forEach(function(G){N.appendChild(F(G,O)||I(G,O))}),Y.insertBefore(N,null),q.observe(Y,E),U.forEach(function(G){L(G,F(G,O))})}function W(O){var N=this;N.sheets=[],_.set(N,O),x.set(N,[]),M.set(N,new MutationObserver(function(U,q){if(!document){q.disconnect();return}U.forEach(function(Y){C||l.call(Y.addedNodes,function(G){G instanceof Element&&y(G,function(Q){k(Q).connect()})}),l.call(Y.removedNodes,function(G){G instanceof Element&&(B(N,G)&&H(N),C||y(G,function(Q){k(Q).disconnect()}))})})}))}if(W.prototype={isConnected:function(){var O=_.get(this);return O instanceof Document?O.readyState!=="loading":r(O.host)},connect:function(){var O=P(this);M.get(this).observe(O,E),x.get(this).length>0&&H(this),y(O,function(N){k(N).connect()})},disconnect:function(){M.get(this).disconnect()},update:function(O){var N=this,U=_.get(N)===document?"Document":"ShadowRoot";if(!Array.isArray(O))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+U+": Iterator getter is not callable.");if(!O.every(u))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+U+": Failed to convert value to 'CSSStyleSheet'");if(O.some(g))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+U+": Can't adopt non-constructed stylesheets");N.sheets=O;var q=x.get(N),Y=e(O),G=n(q,Y);G.forEach(function(Q){c(F(Q,N)),j(Q,N)}),x.set(N,Y),N.isConnected()&&Y.length>0&&H(N)}},window.CSSStyleSheet=V,b(Document),"ShadowRoot"in window){b(ShadowRoot);var K=Element.prototype,D=K.attachShadow;K.attachShadow=function(N){var U=D.call(this,N);return N.mode==="closed"&&t.set(this,U),U}}var X=k(document);X.isConnected()?X.connect():document.addEventListener("DOMContentLoaded",X.connect.bind(X))})();const bl=C=>{var w,t;return(t=(w=C==null?void 0:C.split(/[,;\s]/))==null?void 0:w.filter(h=>h))==null?void 0:t.map(h=>h.split("=").map(d=>d.trim()))},gb=(C,w)=>{var d,l;if(C.documentElement.localName==="svg"){const[,,i,o]=((d=C.documentElement.getAttribute("viewBox"))==null?void 0:d.split(/\s/))??[];return{width:i,height:o}}const t=bl((l=C.querySelector('meta[name="viewport"]'))==null?void 0:l.getAttribute("content"));if(t)return Object.fromEntries(t);if(typeof w=="string")return bl(w);if(w)return w;const h=C.querySelector("img");return h?{width:h.naturalWidth,height:h.naturalHeight}:(console.warn(new Error("Missing viewport properties")),{width:1e3,height:2e3})};var Ln,ts,Hr,dn,pi,wr,_r,cr,pn,mn,ke,Vs,Kn,qo,Xo,Zo,Us;class ha extends HTMLElement{constructor(){super();mt(this,ke);mt(this,Ln,this.attachShadow({mode:"closed"}));mt(this,ts,new ResizeObserver(()=>ht(this,ke,Kn).call(this)));mt(this,Hr);mt(this,dn,-1);De(this,"defaultViewport");De(this,"spread");mt(this,pi,!1);mt(this,wr);mt(this,_r);mt(this,cr);mt(this,pn);mt(this,mn);const t=new CSSStyleSheet;Z(this,Ln).adoptedStyleSheets=[t],t.replaceSync(`:host {
175
175
  width: 100%;
176
176
  height: 100%;
177
177
  display: flex;
178
178
  justify-content: center;
179
179
  align-items: center;
180
180
  overflow: auto;
181
- }`),Z(this,ts).observe(this)}attributeChangedCallback(t,h,d){switch(t){case"zoom":gt(this,mn,d!=="fit-width"&&d!=="fit-page"?parseFloat(d):d),ht(this,ke,Kn).call(this);break}}open(t){this.book=t;const{rendition:h}=t;this.spread=h==null?void 0:h.spread,this.defaultViewport=h==null?void 0:h.viewport;const d=t.dir==="rtl",l=!d;this.rtl=d,(h==null?void 0:h.spread)==="none"?gt(this,Hr,t.sections.map(i=>({center:i}))):gt(this,Hr,t.sections.reduce((i,o,r)=>{const e=i[i.length-1],{pageSpread:n}=o,c=()=>{const a={};return i.push(a),a};if(n==="center"){const a=e.left||e.right?c():e;a.center=o}else if(n==="left"){const a=e.center||e.left||l&&r?c():e;a.left=o}else if(n==="right"){const a=e.center||e.right||d&&r?c():e;a.right=o}else l?e.center||e.right?c().left=o:e.left||!r?e.right=o:e.left=o:e.center||e.left?c().right=o:e.right||!r?e.left=o:e.right=o;return i},[{}]))}get index(){const t=Z(this,Hr)[Z(this,dn)],h=(t==null?void 0:t.center)??(this.side==="left"?t.left??t.right:t.right??t.left);return this.book.sections.indexOf(h)}getSpreadOf(t){const h=Z(this,Hr);for(let d=0;d<h.length;d++){const{left:l,right:i,center:o}=h[d];if(l===t)return{index:d,side:"left"};if(i===t)return{index:d,side:"right"};if(o===t)return{index:d,side:"center"}}}async goToSpread(t,h,d){var i,o,r,e,n,c;if(t<0||t>Z(this,Hr).length-1)return;if(t===Z(this,dn)){ht(this,ke,Kn).call(this,h);return}gt(this,dn,t);const l=Z(this,Hr)[t];if(l.center){const a=this.book.sections.indexOf(l.center),s=await((o=(i=l.center)==null?void 0:i.load)==null?void 0:o.call(i));await ht(this,ke,qo).call(this,{center:{index:a,src:s}})}else{const a=this.book.sections.indexOf(l.left),s=this.book.sections.indexOf(l.right),f=await((e=(r=l.left)==null?void 0:r.load)==null?void 0:e.call(r)),p=await((c=(n=l.right)==null?void 0:n.load)==null?void 0:c.call(n)),u={index:a,src:f},g={index:s,src:p};await ht(this,ke,qo).call(this,{left:u,right:g,side:h})}ht(this,ke,Us).call(this,d)}async select(t){await this.goTo(t)}async goTo(t){const{book:h}=this,d=await t,l=h.sections[d.index];if(!l)return;const{index:i,side:o}=this.getSpreadOf(l);await this.goToSpread(i,o)}async next(){if(this.rtl?ht(this,ke,Xo).call(this):ht(this,ke,Zo).call(this))ht(this,ke,Us).call(this,"page");else return this.goToSpread(Z(this,dn)+1,this.rtl?"right":"left","page")}async prev(){if(this.rtl?ht(this,ke,Zo).call(this):ht(this,ke,Xo).call(this))ht(this,ke,Us).call(this,"page");else return this.goToSpread(Z(this,dn)-1,this.rtl?"left":"right","page")}getContents(){return Array.from(Z(this,Ln).querySelectorAll("iframe"),t=>({doc:t.contentDocument}))}destroy(){Z(this,ts).unobserve(this)}}Ln=new WeakMap,ts=new WeakMap,Hr=new WeakMap,dn=new WeakMap,pi=new WeakMap,wr=new WeakMap,_r=new WeakMap,cr=new WeakMap,pn=new WeakMap,mn=new WeakMap,ke=new WeakSet,Vs=async function({index:t,src:h}){const d=typeof h=="string",l=d?h:h==null?void 0:h.src,i=d?null:h==null?void 0:h.onZoom,o=document.createElement("div"),r=document.createElement("iframe");return o.append(r),Object.assign(r.style,{border:"0",display:"none",overflow:"hidden"}),r.setAttribute("sandbox","allow-same-origin allow-scripts"),r.setAttribute("scrolling","no"),r.setAttribute("part","filter"),Z(this,Ln).append(o),l?new Promise(e=>{r.addEventListener("load",()=>{const n=r.contentDocument;this.dispatchEvent(new CustomEvent("load",{detail:{doc:n,index:t}}));const{width:c,height:a}=kb(n,this.defaultViewport);e({element:o,iframe:r,width:parseFloat(c),height:parseFloat(a),onZoom:i})},{once:!0}),r.src=l}):{blank:!0,element:o,iframe:r}},Kn=function(t=Z(this,pn)){if(!t)return;const h=Z(this,wr)??{},d=Z(this,cr)??Z(this,_r),l=t==="left"?h:d,{width:i,height:o}=this.getBoundingClientRect(),r=this.spread!=="both"&&this.spread!=="portrait"&&o>i;gt(this,pi,r);const e=h.width??d.width,n=h.height??d.height,c=typeof Z(this,mn)=="number"&&!isNaN(Z(this,mn))?Z(this,mn):Z(this,mn)==="fit-width"?r||Z(this,cr)?i/(l.width??e):i/((h.width??e)+(d.width??e)):r||Z(this,cr)?Math.min(i/(l.width??e),o/(l.height??n)):Math.min(i/((h.width??e)+(d.width??e)),o/Math.max(h.height??n,d.height??n)),a=s=>{let{element:f,iframe:p,width:u,height:g,blank:m,onZoom:v}=s;v&&v({doc:s.iframe.contentDocument,scale:c});const S=v?c:1;Object.assign(p.style,{width:`${u*S}px`,height:`${g*S}px`,transform:v?"none":`scale(${c})`,transformOrigin:"top left",display:m?"none":"block"}),Object.assign(f.style,{width:`${(u??e)*c}px`,height:`${(g??n)*c}px`,overflow:"hidden",display:"block",flexShrink:"0",marginBlock:"auto"}),r&&s!==l&&(f.style.display="none")};Z(this,cr)?a(Z(this,cr)):(a(h),a(d))},qo=async function({left:t,right:h,center:d,side:l}){Z(this,Ln).replaceChildren(),gt(this,wr,null),gt(this,_r,null),gt(this,cr,null),d?(gt(this,cr,await ht(this,ke,Vs).call(this,d)),gt(this,pn,"center"),ht(this,ke,Kn).call(this)):(gt(this,wr,await ht(this,ke,Vs).call(this,t)),gt(this,_r,await ht(this,ke,Vs).call(this,h)),gt(this,pn,Z(this,wr).blank?"right":Z(this,_r).blank?"left":l),ht(this,ke,Kn).call(this))},Xo=function(){var t,h,d,l;if(!(Z(this,cr)||(t=Z(this,wr))!=null&&t.blank)&&Z(this,pi)&&((l=(d=(h=Z(this,wr))==null?void 0:h.element)==null?void 0:d.style)==null?void 0:l.display)==="none")return Z(this,_r).element.style.display="none",Z(this,wr).element.style.display="block",gt(this,pn,"left"),!0},Zo=function(){var t,h,d,l;if(!(Z(this,cr)||(t=Z(this,_r))!=null&&t.blank)&&Z(this,pi)&&((l=(d=(h=Z(this,_r))==null?void 0:h.element)==null?void 0:d.style)==null?void 0:l.display)==="none")return Z(this,wr).element.style.display="none",Z(this,_r).element.style.display="block",gt(this,pn,"right"),!0},Us=function(t){this.dispatchEvent(new CustomEvent("relocate",{detail:{reason:t,range:null,index:this.index,fraction:0,size:1}}))},De(ha,"observedAttributes",["zoom"]);customElements.define("foliate-fxl",ha);const Sb=Object.freeze(Object.defineProperty({__proto__:null,FixedLayout:ha},Symbol.toStringTag,{value:"Module"})),Eb=C=>new Promise(w=>setTimeout(w,C)),vl=(C,w,t)=>{let h;return(...d)=>{const l=()=>{h=null,C(...d)};h&&clearTimeout(h),h=setTimeout(l,w)}},Cb=(C,w,t)=>t*(w-C)+C,Tb=C=>1-(1-C)*(1-C),Mb=(C,w,t,h,d)=>new Promise(l=>{let i;const o=r=>{i??(i=r);const e=Math.min(1,(r-i)/t);d(Cb(C,w,h(e))),e<1?requestAnimationFrame(o):l()};requestAnimationFrame(o)}),Ab=C=>{if(!(C!=null&&C.collapsed))return C;const{endOffset:w,endContainer:t}=C;if(t.nodeType===1){const h=t.childNodes[w];return(h==null?void 0:h.nodeType)===1?h:t}if(w+1<t.length)C.setEnd(t,w+1);else if(w>1)C.setStart(t,w-1);else return t.parentNode;return C},As=(C,w,t,h=t)=>{const d=C.createRange();return d.setStart(w,t),d.setEnd(w,h),d},eo=(C,w,t,h=0,d=w.nodeValue.length)=>{if(d-h===1)return t(As(C,w,h),As(C,w,d))<0?h:d;const l=Math.floor(h+(d-h)/2),i=t(As(C,w,h,l),As(C,w,l,d));return i<0?eo(C,w,t,h,l):i>0?eo(C,w,t,l,d):l},{SHOW_ELEMENT:Rb,SHOW_TEXT:Nb,SHOW_CDATA_SECTION:Ob,FILTER_ACCEPT:yl,FILTER_REJECT:wl,FILTER_SKIP:_l}=NodeFilter,jb=Rb|Nb|Ob,Rs=C=>{let w=1/0,t=-1/0,h=1/0,d=-1/0;for(const l of C.getClientRects())h=Math.min(h,l.left),w=Math.min(w,l.top),t=Math.max(t,l.right),d=Math.max(d,l.bottom);return new DOMRect(h,w,t-h,d-w)},xl=(C,w,t,h)=>{const d=a=>{var f,p;const s=(f=a.localName)==null?void 0:f.toLowerCase();if(s==="script"||s==="style")return wl;if(a.nodeType===1){const{left:u,right:g}=h(a.getBoundingClientRect());if(g<w||u>t)return wl;if(u>=w&&g<=t)return yl}else{if(!((p=a.nodeValue)!=null&&p.trim()))return _l;const u=C.createRange();u.selectNodeContents(a);const{left:g,right:m}=h(u.getBoundingClientRect());if(m>=w&&g<=t)return yl}return _l},l=C.createTreeWalker(C.body,jb,{acceptNode:d}),i=[];for(let a=l.nextNode();a;a=l.nextNode())i.push(a);const o=i[0]??C.body,r=i[i.length-1]??o,e=o.nodeType===1?0:eo(C,o,(a,s)=>{const f=h(Rs(a)),p=h(Rs(s));return f.right<w&&p.left>w?0:p.left>w?-1:1}),n=r.nodeType===1?0:eo(C,r,(a,s)=>{const f=h(Rs(a)),p=h(Rs(s));return f.right<t&&p.left>t?0:p.left>t?-1:1}),c=C.createRange();return c.setStart(o,e),c.setEnd(r,n),c},kl=C=>{const w=document.createRange();return w.setStart(C.anchorNode,C.anchorOffset),w.setEnd(C.focusNode,C.focusOffset),w.collapsed},Ns=(C,w)=>{let t;if(C.startContainer?t=C.cloneRange():C.nodeType&&(t=document.createRange(),t.selectNode(C)),t){const h=t.startContainer.ownerDocument.defaultView.getSelection();h.removeAllRanges(),w===-1?t.collapse(!0):w===1&&t.collapse(),h.addRange(t)}},Ib=C=>{const{defaultView:w}=C,{writingMode:t,direction:h}=w.getComputedStyle(C.body),d=t==="vertical-rl"||t==="vertical-lr",l=C.body.dir==="rtl"||h==="rtl"||C.documentElement.dir==="rtl";return{vertical:d,rtl:l}},Bb=C=>{const w=C.defaultView.getComputedStyle(C.body);return w.backgroundColor==="rgba(0, 0, 0, 0)"&&w.backgroundImage==="none"?C.defaultView.getComputedStyle(C.documentElement).background:w.background},Sl=(C,w)=>Array.from({length:C},()=>{const t=document.createElement("div"),h=document.createElement("div");return t.append(h),h.setAttribute("part",w),t}),Mi=(C,w)=>{const{style:t}=C;for(const[h,d]of Object.entries(w))t.setProperty(h,d,"important")};var es,rr,Oe,rs,Pe,He,ns,mi,Rr,gi;class Pb{constructor({container:w,onExpand:t}){mt(this,es,new ResizeObserver(()=>this.expand()));mt(this,rr,document.createElement("div"));mt(this,Oe,document.createElement("iframe"));mt(this,rs,document.createRange());mt(this,Pe);mt(this,He,!1);mt(this,ns,!1);mt(this,mi,!0);mt(this,Rr);mt(this,gi,{});this.container=w,this.onExpand=t,Z(this,Oe).setAttribute("part","filter"),Z(this,rr).append(Z(this,Oe)),Object.assign(Z(this,rr).style,{boxSizing:"content-box",position:"relative",overflow:"hidden",flex:"0 0 auto",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}),Object.assign(Z(this,Oe).style,{overflow:"hidden",border:"0",display:"none",width:"100%",height:"100%"}),Z(this,Oe).setAttribute("sandbox","allow-same-origin allow-scripts"),Z(this,Oe).setAttribute("scrolling","no")}get element(){return Z(this,rr)}get document(){return Z(this,Oe).contentDocument}async load(w,t,h){if(typeof w!="string")throw new Error(`${w} is not string`);return new Promise(d=>{Z(this,Oe).addEventListener("load",()=>{const l=this.document;t==null||t(l),Z(this,Oe).style.display="block";const{vertical:i,rtl:o}=Ib(l);this.docBackground=Bb(l),l.body.style.background="none";const r=this.docBackground;Z(this,Oe).style.display="none",gt(this,He,i),gt(this,ns,o),Z(this,rs).selectNodeContents(l.body);const e=h==null?void 0:h({vertical:i,rtl:o,background:r});Z(this,Oe).style.display="block",this.render(e),Z(this,es).observe(l.body),l.fonts.ready.then(()=>this.expand()),d()},{once:!0}),Z(this,Oe).src=w})}render(w){!w||!this.document||(gt(this,mi,w.flow!=="scrolled"),gt(this,gi,w),Z(this,mi)?this.columnize(w):this.scrolled(w))}scrolled({margin:w,gap:t,columnWidth:h}){const d=Z(this,He),l=this.document;Mi(l.documentElement,{"box-sizing":"border-box",padding:d?`${w*1.5}px ${t}px`:`0 ${t}px`,"column-width":"auto",height:"auto",width:"auto"}),Mi(l.body,{[d?"max-height":"max-width"]:`${h}px`,margin:"auto"}),this.setImageSize(),this.expand()}columnize({width:w,height:t,margin:h,gap:d,columnWidth:l}){const i=Z(this,He);gt(this,Rr,i?t:w);const o=this.document;Mi(o.documentElement,{"box-sizing":"border-box","column-width":`${Math.trunc(l)}px`,"column-gap":i?`${h}px`:`${d}px`,"column-fill":"auto",...i?{width:`${w}px`}:{height:`${t}px`},padding:i?`${h/2}px ${d}px`:`0 ${d/2}px`,overflow:"hidden","overflow-wrap":"break-word",position:"static",border:"0",margin:"0","max-height":"none","max-width":"none","min-height":"none","min-width":"none","-webkit-line-box-contain":"block glyphs replaced"}),Mi(o.body,{"max-height":"none","max-width":"none",margin:"0"}),this.setImageSize(),this.expand()}setImageSize(){const{width:w,height:t,margin:h}=Z(this,gi),d=Z(this,He),l=this.document;for(const i of l.body.querySelectorAll("img, svg, video")){const{maxHeight:o,maxWidth:r}=l.defaultView.getComputedStyle(i);Mi(i,{"max-height":d?o!=="none"&&o!=="0px"?o:"100%":`${t-h*2}px`,"max-width":d?`${w-h*2}px`:r!=="none"&&r!=="0px"?r:"100%","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"})}}expand(){const{documentElement:w}=this.document;if(Z(this,mi)){const t=Z(this,He)?"height":"width",h=Z(this,He)?"width":"height",d=Z(this,rs).getBoundingClientRect(),l=w.getBoundingClientRect(),o=(Z(this,He)?0:Z(this,ns)?l.right-d.right:d.left-l.left)+d[t],e=Math.ceil(o/Z(this,Rr))*Z(this,Rr);Z(this,rr).style.padding="0",Z(this,Oe).style[t]=`${e}px`,Z(this,rr).style[t]=`${e+Z(this,Rr)*2}px`,Z(this,Oe).style[h]="100%",Z(this,rr).style[h]="100%",w.style[t]=`${Z(this,Rr)}px`,Z(this,Pe)&&(Z(this,Pe).element.style.margin="0",Z(this,Pe).element.style.left=Z(this,He)?"0":`${Z(this,Rr)}px`,Z(this,Pe).element.style.top=Z(this,He)?`${Z(this,Rr)}px`:"0",Z(this,Pe).element.style[t]=`${e}px`,Z(this,Pe).redraw())}else{const t=Z(this,He)?"width":"height",h=Z(this,He)?"height":"width",l=w.getBoundingClientRect()[t],{margin:i,gap:o}=Z(this,gi),r=Z(this,He)?`0 ${o}px`:`${i}px 0`;Z(this,rr).style.padding=r,Z(this,Oe).style[t]=`${l}px`,Z(this,rr).style[t]=`${l}px`,Z(this,Oe).style[h]="100%",Z(this,rr).style[h]="100%",Z(this,Pe)&&(Z(this,Pe).element.style.margin=r,Z(this,Pe).element.style.left="0",Z(this,Pe).element.style.top="0",Z(this,Pe).element.style[t]=`${l}px`,Z(this,Pe).redraw())}this.onExpand()}set overlayer(w){gt(this,Pe,w),Z(this,rr).append(w.element)}get overlayer(){return Z(this,Pe)}destroy(){this.document&&Z(this,es).unobserve(this.document.body)}}es=new WeakMap,rr=new WeakMap,Oe=new WeakMap,rs=new WeakMap,Pe=new WeakMap,He=new WeakMap,ns=new WeakMap,mi=new WeakMap,Rr=new WeakMap,gi=new WeakMap;var Wr,is,qr,gn,Je,bn,zn,ce,ur,xr,vn,Nr,kr,bi,$n,ss,os,as,vi,yn,Vn,yi,ls,At,Kc,Hs,Go,Ko,Yo,Jo,Ri,Yc,Yn,Jn,Qn,Jc,Ni,Qo,ta,Ws,Qc,tu,Rn,ea;class da extends HTMLElement{constructor(){super();mt(this,At);mt(this,Wr,this.attachShadow({mode:"closed"}));mt(this,is,new ResizeObserver(()=>this.render()));mt(this,qr);mt(this,gn);mt(this,Je);mt(this,bn);mt(this,zn);mt(this,ce);mt(this,ur,!1);mt(this,xr,!1);mt(this,vn,0);mt(this,Nr,-1);mt(this,kr,0);mt(this,bi,!1);mt(this,$n,!1);mt(this,ss);mt(this,os,new WeakMap);mt(this,as,matchMedia("(prefers-color-scheme: dark)"));mt(this,vi);mt(this,yn);mt(this,Vn);mt(this,yi);mt(this,ls);Z(this,Wr).innerHTML=`<style>
181
+ }`),Z(this,ts).observe(this)}attributeChangedCallback(t,h,d){switch(t){case"zoom":gt(this,mn,d!=="fit-width"&&d!=="fit-page"?parseFloat(d):d),ht(this,ke,Kn).call(this);break}}open(t){this.book=t;const{rendition:h}=t;this.spread=h==null?void 0:h.spread,this.defaultViewport=h==null?void 0:h.viewport;const d=t.dir==="rtl",l=!d;this.rtl=d,(h==null?void 0:h.spread)==="none"?gt(this,Hr,t.sections.map(i=>({center:i}))):gt(this,Hr,t.sections.reduce((i,o,r)=>{const e=i[i.length-1],{pageSpread:n}=o,c=()=>{const a={};return i.push(a),a};if(n==="center"){const a=e.left||e.right?c():e;a.center=o}else if(n==="left"){const a=e.center||e.left||l&&r?c():e;a.left=o}else if(n==="right"){const a=e.center||e.right||d&&r?c():e;a.right=o}else l?e.center||e.right?c().left=o:e.left||!r?e.right=o:e.left=o:e.center||e.left?c().right=o:e.right||!r?e.left=o:e.right=o;return i},[{}]))}get index(){const t=Z(this,Hr)[Z(this,dn)],h=(t==null?void 0:t.center)??(this.side==="left"?t.left??t.right:t.right??t.left);return this.book.sections.indexOf(h)}getSpreadOf(t){const h=Z(this,Hr);for(let d=0;d<h.length;d++){const{left:l,right:i,center:o}=h[d];if(l===t)return{index:d,side:"left"};if(i===t)return{index:d,side:"right"};if(o===t)return{index:d,side:"center"}}}async goToSpread(t,h,d){var i,o,r,e,n,c;if(t<0||t>Z(this,Hr).length-1)return;if(t===Z(this,dn)){ht(this,ke,Kn).call(this,h);return}gt(this,dn,t);const l=Z(this,Hr)[t];if(l.center){const a=this.book.sections.indexOf(l.center),s=await((o=(i=l.center)==null?void 0:i.load)==null?void 0:o.call(i));await ht(this,ke,qo).call(this,{center:{index:a,src:s}})}else{const a=this.book.sections.indexOf(l.left),s=this.book.sections.indexOf(l.right),f=await((e=(r=l.left)==null?void 0:r.load)==null?void 0:e.call(r)),p=await((c=(n=l.right)==null?void 0:n.load)==null?void 0:c.call(n)),u={index:a,src:f},g={index:s,src:p};await ht(this,ke,qo).call(this,{left:u,right:g,side:h})}ht(this,ke,Us).call(this,d)}async select(t){await this.goTo(t)}async goTo(t){const{book:h}=this,d=await t,l=h.sections[d.index];if(!l)return;const{index:i,side:o}=this.getSpreadOf(l);await this.goToSpread(i,o)}async next(){if(this.rtl?ht(this,ke,Xo).call(this):ht(this,ke,Zo).call(this))ht(this,ke,Us).call(this,"page");else return this.goToSpread(Z(this,dn)+1,this.rtl?"right":"left","page")}async prev(){if(this.rtl?ht(this,ke,Zo).call(this):ht(this,ke,Xo).call(this))ht(this,ke,Us).call(this,"page");else return this.goToSpread(Z(this,dn)-1,this.rtl?"left":"right","page")}getContents(){return Array.from(Z(this,Ln).querySelectorAll("iframe"),t=>({doc:t.contentDocument}))}destroy(){Z(this,ts).unobserve(this)}}Ln=new WeakMap,ts=new WeakMap,Hr=new WeakMap,dn=new WeakMap,pi=new WeakMap,wr=new WeakMap,_r=new WeakMap,cr=new WeakMap,pn=new WeakMap,mn=new WeakMap,ke=new WeakSet,Vs=async function({index:t,src:h}){const d=typeof h=="string",l=d?h:h==null?void 0:h.src,i=d?null:h==null?void 0:h.onZoom,o=document.createElement("div"),r=document.createElement("iframe");return o.append(r),Object.assign(r.style,{border:"0",display:"none",overflow:"hidden"}),r.setAttribute("sandbox","allow-same-origin allow-scripts"),r.setAttribute("scrolling","no"),r.setAttribute("part","filter"),Z(this,Ln).append(o),l?new Promise(e=>{r.addEventListener("load",()=>{const n=r.contentDocument;this.dispatchEvent(new CustomEvent("load",{detail:{doc:n,index:t}}));const{width:c,height:a}=gb(n,this.defaultViewport);e({element:o,iframe:r,width:parseFloat(c),height:parseFloat(a),onZoom:i})},{once:!0}),r.src=l}):{blank:!0,element:o,iframe:r}},Kn=function(t=Z(this,pn)){if(!t)return;const h=Z(this,wr)??{},d=Z(this,cr)??Z(this,_r),l=t==="left"?h:d,{width:i,height:o}=this.getBoundingClientRect(),r=this.spread!=="both"&&this.spread!=="portrait"&&o>i;gt(this,pi,r);const e=h.width??d.width,n=h.height??d.height,c=typeof Z(this,mn)=="number"&&!isNaN(Z(this,mn))?Z(this,mn):Z(this,mn)==="fit-width"?r||Z(this,cr)?i/(l.width??e):i/((h.width??e)+(d.width??e)):r||Z(this,cr)?Math.min(i/(l.width??e),o/(l.height??n)):Math.min(i/((h.width??e)+(d.width??e)),o/Math.max(h.height??n,d.height??n)),a=s=>{let{element:f,iframe:p,width:u,height:g,blank:m,onZoom:v}=s;v&&v({doc:s.iframe.contentDocument,scale:c});const S=v?c:1;Object.assign(p.style,{width:`${u*S}px`,height:`${g*S}px`,transform:v?"none":`scale(${c})`,transformOrigin:"top left",display:m?"none":"block"}),Object.assign(f.style,{width:`${(u??e)*c}px`,height:`${(g??n)*c}px`,overflow:"hidden",display:"block",flexShrink:"0",marginBlock:"auto"}),r&&s!==l&&(f.style.display="none")};Z(this,cr)?a(Z(this,cr)):(a(h),a(d))},qo=async function({left:t,right:h,center:d,side:l}){Z(this,Ln).replaceChildren(),gt(this,wr,null),gt(this,_r,null),gt(this,cr,null),d?(gt(this,cr,await ht(this,ke,Vs).call(this,d)),gt(this,pn,"center"),ht(this,ke,Kn).call(this)):(gt(this,wr,await ht(this,ke,Vs).call(this,t)),gt(this,_r,await ht(this,ke,Vs).call(this,h)),gt(this,pn,Z(this,wr).blank?"right":Z(this,_r).blank?"left":l),ht(this,ke,Kn).call(this))},Xo=function(){var t,h,d,l;if(!(Z(this,cr)||(t=Z(this,wr))!=null&&t.blank)&&Z(this,pi)&&((l=(d=(h=Z(this,wr))==null?void 0:h.element)==null?void 0:d.style)==null?void 0:l.display)==="none")return Z(this,_r).element.style.display="none",Z(this,wr).element.style.display="block",gt(this,pn,"left"),!0},Zo=function(){var t,h,d,l;if(!(Z(this,cr)||(t=Z(this,_r))!=null&&t.blank)&&Z(this,pi)&&((l=(d=(h=Z(this,_r))==null?void 0:h.element)==null?void 0:d.style)==null?void 0:l.display)==="none")return Z(this,wr).element.style.display="none",Z(this,_r).element.style.display="block",gt(this,pn,"right"),!0},Us=function(t){this.dispatchEvent(new CustomEvent("relocate",{detail:{reason:t,range:null,index:this.index,fraction:0,size:1}}))},De(ha,"observedAttributes",["zoom"]);customElements.define("foliate-fxl",ha);const bb=Object.freeze(Object.defineProperty({__proto__:null,FixedLayout:ha},Symbol.toStringTag,{value:"Module"})),vb=C=>new Promise(w=>setTimeout(w,C)),vl=(C,w,t)=>{let h;return(...d)=>{const l=()=>{h=null,C(...d)};h&&clearTimeout(h),h=setTimeout(l,w)}},yb=(C,w,t)=>t*(w-C)+C,wb=C=>1-(1-C)*(1-C),_b=(C,w,t,h,d)=>new Promise(l=>{let i;const o=r=>{i??(i=r);const e=Math.min(1,(r-i)/t);d(yb(C,w,h(e))),e<1?requestAnimationFrame(o):l()};requestAnimationFrame(o)}),xb=C=>{if(!(C!=null&&C.collapsed))return C;const{endOffset:w,endContainer:t}=C;if(t.nodeType===1){const h=t.childNodes[w];return(h==null?void 0:h.nodeType)===1?h:t}if(w+1<t.length)C.setEnd(t,w+1);else if(w>1)C.setStart(t,w-1);else return t.parentNode;return C},As=(C,w,t,h=t)=>{const d=C.createRange();return d.setStart(w,t),d.setEnd(w,h),d},eo=(C,w,t,h=0,d=w.nodeValue.length)=>{if(d-h===1)return t(As(C,w,h),As(C,w,d))<0?h:d;const l=Math.floor(h+(d-h)/2),i=t(As(C,w,h,l),As(C,w,l,d));return i<0?eo(C,w,t,h,l):i>0?eo(C,w,t,l,d):l},{SHOW_ELEMENT:kb,SHOW_TEXT:Sb,SHOW_CDATA_SECTION:Eb,FILTER_ACCEPT:yl,FILTER_REJECT:wl,FILTER_SKIP:_l}=NodeFilter,Cb=kb|Sb|Eb,Rs=C=>{let w=1/0,t=-1/0,h=1/0,d=-1/0;for(const l of C.getClientRects())h=Math.min(h,l.left),w=Math.min(w,l.top),t=Math.max(t,l.right),d=Math.max(d,l.bottom);return new DOMRect(h,w,t-h,d-w)},xl=(C,w,t,h)=>{const d=a=>{var f,p;const s=(f=a.localName)==null?void 0:f.toLowerCase();if(s==="script"||s==="style")return wl;if(a.nodeType===1){const{left:u,right:g}=h(a.getBoundingClientRect());if(g<w||u>t)return wl;if(u>=w&&g<=t)return yl}else{if(!((p=a.nodeValue)!=null&&p.trim()))return _l;const u=C.createRange();u.selectNodeContents(a);const{left:g,right:m}=h(u.getBoundingClientRect());if(m>=w&&g<=t)return yl}return _l},l=C.createTreeWalker(C.body,Cb,{acceptNode:d}),i=[];for(let a=l.nextNode();a;a=l.nextNode())i.push(a);const o=i[0]??C.body,r=i[i.length-1]??o,e=o.nodeType===1?0:eo(C,o,(a,s)=>{const f=h(Rs(a)),p=h(Rs(s));return f.right<w&&p.left>w?0:p.left>w?-1:1}),n=r.nodeType===1?0:eo(C,r,(a,s)=>{const f=h(Rs(a)),p=h(Rs(s));return f.right<t&&p.left>t?0:p.left>t?-1:1}),c=C.createRange();return c.setStart(o,e),c.setEnd(r,n),c},kl=C=>{const w=document.createRange();return w.setStart(C.anchorNode,C.anchorOffset),w.setEnd(C.focusNode,C.focusOffset),w.collapsed},Ns=(C,w)=>{let t;if(C.startContainer?t=C.cloneRange():C.nodeType&&(t=document.createRange(),t.selectNode(C)),t){const h=t.startContainer.ownerDocument.defaultView.getSelection();h.removeAllRanges(),w===-1?t.collapse(!0):w===1&&t.collapse(),h.addRange(t)}},Tb=C=>{const{defaultView:w}=C,{writingMode:t,direction:h}=w.getComputedStyle(C.body),d=t==="vertical-rl"||t==="vertical-lr",l=C.body.dir==="rtl"||h==="rtl"||C.documentElement.dir==="rtl";return{vertical:d,rtl:l}},Mb=C=>{const w=C.defaultView.getComputedStyle(C.body);return w.backgroundColor==="rgba(0, 0, 0, 0)"&&w.backgroundImage==="none"?C.defaultView.getComputedStyle(C.documentElement).background:w.background},Sl=(C,w)=>Array.from({length:C},()=>{const t=document.createElement("div"),h=document.createElement("div");return t.append(h),h.setAttribute("part",w),t}),Mi=(C,w)=>{const{style:t}=C;for(const[h,d]of Object.entries(w))t.setProperty(h,d,"important")};var es,rr,Oe,rs,Pe,He,ns,mi,Ar,gi;class Ab{constructor({container:w,onExpand:t}){mt(this,es,new ResizeObserver(()=>this.expand()));mt(this,rr,document.createElement("div"));mt(this,Oe,document.createElement("iframe"));mt(this,rs,document.createRange());mt(this,Pe);mt(this,He,!1);mt(this,ns,!1);mt(this,mi,!0);mt(this,Ar);mt(this,gi,{});this.container=w,this.onExpand=t,Z(this,Oe).setAttribute("part","filter"),Z(this,rr).append(Z(this,Oe)),Object.assign(Z(this,rr).style,{boxSizing:"content-box",position:"relative",overflow:"hidden",flex:"0 0 auto",width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}),Object.assign(Z(this,Oe).style,{overflow:"hidden",border:"0",display:"none",width:"100%",height:"100%"}),Z(this,Oe).setAttribute("sandbox","allow-same-origin allow-scripts"),Z(this,Oe).setAttribute("scrolling","no")}get element(){return Z(this,rr)}get document(){return Z(this,Oe).contentDocument}async load(w,t,h){if(typeof w!="string")throw new Error(`${w} is not string`);return new Promise(d=>{Z(this,Oe).addEventListener("load",()=>{const l=this.document;t==null||t(l),Z(this,Oe).style.display="block";const{vertical:i,rtl:o}=Tb(l);this.docBackground=Mb(l),l.body.style.background="none";const r=this.docBackground;Z(this,Oe).style.display="none",gt(this,He,i),gt(this,ns,o),Z(this,rs).selectNodeContents(l.body);const e=h==null?void 0:h({vertical:i,rtl:o,background:r});Z(this,Oe).style.display="block",this.render(e),Z(this,es).observe(l.body),l.fonts.ready.then(()=>this.expand()),d()},{once:!0}),Z(this,Oe).src=w})}render(w){!w||!this.document||(gt(this,mi,w.flow!=="scrolled"),gt(this,gi,w),Z(this,mi)?this.columnize(w):this.scrolled(w))}scrolled({margin:w,gap:t,columnWidth:h}){const d=Z(this,He),l=this.document;Mi(l.documentElement,{"box-sizing":"border-box",padding:d?`${w*1.5}px ${t}px`:`0 ${t}px`,"column-width":"auto",height:"auto",width:"auto"}),Mi(l.body,{[d?"max-height":"max-width"]:`${h}px`,margin:"auto"}),this.setImageSize(),this.expand()}columnize({width:w,height:t,margin:h,gap:d,columnWidth:l}){const i=Z(this,He);gt(this,Ar,i?t:w);const o=this.document;Mi(o.documentElement,{"box-sizing":"border-box","column-width":`${Math.trunc(l)}px`,"column-gap":i?`${h}px`:`${d}px`,"column-fill":"auto",...i?{width:`${w}px`}:{height:`${t}px`},padding:i?`${h/2}px ${d}px`:`0 ${d/2}px`,overflow:"hidden","overflow-wrap":"break-word",position:"static",border:"0",margin:"0","max-height":"none","max-width":"none","min-height":"none","min-width":"none","-webkit-line-box-contain":"block glyphs replaced"}),Mi(o.body,{"max-height":"none","max-width":"none",margin:"0"}),this.setImageSize(),this.expand()}setImageSize(){const{width:w,height:t,margin:h}=Z(this,gi),d=Z(this,He),l=this.document;for(const i of l.body.querySelectorAll("img, svg, video")){const{maxHeight:o,maxWidth:r}=l.defaultView.getComputedStyle(i);Mi(i,{"max-height":d?o!=="none"&&o!=="0px"?o:"100%":`${t-h*2}px`,"max-width":d?`${w-h*2}px`:r!=="none"&&r!=="0px"?r:"100%","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"})}}expand(){const{documentElement:w}=this.document;if(Z(this,mi)){const t=Z(this,He)?"height":"width",h=Z(this,He)?"width":"height",d=Z(this,rs).getBoundingClientRect(),l=w.getBoundingClientRect(),o=(Z(this,He)?0:Z(this,ns)?l.right-d.right:d.left-l.left)+d[t],e=Math.ceil(o/Z(this,Ar))*Z(this,Ar);Z(this,rr).style.padding="0",Z(this,Oe).style[t]=`${e}px`,Z(this,rr).style[t]=`${e+Z(this,Ar)*2}px`,Z(this,Oe).style[h]="100%",Z(this,rr).style[h]="100%",w.style[t]=`${Z(this,Ar)}px`,Z(this,Pe)&&(Z(this,Pe).element.style.margin="0",Z(this,Pe).element.style.left=Z(this,He)?"0":`${Z(this,Ar)}px`,Z(this,Pe).element.style.top=Z(this,He)?`${Z(this,Ar)}px`:"0",Z(this,Pe).element.style[t]=`${e}px`,Z(this,Pe).redraw())}else{const t=Z(this,He)?"width":"height",h=Z(this,He)?"height":"width",l=w.getBoundingClientRect()[t],{margin:i,gap:o}=Z(this,gi),r=Z(this,He)?`0 ${o}px`:`${i}px 0`;Z(this,rr).style.padding=r,Z(this,Oe).style[t]=`${l}px`,Z(this,rr).style[t]=`${l}px`,Z(this,Oe).style[h]="100%",Z(this,rr).style[h]="100%",Z(this,Pe)&&(Z(this,Pe).element.style.margin=r,Z(this,Pe).element.style.left="0",Z(this,Pe).element.style.top="0",Z(this,Pe).element.style[t]=`${l}px`,Z(this,Pe).redraw())}this.onExpand()}set overlayer(w){gt(this,Pe,w),Z(this,rr).append(w.element)}get overlayer(){return Z(this,Pe)}destroy(){this.document&&Z(this,es).unobserve(this.document.body)}}es=new WeakMap,rr=new WeakMap,Oe=new WeakMap,rs=new WeakMap,Pe=new WeakMap,He=new WeakMap,ns=new WeakMap,mi=new WeakMap,Ar=new WeakMap,gi=new WeakMap;var Wr,is,qr,gn,Je,bn,zn,ce,ur,xr,vn,Rr,kr,bi,$n,ss,os,as,vi,yn,Vn,yi,ls,At,Yc,Hs,Go,Ko,Yo,Jo,Ri,Jc,Yn,Jn,Qn,Qc,Ni,Qo,ta,Ws,tu,eu,Rn,ea;class da extends HTMLElement{constructor(){super();mt(this,At);mt(this,Wr,this.attachShadow({mode:"closed"}));mt(this,is,new ResizeObserver(()=>this.render()));mt(this,qr);mt(this,gn);mt(this,Je);mt(this,bn);mt(this,zn);mt(this,ce);mt(this,ur,!1);mt(this,xr,!1);mt(this,vn,0);mt(this,Rr,-1);mt(this,kr,0);mt(this,bi,!1);mt(this,$n,!1);mt(this,ss);mt(this,os,new WeakMap);mt(this,as,matchMedia("(prefers-color-scheme: dark)"));mt(this,vi);mt(this,yn);mt(this,Vn);mt(this,yi);mt(this,ls);Z(this,Wr).innerHTML=`<style>
182
182
  :host {
183
183
  display: block;
184
184
  container-type: size;
@@ -274,5 +274,5 @@ body:not(.notesBodyType) > .title, body:not(.notesBodyType) > .epigraph {
274
274
  <div id="container" part="container"></div>
275
275
  <div id="footer"></div>
276
276
  </div>
277
- `,gt(this,qr,Z(this,Wr).getElementById("top")),gt(this,gn,Z(this,Wr).getElementById("background")),gt(this,Je,Z(this,Wr).getElementById("container")),gt(this,bn,Z(this,Wr).getElementById("header")),gt(this,zn,Z(this,Wr).getElementById("footer")),Z(this,is).observe(Z(this,Je)),Z(this,Je).addEventListener("scroll",()=>this.dispatchEvent(new Event("scroll"))),Z(this,Je).addEventListener("scroll",vl(()=>{this.scrolled&&(Z(this,bi)?gt(this,bi,!1):ht(this,At,Ni).call(this,"scroll"))},250));const t={passive:!1};this.addEventListener("touchstart",ht(this,At,Ko).bind(this),t),this.addEventListener("touchmove",ht(this,At,Yo).bind(this),t),this.addEventListener("touchend",ht(this,At,Jo).bind(this)),this.addEventListener("load",({detail:{doc:d}})=>{d.addEventListener("touchstart",ht(this,At,Ko).bind(this),t),d.addEventListener("touchmove",ht(this,At,Yo).bind(this),t),d.addEventListener("touchend",ht(this,At,Jo).bind(this))}),this.addEventListener("relocate",({detail:d})=>{d.reason==="selection"?Ns(Z(this,kr),0):d.reason==="navigation"&&(Z(this,kr)===1?Ns(d.range,1):typeof Z(this,kr)=="number"?Ns(d.range,-1):Ns(Z(this,kr),-1))});const h=vl((d,l)=>{if(!l.rangeCount)return;const i=l.getRangeAt(0),o=kl(l);o&&i.compareBoundaryPoints(Range.START_TO_START,d)<0?this.prev():!o&&i.compareBoundaryPoints(Range.END_TO_END,d)>0&&this.next()},700);this.addEventListener("load",({detail:{doc:d}})=>{let l=!1;d.addEventListener("pointerdown",()=>l=!0),d.addEventListener("pointerup",()=>l=!1);let i=!1;d.addEventListener("keydown",()=>i=!0),d.addEventListener("keyup",()=>i=!1),d.addEventListener("selectionchange",()=>{if(this.scrolled)return;const o=Z(this,ls);if(!o)return;const r=d.getSelection();if(r.rangeCount){if(l&&r.type==="Range")h(o,r);else if(i){const e=r.getRangeAt(0).cloneRange();kl(r)||e.collapse(),ht(this,At,Qn).call(this,e)}}}),d.addEventListener("focusin",o=>this.scrolled?null:requestAnimationFrame(()=>ht(this,At,Qn).call(this,o.target)))}),gt(this,vi,()=>{Z(this,ce)&&ht(this,At,Hs).call(this,Z(this,ce).docBackground,this.columnCount)}),Z(this,as).addEventListener("change",Z(this,vi))}attributeChangedCallback(t,h,d){switch(t){case"flow":this.render();break;case"gap":case"margin":case"max-block-size":case"max-column-count":Z(this,qr).style.setProperty("--_"+t,d),this.render();break;case"max-inline-size":Z(this,qr).style.setProperty("--_"+t,d),this.render();break}}open(t){var h;this.bookDir=t.dir,this.sections=t.sections,(h=t.transformTarget)==null||h.addEventListener("data",({detail:d})=>{if(d.type!=="text/css")return;const l=innerWidth,i=innerHeight;d.data=Promise.resolve(d.data).then(o=>o.replace(new RegExp("(?<=[{\\s;])-epub-","gi"),"").replace(/(\d*\.?\d+)vw/gi,(r,e)=>parseFloat(e)*l/100+"px").replace(/(\d*\.?\d+)vh/gi,(r,e)=>parseFloat(e)*i/100+"px").replace(/page-break-(after|before|inside)\s*:/gi,(r,e)=>`-webkit-column-break-${e}:`).replace(/break-(after|before|inside)\s*:\s*(avoid-)?page/gi,(r,e,n)=>`break-${e}: ${n??""}column`))})}render(){Z(this,ce)&&(Z(this,ce).render(ht(this,At,Go).call(this,{vertical:Z(this,ur),rtl:Z(this,xr)})),ht(this,At,Qn).call(this,Z(this,kr)))}get scrolled(){return this.getAttribute("flow")==="scrolled"}get scrollProp(){const{scrolled:t}=this;return Z(this,ur)?t?"scrollLeft":"scrollTop":t?"scrollTop":"scrollLeft"}get sideProp(){const{scrolled:t}=this;return Z(this,ur)?t?"width":"height":t?"height":"width"}get size(){return Z(this,Je).getBoundingClientRect()[this.sideProp]}get viewSize(){return Z(this,ce).element.getBoundingClientRect()[this.sideProp]}get start(){return Math.abs(Z(this,Je)[this.scrollProp])}get end(){return this.start+this.size}get page(){return Math.floor((this.start+this.end)/2/this.size)}get pages(){return Math.round(this.viewSize/this.size)}get containerPosition(){return Z(this,Je)[this.scrollProp]}set containerPosition(t){Z(this,Je)[this.scrollProp]=t}scrollBy(t,h){const d=Z(this,ur)?h:t,[l,i,o]=Z(this,yn),r=Z(this,xr),e=r?l-o:l-i,n=r?l+i:l+o;this.containerPosition=Math.max(e,Math.min(n,this.containerPosition+d))}snap(t,h){const d=Z(this,ur)?h:t,[l,i,o]=Z(this,yn),{start:r,end:e,pages:n,size:c}=this,a=Math.abs(l)-i,s=Math.abs(l)+o,f=d*(Z(this,xr)?-c:c),p=Math.floor(Math.max(a,Math.min(s,(r+e)/2+(isNaN(f)?0:f)))/c);ht(this,At,Jn).call(this,p,"snap").then(()=>{const u=p<=0?-1:p>=n-1?1:null;if(u)return ht(this,At,Ws).call(this,{index:ht(this,At,Rn).call(this,u),anchor:u<0?()=>1:()=>0})})}async scrollToAnchor(t,h){return ht(this,At,Qn).call(this,t,h?"selection":"navigation")}async goTo(t){if(Z(this,$n))return;const h=await t;if(ht(this,At,ta).call(this,h.index))return ht(this,At,Ws).call(this,h)}get atStart(){return ht(this,At,Rn).call(this,-1)==null&&this.page<=1}get atEnd(){return ht(this,At,Rn).call(this,1)==null&&this.page>=this.pages-2}async prev(t){return await ht(this,At,ea).call(this,-1,t)}async next(t){return await ht(this,At,ea).call(this,1,t)}prevSection(){return this.goTo({index:ht(this,At,Rn).call(this,-1)})}nextSection(){return this.goTo({index:ht(this,At,Rn).call(this,1)})}firstSection(){const t=this.sections.findIndex(h=>h.linear!=="no");return this.goTo({index:t})}lastSection(){const t=this.sections.findLastIndex(h=>h.linear!=="no");return this.goTo({index:t})}getContents(){return Z(this,ce)?[{index:Z(this,Nr),overlayer:Z(this,ce).overlayer,doc:Z(this,ce).document}]:[]}setStyles(t){var i,o,r,e,n;gt(this,ss,t);const h=Z(this,os).get((i=Z(this,ce))==null?void 0:i.document);if(!h)return;const[d,l]=h;if(Array.isArray(t)){const[c,a]=t;d.textContent=c,l.textContent=a}else l.textContent=t;requestAnimationFrame(()=>{ht(this,At,Hs).call(this,Z(this,ce).docBackground,this.columnCount)}),(n=(e=(r=(o=Z(this,ce))==null?void 0:o.document)==null?void 0:r.fonts)==null?void 0:e.ready)==null||n.then(()=>Z(this,ce).expand())}focusView(){Z(this,ce).document.defaultView.focus()}destroy(){var t,h;Z(this,is).unobserve(this),Z(this,ce).destroy(),gt(this,ce,null),(h=(t=this.sections[Z(this,Nr)])==null?void 0:t.unload)==null||h.call(t),Z(this,as).removeEventListener("change",Z(this,vi))}}Wr=new WeakMap,is=new WeakMap,qr=new WeakMap,gn=new WeakMap,Je=new WeakMap,bn=new WeakMap,zn=new WeakMap,ce=new WeakMap,ur=new WeakMap,xr=new WeakMap,vn=new WeakMap,Nr=new WeakMap,kr=new WeakMap,bi=new WeakMap,$n=new WeakMap,ss=new WeakMap,os=new WeakMap,as=new WeakMap,vi=new WeakMap,yn=new WeakMap,Vn=new WeakMap,yi=new WeakMap,ls=new WeakMap,At=new WeakSet,Kc=function(){return Z(this,ce)&&(Z(this,ce).destroy(),Z(this,Je).removeChild(Z(this,ce).element)),gt(this,ce,new Pb({container:this,onExpand:()=>ht(this,At,Qn).call(this,Z(this,kr))})),Z(this,Je).append(Z(this,ce).element),Z(this,ce)},Hs=function(t,h){var o;const d=(o=Z(this,ce))==null?void 0:o.document;if(!d)return;const i=d.defaultView.getComputedStyle(d.documentElement).getPropertyValue("--theme-bg-color");if(t&&i){const r=t.split(/\s(?=(?:url|rgb|hsl|#[0-9a-fA-F]{3,6}))/);r[0]=i,t=r.join(" ")}/cover.*fixed|fixed.*cover/.test(t)&&(t=t.replace("cover","auto 100%").replace("fixed","")),Z(this,gn).innerHTML="",Z(this,gn).style.display="grid",Z(this,gn).style.gridTemplateColumns=`repeat(${h}, 1fr)`;for(let r=0;r<h;r++){const e=document.createElement("div");e.style.background=t,e.style.width="100%",e.style.height="100%",Z(this,gn).appendChild(e)}},Go=function({vertical:t,rtl:h,background:d}){gt(this,ur,t),gt(this,xr,h),Z(this,qr).classList.toggle("vertical",t);const{width:l,height:i}=Z(this,Je).getBoundingClientRect(),o=t?i:l,r=getComputedStyle(Z(this,qr)),e=parseFloat(r.getPropertyValue("--_max-inline-size")),n=parseInt(r.getPropertyValue("--_max-column-count-spread")),c=parseFloat(r.getPropertyValue("--_margin"));gt(this,vn,c);const a=parseFloat(r.getPropertyValue("--_gap"))/100,s=-a/(a-1)*o,f=this.getAttribute("flow");if(f==="scrolled"){this.setAttribute("dir",t?"rtl":"ltr"),Z(this,qr).style.padding="0";const R=e;return this.heads=null,this.feet=null,Z(this,bn).replaceChildren(),Z(this,zn).replaceChildren(),{flow:f,margin:c,gap:s,columnWidth:R}}const p=Math.min(n,Math.ceil(o/e)),u=t?o/p-c:o/p-s;this.setAttribute("dir",h?"rtl":"ltr"),this.columnCount=p,ht(this,At,Hs).call(this,d,this.columnCount);const g=t?Math.min(2,Math.ceil(l/e)):p,m={gridTemplateColumns:`repeat(${g}, 1fr)`,gap:`${s}px`,direction:this.bookDir==="rtl"?"rtl":"ltr"};Object.assign(Z(this,bn).style,m),Object.assign(Z(this,zn).style,m);const v=Sl(g,"head"),S=Sl(g,"foot");return this.heads=v.map(R=>R.children[0]),this.feet=S.map(R=>R.children[0]),Z(this,bn).replaceChildren(...v),Z(this,zn).replaceChildren(...S),{height:i,width:l,margin:c,gap:s,columnWidth:u}},Ko=function(t){const h=t.changedTouches[0];gt(this,Vn,{x:h==null?void 0:h.screenX,y:h==null?void 0:h.screenY,t:t.timeStamp,vx:0,xy:0})},Yo=function(t){var a;const h=Z(this,Vn);if(h.pinched||(h.pinched=globalThis.visualViewport.scale>1,this.scrolled||h.pinched))return;if(t.touches.length>1){Z(this,yi)&&t.preventDefault();return}const d=(a=Z(this,ce))==null?void 0:a.document,l=d==null?void 0:d.getSelection();if(l&&l.rangeCount>0&&!l.isCollapsed)return;t.preventDefault();const i=t.changedTouches[0],o=i.screenX,r=i.screenY,e=h.x-o,n=h.y-r,c=t.timeStamp-h.t;h.x=o,h.y=r,h.t=t.timeStamp,h.vx=e/c,h.vy=n/c,gt(this,yi,!0),Math.abs(e)>=Math.abs(n)?this.scrollBy(e,0):Math.abs(n)>Math.abs(e)&&this.scrollBy(0,n)},Jo=function(){gt(this,yi,!1),!this.scrolled&&requestAnimationFrame(()=>{globalThis.visualViewport.scale===1&&this.snap(Z(this,Vn).vx,Z(this,Vn).vy)})},Ri=function(){if(this.scrolled){const h=this.viewSize,d=Z(this,vn);return Z(this,ur)?({left:l,right:i})=>({left:h-i-d,right:h-l-d}):({top:l,bottom:i})=>({left:l+d,right:i+d})}const t=this.pages*this.size;return Z(this,xr)?({left:h,right:d})=>({left:t-d,right:t-h}):Z(this,ur)?({top:h,bottom:d})=>({left:h,right:d}):h=>h},Yc=async function(t,h){if(this.scrolled){const l=ht(this,At,Ri).call(this)(t).left-Z(this,vn);return ht(this,At,Yn).call(this,l,h)}const d=ht(this,At,Ri).call(this)(t).left;return ht(this,At,Jn).call(this,Math.floor(d/this.size)+(Z(this,xr)?-1:1),h)},Yn=async function(t,h,d){const{size:l}=this;if(this.containerPosition===t){gt(this,yn,[t,this.atStart?0:l,this.atEnd?0:l]),ht(this,At,Ni).call(this,h);return}if(this.scrolled&&Z(this,ur)&&(t=-t),(h==="snap"||d)&&this.hasAttribute("animated"))return Mb(this.containerPosition,t,300,Tb,i=>this.containerPosition=i).then(()=>{gt(this,yn,[t,this.atStart?0:l,this.atEnd?0:l]),ht(this,At,Ni).call(this,h)});this.containerPosition=t,gt(this,yn,[t,this.atStart?0:l,this.atEnd?0:l]),ht(this,At,Ni).call(this,h)},Jn=async function(t,h,d){const l=this.size*(Z(this,xr)?-t:t);return ht(this,At,Yn).call(this,l,h,d)},Qn=async function(t,h="anchor"){var r,e;gt(this,kr,t);const d=(e=(r=Ab(t))==null?void 0:r.getClientRects)==null?void 0:e.call(r);if(d){const n=Array.from(d).find(c=>c.width>0&&c.height>0)||d[0];if(!n)return;await ht(this,At,Yc).call(this,n,h);return}if(this.scrolled){await ht(this,At,Yn).call(this,t*this.viewSize,h);return}const{pages:l}=this;if(!l)return;const i=l-2,o=Math.round(t*(i-1));await ht(this,At,Jn).call(this,o+1,h)},Jc=function(){if(this.scrolled)return xl(Z(this,ce).document,this.start+Z(this,vn),this.end-Z(this,vn),ht(this,At,Ri).call(this));const t=Z(this,xr)?-this.size:this.size;return xl(Z(this,ce).document,this.start-t,this.end-t,ht(this,At,Ri).call(this))},Ni=function(t){const h=ht(this,At,Jc).call(this);gt(this,ls,h),t!=="selection"&&t!=="navigation"&&t!=="anchor"?gt(this,kr,h):gt(this,bi,!0);const d=Z(this,Nr),l={reason:t,range:h,index:d};if(this.scrolled)l.fraction=this.start/this.viewSize;else if(this.pages>0){const{page:i,pages:o}=this;Z(this,bn).style.visibility=i>1?"visible":"hidden",l.fraction=(i-1)/(o-2),l.size=1/(o-2)}this.dispatchEvent(new CustomEvent("relocate",{detail:l}))},Qo=async function(t){var e,n;const{index:h,src:d,anchor:l,onLoad:i,select:o}=await t;gt(this,Nr,h);const r=(n=(e=Z(this,ce))==null?void 0:e.document)==null?void 0:n.hasFocus();if(d){const c=ht(this,At,Kc).call(this),a=f=>{if(f.head){const p=f.createElement("style");f.head.prepend(p);const u=f.createElement("style");f.head.append(u),Z(this,os).set(f,[p,u])}i==null||i({doc:f,index:h})},s=ht(this,At,Go).bind(this);await c.load(d,a,s),this.dispatchEvent(new CustomEvent("create-overlayer",{detail:{doc:c.document,index:h,attach:f=>c.overlayer=f}})),gt(this,ce,c)}await this.scrollToAnchor((typeof l=="function"?l(Z(this,ce).document):l)??0,o),r&&this.focusView()},ta=function(t){return t>=0&&t<=this.sections.length-1},Ws=async function({index:t,anchor:h,select:d}){if(t===Z(this,Nr))await ht(this,At,Qo).call(this,{index:t,anchor:h,select:d});else{const l=Z(this,Nr),i=o=>{var r,e;(e=(r=this.sections[l])==null?void 0:r.unload)==null||e.call(r),this.setStyles(Z(this,ss)),this.dispatchEvent(new CustomEvent("load",{detail:o}))};await ht(this,At,Qo).call(this,Promise.resolve(this.sections[t].load()).then(o=>({index:t,src:o,anchor:h,onLoad:i,select:d})).catch(o=>(console.warn(o),console.warn(new Error(`Failed to load section ${t}`)),{})))}},Qc=function(t){if(!Z(this,ce))return!0;if(this.scrolled)return this.start>0?ht(this,At,Yn).call(this,Math.max(0,this.start-(t??this.size)),null,!0):!this.atStart;if(this.atStart)return;const h=this.page-1;return ht(this,At,Jn).call(this,h,"page",!0).then(()=>h<=0)},tu=function(t){if(!Z(this,ce))return!0;if(this.scrolled)return this.viewSize-this.end>2?ht(this,At,Yn).call(this,Math.min(this.viewSize,t?this.start+t:this.end),null,!0):!this.atEnd;if(this.atEnd)return;const h=this.page+1,d=this.pages;return ht(this,At,Jn).call(this,h,"page",!0).then(()=>h>=d-1)},Rn=function(t){var h;for(let d=Z(this,Nr)+t;ht(this,At,ta).call(this,d);d+=t)if(((h=this.sections[d])==null?void 0:h.linear)!=="no")return d},ea=async function(t,h){if(Z(this,$n))return;gt(this,$n,!0);const d=t===-1,l=await(d?ht(this,At,Qc).call(this,h):ht(this,At,tu).call(this,h));l&&await ht(this,At,Ws).call(this,{index:ht(this,At,Rn).call(this,t),anchor:d?()=>1:()=>0}),(l||!this.hasAttribute("animated"))&&await Eb(100),gt(this,$n,!1)},De(da,"observedAttributes",["flow","gap","margin","max-inline-size","max-block-size","max-column-count"]);customElements.define("foliate-paginator",da);const Fb=Object.freeze(Object.defineProperty({__proto__:null,Paginator:da},Symbol.toStringTag,{value:"Module"})),Os=50,El=C=>C.replace(/\s+/g," "),eu=(C,{startIndex:w,startOffset:t,endIndex:h,endOffset:d})=>{const l=C[w],i=C[h],o=l===i?l.slice(t,d):l.slice(t)+C.slice(l+1,i).join("")+i.slice(0,d),r=El(l.slice(0,t)).trimStart(),e=El(i.slice(d)).trimEnd(),n=r.length<Os?"":"…",c=e.length<Os?"":"…",a=`${n}${r.slice(-Os)}`,s=`${e.slice(0,Os)}${c}`;return{pre:a,match:o,post:s}},Db=function*(C,w,t={}){const{locales:h="en",sensitivity:d}=t,l=d==="variant",i=C.join(""),o=l?i:i.toLocaleLowerCase(h),r=l?w:w.toLocaleLowerCase(h),e=r.length;let n=-1,c=-1,a=0;do if(n=o.indexOf(r,n+1),n>-1){for(;a<=n;)a+=C[++c].length;const s=c,f=n-(a-C[c].length),p=n+e;for(;a<=p;)a+=C[++c].length;const u=c,g=p-(a-C[c].length),m={startIndex:s,startOffset:f,endIndex:u,endOffset:g};yield{range:m,excerpt:eu(C,m)}}while(n>-1)},Lb=function*(C,w,t={}){var a;const{locales:h="en",granularity:d="word",sensitivity:l="base"}=t;let i,o;try{i=new Intl.Segmenter(h,{usage:"search",granularity:d}),o=new Intl.Collator(h,{sensitivity:l})}catch(s){console.warn(s),i=new Intl.Segmenter("en",{usage:"search",granularity:d}),o=new Intl.Collator("en",{sensitivity:l})}const r=Array.from(i.segment(w)).length,e=[];let n=0,c=i.segment(C[n])[Symbol.iterator]();t:for(;n<C.length;){for(;e.length<r;){const{done:f,value:p}=c.next();if(f)if(n++,n<C.length){c=i.segment(C[n])[Symbol.iterator]();continue}else break t;const{index:u,segment:g}=p;if(/[^\p{Format}]/u.test(g)){if(/\s/u.test(g)){/\s/u.test((a=e[e.length-1])==null?void 0:a.segment)||e.push({strIndex:n,index:u,segment:" "});continue}p.strIndex=n,e.push(p)}}const s=e.map(f=>f.segment).join("");if(o.compare(w,s)===0){const f=n,p=e[e.length-1],u=p.index+p.segment.length,g=e[0].strIndex,m=e[0].index,v={startIndex:g,startOffset:m,endIndex:f,endOffset:u};yield{range:v,excerpt:eu(C,v)}}e.shift()}},ru=(C,w,t)=>{const{granularity:h="grapheme",sensitivity:d="base"}=t;return!(Intl!=null&&Intl.Segmenter)||h==="grapheme"&&(d==="variant"||d==="accent")?Db(C,w,t):Lb(C,w,t)},zb=(C,w)=>{const{defaultLocale:t,matchCase:h,matchDiacritics:d,matchWholeWords:l}=w;return function*(i,o){const r=C(i,function*(e,n){for(const c of ru(e,o,{locales:i.body.lang||i.documentElement.lang||t||"en",granularity:l?"word":"grapheme",sensitivity:d&&h?"variant":d&&!h?"accent":!d&&h?"case":"base"})){const{startIndex:a,startOffset:s,endIndex:f,endOffset:p}=c.range;c.range=n(a,s,f,p),yield c}});for(const e of r)yield e}},$b=Object.freeze(Object.defineProperty({__proto__:null,search:ru,searchMatcher:zb},Symbol.toStringTag,{value:"Module"})),Ge={XML:"http://www.w3.org/XML/1998/namespace",SSML:"http://www.w3.org/2001/10/synthesis"},Vb=new Set(["article","aside","audio","blockquote","caption","details","dialog","div","dl","dt","dd","figure","footer","form","figcaption","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","math","nav","ol","p","pre","section","tr"]),nu=C=>{var t;const w=C.lang||((t=C==null?void 0:C.getAttributeNS)==null?void 0:t.call(C,Ge.XML,"lang"));return w||(C.parentElement?nu(C.parentElement):null)},iu=C=>{var t;const w=(t=C==null?void 0:C.getAttributeNS)==null?void 0:t.call(C,Ge.XML,"lang");return w||(C.parentElement?iu(C.parentElement):null)},Ub=(C="en",w="word")=>{const t=new Intl.Segmenter(C,{granularity:w}),h=w==="word";return function*(d,l){var a;const i=d.join("").replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ");let o=0,r=-1,e=0;const n=Array.from(t.segment(i)),c=[];for(let s=0;s<n.length;s++){const f=n[s],p=n[s+1],u=f.segment.trim(),g=(a=p==null?void 0:p.segment)==null?void 0:a.trim(),m=/(?:^|\s)([A-Z][a-z]{1,5})\.$/.test(u),v=/^[A-Z]/.test(g||"");if(m&&v){const S={index:f.index,segment:f.segment+((p==null?void 0:p.segment)||""),isWordLike:!0};c.push(S),s++}else c.push(f)}for(const{index:s,segment:f,isWordLike:p}of c){if(h&&!p)continue;for(;e<=s;)e+=d[++r].length;const u=r,g=s-(e-d[r].length),m=s+f.length-1;if(m<i.length)for(;e<=m;)e+=d[++r].length;const v=r,S=m-(e-d[r].length)+1;yield[(o++).toString(),l(u,g,v,S)]}}},Hb=(C,w)=>{const t=document.implementation.createDocument(Ge.SSML,"speak"),{lang:h}=w;h&&t.documentElement.setAttributeNS(Ge.XML,"lang",h);const d=(l,i,o)=>{if(!l)return;if(l.nodeType===3)return t.createTextNode(l.textContent);if(l.nodeType===4)return t.createCDATASection(l.textContent);if(l.nodeType!==1)return;let r;const e=l.nodeName.toLowerCase();e==="foliate-mark"?(r=t.createElementNS(Ge.SSML,"mark"),r.setAttribute("name",l.dataset.name)):e==="br"?r=t.createElementNS(Ge.SSML,"break"):(e==="em"||e==="strong")&&(r=t.createElementNS(Ge.SSML,"emphasis"));const n=l.lang||l.getAttributeNS(Ge.XML,"lang");n&&(r||(r=t.createElementNS(Ge.SSML,"lang")),r.setAttributeNS(Ge.XML,"lang",n));const c=l.getAttributeNS(Ge.SSML,"alphabet")||o;if(!r){const s=l.getAttributeNS(Ge.SSML,"ph");s&&(r=t.createElementNS(Ge.SSML,"phoneme"),c&&r.setAttribute("alphabet",c),r.setAttribute("ph",s))}r||(r=i);let a=l.firstChild;for(;a;){const s=d(a,r,c);s&&r!==s&&r.append(s),a=a.nextSibling}return r};return d(C.firstChild,t.documentElement,w.alphabet),t},Wb=(C,w,t)=>{const h=nu(C.commonAncestorContainer),d=iu(C.commonAncestorContainer),l=Ub(h,t),i=C.cloneContents(),o=[...w(C,l)],r=[...w(i,l)];for(const[n,c]of r){const a=document.createElement("foliate-mark");a.dataset.name=n,c.insertNode(a)}const e=Hb(i,{lang:h,alphabet:d});return{entries:o,ssml:e}},Cl=C=>!C.toString().trim();function*qb(C){let w;const t=C.createTreeWalker(C.body,NodeFilter.SHOW_ELEMENT);for(let h=t.nextNode();h;h=t.nextNode()){const d=h.tagName.toLowerCase();Vb.has(d)&&(w&&(w.setEndBefore(h),Cl(w)||(yield w)),w=C.createRange(),w.setStart(h,0))}w||(w=C.createRange(),w.setStart(C.body.firstChild??C.body,0)),w.setEndAfter(C.body.lastChild??C.body),Cl(w)||(yield w)}var je,wi,nr,Sr;class Xb{constructor(w,t=h=>h){mt(this,je,[]);mt(this,wi);mt(this,nr,-1);mt(this,Sr);gt(this,wi,w),gt(this,Sr,t)}current(){if(Z(this,je)[Z(this,nr)])return Z(this,Sr).call(this,Z(this,je)[Z(this,nr)])}first(){if(Z(this,je)[0])return gt(this,nr,0),Z(this,Sr).call(this,Z(this,je)[0])}prev(){const w=Z(this,nr)-1;if(Z(this,je)[w])return gt(this,nr,w),Z(this,Sr).call(this,Z(this,je)[w])}next(){const w=Z(this,nr)+1;if(Z(this,je)[w])return gt(this,nr,w),Z(this,Sr).call(this,Z(this,je)[w]);for(;;){const{done:t,value:h}=Z(this,wi).next();if(t)break;if(Z(this,je).push(h),Z(this,je)[w])return gt(this,nr,w),Z(this,Sr).call(this,Z(this,je)[w])}}find(w){const t=Z(this,je).findIndex(h=>w(h));if(t>-1)return gt(this,nr,t),Z(this,Sr).call(this,Z(this,je)[t]);for(;;){const{done:h,value:d}=Z(this,wi).next();if(h)break;if(Z(this,je).push(d),w(d))return gt(this,nr,Z(this,je).length-1),Z(this,Sr).call(this,d)}}}je=new WeakMap,wi=new WeakMap,nr=new WeakMap,Sr=new WeakMap;var Xr,_i,Or,cs,dr,qs,ti;class Zb{constructor(w,t,h,d){mt(this,dr);mt(this,Xr);mt(this,_i);mt(this,Or);mt(this,cs,new XMLSerializer);this.doc=w,this.highlight=h,gt(this,Xr,new Xb(qb(w),l=>{const{entries:i,ssml:o}=Wb(l,t,d);return gt(this,_i,new Map(i)),[o,l]}))}start(){gt(this,Or,null);const[w]=Z(this,Xr).first()??[];return w?ht(this,dr,ti).call(this,w,t=>ht(this,dr,qs).call(this,t,Z(this,Or))):this.next()}resume(){const[w]=Z(this,Xr).current()??[];return w?ht(this,dr,ti).call(this,w,t=>ht(this,dr,qs).call(this,t,Z(this,Or))):this.next()}prev(w){gt(this,Or,null);const[t,h]=Z(this,Xr).prev()??[];return w&&h&&this.highlight(h.cloneRange()),ht(this,dr,ti).call(this,t)}next(w){gt(this,Or,null);const[t,h]=Z(this,Xr).next()??[];return w&&h&&this.highlight(h.cloneRange()),ht(this,dr,ti).call(this,t)}from(w){gt(this,Or,null);const[t]=Z(this,Xr).find(d=>w.compareBoundaryPoints(Range.END_TO_START,d)<=0);let h;for(const[d,l]of Z(this,_i).entries())if(w.compareBoundaryPoints(Range.START_TO_START,l)<=0){h=d;break}return ht(this,dr,ti).call(this,t,d=>ht(this,dr,qs).call(this,d,h))}setMark(w){const t=Z(this,_i).get(w);t&&(gt(this,Or,w),this.highlight(t.cloneRange()))}}Xr=new WeakMap,_i=new WeakMap,Or=new WeakMap,cs=new WeakMap,dr=new WeakSet,qs=function(w,t){return t?w.querySelector(`mark[name="${CSS.escape(t)}"`):null},ti=function(w,t){var l,i;if(!w)return;if(!t)return Z(this,cs).serializeToString(w);const h=document.implementation.createDocument(Ge.SSML,"speak");h.documentElement.replaceWith(h.importNode(w.documentElement,!0));let d=(l=t(h))==null?void 0:l.previousSibling;for(;d;){const o=d.previousSibling??((i=d.parentNode)==null?void 0:i.previousSibling);d.parentNode.removeChild(d),d=o}return Z(this,cs).serializeToString(h)};const Gb=Object.freeze(Object.defineProperty({__proto__:null,TTS:Zb},Symbol.toStringTag,{value:"Module"}));exports.FilePreviewContent=uo;exports.FilePreviewEmbed=e1;exports.FilePreviewModal=Q0;exports.LOCALE_KEY=ao;exports.VERSION=r1;exports.configurePdfWorker=Nl;exports.getFileType=na;exports.normalizeFile=Ml;exports.normalizeFiles=Al;exports.provideLocale=Ol;exports.useTranslator=Te;
277
+ `,gt(this,qr,Z(this,Wr).getElementById("top")),gt(this,gn,Z(this,Wr).getElementById("background")),gt(this,Je,Z(this,Wr).getElementById("container")),gt(this,bn,Z(this,Wr).getElementById("header")),gt(this,zn,Z(this,Wr).getElementById("footer")),Z(this,is).observe(Z(this,Je)),Z(this,Je).addEventListener("scroll",()=>this.dispatchEvent(new Event("scroll"))),Z(this,Je).addEventListener("scroll",vl(()=>{this.scrolled&&(Z(this,bi)?gt(this,bi,!1):ht(this,At,Ni).call(this,"scroll"))},250));const t={passive:!1};this.addEventListener("touchstart",ht(this,At,Ko).bind(this),t),this.addEventListener("touchmove",ht(this,At,Yo).bind(this),t),this.addEventListener("touchend",ht(this,At,Jo).bind(this)),this.addEventListener("load",({detail:{doc:d}})=>{d.addEventListener("touchstart",ht(this,At,Ko).bind(this),t),d.addEventListener("touchmove",ht(this,At,Yo).bind(this),t),d.addEventListener("touchend",ht(this,At,Jo).bind(this))}),this.addEventListener("relocate",({detail:d})=>{d.reason==="selection"?Ns(Z(this,kr),0):d.reason==="navigation"&&(Z(this,kr)===1?Ns(d.range,1):typeof Z(this,kr)=="number"?Ns(d.range,-1):Ns(Z(this,kr),-1))});const h=vl((d,l)=>{if(!l.rangeCount)return;const i=l.getRangeAt(0),o=kl(l);o&&i.compareBoundaryPoints(Range.START_TO_START,d)<0?this.prev():!o&&i.compareBoundaryPoints(Range.END_TO_END,d)>0&&this.next()},700);this.addEventListener("load",({detail:{doc:d}})=>{let l=!1;d.addEventListener("pointerdown",()=>l=!0),d.addEventListener("pointerup",()=>l=!1);let i=!1;d.addEventListener("keydown",()=>i=!0),d.addEventListener("keyup",()=>i=!1),d.addEventListener("selectionchange",()=>{if(this.scrolled)return;const o=Z(this,ls);if(!o)return;const r=d.getSelection();if(r.rangeCount){if(l&&r.type==="Range")h(o,r);else if(i){const e=r.getRangeAt(0).cloneRange();kl(r)||e.collapse(),ht(this,At,Qn).call(this,e)}}}),d.addEventListener("focusin",o=>this.scrolled?null:requestAnimationFrame(()=>ht(this,At,Qn).call(this,o.target)))}),gt(this,vi,()=>{Z(this,ce)&&ht(this,At,Hs).call(this,Z(this,ce).docBackground,this.columnCount)}),Z(this,as).addEventListener("change",Z(this,vi))}attributeChangedCallback(t,h,d){switch(t){case"flow":this.render();break;case"gap":case"margin":case"max-block-size":case"max-column-count":Z(this,qr).style.setProperty("--_"+t,d),this.render();break;case"max-inline-size":Z(this,qr).style.setProperty("--_"+t,d),this.render();break}}open(t){var h;this.bookDir=t.dir,this.sections=t.sections,(h=t.transformTarget)==null||h.addEventListener("data",({detail:d})=>{if(d.type!=="text/css")return;const l=innerWidth,i=innerHeight;d.data=Promise.resolve(d.data).then(o=>o.replace(new RegExp("(?<=[{\\s;])-epub-","gi"),"").replace(/(\d*\.?\d+)vw/gi,(r,e)=>parseFloat(e)*l/100+"px").replace(/(\d*\.?\d+)vh/gi,(r,e)=>parseFloat(e)*i/100+"px").replace(/page-break-(after|before|inside)\s*:/gi,(r,e)=>`-webkit-column-break-${e}:`).replace(/break-(after|before|inside)\s*:\s*(avoid-)?page/gi,(r,e,n)=>`break-${e}: ${n??""}column`))})}render(){Z(this,ce)&&(Z(this,ce).render(ht(this,At,Go).call(this,{vertical:Z(this,ur),rtl:Z(this,xr)})),ht(this,At,Qn).call(this,Z(this,kr)))}get scrolled(){return this.getAttribute("flow")==="scrolled"}get scrollProp(){const{scrolled:t}=this;return Z(this,ur)?t?"scrollLeft":"scrollTop":t?"scrollTop":"scrollLeft"}get sideProp(){const{scrolled:t}=this;return Z(this,ur)?t?"width":"height":t?"height":"width"}get size(){return Z(this,Je).getBoundingClientRect()[this.sideProp]}get viewSize(){return Z(this,ce).element.getBoundingClientRect()[this.sideProp]}get start(){return Math.abs(Z(this,Je)[this.scrollProp])}get end(){return this.start+this.size}get page(){return Math.floor((this.start+this.end)/2/this.size)}get pages(){return Math.round(this.viewSize/this.size)}get containerPosition(){return Z(this,Je)[this.scrollProp]}set containerPosition(t){Z(this,Je)[this.scrollProp]=t}scrollBy(t,h){const d=Z(this,ur)?h:t,[l,i,o]=Z(this,yn),r=Z(this,xr),e=r?l-o:l-i,n=r?l+i:l+o;this.containerPosition=Math.max(e,Math.min(n,this.containerPosition+d))}snap(t,h){const d=Z(this,ur)?h:t,[l,i,o]=Z(this,yn),{start:r,end:e,pages:n,size:c}=this,a=Math.abs(l)-i,s=Math.abs(l)+o,f=d*(Z(this,xr)?-c:c),p=Math.floor(Math.max(a,Math.min(s,(r+e)/2+(isNaN(f)?0:f)))/c);ht(this,At,Jn).call(this,p,"snap").then(()=>{const u=p<=0?-1:p>=n-1?1:null;if(u)return ht(this,At,Ws).call(this,{index:ht(this,At,Rn).call(this,u),anchor:u<0?()=>1:()=>0})})}async scrollToAnchor(t,h){return ht(this,At,Qn).call(this,t,h?"selection":"navigation")}async goTo(t){if(Z(this,$n))return;const h=await t;if(ht(this,At,ta).call(this,h.index))return ht(this,At,Ws).call(this,h)}get atStart(){return ht(this,At,Rn).call(this,-1)==null&&this.page<=1}get atEnd(){return ht(this,At,Rn).call(this,1)==null&&this.page>=this.pages-2}async prev(t){return await ht(this,At,ea).call(this,-1,t)}async next(t){return await ht(this,At,ea).call(this,1,t)}prevSection(){return this.goTo({index:ht(this,At,Rn).call(this,-1)})}nextSection(){return this.goTo({index:ht(this,At,Rn).call(this,1)})}firstSection(){const t=this.sections.findIndex(h=>h.linear!=="no");return this.goTo({index:t})}lastSection(){const t=this.sections.findLastIndex(h=>h.linear!=="no");return this.goTo({index:t})}getContents(){return Z(this,ce)?[{index:Z(this,Rr),overlayer:Z(this,ce).overlayer,doc:Z(this,ce).document}]:[]}setStyles(t){var i,o,r,e,n;gt(this,ss,t);const h=Z(this,os).get((i=Z(this,ce))==null?void 0:i.document);if(!h)return;const[d,l]=h;if(Array.isArray(t)){const[c,a]=t;d.textContent=c,l.textContent=a}else l.textContent=t;requestAnimationFrame(()=>{ht(this,At,Hs).call(this,Z(this,ce).docBackground,this.columnCount)}),(n=(e=(r=(o=Z(this,ce))==null?void 0:o.document)==null?void 0:r.fonts)==null?void 0:e.ready)==null||n.then(()=>Z(this,ce).expand())}focusView(){Z(this,ce).document.defaultView.focus()}destroy(){var t,h;Z(this,is).unobserve(this),Z(this,ce).destroy(),gt(this,ce,null),(h=(t=this.sections[Z(this,Rr)])==null?void 0:t.unload)==null||h.call(t),Z(this,as).removeEventListener("change",Z(this,vi))}}Wr=new WeakMap,is=new WeakMap,qr=new WeakMap,gn=new WeakMap,Je=new WeakMap,bn=new WeakMap,zn=new WeakMap,ce=new WeakMap,ur=new WeakMap,xr=new WeakMap,vn=new WeakMap,Rr=new WeakMap,kr=new WeakMap,bi=new WeakMap,$n=new WeakMap,ss=new WeakMap,os=new WeakMap,as=new WeakMap,vi=new WeakMap,yn=new WeakMap,Vn=new WeakMap,yi=new WeakMap,ls=new WeakMap,At=new WeakSet,Yc=function(){return Z(this,ce)&&(Z(this,ce).destroy(),Z(this,Je).removeChild(Z(this,ce).element)),gt(this,ce,new Ab({container:this,onExpand:()=>ht(this,At,Qn).call(this,Z(this,kr))})),Z(this,Je).append(Z(this,ce).element),Z(this,ce)},Hs=function(t,h){var o;const d=(o=Z(this,ce))==null?void 0:o.document;if(!d)return;const i=d.defaultView.getComputedStyle(d.documentElement).getPropertyValue("--theme-bg-color");if(t&&i){const r=t.split(/\s(?=(?:url|rgb|hsl|#[0-9a-fA-F]{3,6}))/);r[0]=i,t=r.join(" ")}/cover.*fixed|fixed.*cover/.test(t)&&(t=t.replace("cover","auto 100%").replace("fixed","")),Z(this,gn).innerHTML="",Z(this,gn).style.display="grid",Z(this,gn).style.gridTemplateColumns=`repeat(${h}, 1fr)`;for(let r=0;r<h;r++){const e=document.createElement("div");e.style.background=t,e.style.width="100%",e.style.height="100%",Z(this,gn).appendChild(e)}},Go=function({vertical:t,rtl:h,background:d}){gt(this,ur,t),gt(this,xr,h),Z(this,qr).classList.toggle("vertical",t);const{width:l,height:i}=Z(this,Je).getBoundingClientRect(),o=t?i:l,r=getComputedStyle(Z(this,qr)),e=parseFloat(r.getPropertyValue("--_max-inline-size")),n=parseInt(r.getPropertyValue("--_max-column-count-spread")),c=parseFloat(r.getPropertyValue("--_margin"));gt(this,vn,c);const a=parseFloat(r.getPropertyValue("--_gap"))/100,s=-a/(a-1)*o,f=this.getAttribute("flow");if(f==="scrolled"){this.setAttribute("dir",t?"rtl":"ltr"),Z(this,qr).style.padding="0";const R=e;return this.heads=null,this.feet=null,Z(this,bn).replaceChildren(),Z(this,zn).replaceChildren(),{flow:f,margin:c,gap:s,columnWidth:R}}const p=Math.min(n,Math.ceil(o/e)),u=t?o/p-c:o/p-s;this.setAttribute("dir",h?"rtl":"ltr"),this.columnCount=p,ht(this,At,Hs).call(this,d,this.columnCount);const g=t?Math.min(2,Math.ceil(l/e)):p,m={gridTemplateColumns:`repeat(${g}, 1fr)`,gap:`${s}px`,direction:this.bookDir==="rtl"?"rtl":"ltr"};Object.assign(Z(this,bn).style,m),Object.assign(Z(this,zn).style,m);const v=Sl(g,"head"),S=Sl(g,"foot");return this.heads=v.map(R=>R.children[0]),this.feet=S.map(R=>R.children[0]),Z(this,bn).replaceChildren(...v),Z(this,zn).replaceChildren(...S),{height:i,width:l,margin:c,gap:s,columnWidth:u}},Ko=function(t){const h=t.changedTouches[0];gt(this,Vn,{x:h==null?void 0:h.screenX,y:h==null?void 0:h.screenY,t:t.timeStamp,vx:0,xy:0})},Yo=function(t){var a;const h=Z(this,Vn);if(h.pinched||(h.pinched=globalThis.visualViewport.scale>1,this.scrolled||h.pinched))return;if(t.touches.length>1){Z(this,yi)&&t.preventDefault();return}const d=(a=Z(this,ce))==null?void 0:a.document,l=d==null?void 0:d.getSelection();if(l&&l.rangeCount>0&&!l.isCollapsed)return;t.preventDefault();const i=t.changedTouches[0],o=i.screenX,r=i.screenY,e=h.x-o,n=h.y-r,c=t.timeStamp-h.t;h.x=o,h.y=r,h.t=t.timeStamp,h.vx=e/c,h.vy=n/c,gt(this,yi,!0),Math.abs(e)>=Math.abs(n)?this.scrollBy(e,0):Math.abs(n)>Math.abs(e)&&this.scrollBy(0,n)},Jo=function(){gt(this,yi,!1),!this.scrolled&&requestAnimationFrame(()=>{globalThis.visualViewport.scale===1&&this.snap(Z(this,Vn).vx,Z(this,Vn).vy)})},Ri=function(){if(this.scrolled){const h=this.viewSize,d=Z(this,vn);return Z(this,ur)?({left:l,right:i})=>({left:h-i-d,right:h-l-d}):({top:l,bottom:i})=>({left:l+d,right:i+d})}const t=this.pages*this.size;return Z(this,xr)?({left:h,right:d})=>({left:t-d,right:t-h}):Z(this,ur)?({top:h,bottom:d})=>({left:h,right:d}):h=>h},Jc=async function(t,h){if(this.scrolled){const l=ht(this,At,Ri).call(this)(t).left-Z(this,vn);return ht(this,At,Yn).call(this,l,h)}const d=ht(this,At,Ri).call(this)(t).left;return ht(this,At,Jn).call(this,Math.floor(d/this.size)+(Z(this,xr)?-1:1),h)},Yn=async function(t,h,d){const{size:l}=this;if(this.containerPosition===t){gt(this,yn,[t,this.atStart?0:l,this.atEnd?0:l]),ht(this,At,Ni).call(this,h);return}if(this.scrolled&&Z(this,ur)&&(t=-t),(h==="snap"||d)&&this.hasAttribute("animated"))return _b(this.containerPosition,t,300,wb,i=>this.containerPosition=i).then(()=>{gt(this,yn,[t,this.atStart?0:l,this.atEnd?0:l]),ht(this,At,Ni).call(this,h)});this.containerPosition=t,gt(this,yn,[t,this.atStart?0:l,this.atEnd?0:l]),ht(this,At,Ni).call(this,h)},Jn=async function(t,h,d){const l=this.size*(Z(this,xr)?-t:t);return ht(this,At,Yn).call(this,l,h,d)},Qn=async function(t,h="anchor"){var r,e;gt(this,kr,t);const d=(e=(r=xb(t))==null?void 0:r.getClientRects)==null?void 0:e.call(r);if(d){const n=Array.from(d).find(c=>c.width>0&&c.height>0)||d[0];if(!n)return;await ht(this,At,Jc).call(this,n,h);return}if(this.scrolled){await ht(this,At,Yn).call(this,t*this.viewSize,h);return}const{pages:l}=this;if(!l)return;const i=l-2,o=Math.round(t*(i-1));await ht(this,At,Jn).call(this,o+1,h)},Qc=function(){if(this.scrolled)return xl(Z(this,ce).document,this.start+Z(this,vn),this.end-Z(this,vn),ht(this,At,Ri).call(this));const t=Z(this,xr)?-this.size:this.size;return xl(Z(this,ce).document,this.start-t,this.end-t,ht(this,At,Ri).call(this))},Ni=function(t){const h=ht(this,At,Qc).call(this);gt(this,ls,h),t!=="selection"&&t!=="navigation"&&t!=="anchor"?gt(this,kr,h):gt(this,bi,!0);const d=Z(this,Rr),l={reason:t,range:h,index:d};if(this.scrolled)l.fraction=this.start/this.viewSize;else if(this.pages>0){const{page:i,pages:o}=this;Z(this,bn).style.visibility=i>1?"visible":"hidden",l.fraction=(i-1)/(o-2),l.size=1/(o-2)}this.dispatchEvent(new CustomEvent("relocate",{detail:l}))},Qo=async function(t){var e,n;const{index:h,src:d,anchor:l,onLoad:i,select:o}=await t;gt(this,Rr,h);const r=(n=(e=Z(this,ce))==null?void 0:e.document)==null?void 0:n.hasFocus();if(d){const c=ht(this,At,Yc).call(this),a=f=>{if(f.head){const p=f.createElement("style");f.head.prepend(p);const u=f.createElement("style");f.head.append(u),Z(this,os).set(f,[p,u])}i==null||i({doc:f,index:h})},s=ht(this,At,Go).bind(this);await c.load(d,a,s),this.dispatchEvent(new CustomEvent("create-overlayer",{detail:{doc:c.document,index:h,attach:f=>c.overlayer=f}})),gt(this,ce,c)}await this.scrollToAnchor((typeof l=="function"?l(Z(this,ce).document):l)??0,o),r&&this.focusView()},ta=function(t){return t>=0&&t<=this.sections.length-1},Ws=async function({index:t,anchor:h,select:d}){if(t===Z(this,Rr))await ht(this,At,Qo).call(this,{index:t,anchor:h,select:d});else{const l=Z(this,Rr),i=o=>{var r,e;(e=(r=this.sections[l])==null?void 0:r.unload)==null||e.call(r),this.setStyles(Z(this,ss)),this.dispatchEvent(new CustomEvent("load",{detail:o}))};await ht(this,At,Qo).call(this,Promise.resolve(this.sections[t].load()).then(o=>({index:t,src:o,anchor:h,onLoad:i,select:d})).catch(o=>(console.warn(o),console.warn(new Error(`Failed to load section ${t}`)),{})))}},tu=function(t){if(!Z(this,ce))return!0;if(this.scrolled)return this.start>0?ht(this,At,Yn).call(this,Math.max(0,this.start-(t??this.size)),null,!0):!this.atStart;if(this.atStart)return;const h=this.page-1;return ht(this,At,Jn).call(this,h,"page",!0).then(()=>h<=0)},eu=function(t){if(!Z(this,ce))return!0;if(this.scrolled)return this.viewSize-this.end>2?ht(this,At,Yn).call(this,Math.min(this.viewSize,t?this.start+t:this.end),null,!0):!this.atEnd;if(this.atEnd)return;const h=this.page+1,d=this.pages;return ht(this,At,Jn).call(this,h,"page",!0).then(()=>h>=d-1)},Rn=function(t){var h;for(let d=Z(this,Rr)+t;ht(this,At,ta).call(this,d);d+=t)if(((h=this.sections[d])==null?void 0:h.linear)!=="no")return d},ea=async function(t,h){if(Z(this,$n))return;gt(this,$n,!0);const d=t===-1,l=await(d?ht(this,At,tu).call(this,h):ht(this,At,eu).call(this,h));l&&await ht(this,At,Ws).call(this,{index:ht(this,At,Rn).call(this,t),anchor:d?()=>1:()=>0}),(l||!this.hasAttribute("animated"))&&await vb(100),gt(this,$n,!1)},De(da,"observedAttributes",["flow","gap","margin","max-inline-size","max-block-size","max-column-count"]);customElements.define("foliate-paginator",da);const Rb=Object.freeze(Object.defineProperty({__proto__:null,Paginator:da},Symbol.toStringTag,{value:"Module"})),Os=50,El=C=>C.replace(/\s+/g," "),ru=(C,{startIndex:w,startOffset:t,endIndex:h,endOffset:d})=>{const l=C[w],i=C[h],o=l===i?l.slice(t,d):l.slice(t)+C.slice(l+1,i).join("")+i.slice(0,d),r=El(l.slice(0,t)).trimStart(),e=El(i.slice(d)).trimEnd(),n=r.length<Os?"":"…",c=e.length<Os?"":"…",a=`${n}${r.slice(-Os)}`,s=`${e.slice(0,Os)}${c}`;return{pre:a,match:o,post:s}},Nb=function*(C,w,t={}){const{locales:h="en",sensitivity:d}=t,l=d==="variant",i=C.join(""),o=l?i:i.toLocaleLowerCase(h),r=l?w:w.toLocaleLowerCase(h),e=r.length;let n=-1,c=-1,a=0;do if(n=o.indexOf(r,n+1),n>-1){for(;a<=n;)a+=C[++c].length;const s=c,f=n-(a-C[c].length),p=n+e;for(;a<=p;)a+=C[++c].length;const u=c,g=p-(a-C[c].length),m={startIndex:s,startOffset:f,endIndex:u,endOffset:g};yield{range:m,excerpt:ru(C,m)}}while(n>-1)},Ob=function*(C,w,t={}){var a;const{locales:h="en",granularity:d="word",sensitivity:l="base"}=t;let i,o;try{i=new Intl.Segmenter(h,{usage:"search",granularity:d}),o=new Intl.Collator(h,{sensitivity:l})}catch(s){console.warn(s),i=new Intl.Segmenter("en",{usage:"search",granularity:d}),o=new Intl.Collator("en",{sensitivity:l})}const r=Array.from(i.segment(w)).length,e=[];let n=0,c=i.segment(C[n])[Symbol.iterator]();t:for(;n<C.length;){for(;e.length<r;){const{done:f,value:p}=c.next();if(f)if(n++,n<C.length){c=i.segment(C[n])[Symbol.iterator]();continue}else break t;const{index:u,segment:g}=p;if(/[^\p{Format}]/u.test(g)){if(/\s/u.test(g)){/\s/u.test((a=e[e.length-1])==null?void 0:a.segment)||e.push({strIndex:n,index:u,segment:" "});continue}p.strIndex=n,e.push(p)}}const s=e.map(f=>f.segment).join("");if(o.compare(w,s)===0){const f=n,p=e[e.length-1],u=p.index+p.segment.length,g=e[0].strIndex,m=e[0].index,v={startIndex:g,startOffset:m,endIndex:f,endOffset:u};yield{range:v,excerpt:ru(C,v)}}e.shift()}},nu=(C,w,t)=>{const{granularity:h="grapheme",sensitivity:d="base"}=t;return!(Intl!=null&&Intl.Segmenter)||h==="grapheme"&&(d==="variant"||d==="accent")?Nb(C,w,t):Ob(C,w,t)},jb=(C,w)=>{const{defaultLocale:t,matchCase:h,matchDiacritics:d,matchWholeWords:l}=w;return function*(i,o){const r=C(i,function*(e,n){for(const c of nu(e,o,{locales:i.body.lang||i.documentElement.lang||t||"en",granularity:l?"word":"grapheme",sensitivity:d&&h?"variant":d&&!h?"accent":!d&&h?"case":"base"})){const{startIndex:a,startOffset:s,endIndex:f,endOffset:p}=c.range;c.range=n(a,s,f,p),yield c}});for(const e of r)yield e}},Ib=Object.freeze(Object.defineProperty({__proto__:null,search:nu,searchMatcher:jb},Symbol.toStringTag,{value:"Module"})),Ge={XML:"http://www.w3.org/XML/1998/namespace",SSML:"http://www.w3.org/2001/10/synthesis"},Bb=new Set(["article","aside","audio","blockquote","caption","details","dialog","div","dl","dt","dd","figure","footer","form","figcaption","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","math","nav","ol","p","pre","section","tr"]),iu=C=>{var t;const w=C.lang||((t=C==null?void 0:C.getAttributeNS)==null?void 0:t.call(C,Ge.XML,"lang"));return w||(C.parentElement?iu(C.parentElement):null)},su=C=>{var t;const w=(t=C==null?void 0:C.getAttributeNS)==null?void 0:t.call(C,Ge.XML,"lang");return w||(C.parentElement?su(C.parentElement):null)},Pb=(C="en",w="word")=>{const t=new Intl.Segmenter(C,{granularity:w}),h=w==="word";return function*(d,l){var a;const i=d.join("").replace(/\r\n/g," ").replace(/\r/g," ").replace(/\n/g," ");let o=0,r=-1,e=0;const n=Array.from(t.segment(i)),c=[];for(let s=0;s<n.length;s++){const f=n[s],p=n[s+1],u=f.segment.trim(),g=(a=p==null?void 0:p.segment)==null?void 0:a.trim(),m=/(?:^|\s)([A-Z][a-z]{1,5})\.$/.test(u),v=/^[A-Z]/.test(g||"");if(m&&v){const S={index:f.index,segment:f.segment+((p==null?void 0:p.segment)||""),isWordLike:!0};c.push(S),s++}else c.push(f)}for(const{index:s,segment:f,isWordLike:p}of c){if(h&&!p)continue;for(;e<=s;)e+=d[++r].length;const u=r,g=s-(e-d[r].length),m=s+f.length-1;if(m<i.length)for(;e<=m;)e+=d[++r].length;const v=r,S=m-(e-d[r].length)+1;yield[(o++).toString(),l(u,g,v,S)]}}},Fb=(C,w)=>{const t=document.implementation.createDocument(Ge.SSML,"speak"),{lang:h}=w;h&&t.documentElement.setAttributeNS(Ge.XML,"lang",h);const d=(l,i,o)=>{if(!l)return;if(l.nodeType===3)return t.createTextNode(l.textContent);if(l.nodeType===4)return t.createCDATASection(l.textContent);if(l.nodeType!==1)return;let r;const e=l.nodeName.toLowerCase();e==="foliate-mark"?(r=t.createElementNS(Ge.SSML,"mark"),r.setAttribute("name",l.dataset.name)):e==="br"?r=t.createElementNS(Ge.SSML,"break"):(e==="em"||e==="strong")&&(r=t.createElementNS(Ge.SSML,"emphasis"));const n=l.lang||l.getAttributeNS(Ge.XML,"lang");n&&(r||(r=t.createElementNS(Ge.SSML,"lang")),r.setAttributeNS(Ge.XML,"lang",n));const c=l.getAttributeNS(Ge.SSML,"alphabet")||o;if(!r){const s=l.getAttributeNS(Ge.SSML,"ph");s&&(r=t.createElementNS(Ge.SSML,"phoneme"),c&&r.setAttribute("alphabet",c),r.setAttribute("ph",s))}r||(r=i);let a=l.firstChild;for(;a;){const s=d(a,r,c);s&&r!==s&&r.append(s),a=a.nextSibling}return r};return d(C.firstChild,t.documentElement,w.alphabet),t},Db=(C,w,t)=>{const h=iu(C.commonAncestorContainer),d=su(C.commonAncestorContainer),l=Pb(h,t),i=C.cloneContents(),o=[...w(C,l)],r=[...w(i,l)];for(const[n,c]of r){const a=document.createElement("foliate-mark");a.dataset.name=n,c.insertNode(a)}const e=Fb(i,{lang:h,alphabet:d});return{entries:o,ssml:e}},Cl=C=>!C.toString().trim();function*Lb(C){let w;const t=C.createTreeWalker(C.body,NodeFilter.SHOW_ELEMENT);for(let h=t.nextNode();h;h=t.nextNode()){const d=h.tagName.toLowerCase();Bb.has(d)&&(w&&(w.setEndBefore(h),Cl(w)||(yield w)),w=C.createRange(),w.setStart(h,0))}w||(w=C.createRange(),w.setStart(C.body.firstChild??C.body,0)),w.setEndAfter(C.body.lastChild??C.body),Cl(w)||(yield w)}var je,wi,nr,Sr;class zb{constructor(w,t=h=>h){mt(this,je,[]);mt(this,wi);mt(this,nr,-1);mt(this,Sr);gt(this,wi,w),gt(this,Sr,t)}current(){if(Z(this,je)[Z(this,nr)])return Z(this,Sr).call(this,Z(this,je)[Z(this,nr)])}first(){if(Z(this,je)[0])return gt(this,nr,0),Z(this,Sr).call(this,Z(this,je)[0])}prev(){const w=Z(this,nr)-1;if(Z(this,je)[w])return gt(this,nr,w),Z(this,Sr).call(this,Z(this,je)[w])}next(){const w=Z(this,nr)+1;if(Z(this,je)[w])return gt(this,nr,w),Z(this,Sr).call(this,Z(this,je)[w]);for(;;){const{done:t,value:h}=Z(this,wi).next();if(t)break;if(Z(this,je).push(h),Z(this,je)[w])return gt(this,nr,w),Z(this,Sr).call(this,Z(this,je)[w])}}find(w){const t=Z(this,je).findIndex(h=>w(h));if(t>-1)return gt(this,nr,t),Z(this,Sr).call(this,Z(this,je)[t]);for(;;){const{done:h,value:d}=Z(this,wi).next();if(h)break;if(Z(this,je).push(d),w(d))return gt(this,nr,Z(this,je).length-1),Z(this,Sr).call(this,d)}}}je=new WeakMap,wi=new WeakMap,nr=new WeakMap,Sr=new WeakMap;var Xr,_i,Nr,cs,dr,qs,ti;class $b{constructor(w,t,h,d){mt(this,dr);mt(this,Xr);mt(this,_i);mt(this,Nr);mt(this,cs,new XMLSerializer);this.doc=w,this.highlight=h,gt(this,Xr,new zb(Lb(w),l=>{const{entries:i,ssml:o}=Db(l,t,d);return gt(this,_i,new Map(i)),[o,l]}))}start(){gt(this,Nr,null);const[w]=Z(this,Xr).first()??[];return w?ht(this,dr,ti).call(this,w,t=>ht(this,dr,qs).call(this,t,Z(this,Nr))):this.next()}resume(){const[w]=Z(this,Xr).current()??[];return w?ht(this,dr,ti).call(this,w,t=>ht(this,dr,qs).call(this,t,Z(this,Nr))):this.next()}prev(w){gt(this,Nr,null);const[t,h]=Z(this,Xr).prev()??[];return w&&h&&this.highlight(h.cloneRange()),ht(this,dr,ti).call(this,t)}next(w){gt(this,Nr,null);const[t,h]=Z(this,Xr).next()??[];return w&&h&&this.highlight(h.cloneRange()),ht(this,dr,ti).call(this,t)}from(w){gt(this,Nr,null);const[t]=Z(this,Xr).find(d=>w.compareBoundaryPoints(Range.END_TO_START,d)<=0);let h;for(const[d,l]of Z(this,_i).entries())if(w.compareBoundaryPoints(Range.START_TO_START,l)<=0){h=d;break}return ht(this,dr,ti).call(this,t,d=>ht(this,dr,qs).call(this,d,h))}setMark(w){const t=Z(this,_i).get(w);t&&(gt(this,Nr,w),this.highlight(t.cloneRange()))}}Xr=new WeakMap,_i=new WeakMap,Nr=new WeakMap,cs=new WeakMap,dr=new WeakSet,qs=function(w,t){return t?w.querySelector(`mark[name="${CSS.escape(t)}"`):null},ti=function(w,t){var l,i;if(!w)return;if(!t)return Z(this,cs).serializeToString(w);const h=document.implementation.createDocument(Ge.SSML,"speak");h.documentElement.replaceWith(h.importNode(w.documentElement,!0));let d=(l=t(h))==null?void 0:l.previousSibling;for(;d;){const o=d.previousSibling??((i=d.parentNode)==null?void 0:i.previousSibling);d.parentNode.removeChild(d),d=o}return Z(this,cs).serializeToString(h)};const Vb=Object.freeze(Object.defineProperty({__proto__:null,TTS:$b},Symbol.toStringTag,{value:"Module"}));exports.FilePreviewContent=uo;exports.FilePreviewEmbed=Z0;exports.FilePreviewModal=q0;exports.LOCALE_KEY=ao;exports.VERSION=G0;exports.configurePdfWorker=Ol;exports.getFileType=na;exports.normalizeFile=Al;exports.normalizeFiles=Rl;exports.provideLocale=jl;exports.useTranslator=Te;
278
278
  //# sourceMappingURL=index.cjs.map