efficient-office 0.5.0 → 0.6.0

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.
Files changed (41) hide show
  1. package/README.md +17 -0
  2. package/dist/Documents-HT324TAY.js +1 -0
  3. package/dist/Slides-EUDBOA5K.js +1 -0
  4. package/dist/SlidesEditor-6KDRHX4H.js +1 -0
  5. package/dist/Spreadsheet-SOF7NDLP.js +1 -0
  6. package/dist/chunk-2AKHYM66.js +1 -0
  7. package/dist/chunk-2PIEDEY5.js +1 -0
  8. package/dist/chunk-2TZUCKZ7.js +1 -0
  9. package/dist/chunk-AVUZSUQD.js +1 -0
  10. package/dist/chunk-E4N3DBYM.js +1 -0
  11. package/dist/chunk-JKYJGXJE.js +1 -0
  12. package/dist/chunk-N26CBJZA.js +1 -0
  13. package/dist/chunk-PWF37Y2N.js +1 -0
  14. package/dist/chunk-QSM7NWZ2.js +1 -0
  15. package/dist/chunk-RHW2M2UY.js +1 -0
  16. package/dist/chunk-SB3YS3LH.js +1 -0
  17. package/dist/chunk-USKJW3BA.js +1 -0
  18. package/dist/chunk-VKCG3LPQ.js +1 -0
  19. package/dist/chunk-XKOHIZO5.js +1 -0
  20. package/dist/chunk-YYHJJIA4.js +1 -0
  21. package/dist/deckPdf-Q4OXQ7HV.js +1 -0
  22. package/dist/documents/index.d.ts +5 -1
  23. package/dist/documents/index.js +1 -1
  24. package/dist/docxPdf-NCSEKI4J.js +1 -0
  25. package/dist/options-Djr917yc.d.ts +10 -0
  26. package/dist/pptxImport-QEKBZWT2.js +1 -0
  27. package/dist/slides/index.d.ts +124 -57
  28. package/dist/slides/index.js +1 -1
  29. package/dist/spreadsheet/index.d.ts +7 -1
  30. package/dist/spreadsheet/index.js +1 -1
  31. package/dist/workbookPdf-OJDSHKRR.js +1 -0
  32. package/dist/xlsxFile-B2JCZCOL.js +1 -0
  33. package/package.json +8 -3
  34. package/dist/Documents-XZ3AZVHI.js +0 -1
  35. package/dist/Slides-ILKPLYAJ.js +0 -1
  36. package/dist/SlidesEditor-44ITB7B2.js +0 -1
  37. package/dist/Spreadsheet-R5MYRMOF.js +0 -1
  38. package/dist/chunk-372GCYWH.js +0 -1
  39. package/dist/chunk-3JJCHWPJ.js +0 -1
  40. package/dist/chunk-BTDWPUTS.js +0 -1
  41. package/dist/chunk-CED4ECIS.js +0 -1
@@ -0,0 +1 @@
1
+ var e={pdfPageFailed:e=>`Page ${e} couldn't be drawn for the PDF.`,backToFiles:"Back to files",filesHeading:"Documents",newFile:"New document",openFile:"Open a file",filesEmptyTitle:"Write your first document",filesEmptyBody:"Every change saves by itself.",deleteFile:"Delete",createFailed:"The document could not be made.",deleteFailed:"The document could not be deleted.",deleteConfirm:e=>`Delete "${e}"? Nobody can open it again.`,documentName:"Document name",documentPanel:"Document",pagePanel:"Page",outline:"Outline",outlineEmpty:"Headings in the document show here.",morePageSetup:"More page setup",export:"Export",renameFailed:"The document could not be renamed.",openFailed:"This document could not be opened.",conflict:"Somebody else saved this document, so your latest changes are not saved. Reload to see theirs.",reload:"Reload",noStoreEdited:"Not saved. Export to keep your changes",noStoreClean:"No autosave here. Export to keep a copy",openFromFiles:"Go back to your files to open another document.",untitled:"Untitled",loading:"Loading",newDocument:"New",open:"Open",rename:"Rename",menuFile:"File",menuInsert:"Insert",menuLayout:"Layout",save:"Save",saveDocx:"Save (.docx)",saveKeepType:"Save",saveAs:"Save as",saveAsWord:"Word document (.docx)",saveAsPdf:"PDF (from the print dialog)",saveAsWeb:"Web page (.html)",saveAsText:"Plain text (.txt)",print:"Print",undo:"Undo",redo:"Redo",find:"Find",replaceWith:"Replace with",replace:"Replace",replaceAll:"Replace all",matchCase:"Match case",previousMatch:"Previous match",nextMatch:"Next match",closeFind:"Close find",noMatches:"No matches",paragraphStyle:"Paragraph style",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",textColor:"Text color",highlight:"Highlight color",clearFormatting:"Clear formatting",bulletedList:"Bulleted list",numberedList:"Numbered list",decreaseIndent:"Decrease indent",increaseIndent:"Increase indent",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",justify:"Justify",lineSpacing:"Line spacing",styleNormal:"Normal",styleTitle:"Title",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleQuote:"Quote",table:"Table",image:"Image",link:"Link",linkPrompt:"Web address, or leave empty to remove the link.",linkInvalid:"That address can't be used as a link.",pageBreak:"Page break",pageNumber:"Page number",horizontalLine:"Horizontal line",rowAbove:"Insert row above",rowBelow:"Insert row below",columnLeft:"Insert column left",columnRight:"Insert column right",mergeCells:"Merge cells",mergeFailed:"These cells can't be merged: the selection would cut a merged cell.",cellShading:"Cell shading",noColor:"No color",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",imageWidth:"Image width",imageOriginalSize:"Original size",imageRemove:"Remove image",pageSetup:"Page setup",paperSize:"Size",paperLetter:"US Letter",paperLegal:"US Legal",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"Margins",marginsNormal:"Normal, 2.54 cm",marginsNarrow:"Narrow, 1.27 cm",marginsModerate:"Moderate, 1.91 cm sides",marginsWide:"Wide, 5.08 cm sides",header:"Header",footer:"Footer",headerFooterHint:"{page} and {pages} become page numbers. A | pushes the text after it to the right.",headerFooterLocked:"This one holds a picture or a table, so it is kept as it is. Edit it in Word.",ok:"OK",cancel:"Cancel",dismiss:"Dismiss",zoomIn:"Zoom in",zoomOut:"Zoom out",wrapLines:"Wrap lines",objectTextBox:"Text box",objectChart:"Chart from Word. Kept as is.",objectDiagram:"Diagram from Word. Kept as is.",objectEquation:"Equation from Word. Kept as is.",objectPicture:"Picture from Word. Kept as is.",objectOther:"Object from Word. Kept as is.",objectField:"Field",discardMessage:"They haven't been saved.",discard:"Discard",keepEditing:"Keep editing",legacyDoc:".doc is the old Word format. Save it as .docx in Word first.",openedOldSave:"Opened as a document. Save it to get a Word file.",saveFailed:"The document could not be saved.",savedAsUtf8:"Saved as UTF-8: the original encoding can't be written from a browser.",dropHint:"Drop a document to open. Images insert into the page.",matchCount:(e,t)=>`${e} of ${t}`,replacedCount:e=>1===e?"1 replacement":`${e} replacements`,tableSize:(e,t)=>`${e} × ${t}`,pageLabel:e=>`Page ${e}`,pageOf:(e,t)=>`Page ${e} of ${t}`,wordCount:e=>1===e?"1 word":`${e.toLocaleString()} words`,lineColumn:(e,t)=>`Ln ${e}, Col ${t}`,lineCount:e=>1===e?"1 line":`${e.toLocaleString()} lines`,noticeComments:e=>1===e?"1 comment":`${e} comments`,noticeTracked:e=>1===e?"1 tracked change":`${e} tracked changes`,noticeObjects:e=>1===e?"1 object such as a text box":`${e} objects such as text boxes`,noticeFootnotes:e=>1===e?"1 footnote":`${e} footnotes`,noticeLead:e=>`Has ${e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]}. They stay in the file, but need Word to edit.`,discardTitle:e=>`Discard your changes to ${e}?`,cannotRead:e=>`${e} can't be opened. It may be damaged or password protected.`,unsupported:e=>`Unsupported file type: .${e||"unknown"}`},t={pdfPageFailed:e=>`第 ${e} 页无法绘制到 PDF。`,backToFiles:"返回文件",filesHeading:"文档",newFile:"新建文档",openFile:"打开文件",filesEmptyTitle:"写下您的第一份文档",filesEmptyBody:"每次更改都会自动保存。",deleteFile:"删除",createFailed:"无法创建文档。",deleteFailed:"无法删除文档。",deleteConfirm:e=>`删除“${e}”?之后任何人都无法再打开它。`,documentName:"文档名称",documentPanel:"文档",pagePanel:"页面",outline:"大纲",outlineEmpty:"文档中的标题会显示在这里。",morePageSetup:"更多页面设置",export:"导出",renameFailed:"无法重命名文档。",openFailed:"无法打开此文档。",conflict:"其他人已保存此文档,您最近的更改尚未保存。请重新加载以查看他们的版本。",reload:"重新加载",noStoreEdited:"未保存。请导出以保留更改",noStoreClean:"此处不会自动保存。请导出以保留副本",openFromFiles:"请返回文件列表以打开其他文档。",untitled:"未命名",loading:"正在加载",newDocument:"新建",open:"打开",rename:"重命名",menuFile:"文件",menuInsert:"插入",menuLayout:"布局",save:"保存",saveDocx:"保存 (.docx)",saveKeepType:"保存",saveAs:"另存为",saveAsWord:"Word 文档 (.docx)",saveAsPdf:"PDF(通过打印对话框)",saveAsWeb:"网页 (.html)",saveAsText:"纯文本 (.txt)",print:"打印",undo:"撤销",redo:"重做",find:"查找",replaceWith:"替换为",replace:"替换",replaceAll:"全部替换",matchCase:"区分大小写",previousMatch:"上一个匹配项",nextMatch:"下一个匹配项",closeFind:"关闭查找",noMatches:"无匹配项",paragraphStyle:"段落样式",font:"字体",fontSize:"字号",bold:"加粗",italic:"倾斜",underline:"下划线",strikethrough:"删除线",superscript:"上标",subscript:"下标",textColor:"文字颜色",highlight:"突出显示颜色",clearFormatting:"清除格式",bulletedList:"项目符号列表",numberedList:"编号列表",decreaseIndent:"减少缩进",increaseIndent:"增加缩进",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",justify:"两端对齐",lineSpacing:"行距",styleNormal:"正文",styleTitle:"标题",styleHeading1:"标题 1",styleHeading2:"标题 2",styleHeading3:"标题 3",styleQuote:"引用",table:"表格",image:"图片",link:"链接",linkPrompt:"输入网址;留空则移除链接。",linkInvalid:"该地址不能用作链接。",pageBreak:"分页符",pageNumber:"页码",horizontalLine:"水平线",rowAbove:"在上方插入行",rowBelow:"在下方插入行",columnLeft:"在左侧插入列",columnRight:"在右侧插入列",mergeCells:"合并单元格",mergeFailed:"无法合并这些单元格:所选范围会切开已合并的单元格。",cellShading:"单元格底纹",noColor:"无颜色",deleteRow:"删除行",deleteColumn:"删除列",deleteTable:"删除表格",imageWidth:"图片宽度",imageOriginalSize:"原始大小",imageRemove:"移除图片",pageSetup:"页面设置",paperSize:"纸张大小",paperLetter:"美国信纸",paperLegal:"美国法律用纸",custom:"自定义",orientation:"方向",portrait:"纵向",landscape:"横向",margins:"页边距",marginsNormal:"常规,2.54 厘米",marginsNarrow:"窄,1.27 厘米",marginsModerate:"中等,左右 1.91 厘米",marginsWide:"宽,左右 5.08 厘米",header:"页眉",footer:"页脚",headerFooterHint:"{page} 和 {pages} 会变成页码。| 会把其后的文字推到右侧。",headerFooterLocked:"此处包含图片或表格,因此保持原样。请在 Word 中编辑。",ok:"确定",cancel:"取消",dismiss:"关闭",zoomIn:"放大",zoomOut:"缩小",wrapLines:"自动换行",objectTextBox:"文本框",objectChart:"来自 Word 的图表,保持原样。",objectDiagram:"来自 Word 的示意图,保持原样。",objectEquation:"来自 Word 的公式,保持原样。",objectPicture:"来自 Word 的图片,保持原样。",objectOther:"来自 Word 的对象,保持原样。",objectField:"域",discardMessage:"这些更改尚未保存。",discard:"放弃",keepEditing:"继续编辑",legacyDoc:".doc 是旧版 Word 格式,请先在 Word 中另存为 .docx。",openedOldSave:"已作为文档打开。保存后即可得到 Word 文件。",saveFailed:"无法保存文档。",savedAsUtf8:"已保存为 UTF-8:浏览器无法写入原始编码。",dropHint:"拖放文档以打开;图片会插入页面。",matchCount:(e,t)=>`第 ${e} 个,共 ${t} 个`,replacedCount:e=>`已替换 ${e} 处`,tableSize:(e,t)=>`${e} × ${t}`,pageLabel:e=>`第 ${e} 页`,pageOf:(e,t)=>`第 ${e} 页,共 ${t} 页`,wordCount:e=>`${e.toLocaleString()} 字`,lineColumn:(e,t)=>`第 ${e} 行,第 ${t} 列`,lineCount:e=>`${e.toLocaleString()} 行`,noticeComments:e=>`${e} 条批注`,noticeTracked:e=>`${e} 处修订`,noticeObjects:e=>`${e} 个文本框等对象`,noticeFootnotes:e=>`${e} 条脚注`,noticeLead:e=>`包含 ${e.join("、")}。它们会保留在文件中,但需要在 Word 中编辑。`,discardTitle:e=>`放弃对 ${e} 的更改?`,cannotRead:e=>`无法打开 ${e}。文件可能已损坏或受密码保护。`,unsupported:e=>`不支持的文件类型:.${e||"未知"}`};export{e as ENGLISH_WORDS,t as ZH_HANS_WORDS};
@@ -0,0 +1 @@
1
+ import{ENGLISH_WORDS as r}from"./chunk-AVUZSUQD.js";import{createContext as e,useContext as o}from"react";import{jsx as t}from"react/jsx-runtime";var n=e(r);function a({words:r,children:e}){return t(n.Provider,{value:r,children:e})}var i=()=>o(n);import{createContext as s,useContext as c}from"react";import{jsx as d}from"react/jsx-runtime";var m=class extends Error{},u=s({});function l({value:r,children:e}){return d(u.Provider,{value:r,children:r.words?d(a,{words:r.words,children:e}):e})}var v=()=>c(u);export{a as DocumentsWordsProvider,i as useDocumentsWords,m as DocumentsConflict,l as DocumentsProvider,v as useDocumentsHost};
@@ -0,0 +1 @@
1
+ var t=t=>t>=192&&t<=207&&196!==t&&200!==t&&204!==t;var e={1:"/DeviceGray",3:"/DeviceRGB",4:"/DeviceCMYK"},n=t=>String(Math.round(100*t)/100),o=class{chunks=[];offsets=[];length=0;write(t){this.chunks.push(t),this.length+=t.length}object(t,e){this.offsets[t]=this.length,this.write(`${t} 0 obj\n${e}\nendobj\n`)}stream(t,e,n){this.offsets[t]=this.length,this.write(`${t} 0 obj\n<<${e}/Length ${n.length}>>\nstream\n`),this.write(n),this.write("\nendstream\nendobj\n")}finish(t){const e=this.length,n=this.offsets.slice(1).map(t=>`${String(t).padStart(10,"0")} 00000 n \n`);return this.write(`xref\n0 ${this.offsets.length}\n0000000000 65535 f \n${n.join("")}`),this.write(`trailer\n<</Size ${this.offsets.length}/Root ${t} 0 R>>\nstartxref\n${e}\n%%EOF\n`),new Blob(this.chunks,{type:"application/pdf"})}};function i(o,i,r){const s=3+3*r,{width:a,height:h,components:c}=function(e){if(255!==e[0]||216!==e[1])throw new Error("Not a JPEG");let n=2;for(;n+9<e.length;){if(255!==e[n])throw new Error("Damaged JPEG");const o=e[n+1];if(255!==o){if(t(o))return{height:e[n+5]<<8|e[n+6],width:e[n+7]<<8|e[n+8],components:e[n+9]};n+=2+(e[n+2]<<8|e[n+3])}else n+=1}throw new Error("Damaged JPEG")}(i.jpeg),f=e[c];if(!f)throw new Error("Unsupported JPEG colours");const l=n(i.width),g=n(i.height);o.object(s,`<</Type/Page/Parent 2 0 R/MediaBox[0 0 ${l} ${g}]/Contents ${s+1} 0 R/Resources<</XObject<</Im0 ${s+2} 0 R>>>>>>`),o.stream(s+1,"",`q ${l} 0 0 ${g} 0 0 cm /Im0 Do Q`),o.stream(s+2,`/Type/XObject/Subtype/Image/Width ${a}/Height ${h}/ColorSpace${f}/BitsPerComponent 8/Filter/DCTDecode`,i.jpeg)}function r(t){if(!t.length)throw new Error("A PDF needs a page");const e=new o;e.write("%PDF-1.4\n"),e.write(Uint8Array.of(37,226,227,207,211,10)),e.object(1,"<</Type/Catalog/Pages 2 0 R>>");const n=t.map((t,e)=>3+3*e+" 0 R").join(" ");return e.object(2,`<</Type/Pages/Kids[${n}]/Count ${t.length}>>`),t.forEach((t,n)=>i(e,t,n)),e.finish(1)}function s(){const t=document.createElement("div");return t.setAttribute("aria-hidden","true"),t.style.cssText="position:fixed;left:-100000px;top:0;pointer-events:none;",document.body.append(t),{root:t,close:()=>t.remove()}}async function a(t){const{getFontEmbedCSS:e}=await(import("html-to-image"));return e(t,{includeQueryParams:!0})}async function h(t){t.getBoundingClientRect(),await document.fonts.ready,await Promise.all(Array.from(t.querySelectorAll("img"),t=>t.decode()))}async function c(t,{width:e,height:n,pixelRatio:o,quality:i,fontCss:r,background:s}){const{toJpeg:a}=await(import("html-to-image"));return function(t){const e=atob(t.slice(t.indexOf(",")+1)),n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}(await a(t,{width:e,height:n,pixelRatio:o,quality:i??.8,backgroundColor:s??"#ffffff",fontEmbedCSS:r,includeQueryParams:!0}))}export{r as jpegPdf,s as openStage,a as embeddedFonts,h as settled,c as drawJpeg};
@@ -0,0 +1 @@
1
+ import{DEFAULT_COL_WIDTH as t,DEFAULT_FONT_SIZE as e,DEFAULT_ROW_HEIGHT as n,FormulaError as r,colIndex as o,colLabel as s,formatKey as l,isFormula as i,newSheet as a,rangeLabel as m,shiftFormula as c,tokenize as f,usedBounds as u}from"./chunk-VKCG3LPQ.js";var h=(()=>{const t=new Uint32Array(256);for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)n=1&n?3988292384^n>>>1:n>>>1;t[e]=n>>>0}return t})();function d(t){let e=4294967295;for(let n=0;n<t.length;n++)e=h[255&(e^t[n])]^e>>>8;return(4294967295^e)>>>0}async function g(t,e){const n=e.writable.getWriter();return n.write(t).then(()=>n.close()).catch(()=>{}),new Uint8Array(await new Response(e.readable).arrayBuffer())}async function p(t){return"undefined"==typeof CompressionStream?null:g(t,new CompressionStream("deflate-raw"))}async function $(t){return g(t,new DecompressionStream("deflate-raw"))}async function b(t){const e=new TextEncoder,n=[],r=[];let o=0;for(const s of t){const t=e.encode(s.name),l=e.encode(s.text),i=await p(l),a=null===i||i.length>=l.length,m=a?l:i,c=d(l),f=new Uint8Array(30+t.length),u=new DataView(f.buffer);u.setUint32(0,67324752,!0),u.setUint16(4,20,!0),u.setUint16(6,2048,!0),u.setUint16(8,a?0:8,!0),u.setUint32(14,c,!0),u.setUint32(18,m.length,!0),u.setUint32(22,l.length,!0),u.setUint16(26,t.length,!0),f.set(t,30);const h=new Uint8Array(46+t.length),g=new DataView(h.buffer);g.setUint32(0,33639248,!0),g.setUint16(4,20,!0),g.setUint16(6,20,!0),g.setUint16(8,2048,!0),g.setUint16(10,a?0:8,!0),g.setUint32(16,c,!0),g.setUint32(20,m.length,!0),g.setUint32(24,l.length,!0),g.setUint16(28,t.length,!0),g.setUint32(42,o,!0),h.set(t,46),n.push(f,m),r.push(h),o+=f.length+m.length}const s=r.reduce((t,e)=>t+e.length,0),l=new Uint8Array(22),i=new DataView(l.buffer);i.setUint32(0,101010256,!0),i.setUint16(8,t.length,!0),i.setUint16(10,t.length,!0),i.setUint32(12,s,!0),i.setUint32(16,o,!0);const a=new Uint8Array(o+s+22);let m=0;for(const t of[...n,...r,l])a.set(t,m),m+=t.length;return a}async function x(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);let n=-1;for(let r=t.length-22;r>=Math.max(0,t.length-66e3);r--)if(101010256===e.getUint32(r,!0)){n=r;break}if(n<0)throw new Error("Not a zip file");const r=e.getUint16(n+10,!0);let o=e.getUint32(n+16,!0);const s=new TextDecoder,l=new Map;for(let n=0;n<r;n++){const n=e.getUint16(o+10,!0),r=e.getUint32(o+20,!0),i=e.getUint16(o+28,!0),a=e.getUint16(o+30,!0),m=e.getUint16(o+32,!0),c=e.getUint32(o+42,!0),f=s.decode(t.subarray(o+46,o+46+i));if(o+=46+i+a+m,!/\.(xml|rels)$/i.test(f))continue;const u=c+30+e.getUint16(c+26,!0)+e.getUint16(c+28,!0),h=t.subarray(u,u+r);l.set(f,s.decode(8===n?await $(h):h))}return l}var w=new Set(["CONCAT","IFS","SWITCH","TEXTJOIN","XLOOKUP","XOR","IFNA","DAYS","STDEV.S","STDEV.P","VAR.S","VAR.P","MODE.SNGL","RANK.EQ","CEILING.MATH","FLOOR.MATH"]);function F(t){const{tokens:e}=f(t);let n="",r=0;for(const o of e){if("ident"!==o.type)continue;const e=o.value.replace(/^_xlfn\.(?:_xlws\.)?/i,"").replace(/^_xlws\./i,"");e!==o.value&&(n+=t.slice(r,o.start)+e,r=o.end)}return`=${n}${t.slice(r)}`}function y(t){return t.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var A='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n',C="http://schemas.openxmlformats.org/spreadsheetml/2006/main",v="http://schemas.openxmlformats.org/officeDocument/2006/relationships";function N(t){return`FF${t.replace("#","").toUpperCase().padStart(6,"0").slice(0,6)}`}var U=class{fonts=[`<font><sz val="${e}"/><name val="Arial"/></font>`];fills=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>'];borders=["<border><left/><right/><top/><bottom/><diagonal/></border>"];numFmts=[];xfs=['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>'];seen=new Map;index(t,e){const n=t.indexOf(e);return n>=0?n:(t.push(e),t.length-1)}add(t){if(!t||!Object.keys(t).length)return 0;const n=JSON.stringify(t),r=this.seen.get(n);if(void 0!==r)return r;const o=this.index(this.fonts,`<font>${t.bold?"<b/>":""}${t.italic?"<i/>":""}${t.strike?"<strike/>":""}${t.underline?"<u/>":""}<sz val="${t.fontSize??e}"/>${t.color?`<color rgb="${N(t.color)}"/>`:""}<name val="Arial"/></font>`),s=t.fill?this.index(this.fills,`<fill><patternFill patternType="solid"><fgColor rgb="${N(t.fill)}"/><bgColor indexed="64"/></patternFill></fill>`):0,l=(t,e)=>e?`<${t} style="thin"><color auto="1"/></${t}>`:`<${t}/>`,i=t.border??{},a=this.index(this.borders,`<border>${l("left",i.left)}${l("right",i.right)}${l("top",i.top)}${l("bottom",i.bottom)}<diagonal/></border>`);let m=0;t.numFmt&&"General"!==t.numFmt&&(m="@"===t.numFmt?49:164+this.index(this.numFmts,t.numFmt));const c=t.align||t.vAlign||t.wrap?`<alignment${t.align?` horizontal="${t.align}"`:""}${t.vAlign?` vertical="${"middle"===t.vAlign?"center":t.vAlign}"`:""}${t.wrap?' wrapText="1"':""}/>`:"",f=`<xf numFmtId="${m}" fontId="${o}" fillId="${s}" borderId="${a}" xfId="0" applyFont="1"${s?' applyFill="1"':""}${a?' applyBorder="1"':""}${m?' applyNumberFormat="1"':""}${c?' applyAlignment="1"':""}${c?`>${c}</xf>`:"/>"}`;return this.xfs.push(f),this.seen.set(n,this.xfs.length-1),this.xfs.length-1}toXml(){const t=this.numFmts.length?`<numFmts count="${this.numFmts.length}">${this.numFmts.map((t,e)=>`<numFmt numFmtId="${164+e}" formatCode="${y(t)}"/>`).join("")}</numFmts>`:"";return`${A}<styleSheet xmlns="${C}">${t}<fonts count="${this.fonts.length}">${this.fonts.join("")}</fonts><fills count="${this.fills.length}">${this.fills.join("")}</fills><borders count="${this.borders.length}">${this.borders.join("")}</borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${this.xfs.length}">${this.xfs.join("")}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`}};function S(t,e,n,o,a,m){const c=`${s(a)}${o+1}`,u=t.cells[o]?.[a]??"",h=t.formats[l(o,a)],d=m.add(h),g=d?` s="${d}"`:"";if(""===u)return d?`<c r="${c}"${g}/>`:"";const p=n.value(e,o,a);if(i(u)){const t=`<f>${y(function(t){const e=t.slice(1),{tokens:n}=f(e);let r="",o=0;for(let t=0;t<n.length;t++){const s=n[t],l=n[t+1];"ident"===s.type&&"op"===l?.type&&"("===l.value&&w.has(s.value.toUpperCase())&&(r+=`${e.slice(o,s.start)}_xlfn.${s.value.toUpperCase()}`,o=s.end)}return r+e.slice(o)}(u))}</f>`;if("number"==typeof p)return`<c r="${c}"${g}>${t}<v>${p}</v></c>`;if("boolean"==typeof p)return`<c r="${c}"${g} t="b">${t}<v>${p?1:0}</v></c>`;if(p instanceof r){return`<c r="${c}"${g} t="e">${t}<v>${/^#(?:REF!|N\/A|NAME\?|DIV\/0!|VALUE!|NUM!|NULL!)$/.test(p.code)?p.code:"#VALUE!"}</v></c>`}return`<c r="${c}"${g} t="str">${t}<v>${y(null===p?"":p)}</v></c>`}if("number"==typeof p)return`<c r="${c}"${g}><v>${p}</v></c>`;if("boolean"==typeof p)return`<c r="${c}"${g} t="b"><v>${p?1:0}</v></c>`;const $=String(p??"");return`<c r="${c}"${g} t="inlineStr"><is><t${$!==$.trim()||/\n/.test($)?' xml:space="preserve"':""}>${y($)}</t></is></c>`}function k(e,r,o,l){const i=u(e);let a=i?.row??0,c=i?.col??0;const f=new Map;for(const t of Object.keys(e.formats)){const[e,n]=t.split(":").map(Number);a=Math.max(a,e),c=Math.max(c,n),f.has(e)||f.set(e,[]),f.get(e).push(n)}const h=new Set(e.hiddenRows);for(const t of[...e.hiddenRows,...Object.keys(e.rowHeights).map(Number)])a=Math.max(a,t);const d=[];for(let t=0;t<=a;t++){const n=e.cells[t]??[],s=new Set(f.get(t)??[]);n.forEach((t,e)=>{""!==t&&s.add(e)});const i=e.rowHeights[t];if(!s.size&&void 0===i&&!h.has(t))continue;const a=[...s].sort((t,e)=>t-e).map(n=>S(e,r,o,t,n,l)).join(""),m=`${void 0!==i?` ht="${(.75*i).toFixed(2)}" customHeight="1"`:""}${h.has(t)?' hidden="1"':""}`;d.push(`<row r="${t+1}"${m}>${a}</row>`)}const g=new Set(e.hiddenCols),p=[...new Set([...Object.keys(e.colWidths).map(Number),...g])].sort((t,e)=>t-e),$=p.length?`<cols>${p.map(n=>`<col min="${n+1}" max="${n+1}" width="${(((e.colWidths[n]??t)-5)/7).toFixed(4)}" customWidth="1"${g.has(n)?' hidden="1"':""}/>`).join("")}</cols>`:"",{frozenRows:b,frozenCols:x}=e,w=b||x?`<pane${x?` xSplit="${x}"`:""}${b?` ySplit="${b}"`:""} topLeftCell="${s(x)}${b+1}" activePane="${b&&x?"bottomRight":b?"bottomLeft":"topRight"}" state="frozen"/>`:"",F=e.merges.length?`<mergeCells count="${e.merges.length}">${e.merges.map(t=>`<mergeCell ref="${m(t)}"/>`).join("")}</mergeCells>`:"",y=e.filter?`<autoFilter ref="${m(e.filter.range)}"/>`:"",v=e.tabColor?`<sheetPr><tabColor rgb="${N(e.tabColor)}"/></sheetPr>`:"";return`${A}<worksheet xmlns="${C}">${v}<dimension ref="A1:${s(c)}${a+1}"/><sheetViews><sheetView${0===r?' tabSelected="1"':""} workbookViewId="0">${w}</sheetView></sheetViews><sheetFormatPr defaultColWidth="${((t-5)/7).toFixed(4)}" defaultRowHeight="${(.75*n).toFixed(2)}" customHeight="1"/>${$}<sheetData>${d.join("")}</sheetData>${y}${F}</worksheet>`}async function I(t,e){const n=new U,r=function(t){const e=new Set;return t.map((t,n)=>{const r=t.name.replace(/[[\]:*?/\\]/g," ").trim().slice(0,31)||`Sheet ${n+1}`;let o=r;for(let t=2;e.has(o.toLowerCase());t++)o=`${r.slice(0,28)} ${t}`;return e.add(o.toLowerCase()),o})}(t),o=t.map((t,r)=>({name:`xl/worksheets/sheet${r+1}.xml`,text:k(t,r,e,n)})),l=t.map((t,e)=>{return t.filter?`<definedName name="_xlnm._FilterDatabase" localSheetId="${e}" hidden="1">${y(`'${r[e].replace(/'/g,"''")}'!${n=t.filter.range,`$${s(n.c1)}$${n.r1+1}:$${s(n.c2)}$${n.r2+1}`}`)}</definedName>`:"";var n}).join("");return b([{name:"[Content_Types].xml",text:`${A}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>${t.map((t,e)=>`<Override PartName="/xl/worksheets/sheet${e+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`},{name:"_rels/.rels",text:`${A}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${v}/officeDocument" Target="xl/workbook.xml"/></Relationships>`},{name:"xl/workbook.xml",text:`${A}<workbook xmlns="${C}" xmlns:r="${v}"><sheets>${r.map((t,e)=>`<sheet name="${y(t)}" sheetId="${e+1}" r:id="rId${e+1}"/>`).join("")}</sheets>${l?`<definedNames>${l}</definedNames>`:""}<calcPr calcId="0" fullCalcOnLoad="1"/></workbook>`},{name:"xl/_rels/workbook.xml.rels",text:`${A}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${t.map((t,e)=>`<Relationship Id="rId${e+1}" Type="${v}/worksheet" Target="worksheets/sheet${e+1}.xml"/>`).join("")}<Relationship Id="rId${t.length+1}" Type="${v}/styles" Target="styles.xml"/></Relationships>`},{name:"xl/styles.xml",text:n.toXml()},...o])}var T={1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",14:"dd/mm/yyyy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"dd/mm/yyyy h:mm",37:"#,##0;(#,##0)",38:"#,##0;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mm:ss.0",48:"##0.0E+0",49:"@"},E=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47","0563C1","954F72"],M={0:"000000",1:"FFFFFF",2:"FF0000",3:"00FF00",4:"0000FF",5:"FFFF00",6:"FF00FF",7:"00FFFF",8:"000000",9:"FFFFFF",10:"FF0000",11:"00FF00",12:"0000FF",13:"FFFF00",14:"FF00FF",15:"00FFFF"};function R(t){if(!t)return;const e=t.getAttribute("rgb");if(e)return`#${e.slice(-6).toLowerCase()}`;const n=Number(t.getAttribute("tint")??0),r=t.getAttribute("theme");if(null!==r){const t=E[Number(r)];return t?`#${function(t,e){const n=n=>{const r=parseInt(t.slice(n,n+2),16),o=e<0?r*(1+e):r+(255-r)*e;return Math.round(o).toString(16).padStart(2,"0")};return`${n(0)}${n(2)}${n(4)}`}(t,n)}`.toLowerCase():void 0}const o=t.getAttribute("indexed");if(null!==o){const t=M[Number(o)];return t?`#${t}`.toLowerCase():void 0}}var D=t=>(new DOMParser).parseFromString(t,"application/xml"),j=(t,e)=>Array.from(t.getElementsByTagNameNS("*",e)),O=(t,e)=>j(t,e)[0],L=(t,e)=>Array.from(t.children).filter(t=>t.localName===e);function V(t){const e=/^([A-Z]+)(\d+)$/.exec(t);return{row:Number(e[2])-1,col:o(e[1])}}function z(t){const[e,n=e]=t.replace(/\$/g,"").split(":"),r=V(e),o=V(n);return{r1:r.row,c1:r.col,r2:o.row,c2:o.col}}function P(t,e,n,r){const o=D(e),s=a(t),i=[],m={},f=new Map;for(const t of j(o,"c")){const e=t.getAttribute("r");if(!e)continue;const{row:o,col:s}=V(e),a=r[Number(t.getAttribute("s")??0)];a&&Object.keys(a).length&&(m[l(o,s)]=a);const u=L(t,"f")[0],h=L(t,"v")[0]?.textContent??"",d=t.getAttribute("t");let g="";if(u){const t=u.getAttribute("si");if("shared"===u.getAttribute("t")&&null!==t)if(u.textContent)f.set(t,{text:u.textContent,row:o,col:s}),g=F(u.textContent);else{const e=f.get(t);e&&(g=c(F(e.text),o-e.row,s-e.col))}else u.textContent&&(g=F(u.textContent))}if(g||(g="s"===d?n[Number(h)]??"":"inlineStr"===d?j(t,"t").map(t=>t.textContent??"").join(""):"b"===d?"1"===h?"TRUE":"FALSE":h,"s"!==d&&"inlineStr"!==d&&"str"!==d||!/^(?:=|-?\d|'|true$|false$)/i.test(g)||(g=`'${g}`)),""!==g){for(;i.length<=o;)i.push([]);for(;i[o].length<=s;)i[o].push("");i[o][s]=g}}const u={},h=[];for(const t of j(o,"col")){const e=Number(t.getAttribute("min"))-1,n=Math.min(Number(t.getAttribute("max"))-1,e+500),r=Number(t.getAttribute("width")??0);for(let o=e;o<=n;o++)r&&"1"===t.getAttribute("customWidth")&&(u[o]=Math.round(7*r+5)),"1"===t.getAttribute("hidden")&&h.push(o)}const d={},g=[];for(const t of j(o,"row")){const e=Number(t.getAttribute("r"))-1,n=t.getAttribute("ht");n&&"1"===t.getAttribute("customHeight")&&(d[e]=Math.round(Number(n)/.75)),"1"===t.getAttribute("hidden")&&g.push(e)}const p=O(o,"pane"),$="frozen"===p?.getAttribute("state"),b=O(o,"autoFilter")?.getAttribute("ref"),x=R(O(o,"tabColor"));return{...s,tabColor:x,cells:i,formats:m,colWidths:u,rowHeights:d,hiddenCols:h,hiddenRows:g,merges:j(o,"mergeCell").map(t=>z(t.getAttribute("ref")??"A1")),frozenRows:$?Number(p?.getAttribute("ySplit")??0):0,frozenCols:$?Number(p?.getAttribute("xSplit")??0):0,filter:b?{range:z(b),excluded:{}}:null,rowCount:Math.max(s.rowCount,i.length+100),colCount:Math.max(s.colCount,i.reduce((t,e)=>Math.max(t,e.length),0))}}async function H(t){const e=await x(t),n=e.get("xl/workbook.xml");if(!n)throw new Error("Not a workbook");const r=D(e.get("xl/_rels/workbook.xml.rels")??"<Relationships/>"),o=new Map(j(r,"Relationship").map(t=>[t.getAttribute("Id"),t.getAttribute("Target")??""])),s=e.get("xl/sharedStrings.xml")?j(D(e.get("xl/sharedStrings.xml")),"si").map(t=>j(t,"t").filter(t=>"rPh"!==t.parentElement?.localName).map(t=>t.textContent??"").join("")):[],l=function(t){if(!t)return[];const e=D(t),n=new Map(j(e,"numFmt").map(t=>[Number(t.getAttribute("numFmtId")),t.getAttribute("formatCode")??""])),r=O(e,"fonts"),o=O(e,"fills"),s=O(e,"borders"),l=O(e,"cellXfs");if(!l)return[];const i=r?L(r,"font"):[],a=o?L(o,"fill"):[],m=s?L(s,"border"):[],c=Number(i[0]?L(i[0],"sz")[0]?.getAttribute("val")??0:0);return L(l,"xf").map(t=>{const e={},r=Number(t.getAttribute("numFmtId")??0),o=n.get(r)??T[r];o&&"General"!==o&&(e.numFmt=o);const s=i[Number(t.getAttribute("fontId")??0)];if(s){L(s,"b").length&&(e.bold=!0),L(s,"i").length&&(e.italic=!0),L(s,"u").length&&(e.underline=!0),L(s,"strike").length&&(e.strike=!0);const t=Number(L(s,"sz")[0]?.getAttribute("val")??0);t&&t!==c&&(e.fontSize=t);const n=R(L(s,"color")[0]);n&&"#000000"!==n&&(e.color=n)}const l=a[Number(t.getAttribute("fillId")??0)]?.getElementsByTagNameNS("*","patternFill")[0];if(l&&"solid"===l.getAttribute("patternType")){const t=R(L(l,"fgColor")[0]);t&&(e.fill=t)}const f=m[Number(t.getAttribute("borderId")??0)];if(f){const t=t=>!!L(f,t)[0]?.getAttribute("style"),n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")};(n.top||n.right||n.bottom||n.left)&&(e.border={...n.top?{top:!0}:{},...n.right?{right:!0}:{},...n.bottom?{bottom:!0}:{},...n.left?{left:!0}:{}})}const u=L(t,"alignment")[0];if(u){const t=u.getAttribute("horizontal");"left"!==t&&"center"!==t&&"right"!==t||(e.align=t);const n=u.getAttribute("vertical");"top"!==n&&"bottom"!==n||(e.vAlign=n),"center"===n&&(e.vAlign="middle");const r=u.getAttribute("wrapText");"1"!==r&&"true"!==r||(e.wrap=!0)}return e})}(e.get("xl/styles.xml")),i=[];for(const t of j(D(n),"sheet")){const n=t.getAttribute("name")??`Sheet ${i.length+1}`,r=t.getAttributeNS(v,"id")??t.getAttribute("r:id"),a=o.get(r)??"",m=a.startsWith("/")?a.slice(1):`xl/${a}`,c=e.get(m);c&&i.push(P(n,c,s,l))}if(!i.length)throw new Error("No sheets");return i}export{b as zip,x as unzip,I as writeXlsx,H as readXlsx};
@@ -0,0 +1 @@
1
+ function t(t,n,o){return t.map((h,r)=>({top:h,height:Math.max(Math.min((t[r+1]??o)-h,n),0)}))}function n(t,n){const o=n.top+n.height;let h=-1,r=-1;return t.forEach((t,e)=>{t.top>=o||t.top+t.height<=n.top||(h<0&&(h=e),r=e)}),h<0?null:{first:h,last:r}}function o(t,n,o){const h=n-o,r=[0];let e=0;return t.forEach((t,n)=>{e>0&&e+t>h&&(r.push(n),e=0),e+=t}),r}export{t as pageWindows,n as boxesInWindow,o as rowPageStarts};
@@ -0,0 +1 @@
1
+ import{ENGLISH_WORDS as t}from"./chunk-SB3YS3LH.js";import{createContext as e,useContext as r}from"react";import{jsx as o}from"react/jsx-runtime";var n=class extends Error{},a="efficient-office:slides",c=()=>{try{return JSON.parse(localStorage.getItem(a)??"{}")}catch{return{}}},s=t=>localStorage.setItem(a,JSON.stringify(t)),i={list:async()=>Object.values(c()).map(({id:t,title:e,updatedAt:r})=>({id:t,title:e,updatedAt:r})).sort((t,e)=>e.updatedAt.localeCompare(t.updatedAt)),get:async t=>{const e=c()[t];if(!e)throw new Error("No such deck");return e},create:async t=>{const e=(new Date).toISOString(),r={id:crypto.randomUUID(),title:t,document:{},version:crypto.randomUUID(),updatedAt:e};return s({...c(),[r.id]:r}),r},rename:async(t,e)=>{const r=c();r[t]&&s({...r,[t]:{...r[t],title:e,updatedAt:(new Date).toISOString()}})},save:async(t,e,r)=>{const o=c();if(!o[t]||o[t].version!==r)throw new n;const a=crypto.randomUUID();return s({...o,[t]:{...o[t],document:e,version:a,updatedAt:(new Date).toISOString()}}),a},remove:async t=>{const{[t]:e,...r}=c();s(r)}},d=e({store:i});function u({value:t,children:e}){return o(d.Provider,{value:t,children:e})}var l=()=>r(d),m=()=>r(d).words??t;export{n as SlidesConflict,i as browserSlidesStore,u as SlidesProvider,l as useSlidesHost,m as useSlidesWords};
@@ -0,0 +1 @@
1
+ var t=(()=>{const t=new Uint32Array(256);for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)n=1&n?3988292384^n>>>1:n>>>1;t[e]=n>>>0}return t})();function e(e){let n=4294967295;for(let r=0;r<e.length;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0}async function n(t,e){const n=e.writable.getWriter();return n.write(t).then(()=>n.close()).catch(()=>{}),new Uint8Array(await new Response(e.readable).arrayBuffer())}function r(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);for(let n=t.length-22;n>=Math.max(0,t.length-66e3);n--)if(101010256===e.getUint32(n,!0))return{count:e.getUint16(n+10,!0),size:e.getUint32(n+12,!0),offset:e.getUint32(n+16,!0)};throw new Error("Not a zip file")}function a(t,e,n){const r=new DataView(t.buffer,t.byteOffset,t.byteLength),a=new TextDecoder,o=[];let s=e,i=0;for(let e=0;e<n;e++){if(33639248!==r.getUint32(s,!0))throw new Error("Damaged zip file");if(i+=r.getUint32(s+24,!0),i>1073741824)throw new Error("Zip file too large");const e=r.getUint16(s+28,!0),n=a.decode(t.subarray(s+46,s+46+e));n.endsWith("/")||o.push({name:n,method:r.getUint16(s+10,!0),packedSize:r.getUint32(s+20,!0),localAt:r.getUint32(s+42,!0)}),s+=46+e+r.getUint16(s+30,!0)+r.getUint16(s+32,!0)}return o}async function o(t,e){if(0===t.method)return e.slice();if(8===t.method)return n(e,new DecompressionStream("deflate-raw"));throw new Error("Unsupported zip compression")}var s=(t,e)=>{const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.localAt+30+n.getUint16(26,!0)+n.getUint16(28,!0)};async function i(t){const e=r(t),n=new Map;for(const r of a(t,e.offset,e.count)){const e=s(r,t.subarray(r.localAt,r.localAt+30));n.set(r.name,await o(r,t.subarray(e,e+r.packedSize)))}return n}async function l(t){const e=async(e,n)=>new Uint8Array(await t.slice(e,n).arrayBuffer()),n=r(await e(Math.max(0,t.size-66e3),t.size)),i=new Map(a(await e(n.offset,n.offset+n.size),0,n.count).map(t=>[t.name,t]));return{names:[...i.keys()],read:async t=>{const n=i.get(t);if(!n)throw new Error(`No part named ${t}`);const r=s(n,await e(n.localAt,n.localAt+30));return o(n,await e(r,r+n.packedSize))}}}async function w(t){const r=new TextEncoder,a=[],o=[];let s=0;for(const[i,l]of t){const t=r.encode(i),w="undefined"==typeof CompressionStream?null:await n(l,new CompressionStream("deflate-raw")),c=null===w||w.length>=l.length,f=c?l:w,p=e(l),h=new Uint8Array(30+t.length),m=new DataView(h.buffer);m.setUint32(0,67324752,!0),m.setUint16(4,20,!0),m.setUint16(6,2048,!0),m.setUint16(8,c?0:8,!0),m.setUint16(12,33,!0),m.setUint32(14,p,!0),m.setUint32(18,f.length,!0),m.setUint32(22,l.length,!0),m.setUint16(26,t.length,!0),h.set(t,30);const u=new Uint8Array(46+t.length),d=new DataView(u.buffer);d.setUint32(0,33639248,!0),d.setUint16(4,20,!0),d.setUint16(6,20,!0),d.setUint16(8,2048,!0),d.setUint16(10,c?0:8,!0),d.setUint16(14,33,!0),d.setUint32(16,p,!0),d.setUint32(20,f.length,!0),d.setUint32(24,l.length,!0),d.setUint16(28,t.length,!0),d.setUint32(42,s,!0),u.set(t,46),a.push(h,f),o.push(u),s+=h.length+f.length}const i=o.reduce((t,e)=>t+e.length,0),l=new Uint8Array(22),w=new DataView(l.buffer);w.setUint32(0,101010256,!0),w.setUint16(8,t.size,!0),w.setUint16(10,t.size,!0),w.setUint32(12,i,!0),w.setUint32(16,s,!0);const c=new Uint8Array(s+i+22);let f=0;for(const t of[...a,...o,l])c.set(t,f),f+=t.length;return c}var c={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};function f(t){return t.includes("&")?t.replace(/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g,(t,e)=>{if("#"!==e[0])return c[e]??t;const n="x"===e[1]?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return n<=1114111?String.fromCodePoint(n):t}):t}function p(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f￾￿]/g,"")}var h=/([^\s=]+)\s*=\s*("([^"]*)"|'([^']*)')/g;function m(t){const e=[];let n=null,r=0;for(;r<t.length;){const a=t.indexOf("<",r);if(a<0)break;if(a>r&&e.length&&(e[e.length-1].text+=f(t.slice(r,a))),t.startsWith("\x3c!--",a)){r=u(t,"--\x3e",a);continue}if(t.startsWith("<?",a)){r=u(t,"?>",a);continue}if(t.startsWith("<![CDATA[",a)){const n=u(t,"]]>",a);e.length&&(e[e.length-1].text+=t.slice(a+9,n-3)),r=n;continue}if(t.startsWith("<!",a)){r=u(t,">",a);continue}const o=d(t,a);if("/"===t[a+1]){const n=e.pop();if(!n||n.name!==t.slice(a+2,o).trim())throw new Error("Malformed XML");n.innerEnd=a,n.end=o+1,r=o+1;continue}const s="/"===t[o-1],i=t.slice(a+1,s?o-1:o),l=i.search(/\s/),w={name:l<0?i:i.slice(0,l),attrs:{},children:[],text:"",start:a,end:o+1,innerStart:o+1,innerEnd:o+1};if(l>=0)for(const t of i.slice(l).matchAll(h))w.attrs[t[1]]=f(t[3]??t[4]??"");e.length?e[e.length-1].children.push(w):n||(n=w),s||e.push(w),r=o+1}if(!n||e.length)throw new Error("Malformed XML");return n}function u(t,e,n){const r=t.indexOf(e,n);if(r<0)throw new Error("Malformed XML");return r+e.length}function d(t,e){let n="";for(let r=e+1;r<t.length;r++){const e=t[r];if(n)e===n&&(n="");else if('"'===e||"'"===e)n=e;else if(">"===e)return r}throw new Error("Malformed XML")}var g=(t,e)=>t?.children.find(t=>t.name===e),y=(t,e)=>t?.children.filter(t=>t.name===e)??[];function v(t,e,n=[]){for(const r of t.children)e.has(r.name)&&n.push(r),v(r,e,n);return n}function x(t){if(!t)return;const e=t.attrs["w:val"];return!("0"===e||"false"===e||"off"===e||"none"===e)}var b='xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"',$="http://schemas.openxmlformats.org/officeDocument/2006/relationships",U={officeDocument:`${$}/officeDocument`,styles:`${$}/styles`,numbering:`${$}/numbering`,theme:`${$}/theme`,comments:`${$}/comments`,footnotes:`${$}/footnotes`,header:`${$}/header`,footer:`${$}/footer`,image:`${$}/image`,hyperlink:`${$}/hyperlink`},T=new TextEncoder,P=new TextDecoder,z=(t,e)=>{const n=t.get(e);return n?P.decode(n):void 0},C=(t,e,n)=>{t.set(e,T.encode(n))},N=t=>{const e=t.lastIndexOf("/");return`${t.slice(0,e+1)}_rels/${t.slice(e+1)}.rels`};function A(t,e){const n=z(t,N(e));return n?m(n).children.filter(t=>"Relationship"===t.name).map(t=>({id:t.attrs.Id,type:t.attrs.Type,target:t.attrs.Target,external:"External"===t.attrs.TargetMode})):[]}function M(t,e){if(e.startsWith("/"))return e.slice(1);const n=t.split("/").slice(0,-1);for(const t of e.split("/"))".."===t?n.pop():"."!==t&&n.push(t);return n.join("/")}function k(t,e,n,r,a=!1){const o=N(e),s=z(t,o),i=new Set(A(t,e).map(t=>t.id));let l=i.size+1;for(;i.has(`rId${l}`);)l++;const w=`rId${l}`,c=`<Relationship Id="${w}" Type="${n}" Target="${p(r)}"${a?' TargetMode="External"':""}/>`;return C(t,o,s?s.replace(/(<\/Relationships>\s*)$/,`${c}$1`).replace(/<Relationships([^>]*)\/>\s*$/,`<Relationships$1>${c}</Relationships>`):`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${c}</Relationships>`),w}function D(t,e,n){const r=z(t,"[Content_Types].xml")??"";r.includes(`PartName="/${e}"`)||C(t,"[Content_Types].xml",r.replace("</Types>",`<Override PartName="/${e}" ContentType="${n}"/></Types>`))}function R(t,e,n){const r=z(t,"[Content_Types].xml")??"";new RegExp(`Extension="${e}"`,"i").test(r)||C(t,"[Content_Types].xml",r.replace(/(<Types[^>]*>)/,`$1<Default Extension="${e}" ContentType="${n}"/>`))}var E={a4:{width:11906,height:16838},letter:{width:12240,height:15840},legal:{width:12240,height:20160},a3:{width:16838,height:23811},a5:{width:8391,height:11906}},I={normal:{top:1440,right:1440,bottom:1440,left:1440},narrow:{top:720,right:720,bottom:720,left:720},moderate:{top:1440,right:1080,bottom:1440,left:1080},wide:{top:1440,right:2880,bottom:1440,left:2880}},L={...E.a4,...I.normal,header:708,footer:708};function O(t,e){const n=E[e];return t.width>t.height?{...t,width:n.height,height:n.width}:{...t,...n}}function F(t,e){return{...t,...I[e]}}function j(t){const e=Math.min(t.width,t.height),n=Math.max(t.width,t.height);for(const[t,r]of Object.entries(E))if(Math.abs(r.width-e)<30&&Math.abs(r.height-n)<30)return t;return null}function S(t){for(const[e,n]of Object.entries(I))if(n.top===t.top&&n.right===t.right&&n.bottom===t.bottom&&n.left===t.left)return e;return null}var q={yellow:"#ffff00",green:"#00ff00",cyan:"#00ffff",magenta:"#ff00ff",blue:"#0000ff",red:"#ff0000",darkBlue:"#000080",darkCyan:"#008080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",darkGray:"#808080",lightGray:"#c0c0c0",black:"#000000",white:"#ffffff"};function W(t){if(!t)return{};try{const e=m(t),n=g(g(e,"a:themeElements"),"a:fontScheme");return{major:g(g(n,"a:majorFont"),"a:latin")?.attrs.typeface,minor:g(g(n,"a:minorFont"),"a:latin")?.attrs.typeface}}catch{return{}}}var _=t=>t&&/^[0-9a-fA-F]{6}$/.test(t)?`#${t.toLowerCase()}`:void 0;function H(t,e){const n={};if(!t)return n;const r=x(g(t,"w:b"));void 0!==r&&(n.b=r);const a=x(g(t,"w:i"));void 0!==a&&(n.i=a);const o=g(t,"w:u");o&&(n.u="none"!==o.attrs["w:val"]);const s=x(g(t,"w:strike"));void 0!==s&&(n.strike=s);const i=g(t,"w:vertAlign")?.attrs["w:val"];"subscript"===i&&(n.vert="sub"),"superscript"===i&&(n.vert="super");const l=function(t,e){if(!t)return;const n=t.attrs["w:ascii"]??t.attrs["w:hAnsi"];if(n)return n;const r=t.attrs["w:asciiTheme"]??t.attrs["w:hAnsiTheme"];return r?r.startsWith("major")?e.major:e.minor:t.attrs["w:eastAsia"]??t.attrs["w:cs"]}(g(t,"w:rFonts"),e);l&&(n.font=l);const w=Number(g(t,"w:sz")?.attrs["w:val"]);w&&(n.size=w/2);const c=_(g(t,"w:color")?.attrs["w:val"]);c&&(n.color=c);const f=g(t,"w:highlight")?.attrs["w:val"];if(f&&q[f])n.hl=q[f];else{const e=_(g(t,"w:shd")?.attrs["w:fill"]);e&&(n.hl=e)}return n}function V(t){const e={};if(!t)return e;const n=g(t,"w:jc")?.attrs["w:val"];"left"===n||"start"===n?e.align="left":"center"===n?e.align="center":"right"===n||"end"===n?e.align="right":"both"!==n&&"distribute"!==n||(e.align="justify");const r=g(t,"w:ind");if(r){const t=r.attrs["w:left"]??r.attrs["w:start"];void 0!==t&&(e.indentLeft=Number(t)/20),void 0!==r.attrs["w:firstLine"]&&(e.firstLine=Number(r.attrs["w:firstLine"])/20),void 0!==r.attrs["w:hanging"]&&(e.firstLine=-Number(r.attrs["w:hanging"])/20)}const a=g(t,"w:spacing");if(a){void 0!==a.attrs["w:before"]&&(e.before=Number(a.attrs["w:before"])/20),void 0!==a.attrs["w:after"]&&(e.after=Number(a.attrs["w:after"])/20);const t=Number(a.attrs["w:line"]);t&&("exact"===a.attrs["w:lineRule"]||"atLeast"===a.attrs["w:lineRule"]?e.linePoints=t/20:e.lineMultiple=t/240)}return e}var B=t=>Math.round(100*t)/100;function Q(t){const e=[];return t.align&&e.push(`text-align:${t.align}`),void 0!==t.indentLeft&&e.push(`margin-left:${B(t.indentLeft)}pt`),void 0!==t.firstLine&&e.push(`text-indent:${B(t.firstLine)}pt`),void 0!==t.before&&e.push(`margin-top:${B(t.before)}pt`),void 0!==t.after&&e.push(`margin-bottom:${B(t.after)}pt`),void 0!==t.lineMultiple&&e.push(`line-height:${B(t.lineMultiple)}`),void 0!==t.linePoints&&e.push(`line-height:${B(t.linePoints)}pt`),e.join(";")}function X(t){const e=[];void 0!==t.b&&e.push("font-weight:"+(t.b?700:400)),void 0!==t.i&&e.push("font-style:"+(t.i?"italic":"normal"));const n=[t.u&&"underline",t.strike&&"line-through"].filter(Boolean);return n.length&&e.push(`text-decoration-line:${n.join(" ")}`),t.font&&e.push(`font-family:${function(t){const e=t.replace(/["\\<>;]/g,"");return/mono|courier|consolas|menlo/i.test(e)?`"${e}",monospace`:/times|georgia|cambria|garamond|palatino|serif|song|ming/i.test(e)&&!/sans/i.test(e)?`"${e}",Caladea,serif`:`"${e}",Carlito,Arial,sans-serif`}(t.font)}`),t.size&&e.push(`font-size:${B(t.size)}pt`),t.color&&e.push(`color:${t.color}`),t.hl&&e.push(`background-color:${t.hl}`),e.join(";")}var Z={Title:{name:"Title",xml:'<w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:after="80" w:line="240" w:lineRule="auto"/></w:pPr><w:rPr><w:sz w:val="56"/><w:szCs w:val="56"/></w:rPr></w:style>'},Heading1:{name:"heading 1",xml:'<w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="360" w:after="80"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:color w:val="0F4761"/><w:sz w:val="40"/><w:szCs w:val="40"/></w:rPr></w:style>'},Heading2:{name:"heading 2",xml:'<w:style w:type="paragraph" w:styleId="Heading2"><w:name w:val="heading 2"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="160" w:after="80"/><w:outlineLvl w:val="1"/></w:pPr><w:rPr><w:color w:val="0F4761"/><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr></w:style>'},Heading3:{name:"heading 3",xml:'<w:style w:type="paragraph" w:styleId="Heading3"><w:name w:val="heading 3"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="160" w:after="80"/><w:outlineLvl w:val="2"/></w:pPr><w:rPr><w:color w:val="0F4761"/><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr></w:style>'},Quote:{name:"Quote",xml:'<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:spacing w:before="160"/><w:jc w:val="center"/></w:pPr><w:rPr><w:i/><w:iCs/><w:color w:val="404040"/></w:rPr></w:style>'}},G='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';function Y(t){const e=new Map;C(e,"[Content_Types].xml",`${G}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/></Types>`),C(e,"_rels/.rels",`${G}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${U.officeDocument}" Target="word/document.xml"/></Relationships>`);const n=L;C(e,"word/document.xml",`${G}<w:document ${b}><w:body><w:p/><w:sectPr><w:pgSz w:w="${n.width}" w:h="${n.height}"/><w:pgMar w:top="${n.top}" w:right="${n.right}" w:bottom="${n.bottom}" w:left="${n.left}" w:header="${n.header}" w:footer="${n.footer}" w:gutter="0"/></w:sectPr></w:body></w:document>`),C(e,"word/_rels/document.xml.rels",`${G}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="${U.styles}" Target="styles.xml"/><Relationship Id="rId2" Type="${$}/settings" Target="settings.xml"/></Relationships>`),C(e,"word/settings.xml",`${G}<w:settings ${b}><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15"/></w:compat></w:settings>`);const r=/^[A-Za-z]{2,3}(-[A-Za-z0-9]+)*$/.test(t)?t:"en-AU";return C(e,"word/styles.xml",`${G}<w:styles ${b}><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Calibri" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="${r}"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="259" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>${Object.values(Z).map(t=>t.xml).join("")}<w:style w:type="table" w:default="1" w:styleId="TableNormal"><w:name w:val="Normal Table"/><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style></w:styles>`),e}export{i as readZip,l as openZip,w as writeZip,p as escapeXml,m as parseXml,g as child,y as childrenOf,v as descendants,b as WORD_NS,U as REL,z as partText,C as setPartText,A as readRels,M as resolveTarget,k as addRel,D as addContentOverride,R as addContentDefault,E as PAPER_SIZES,I as MARGIN_PRESETS,L as DEFAULT_PAGE,O as withPaper,F as withMargins,j as paperOf,S as marginsOf,q as HIGHLIGHTS,W as readThemeFonts,H as parseRunProps,V as parseParaProps,Q as paraCss,X as runCss,Z as BUILTIN_STYLES,Y as blankDocxParts};
@@ -0,0 +1 @@
1
+ var e={decks:"Decks",newDeck:"New deck",untitledDeck:"Untitled deck",emptyTitle:"Make your first deck",emptyBody:"Build slides here, then present them or export to PowerPoint.",openFailed:"Couldn't open this deck",createFailed:"Could not create a deck.",deleteFailed:"Could not delete this deck.",backToDecks:"Back to decks",deleteConfirm:e=>`Delete "${e}"? This can't be undone.`,delete:"Delete",deckName:"Deck name",slidesPanel:"Slides",slideNumber:e=>`Slide ${e}`,slideOf:(e,t)=>`Slide ${e} of ${t}`,addSlide:"Add slide",duplicateSlide:"Duplicate slide",deleteSlide:"Delete slide",slideText:"Slide text",undo:"Undo",redo:"Redo",export:"Export",exportFailed:"Could not export this deck.",present:"Present",endShow:"End show",popupBlocked:"Your browser blocked the audience window. Allow pop-ups for this site, then end the show and present again.",back:"Back",next:"Next",nextSlide:"Next slide",endOfDeck:"End of the deck.",notes:"Notes",noNotes:"No notes for this slide.",speakerNotes:"Speaker notes",saveFailed:"Could not save this deck. Trying again.",renameFailed:"Could not rename this deck.",conflict:"Somebody else changed this deck. Your latest edits aren't saved. Reload to see their version.",reload:"Reload",addText:"Add text",addShape:"Add shape",addImage:"Add image",addChart:"Add chart",addTable:"Add table",elementText:"Text",elementShape:"Shape",elementImage:"Image",elementChart:"Chart",elementTable:"Table",slide:"Slide",objects:e=>`${e} objects`,background:"Background",positionAndSize:"Position and size",width:"W",height:"H",angle:"Angle",align:"Align",alignLeft:"Align left",alignCentre:"Align centre",alignRight:"Align right",bringForward:"Bring forward",size:"Size",weight:"Weight",regular:"Regular",bold:"Bold",textAlignment:"Text alignment",left:"Left",centre:"Centre",right:"Right",colour:"Colour",rectangle:"Rectangle",ellipse:"Ellipse",roundedRectangle:"Rounded rectangle",diamond:"Diamond",lineShape:"Line",outlineColour:"Outline colour",imageAddress:"Image address",chooseImage:"Choose image",imageTitle:"Slide image",description:"Description",data:"Data",chartType:"Chart type",bar:"Bar",line:"Line",values:"Values",valuesHint:"One label and number a line, like Sept, 42.",rows:"Rows",rowsHint:"One row a line, with commas between cells.",headingColour:"Heading colour",pptxPasswordProtected:"This file has a password. Remove it in PowerPoint, then import the file again.",pptxUnreadable:"This file can't be read as a PowerPoint (.pptx) file.",pptxLegacyFormat:"This is an older Office file. Save it as .pptx in PowerPoint, then import it again.",pptxTooManySlides:(e,t)=>`This deck has ${e} slides, and a deck can have at most ${t}.`,pptxTooLarge:(e,t)=>`This deck comes to ${e} MiB without its pictures, and a deck can be at most ${t} MiB. Split it into smaller decks.`,pdfSlideFailed:e=>`Slide ${e} couldn't be drawn for the PDF.`},t={decks:"演示文稿",newDeck:"新建演示文稿",untitledDeck:"未命名演示文稿",emptyTitle:"制作第一份演示文稿",emptyBody:"在这里制作幻灯片,然后放映或导出为 PowerPoint。",openFailed:"无法打开此演示文稿",createFailed:"无法创建演示文稿。",deleteFailed:"无法删除此演示文稿。",backToDecks:"返回演示文稿列表",deleteConfirm:e=>`要删除“${e}”吗?此操作无法撤销。`,delete:"删除",deckName:"演示文稿名称",slidesPanel:"幻灯片",slideNumber:e=>`第 ${e} 张幻灯片`,slideOf:(e,t)=>`第 ${e} 张,共 ${t} 张`,addSlide:"添加幻灯片",duplicateSlide:"复制幻灯片",deleteSlide:"删除幻灯片",slideText:"幻灯片文字",undo:"撤销",redo:"重做",export:"导出",exportFailed:"无法导出此演示文稿。",present:"放映",endShow:"结束放映",popupBlocked:"浏览器阻止了观众窗口。请允许此网站的弹出窗口,然后结束放映并重新放映。",back:"上一张",next:"下一张",nextSlide:"下一张幻灯片",endOfDeck:"演示文稿已结束。",notes:"备注",noNotes:"此幻灯片没有备注。",speakerNotes:"演讲者备注",saveFailed:"无法保存此演示文稿,正在重试。",renameFailed:"无法重命名此演示文稿。",conflict:"其他人修改了此演示文稿,您最近的编辑未保存。请重新加载以查看对方的版本。",reload:"重新加载",addText:"添加文字",addShape:"添加形状",addImage:"添加图片",addChart:"添加图表",addTable:"添加表格",elementText:"文字",elementShape:"形状",elementImage:"图片",elementChart:"图表",elementTable:"表格",slide:"幻灯片",objects:e=>`${e} 个对象`,background:"背景",positionAndSize:"位置和大小",width:"宽",height:"高",angle:"角度",align:"对齐",alignLeft:"左对齐",alignCentre:"居中对齐",alignRight:"右对齐",bringForward:"上移一层",size:"字号",weight:"字重",regular:"常规",bold:"粗体",textAlignment:"文字对齐",left:"左",centre:"中",right:"右",colour:"颜色",rectangle:"矩形",ellipse:"椭圆",roundedRectangle:"圆角矩形",diamond:"菱形",lineShape:"线条",outlineColour:"轮廓颜色",imageAddress:"图片地址",chooseImage:"选择图片",imageTitle:"幻灯片图片",description:"描述",data:"数据",chartType:"图表类型",bar:"柱形图",line:"折线图",values:"数值",valuesHint:"每行一个标签和数字,例如 九月, 42。",rows:"行",rowsHint:"每行一行数据,单元格之间用逗号分隔。",headingColour:"标题颜色",pptxPasswordProtected:"此文件设有密码。请先在 PowerPoint 中移除密码,再重新导入。",pptxUnreadable:"无法将此文件读取为 PowerPoint (.pptx) 文件。",pptxLegacyFormat:"这是旧版 Office 文件。请先在 PowerPoint 中另存为 .pptx,再重新导入。",pptxTooManySlides:(e,t)=>`此演示文稿有 ${e} 张幻灯片,最多只能有 ${t} 张。`,pptxTooLarge:(e,t)=>`此演示文稿不计图片已达 ${e} MiB,上限为 ${t} MiB。请拆分成较小的演示文稿。`,pdfSlideFailed:e=>`第 ${e} 张幻灯片无法绘制到 PDF。`};export{e as ENGLISH_WORDS,t as ZH_HANS_WORDS};
@@ -0,0 +1 @@
1
+ import{ENGLISH_WORDS as r}from"./chunk-SB3YS3LH.js";var s=class extends Error{constructor(s=r.pptxPasswordProtected){super(s),this.name="PptxPasswordError"}},t=class extends Error{constructor(s=r.pptxUnreadable){super(s),this.name="PptxUnreadableError"}};export{s as PptxPasswordError,t as PptxUnreadableError};
@@ -0,0 +1 @@
1
+ var t=1048576,n=16384;function e(t){let n=t+1,e="";for(;n>0;){const t=(n-1)%26;e=String.fromCharCode(65+t)+e,n=Math.floor((n-1)/26)}return e}function r(t){let n=0;for(const e of t.toUpperCase())n=26*n+(e.charCodeAt(0)-64);return n-1}function o(t,n){return`${e(n)}${t+1}`}function s(t,n){return{r1:Math.min(t.row,n.row),c1:Math.min(t.col,n.col),r2:Math.max(t.row,n.row),c2:Math.max(t.col,n.col)}}function c(t){const n=o(t.r1,t.c1);return t.r1===t.r2&&t.c1===t.c2?n:`${n}:${o(t.r2,t.c2)}`}function u(t,n,e){return n>=t.r1&&n<=t.r2&&e>=t.c1&&e<=t.c2}function l(t,n){return t.r1<=n.r2&&t.r2>=n.r1&&t.c1<=n.c2&&t.c2>=n.c1}function i(t){const n=/^\$?([A-Za-z]{1,3})\$?(\d{1,7})(?::\$?([A-Za-z]{1,3})\$?(\d{1,7}))?$/.exec(t.trim());if(!n)return null;const e={row:Number(n[2])-1,col:r(n[1])},o=n[3]?{row:Number(n[4])-1,col:r(n[3])}:e;return e.row<0||o.row<0?null:s(e,o)}var a=class extends Error{},f=String.raw`(\$?)([A-Za-z]{1,3})(\$?)(\d{1,7})`,h=new RegExp(`^${f}(?::${f})?(?![A-Za-z0-9_.(])`),m=/^(\$?)([A-Za-z]{1,3}):(\$?)([A-Za-z]{1,3})(?![A-Za-z0-9_.(])/,d=/^(\$?)(\d{1,7}):(\$?)(\d{1,7})(?![A-Za-z0-9_.(])/,p=/^(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/,g=/^[A-Za-z_][A-Za-z0-9_.]*/,w=/^#(?:REF!|N\/A|NAME\?|DIV\/0!|VALUE!|NUM!|NULL!)/i,b=/^(?:'((?:[^']|'')+)'|([A-Za-z_][A-Za-z0-9_.]*))!/;function M(t,n,e,o){return{col:r(n),row:Number(o)-1,colAbs:"$"===t,rowAbs:"$"===e}}function y(e){let o=null,s=0;const c=b.exec(e);c&&(o=void 0!==c[1]?c[1].replace(/''/g,"'"):c[2],s=c[0].length);const u=e.slice(s),l=h.exec(u);if(l){const e=M(l[1],l[2],l[3],l[4]);if(e.row<0||e.row>=t||e.col>=n)return null;const r=l[6]?M(l[5],l[6],l[7],l[8]):null;return r&&(r.row<0||r.row>=t||r.col>=n)?null:{ref:{sheet:o,a:e,b:r},length:s+l[0].length}}const i=m.exec(u);if(i){return{ref:{sheet:o,a:{col:r(i[2]),row:null,colAbs:"$"===i[1],rowAbs:!1},b:{col:r(i[4]),row:null,colAbs:"$"===i[3],rowAbs:!1}},length:s+i[0].length}}const a=d.exec(u);if(a&&Number(a[2])>0&&Number(a[4])>0){return{ref:{sheet:o,a:{col:null,row:Number(a[2])-1,colAbs:!1,rowAbs:"$"===a[1]},b:{col:null,row:Number(a[4])-1,colAbs:!1,rowAbs:"$"===a[3]}},length:s+a[0].length}}return null}var A=["<=",">=","<>","+","-","*","/","^","&","=","<",">","%","(",")",",",";"];function v(t){const n=[];let e=0;for(;e<t.length;){const r=t[e];if(/\s/.test(r)){e++;continue}const o=t.slice(e);if('"'===r){let r=e+1,o="",s=!1;for(;r<t.length;){if('"'===t[r]){if('"'===t[r+1]){o+='"',r+=2;continue}s=!0,r++;break}o+=t[r++]}if(!s)return{tokens:n,complete:!1};n.push({type:"string",value:o,start:e,end:r}),e=r;continue}if("#"===r){const t=w.exec(o);if(!t)return{tokens:n,complete:!1};n.push({type:"error",value:t[0].toUpperCase(),start:e,end:e+t[0].length}),e+=t[0].length;continue}const s=y(o);if(s){n.push({type:"ref",ref:s.ref,start:e,end:e+s.length}),e+=s.length;continue}const c=p.exec(o);if(c){n.push({type:"number",value:Number(c[0]),start:e,end:e+c[0].length}),e+=c[0].length;continue}const u=g.exec(o);if(u){n.push({type:"ident",value:u[0],start:e,end:e+u[0].length}),e+=u[0].length;continue}const l=A.find(t=>o.startsWith(t));if(!l)return{tokens:n,complete:!1};n.push({type:"op",value:l,start:e,end:e+l.length}),e+=l.length}return{tokens:n,complete:!0}}var E={"=":1,"<>":1,"<":1,">":1,"<=":1,">=":1,"&":2,"+":3,"-":3,"*":4,"/":4,"^":6},N=class{constructor(t){this.tokens=t}tokens;pos=0;peek(){return this.tokens[this.pos]}isOp(t){const n=this.peek();return"op"===n?.type&&n.value===t}run(){const t=this.expression(0);if(this.pos<this.tokens.length)throw new a("Unexpected text");return t}expression(t){let n=this.prefix();for(;;){const e=this.peek();if("op"!==e?.type)break;if("%"===e.value){this.pos++,n={kind:"percent",arg:n};continue}const r=E[e.value];if(void 0===r||r<=t)break;this.pos++,n={kind:"binary",op:e.value,left:n,right:this.expression(r)}}return n}prefix(){const t=this.peek();if(!t)throw new a("Formula ends early");switch(this.pos++,t.type){case"number":return{kind:"num",value:t.value};case"string":return{kind:"str",value:t.value};case"error":return{kind:"err",value:t.value};case"ref":return{kind:"ref",ref:t.ref};case"ident":{if(this.isOp("("))return this.call(t.value);const n=t.value.toUpperCase();return"TRUE"===n?{kind:"bool",value:!0}:"FALSE"===n?{kind:"bool",value:!1}:{kind:"err",value:"#NAME?"}}case"op":if("-"===t.value||"+"===t.value)return{kind:"unary",op:t.value,arg:this.expression(7)};if("("===t.value){const t=this.expression(0);if(!this.isOp(")"))throw new a("Missing )");return this.pos++,t}throw new a(`Unexpected ${t.value}`)}}call(t){this.pos++;const n=[];if(this.isOp(")"))return this.pos++,{kind:"call",name:t.toUpperCase(),args:n};for(;;){if(this.isOp(",")||this.isOp(";")||this.isOp(")")?n.push({kind:"empty"}):n.push(this.expression(0)),!this.isOp(",")&&!this.isOp(";")){if(this.isOp(")"))return this.pos++,{kind:"call",name:t.toUpperCase(),args:n};throw new a("Missing )")}this.pos++}}},x=new Map;function C(t){return t.length>1&&"="===t[0]}function $(t){return(null===t.col?"":`${t.colAbs?"$":""}${e(t.col)}`)+(null===t.row?"":`${t.rowAbs?"$":""}${t.row+1}`)}function S(t){return(null===(n=t.sheet)?"":/^[A-Za-z_][A-Za-z0-9_.]*$/.test(n)&&!h.test(n)?`${n}!`:`'${n.replace(/'/g,"''")}'!`)+$(t.a)+(t.b?`:${$(t.b)}`:"");var n}function O(t,n){if(!C(t))return t;const e=t.slice(1),{tokens:r}=v(e);let o="",s=0;for(const t of r){if("ref"!==t.type)continue;const r=n(t.ref);o+=e.slice(s,t.start)+(r?S(r):"#REF!"),s=t.end}return`=${o}${e.slice(s)}`}function R(e,r,o){const s=e=>{const s=null===e.row||e.rowAbs?e.row:e.row+r,c=null===e.col||e.colAbs?e.col:e.col+o;return null!==s&&(s<0||s>=t)||null!==c&&(c<0||c>=n)?null:{...e,row:s,col:c}};return O(e,t=>{const n=s(t.a),e=t.b?s(t.b):null;return!n||t.b&&!e?null:{...t,a:n,b:e}})}function T(t){return t.colAbs||t.rowAbs?t.colAbs&&t.rowAbs?{...t,colAbs:!1,rowAbs:!0}:!t.colAbs&&t.rowAbs?{...t,colAbs:!0,rowAbs:!1}:{...t,colAbs:!1,rowAbs:!1}:{...t,colAbs:!0,rowAbs:!0}}var U=t=>String(t).padStart(2,"0"),F={general:"General",number:"#,##0.00",percent:"0.00%",currency:'"$"#,##0.00',scientific:"0.00E+00",date:"yyyy-mm-dd",time:"h:mm:ss AM/PM",dateTime:"yyyy-mm-dd h:mm",text:"@"},k=864e5,D=Date.UTC(1899,11,30);function L(t,n,e){return Math.round((Date.UTC(t,n-1,e)-D)/k)}function I(t){const n=Math.floor(t),e=new Date(D+n*k),r=Math.round(86400*(t-n));return{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),weekday:e.getUTCDay(),hours:Math.floor(r/3600)%24,minutes:Math.floor(r/60)%60,seconds:r%60}}var P=/\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i;function V(t){const n=[];let e="",r=!1;for(let o=0;o<t.length;o++){const s=t[o];"\\"!==s?('"'===s&&(r=!r),";"!==s||r?e+=s:(n.push(e),e="")):e+=s+(t[++o]??"")}return n.push(e),n}function z(t){return t.replace(/\\./g,"").replace(/"[^"]*"/g,"").replace(/\[[^\]]*\]/g,"")}function G(t){return!(!t||"General"===t||"@"===t)&&/[ymdhs]/i.test(z(V(t)[0]).replace(/E\+/gi,""))}var W=["January","February","March","April","May","June","July","August","September","October","November","December"],j=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function H(t,n){const e=I(n),r=/AM\/PM|A\/P/i.test(z(t)),o=t.match(/"[^"]*"|\\.|\[[^\]]*\]|AM\/PM|A\/P|y+|m+|d+|h+|s+|./gi)??[];let s="";return o.forEach((t,n)=>{if('"'===t[0])s+=t.slice(1,-1);else if("\\"===t[0])s+=t.slice(1);else if("["===t[0])s+="";else if(/^AM\/PM$/i.test(t))s+=e.hours<12?"AM":"PM";else if(/^A\/P$/i.test(t))s+=e.hours<12?"A":"P";else if(/^y+$/i.test(t))s+=t.length<=2?U(e.year%100):String(e.year);else if(/^m+$/i.test(t))t.length<=2&&(t=>{for(let n=t-1;n>=0;n--){if(/^h+$/i.test(o[n]))return!0;if(/^[ymds]+$/i.test(o[n]))break}for(let n=t+1;n<o.length;n++){if(/^s+$/i.test(o[n]))return!0;if(/^[ymdh]+$/i.test(o[n]))break}return!1})(n)?s+=2===t.length?U(e.minutes):String(e.minutes):1===t.length?s+=String(e.month):2===t.length?s+=U(e.month):3===t.length?s+=W[e.month-1].slice(0,3):s+=W[e.month-1];else if(/^d+$/i.test(t))1===t.length?s+=String(e.day):2===t.length?s+=U(e.day):3===t.length?s+=j[e.weekday].slice(0,3):s+=j[e.weekday];else if(/^h+$/i.test(t)){const n=r?e.hours%12||12:e.hours;s+=2===t.length?U(n):String(n)}else/^s+$/i.test(t)?s+=2===t.length?U(e.seconds):String(e.seconds):s+=t}),s}function Z(t,n){const e=/[eE]([+-])(0+|\?+|#+)$/.exec(t);if(e){const r=(t.slice(0,e.index).split(".")[1]??"").length,[o,s]=n.toExponential(r).split("e"),c=Number(s);return`${o}E${c<0?"-":"+"===e[1]?"+":""}${String(Math.abs(c)).padStart(e[2].length,"0")}`}const[r,o=""]=t.split("."),s=/,+$/.exec(r)?.[0].length??0,c=/[#0?],[#0?]/.test(r),u=(r.match(/0/g)??[]).length,l=o.replace(/[^#0?]/g,"").length,i=(o.match(/0/g)??[]).length,a=n/1e3**s,f=Math.abs(a).toFixed(Math.min(l,20));let[h,m=""]=f.split(".");for(;m.length>i&&m.endsWith("0");)m=m.slice(0,-1);return"0"===h&&0===u&&(h=""),h=h.padStart(u,"0"),c&&(h=h.replace(/\B(?=(\d{3})+(?!\d))/g,",")),m?`${h}.${m}`:(o.includes("."),h)}function _(t){if(!Number.isFinite(t))return String(t);if(0===t)return"0";const n=Math.abs(t);if(n>=1e11||n<1e-9){const[n,e]=t.toExponential(5).split("e"),r=Number(e);return`${n.replace(/\.?0+$/,"")}E${r<0?"-":"+"}${U(Math.abs(r))}`}return String(Number(t.toPrecision(10)))}var K={black:"#000000",blue:"#0000ff",cyan:"#00ffff",green:"#00a650",magenta:"#ff00ff",red:"#ff0000",white:"#ffffff",yellow:"#ffff00"};function X(t,n){if(!n||"General"===n||"@"===n)return{text:_(t),color:null};const e=V(n);let r=e[0],o=!1;t<0&&e.length>1?(r=e[1],o=!0):0===t&&e.length>2&&(r=e[2]);const s=P.exec(r),c=s?K[s[1].toLowerCase()]??null:null;if(/general/i.test(z(r)))return{text:r.replace(/\[[^\]]*\]/g,"").replace(/general/i,_(o?-t:t)),color:c};if(G(r))return t<0?{text:_(t),color:c}:{text:H(r,t),color:c};const u=o?Math.abs(t):t,l=function(t,n){const e=t.match(/"[^"]*"|\\.|\[[^\]]*\]|_.|\*.|[#0?][#0?,.]*(?:[eE][+-][0?#]+)?%?|%|./g)??[],r=n*100**(z(t).match(/%/g)??[]).length;let o="",s=!1;for(const t of e)if('"'===t[0])o+=t.slice(1,-1);else if("\\"===t[0])o+=t.slice(1);else if("["===t[0]){const n=/^\[\$([^-\]]*)/.exec(t);n&&(o+=n[1])}else if("_"===t[0])o+=" ";else if("*"===t[0])o+="";else if(/^[#0?]/.test(t)){const n=t.endsWith("%"),e=n?t.slice(0,-1):t;s||(o+=Z(e,r),s=!0),n&&(o+="%")}else o+=t;return s?o:`${o}`}(r,Math.abs(u)),i=!/[1-9]/.test(l);return{text:!o&&t<0&&!i?`-${l}`:l,color:c}}function Y(t,n){if(!n||"General"===n||"@"===n)return t;const e=V(n),r=e.length>=4?e[3]:e[0];return r.includes("@")?r.replace(/"([^"]*)"/g,"$1").replace(/\\(.)/g,"$1").replace(/@/g,t):t}function B(t,n,e){let r=t;if(!r||"General"===r){const t=null===e?0:Math.min(9,(String(e).split(".")[1]??"").length);r=t>0?`0.${"0".repeat(t)}`:"0"}return"@"===r||G(r)?r:V(r).map(t=>{const e=t.match(/"[^"]*"|\\.|\[[^\]]*\]|./g)??[];let r=-1,o=-1;return e.forEach((t,n)=>{"."===t&&-1===o&&(o=n),"0"!==t&&"#"!==t&&"?"!==t||(r=n)}),-1===r?t:(1===n?-1===o?e.splice(r+1,0,".","0"):e.splice(r+1,0,"0"):-1!==o&&(r-o===1?e.splice(o,2):e.splice(r,1)),e.join(""))}).join(";")}var J=/^(-?)\s*([$€£¥])\s*(-?)\s*([\d,]*\.?\d+)$/,q=/^[+-]?(?:\d{1,3}(?:,\d{3})+|\d+)?(?:\.\d+)?(?:[eE][+-]?\d+)?$/,Q=/^[+-]?0\d/,tt=/^[+-]?\d{16,}$/,nt=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,et=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/;function rt(){try{const t=new Intl.DateTimeFormat(void 0).formatToParts(new Date(2e3,11,31));return t.findIndex(t=>"day"===t.type)<t.findIndex(t=>"month"===t.type)}catch{return!0}}function ot(t,n,e){if(n<1||n>12||e<1||e>31)return!1;const r=new Date(Date.UTC(t,n-1,e));return r.getUTCMonth()===n-1&&r.getUTCDate()===e}function st(t){const n=t.trim();if(!n||Q.test(n)||tt.test(n))return null;const e=J.exec(n);if(e){const t=Number(e[4].replace(/,/g,""));if(Number.isNaN(t))return null;return{value:"-"===e[1]||"-"===e[3]?-t:t,kind:"currency",format:`"${e[2]}"#,##0${e[4].includes(".")?".00":""}`}}if(n.endsWith("%")){const t=n.slice(0,-1).trim();if(!t||!q.test(t))return null;return{value:Number(t.replace(/,/g,""))/100,kind:"percent",format:t.includes(".")?"0.00%":"0%"}}if(/\d/.test(n)&&q.test(n))return{value:Number(n.replace(/,/g,"")),kind:"number",format:n.includes(",")?n.includes(".")?"#,##0.00":"#,##0":null};const r=nt.exec(n);if(r&&ot(Number(r[1]),Number(r[2]),Number(r[3])))return{value:L(Number(r[1]),Number(r[2]),Number(r[3])),kind:"date",format:F.date};const o=et.exec(n);if(o){const t=Number(o[1]),n=Number(o[2]),e=2===o[3].length?2e3+Number(o[3]):Number(o[3]),[r,s]=rt()?[t,n]:[n,t];if(ot(e,s,r))return{value:L(e,s,r),kind:"date",format:rt()?"dd/mm/yyyy":"mm/dd/yyyy"}}return null}var ct=class{constructor(t){this.code=t}code;toString(){return this.code}},ut=t=>"object"==typeof t&&null!==t&&!(t instanceof ct),lt=t=>new ct(t),it=lt("#VALUE!"),at=lt("#DIV/0!"),ft=lt("#NUM!"),ht=lt("#N/A"),mt=lt("#REF!"),dt=lt("#NAME?"),pt=lt("#CIRC!"),gt=lt("#ERROR!"),wt=/^-?(?:0|[1-9]\d{0,14})(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function bt(t){if(""===t)return null;if("'"===t[0])return t.slice(1);if(wt.test(t))return Number(t);const n=t.toUpperCase();return"TRUE"===n||"FALSE"!==n&&t}function Mt(t){return ut(t)?0===t.rows||0===t.cols?null:t.at(0,0):t}function yt(t){if(null===t)return 0;if("number"==typeof t)return t;if("boolean"==typeof t)return t?1:0;if(t instanceof ct)return t;if(""===t.trim())return it;const n=st(t);return n?n.value:it}function At(t){return null===t?"":"number"==typeof t?_(t):"boolean"==typeof t?t?"TRUE":"FALSE":t instanceof ct?t.code:t}function vt(t){if(null===t)return!1;if("boolean"==typeof t)return t;if("number"==typeof t)return 0!==t;if(t instanceof ct)return t;const n=t.toUpperCase();return"TRUE"===n||"FALSE"!==n&&it}function Et(t,n){const e=t=>"number"==typeof t?0:"string"==typeof t?1:"boolean"==typeof t?2:3,r=null===t?"string"==typeof n?"":"boolean"!=typeof n&&0:t,o=null===n?"string"==typeof t?"":"boolean"!=typeof t&&0:n,s=e(r),c=e(o);if(s!==c)return s-c;if("number"==typeof r)return r-o;if("string"==typeof r){const t=r.toLowerCase(),n=o.toLowerCase();return t<n?-1:t>n?1:0}return"boolean"==typeof r?Number(r)-Number(o):0}function Nt(t,n,e){if(n instanceof ct)return n;if(e instanceof ct)return e;switch(t){case"&":return At(n)+At(e);case"=":return 0===Et(n,e);case"<>":return 0!==Et(n,e);case"<":return Et(n,e)<0;case">":return Et(n,e)>0;case"<=":return Et(n,e)<=0;case">=":return Et(n,e)>=0}const r=yt(n),o=yt(e);if(r instanceof ct)return r;if(o instanceof ct)return o;switch(t){case"+":return r+o;case"-":return r-o;case"*":return r*o;case"/":return 0===o?at:r/o;case"^":{const t=r**o;return Number.isFinite(t)?t:ft}}return it}function xt(t,n,e){return{rows:t,cols:n,at:e}}function Ct(t,n,e){if(!ut(t)&&!ut(n))return e(t,n);const r=Math.max(ut(t)?t.rows:1,ut(n)?n.rows:1),o=Math.max(ut(t)?t.cols:1,ut(n)?n.cols:1),s=(t,n,e)=>{if(!ut(t))return t;const r=1===t.rows?0:n,o=1===t.cols?0:e;return r<t.rows&&o<t.cols?t.at(r,o):ht};return xt(r,o,(r,o)=>e(s(t,r,o),s(n,r,o)))}function $t(t,n){if(ut(t))for(let e=0;e<t.rows;e++)for(let r=0;r<t.cols;r++)n(t.at(e,r),!0);else n(t,!1)}function St(t){const n=[];let e=null;for(const r of t)$t(r,(t,r)=>{if(e)return;if(t instanceof ct)return void(e=t);if("number"==typeof t)return void n.push(t);if(r||null===t)return;const o=yt(t);o instanceof ct?e=o:n.push(o)});return e??n}function Ot(t){return t.replace(/[.+^${}()|[\]\\]/g,"\\$&")}function Rt(t){let n="";for(let e=0;e<t.length;e++){const r=t[e];"~"===r&&e+1<t.length?n+=Ot(t[++e]):n+="*"===r?"[\\s\\S]*":"?"===r?"[\\s\\S]":Ot(r)}return new RegExp(`^${n}$`,"i")}var Tt=(t,n)=>{if(void 0===t)return n??it;const e=Mt(t);return null===e&&void 0!==n?n:yt(e)},Ut=t=>{if(void 0===t)return it;const n=Mt(t);return n instanceof ct?n:At(n)},Ft=t=>n=>{const e=Tt(n[0]);if(e instanceof ct)return e;const r=t(e);return Number.isFinite(r)?r:ft},kt=t=>n=>{const e=St(n);return e instanceof ct?e:t(e)};var Dt=t=>n=>{const e=Tt(n[0]),r=Tt(n[1],0);if(e instanceof ct)return e;if(r instanceof ct)return r;return(e<0?-1:1)*function(t,n,e){const r=10**n;return e(Number((t*r).toPrecision(15)))/r}(Math.abs(e),Math.trunc(r),t)};function Lt(t,n){const e=t.length;if(e<(n?2:1))return at;const r=t.reduce((t,n)=>t+n,0)/e;return t.reduce((t,n)=>t+(n-r)**2,0)/(n?e-1:e)}function It(t){return ut(t)?t:xt(1,1,()=>t)}function Pt(t,n){const e=n??t[0][0];for(const[n]of t)if(n.rows!==e.rows||n.cols!==e.cols)return it;const r=t.map(([,t])=>function(t){if("string"!=typeof t)return n=>null===t?null===n:null!==n&&0===Et(n,t);const n=/^(<=|>=|<>|=|<|>)?([\s\S]*)$/.exec(t),e=n[1]??"=",r=n[2],o=st(r);if(o){const t=o.value;return n=>{const r="number"==typeof n;switch(e){case"=":return r&&n===t;case"<>":return!(r&&n===t);case"<":return r&&n<t;case">":return r&&n>t;case"<=":return r&&n<=t;default:return r&&n>=t}}}if("="===e||"<>"===e){if(""===r)return t=>"="===e?null===t||""===t:null!==t&&""!==t;const t=Rt(r);return n=>{const r=null!==n&&!(n instanceof ct)&&t.test(At(n));return"="===e?r:!r}}return t=>{if("string"!=typeof t)return!1;const n=Et(t,r);return"<"===e?n<0:">"===e?n>0:"<="===e?n<=0:n>=0}}(t)),o=[];for(let n=0;n<e.rows;n++)for(let s=0;s<e.cols;s++)t.every(([t],e)=>r[e](t.at(n,s)))&&o.push(e.at(n,s));return o}function Vt(t){let n=0;for(const e of t){if(e instanceof ct)return e;"number"==typeof e&&(n+=e)}return n}function zt(t){let n=0,e=0;for(const r of t){if(r instanceof ct)return r;"number"==typeof r&&(n+=r,e++)}return e?n/e:at}function Gt(t,n){if((t.length-n)%2!=0||t.length-n<2)return it;const e=[];for(let r=n;r<t.length;r+=2){const n=Mt(t[r+1]);if(n instanceof ct)return n;e.push([It(t[r]),n])}return e}function Wt(t,n,e,r=!1){const o=Math.max(n.rows,n.cols),s=t=>n.rows>=n.cols?n.at(t,0):n.at(0,t);if(0===e){const n=r&&"string"==typeof t?Rt(t):null;for(let e=0;e<o;e++){const r=s(e);if(n?"string"==typeof r&&n.test(r):null!==r&&!(r instanceof ct)&&0===Et(r,t))return e}return-1}let c=-1;for(let n=0;n<o;n++){const r=s(n);if(null===r||r instanceof ct||typeof r!=typeof t)continue;const o=Et(r,t);(1===e?o<=0:o>=0)&&(-1===c||(1===e?Et(r,s(c))>0:Et(r,s(c))<0))&&(c=n)}return c}function jt(t,n){const e=Mt(t[0]);if(e instanceof ct)return e;if(void 0===t[1])return it;const r=It(t[1]),o=Tt(t[2]);if(o instanceof ct)return o;const s=void 0===t[3]||null===t[3]||vt(Mt(t[3]));if(s instanceof ct)return s;const c=Math.trunc(o)-1,u=n?r.cols:r.rows,l=n?r.rows:r.cols;if(c<0)return it;if(c>=l)return mt;const i=Wt(e,n?xt(1,u,(t,n)=>r.at(0,n)):xt(u,1,t=>r.at(t,0)),s?1:0,!s);return-1===i?ht:n?r.at(c,i):r.at(i,c)}function Ht(){const t=new Date;return L(t.getFullYear(),t.getMonth()+1,t.getDate())+(3600*t.getHours()+60*t.getMinutes()+t.getSeconds())/86400}var Zt=t=>n=>{const e=Tt(n[0]);return e instanceof ct?e:e<0?ft:t(I(e))};function _t(t,n){const e=I(t),r=12*e.year+(e.month-1)+n;return{year:Math.floor(r/12),month:(r%12+12)%12+1,day:e.day}}function Kt(t,n){return new Date(Date.UTC(t,n,0)).getUTCDate()}function Xt(t){const n=I(t).weekday;return 0===n||6===n}var Yt=(t,n)=>{const e=[];for(let r=0;r<n.length;r++){const o=Tt(t[r],n[r]);if(o instanceof ct)return o;e.push(o)}return e},Bt={SUM:kt(t=>t.reduce((t,n)=>t+n,0)),AVERAGE:kt(t=>t.length?t.reduce((t,n)=>t+n,0)/t.length:at),MIN:kt(t=>t.length?Math.min(...t):0),MAX:kt(t=>t.length?Math.max(...t):0),PRODUCT:kt(t=>t.length?t.reduce((t,n)=>t*n,1):0),MEDIAN:kt(t=>{if(!t.length)return ft;const n=[...t].sort((t,n)=>t-n),e=Math.floor(n.length/2);return n.length%2?n[e]:(n[e-1]+n[e])/2}),MODE:kt(t=>{const n=new Map;let e=null,r=1;for(const o of t){const t=(n.get(o)??0)+1;n.set(o,t),t>r&&(r=t,e=o)}return e??ht}),STDEV:kt(t=>{const n=Lt(t,!0);return n instanceof ct?n:Math.sqrt(n)}),STDEVP:kt(t=>{const n=Lt(t,!1);return n instanceof ct?n:Math.sqrt(n)}),VAR:kt(t=>Lt(t,!0)),VARP:kt(t=>Lt(t,!1)),COUNT:t=>{let n=0;for(const e of t)$t(e,(t,e)=>{"number"==typeof t?n++:e||"boolean"!=typeof t?!e&&"string"==typeof t&&st(t)&&n++:n++});return n},COUNTA:t=>{let n=0;for(const e of t)$t(e,t=>{null!==t&&n++});return n},COUNTBLANK:t=>{let n=0;for(const e of t)$t(e,t=>{null!==t&&""!==t||n++});return n},ABS:Ft(Math.abs),INT:Ft(Math.floor),TRUNC:Dt(Math.floor),ROUND:Dt(Math.round),ROUNDUP:Dt(Math.ceil),ROUNDDOWN:Dt(Math.floor),SIGN:Ft(Math.sign),SQRT:Ft(Math.sqrt),EXP:Ft(Math.exp),LN:Ft(Math.log),LOG10:Ft(Math.log10),SIN:Ft(Math.sin),COS:Ft(Math.cos),TAN:Ft(Math.tan),LOG:t=>{const n=Tt(t[0]),e=Tt(t[1],10);if(n instanceof ct)return n;if(e instanceof ct)return e;const r=Math.log(n)/Math.log(e);return Number.isFinite(r)?r:ft},MOD:t=>{const n=Tt(t[0]),e=Tt(t[1]);return n instanceof ct?n:e instanceof ct?e:0===e?at:n-e*Math.floor(n/e)},POWER:t=>Nt("^",Mt(t[0]??null),Mt(t[1]??null)),PI:()=>Math.PI,RAND:()=>Math.random(),RANDBETWEEN:t=>{const n=Tt(t[0]),e=Tt(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const r=Math.ceil(n),o=Math.floor(e);return r>o?ft:r+Math.floor(Math.random()*(o-r+1))},CEILING:t=>{const n=Tt(t[0]),e=Tt(t[1],1);return n instanceof ct?n:e instanceof ct?e:0===e?0:Math.ceil(Number((n/e).toPrecision(15)))*e},FLOOR:t=>{const n=Tt(t[0]),e=Tt(t[1],1);return n instanceof ct?n:e instanceof ct?e:0===e?at:Math.floor(Number((n/e).toPrecision(15)))*e},SUMIF:t=>{const n=Mt(t[1]??null);if(n instanceof ct)return n;const e=Pt([[It(t[0]),n]],void 0!==t[2]?It(t[2]):null);return e instanceof ct?e:Vt(e)},SUMIFS:t=>{const n=Gt(t,1);if(n instanceof ct)return n;const e=Pt(n,It(t[0]));return e instanceof ct?e:Vt(e)},AVERAGEIF:t=>{const n=Mt(t[1]??null);if(n instanceof ct)return n;const e=Pt([[It(t[0]),n]],void 0!==t[2]?It(t[2]):null);return e instanceof ct?e:zt(e)},AVERAGEIFS:t=>{const n=Gt(t,1);if(n instanceof ct)return n;const e=Pt(n,It(t[0]));return e instanceof ct?e:zt(e)},COUNTIF:t=>{const n=Mt(t[1]??null);if(n instanceof ct)return n;const e=Pt([[It(t[0]),n]],null);return e instanceof ct?e:e.length},COUNTIFS:t=>{const n=Gt(t,0);if(n instanceof ct)return n;const e=Pt(n,null);return e instanceof ct?e:e.length},SUMPRODUCT:t=>{if(!t.length)return it;const n=t.map(It),{rows:e,cols:r}=n[0];if(n.some(t=>t.rows!==e||t.cols!==r))return it;let o=0;for(let t=0;t<e;t++)for(let e=0;e<r;e++){let r=1;for(const o of n){const s=o.at(t,e);if(s instanceof ct)return s;r*="number"==typeof s?s:"boolean"==typeof s&&1===n.length?Number(s):0}o+=r}return o},LARGE:t=>{const n=St([t[0]??null]),e=Tt(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const r=[...n].sort((t,n)=>n-t);return e<1||e>r.length?ft:r[Math.trunc(e)-1]},SMALL:t=>{const n=St([t[0]??null]),e=Tt(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const r=[...n].sort((t,n)=>t-n);return e<1||e>r.length?ft:r[Math.trunc(e)-1]},RANK:t=>{const n=Tt(t[0]),e=St([t[1]??null]),r=Tt(t[2],0);return n instanceof ct?n:e instanceof ct?e:r instanceof ct?r:e.includes(n)?1+e.filter(t=>r?t<n:t>n).length:ht},AND:t=>{let n=!1,e=!0,r=null;for(const o of t)$t(o,(t,o)=>{if(r)return;if(o&&"string"==typeof t)return;if(null===t)return;const s=vt(t);s instanceof ct?r=s:(n=!0,s||(e=!1))});return r??(n?e:it)},OR:t=>{let n=!1,e=!1,r=null;for(const o of t)$t(o,(t,o)=>{if(r)return;if(o&&"string"==typeof t)return;if(null===t)return;const s=vt(t);s instanceof ct?r=s:(n=!0,s&&(e=!0))});return r??(n?e:it)},XOR:t=>{let n=!1,e=null;for(const r of t)$t(r,t=>{if(e||null===t)return;const r=vt(t);r instanceof ct?e=r:r&&(n=!n)});return e??n},NOT:t=>{const n=vt(Mt(t[0]??null));return n instanceof ct?n:!n},TRUE:()=>!0,FALSE:()=>!1,CONCAT:t=>{let n="",e=null;for(const r of t)$t(r,t=>{t instanceof ct?e??=t:n+=At(t)});return e??n},TEXTJOIN:t=>{const n=Ut(t[0]),e=vt(Mt(t[1]??null));if(n instanceof ct)return n;if(e instanceof ct)return e;const r=[];let o=null;for(const n of t.slice(2))$t(n,t=>{if(t instanceof ct)return void(o??=t);const n=At(t);e&&""===n||r.push(n)});return o??r.join(n)},LEFT:t=>{const n=Ut(t[0]),e=Tt(t[1],1);return n instanceof ct?n:e instanceof ct?e:e<0?it:n.slice(0,Math.trunc(e))},RIGHT:t=>{const n=Ut(t[0]),e=Tt(t[1],1);return n instanceof ct?n:e instanceof ct?e:e<0?it:0===Math.trunc(e)?"":n.slice(-Math.trunc(e))},MID:t=>{const n=Ut(t[0]),e=Tt(t[1]),r=Tt(t[2]);return n instanceof ct?n:e instanceof ct?e:r instanceof ct?r:e<1||r<0?it:n.slice(Math.trunc(e)-1,Math.trunc(e)-1+Math.trunc(r))},LEN:t=>{const n=Ut(t[0]);return n instanceof ct?n:n.length},LOWER:t=>{const n=Ut(t[0]);return n instanceof ct?n:n.toLowerCase()},UPPER:t=>{const n=Ut(t[0]);return n instanceof ct?n:n.toUpperCase()},PROPER:t=>{const n=Ut(t[0]);return n instanceof ct?n:n.toLowerCase().replace(/(^|[^\p{L}])(\p{L})/gu,(t,n,e)=>n+e.toUpperCase())},TRIM:t=>{const n=Ut(t[0]);return n instanceof ct?n:n.trim().replace(/ +/g," ")},REPT:t=>{const n=Ut(t[0]),e=Tt(t[1]);return n instanceof ct?n:e instanceof ct?e:e<0||n.length*e>32767?it:n.repeat(Math.trunc(e))},EXACT:t=>{const n=Ut(t[0]),e=Ut(t[1]);return n instanceof ct?n:e instanceof ct?e:n===e},SUBSTITUTE:t=>{const n=Ut(t[0]),e=Ut(t[1]),r=Ut(t[2]);if(n instanceof ct)return n;if(e instanceof ct)return e;if(r instanceof ct)return r;if(""===e)return n;if(void 0===t[3])return n.split(e).join(r);const o=Tt(t[3]);if(o instanceof ct)return o;let s=-1;for(let t=0;t<o;t++)if(s=n.indexOf(e,s+1),-1===s)return n;return n.slice(0,s)+r+n.slice(s+e.length)},REPLACE:t=>{const n=Ut(t[0]),e=Tt(t[1]),r=Tt(t[2]),o=Ut(t[3]);return n instanceof ct?n:e instanceof ct?e:r instanceof ct?r:o instanceof ct?o:e<1||r<0?it:n.slice(0,e-1)+o+n.slice(e-1+r)},FIND:t=>{const n=Ut(t[0]),e=Ut(t[1]),r=Tt(t[2],1);if(n instanceof ct)return n;if(e instanceof ct)return e;if(r instanceof ct)return r;const o=e.indexOf(n,r-1);return-1===o?it:o+1},SEARCH:t=>{const n=Ut(t[0]),e=Ut(t[1]),r=Tt(t[2],1);if(n instanceof ct)return n;if(e instanceof ct)return e;if(r instanceof ct)return r;const o=new RegExp(Rt(n).source.slice(1,-1),"i").exec(e.slice(r-1));return o?o.index+r:it},TEXT:t=>{const n=Mt(t[0]??null),e=Ut(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const r="string"==typeof n?st(n)?.value??null:null===n?0:"boolean"==typeof n?null:n;return null===r?Y(At(n),e):X(r,e).text},VALUE:t=>{const n=Mt(t[0]??null);return n instanceof ct||"number"==typeof n?n:st(At(n))?.value??it},VLOOKUP:t=>jt(t,!1),HLOOKUP:t=>jt(t,!0),XLOOKUP:t=>{const n=Mt(t[0]??null);if(n instanceof ct)return n;if(void 0===t[1]||void 0===t[2])return it;const e=It(t[1]),r=It(t[2]),o=Tt(t[4],0);if(o instanceof ct)return o;const s=Wt(n,e,1===o?-1:-1===o?1:0,2===o);return-1===s?void 0!==t[3]&&null!==Mt(t[3])?Mt(t[3]):ht:e.rows>=e.cols?r.at(s,0):r.at(0,s)},MATCH:t=>{const n=Mt(t[0]??null);if(n instanceof ct)return n;if(void 0===t[1])return it;const e=It(t[1]),r=Tt(t[2],1);if(r instanceof ct)return r;if(e.rows>1&&e.cols>1)return ht;const o=Wt(n,e,0===r?0:r<0?-1:1,0===r);return-1===o?ht:o+1},INDEX:t=>{if(void 0===t[0])return it;const n=It(t[0]),e=Tt(t[1],0),r=Tt(t[2],1===n.rows&&void 0===t[2]?0:1);if(e instanceof ct)return e;if(r instanceof ct)return r;const[o,s]=1===n.rows&&void 0===t[2]?[1,e]:[e,r];return o<0||s<0||o>n.rows||s>n.cols?mt:0===o?xt(n.rows,1,t=>n.at(t,Math.max(s,1)-1)):0===s?xt(1,n.cols,(t,e)=>n.at(o-1,e)):n.at(Math.trunc(o)-1,Math.trunc(s)-1)},ROWS:t=>void 0===t[0]?it:It(t[0]).rows,COLUMNS:t=>void 0===t[0]?it:It(t[0]).cols,TODAY:()=>Math.floor(Ht()),NOW:()=>Ht(),DATE:t=>{const n=Tt(t[0]),e=Tt(t[1]),r=Tt(t[2]);if(n instanceof ct)return n;if(e instanceof ct)return e;if(r instanceof ct)return r;const o=n<1900?n+1900:n;return L(o,1,1)+Math.round((Date.UTC(o,e-1,r)-Date.UTC(o,0,1))/864e5)},TIME:t=>{const n=Tt(t[0]),e=Tt(t[1]),r=Tt(t[2]);return n instanceof ct?n:e instanceof ct?e:r instanceof ct?r:(3600*n+60*e+r)/86400%1},YEAR:Zt(t=>t.year),MONTH:Zt(t=>t.month),DAY:Zt(t=>t.day),HOUR:Zt(t=>t.hours),MINUTE:Zt(t=>t.minutes),SECOND:Zt(t=>t.seconds),WEEKDAY:t=>{const n=Tt(t[0]),e=Tt(t[1],1);if(n instanceof ct)return n;if(e instanceof ct)return e;const r=I(n).weekday;return 1===e?r+1:2===e?(r+6)%7+1:3===e?(r+6)%7:ft},EDATE:t=>{const n=Tt(t[0]),e=Tt(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const{year:r,month:o,day:s}=_t(n,Math.trunc(e));return L(r,o,Math.min(s,Kt(r,o)))},EOMONTH:t=>{const n=Tt(t[0]),e=Tt(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const{year:r,month:o}=_t(n,Math.trunc(e));return L(r,o,Kt(r,o))},DAYS:t=>{const n=Tt(t[0]),e=Tt(t[1]);return n instanceof ct?n:e instanceof ct?e:Math.trunc(n)-Math.trunc(e)},DATEDIF:t=>{const n=Tt(t[0]),e=Tt(t[1]),r=Ut(t[2]);if(n instanceof ct)return n;if(e instanceof ct)return e;if(r instanceof ct)return r;if(n>e)return ft;const o=I(n),s=I(e),c=12*(s.year-o.year)+(s.month-o.month)-(s.day<o.day?1:0);switch(r.toUpperCase()){case"D":return Math.trunc(e)-Math.trunc(n);case"M":return c;case"Y":return Math.floor(c/12);default:return ft}},NETWORKDAYS:t=>{const n=Tt(t[0]),e=Tt(t[1]);if(n instanceof ct)return n;if(e instanceof ct)return e;const r=new Set;void 0!==t[2]&&$t(t[2],t=>{"number"==typeof t&&r.add(Math.trunc(t))});const o=Math.trunc(Math.min(n,e)),s=Math.trunc(Math.max(n,e));if(s-o>366e3)return ft;let c=0;for(let t=o;t<=s;t++)Xt(t)||r.has(t)||c++;return n<=e?c:-c},ISBLANK:t=>null===Mt(t[0]??null),ISNUMBER:t=>"number"==typeof Mt(t[0]??null),ISTEXT:t=>"string"==typeof Mt(t[0]??null),ISLOGICAL:t=>"boolean"==typeof Mt(t[0]??null),ISERROR:t=>Mt(t[0]??null)instanceof ct,ISNA:t=>{const n=Mt(t[0]??null);return n instanceof ct&&"#N/A"===n.code},N:t=>{const n=Mt(t[0]??null);return n instanceof ct||"number"==typeof n?n:"boolean"==typeof n?Number(n):0},NA:()=>ht,PMT:t=>{const n=Yt(t,[void 0,void 0,void 0,0,0]);return n instanceof ct?n:0===n[1]?ft:function(t,n,e,r,o){if(0===t)return-(e+r)/n;const s=(1+t)**n;return-t*(e*s+r)/((s-1)*(1+t*o))}(n[0],n[1],n[2],n[3],n[4])},FV:t=>{const n=Yt(t,[void 0,void 0,void 0,0,0]);if(n instanceof ct)return n;const[e,r,o,s,c]=n;if(0===e)return-(s+o*r);const u=(1+e)**r;return-(s*u+o*(1+e*c)*(u-1)/e)},PV:t=>{const n=Yt(t,[void 0,void 0,void 0,0,0]);if(n instanceof ct)return n;const[e,r,o,s,c]=n;if(0===e)return-(s+o*r);const u=(1+e)**r;return-(s+o*(1+e*c)*(u-1)/e)/u},NPV:t=>{const n=Tt(t[0]),e=St(t.slice(1));return n instanceof ct?n:e instanceof ct?e:e.reduce((t,e,r)=>t+e/(1+n)**(r+1),0)}};Bt.CONCATENATE=Bt.CONCAT,Bt["STDEV.S"]=Bt.STDEV,Bt["STDEV.P"]=Bt.STDEVP,Bt["VAR.S"]=Bt.VAR,Bt["VAR.P"]=Bt.VARP,Bt["CEILING.MATH"]=Bt.CEILING,Bt["FLOOR.MATH"]=Bt.FLOOR,Bt["MODE.SNGL"]=Bt.MODE,Bt["RANK.EQ"]=Bt.RANK;var Jt={IF:(t,n)=>{if(t.length<2)return it;const e=vt(Mt(n(t[0])));return e instanceof ct?e:e?n(t[1]):t.length>2&&n(t[2])},IFS:(t,n)=>{if(t.length<2||t.length%2)return it;for(let e=0;e<t.length;e+=2){const r=vt(Mt(n(t[e])));if(r instanceof ct)return r;if(r)return n(t[e+1])}return ht},IFERROR:(t,n)=>{if(t.length<1)return it;const e=Mt(n(t[0]));return e instanceof ct?t[1]?n(t[1]):"":e},IFNA:(t,n)=>{if(t.length<1)return it;const e=Mt(n(t[0]));return e instanceof ct&&"#N/A"===e.code?t[1]?n(t[1]):"":e},SWITCH:(t,n)=>{if(t.length<3)return it;const e=Mt(n(t[0]));if(e instanceof ct)return e;let r=1;for(;r+1<t.length;r+=2){const o=Mt(n(t[r]));if(o instanceof ct)return o;if(0===Et(e,o))return n(t[r+1])}return r<t.length?n(t[r]):ht},CHOOSE:(t,n)=>{if(t.length<2)return it;const e=yt(Mt(n(t[0])));if(e instanceof ct)return e;const r=Math.trunc(e);return r<1||r>=t.length?it:n(t[r])},ROW:(t,n,e)=>t.length?"ref"===t[0].kind&&null!==t[0].ref.a.row?t[0].ref.a.row+1:it:e.row+1,COLUMN:(t,n,e)=>t.length?"ref"===t[0].kind&&null!==t[0].ref.a.col?t[0].ref.a.col+1:it:e.col+1},qt=[...new Set([...Object.keys(Bt),...Object.keys(Jt)])].filter(t=>"TRUE"!==t&&"FALSE"!==t).sort();function Qt(t){const n=t.map(()=>new Map),e=t.map(()=>new Set),r=new Map(t.map((t,n)=>[t.name.toLowerCase(),n]));let o=0;const s=(r,s,c)=>{const l=t[r]?.cells[s]?.[c];if(void 0===l||""===l)return null;if(!C(l))return bt(l);const i=((t,n)=>2e4*t+n)(s,c),f=n[r].get(i);if(void 0!==f)return f;if(e[r].has(i))return pt;let h;e[r].add(i),o++;try{const t=u(function(t){const n=x.get(t);if(n){if(n instanceof a)throw n;return n}let e;try{const{tokens:n,complete:r}=v(t.slice(1));if(!r)throw new a("Unreadable text");e=new N(n).run()}catch(t){if(!(t instanceof a))throw t;e=t}if(x.size>=2e4&&x.clear(),x.set(t,e),e instanceof a)throw e;return e}(l),{sheet:r,row:s,col:c});h=Mt(t),null===h&&(h=0)}catch(t){if(!(t instanceof a)){if(!(t instanceof RangeError)||o>1)throw t;return pt}h=gt}finally{o--,e[r].delete(i)}return n[r].set(i,h),h},c=(n,e)=>{let o=e.sheet;if(null!==n.sheet){const t=r.get(n.sheet.toLowerCase());if(void 0===t)return mt;o=t}const c=n.b??n.a;if(null===n.b)return s(o,n.a.row,n.a.col);const u=Math.min(n.a.row??0,c.row??0),l=Math.min(n.a.col??0,c.col??0),i=null===n.a.row?(n=>t[n].cells.length)(o)-1:Math.max(n.a.row,c.row),a=null===n.a.col?(n=>t[n].cells.reduce((t,n)=>Math.max(t,n.length),0))(o)-1:Math.max(n.a.col,c.col);return xt(Math.max(0,i-u+1),Math.max(0,a-l+1),(t,n)=>s(o,u+t,l+n))},u=(t,n)=>{switch(t.kind){case"num":case"str":case"bool":return t.value;case"err":return lt(t.value);case"empty":return null;case"ref":return c(t.ref,n);case"unary":return Ct(u(t.arg,n),null,n=>{const e=n instanceof ct?n:yt(n);return e instanceof ct?e:"-"===t.op?-e:e});case"percent":return Ct(u(t.arg,n),100,(t,n)=>Nt("/",t,n));case"binary":return Ct(u(t.left,n),u(t.right,n),(n,e)=>Nt(t.op,n,e));case"call":{const e=Jt[t.name];if(e)return e(t.args,t=>u(t,n),n);const r=Bt[t.name];return r?r(t.args.map(t=>u(t,n)),n):dt}}};let l=!1;return{value:(n,e,r)=>t[n]?(l||(l=!0,t.forEach((t,n)=>{t.cells.forEach((t,e)=>t.forEach((t,r)=>{C(t)&&s(n,e,r)}));for(let e=t.cells.length-1;e>=0;e--){const r=t.cells[e];for(let t=r.length-1;t>=0;t--)C(r[t])&&s(n,e,t)}})),s(n,e,r)):null}}var tn=100,nn=24,en=10;function rn(t,n=[]){return{id:crypto.randomUUID(),name:t,rowCount:Math.max(1e3,n.length+100),colCount:Math.max(26,n.reduce((t,n)=>Math.max(t,n.length),0)),cells:n,formats:{},colWidths:{},rowHeights:{},hiddenRows:[],hiddenCols:[],merges:[],frozenRows:0,frozenCols:0,filter:null}}var on=(t,n)=>`${t}:${n}`,sn=(t,n,e)=>t.cells[n]?.[e]??"";function cn(t,n){const e=new Set(t.map(t=>t.name.toLowerCase()));for(let r=t.length+1;;r++){const t=`${n} ${r}`;if(!e.has(t.toLowerCase()))return t}}function un(t){return Qt(t)}function ln(t){let n=0,e=!1;for(const r of t)'"'===r?e=!e:e||"("!==r?e||")"!==r||n--:n++;return!e&&n>0?t+")".repeat(n):t}function an(t,n){if(C(t))return{raw:ln(t),numFmt:null};if(""===t||"'"===t[0])return{raw:t,numFmt:null};if("@"===n?.numFmt)return{raw:`'${t}`,numFmt:null};const e=st(t);return e?{raw:String(e.value),numFmt:e.format}:{raw:t,numFmt:null}}function fn(t,n){if(C(t)||""===t)return t;const e=bt(t);if("number"!=typeof e||!n?.numFmt)return t;if(G(n.numFmt)){const t=I(e),n=`${t.year}-${U(t.month)}-${U(t.day)}`;return Number.isInteger(e)?n:`${n} ${U(t.hours)}:${U(t.minutes)}:${U(t.seconds)}`}return/%/.test(n.numFmt)?`${_(100*e)}%`:t}var hn={text:"",color:null,align:"left",error:!1};function mn(t,n,e,r,o){const s=sn(t,r,o);return""===s?hn:function(t,n,e){if(null===t)return hn;if(t instanceof ct)return{text:t.code,color:null,align:"center",error:!0};if("boolean"==typeof t)return{text:t?"TRUE":"FALSE",color:null,align:"center",error:!1};const r=e?.numFmt;if("number"==typeof t){if(!(r&&"General"!==r||C(n)))return{text:n,color:null,align:"right",error:!1};const{text:e,color:o}=X(t,r??"General");return{text:e,color:o,align:"right",error:!1}}return{text:r?Y(t,r):t,color:null,align:"left",error:!1}}(e.value(n,r,o),s,t.formats[on(r,o)])}function dn(t){let n=-1,e=-1;return t.cells.forEach((t,r)=>{for(let o=t.length-1;o>=0;o--)if(""!==t[o]){n=Math.max(n,r),e=Math.max(e,o);break}}),n<0?null:{row:n,col:e}}function pn(t,n){if(!n.length)return t;const e=[...t.cells],r=new Set;let o=t.rowCount,s=t.colCount;for(const{row:t,col:c,raw:u}of n)if(""!==u||""!==(e[t]?.[c]??"")){for(;e.length<=t;)e.push([]);for(r.has(t)||(e[t]=[...e[t]],r.add(t));e[t].length<=c;)e[t].push("");e[t][c]=u,o=Math.max(o,t+1),s=Math.max(s,c+1)}return{...t,cells:e,rowCount:o,colCount:s}}function gn(t,n,e,r){const o=on(n,e),s=t.formats[o],{raw:c,numFmt:u}=an(r,s),l=pn(t,[{row:n,col:e,raw:c}]);return!u||s?.numFmt&&"General"!==s.numFmt?l:{...l,formats:{...l.formats,[o]:{...s,numFmt:u}}}}function wn(t,n){for(let e=t.r1;e<=t.r2;e++)for(let r=t.c1;r<=t.c2;r++)n(e,r)}function bn(t,n){const e=[];return wn(function(t,n){const e=Math.min(n.r2,t.cells.length-1);return{...n,r2:Math.max(e,n.r1-1)}}(t,n),(n,r)=>{""!==sn(t,n,r)&&e.push({row:n,col:r,raw:""})}),pn(t,e)}function Mn(t,n,e){const r={...t.formats},o=(t,n)=>{const o=on(t,n),s=e(r[o]??{});Object.keys(s).length?r[o]=s:delete r[o]};return wn((n.r2-n.r1+1)*(n.c2-n.c1+1)>2e5?{...n,r2:Math.min(n.r2,Math.max(t.cells.length,2e3))}:n,o),{...t,formats:r}}function yn(t,n,e){const r={...t};return void 0===e||!1===e?delete r[n]:r[n]=e,r}function An(t,n,e){const r={...t.formats};return wn(n,(t,o)=>{const s=on(t,o),c=r[s]??{},u=((t,e)=>({...t===n.r1?{top:!0}:{},...t===n.r2?{bottom:!0}:{},...e===n.c1?{left:!0}:{},...e===n.c2?{right:!0}:{}}))(t,o);let l;switch(e){case"none":l={};break;case"all":l={top:!0,right:!0,bottom:!0,left:!0};break;case"outer":l={...c.border,...u};break;default:l=u[e]?{...c.border,[e]:!0}:c.border??{}}const i=yn(c,"border",Object.keys(l).length?l:void 0);Object.keys(i).length?r[s]=i:delete r[s]}),{...t,formats:r}}function vn(t,n,e){return t.merges.find(t=>u(t,n,e))??null}function En(t,n){let e=n;for(let n=!0;n;){n=!1;for(const r of t.merges){if(!l(e,r))continue;const t={r1:Math.min(e.r1,r.r1),c1:Math.min(e.c1,r.c1),r2:Math.max(e.r2,r.r2),c2:Math.max(e.c2,r.c2)};t.r1===e.r1&&t.c1===e.c1&&t.r2===e.r2&&t.c2===e.c2||(e=t,n=!0)}}return e}function Nn(t,n){if(n.r1===n.r2&&n.c1===n.c2)return t;const e=[];wn(n,(r,o)=>{r===n.r1&&o===n.c1||""===sn(t,r,o)||e.push({row:r,col:o,raw:""})});const r=pn(t,e);return{...r,merges:[...r.merges.filter(t=>!l(t,n)),n]}}function xn(t,n){return{...t,merges:t.merges.filter(t=>!l(t,n))}}function Cn(t,n,e){const r=t[n].name.toLowerCase();return t.map((t,o)=>{let s=!1;const c=t.cells.map(t=>{let c=!1;const u=t.map(t=>{if(!C(t))return t;const s=O(t,t=>(null===t.sheet?o===n:t.sheet.toLowerCase()===r)?e(t):t);return s!==t&&(c=!0),s});return c&&(s=!0),c?u:t});return s?{...t,cells:c}:t})}function $n(t,n,e){if(e>0)return t>=n?t+e:t;const r=n-e;return t>=n&&t<r?null:t>=r?t+e:t}function Sn(t,n,e){const r={};for(const[o,s]of Object.entries(t)){const t=$n(Number(o),n,e);null!==t&&(r[t]=s)}return r}function On(t,n,e,r){const[o,s]="row"===n?[t.r1,t.r2]:[t.c1,t.c2];let c,u;if(r>0)c=o>=e?o+r:o,u=s>=e?s+r:s;else{const t=e-r;if(c=o<e?o:o>=t?o+r:e,u=s<e?s:s>=t?s+r:e-1,c>u)return null}return"row"===n?{...t,r1:c,r2:u}:{...t,c1:c,c2:u}}function Rn(t,n,e,r,o){const s=Cn(t,n,t=>function(t,n,e,r){const o=t=>"row"===n?t.row:t.col,s=(t,e)=>"row"===n?{...t,row:e}:{...t,col:e},c=o(t.a);if(null===c)return t;if(r>0){const n=t=>t>=e?t+r:t;return{...t,a:s(t.a,n(c)),b:t.b?s(t.b,n(o(t.b))):null}}const u=-r,l=e+u;if(!t.b)return c>=e&&c<l?null:{...t,a:s(t.a,c>=l?c-u:c)};const i=Math.min(c,o(t.b)),a=Math.max(c,o(t.b)),f=i<e?i:i>=l?i-u:e,h=a<e?a:a>=l?a-u:e-1;return f>h?null:{...t,a:s(t.a,f),b:s(t.b,h)}}(t,e,r,o));return s.map((t,s)=>{if(s!==n)return t;const c="row"===e?(()=>{const n=[...t.cells];return o>0?n.length>r&&n.splice(r,0,...Array.from({length:o},()=>[])):n.splice(r,-o),n})():t.cells.map(t=>{if(t.length<=r)return t;const n=[...t];return o>0?n.splice(r,0,...Array(o).fill("")):n.splice(r,-o),n}),u={};for(const[n,s]of Object.entries(t.formats)){const[t,c]=n.split(":").map(Number),l=$n("row"===e?t:c,r,o);null!==l&&(u["row"===e?on(l,c):on(t,l)]=s)}const l=t.merges.map(t=>On(t,e,r,o)).filter(t=>null!==t&&(t.r1!==t.r2||t.c1!==t.c2)),i=t=>t.map(t=>$n(t,r,o)).filter(t=>null!==t),a=t.filter?On(t.filter.range,e,r,o):null,f=t.filter&&a?{range:a,excluded:"col"===e?Sn(t.filter.excluded,r,o):t.filter.excluded}:null,h=t=>r<t?o>0?t+o:Math.max(r,t+o):t;return{...t,cells:c,formats:u,merges:l,filter:f,rowCount:"row"===e?Math.max(1,t.rowCount+o):t.rowCount,colCount:"col"===e?Math.max(1,t.colCount+o):t.colCount,rowHeights:"row"===e?Sn(t.rowHeights,r,o):t.rowHeights,colWidths:"col"===e?Sn(t.colWidths,r,o):t.colWidths,hiddenRows:"row"===e?i(t.hiddenRows):t.hiddenRows,hiddenCols:"col"===e?i(t.hiddenCols):t.hiddenCols,frozenRows:"row"===e?h(t.frozenRows):t.frozenRows,frozenCols:"col"===e?h(t.frozenCols):t.frozenCols}})}function Tn(t,n,e){return Cn(t,n,t=>null===t.sheet?t:{...t,sheet:e}).map((t,r)=>r===n?{...t,name:e}:t)}function Un(t,n){return Cn(t,n,t=>null===t.sheet?t:null).filter((t,e)=>e!==n)}function Fn(t,n,e){const r={...t[n],id:crypto.randomUUID(),name:e};return[...t.slice(0,n+1),r,...t.slice(n+1)]}function kn(t,n,e,r,o,s){const c=[];for(let t=r.r1;t<=r.r2;t++)c.push(t);const u=new Map(c.map(t=>[t,e.value(n,t,o)])),l=[...c].sort((t,n)=>{const e=u.get(t),r=u.get(n),o=null===e||""===e,c=null===r||""===r;if(o||c)return o===c?t-n:o?1:-1;if(e instanceof ct||r instanceof ct)return e instanceof ct?1:-1;const l=Et(e,r);return(s?l:-l)||t-n}),i=[],a={...t.formats},f=new Map;return wn(r,(n,e)=>f.set(on(n,e),t.formats[on(n,e)])),l.forEach((n,e)=>{const o=r.r1+e;for(let e=r.c1;e<=r.c2;e++){const r=sn(t,n,e);i.push({row:o,col:e,raw:C(r)?R(r,o-n,0):r});const s=f.get(on(n,e));s?a[on(o,e)]=s:delete a[on(o,e)]}}),{...pn(t,i),formats:a}}function Dn(t,n,e){const r=new Set,{filter:o}=t;if(!o)return r;for(const[s,c]of Object.entries(o.excluded)){if(!c.length)continue;const u=Number(s),l=new Set(c);for(let s=o.range.r1+1;s<=o.range.r2;s++)l.has(mn(t,n,e,s,u).text)&&r.add(s)}return r}function Ln(t,n){if(n.r1!==n.r2||n.c1!==n.c2)return n;const e=(n,e,r)=>{for(let o=e;o<=r;o++)if(""!==sn(t,n,o))return!1;return!0},r=(n,e,r)=>{for(let o=e;o<=r;o++)if(""!==sn(t,o,n))return!1;return!0};let{r1:o,r2:s,c1:c,c2:u}=n;for(let n=!0;n;)n=!1,o>0&&!e(o-1,c,u)&&(o--,n=!0),s<t.rowCount-1&&!e(s+1,c,u)&&(s++,n=!0),c>0&&!r(c-1,o,s)&&(c--,n=!0),u<t.colCount-1&&!r(u+1,o,s)&&(u++,n=!0);return{r1:o,c1:c,r2:s,c2:u}}var In=/^(.*?)(\d+)$/;function Pn(t,n){const e=t.length,r=t.map(t=>{if(C(t))return null;const n=bt(t);return"number"==typeof n?n:null});if(e>=2&&r.every(t=>null!==t)){const t=(r[e-1]-r[0])/(e-1);if(r.every((n,e)=>Math.abs(n-(r[0]+t*e))<1e-9))return String(Number((r[0]+t*n).toPrecision(15)))}const o=(n%e+e)%e,s=t[o];if("number"==typeof r[o]||C(s)||""===s||"'"===s[0])return s;const c=In.exec(s);if(c&&c[1]&&1===e){const t=Number(c[2])+n;if(t>=0)return c[1]+String(t).padStart(c[2].length,"0")}return s}function Vn(t,n,e){const r=[],o={...t.formats},s=n.r2-n.r1+1,c=n.c2-n.c1+1,l=e.r1<n.r1||e.r2>n.r2;return wn(e,(e,i)=>{if(u(n,e,i))return;let a,f,h;if(l){const r=Array.from({length:s},(e,r)=>sn(t,n.r1+r,i)),o=e-n.r1;a=n.r1+(o%s+s)%s,f=i;const c=sn(t,a,f);h=C(c)?R(c,e-a,0):Pn(r,o)}else{const r=Array.from({length:c},(r,o)=>sn(t,e,n.c1+o)),o=i-n.c1;a=e,f=n.c1+(o%c+c)%c;const s=sn(t,a,f);h=C(s)?R(s,0,i-f):Pn(r,o)}r.push({row:e,col:i,raw:h});const m=t.formats[on(a,f)];m?o[on(e,i)]=m:delete o[on(e,i)]}),{...pn(t,r),formats:o}}function zn(t,n,e,r,o){const s=[];for(let o=r.r1;o<=r.r2;o++){const c=[];for(let s=r.c1;s<=r.c2;s++){const r=sn(t,o,s);c.push({raw:r,display:mn(t,n,e,o,s).text,value:""===r?null:e.value(n,o,s),format:t.formats[on(o,s)]})}s.push(c)}return{sheetId:t.id,range:r,cut:o,cells:s,text:s.map(t=>t.map(t=>{return n=t.display,/["\t\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n;var n}).join("\t")).join("\n")}}function Gn(t,n,e,r){const o=n.cells.length,s=n.cells[0]?.length??0,c=e.r2-e.r1+1,u=e.c2-e.c1+1,l=c%o===0&&u%s===0,i=l?c:o,a=l?u:s,f=[],h={...t.formats};for(let t=0;t<i;t++)for(let c=0;c<a;c++){const u=n.cells[t%o][c%s],l=e.r1+t,i=e.c1+c;if("formats"!==r){let e=u.raw;"values"===r?(e=u.value instanceof ct?u.value.code:null===u.value?"":At(u.value),"number"==typeof u.value&&(e=String(u.value))):C(e)&&!n.cut&&(e=R(e,l-(n.range.r1+t%o),i-(n.range.c1+c%s))),f.push({row:l,col:i,raw:e})}"values"!==r&&(u.format?h[on(l,i)]=u.format:delete h[on(l,i)])}return{sheet:{...pn(t,f),formats:h},range:{r1:e.r1,c1:e.c1,r2:e.r1+i-1,c2:e.c1+a-1}}}function Wn(t,n,e,r,o){const{range:s}=e,c=o.r1-s.r1,l=o.c1-s.c1,i=t[r].name,a=n!==r,f=Cn(t,n,t=>{const n=t.a.row,e=t.a.col,r=t.b?t.b.row:t.a.row,o=t.b?t.b.col:t.a.col;if(null===n||null===e||null===r||null===o)return t;if(!u(s,n,e)||!u(s,r,o))return t;const f=t=>({...t,row:t.row+c,col:t.col+l});return{...t,sheet:a?i:t.sheet,a:f(t.a),b:t.b?f(t.b):null}}),h=f.map((t,e)=>{if(e!==n)return t;const r={...t.formats};return wn(s,(t,n)=>{delete r[on(t,n)]}),{...bn(t,s),formats:r}}),m={...e,cells:e.cells.map((t,e)=>t.map((t,r)=>({...t,raw:sn(f[n],s.r1+e,s.c1+r)})))},d={r1:o.r1,c1:o.c1,r2:o.r1+e.cells.length-1,c2:o.c1+(e.cells[0]?.length??1)-1},p=Gn(h[r],m,d,"all");return{sheets:h.map((t,n)=>n===r?p.sheet:t),range:p.range}}function jn(t,n){const e=n.matchCase?t:t.toLowerCase();return t=>{const r=n.matchCase?t:t.toLowerCase();return n.wholeCell?r===e:r.includes(e)}}function Hn(t,n,e,r,o){if(!r)return[];const s=jn(r,o),c=[];return t.cells.forEach((r,u)=>r.forEach((r,l)=>{if(""===r)return;const i=o.inFormulas?r:mn(t,n,e,u,l).text;s(i)&&c.push({row:u,col:l})})),c}function Zn(t,n,e,r){if(C(t)&&!r.inFormulas)return t;if(r.wholeCell)return jn(n,r)(t)?e:t;const o=r.matchCase?"g":"gi";return t.replace(new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),()=>e)}function _n(t,n,e,r,o){let s,c=0,u=0,l=0,i=1/0,a=-1/0;const f=Math.min(r.r2,t.cells.length-1);for(let h=r.r1;h<=f;h++){if(o.has(h))continue;const f=t.cells[h];if(!f)continue;const m=Math.min(r.c2,f.length-1);for(let o=r.c1;o<=m;o++){if(""===f[o])continue;u++;const r=e.value(n,h,o);"number"==typeof r&&(l++,c+=r,r<i&&(i=r),r>a&&(a=r),s??=t.formats[on(h,o)]?.numFmt)}}return{sum:c,average:l?c/l:null,count:u,numbers:l,min:i,max:a,firstFormat:s}}function Kn(t){const n=t.replace(/^/,""),e=n.slice(0,n.search(/\r?\n|$/)),r=e.includes("\t")&&!e.includes(",")||e.includes("\t")?"\t":",",o=[];let s=[],c="",u=!1,l=0;for(;l<n.length;){const t=n[l];if(u){if('"'===t){if('"'===n[l+1]){c+='"',l+=2;continue}u=!1,l++;continue}c+=t,l++}else'"'!==t||""!==c?t!==r?("\r"===t&&"\n"===n[l+1]&&l++,"\n"!==t&&"\r"!==t?(c+=t,l++):(s.push(c),o.push(s),s=[],c="",l++)):(s.push(c),c="",l++):(u=!0,l++)}return(""!==c||s.length)&&(s.push(c),o.push(s)),o.filter(t=>t.some(t=>""!==t))}function Xn(t){return/[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function Yn(t,n,e){const r=dn(t);if(!r)return"";const o=[];for(let s=0;s<=r.row;s++){const c=[];for(let o=0;o<=r.col;o++){const r=sn(t,s,o),u=mn(t,n,e,s,o).text;c.push(Xn("'"===r[0]&&/^[=+\-@]/.test(u)?r:u))}o.push(c.join(","))}return o.join("\n")}function Bn(t,n){const e=rn(t),r={},o=n.map((t,n)=>t.map((t,e)=>{const{raw:o,numFmt:s}=an(t);return s&&(r[on(n,e)]={numFmt:s}),o}));return{...e,cells:o,formats:r,rowCount:Math.max(e.rowCount,o.length+100),colCount:Math.max(e.colCount,o.reduce((t,n)=>Math.max(t,n.length),0))}}function Jn(t,n,e,r,o){const s=new Set;for(let c=r.r1+1;c<=r.r2;c++)s.add(mn(t,n,e,c,o).text);return[...s].sort((t,n)=>t.localeCompare(n,void 0,{numeric:!0}))}export{t as MAX_ROWS,n as MAX_COLS,e as colLabel,r as colIndex,o as cellLabel,s as normalizeRange,c as rangeLabel,u as rangeContains,i as parseRangeLabel,v as tokenize,C as isFormula,S as printRef,R as shiftFormula,T as cycleRefAbsolute,F as NUMBER_FORMATS,X as formatNumber,B as adjustDecimals,ct as FormulaError,qt as FUNCTION_NAMES,tn as DEFAULT_COL_WIDTH,nn as DEFAULT_ROW_HEIGHT,en as DEFAULT_FONT_SIZE,rn as newSheet,on as formatKey,sn as rawAt,cn as nextSheetName,un as makeEvaluator,an as readEntry,fn as editText,mn as cellDisplay,dn as usedBounds,pn as writeCells,gn as commitEntry,bn as clearValues,Mn as updateFormats,yn as withFormat,An as applyBorders,vn as mergedAt,En as expandForMerges,Nn as mergeRange,xn as unmergeRange,Rn as changeStructure,Tn as renameSheet,Un as deleteSheet,Fn as duplicateSheet,kn as sortRange,Dn as filteredRows,Ln as dataRegion,Vn as fillRange,zn as copyClip,Gn as pasteClip,Wn as moveCells,Hn as findCells,Zn as replaceInCell,_n as selectionStats,Kn as parseCsv,Yn as serializeCsv,Bn as sheetFromRows,Jn as columnValues};
@@ -0,0 +1 @@
1
+ import{BUILTIN_STYLES as e,DEFAULT_PAGE as t,REL as n,child as o,childrenOf as a,descendants as r,paraCss as s,parseParaProps as c,parseRunProps as l,parseXml as i,partText as d,readRels as p,readThemeFonts as f,readZip as w,resolveTarget as m,runCss as u}from"./chunk-RHW2M2UY.js";import{escapeHtml as g}from"efficient-shell/ui";var h={textBox:"Text box",chart:"Chart",diagram:"Diagram",equation:"Equation",picture:"Picture",object:"Object",contents:"Field"},b=new Set(["w:ins","w:del","w:moveFrom","w:moveTo","w:rPrChange","w:pPrChange","w:tcPrChange","w:trPrChange","w:tblPrChange","w:sectPrChange","w:cellIns","w:cellDel"]),$=new Set(["w:ins","w:del","w:moveFrom","w:moveTo"]),y={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml"},k=/^(https?:|mailto:|tel:)/i,v=e=>g(e);function x(e,t){let n="";for(let t=0;t<e.length;t+=32768)n+=String.fromCharCode(...e.subarray(t,t+32768));return`data:${t};base64,${btoa(n)}`}var T=(e,t)=>`${t}${++e.nextId}`,C=(e,t)=>e.src.slice(t.start,t.end),A=(e,t)=>t?C(e,t):void 0;function S(e,t){const n=[],a=new Set;let r=t;for(;r&&!a.has(r);){a.add(r);const t=e.styles.get(r);if(!t)break;n.unshift(t),r=o(t,"w:basedOn")?.attrs["w:val"]}return n}var P=e=>`"${e.replace(/["\\\n\r]/g,"")}"`;function j(e){return"w:t"===e.name||"w:delText"===e.name?e.text:"w:tab"===e.name?"\t":"w:instrText"===e.name||"w:instrDelText"===e.name?"":e.children.map(j).join("")}function N(e,t,n,o,a=""){const r=T(e,"x");return e.doc.raw.set(r,t),`<span data-raw="${r}" data-kind="${n}" contenteditable="false"${a}>${g(o)}</span>`}function E(e,t){const n=T(e,"x");return e.doc.raw.set(n,t),`<span data-raw="${n}" data-kind="mark"></span>`}function I(e,t,n){const a=n(C(e,t)),s=e=>r(t,new Set([e])).length>0,c=o(t,"wp:inline"),l=r(t,new Set(["a:blip"]))[0],i=l&&e.rels.get(l.attrs["r:embed"]),d=i&&!i.external?m(e.doc.docPath,i.target):void 0,p=d?.split(".").pop()?.toLowerCase()??"",f=d?e.doc.parts.get(d):void 0;if(f&&y[p]&&!s("wps:txbx")){const n=T(e,"x");e.doc.raw.set(n,a);const r=o(c??o(t,"wp:anchor"),"wp:extent"),s=Number(r?.attrs.cx)/12700,l=Number(r?.attrs.cy)/12700,i=s&&l?` style="width:${Math.round(100*s)/100}pt;height:${Math.round(100*l)/100}pt"`:"",d=c?"":' contenteditable="false"';return c||e.doc.notices.objects++,`<img data-raw="${n}" src="${v(e.imageUrl(f,y[p]))}"${i}${d} alt="">`}return e.doc.notices.objects++,s("wps:txbx")||s("w:txbxContent")?N(e,a,"object",`${e.labels.textBox}: ${j(t).slice(0,80)}`):s("c:chart")?N(e,a,"object",e.labels.chart):s("dgm:relIds")?N(e,a,"object",e.labels.diagram):N(e,a,"object",l?e.labels.picture:e.labels.object)}function M(e,t){const n=o(t,"w:rPr"),a=l(n,e.theme),s=A(e,n)??"",c=e=>`<w:r>${s}${e}</w:r>`;let i="";for(const n of t.children)switch(n.name){case"w:rPr":case"w:lastRenderedPageBreak":case"w:commentReference":case"w:fldChar":case"w:instrText":case"w:delInstrText":break;case"w:t":case"w:delText":i+=g(n.text);break;case"w:tab":i+="\t";break;case"w:noBreakHyphen":i+="‑";break;case"w:softHyphen":i+="­";break;case"w:br":case"w:cr":"page"===n.attrs["w:type"]?i+='<span data-page-break contenteditable="false"></span>':"column"===n.attrs["w:type"]?i+=N(e,c(C(e,n)),"mark",""):i+="<br>";break;case"w:drawing":i+=I(e,n,c);break;case"mc:AlternateContent":case"w:pict":case"w:object":e.doc.notices.objects++,i+=N(e,c(C(e,n)),"object",r(n,new Set(["wps:txbx","w:txbxContent","v:textbox"])).length?`${e.labels.textBox}: ${j(r(n,new Set(["wps:txbx","w:txbxContent","v:textbox"]))[0]).slice(0,80)}`:e.labels.object);break;case"w:footnoteReference":case"w:endnoteReference":{const t=++e.footnoteCount;e.doc.notices.footnotes++;const o=e.footnotes.get(n.attrs["w:id"]);i+=N(e,c(C(e,n)),"note",String(t),o?` title="${v(o)}"`:"");break}default:i+=N(e,c(C(e,n)),"mark","")}if(!i)return"";if(a.vert&&(i=`<${"sub"===a.vert?"sub":"sup"}>${i}</${"sub"===a.vert?"sub":"sup"}>`),n){const t=T(e,"r");e.doc.runs.set(t,s);const r=u(a),c=o(n,"w:rStyle")?.attrs["w:val"];i=`<span data-r="${t}"${c?` data-rstyle="${v(c)}"`:""}${r?` style="${v(r)}"`:""}>${i}</span>`}for(const t of e.openComments)i=`<span data-comment="${v(t)}" title="${v(e.comments.get(t)??"")}">${i}</span>`;return i}function L(e,t){let n="",o=0,r=-1,s=-1,c="",l=!1;const i=()=>{r>=0&&(n+=N(e,e.src.slice(r,s),"field",c||e.labels.contents)),r=-1,c="",l=!1};for(const d of t){if("w:r"===d.name){const t=a(d,"w:fldChar");if(t.length||o>0){0===o&&(r=d.start,l=!1),l&&(c+=j(d));for(const e of t){const t=e.attrs["w:fldCharType"];"begin"===t?o++:"separate"===t&&1===o?l=!0:"end"===t&&o--}s=d.end,0===o&&i();continue}n+=M(e,d);continue}if(o>0)s=d.end;else switch(d.name){case"w:pPr":case"w:proofErr":break;case"w:commentRangeStart":e.openComments.add(d.attrs["w:id"]);break;case"w:commentRangeEnd":e.openComments.delete(d.attrs["w:id"]);break;case"w:hyperlink":{const t=d.attrs["r:id"]?e.rels.get(d.attrs["r:id"]):void 0,o=d.attrs["w:anchor"],a=t?.target??(o?`#${o}`:""),r=k.test(a)||a.startsWith("#"),s=`${t?` data-rel="${v(d.attrs["r:id"])}"`:""}${o?` data-anchor="${v(o)}"`:""}`;n+=`<a${r?` href="${v(a)}"`:""}${s}>${L(e,d.children)}</a>`;break}case"w:ins":case"w:moveTo":n+=`<ins>${L(e,d.children)}</ins>`;break;case"w:del":case"w:moveFrom":n+=`<del>${L(e,d.children)}</del>`;break;case"w:bookmarkStart":case"w:bookmarkEnd":case"w:permStart":case"w:permEnd":default:n+=E(e,C(e,d));break;case"m:oMath":case"m:oMathPara":e.doc.notices.objects++,n+=N(e,C(e,d),"object",e.labels.equation);break;case"w:fldSimple":case"w:sdt":case"w:smartTag":case"w:customXml":n+=N(e,C(e,d),"field",j(d)||e.labels.contents)}}return o>0&&(n+=g(c)),n}function O(e){return r(e,b).length>0}function B(e,t){const n=o(t,"w:pPr"),a=o(n,"w:pStyle")?.attrs["w:val"],r=o(n,"w:numPr")??function(e,t){let n;for(const a of S(e,t))n=o(o(a,"w:pPr"),"w:numPr")??n;return n}(e,a),s=o(r,"w:numId")?.attrs["w:val"];if(!s||"0"===s)return null;const c=Number(o(r,"w:ilvl")?.attrs["w:val"]??0),l=e.numbering.get(s)?.get(c);return{numId:s,ilvl:c,ordered:l?.ordered??!1,marker:l?.marker??""}}function R(e){const t=[],n=o(e,"w:pBdr");for(const e of["top","bottom","left","right"]){const a=o(n,`w:${e}`);if(!a||"nil"===a.attrs["w:val"]||"none"===a.attrs["w:val"])continue;const r=/^[0-9a-fA-F]{6}$/.test(a.attrs["w:color"]??"")?`#${a.attrs["w:color"]}`:"currentcolor";t.push(`border-${e}:${(Number(a.attrs["w:sz"])||4)/8}pt solid ${r}`)}const a=o(e,"w:shd")?.attrs["w:fill"];return a&&/^[0-9a-fA-F]{6}$/.test(a)&&t.push(`background-color:#${a}`),t.join(";")}function H(e,t,n){const a=o(t,"w:pPr"),l=o(a,"w:pStyle")?.attrs["w:val"],i=e.fieldOpen,d=function(e){let t=0;for(const n of r(e,new Set(["w:fldChar"]))){const e=n.attrs["w:fldCharType"];"begin"===e?t++:"end"===e&&t--}return t}(t),p=O(t)||i||0!==d;d>0&&(e.fieldOpen=!0),i&&d<0&&(e.fieldOpen=!1);const f=T(e,"p");e.doc.blocks.set(f,{xml:C(e,t),fingerprint:"",props:A(e,a),numId:n?.numId,ilvl:n?.ilvl});const w=n?0:function(e,t){if(!t)return 0;const n=o(e.styles.get(t),"w:name")?.attrs["w:val"]??"",a=/^heading ([1-6])$/i.exec(n);return a?Number(a[1]):0}(e,l),m=n?"li":w?`h${w}`:"p",u=c(a);n&&delete u.indentLeft,n&&delete u.firstLine;const g=[s(u),R(a)].filter(Boolean).join(";");let h=p?D(e,t):L(e,t.children);h&&!/<br>(<\/[^>]+>)*$/.test(h)||(h+="<br>");return`<${m} data-docx="${f}"${o(a,"w:pageBreakBefore")?" data-break-before":""}${l?` data-pstyle="${v(l)}"`:""}${g?` style="${v(g)}"`:""}${p?' data-locked contenteditable="false"':""}>${h}</${m}>`}function D(e,t){let n="";for(const o of t.children)"w:pPr"!==o.name&&"w:rPr"!==o.name&&"w:instrText"!==o.name&&"w:delInstrText"!==o.name&&("w:ins"===o.name||"w:moveTo"===o.name?n+=`<ins>${D(e,o)}</ins>`:"w:del"===o.name||"w:moveFrom"===o.name?n+=`<del>${D(e,o)}</del>`:"w:commentRangeStart"===o.name?e.openComments.add(o.attrs["w:id"]):"w:commentRangeEnd"===o.name?e.openComments.delete(o.attrs["w:id"]):"w:t"===o.name||"w:delText"===o.name?n+=g(o.text):"w:tab"===o.name?n+="\t":"w:br"===o.name?n+="<br>":"w:drawing"===o.name||"mc:AlternateContent"===o.name||"w:pict"===o.name?n+=`<span data-kind="object">${g(e.labels.object)}</span>`:n+=D(e,o));return n}function U(e,t){const n=T(e,"t"),r=o(t,"w:tblPr"),s=o(t,"w:tblGrid"),c=a(t,"w:tr"),l=c.some(e=>o(o(e,"w:trPr"),"w:gridBefore")||o(o(e,"w:trPr"),"w:gridAfter")),i=O(t)||l;l&&e.doc.notices.objects++,e.doc.blocks.set(n,{xml:C(e,t),fingerprint:"",props:A(e,r),tblGrid:A(e,s)});const d=o(r,"w:tblStyle")?.attrs["w:val"],p=a(s,"w:gridCol").map(e=>Number(e.attrs["w:w"])/20),f=new Map,w=c.map(e=>{const t=[];let n=0;for(const r of a(e,"w:tc")){const e=o(r,"w:tcPr"),a=Number(o(e,"w:gridSpan")?.attrs["w:val"]??1),s=o(e,"w:vMerge");if(s&&"restart"!==s.attrs["w:val"]&&f.has(n))f.get(n).rowSpan++;else{const e={node:r,rowSpan:1,col:n,span:a};t.push(e),s?f.set(n,e):f.delete(n)}n+=a}return t}),m=function(e,t,n){let a=o(t,"w:tblBorders");if(!a)for(const t of S(e,n))a=o(o(t,"w:tblPr"),"w:tblBorders")??a;return!!a&&a.children.some(e=>!["nil","none"].includes(e.attrs["w:val"]))}(e,r,d),u=c.map((t,n)=>{const a=T(e,"t");e.doc.blocks.set(a,{xml:"",fingerprint:"",props:A(e,o(t,"w:trPr"))});return`<tr data-docx="${a}">${w[n].map(t=>{const n=T(e,"t"),a=o(t.node,"w:tcPr");e.doc.blocks.set(n,{xml:"",fingerprint:"",props:A(e,a)});const r=o(a,"w:shd")?.attrs["w:fill"],s=[];r&&/^[0-9a-fA-F]{6}$/.test(r)&&s.push(`background-color:#${r.toLowerCase()}`);const c=o(a,"w:vAlign")?.attrs["w:val"];return"center"===c&&s.push("vertical-align:middle"),"bottom"===c&&s.push("vertical-align:bottom"),`<td data-docx="${n}"${t.span>1?` colspan="${t.span}"`:""}${t.rowSpan>1?` rowspan="${t.rowSpan}"`:""}${s.length?` style="${s.join(";")}"`:""}>${F(e,t.node.children)}</td>`}).join("")}</tr>`}).join(""),g=p.length?`<colgroup>${p.map(e=>`<col style="width:${Math.round(100*e)/100}pt">`).join("")}</colgroup>`:"";return`<table data-docx="${n}"${d?` data-tstyle="${v(d)}"`:""}${m?"":" data-no-borders"}${i?' data-locked contenteditable="false"':""}>${g}<tbody>${u}</tbody></table>`}function F(e,t){const n=[],r=[],s=e=>{for(;r.length>e;){const e=r.pop();n.push(`</li></${e.tag}>`)}};for(const c of t){const t="w:p"===c.name?B(e,c):null;if(t){for(;r.length&&r[r.length-1].ilvl>t.ilvl;)s(r.length-1);const o=r[r.length-1];!o||o.ilvl!==t.ilvl||o.numId===t.numId&&o.tag===(t.ordered?"ol":"ul")||s(r.length-1);const a=`${t.numId}:${t.ilvl}`,l=e.listCounters.get(a)??0;e.listCounters.set(a,l+1);const i=H(e,c,t),d=r[r.length-1];if(d&&d.ilvl===t.ilvl)n.push(`</li>${i.slice(0,i.lastIndexOf("</li>"))}`);else{const e=t.ordered?"ol":"ul",o=t.marker?` style="list-style-type:${t.marker}"`:"",a=t.ordered&&l?` start="${l+1}"`:"";n.push(`<${e} data-num-id="${v(t.numId)}" data-ilvl="${t.ilvl}"${a}${o}>${i.slice(0,i.lastIndexOf("</li>"))}`),r.push({tag:e,numId:t.numId,ilvl:t.ilvl})}continue}if("w:tcPr"!==c.name&&"w:sectPr"!==c.name)if(s(0),"w:p"===c.name)n.push(H(e,c,null));else if("w:tbl"===c.name)n.push(U(e,c));else if("w:sdt"===c.name){const t=T(e,"p");e.doc.blocks.set(t,{xml:C(e,c),fingerprint:""}),e.doc.notices.objects++;const r=F(e,a(o(c,"w:sdtContent"),"w:p"));n.push(`<div data-docx="${t}" data-locked contenteditable="false">${r}</div>`)}else{const t=T(e,"p");e.doc.blocks.set(t,{xml:C(e,c),fingerprint:""}),n.push(`<div data-docx="${t}" data-locked data-hidden contenteditable="false"></div>`)}}return s(0),n.join("")}function z(e){if("LI"!==e.tagName)return e.outerHTML;const t=e.cloneNode(!0);return Array.from(t.children).forEach(e=>{"UL"!==e.tagName&&"OL"!==e.tagName||e.remove()}),t.outerHTML}function V(e){const t=document.createElement("div");t.innerHTML=e.html,t.querySelectorAll("[data-docx]").forEach(t=>{const n=e.blocks.get(t.getAttribute("data-docx"));n&&(n.fingerprint=z(t))})}function q(e,t){const n=t?d(e,t):void 0;if(!n)return{text:"",editable:!0};const o=i(n),a=o.children.filter(e=>"w:p"===e.name),s=o.children.every(e=>"w:p"===e.name)&&0===r(o,new Set(["w:drawing","w:pict","mc:AlternateContent","w:sdt"])).length,c=a.map(e=>{let t="",n="",o=!1;const a=e=>{for(const r of e.children)if("w:t"===r.name)o||(t+=r.text);else if("w:tab"===r.name)o||(t+=" | ");else if("w:instrText"===r.name)n+=r.text;else if("w:fldChar"===r.name){const e=r.attrs["w:fldCharType"];"separate"!==e&&"end"!==e||(n&&(t+=G(n),n=""),o="separate"===e)}else"w:fldSimple"===r.name?t+=G(r.attrs["w:instr"]??"")||r.children.map(j).join(""):"w:pPr"!==r.name&&"w:rPr"!==r.name&&a(r)};return a(e),t}).filter(Boolean);return{text:c.join(" "),editable:s&&c.length<=1,part:t}}function G(e){const t=e.trim().split(/\s+/)[0]?.toUpperCase();return"PAGE"===t?"{page}":"NUMPAGES"===t?"{pages}":""}async function W(e,t={}){return K(await w(e),e,t)}function K(w,g,b={}){const y=p(w,"").find(e=>e.type.endsWith("/officeDocument")),k=y?m("",y.target):"word/document.xml",v=d(w,k);if(!v)throw new Error("Not a Word document");const T=i(v),C=o(T,"w:body");if(!C)throw new Error("Not a Word document");const A=p(w,k),N=e=>{const t=(e=>A.find(t=>t.type===e))(e);return t?m(k,t.target):void 0},E=f(N(n.theme)?d(w,N(n.theme)):void 0),I={parts:w,docPath:k,source:g,html:"",css:"",page:{...t},header:{text:"",editable:!0},footer:{text:"",editable:!0},blocks:new Map,runs:new Map,raw:new Map,notices:{comments:0,tracked:0,objects:0,footnotes:0},styles:[],theme:E},M={src:v,doc:I,labels:b.labels??h,rels:new Map(A.map(e=>[e.id,e])),theme:E,imageUrl:b.imageUrl??x,styles:new Map,numbering:new Map,listCounters:new Map,comments:new Map,footnotes:new Map,nextId:0,footnoteCount:0,openComments:new Set,fieldOpen:!1},L=N(n.styles),O=L?d(w,L):void 0,B=O?i(O):void 0;for(const e of a(B,"w:style"))M.styles.set(e.attrs["w:styleId"],e);const R=new Set(M.styles.keys());for(const[t,n]of Object.entries(e))R.has(t)||M.styles.set(t,i(n.xml));const H=o(B,"w:docDefaults");I.lang=o(o(o(H,"w:rPrDefault"),"w:rPr"),"w:lang")?.attrs["w:val"],I.css=function(e,t){const n=[],a=l(o(o(t,"w:rPrDefault"),"w:rPr"),e.theme),r=c(o(o(t,"w:pPrDefault"),"w:pPr"));e.doc.defaultFont=a.font,e.doc.defaultSize=a.size;let i=a,d=r;for(const[t,p]of e.styles){const f=p.attrs["w:type"];if("paragraph"!==f&&"character"!==f&&"table"!==f)continue;let w={},m={};for(const n of S(e,t))w={...w,...l(o(n,"w:rPr"),e.theme)},m={...m,...c(o(n,"w:pPr"))};if("paragraph"===f)n.push(`.docs-page [data-pstyle=${P(t)}]{${[u(w),s(m)].filter(Boolean).join(";")}}`),"1"===p.attrs["w:default"]&&(i={...a,...w},d={...r,...m});else if("character"===f)n.push(`.docs-page [data-rstyle=${P(t)}]{${u(w)}}`);else{const e=s(m);e&&n.push(`.docs-page table[data-tstyle=${P(t)}] p{${e}}`)}}return n.unshift(`.docs-page{${u(i)}}`,`.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6,.docs-page li{${s(d)}}`),n.join("\n")}(M,H);const D=new Set(Object.keys(e));I.styles=[...M.styles.values()].filter(e=>"paragraph"===e.attrs["w:type"]&&"1"!==e.attrs["w:default"]&&(D.has(e.attrs["w:styleId"])||o(e,"w:qFormat"))&&!o(e,"w:hidden")&&!o(e,"w:semiHidden")).map(e=>({id:e.attrs["w:styleId"],name:o(e,"w:name")?.attrs["w:val"]??e.attrs["w:styleId"]}));const U=N(n.numbering),z=U?d(w,U):void 0;z&&function(e,t){const n=new Map;for(const e of a(t,"w:abstractNum")){const t=new Map;for(const n of a(e,"w:lvl")){const e=o(n,"w:numFmt")?.attrs["w:val"]??"decimal";t.set(Number(n.attrs["w:ilvl"]),{ordered:"bullet"!==e&&"none"!==e,marker:Y[e]??""})}n.set(e.attrs["w:abstractNumId"],t)}for(const r of a(t,"w:num")){const t=n.get(o(r,"w:abstractNumId")?.attrs["w:val"]??"");t&&e.numbering.set(r.attrs["w:numId"],t)}}(M,i(z));const G=N(n.comments),W=G?d(w,G):void 0;if(W){for(const e of a(i(W),"w:comment"))M.comments.set(e.attrs["w:id"],`${e.attrs["w:author"]??""}: ${j(e)}`);I.notices.comments=M.comments.size}const K=N(n.footnotes),Q=K?d(w,K):void 0;if(Q)for(const e of a(i(Q),"w:footnote"))M.footnotes.set(e.attrs["w:id"],j(e));I.notices.tracked=r(C,$).length;const X=o(C,"w:sectPr"),J=o(X,"w:pgSz"),Z=o(X,"w:pgMar"),_=(e,t,n)=>{const o=Number(e?.attrs[t]);return Number.isFinite(o)&&void 0!==e?.attrs[t]?o:n};I.page={width:_(J,"w:w",t.width),height:_(J,"w:h",t.height),top:Math.abs(_(Z,"w:top",t.top)),right:_(Z,"w:right",t.right),bottom:Math.abs(_(Z,"w:bottom",t.bottom)),left:_(Z,"w:left",t.left),header:_(Z,"w:header",t.header),footer:_(Z,"w:footer",t.footer)};const ee=e=>{const t=a(X,e).find(e=>"default"===e.attrs["w:type"]),n=t&&M.rels.get(t.attrs["r:id"]);return n?m(k,n.target):void 0};return I.header=q(w,ee("w:headerReference")),I.footer=q(w,ee("w:footerReference")),I.html=F(M,C.children),I.html||(I.html="<p><br></p>"),V(I),I}var Y={lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero"};var Q=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI","TR","TABLE","UL","OL","TBODY"]);function X(e){let t="";const n=e=>{for(const o of Array.from(e.childNodes)){if(3===o.nodeType){t+=(o.nodeValue??"").replace(/​/g,"");continue}if(1!==o.nodeType)continue;const e=o;if("BR"===e.tagName){t+="\n";continue}if("DEL"===e.tagName||e.hasAttribute("data-hidden"))continue;if("object"===e.getAttribute("data-kind")||"mark"===e.getAttribute("data-kind"))continue;if("TD"===e.tagName||"TH"===e.tagName){n(e),t=`${t.replace(/\n+$/,"")}\t`;continue}const a=Q.has(e.tagName);n(e),a&&!t.endsWith("\n")&&(t+="\n")}};return n(e),t.replace(/\t\n/g,"\n").replace(/\n+$/,"\n")}function J(e){return(e.match(/[぀-ヿ㐀-鿿豈-﫿]/g)?.length??0)+(e.replace(/[぀-ヿ㐀-鿿豈-﫿]/g," ").match(/\S+/g)?.length??0)}function Z(e,t,n){if(!t)return[];const o=function(e){const t=[],n=e=>{for(const o of Array.from(e.childNodes))if(3===o.nodeType)t.push(o);else if(1===o.nodeType){const e=o;if("false"===e.getAttribute("contenteditable")||e.hasAttribute("data-raw"))continue;n(e)}};return n(e),t}(e),a=t=>{let n=t.parentNode;for(;n&&n!==e&&!Q.has(n.tagName)&&"TD"!==n.tagName;)n=n.parentNode;return n},r=[];let s=0;for(;s<o.length;){const e=a(o[s]);let c=s;const l=[];for(;c<o.length&&a(o[c])===e;)l.push(o[c++]);const i=l.map(e=>e.nodeValue??"").join(""),d=n?i:i.toLowerCase(),p=n?t:t.toLowerCase(),f=d.length===i.length?d:i;for(let e=f.indexOf(p);e>=0;e=f.indexOf(p,e+p.length)){const t=[];let n=0;for(const o of l){const a=(o.nodeValue??"").length,r=Math.max(e,n),s=Math.min(e+p.length,n+a);r<s&&t.push({node:o,start:r-n,end:s-n}),n+=a}r.push(t)}s=c}return r}function _(e,t){e.forEach((e,n)=>{const o=e.node.nodeValue??"";e.node.nodeValue=o.slice(0,e.start)+(0===n?t:"")+o.slice(e.end)})}function ee(e,t){const n=[0];if(t<=0)return n;let o=0;for(const a of e)if(a.breakBefore&&a.top>o&&(o=a.top,n.push(o)),!(a.top+a.height-o<=t))if(a.height<=t)a.top>o&&(o=a.top,n.push(o));else for(;a.top+a.height-o>t;)o+=t,n.push(o);return n}function te(e,t,n=1){const o=[],a=e=>{const a=e.getBoundingClientRect();o.push({top:(a.top-t)/n,height:a.height/n,breakBefore:e.hasAttribute("data-break-before")})};for(const r of Array.from(e.children))"TABLE"===r.tagName?r.querySelectorAll("tr").forEach(a):"UL"===r.tagName||"OL"===r.tagName?r.querySelectorAll("li").forEach(a):a(r),r.querySelectorAll("[data-page-break]").forEach(e=>{const a=e.getBoundingClientRect();o.push({top:(a.bottom-t)/n,height:0,breakBefore:!0})});return o}var ne=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","COLGROUP","COL","B","STRONG","I","EM","U","S","STRIKE","SUB","SUP","SPAN","FONT","A","BR","IMG","PRE","HR"]),oe=new Set(["SCRIPT","STYLE","TITLE","META","LINK","OBJECT","EMBED","IFRAME","NOSCRIPT","TEMPLATE","SVG","MATH","FORM","INPUT","BUTTON","SELECT","TEXTAREA","VIDEO","AUDIO","CANVAS"]),ae=new Set(["color","background-color","font-weight","font-style","text-decoration-line","text-decoration","font-family","font-size","text-align","margin-left","line-height","width","height","list-style-type"]),re=/^(https?:|mailto:|tel:|#)/i,se=/^(data:image\/(png|jpe?g|gif|webp|bmp);base64,|blob:)/i;function ce(e){const t=document.implementation.createHTMLDocument("");t.body.innerHTML=e;const n=(e,t,o)=>{for(const a of Array.from(e.childNodes)){if(3===a.nodeType){t.appendChild(o.createTextNode(a.nodeValue??""));continue}if(1!==a.nodeType)continue;const e=a,r=e.tagName.toUpperCase();if(oe.has(r))continue;if(!ne.has(r)){n(e,t,o);continue}if("IMG"===r&&!se.test(e.getAttribute("src")??""))continue;const s=o.createElement(r),c=(e.getAttribute("style")??"").split(";").map(e=>{const t=e.indexOf(":");if(t<0)return"";const n=e.slice(0,t).trim().toLowerCase(),o=e.slice(t+1).trim();return ae.has(n)&&!/url\(|expression|mso-/i.test(o)?`${n}:${o}`:""}).filter(Boolean).join(";");c&&s.setAttribute("style",c),"A"===r&&re.test(e.getAttribute("href")??"")&&s.setAttribute("href",e.getAttribute("href")),"IMG"===r&&s.setAttribute("src",e.getAttribute("src"));for(const t of["colspan","rowspan","start","color","face","size"]){const n=e.getAttribute(t);null!==n&&s.setAttribute(t,n)}n(e,s,o),t.appendChild(s)}},o=document.createElement("div");return n(t.body,o,document),o.innerHTML}import{escapeHtml as le}from"efficient-shell/ui";var ie="\nhtml,body{margin:0;background:#fff}\n.docs-page [data-comment]{background:none;border:0}\n.docs-page [data-locked]{background:none;box-shadow:none}\n.docs-page [data-page-break]{break-after:page;border:0;margin:0}\n.docs-page [data-break-before]{break-before:page}\n.docs-page tr,.docs-page img{break-inside:avoid}\n";function de(e,t){return`\n.docs-sheet{background:#fff;color:#777}\n.docs-sheet-line{border-color:#aaa}\n\n${`\n.docs-page{color:#000;background:#fff;white-space:pre-wrap;overflow-wrap:break-word;outline:none;line-height:1.08;tab-size:36pt;font-family:Calibri,Carlito,Arial,sans-serif;font-size:11pt}\n.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6{margin:0;font:inherit;font-weight:400}\n.docs-page ul,.docs-page ol{margin:0;padding-left:24pt}\n.docs-page ul{list-style-type:disc}.docs-page ol{list-style-type:decimal}\n.docs-page ul ul{list-style-type:circle}.docs-page ul ul ul{list-style-type:square}\n.docs-page a{color:#0563c1;text-decoration:underline}\n.docs-page sub,.docs-page sup{font-size:.66em}\n.docs-page img{max-width:100%}\n.docs-page table{border-collapse:collapse;table-layout:fixed;width:100%}\n.docs-page td,.docs-page th{border:.5pt solid #000;padding:0 5.4pt;vertical-align:top}\n.docs-page table[data-no-borders] td,.docs-page table[data-no-borders] th{border:.5pt dotted #bbb}\n.docs-page td p{margin-bottom:0}\n.docs-page blockquote{margin:0 0 8pt 24pt;font-style:italic}\n.docs-page hr{border:0;border-top:.75pt solid #000;margin:6pt 0}\n.docs-page [data-hidden]{display:none}\n.docs-page [data-page-break]{display:block;height:0;border-top:1pt dashed #999;margin:6pt 0;user-select:none}\n.docs-page [data-comment]{background:#fff2cc;border-bottom:1.5pt solid #e0b000}\n.docs-page [data-locked]{background:#f4f4f4;box-shadow:-5pt 0 0 #bbb;cursor:not-allowed}\n.docs-page ins{color:#c00000;text-decoration:underline}\n.docs-page del{color:#c00000;text-decoration:line-through}\n.docs-page [data-kind="object"]{display:inline-block;background:#f4f4f4;border:.75pt dashed #999;color:#555;padding:1pt 5pt;cursor:not-allowed;white-space:normal}\n.docs-page [data-kind="field"]{background:#ededed}\n.docs-page [data-kind="note"]{vertical-align:super;font-size:.66em}\n.docs-page ::highlight(docs-find){background:#ffe680}\n.docs-page ::highlight(docs-find-current){background:#ff9f1a}\n\n${e.css}`.replaceAll(".docs-page",`.docs-page[data-doc="${t}"]`)}`}var pe=e=>ie.replaceAll(".docs-page",`.docs-page[data-doc="${e}"]`);function fe(e,t,n){const o=e=>(e??"").replaceAll("{page}",String(t)).replaceAll("{pages}",String(n)),[a,r]=e.split(/\s*\|\s*/);return[o(a),o(r)]}function we(e,t){const[n,o]=function(e){return e.split(/\s*\|\s*/).map(e=>e.split(/(\{page\}|\{pages\})/).map(e=>"{page}"===e?"counter(page)":"{pages}"===e?"counter(pages)":e?`"${e.replace(/["\\\n\r]/g,"")}"`:"").filter(Boolean).join(" "))}(t),a="font:9pt Calibri,Carlito,Arial,sans-serif;color:#555";return`${n?`@${e}-left{content:${n};${a}}`:""}${o?`@${e}-right{content:${o};${a}}`:""}`}function me({title:e,html:t,doc:n,scope:o,page:a,header:r,footer:s}){const c=e=>Math.round(e)/20+"pt",l=`@page{size:${c(a.width)} ${c(a.height)};margin:${c(a.top)} ${c(a.right)} ${c(a.bottom)} ${c(a.left)};${we("top",r)}${we("bottom",s)}}`;return`<!doctype html><html><head><meta charset="utf-8"><meta name="generator" content="efficient-shell Documents"><title>${le(e)}</title><style>${de(n,o)}\n${pe(o)}\n${l}</style></head><body><div class="docs-page" data-doc="${o}">${t}</div></body></html>`}export{z as fingerprintOf,V as stampFingerprints,W as readDocx,K as readParts,X as documentText,J as countWords,Z as findInNodes,_ as replaceSpots,ee as pageStarts,te as pageBlocks,ce as sanitizeHtml,de as pageStyles,pe as printStyles,fe as marginText,me as pageDocument};
@@ -0,0 +1 @@
1
+ import{ENGLISH_WORDS as r}from"./chunk-2PIEDEY5.js";import{newSheet as e}from"./chunk-VKCG3LPQ.js";import{createContext as t,useContext as n}from"react";import{jsx as o}from"react/jsx-runtime";var a=t(r);function s({words:r,children:e}){return o(a.Provider,{value:r,children:e})}var c=()=>n(a);import{createContext as i,useContext as m}from"react";import{jsx as u}from"react/jsx-runtime";var l=class extends Error{},p=i({});function f({value:r,children:e}){return u(p.Provider,{value:r,children:e})}var h=()=>m(p);function v(r,t){const n=Array.isArray(r?.sheets)?r.sheets:[];return n.length?n.map(r=>({...e(r.name),...r,cells:(r.cells??[]).map(r=>(r??[]).map(r=>r??""))})):[e(t)]}export{s as SpreadsheetWordsProvider,c as useSpreadsheetWords,l as SpreadsheetsConflict,f as SpreadsheetsProvider,h as useSpreadsheetsHost,v as sheetsOf};
@@ -0,0 +1 @@
1
+ import{drawJpeg as t,embeddedFonts as o,jpegPdf as r,openStage as n,settled as e}from"./chunk-JKYJGXJE.js";import{SLIDE_FONT as i,SlideView as a}from"./chunk-2AKHYM66.js";import"./chunk-2TZUCKZ7.js";import{ENGLISH_WORDS as c}from"./chunk-SB3YS3LH.js";import{flushSync as s}from"react-dom";import{createRoot as m}from"react-dom/client";import{jsx as l}from"react/jsx-runtime";async function d(o,r,n,i){const c=document.createElement("div");r.root.append(c);const d=m(c);try{s(()=>d.render(l(a,{slide:o,width:1600})));const r=c.firstElementChild;await e(r);return{jpeg:await t(r,{width:1600,height:900,pixelRatio:1,quality:i,fontCss:n,background:o.background}),width:720,height:405}}finally{d.unmount(),c.remove()}}async function u(t,e={}){const{signal:a,onProgress:s,quality:m}=e;a?.throwIfAborted();const l=n();try{const n=await async function(t){const r=document.createElement("div");r.style.fontFamily=i,t.root.append(r);try{return await o(r)}finally{r.remove()}}(l),e=[];for(const[o,r]of t.slides.entries()){a?.throwIfAborted();const i=await d(r,l,n,m).catch(t=>{throw new Error(c.pdfSlideFailed(o+1),{cause:t})});e.push(i),s?.(o+1,t.slides.length)}return r(e)}finally{l.close()}}export{u as deckToPdf};
@@ -1,5 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentType } from 'react';
3
+ import { P as PdfOptions } from '../options-Djr917yc.js';
3
4
 
4
5
  /**
5
6
  * The Documents app's words: its English, and each language this package carries. A
@@ -165,6 +166,7 @@ interface DocumentsWords {
165
166
  discardTitle: (name: string) => string;
166
167
  cannotRead: (name: string) => string;
167
168
  unsupported: (ext: string) => string;
169
+ pdfPageFailed: (page: number) => string;
168
170
  }
169
171
  declare const ENGLISH_WORDS: DocumentsWords;
170
172
  declare const ZH_HANS_WORDS: DocumentsWords;
@@ -236,5 +238,7 @@ declare const documentsApp: {
236
238
  readonly multiInstance: true;
237
239
  };
238
240
  };
241
+ /** A PDF of a `.docx`, its pages as the document's page setup lays them out. */
242
+ declare function docxToPdf(file: Blob, options?: PdfOptions): Promise<Blob>;
239
243
 
240
- export { DocumentEditor, type DocumentSummary, Documents, DocumentsConflict, type DocumentsHost, DocumentsProvider, type DocumentsStore, type DocumentsWords, DocumentsWordsProvider, ENGLISH_WORDS, type StoredDocument, ZH_HANS_WORDS, documentsApp };
244
+ export { DocumentEditor, type DocumentSummary, Documents, DocumentsConflict, type DocumentsHost, DocumentsProvider, type DocumentsStore, type DocumentsWords, DocumentsWordsProvider, ENGLISH_WORDS, PdfOptions, type StoredDocument, ZH_HANS_WORDS, documentsApp, docxToPdf };
@@ -1 +1 @@
1
- import{DocumentsConflict as t,DocumentsProvider as e,DocumentsWordsProvider as o,ENGLISH_WORDS as m,ZH_HANS_WORDS as n}from"../chunk-CED4ECIS.js";import{lazy as c}from"react";var p=c(()=>import("../Documents-XZ3AZVHI.js")),r=c(()=>import("../Documents-XZ3AZVHI.js").then(t=>({default:t.OpenDocument}))),s={"/documents":{component:p,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0}};export{r as DocumentEditor,p as Documents,t as DocumentsConflict,e as DocumentsProvider,o as DocumentsWordsProvider,m as ENGLISH_WORDS,n as ZH_HANS_WORDS,s as documentsApp};
1
+ import{DocumentsConflict as t,DocumentsProvider as o,DocumentsWordsProvider as n}from"../chunk-E4N3DBYM.js";import{ENGLISH_WORDS as e,ZH_HANS_WORDS as m}from"../chunk-AVUZSUQD.js";import{lazy as c}from"react";var r=c(()=>import("../Documents-HT324TAY.js")),s=c(()=>import("../Documents-HT324TAY.js").then(t=>({default:t.OpenDocument}))),p={"/documents":{component:r,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0}};async function u(t,o){const{docxToPdf:n}=await(import("../docxPdf-NCSEKI4J.js"));return n(t,o)}export{s as DocumentEditor,r as Documents,t as DocumentsConflict,o as DocumentsProvider,n as DocumentsWordsProvider,e as ENGLISH_WORDS,m as ZH_HANS_WORDS,p as documentsApp,u as docxToPdf};
@@ -0,0 +1 @@
1
+ import{boxesInWindow as t,pageWindows as e}from"./chunk-PWF37Y2N.js";import{drawJpeg as o,embeddedFonts as n,jpegPdf as i,openStage as r,settled as a}from"./chunk-JKYJGXJE.js";import{marginText as s,pageBlocks as p,pageStarts as c,pageStyles as l,printStyles as h,readDocx as d}from"./chunk-XKOHIZO5.js";import{ENGLISH_WORDS as f}from"./chunk-AVUZSUQD.js";import"./chunk-RHW2M2UY.js";var g="pdf",u=t=>t/20*(4/3);function m(t){const e=t.getBoundingClientRect().top;return Array.from(t.children,t=>{const o=t.getBoundingClientRect();return{top:o.top-e,height:o.height}})}function x(t,e,o,n,i){const r=document.createElement("div");r.style.cssText=`position:absolute;display:flex;justify-content:space-between;font:9pt Calibri,Carlito,Arial,sans-serif;color:#555;white-space:pre;left:${u(e.left)}px;right:${u(e.right)}px;${i}`;for(const e of s(t,o,n))r.append(Object.assign(document.createElement("span"),{textContent:e}));return r}function w(e,o,n,i){const{page:r,header:a,footer:s}=e.doc,p=document.createElement("div");p.style.cssText=`position:relative;overflow:hidden;background:#fff;width:${u(r.width)}px;height:${u(r.height)}px`;const c=document.createElement("div");return c.style.cssText=`position:absolute;overflow:hidden;left:${u(r.left)}px;top:${u(r.top)}px;right:${u(r.right)}px;height:${o.height}px`,c.append(function({body:e,boxes:o},n){const i=e.cloneNode(!1),r=t(o,n);if(!r)return i;for(let t=r.first;t<=r.last;t+=1)i.append(e.children[t].cloneNode(!0));const a=parseFloat(getComputedStyle(e.children[r.first]).marginTop)||0;return i.style.position="absolute",i.style.left="0",i.style.top=o[r.first].top-a-n.top+"px",i}(e,o)),p.append(c),a.text&&p.append(x(a.text,r,n,i,`top:${u(r.header)}px`)),s.text&&p.append(x(s.text,r,n,i,`bottom:${u(r.footer)}px`)),p}async function y(t,e,n,i,r){e.append(t);try{await a(t);return{jpeg:await o(t,{width:u(n.width),height:u(n.height),pixelRatio:2,quality:r,fontCss:i}),width:n.width/20,height:n.height/20}}finally{t.remove()}}async function b(t,o={}){const{signal:s,onProgress:x,quality:b}=o;s?.throwIfAborted();const $=await d(new Uint8Array(await t.arrayBuffer())),C=r();try{const t=function(t,e){const o=document.createElement("style");o.textContent=`${l(t,g)}\n${h(g)}`;const n=document.createElement("div");return n.className="docs-page",n.dataset.doc=g,n.style.cssText=`display:flow-root;width:${u(t.page.width-t.page.left-t.page.right)}px`,n.innerHTML=t.html,e.append(o,n),n}($,C.root);await a(t);const o={doc:$,body:t,boxes:m(t)},r=function(t,o){const n=u(t.page.height-t.page.top-t.page.bottom),i=c(p(o,o.getBoundingClientRect().top),n);return e(i,n,o.getBoundingClientRect().height)}($,t),d=await n(t),v=[];for(const[t,e]of r.entries()){s?.throwIfAborted();const n=w(o,e,t+1,r.length);v.push(await y(n,C.root,$.page,d,b).catch(e=>{throw new Error(f.pdfPageFailed(t+1),{cause:e})})),x?.(t+1,r.length)}return i(v)}finally{C.close()}}export{b as docxToPdf};
@@ -0,0 +1,10 @@
1
+ /** How any of the three apps makes a PDF. */
2
+ interface PdfOptions {
3
+ /** Called after each page. */
4
+ onProgress?: (done: number, total: number) => void;
5
+ signal?: AbortSignal;
6
+ /** JPEG quality of each page, 0..1. */
7
+ quality?: number;
8
+ }
9
+
10
+ export type { PdfOptions as P };
@@ -0,0 +1 @@
1
+ import{PptxPasswordError as t,PptxUnreadableError as e}from"./chunk-USKJW3BA.js";import{DECK_FONT as n,MIN_SIZE as r,NO_FILL as a,SLIDE_H as o,SLIDE_W as s,newId as i,newSlide as l}from"./chunk-2TZUCKZ7.js";import{ENGLISH_WORDS as c}from"./chunk-SB3YS3LH.js";import{child as p,childrenOf as f,descendants as u,openZip as d,parseXml as m,partText as h,readRels as y,readThemeFonts as g,resolveTarget as w}from"./chunk-RHW2M2UY.js";var x=2097152;function b(t){if(Array.isArray(t))return t.reduce((t,e)=>t+b(e)+2,t.length?0:2);if(t&&"object"==typeof t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.reduce((t,[e,n])=>t+b(e)+2+b(n)+2,e.length?0:2)}const e=JSON.stringify(t)??"null";return e.length+5*(e.match(/[^\x20-\x7e]/g)?.length??0)}var v=[208,207,17,224],M=Array.from("EncryptedPackage").flatMap(t=>[t.charCodeAt(0),0]),k=4194304;function P(t){for(let e=t.indexOf(M[0]);e>=0;e=t.indexOf(M[0],e+1))if(M.every((n,r)=>t[e+r]===n))return!0;return!1}var S={black:"000000",white:"ffffff",red:"ff0000",green:"008000",blue:"0000ff",yellow:"ffff00",gray:"808080",grey:"808080"},C={bg1:"lt1",tx1:"dk1",bg2:"lt2",tx2:"dk2"};function N(t){const e=t.children[0];return e?.attrs.lastClr??e?.attrs.val}function B(t,e){const n=new Map,r=p(p(t,"a:themeElements"),"a:clrScheme")?.children??[];for(const t of r){const e=N(t);e&&n.set(t.name.replace(/^a:/,""),e)}return{scheme:n,map:{...C,...e?.attrs}}}function A(t,e){const n=p(p(e,"p:clrMapOvr"),"a:overrideClrMapping");return n?{...t,map:{...t.map,...n.attrs}}:t}var I=t=>[0,2,4].map(e=>parseInt(t.slice(e,e+2),16)),F=t=>t.map(t=>{return(e=t,Math.max(0,Math.min(255,Math.round(e)))).toString(16).padStart(2,"0");var e}).join("");function T(t,e,n){const[r,a,o]=function([t,e,n]){const[r,a,o]=[t/255,e/255,n/255],s=Math.max(r,a,o),i=Math.min(r,a,o),l=(s+i)/2;if(s===i)return[0,0,l];const c=s-i;return[(s===r?(a-o)/c+(a<o?6:0):s===a?(o-r)/c+2:(r-a)/c+4)/6,l>.5?c/(2-s-i):c/(s+i),l]}(I(t));return F(function([t,e,n]){if(0===e)return[255*n,255*n,255*n];const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r,o=t=>{const e=(t+1)%1;return e<1/6?a+6*(r-a)*e:e<.5?r:e<2/3?a+(r-a)*(2/3-e)*6:a};return[o(t+1/3),o(t),o(t-1/3)].map(t=>255*t)}([r,a,Math.max(0,Math.min(1,o*e+n))]))}function $(t,e){const n=Number(e.attrs.val)/1e5;if(!Number.isFinite(n))return t;switch(e.name){case"a:lumMod":return T(t,n,0);case"a:lumOff":return T(t,1,n);case"a:tint":return F(I(t).map(t=>t+(255-t)*(1-n)));case"a:shade":return F(I(t).map(t=>t*n));default:return t}}function j(t,e){const n=e.scheme.get(e.map[t]??t);return n?`#${n.toLowerCase()}`:void 0}function z(t,e){const n=t&&function(t,e){switch(t.name){case"a:srgbClr":return t.attrs.val;case"a:sysClr":return t.attrs.lastClr;case"a:prstClr":return S[t.attrs.val];case"a:schemeClr":return e.scheme.get(e.map[t.attrs.val]??t.attrs.val);default:return}}(t,e);if(t&&n&&/^[0-9a-f]{6}$/i.test(n)&&"0"!==p(t,"a:alpha")?.attrs.val)return`#${t.children.reduce($,n).toLowerCase()}`}function R(t,e){return z(p(t,"a:solidFill")?.children[0],e)}var O=t=>"1"===t||"true"===t,L=t=>Math.round(100*t)/100+0,H=(t,e)=>L(12700*t*e.scale),E=t=>t*Math.PI/180;function D(t){const e=p(t,"a:off")?.attrs,n=p(t,"a:ext")?.attrs;if(t&&e&&n)return{x:Number(e.x)||0,y:Number(e.y)||0,w:Number(n.cx)||0,h:Number(n.cy)||0,rotation:(Number(t.attrs.rot)||0)/6e4}}function V(t){const e=p(p(t,"p:grpSpPr"),"a:xfrm"),n=D(e),r=p(e,"a:chOff")?.attrs,a=p(e,"a:chExt")?.attrs;if(n&&r&&a)return{box:n,childX:Number(r.x)||0,childY:Number(r.y)||0,scaleX:Number(a.cx)?n.w/Number(a.cx):1,scaleY:Number(a.cy)?n.h/Number(a.cy):1,flipH:O(e?.attrs.flipH),flipV:O(e?.attrs.flipV)}}function W(t,e){const{box:n}=e,r=n.x+n.w/2,a=n.y+n.h/2;let o=n.x+(t.x-e.childX)*e.scaleX,s=n.y+(t.y-e.childY)*e.scaleY;e.flipH&&(o=2*r-o),e.flipV&&(s=2*a-s);const i=E(n.rotation),l=o-r,c=s-a;return{x:r+l*Math.cos(i)-c*Math.sin(i),y:a+l*Math.sin(i)+c*Math.cos(i)}}function Y(t,e){const n=W({x:t.x+t.w/2,y:t.y+t.h/2},e),r=t.w*e.scaleX,a=t.h*e.scaleY,o=e.flipH!==e.flipV;return{x:n.x-r/2,y:n.y-a/2,w:r,h:a,rotation:(o?-t.rotation:t.rotation)+e.box.rotation}}var U=t=>L((t%360+360)%360);function X(t,e,n){const r=e.reduce(Y,t);return{id:i(),x:L(n.left+r.x*n.scale),y:L(n.top+r.y*n.scale),w:L(r.w*n.scale),h:L(r.h*n.scale),rotation:U(r.rotation)}}function G(t,e,n,a){const o=t.x+t.w/2,s=t.y+t.h/2,l=E(t.rotation),c=r=>{const i=r*(e.flipH?-1:1)*t.w/2,c=r*(e.flipV?-1:1)*t.h/2,p={x:o+i*Math.cos(l)-c*Math.sin(l),y:s+i*Math.sin(l)+c*Math.cos(l)},f=n.reduce(W,p);return{x:a.left+f.x*a.scale,y:a.top+f.y*a.scale}},p=c(-1),f=c(1),u=Math.hypot(f.x-p.x,f.y-p.y);return{id:i(),x:L((p.x+f.x-u)/2),y:L((p.y+f.y-r)/2),w:L(u),h:r,rotation:U(180*Math.atan2(f.y-p.y,f.x-p.x)/Math.PI)}}var q={scheme:new Map,map:{}},J=(t,e)=>[...t.rels.values()].find(t=>t.type.endsWith(e)),K=t=>p(p(t,"p:cSld"),"p:spTree");function Z(t,e){const n=h(t,e);if(n)return{part:e,root:m(n),rels:new Map(y(t,e).map(t=>[t.id,t]))}}function Q(t,e,n){const r=Z(t,e);if(!r)return;const a=J(r,"/slideMaster"),o=a&&w(e,a.target);return o&&!n.has(o)&&n.set(o,function(t,e){const n=Z(t,e);if(!n)return;const r=J(n,"/theme"),a=r?h(t,w(e,r.target)):void 0;return{...n,palette:B(a?m(a):void 0,p(n.root,"p:clrMap")),fonts:g(a)}}(t,o)),{...r,master:o?n.get(o):void 0}}var _={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp"};var tt=t=>p(p(p(t,"p:nvSpPr"),"p:nvPr"),"p:ph")??p(p(p(t,"p:nvPicPr"),"p:nvPr"),"p:ph"),et=t=>!!tt(t),nt=t=>(K(t.root)?.children??[]).filter(t=>"p:sp"===t.name&&tt(t)),rt=new Set(["title","ctrTitle"]),at=new Set(["dt","ftr","sldNum"]);function ot(t){return t&&rt.has(t)?"title":t&&at.has(t)?t:"body"}function st(t,e){const n=tt(t);if(!n)return{shapes:[],style:"p:otherStyle",isPlaceholder:!1};const r=e.layout&&function(t,e){const n=nt(t),{idx:r,type:a}=e.attrs;return(void 0!==r?n.find(t=>tt(t)?.attrs.idx===r):void 0)??(void 0!==a?n.find(t=>tt(t)?.attrs.type===a):void 0)}(e.layout,n),a=r?tt(r)??n:n,o=e.master&&function(t,e){const n=ot(e.attrs.type);return nt(t).find(t=>ot(tt(t)?.attrs.type)===n)}(e.master,a),s=ot(a.attrs.type);return{shapes:[r,o].filter(t=>!!t),style:"title"===s?"p:titleStyle":"body"===s?"p:bodyStyle":"p:otherStyle",isPlaceholder:!0}}function it(t,e,n,r){const a=t=>p(p(t,"p:txBody"),"a:lstStyle"),o=p(p(n.master?.root,"p:txStyles"),e.style),s=e.isPlaceholder?[o,r]:[r,o];return[a(t),...e.shapes.map(a),...s]}function lt(t,e,n){for(const r of[t,...e.shapes]){const t=p(p(r,"p:txBody"),"a:bodyPr")?.attrs[n];if(void 0!==t)return t}}var ct={l:"left",ctr:"center",r:"right"},pt=(t,e)=>t.lists.flatMap(t=>{const n=p(t,`a:lvl${e+1}pPr`);return n?[n]:[]});function ft(t,e){return"+mj-lt"===t?e.fonts.major:"+mn-lt"===t?e.fonts.minor:t}function ut(t,e,n,r){const a=[t,p(e,"a:defRPr"),...n.map(t=>p(t,"a:defRPr"))].filter(t=>!!t),o=t=>a.find(e=>void 0!==e.attrs[t])?.attrs[t],s=Number(o("sz")),i=o("b"),l=a.map(t=>R(t,r.palette)),c=a.map(t=>p(t,"a:latin")?.attrs.typeface).find(Boolean);return{sizePt:Number.isFinite(s)&&s>0?s/100:18,bold:"1"===i||"true"===i,colour:l.find(Boolean)??r.styleColour??j("tx1",r.palette)??"#000000",typeface:ft(c,r)??(r.isTitle?r.fonts.major:r.fonts.minor)}}function dt(t,e){for(const n of[t,...e]){if(p(n,"a:buNone"))return{kind:"none"};if(p(n,"a:buChar")||p(n,"a:buBlip"))return{kind:"bullet"};const t=p(n,"a:buAutoNum");if(t)return{kind:"number",startAt:Number(t.attrs.startAt)||1}}return{kind:"none"}}function mt(t,e){const n=[t,...e].map(t=>t?.attrs.algn).find(Boolean);return n&&ct[n]||"left"}function ht(t,e,n){const r=p(t,"a:pPr"),a=[];let o="";for(const s of t.children){if("a:br"===s.name&&(o+="\n"),"a:r"!==s.name&&"a:fld"!==s.name)continue;const t=p(s,"a:t")?.text??"";o+=t,t.trim()&&a.push({text:t,style:ut(p(s,"a:rPr"),r,e,n)})}return{text:o,runs:a}}var yt=(t,e)=>t.sizePt===e.sizePt&&t.bold===e.bold&&t.colour===e.colour;function gt(t,e){const n=[],r=[],a=function(){const t=[];return(e,n)=>"bullet"===e.kind?"• ":"none"===e.kind?(t.length=Math.min(t.length,n),""):(t.length=Math.min(t.length,n+1),t[n]=(t[n]??e.startAt-1)+1,`${t[n]}. `)}();let o;for(const s of f(t,"a:p")){const t=p(s,"a:pPr"),i=Number(t?.attrs.lvl)||0,l=pt(e,i),c=ht(s,l,e),f=dt(t,l),u=c.text.trim()?a(f,i):"";n.push(u?`${" ".repeat(i)}${u}${c.text}`:c.text),c.runs.length&&!o&&(o=mt(t,l)),r.push(...c.runs)}if(!r[0])return null;const s=function(t){const e=[];for(const n of t){const t=e.find(t=>yt(t.style,n.style));t?t.length+=n.text.length:e.push({style:n.style,length:n.text.length})}return e.reduce((t,e)=>e.length>t.length?e:t).style}(r),i=Number(p(p(t,"a:bodyPr"),"a:normAutofit")?.attrs.fontScale);return{text:n.join("\n").trimEnd(),sizePt:s.sizePt*(i>0?i/1e5:1),bold:s.bold,colour:s.colour,align:o??"left",mixed:r.some(t=>!yt(t.style,s)),typefaces:new Set(r.flatMap(t=>t.style.typeface?[t.style.typeface]:[]))}}function wt(t,e){const n=t.map(t=>t.map(e));return n.some(t=>t.some(Boolean))?n:void 0}var xt=t=>t.reduce((t,e)=>t+e,0);function bt(t,e,n,r){const o=D(p(t,"p:xfrm")),s=f(e,"a:tr");if(!o||!s.length)return void(n.tally.skipped+=1);const i=f(p(e,"a:tblGrid"),"a:gridCol").map(t=>Number(t.attrs.w)||0),l=s.map(t=>Number(t.attrs.h)||0),c=s.map(t=>f(t,"a:tc").map(t=>function(t,e){const n=p(t,"a:txBody"),r=gt(n,{palette:e.palette,fonts:e.master?.fonts??{},lists:[p(n,"a:lstStyle"),e.presentation.defaultTextStyle],isTitle:!1});for(const t of r?.typefaces??[])e.tally.typefaces.add(t);return{text:r?.text.replace(/\s*\n\s*/g," ")??"",block:r,fill:R(p(t,"a:tcPr"),e.palette)??null}}(t,n))),u=X({...o,w:xt(i)||o.w,h:xt(l)||o.h},r,n.frame),d=function(t){const e=new Map;for(const{block:n}of t)n&&e.set(n.sizePt,(e.get(n.sizePt)??0)+1);return[...e].sort((t,e)=>e[1]-t[1])[0]?.[0]}(c.flat()),m={...u,type:"table",rows:c.map(t=>t.map(t=>t.text)),headerFill:c[0].map(t=>t.fill).find(Boolean)??a,headerColor:c[0].map(t=>t.block?.colour).find(Boolean),fontSize:void 0===d?void 0:H(d,n.frame),columnWidths:xt(i)?i.map(t=>{return e=t,n=xt(i),Math.round(e/n*1e4)/1e4;var e,n}):void 0,rowHeights:xt(l)?l.map(t=>Math.round(t/xt(l)*u.h*100)/100):void 0,cellFills:wt(c,t=>t.fill),cellColors:wt(c,t=>t.block?.colour??null)};n.elements.push(m)}var vt={rect:"rect",ellipse:"ellipse",roundRect:"roundRect",diamond:"diamond",line:"line",straightConnector1:"line",flowChartProcess:"rect",flowChartAlternateProcess:"roundRect",flowChartDecision:"diamond",flowChartConnector:"ellipse"},Mt=new Set(["a:videoFile","a:audioFile","a:quickTimeFile","p14:media"]);function kt(t,e,n,r){const a=gt(p(t,"p:txBody"),function(t,e,n){const r=p(p(t,"p:style"),"a:fontRef")?.children[0];return{palette:n.palette,fonts:n.master?.fonts??{},lists:it(t,e,n,n.presentation.defaultTextStyle),isTitle:"p:titleStyle"===e.style,styleColour:z(r,n.palette)}}(t,n,r));if(!a)return;const{scale:o}=r.frame,s=(e,r)=>(Number(lt(t,n,e)??r)||0)*o,l=H(a.sizePt,r.frame),c=s("lIns",91440),f=s("tIns",45720),u=Math.max(e.w-c-s("rIns",91440),1),d=Math.max(e.h-f-s("bIns",45720),1),m=lt(t,n,"anchor"),h=Math.max(d-function(t,e,n){const r=Math.max(1,Math.floor(n/(.52*e)));return t.split("\n").reduce((t,e)=>t+Math.max(1,Math.ceil(e.length/r)),0)*e*1.25}(a.text,l,u),0),y="ctr"===m?h/2:"b"===m?h:0;r.elements.push({id:i(),type:"text",rotation:e.rotation,x:L(e.x+c),y:L(e.y+f+y),w:L(u),h:L(d-y),text:a.text,fontSize:l,bold:a.bold,color:a.colour,align:a.align});for(const t of a.typefaces)r.tally.typefaces.add(t);a.mixed&&(r.tally.mixedTextSimplified+=1)}function Pt(t,e){const n=p(t,"p:spPr");if(p(n,"a:noFill"))return{kind:"none"};if(p(n,"a:solidFill")){const t=R(n,e.palette);return t?{kind:"colour",colour:t}:{kind:"none"}}if(["a:gradFill","a:blipFill","a:pattFill","a:grpFill"].some(t=>p(n,t))){const t=function(t,e){const n=p(p(p(t,"a:gradFill"),"a:gsLst"),"a:gs")?.children[0],r=p(p(t,"a:pattFill"),"a:fgClr")?.children[0];return z(n??r,e.palette)}(n,e);return t?{kind:"colour",colour:t}:{kind:"undrawable"}}const r=p(p(t,"p:style"),"a:fillRef"),a=r&&"0"!==r.attrs.idx?z(r.children[0],e.palette):void 0;return a?{kind:"colour",colour:a}:{kind:"none"}}function St(t,e){const n=p(p(t,"p:spPr"),"a:ln");if(p(n,"a:noFill"))return;const r=p(p(t,"p:style"),"a:lnRef"),a=R(n,e.palette)??(r&&"0"!==r.attrs.idx?z(r.children[0],e.palette):void 0);return a?{stroke:a,strokeWidth:L((Number(n?.attrs.w)||9525)*e.frame.scale)}:void 0}function Ct(t,e){const n=p(p(p(t,"a:prstGeom"),"a:avLst"),"a:gd")?.attrs.fmla,r=Number(n?.replace("val ",""));return L((Number.isFinite(r)?r:16667)/1e5*Math.min(e.w,e.h))}var Nt=t=>!!t?.attrs.type&&"none"!==t.attrs.type;function Bt(t,e,n){const r=p(t,"p:spPr"),o=p(r,"a:xfrm"),s=D(o);if(!s)return void(e.tally.skipped+=1);const i=St(t,e);if(!i)return;const l=p(r,"a:ln");e.elements.push({...G(s,{flipH:O(o?.attrs.flipH),flipV:O(o?.attrs.flipV)},n,e.frame),type:"shape",shape:"line",fill:a,...i,...Nt(p(l,"a:tailEnd"))?{arrowEnd:!0}:{},...Nt(p(l,"a:headEnd"))?{arrowStart:!0}:{}})}function At(t,e,n){const r=st(t,e),o=p(t,"p:spPr"),s=function(t){return vt[p(t,"a:prstGeom")?.attrs.prst??"rect"]??"rect"}(o);if("line"===s)return void Bt(t,e,n);const i=D(p(o,"a:xfrm"))??r.shapes.map(t=>D(p(p(t,"p:spPr"),"a:xfrm"))).find(Boolean);if(!i)return void(p(t,"p:txBody")&&u(t,new Set(["a:t"])).length&&(e.tally.skipped+=1));const l=X(i,n,e.frame),c=Pt(t,e),f=St(t,e),d="colour"===c.kind||!!f;d&&function(t,e,n,r,o,s){s.elements.push({...t,type:"shape",shape:e,fill:"colour"===n.kind?n.colour:a,...r,..."roundRect"===e?{radius:Ct(o,t)}:{}})}(l,s,c,f,o,e),kt(t,l,r,e),"undrawable"!==c.kind||d||(e.tally.skipped+=1)}function It(t,e){const n=e.rels.get(t?.attrs["r:embed"]??"");return n&&!n.external?w(e.part,n.target):void 0}function Ft(t,e,n){const r=p(t,"p:nvPicPr"),a=st(t,e),o=D(p(p(t,"p:spPr"),"a:xfrm"))??a.shapes.map(t=>D(p(p(t,"p:spPr"),"a:xfrm"))).find(Boolean),s=p(t,"p:blipFill"),i=It(p(s,"a:blip"),e.slide),l=i&&!u(t,Mt).length?e.useImage(i,function(t){const e=e=>(Number(t?.attrs[e])||0)/1e5,n={left:e("l"),top:e("t"),right:e("r"),bottom:e("b")},r=Object.values(n);if(!r.every(t=>0===t)&&!r.some(t=>t<0))return n.left+n.right<1&&n.top+n.bottom<1?n:void 0}(p(s,"a:srcRect"))):void 0;o&&l?e.elements.push({...X(o,n,e.frame),type:"image",src:l,alt:p(r,"p:cNvPr")?.attrs.descr??""}):e.tally.skipped+=1}function Tt(t,e,n){const r=p(p(p(t,"a:graphic"),"a:graphicData"),"a:tbl");r?bt(t,r,e,n):e.tally.skipped+=1}function $t(t,e,n=[]){for(const r of t)switch(r.name){case"p:sp":At(r,e,n);break;case"p:pic":Ft(r,e,n);break;case"p:graphicFrame":Tt(r,e,n);break;case"p:cxnSp":Bt(r,e,n);break;case"p:contentPart":e.tally.skipped+=1;break;case"p:grpSp":{const t=V(r);$t(r.children,e,t?[t,...n]:n);break}case"mc:AlternateContent":$t(p(r,"mc:Fallback")?.children??[],e,n)}}function jt(t){const e=function(t){const e=h(t,"[Content_Types].xml"),n=e?m(e):void 0,r=new Map(f(n,"Override").map(t=>[t.attrs.PartName,t.attrs.ContentType])),a=new Map(f(n,"Default").map(t=>[t.attrs.Extension?.toLowerCase(),t.attrs.ContentType]));return t=>{const e=t.slice(t.lastIndexOf(".")+1).toLowerCase();return r.get(`/${t}`)??a.get(e)??_[e]??"application/octet-stream"}}(t),n=new Map;return{use:(t,r)=>{const a=e(t);if(!a.startsWith("image/"))return;const o=`${t}${function(t){return t?`#${t.left},${t.top},${t.right},${t.bottom}`:""}(r)}`;return n.has(o)||n.set(o,{key:o,part:t,contentType:a,crop:r}),o},uses:n}}function zt(t){return t.children.map(t=>"a:br"===t.name?"\n":"a:r"===t.name||"a:fld"===t.name?p(t,"a:t")?.text??"":"").join("")}function Rt(t,e){const n=J(e,"/notesSlide"),r=n&&Z(t,w(e.part,n.target)),a=((r&&K(r.root)?.children)??[]).find(t=>"body"===p(p(p(t,"p:nvSpPr"),"p:nvPr"),"p:ph")?.attrs.type);return f(p(a,"p:txBody"),"a:p").map(zt).join("\n").trim()}function Ot(t,e){const n=p(p(t.root,"p:cSld"),"p:bg");if(!n)return;const r=p(n,"p:bgPr"),a=R(r,e.palette)??z(p(n,"p:bgRef")?.children[0],e.palette);if(a)return{colour:a};const o=It(p(p(r,"a:blipFill"),"a:blip"),t);return o?{picture:o}:void 0}var Lt=t=>"0"===t.root.attrs.showMasterSp||"false"===t.root.attrs.showMasterSp;function Ht(t,e){const n=function(t){for(const e of[t.slide,t.layout,t.master]){const n=e&&Ot(e,t);if(n)return n}return{}}(t);return n.picture&&function(t,e){const n=e.useImage(t,void 0);if(!n)return void(e.tally.skipped+=1);const{left:r,top:a,width:o,height:s}=e.frame;e.elements.push({id:i(),type:"image",x:r,y:a,w:o,h:s,rotation:0,src:n,alt:""})}(n.picture,t),function(t){const{layout:e,master:n,slide:r}=t;if(!Lt(r))for(const r of[e&&Lt(e)?void 0:n,e]){const e=r?K(r.root)?.children??[]:[];r&&$t(e.filter(t=>!et(t)),{...t,slide:r})}}(t),$t(K(t.slide.root)?.children??[],t),{id:i(),background:n.colour??"#ffffff",notes:Rt(e,t.slide),elements:(r=t.elements,a=t.tally,a.skipped+=Math.max(r.length-200,0),r.slice(0,200))};var r,a}var Et=t=>"0"===t.root.attrs.show||"false"===t.root.attrs.show;function Dt(t){const n=function(t){const n=y(t,"").find(t=>t.type.endsWith("/officeDocument")),r=Z(t,n?w("",n.target):"ppt/presentation.xml");if(!r||"p:presentation"!==r.root.name)throw new e;const a=f(p(r.root,"p:sldIdLst"),"p:sldId").flatMap(t=>{const e=r.rels.get(t.attrs["r:id"]);return e?[w(r.part,e.target)]:[]}),o=p(r.root,"p:sldSz")?.attrs;return{width:Number(o?.cx)||9144e3,height:Number(o?.cy)||5143500,slides:a,defaultTextStyle:p(r.root,"p:defaultTextStyle")}}(t),r=function(t){const e=new Map,n=new Map;return r=>{const a=J(r,"/slideLayout"),o=a&&w(r.part,a.target);o&&!n.has(o)&&n.set(o,Q(t,o,e));const s=o?n.get(o):void 0,i=s?.master,l=i?.palette??q;return{slide:r,layout:s,master:i,palette:A(s?A(l,s.root):l,r.root)}}}(t),a=jt(t),i=function(t,e){const n=Math.min(s/t,o/e);return{scale:n,left:(s-t*n)/2,top:(o-e*n)/2,width:t*n,height:e*n}}(n.width,n.height),c={skipped:0,mixedTextSimplified:0,typefaces:new Set},u=[];let d=0;for(const e of n.slides){const o=Z(t,e);o&&!Et(o)&&(p(o.root,"p:timing")&&(d+=1),u.push(Ht({...r(o),presentation:n,frame:i,tally:c,elements:[],useImage:a.use},t)))}const m=new Set(u.flatMap(t=>t.elements.flatMap(t=>"image"===t.type?[t.src]:[])));return{document:{slides:u.length?u:[l()]},slideCount:u.length,images:[...a.uses.values()].filter(t=>m.has(t.key)),animationsDropped:d,tally:c}}var Vt=.15,Wt=1048576,Yt=/\.(xml|rels)$/i;async function Ut(n,r){if(await async function(t){const e=new Uint8Array(await t.slice(0,v.length).arrayBuffer());return v.every((t,n)=>e[n]===t)}(n))throw await async function(t,e){for(let n=0;n<t.size;n+=k-M.length)if(e?.throwIfAborted(),P(new Uint8Array(await t.slice(n,n+k).arrayBuffer())))return!0;return!1}(n,r)?new t:new e(c.pptxLegacyFormat)}function Xt(t){if(t.slides.length>300)throw new e(c.pptxTooManySlides(t.slides.length,300));const n=b(t);if(n>x)throw new e(c.pptxTooLarge((n/Wt).toFixed(1),2))}var Gt={"image/webp":"webp","image/png":"png","image/jpeg":"jpg","image/gif":"gif"};async function qt(t,e,n){try{return await(n.prepareImage?n.prepareImage(e,t.contentType):async function(t,e,n){const r=await createImageBitmap(new Blob([t],{type:e}));try{const t=r.width*(n?.left??0),e=r.height*(n?.top??0),a=r.width-t-r.width*(n?.right??0),o=r.height-e-r.height*(n?.bottom??0),s=Math.min(1,1920/Math.max(a,o)),i=new OffscreenCanvas(Math.max(1,Math.round(a*s)),Math.max(1,Math.round(o*s))),l=i.getContext("2d");if(!l)throw new Error("No drawing context");return l.imageSmoothingQuality="high",l.drawImage(r,t,e,a,o,0,0,i.width,i.height),await i.convertToBlob({type:"image/webp",quality:.85})}finally{r.close()}}(e,t.contentType,t.crop))}catch(e){return n.signal?.throwIfAborted(),console.warn("A picture in the deck could not be read",t.part,e),null}}async function Jt(t,e,n){const r={addresses:new Map,count:0,bytesBefore:0,bytesAfter:0},a=function(t,e){const n=new Map;for(const r of t){const t=e.prepareImage?r.part:r.key;n.set(t,[...n.get(t)??[],r])}return[...n.values()]}(t,n),o=new Map;let s=0;return await async function(t,e,n){let r=0,a=!1;await Promise.all(Array.from({length:Math.min(e,t.length)},async()=>{for(;!a&&r<t.length;){const e=t[r];r+=1;try{await n(e)}catch(t){throw a=!0,t}}}))}(a,4,async t=>{n.signal?.throwIfAborted();const[i]=t,l=o.get(i.part)??0;o.set(i.part,l+1);const c=await e.read(i.part).catch(()=>null),p=c&&await qt(i,c,n);if(c&&p){n.signal?.throwIfAborted();const e=await n.storeImage(p,function(t,e,n){return`${t.slice(t.lastIndexOf("/")+1).replace(/\.[^.]*$/,"")}${n?`-${n}`:""}.${Gt[e.type]??"img"}`}(i.part,p,l));for(const{key:n}of t)r.addresses.set(n,e);r.count+=1,r.bytesBefore+=c.length,r.bytesAfter+=p.size}s+=1,n.onProgress?.(Vt+.85*s/a.length)}),r}async function Kt(t,r){r.signal?.throwIfAborted(),await Ut(t,r.signal);const a=await async function(t){try{return await d(t)}catch{throw new e}}(t),o=await async function(t,e){const n=new Map,r=t.names.filter(t=>Yt.test(t));for(const[a,o]of r.entries())e.signal?.throwIfAborted(),n.set(o,await t.read(o)),e.onProgress?.(Vt*(a+1)/r.length);return n}(a,r).catch(t=>{throw r.signal?.throwIfAborted(),t instanceof e?t:new e}),s=function(t){try{return Dt(t)}catch(t){if(t instanceof e)throw t;throw new e}}(o);Xt(s.document);const i=await Jt(s.images,a,r),l=function(t,e,n){const r=t=>{if("image"!==t.type)return[t];const r=e.get(t.src);return void 0===r&&(n.skipped+=1),void 0===r?[]:[{...t,src:r}]};return{slides:t.slides.map(t=>({...t,elements:t.elements.flatMap(r)}))}}(s.document,i.addresses,s.tally);return Xt(l),r.onProgress?.(1),{document:l,notes:{slides:s.slideCount,images:i.count,imageBytesBefore:i.bytesBefore,imageBytesAfter:i.bytesAfter,fontsReplaced:[...s.tally.typefaces].filter(t=>t!==n).sort(),animationsDropped:s.animationsDropped,mixedTextSimplified:s.tally.mixedTextSimplified,skipped:s.tally.skipped}}}export{Kt as importPptx};