officeparser 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/OfficeConverter.d.ts +1 -1
- package/dist/OfficeParser.d.ts +1 -1
- package/dist/OfficeParser.js +3 -0
- package/dist/generators/RtfGenerator.js +36 -17
- package/dist/officeparser.browser.d.ts +3 -3
- package/dist/officeparser.browser.iife.js +11 -7
- package/dist/officeparser.browser.mjs +11 -7
- package/dist/sbom.cdx.json +99 -99
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -606,7 +606,7 @@ Pass as the second argument to `parseOffice(file, config)`.
|
|
|
606
606
|
| `preserveXmlWhitespace` | `boolean` | `false` | Preserve original XML whitespace during serialization |
|
|
607
607
|
| `includeBreakNodes` | `boolean` | `false` | Include `w:br` / `w:cr` as typed break nodes (DOCX only) |
|
|
608
608
|
| `ignoreInternalLinks` | `boolean` | `false` | Strip bookmarks and internal cross-references from AST |
|
|
609
|
-
| `fileType` | `SupportedFileType \| null` | `null` | **Required for text-based
|
|
609
|
+
| `fileType` | `SupportedFileType \| null` | `null` | **Required for text-based binary data** (`'md'`, `'html'`, `'csv'`) as these lack magic bytes. |
|
|
610
610
|
| `csvDelimiter` | `string` | `','` | Input delimiter when parsing CSV files |
|
|
611
611
|
| `pdfWorkerSrc` | `string` | CDN (jsDelivr) | Path/URL to `pdf.worker.min.mjs` (required in browser) |
|
|
612
612
|
| `onWarning` | `(issue: OfficeIssue) => void` | — | Callback for non-fatal parsing issues |
|
|
@@ -42,6 +42,6 @@ export declare class OfficeConverter {
|
|
|
42
42
|
* });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
static convert<F extends string | Buffer | ArrayBuffer, T extends SupportedFileType = InferFileTypeFromPath<F>>(file: F, destination: SupportedDestination<T>, config?: OfficeConverterConfig<SupportedDestination<T>, T>): Promise<ConversionResult<SupportedDestination<T>>>;
|
|
45
|
+
static convert<F extends string | Buffer | ArrayBuffer | Uint8Array, T extends SupportedFileType = InferFileTypeFromPath<F>>(file: F, destination: SupportedDestination<T>, config?: OfficeConverterConfig<SupportedDestination<T>, T>): Promise<ConversionResult<SupportedDestination<T>>>;
|
|
46
46
|
}
|
|
47
47
|
export {};
|
package/dist/OfficeParser.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export declare class OfficeParser {
|
|
|
91
91
|
* const text = ast.toText();
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
static parseOffice(file: string | Buffer | ArrayBuffer, configOrCallback?: OfficeParserConfig | ((ast: OfficeParserAST, err?: any) => void), config?: OfficeParserConfig): Promise<OfficeParserAST>;
|
|
94
|
+
static parseOffice(file: string | Buffer | ArrayBuffer | Uint8Array, configOrCallback?: OfficeParserConfig | ((ast: OfficeParserAST, err?: any) => void), config?: OfficeParserConfig): Promise<OfficeParserAST>;
|
|
95
95
|
/**
|
|
96
96
|
* Terminates all active OCR workers and cleans up resources.
|
|
97
97
|
*
|
package/dist/OfficeParser.js
CHANGED
|
@@ -136,6 +136,9 @@ class OfficeParser {
|
|
|
136
136
|
if (file instanceof ArrayBuffer) {
|
|
137
137
|
buffer = Buffer.from(file);
|
|
138
138
|
}
|
|
139
|
+
else if (file instanceof Uint8Array) {
|
|
140
|
+
buffer = Buffer.from(file.buffer, file.byteOffset, file.byteLength);
|
|
141
|
+
}
|
|
139
142
|
else if (Buffer.isBuffer(file)) {
|
|
140
143
|
buffer = file;
|
|
141
144
|
}
|
|
@@ -13,7 +13,7 @@ class RtfGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
13
13
|
}
|
|
14
14
|
async generate() {
|
|
15
15
|
this.colorTable = [];
|
|
16
|
-
// We first process all nodes to collect colors
|
|
16
|
+
// We first process all nodes to collect colors and analyze structure
|
|
17
17
|
const bodyContent = await this.renderBody(this.ast);
|
|
18
18
|
let output = '{\\rtf1\\ansi\\deff0\n';
|
|
19
19
|
// 1. Info Group (Metadata)
|
|
@@ -61,7 +61,6 @@ class RtfGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
61
61
|
let body = '';
|
|
62
62
|
this.inTable = false;
|
|
63
63
|
const processor = async (node, childrenOutput) => {
|
|
64
|
-
// Handle Semantic Style Mapping for RTF using the semantic mapping helper
|
|
65
64
|
const mapping = this.getSemanticMapping(node);
|
|
66
65
|
if (mapping) {
|
|
67
66
|
if (mapping.tag === 'blockquote') {
|
|
@@ -112,7 +111,7 @@ class RtfGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
112
111
|
const pt = parseInt(f.size);
|
|
113
112
|
prefix += `\\fs${pt * 2} `;
|
|
114
113
|
}
|
|
115
|
-
text = `{\\
|
|
114
|
+
text = `{\\f0 ${prefix}${text}${suffix}}`;
|
|
116
115
|
}
|
|
117
116
|
if (meta?.link) {
|
|
118
117
|
const isInternal = meta.linkType !== 'external';
|
|
@@ -142,25 +141,16 @@ class RtfGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
142
141
|
else if (meta.alignment === 'justify')
|
|
143
142
|
pPr += '\\qj';
|
|
144
143
|
}
|
|
145
|
-
if (meta.paragraphIndentation) {
|
|
146
|
-
const ind = meta.paragraphIndentation;
|
|
147
|
-
if (ind.left)
|
|
148
|
-
pPr += `\\li${ind.left}`;
|
|
149
|
-
if (ind.right)
|
|
150
|
-
pPr += `\\ri${ind.right}`;
|
|
151
|
-
if (ind.firstLine)
|
|
152
|
-
pPr += `\\fi${ind.firstLine}`;
|
|
153
|
-
}
|
|
154
144
|
}
|
|
155
145
|
return `${pPr} ${childrenOutput}\\par\n`;
|
|
156
146
|
}
|
|
157
147
|
case 'list': {
|
|
158
148
|
const meta = node.metadata;
|
|
159
|
-
const
|
|
149
|
+
const level = meta?.indentation || 0;
|
|
150
|
+
const indent = (level + 1) * 360;
|
|
160
151
|
const isOrdered = meta?.listType === 'ordered';
|
|
161
152
|
const marker = isOrdered ? `${(meta.itemIndex ?? 0) + 1}. ` : '\\bullet ';
|
|
162
153
|
const listControl = isOrdered ? '\\pndec' : '\\pnbullet';
|
|
163
|
-
const level = meta?.indentation || 0;
|
|
164
154
|
const pPr = this.inTable ? '\\pard\\intbl' : '\\pard';
|
|
165
155
|
return `${pPr}\\li${indent}\\fi-360\\ilvl${level}${listControl} ${marker}${childrenOutput}\\par\n`;
|
|
166
156
|
}
|
|
@@ -168,11 +158,40 @@ class RtfGenerator extends BaseGenerator_js_1.BaseGenerator {
|
|
|
168
158
|
return `\\pard\\sa0\n${childrenOutput}`;
|
|
169
159
|
}
|
|
170
160
|
case 'row': {
|
|
171
|
-
|
|
161
|
+
const cells = node.children || [];
|
|
162
|
+
const pageWidth = 9000; // Standard twips width
|
|
163
|
+
const cellWidth = Math.floor(pageWidth / (cells.length || 1));
|
|
164
|
+
let cellDefs = '';
|
|
165
|
+
for (let i = 0; i < cells.length; i++) {
|
|
166
|
+
// Add basic cell borders and calculate width
|
|
167
|
+
cellDefs += `\\clbrdrt\\brdrs\\brdrw10\\clbrdrl\\brdrs\\brdrw10\\clbrdrb\\brdrs\\brdrw10\\clbrdrr\\brdrs\\brdrw10\\cellx${(i + 1) * cellWidth}`;
|
|
168
|
+
}
|
|
169
|
+
return `\\trowd\\trgaph108\\trleft-108${cellDefs}\n${childrenOutput}\\row\n`;
|
|
172
170
|
}
|
|
173
171
|
case 'cell': {
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
return `\\pard\\intbl\\sb60\\sa60 ${childrenOutput}\\cell\n`;
|
|
173
|
+
}
|
|
174
|
+
case 'image': {
|
|
175
|
+
if (!this.config.includeImages)
|
|
176
|
+
return '';
|
|
177
|
+
const meta = node.metadata;
|
|
178
|
+
const attachmentName = meta?.attachmentName;
|
|
179
|
+
const attachment = this.ast.attachments.find(a => a.name === attachmentName);
|
|
180
|
+
if (attachment && attachment.data) {
|
|
181
|
+
const type = attachment.extension === 'png' ? 'pngblip' : 'jpegblip';
|
|
182
|
+
// Convert base64 to hex
|
|
183
|
+
const binary = atob(attachment.data);
|
|
184
|
+
let hex = '';
|
|
185
|
+
for (let i = 0; i < binary.length; i++) {
|
|
186
|
+
const h = binary.charCodeAt(i).toString(16);
|
|
187
|
+
hex += h.length === 1 ? '0' + h : h;
|
|
188
|
+
if (i % 64 === 63)
|
|
189
|
+
hex += '\n'; // Add newlines for better RTF readability
|
|
190
|
+
}
|
|
191
|
+
// Default goals (approx 3 inches wide at 1440 twips per inch)
|
|
192
|
+
return `{\\pict\\${type}\\picwgoal4320\\pichgoal3240\n${hex}\n}\n`;
|
|
193
|
+
}
|
|
194
|
+
return '';
|
|
176
195
|
}
|
|
177
196
|
case 'break': {
|
|
178
197
|
return node.metadata?.breakType === 'page' ? '\\page\n' : '\\line\n';
|
|
@@ -17,7 +17,7 @@ export declare enum OfficeErrorType {
|
|
|
17
17
|
IMPROPER_ARGUMENTS = "IMPROPER_ARGUMENTS",
|
|
18
18
|
/** Error occurred while reading or processing file buffers */
|
|
19
19
|
IMPROPER_BUFFERS = "IMPROPER_BUFFERS",
|
|
20
|
-
/** Input type is not a supported type (string, Buffer, ArrayBuffer) */
|
|
20
|
+
/** Input type is not a supported type (string, Buffer, ArrayBuffer, Uint8Array) */
|
|
21
21
|
INVALID_INPUT = "INVALID_INPUT",
|
|
22
22
|
/** PDF worker source is missing (required in browser) */
|
|
23
23
|
PDF_WORKER_MISSING = "PDF_WORKER_MISSING",
|
|
@@ -1546,7 +1546,7 @@ export declare class OfficeParser {
|
|
|
1546
1546
|
* const text = ast.toText();
|
|
1547
1547
|
* ```
|
|
1548
1548
|
*/
|
|
1549
|
-
static parseOffice(file: string | Buffer | ArrayBuffer, configOrCallback?: OfficeParserConfig | ((ast: OfficeParserAST, err?: any) => void), config?: OfficeParserConfig): Promise<OfficeParserAST>;
|
|
1549
|
+
static parseOffice(file: string | Buffer | ArrayBuffer | Uint8Array, configOrCallback?: OfficeParserConfig | ((ast: OfficeParserAST, err?: any) => void), config?: OfficeParserConfig): Promise<OfficeParserAST>;
|
|
1550
1550
|
/**
|
|
1551
1551
|
* Terminates all active OCR workers and cleans up resources.
|
|
1552
1552
|
*
|
|
@@ -1618,7 +1618,7 @@ export declare class OfficeConverter {
|
|
|
1618
1618
|
* });
|
|
1619
1619
|
* ```
|
|
1620
1620
|
*/
|
|
1621
|
-
static convert<F extends string | Buffer | ArrayBuffer, T extends SupportedFileType = InferFileTypeFromPath<F>>(file: F, destination: SupportedDestination<T>, config?: OfficeConverterConfig<SupportedDestination<T>, T>): Promise<ConversionResult<SupportedDestination<T>>>;
|
|
1621
|
+
static convert<F extends string | Buffer | ArrayBuffer | Uint8Array, T extends SupportedFileType = InferFileTypeFromPath<F>>(file: F, destination: SupportedDestination<T>, config?: OfficeConverterConfig<SupportedDestination<T>, T>): Promise<ConversionResult<SupportedDestination<T>>>;
|
|
1622
1622
|
}
|
|
1623
1623
|
export declare const parseOffice: typeof OfficeParser.parseOffice;
|
|
1624
1624
|
export declare const terminateOcr: typeof OfficeParser.terminateOcr;
|
|
@@ -704,14 +704,18 @@ ${i} </tr>
|
|
|
704
704
|
`}return n+=`\\f0\\fs24
|
|
705
705
|
`,n+=e,n+="}",{value:n,messages:this.messages}}async processNodeRecursive(e,n){let i=this.inTable;e.type==="table"&&(this.inTable=!0);let s=await super.processNodeRecursive(e,n);return this.inTable=i,s}async renderBody(e){let n="";this.inTable=!1;let i=async(s,a)=>{let l=this.getSemanticMapping(s);if(l){if(l.tag==="blockquote")return`${this.inTable?"\\pard\\intbl":"\\pard"}\\li720\\ri720\\sa120 ${a}\\par
|
|
706
706
|
`;let c=l.tag.match(/^h([1-6])$/);if(c){let u=parseInt(c[1]),h=24+(6-u)*4;return`${this.inTable?"\\pard\\intbl":"\\pard"}\\s${u}\\sb240\\sa120{\\b\\fs${h} ${a}}\\par
|
|
707
|
-
`}}switch(s.type){case"text":{let c=this.escapeRtf(s.text||""),u=s.formatting,h=s.metadata;if(this.config.includeFormatting&&u){let d="",f="";if(u.bold&&(d+="\\b ",f="\\b0 "+f),u.italic&&(d+="\\i ",f="\\i0 "+f),u.underline&&(d+="\\ul ",f="\\ul0 "+f),u.strikethrough&&(d+="\\strike ",f="\\strike0 "+f),u.color){let p=this.getColorIndex(u.color);d+=`\\cf${p+1} `}if(u.backgroundColor){let p=this.getColorIndex(u.backgroundColor);d+=`\\highlight${p+1} `}if(u.size){let p=parseInt(u.size);d+=`\\fs${p*2} `}c=`{\\
|
|
708
|
-
`}case"paragraph":{let c=this.inTable?"\\pard\\intbl":"\\pard";if(c+="\\sa120",this.config.includeFormatting&&s.metadata){let u=s.metadata;
|
|
709
|
-
`}case"list":{let c=s.metadata,u=
|
|
707
|
+
`}}switch(s.type){case"text":{let c=this.escapeRtf(s.text||""),u=s.formatting,h=s.metadata;if(this.config.includeFormatting&&u){let d="",f="";if(u.bold&&(d+="\\b ",f="\\b0 "+f),u.italic&&(d+="\\i ",f="\\i0 "+f),u.underline&&(d+="\\ul ",f="\\ul0 "+f),u.strikethrough&&(d+="\\strike ",f="\\strike0 "+f),u.color){let p=this.getColorIndex(u.color);d+=`\\cf${p+1} `}if(u.backgroundColor){let p=this.getColorIndex(u.backgroundColor);d+=`\\highlight${p+1} `}if(u.size){let p=parseInt(u.size);d+=`\\fs${p*2} `}c=`{\\f0 ${d}${c}${f}}`}if(h?.link){let d=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!d)return`{\\field{\\*\\fldinst{HYPERLINK "${h.link}"}}{\\fldrslt ${c}}}`}return c}case"heading":{let u=s.metadata?.level||1,h=24+(6-u)*4;return`${this.inTable?"\\pard\\intbl":"\\pard"}\\s${u}\\sb240\\sa120{\\b\\fs${h} ${a}}\\par
|
|
708
|
+
`}case"paragraph":{let c=this.inTable?"\\pard\\intbl":"\\pard";if(c+="\\sa120",this.config.includeFormatting&&s.metadata){let u=s.metadata;u.alignment&&(u.alignment==="center"?c+="\\qc":u.alignment==="right"?c+="\\qr":u.alignment==="justify"&&(c+="\\qj"))}return`${c} ${a}\\par
|
|
709
|
+
`}case"list":{let c=s.metadata,u=c?.indentation||0,h=(u+1)*360,d=c?.listType==="ordered",f=d?`${(c.itemIndex??0)+1}. `:"\\bullet ",p=d?"\\pndec":"\\pnbullet";return`${this.inTable?"\\pard\\intbl":"\\pard"}\\li${h}\\fi-360\\ilvl${u}${p} ${f}${a}\\par
|
|
710
710
|
`}case"table":return`\\pard\\sa0
|
|
711
|
-
${a}`;case"row":return`\\trowd\\trgaph108\\trleft-108
|
|
711
|
+
${a}`;case"row":{let c=s.children||[],h=Math.floor(9e3/(c.length||1)),d="";for(let f=0;f<c.length;f++)d+=`\\clbrdrt\\brdrs\\brdrw10\\clbrdrl\\brdrs\\brdrw10\\clbrdrb\\brdrs\\brdrw10\\clbrdrr\\brdrs\\brdrw10\\cellx${(f+1)*h}`;return`\\trowd\\trgaph108\\trleft-108${d}
|
|
712
712
|
${a}\\row
|
|
713
|
-
|
|
714
|
-
`;case"
|
|
713
|
+
`}case"cell":return`\\pard\\intbl\\sb60\\sa60 ${a}\\cell
|
|
714
|
+
`;case"image":{if(!this.config.includeImages)return"";let u=s.metadata?.attachmentName,h=this.ast.attachments.find(d=>d.name===u);if(h&&h.data){let d=h.extension==="png"?"pngblip":"jpegblip",f=atob(h.data),p="";for(let m=0;m<f.length;m++){let y=f.charCodeAt(m).toString(16);p+=y.length===1?"0"+y:y,m%64===63&&(p+=`
|
|
715
|
+
`)}return`{\\pict\\${d}\\picwgoal4320\\pichgoal3240
|
|
716
|
+
${p}
|
|
717
|
+
}
|
|
718
|
+
`}return""}case"break":return s.metadata?.breakType==="page"?`\\page
|
|
715
719
|
`:`\\line
|
|
716
720
|
`;default:return a}};for(let s of e.content)n+=await this.processNodeRecursive(s,i);return n}getColorIndex(e){let n=e.toUpperCase(),i=this.colorTable.indexOf(n);return i===-1&&(i=this.colorTable.length,this.colorTable.push(n)),i}escapeRtf(e){return e.replace(/\\/g,"\\\\").replace(/{/g,"\\{").replace(/}/g,"\\}").replace(/[^\x00-\x7F]/g,n=>`\\u${n.charCodeAt(0)}?`)}};B();var _g=class extends qn{constructor(t,e){super("text",t,e)}async generate(){let t="",e=this.config.textConfig.newlineDelimiter;this.config.renderMetadata&&this.ast.metadata&&(this.ast.metadata.title&&(t+=`Title: ${this.ast.metadata.title}${e}`),this.ast.metadata.author&&(t+=`Author: ${this.ast.metadata.author}${e}`),this.ast.metadata.created&&(t+=`Created: ${new Date(this.ast.metadata.created).toLocaleString()}${e}`),t+=`-------------------${e}${e}`);let n=async(i,s)=>{if(i.type==="text"||i.type==="code")return i.text||"";if(i.type==="break")return e;if(i.type==="image"){if(!this.config.includeImages)return"";let l=i.metadata;return`[Image: ${l?.altText||l?.attachmentName||"Untitled"}]${e}`}if(i.type==="table"&&this.config.textConfig.preserveLayout)return await this.renderTable(i,n,e);if(i.type==="list"&&this.config.textConfig.preserveLayout){let l=i.metadata,u=" ".repeat(4).repeat(l?.indentation||0),h=l?.listType==="ordered"?`${(l.itemIndex??0)+1}. `:"- ";return`${u}${h}${s.trimStart()}`+(s.endsWith(e)?"":e)}return["paragraph","heading","row","sheet","slide","note","list","table","code"].includes(i.type)?s.trim()===""?"":s+(s.endsWith(e)?"":e):s};for(let i of this.ast.content)t+=await this.processNodeRecursive(i,n);return{value:t.trim(),messages:this.messages}}async renderTable(t,e,n){if(!t.children||t.children.length===0)return"";let i=[],s=[];for(let l of t.children){let c=await this.handleOnNode(l);if(c===!1)continue;if(typeof c=="string"){i.push([c]);continue}let u=[];if(l.children)for(let h=0;h<l.children.length;h++){let d=l.children[h],f=(await this.processNodeRecursive(d,e)).trim().replace(/\r?\n/g," ");u.push(f),s[h]=Math.max(s[h]||0,f.length)}i.push(u)}let a=n;for(let l of i){a+="| ";for(let c=0;c<l.length;c++)a+=(l[c]||"").padEnd(s[c]||0)+" | ";a+=n}return a+n}};var Xs=class{static async generate(t,e,n){switch(e.toLowerCase()){case"text":return new _g(t,n).generate();case"md":return new Sg(t,n).generate();case"html":return new hu(t,n).generate();case"pdf":return new Ig(t,n).generate();case"csv":return new Tg(t,n).generate();case"rtf":return new kg(t,n).generate();case"chunks":return new yg(t,n).generate();default:throw hn("EXTENSION_UNSUPPORTED",void 0,e)}}};function An(r,t,e,n,i,s){return{config:i,type:r,metadata:t,content:e,attachments:n,warnings:[],toText:s,async to(a,l){return Xs.generate(this,a,l)}}}var Hv=async(r,t)=>{let e=r.toString("utf-8"),n=t.csvDelimiter,i=[],s=[],a="",l=!1;for(let f=0;f<e.length;f++){let p=e[f],m=e[f+1];l?p==='"'?m==='"'?(a+='"',f++):l=!1:a+=p:p==='"'?l=!0:e.substring(f,f+n.length)===n?(s.push(a),a="",f+=n.length-1):p===`
|
|
717
721
|
`?(s.push(a),i.push(s),s=[],a=""):p==="\r"||(a+=p)}(a!==""||s.length>0)&&(s.push(a),i.push(s)),i.length>0&&i[i.length-1].length===1&&i[i.length-1][0]===""&&i.pop();let c=[];i.forEach((f,p)=>{if(f.length===1&&f[0].startsWith("#")){c.push({type:"comment",text:f[0]});return}let m=[];f.forEach((y,x)=>{if(y&&y.trim()!==""){let b={row:p,col:x};m.push({type:"cell",text:y,metadata:b,children:[{type:"text",text:y}]})}}),m.length>0&&c.push({type:"row",children:m})});let h={type:"sheet",metadata:{sheetName:"Sheet1"},children:c,rawContent:t.includeRawContent?e:void 0};return An("csv",{title:"Sheet1"},[h],[],t,()=>i.map(f=>f.filter(p=>p.trim()!=="").join(t.newlineDelimiter)).join(t.newlineDelimiter).replace(/\n{3,}/g,`
|
|
@@ -749,7 +753,7 @@ ${x}
|
|
|
749
753
|
`})))}}}return W.filter(V=>V.text?.trim()||V.children&&V.children.length>0)};function q(T,I,_){let W=[];for(let z of Array.from(T?.childNodes||[])){if(!Oe(z))continue;let D=z,F=D.tagName;if(F==="p:sp")W.push(...$(D,I,_));else if(F==="p:pic"){let P=M(D,I,_);P&&W.push(P)}else if(F==="p:graphicFrame"){let P=j(D,I,_);P&&W.push(P)}else if(F==="p:grpSp"){let P=pt(D,"p:spTree");P&&W.push(...q(P,I,_))}}return W}for(let T of h)if(T.path.match(i)){let I=T.path.match(/slide(\d+)\.xml\.rels/);if(I){let _=parseInt(I[1]);x[_]={};let W=le(T.content.toString()),z=ut(W,"Relationship");for(let D=0;D<z.length;D++){let F=z[D].getAttribute("Id"),P=z[D].getAttribute("Type"),G=z[D].getAttribute("Target");if(F&&P&&G){let H="other";P.includes("relationships/image")?H="image":P.includes("relationships/hyperlink")?H="hyperlink":P.includes("relationships/chart")?H="chart":P.includes("relationships/slide")?H="slide":P.includes("relationships/notesSlide")&&(H="notes");let V=G;G.startsWith("http://")||G.startsWith("https://")||(V=V.split("/").pop()||""),x[_][F]={type:H,target:V}}}}}for(let T of h){if(T.path.match(a)||T.path.match(l)||T.path.match(i)||T.path.match(c))continue;let I=T.content.toString(),_=le(I,{locator:t.includeRawContent});t.includeRawContent&&y.push(I);let W=T.path.match(s),z=W?parseInt(W[1]):0,D=T.path.includes("notesSlide"),F={type:D?"note":"slide",children:[],metadata:{slideNumber:z,...D?{noteId:`slide-note-${z}`}:{}}};t.includeRawContent&&(F.rawContent=ee(_,I,t));let P=pt(_,"p:spTree");P&&F.children?.push(...q(P,z,I)),F.children&&F.children.length>0&&m.push(F)}let Q=[],Z=h.filter(T=>T.path.match(/ppt\/media\/.*/)),Y=h.filter(T=>T.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let I of Z){let _=Mr(I.path.split("/").pop()||"image",I.content);if(Q.push(_),t.ocr&&_.mimeType.startsWith("image/"))try{_.ocrText=(await lr(I.content,{...t.ocrConfig})).trim()}catch(W){Ce("OCR_FAILED",t,_.name,W)}}for(let I of Y){let _={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:I.content.toString("base64"),name:I.path.split("/").pop()||"",extension:"xml"};Q.push(_);try{let W=await pl(I.content);_.chartData=W}catch(W){Ce("CHART_DATA_EXTRACTION_FAILED",t,I.path,W)}}let T=I=>{for(let _ of I){if("attachmentName"in(_.metadata||{})){let W=_.metadata,z=Q.find(D=>D.name===W.attachmentName);z&&(_.type==="image"&&(z.altText=W.altText,z.ocrText&&(_.text=z.ocrText)),_.type==="chart"&&(_.text=z.chartData?.rawTexts.join(t.newlineDelimiter)))}_.children&&T(_.children)}};T(m)}return!t.ignoreNotes&&t.putNotesAtLast&&m.sort((T,I)=>{let _=T.type==="note"?1:0,W=I.type==="note"?1:0;return _-W}),An("pptx",f,m,Q,t,()=>m.map(T=>{let I=_=>{let W="";return _.children?W+=_.children.map(I).filter(z=>z!="").join(_.children[0]?.children?t.newlineDelimiter:""):W+=_.text||"",W};return I(T)}).filter(T=>T!="").join(t.newlineDelimiter))};B();var cF={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},uF={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},M2=class{constructor(t){U(this,"index",0);U(this,"buffer");U(this,"codePage",1252);U(this,"decoders",{});U(this,"pendingBytes",[]);U(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index<this.length;){let n=this.buffer[this.index],i=e[e.length-1];if(n===123){this.index++,this.flushPendingText(i);let s={type:"group",content:[]};i.content.push(s),e.push(s)}else n===125?(this.index++,this.flushPendingText(i),e.length>1&&e.pop()):n===92?(this.index++,this.parseControl(i)):n===13||n===10?this.index++:this.parseText(i)}return this.flushPendingText(t),t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){this.pendingBytes.push(e),this.index++;return}if(e===39){if(this.index++,this.index+1<this.length){let l=String.fromCharCode(this.buffer[this.index],this.buffer[this.index+1]),c=parseInt(l,16);isNaN(c)||this.pendingBytes.push(c),this.index+=2}return}if(this.flushPendingText(t),e===42){t.content.push({type:"control",value:"*"}),this.index++;return}let n="";for(;this.index<this.length;){let l=this.buffer[this.index];if(l>=97&&l<=122||l>=65&&l<=90)n+=String.fromCharCode(l),this.index++;else break}let i,s=!1,a="";for(this.index<this.length&&this.buffer[this.index]===45&&(a+="-",this.index++);this.index<this.length;){let l=this.buffer[this.index];if(l>=48&&l<=57)a+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(i=parseInt(a,10)),n!==""&&this.index<this.length&&this.buffer[this.index]===32&&this.index++,n==="bin"&&i!==void 0&&i>0){this.index+=i;return}n==="ansicpg"&&i!==void 0?this.codePage=i:n==="ansi"?this.codePage=1252:n==="mac"?this.codePage=1e4:n==="pc"?this.codePage=437:n==="pca"&&(this.codePage=850),t.content.push({type:"control",value:n,param:i}),(t.content.length===1&&t.type==="group"||t.content.length===2&&t.content[0].type==="control"&&t.content[0].value==="*")&&(t.destination=n)}parseText(t){for(;this.index<this.length;){let e=this.buffer[this.index];if(e===void 0||e===123||e===125||e===92||e===13||e===10)break;this.pendingBytes.push(e),this.index++}}flushPendingText(t){this.pendingBytes.length>0&&(t.content.push({type:"text",value:this.decodeBytes(this.pendingBytes,this.codePage)}),this.pendingBytes=[])}decodeBytes(t,e){let n=new Uint8Array(t);if(t.some(s=>s>127))try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{}if(!this.decoders[e]){let s=`windows-${e}`;e===1e4?s="macintosh":e===437?s="ibm437":e===850&&(s="ibm850");try{this.decoders[e]=new TextDecoder(s)}catch{if(e!==1252)try{this.decoders[e]=new TextDecoder("windows-1252")}catch{return String.fromCharCode(...t)}else return String.fromCharCode(...t)}}let i=this.decoders[e].decode(n);if(e===1252&&/[\u0080-\u009F]/.test(i)){let s={"\x80":"\u20AC","\x82":"\u201A","\x83":"\u0192","\x84":"\u201E","\x85":"\u2026","\x86":"\u2020","\x87":"\u2021","\x88":"\u02C6","\x89":"\u2030","\x8A":"\u0160","\x8B":"\u2039","\x8C":"\u0152","\x8E":"\u017D","\x91":"\u2018","\x92":"\u2019","\x93":"\u201C","\x94":"\u201D","\x95":"\u2022","\x96":"\u2013","\x97":"\u2014","\x98":"\u02DC","\x99":"\u2122","\x9A":"\u0161","\x9B":"\u203A","\x9C":"\u0153","\x9E":"\u017E","\x9F":"\u0178"};return i.replace(/[\u0080-\u009F]/g,a=>s[a]||a)}return i}},VD=async(r,t)=>{let n=new M2(r).parse(),i=hF(n),s=dF(n),a=[],l=[],c=[],u=[],h=[],d=[],f=[],p={},m=a,y=0,x="left",b=!1,w,C,E,S=[],N,k,M=[],R=0,j=0,$=()=>M.length>0?M[M.length-1]:void 0,q=()=>{M.length===0&&M.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},Q=!1,Z=!1,Y=0,X=[],T={isMergedContinuation:!1},I=0,_=0,W={},z=!1,D=!1,F,P,G={},H=!1,V,L,tt={},rt={},at,ft=(O,K)=>O.bold!==K.bold||O.italic!==K.italic||O.underline!==K.underline||O.strikethrough!==K.strikethrough||O.size!==K.size||O.font!==K.font||O.color!==K.color||O.backgroundColor!==K.backgroundColor||O.subscript!==K.subscript||O.superscript!==K.superscript,J=()=>{if(f.length>0){let O=f.join(""),K={type:"text",text:O,formatting:{...p}};at&&(K.metadata={link:at,linkType:Ft(at)}),h.push(K),u.push(O),f=[]}},st=!1,lt=()=>{J();let O=u.length>0||h.length>0;if(Q&&!Z&&!st&&O){let K=[...u],Tt=[...h],xt=[...d];u=[],h=[],d=[],vt(),u=K,h=Tt,d=xt}if(O){let K=u.join(""),Tt="paragraph",xt;if(C===void 0&&h.length>0){let Ot=h[0];if(Ot.type==="text"&&Ot.formatting?.bold){let Yt=parseInt(Ot.formatting.size||"12");Yt>=14&&K.length<300&&(Yt>=22?C=1:Yt>=18?C=2:Yt>=16?C=3:C=4)}}if(!b&&y>300){let Ot=K.trim();(/^[\u2022\u00b7\-\u25cf\u25cb]/.test(Ot)||/^\d+[.\)]/.test(Ot))&&(b=!0,w=/^\d+[.\)]/.test(Ot)?"ordered":"unordered")}if(C!==void 0&&C>0)Tt="heading",xt={level:C},N=void 0,k=void 0;else if(b){Tt="list";let Ot=E||N,Yt=w||k||"unordered",se=0;if(Ot){rt[Ot]||(rt[Ot]={});let _n=Object.keys(rt[Ot]).map($s=>parseInt($s));for(let $s of _n)$s>y&&delete rt[Ot][$s];rt[Ot][y]===void 0?rt[Ot][y]=0:rt[Ot][y]++,se=rt[Ot][y]}xt={listType:Yt,indentation:y,listId:Ot||"",itemIndex:se,alignment:x},Ot&&(N=Ot),Yt&&(k=Yt)}let Mt={type:Tt,text:K,children:h,formatting:void 0,metadata:{...xt,anchorIds:S.length>0?[...S]:void 0}};t.includeRawContent&&d.length>0&&(Mt.rawContent=d.join("")),Q&&Z?(q(),$().currentCellContent.push(Mt)):m.push(Mt),u=[],h=[],d=[],S=[]}},dt=O=>{lt();let K=O||$();if(!K)return;let Tt={type:"cell",text:K.currentCellContent.map(xt=>xt.text).join(`
|
|
750
754
|
`),children:[...K.currentCellContent],metadata:{row:K.rowIndex,col:K.currentCells.length}};return K.currentCellContent=[],Tt},et=O=>{let K=O||$();if(!K)return;let Tt=dt(K);if(Tt&&(Tt.children&&Tt.children.length>0||Tt.text)&&K.currentCells.push(Tt),K.currentCells.length>0){let xt={type:"row",text:K.currentCells.map(Mt=>Mt.text).filter(Mt=>Mt!=="").join(t.newlineDelimiter),children:[...K.currentCells]};K.rows.push(xt),K.currentCells=[],K.rowIndex++}},vt=()=>{if(st)return;st=!0;let O=$();if(!O){st=!1;return}if(et(O),O.rows.length>0){Y++;let K={type:"table",text:O.rows.map(Tt=>Tt.text).join(`
|
|
751
755
|
`),children:[...O.rows]};M.length>1?M[M.length-2].currentCellContent.push(K):m.push(K)}M.pop(),M.length===0&&(Q=!1,Z=!1),st=!1},bt=O=>{let K,Tt=xt=>{if(xt.type==="text"){let Mt=xt.value,Ot=Mt.match(/HYPERLINK\s+"([^"]+)"/i);if(Ot)return Ot[1];let Yt=Mt.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(Yt)return Yt[1]}else if(xt.type==="group"){let Mt=!1,Ot,Yt=!1;for(let se of xt.content)if(se.type==="text"){let _n=se.value.toUpperCase();_n.includes("HYPERLINK")&&(Mt=!0),_n.includes("\\L")&&(Yt=!0);let $s=se.value.match(/"([^"]+)"/);$s&&Mt&&(Ot=$s[1])}else if(se.type==="group"){let _n=Tt(se);_n&&(Ot=_n)}if(Ot)return Yt&&!Ot.startsWith("#")?"#"+Ot:Ot}};for(let xt of O.content)if(xt.type==="group"){let Mt=Tt(xt);if(Mt)return Mt}return K},Ft=O=>{let K=O.trim();return K.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(K)?"internal":"external"},Ct=O=>{let K="",Tt=xt=>{if(xt.type==="text")K+=xt.value;else if(xt.type==="group")for(let Mt of xt.content)Tt(Mt)};for(let xt of O.content)Tt(xt);return K},mt=O=>{let K,Tt=[];for(let Ot of O.content)if(Ot.type==="control"){let Yt=cF[Ot.value];Yt&&(K=Yt)}else Ot.type==="text"?Tt.push(Ot.value.replace(/[^0-9a-fA-F]/g,"")):Ot.type;let xt=Tt.join("");if(!K||xt.length===0)return;let Mt=uF[K];if(Mt)try{let Ot=ct.Buffer.from(xt,"hex"),Yt=K,se=`image_${c.length+1}.${Yt}`;return{type:"image",mimeType:Mt,data:Ot.toString("base64"),name:se,extension:Yt}}catch{return}},ot=O=>{if(!/^[a-zA-Z]/.test(O.value))return`\\${O.value}`;let K=`\\${O.value}`;return O.param!==void 0&&(K+=O.param),K+=" ",K},ht=O=>{let K="";for(let Tt of O.content)Tt.type==="text"?K+=Tt.value:Tt.type==="group"&&(K+=ht(Tt));return K.trim()},gt=O=>O.value.replace(/([\\{}])/g,"\\$1"),Et=(O,K,Tt=0)=>{if(O.type==="group"){let xt=["fonttbl","colortbl","stylesheet","info","macpict","pmmetafile","wmetafile","dibitmap","bitmap","object","nextGenerator","header","footer","nonshppict","xml","private","upnp","ud","filetbl","operator","author","creatim","revtim","printim","comment","fldinst","listtext","pntext"],Mt=!1,Ot=!1,Yt=!1,se=!1;if(O.destination){if(O.destination==="footnote")Ot=!0;else if(O.destination==="field"){let Ye=bt(O);Ye&&(J(),Yt=!0,at=Ye)}else if(O.destination==="listtable")z=!0;else if(z&&O.destination==="list")D=!0,F=void 0,P=void 0;else if(O.destination==="listoverridetable")H=!0;else if(H&&O.destination==="listoverride")V=void 0,L=void 0;else if(O.destination==="pict")t.extractAttachments?se=!0:Mt=!0;else if(xt.includes(O.destination))Mt=!0;else if(O.content.length>0&&O.content[0].type==="control"&&O.content[0].value==="*"){let Ye=["fldinst","nesttableprops"];if(t.extractAttachments&&Ye.push("shppict","listpicture"),!Ye.includes(O.destination||""))if(O.destination==="bkmkstart"){let Ke=ht(O);Ke&&!S.includes(Ke)&&S.push(Ke),Mt=!0}else O.destination,Mt=!0}}if(O.destination==="listtext"||O.destination==="pntext"){b||(y=0),b=!0;let Ye=Ct(O);if(Ye){let Ke=Ye.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Za=>Ke.includes(Za))||Ke.length===1&&!/[0-9a-zA-Z]/.test(Ke)?w="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(Ke)||/^[a-z][\.\)]/i.test(Ke))&&(w="ordered")}Mt=!0}if(Mt)return;if(d.push("{"),se){let Ye=mt(O);Ye&&(c.push(Ye),!z&&!D&&(lt(),m.push({type:"image",text:"",metadata:{attachmentName:Ye.name||`image_${c.length}`}})));for(let Ke of O.content)if(Ke.type==="control")d.push(ot(Ke));else if(Ke.type==="text")d.push(gt(Ke));else if(Ke.type==="group"){let ru=er=>{for(let Za of er.content)Za.type==="control"?d.push(ot(Za)):Za.type==="text"?d.push(gt(Za)):Za.type==="group"&&(d.push("{"),ru(Za),d.push("}"))};ru(O)}d.push("}");return}let _n=m;if(Ot){if(t.ignoreNotes)return;lt(),R++;let Ye="footnote";j===1?Ye="endnote":j===2&&(Ye=O.content.some(er=>er.type==="control"&&er.value==="ftnalt")?"endnote":"footnote");let Ke={type:"note",children:[],metadata:{noteId:R.toString(),noteType:Ye}};l.push(Ke),m=Ke.children}let $s={...K};for(let Ye of O.content){if(Ye.type==="group"&&Ye.destination==="fldinst"){d.push("{");let Ke=ru=>{for(let er of ru.content)er.type==="control"?d.push(ot(er)):er.type==="text"?d.push(gt(er)):er.type==="group"&&(d.push("{"),Ke(er),d.push("}"))};Ke(Ye),d.push("}");continue}Et(Ye,$s,Tt+1)}O.destination==="listtable"?z=!1:O.destination==="list"?(D=!1,F!==void 0&&P!==void 0&&(G[F]=P)):O.destination==="listoverridetable"?H=!1:H&&O.destination==="listoverride"&&L!==void 0&&V!==void 0&&(tt[L]=V),Ot&&(lt(),m=_n),Yt&&(J(),at=void 0),d.push("}")}else if(O.type==="text"){if(z||H){d.push(gt(O));return}ft(p,K)&&(J(),p={...K}),f.push(O.value),d.push(gt(O))}else if(O.type==="control"){if(d.push(ot(O)),z){if(O.value==="listid")F=O.param;else if(O.value==="levelnfc"||O.value==="levelnfcn"){let xt=O.param!==void 0&&(O.param===0||O.param>=0&&O.param<=4);(!P||P==="unordered"&&xt)&&(P=xt?"ordered":"unordered")}return}if(H){O.value==="listid"?V=O.param:O.value==="ls"&&(L=O.param);return}if(O.value==="par")lt(),p={...K};else if(O.value==="trowd"){let xt=$();Q&&xt&&xt.currentCellContent.length>0?(q(),M.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):Q||(Q=!0,q()),Z=!0,X=[],T={isMergedContinuation:!1},I=0}else if(O.value==="clvmrg")T.isMergedContinuation=!0;else if(O.value==="clmgf")T.isMergedContinuation=!1;else if(O.value==="cellx")X.push({...T}),T={isMergedContinuation:!1};else if(O.value==="cell"){Z=!0;let xt=!1;I<X.length&&(xt=X[I].isMergedContinuation),I++;let Mt=dt();if(Mt&&!xt){let Ot=$();Ot&&Ot.currentCells.push(Mt)}p={...K}}else if(O.value==="nestcell"){if(M.length>1){let Mt=$();Mt&&(Mt.rows.length>0||Mt.currentCells.length>0)&&vt()}Z=!0;let xt=dt();if(xt){let Mt=$();Mt&&Mt.currentCells.push(xt)}p={...K}}else if(O.value==="row")et(),p={...K},I=0,Z=!1;else if(O.value==="nestrow")M.length>1&&vt(),et(),p={...K},I=0;else if(O.value==="intbl")Q=!0,Z=!0,q();else if(O.value==="pard")Z=!1,y=0,x="left",b=!1,w=void 0,C=void 0,E=void 0,K.backgroundColor=void 0;else if(O.value==="tab")ft(p,K)&&(J(),p={...K}),f.push(" ");else if(O.value==="line")ft(p,K)&&(J(),p={...K}),f.push(`
|
|
752
|
-
`);else if(O.value==="lquote")ft(p,K)&&(J(),p={...K}),f.push("\u2018");else if(O.value==="rquote")ft(p,K)&&(J(),p={...K}),f.push("\u2019");else if(O.value==="ldblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201C");else if(O.value==="rdblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201D");else if(O.value==="u"){if(O.param!==void 0){let xt=O.param;xt<0&&(xt+=65536),ft(p,K)&&(J(),p={...K}),f.push(String.fromCharCode(xt))}}else if(O.value==="b")K.bold=O.param!==0;else if(O.value==="i")K.italic=O.param!==0;else if(O.value==="ul")K.underline=O.param!==0;else if(O.value==="ulnone")K.underline=!1;else if(O.value==="strike")K.strikethrough=O.param!==0;else if(O.value==="plain")K.bold=!1,K.italic=!1,K.underline=!1,K.strikethrough=!1,K.subscript=!1,K.superscript=!1,K.size=void 0,K.font=void 0,K.color=void 0,K.backgroundColor=void 0;else if(O.value==="fs")O.param!==void 0&&(K.size=(O.param/2).toString()+"pt");else if(O.value==="f")O.param!==void 0&&i[O.param]&&(K.font=i[O.param]);else if(O.value==="cf")O.param!==void 0&&s[O.param]&&(K.color=s[O.param]);else if(O.value==="fet")O.param!==void 0&&(j=O.param);else if(O.value==="cb"||O.value==="highlight"||O.value==="chcbpat"||O.value==="cbpat")O.param!==void 0&&s[O.param]&&(K.backgroundColor=s[O.param]);else if(O.value==="sub")K.subscript=!0,K.superscript=!1;else if(O.value==="super")K.superscript=!0,K.subscript=!1;else if(O.value==="nosupersub")K.subscript=!1,K.superscript=!1;else if(O.value==="li"){if(O.param!==void 0){let xt=Math.round(O.param/720);b||(y=xt)}}else if(O.value==="ls"){if(O.param!==void 0){b||(y=0),b=!0,W[O.param]||(_++,W[O.param]=`rtf-list-${_}`),E=W[O.param];let xt=tt[O.param]!==void 0?tt[O.param]:O.param;G[xt]&&(w=G[xt])}}else O.value==="ilvl"?O.param!==void 0&&(b=!0,y=O.param):O.value==="pnlvl"?(b=!0,O.param!==void 0&&(y=O.param)):O.value==="levelnfc"||O.value==="pnf"?O.param!==void 0&&(b=!0,O.param===23?w="unordered":w="ordered"):O.value==="pndec"||O.value==="pnord"||O.value==="pnlcltr"||O.value==="pnucltr"?(b||(y=0),b=!0,w="ordered"):O.value==="pnbullet"||O.value==="pncard"?(b||(y=0),b=!0,w="unordered"):O.value==="s"?O.param!==void 0&&O.param>=1&&O.param<=9&&(C=O.param):O.value==="ql"?x="left":O.value==="qc"?x="center":O.value==="qr"?x="right":O.value==="qj"&&(x="justify")}};Et(n,{});let Pt=$();if((Q||Pt&&(Pt.rows.length>0||Pt.currentCells.length>0))&&vt(),lt(),!t.putNotesAtLast&&l.length>0&&(a.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let K of c)if(K.mimeType.startsWith("image/"))try{let Tt=ct.Buffer.from(K.data,"base64");K.ocrText=(await lr(Tt,{...t.ocrConfig})).trim()}catch(Tt){Ce("OCR_FAILED",t,K.name,Tt)}let O=K=>{for(let Tt of K){if(Tt.type==="image"&&Tt.metadata&&"attachmentName"in Tt.metadata){let xt=Tt.metadata,Mt=c.find(Ot=>Ot.name===xt.attachmentName);Mt&&(Mt.ocrText&&(Tt.text=Mt.ocrText),Mt.altText&&(xt.altText=Mt.altText))}Tt.children&&O(Tt.children)}};O(a)}let wt=O=>{for(let K of O){if(K.type==="note"&&K.children){let Tt=xt=>xt.children&&xt.children.length>0?xt.children.map(Tt).join(""):xt.text||"";K.text=K.children.map(Tt).join("").trim()}K.children&&wt(K.children)}};wt(a),wt(l);let St=An("rtf",{},a,c,t,()=>{let O=a.map(K=>K.text).join(t.newlineDelimiter);return t.putNotesAtLast&&l.length>0&&(O+=t.newlineDelimiter+l.map(K=>K.text).join(t.newlineDelimiter)),O});return t.putNotesAtLast&&l.length>0&&a.push(...l),St};function O2(r,t){for(let e of r.content)if(e.type==="group"){if(e.destination===t)return e;let n=O2(e,t);if(n)return n}return null}function hF(r){let t={},e=O2(r,"fonttbl");if(e){for(let n of e.content)if(n.type==="group"){let i,s="";for(let a of n.content)a.type==="control"&&a.value==="f"?i=a.param:a.type==="text"&&(s+=a.value);i!==void 0&&s&&(t[i]=s.replace(/;$/,"").trim())}}return t}function dF(r){let t={},e=O2(r,"colortbl");if(e){let n=0,i=0,s=0,a=0;for(let l of e.content)if(l.type==="control")l.value==="red"&&l.param!==void 0?i=l.param:l.value==="green"&&l.param!==void 0?s=l.param:l.value==="blue"&&l.param!==void 0&&(a=l.param);else if(l.type==="text"&&l.value===";"){let c=`#${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`;t[n]=c,n++,i=0,s=0,a=0}}return t}B();var XD=async(r,t)=>{let e=/word\/document[\d+]?.xml/,n=/word\/footnotes[\d+]?.xml/,i=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,a=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=D=>{let F={},P=(dt,et)=>{let vt=pt(dt,et);if(vt){let bt=vt.getAttribute("w:val");return bt===null?!0:bt==="1"||bt==="true"||bt==="on"}return null},G=P(D,"w:b");G!==null&&(F.bold=G);let H=P(D,"w:i");H!==null&&(F.italic=H);let V=pt(D,"w:u");if(V){let dt=V.getAttribute("w:val");(!dt||dt!=="none")&&(F.underline=!0)}let L=P(D,"w:strike"),tt=P(D,"w:dstrike");L!==null?F.strikethrough=L:tt!==null&&(F.strikethrough=tt);let rt=pt(D,"w:sz");if(rt){let dt=rt.getAttribute("w:val");dt&&(F.size=(parseInt(dt,10)/2).toString()+"pt")}let at=pt(D,"w:color");if(at){let dt=at.getAttribute("w:val");dt&&dt!=="auto"&&(F.color="#"+dt)}let ft=pt(D,"w:shd");if(ft){let dt=ft.getAttribute("w:fill");dt&&dt!=="auto"&&(F.backgroundColor="#"+dt)}let J=pt(D,"w:highlight");if(J){let dt=J.getAttribute("w:val");if(dt&&dt!=="none"){let et={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};F.backgroundColor=et[dt]||dt}}let st=pt(D,"w:rFonts");if(st){let dt=st.getAttribute("w:ascii")||st.getAttribute("w:hAnsi");dt&&(F.font=dt)}let lt=pt(D,"w:vertAlign");if(lt){let dt=lt.getAttribute("w:val");dt==="subscript"?F.subscript=!0:dt==="superscript"&&(F.superscript=!0)}return F},f=D=>{let F=pt(D,"w:ind");if(F){let P={},G=F.getAttribute("w:left")||F.getAttribute("w:start"),H=F.getAttribute("w:right")||F.getAttribute("w:end"),V=F.getAttribute("w:firstLine"),L=F.getAttribute("w:hanging");return G&&(P.left=parseInt(G,10)),H&&(P.right=parseInt(H,10)),V&&(P.firstLine=parseInt(V,10)),L&&(P.hanging=parseInt(L,10)),Object.keys(P).length>0?P:void 0}},p=D=>{let F=pt(D,"mc:Choice");if(F)return Array.from(F.childNodes);let P=pt(D,"mc:Fallback");return Array.from(P?P.childNodes:D.childNodes)},m=await oo(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(i)||!!D.match(s)||!!D.match(l)||!!D.match(c)||!!D.match(u)||!!D.match(h)||!!t.extractAttachments&&!!D.match(a)),y=m.find(D=>D.path.match(l)),x=y?so(y.content.toString()):{},b=m.find(D=>D.path.match(c));if(b){let D=ku(b.content.toString());Object.keys(D).length>0&&(x.customProperties=D)}let w=new Map,C=new Map,E=[],S=[],N=m.filter(D=>D.path.match(a)),k=m.find(D=>D.path.match(u)),M={};if(k){let D=le(k.content.toString()),F=ut(D,"Relationship");for(let P of F){let G=P.getAttribute("Id"),H=P.getAttribute("Target");G&&H&&(M[G]=H)}}let R=m.find(D=>D.path.match(s)),j={};if(R){let D=le(R.content.toString()),F=ut(D,"w:num"),P=ut(D,"w:abstractNum"),G={};for(let H of P){let V=H.getAttribute("w:abstractNumId");V&&(G[V]=H)}for(let H of F){let V=H.getAttribute("w:numId"),tt=pt(H,"w:abstractNumId")?.getAttribute("w:val");if(V&&tt&&G[tt]){j[V]={};let rt=ut(G[tt],"w:lvl");for(let ft of rt){let J=ft.getAttribute("w:ilvl"),st=pt(ft,"w:numFmt"),lt=pt(ft,"w:lvlText"),dt=pt(ft,"w:start");J&&(j[V][J]={numFmt:st?.getAttribute("w:val")||"decimal",lvlText:lt?.getAttribute("w:val")||"",start:parseInt(dt?.getAttribute("w:val")||"1",10)})}let at=ut(H,"w:lvlOverride");for(let ft of at){let J=ft.getAttribute("w:ilvl");if(J&&j[V][J]){let st=pt(ft,"w:startOverride");st&&(j[V][J].start=parseInt(st.getAttribute("w:val")||"1",10))}}}}}let $=m.find(D=>D.path.match(h)),q={};if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:styleId");if(G){let H=pt(P,"w:rPr"),V=pt(P,"w:pPr"),L=H?d(H):{},tt,rt,at;if(V){let ft=pt(V,"w:jc");if(ft){let lt=ft.getAttribute("w:val");(lt==="left"||lt==="center"||lt==="right"||lt==="justify")&&(tt=lt)}let J=pt(V,"w:shd");if(J){let lt=J.getAttribute("w:fill");lt&<!=="auto"&&(rt="#"+lt)}let st=f(V);st&&(at=st)}q[G]={formatting:L,alignment:tt,backgroundColor:rt,paragraphIndentation:at}}}}let Q={};if($){let D=le($.content.toString()),F=pt(D,"w:docDefaults");if(F){let P=pt(F,"w:rPrDefault");if(P){let G=pt(P,"w:rPr");G&&(Q=d(G))}}}let Z;if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:type"),H=P.getAttribute("w:default"),V=P.getAttribute("w:styleId");if(G==="paragraph"&&H==="1"&&V){Z=V;break}}!Z&&q.Normal&&(Z="Normal")}let Y=[],X=[],T={},I={},_=(D,F,P=[])=>{let G=pt(D,"w:numPr"),H=!!G,V=pt(D,"w:pPr"),tt=(V?pt(V,"w:pStyle"):null)?.getAttribute("w:val"),rt=tt?tt.startsWith("Heading")||tt==="Title":!1,at=tt&&q[tt]?q[tt]:{formatting:{}},ft=at.alignment;if(V){let mt=pt(V,"w:jc");if(mt){let ot=mt.getAttribute("w:val");(ot==="left"||ot==="center"||ot==="right"||ot==="justify")&&(ft=ot)}}let J=at.paragraphIndentation;if(V){let mt=f(V);mt&&(J={...J,...mt})}let st=at.backgroundColor;if(V){let mt=pt(V,"w:shd");if(mt){let ot=mt.getAttribute("w:fill");ot&&ot!=="auto"&&(st="#"+ot)}}let lt={...at.formatting};if(V){let mt=pt(V,"w:rPr");if(mt){let ot=d(mt);for(let ht in ot){let gt=ot[ht];gt===!1?delete lt[ht]:gt!==void 0&&(lt[ht]=gt)}}}let dt="",et=[],vt=mt=>{if(Oe(mt)&&mt.nodeName==="w:r"){let ot=mt,ht=pt(ot,"w:rPr"),gt={};for(let wt in lt)gt[wt]=lt[wt];let Et=ht?pt(ht,"w:rStyle"):null,Pt=Et?Et.getAttribute("w:val"):tt;if(Pt&&q[Pt])for(let wt in q[Pt].formatting)gt[wt]=q[Pt].formatting[wt];if(ht){let wt=d(ht);for(let kt in wt){let St=wt[kt];St===!1?delete gt[kt]:St!==void 0&&(gt[kt]=St)}}!gt.backgroundColor&&st&&(gt.backgroundColor=st);for(let wt of ot.childNodes)if(Oe(wt)){if(wt.tagName==="w:t"||wt.tagName==="t"){let kt=wt,St=kt.textContent||"";dt+=St;let O={type:"text",text:St,formatting:gt};t.includeRawContent&&(O.rawContent=ee(kt,F,t));let K=Pt||tt||Z;K&&(O.metadata={style:K}),et.push(O)}else if(t.includeBreakNodes&&(wt.tagName==="w:br"||wt.tagName==="br"||wt.tagName==="w:cr"||wt.tagName==="cr")){let kt=wt,St="textWrapping";if(wt.tagName==="w:cr"||wt.tagName==="cr")St="carriageReturn";else{let Tt=kt.getAttribute("w:type")||kt.getAttribute("type");Tt!==null&&(St=Tt)}let O;St==="textWrapping"&&kt.getAttribute("w:clear")!==null&&(O=kt.getAttribute("w:clear"));let K={type:"break",metadata:{breakType:St,clear:O}};t.includeRawContent&&(K.rawContent=ee(kt,F,t)),et.push(K)}else if(t.includeBreakNodes&&(wt.tagName==="w:lastRenderedPageBreak"||wt.tagName==="lastRenderedPageBreak")){let kt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(kt.rawContent=ee(wt,F,t)),et.push(kt)}}if(t.extractAttachments){let wt=ut(ot,"w:drawing"),kt=ut(ot,"w:pict"),St=[...wt,...kt];for(let O of St){let K=mx(O),Tt="",xt=pt(O,"wp:docPr");xt&&(Tt=xt.getAttribute("descr")||xt.getAttribute("title")||"");let Mt="",Ot=pt(O,"a:blip");if(Ot)Mt=Ot.getAttribute("r:embed")||"";else{let Yt=pt(O,"v:imagedata");Yt&&(Mt=Yt.getAttribute("r:id")||"")}if(Mt&&M[Mt]){let se=M[Mt].split("/").pop();if(se){let _n={type:"image",text:"",metadata:{attachmentName:se,altText:Tt}};t.includeRawContent&&(_n.rawContent=ee(O,F,t)),et.push(_n)}}else{let Yt={type:"image",text:""};t.includeRawContent&&(Yt.rawContent=ee(O,F,t)),et.push(Yt)}}}if(!t.ignoreNotes){let wt=pt(ot,"w:footnoteReference");if(wt){let St=wt.getAttribute("w:id");if(St&&w.has(St)){let O=w.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"footnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}let kt=pt(ot,"w:endnoteReference");if(kt){let St=kt.getAttribute("w:id");if(St&&C.has(St)){let O=C.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"endnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}}}else if(Oe(mt)&&mt.nodeName==="w:hyperlink"){let ot=mt,ht=ot.getAttribute("r:id"),gt=ot.getAttribute("w:anchor"),Et;gt&&!t.ignoreInternalLinks?Et={link:"#"+gt,linkType:"internal"}:ht&&M[ht]&&(Et={link:M[ht],linkType:"external"});let Pt=Array.from(ot.childNodes);for(let wt of Pt){let kt=et.length;if(vt(wt),Et)for(let St=kt;St<et.length;St++)et[St].type==="text"&&(et[St].metadata={...et[St].metadata??{},...Et})}}else if(Oe(mt)&&mt.nodeName==="w:bookmarkStart"){let ot=mt.getAttribute("w:name");ot&&!ot.startsWith("_GoBack")&&!t.ignoreInternalLinks&&bt.push(ot)}else if(Oe(mt)&&(mt.nodeName==="mc:AlternateContent"||mt.nodeName==="AlternateContent")){let ot=p(mt);for(let ht of ot)vt(ht)}else if(Oe(mt)&&(mt.nodeName==="w:pict"||mt.nodeName==="pict"||mt.nodeName==="w:drawing"||mt.nodeName==="drawing")){let ot=ut(mt,"w:txbxContent");for(let ht of ot){let gt=Array.from(ht.childNodes);for(let Et of gt)if(Oe(Et)&&Et.nodeName==="w:p"){let Pt=_(Et,F);et.push(...Pt.children||[]),dt+=Pt.text}}}else if(mt.childNodes.length>0)for(let ot of Array.from(mt.childNodes))vt(ot)},bt=[...P],Ft=Array.from(D.childNodes);for(let mt of Ft)vt(mt);let Ct=bt.length>0?{anchorIds:bt}:{};if(H){let mt=pt(G,"w:numId"),ot=pt(G,"w:ilvl"),ht=mt&&mt.getAttribute("w:val")||"0",gt=ot?parseInt(ot.getAttribute("w:val")||"0",10):0,Et="ordered",Pt=0;if(ht&&j[ht]){let kt=gt.toString();T[ht]||(T[ht]={}),T[ht][kt]||(T[ht][kt]=0),T[ht][kt]++;for(let O=gt+1;O<10;O++)T[ht][O.toString()]&&(T[ht][O.toString()]=0);Et=(j[ht][kt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",I[ht]||(I[ht]={}),I[ht][kt]===void 0?I[ht][kt]=(j[ht][kt]?.start??1)-1:I[ht][kt]++,Pt=I[ht][kt]}let wt={type:"list",text:dt,children:et,metadata:{listType:Et,indentation:gt,paragraphIndentation:J,alignment:ft||"left",listId:ht,itemIndex:Pt,style:tt,...Ct}};return t.includeRawContent&&(wt.rawContent=ee(D,F,t)),wt}else if(rt){let mt=tt&&parseInt(tt.replace("Heading",""),10)||1,ot={type:"heading",text:dt,children:et,metadata:{level:mt,alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(ot.rawContent=ee(D,F,t)),ot}else{let mt={type:"paragraph",text:dt,children:et,metadata:{alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(mt.rawContent=ee(D,F,t)),mt}},W=(D,F,P=[])=>{let G=[],H=Qe(D,"w:tr"),V=new Map;for(let L=0;L<H.length;L++){let tt=H[L],rt=[],at=Qe(tt,"w:tc"),ft=0;for(let st=0;st<at.length;st++){let lt=at[st],dt=pt(lt,"w:tcPr"),et=1;if(dt){let ht=pt(dt,"w:gridSpan");ht&&(et=parseInt(ht.getAttribute("w:val")||"1",10))}let vt=!1,bt=!1;if(dt){let ht=pt(dt,"w:vMerge");ht&&(bt=!0,(ht.getAttribute("w:val")==="restart"||!V.has(ft))&&(vt=!0))}let Ft=[],Ct="",mt=Array.from(lt.childNodes);for(let ht of mt)if(Oe(ht)&&ht.nodeName==="w:p"){let gt=_(ht,F);Ft.push(gt),Ct+=gt.text}else if(Oe(ht)&&ht.nodeName==="w:tbl"){let gt=W(ht,F);Ft.push(gt)}let ot={type:"cell",text:Ct,children:Ft,metadata:{row:L,col:ft}};if(et>1&&(ot.metadata.colSpan=et),bt)if(vt)V.set(ft,{node:ot,span:1}),rt.push(ot);else{let ht=V.get(ft);ht?(ht.span++,ht.node.metadata.rowSpan=ht.span,Ft.length>0&&(ht.node.children||(ht.node.children=[]),ht.node.children.push(...Ft),ht.node.text+=" "+Ct)):rt.push(ot)}else V.delete(ft),rt.push(ot);ft+=et}let J={type:"row",children:rt};G.push(J)}return{type:"table",children:G}};if(!t.ignoreNotes){let D=m.find(P=>P.path.match(n));if(D){let P=le(D.content.toString()),G=D.content.toString(),H=ut(P,"w:footnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");w.set(L,tt.map(rt=>_(rt,G)))}}let F=m.find(P=>P.path.match(i));if(F){let P=le(F.content.toString()),G=F.content.toString(),H=ut(P,"w:endnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");C.set(L,tt.map(rt=>_(rt,G)))}}}for(let D of m){if(D.path.match(a)||D.path.match(s)||D.path.match(u)||D.path.match(h)||D.path.match(n)||D.path.match(i))continue;let F=D.content.toString();t.includeRawContent&&X.push(F);let P=le(F,{locator:t.includeRawContent}),G=pt(P,"w:body");if(G){let H=Array.from(G.childNodes),V=[];for(let L of H)if(Oe(L)){if(L.nodeName==="w:p")Y.push(_(L,F,V)),V=[];else if(L.nodeName==="w:tbl")Y.push(W(L,F,V)),V=[];else if(L.nodeName==="w:bookmarkStart"){let tt=L.getAttribute("w:name");tt&&!tt.startsWith("_GoBack")&&!t.ignoreInternalLinks&&V.push(tt)}}}}if(t.extractAttachments){for(let D of N){let F=Mr(D.path.split("/").pop()||"image",D.content);if(S.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Ce("OCR_FAILED",t,F.name,P)}}if(t.ocr){let D=F=>{for(let P of F){if(P.type==="image"&&"attachmentName"in(P.metadata||{})){let G=P.metadata,H=S.find(V=>V.name===G.attachmentName);H&&H.ocrText&&(P.text=H.ocrText,H.altText=G.altText)}P.children&&D(P.children)}};D(Y)}}t.putNotesAtLast&&E.length>0&&Y.push(...E);let z=()=>Y.map(D=>{let F=P=>{let G="";return P.children?G+=P.children.map(F).filter(H=>H!="").join(P.children[0]?.children?t.newlineDelimiter:""):P.type==="break"?G+=t.newlineDelimiter:G+=P.text||"",G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An("docx",{...x,formatting:Q,styleMap:q},Y,S,t,z)};var Ka=class{static async parseOffice(t,e,n){let i,s={};typeof e=="function"?(i=e,s=n||{}):s=e||{};let a=pv(s),l=[],c=a.onWarning;a.onWarning=f=>{l.push(f),c&&c(f)};let u=ct.Buffer.alloc(0),h=a.fileType??"",d;try{if(!t)throw hn("IMPROPER_ARGUMENTS",a);if(t instanceof ArrayBuffer)u=ct.Buffer.from(t);else if(ct.Buffer.isBuffer(t))u=t;else if(typeof t=="string"){d=t,Ng("path-parsing");let p=await Promise.resolve().then(()=>(rN(),iN));if(!p.existsSync(t))throw hn("FILE_DOES_NOT_EXIST",a,t);if(p.lstatSync(t).isDirectory())throw hn("LOCATION_NOT_FOUND",a,t);u=p.readFileSync(t),h=h||t.split(".").pop()||""}else throw hn("INVALID_INPUT",a);if(u.length>0&&!h)try{let{fileTypeFromBuffer:p}=await _2(),m=await p(u);m&&(h=m.ext)}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}else if(u.length>0&&h)try{let{fileTypeFromBuffer:p}=await _2(),m=await p(u);m&&m.ext.toLowerCase()!==h.toLowerCase()&&Ce("BUFFER_TYPE_MISMATCH",a,{detected:m.ext,expected:h})}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}if(!h)throw hn("IMPROPER_BUFFERS",a);let f;switch(h.toLowerCase()){case"docx":f=await XD(u,a);break;case"pptx":f=await qD(u,a);break;case"xlsx":f=await HE(u,a);break;case"odt":case"odp":case"ods":f=await VE(u,a);break;case"pdf":f=await WD(u,a);break;case"rtf":f=await VD(u,a);break;case"csv":f=await Hv(u,a);break;case"html":f=await WE(u,a);break;case"md":f=await qE(u,a);break;default:throw hn("EXTENSION_UNSUPPORTED",a,h)}return f.warnings=l,i&&i(f),f}catch(f){let p=fv(f,a,d);throw i&&i(void 0,p),p}}static async terminateOcr(){await GE()}};B();var cg=class{static async convert(t,e,n){let i={...n?.parseConfig,onWarning:n?.onWarning||n?.parseConfig?.onWarning};i.ocr=!1,Object.keys(i).forEach(c=>i[c]===void 0&&delete i[c]),i.extractAttachments=n?.generatorConfig?.includeImages!==!1||n?.generatorConfig?.includeCharts!==!1;let s=await Ka.parseOffice(t,i),a={...n?.generatorConfig,onWarning:n?.onWarning||n?.generatorConfig?.onWarning},l=await Xs.generate(s,e,a);return l.messages=[...s.warnings||[],...l.messages],l}};var pF=Ka.parseOffice,mF=Ka.terminateOcr,gF=cg.convert,yF=Xs.generate;var bF=Ka;return hN(xF);})();
|
|
756
|
+
`);else if(O.value==="lquote")ft(p,K)&&(J(),p={...K}),f.push("\u2018");else if(O.value==="rquote")ft(p,K)&&(J(),p={...K}),f.push("\u2019");else if(O.value==="ldblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201C");else if(O.value==="rdblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201D");else if(O.value==="u"){if(O.param!==void 0){let xt=O.param;xt<0&&(xt+=65536),ft(p,K)&&(J(),p={...K}),f.push(String.fromCharCode(xt))}}else if(O.value==="b")K.bold=O.param!==0;else if(O.value==="i")K.italic=O.param!==0;else if(O.value==="ul")K.underline=O.param!==0;else if(O.value==="ulnone")K.underline=!1;else if(O.value==="strike")K.strikethrough=O.param!==0;else if(O.value==="plain")K.bold=!1,K.italic=!1,K.underline=!1,K.strikethrough=!1,K.subscript=!1,K.superscript=!1,K.size=void 0,K.font=void 0,K.color=void 0,K.backgroundColor=void 0;else if(O.value==="fs")O.param!==void 0&&(K.size=(O.param/2).toString()+"pt");else if(O.value==="f")O.param!==void 0&&i[O.param]&&(K.font=i[O.param]);else if(O.value==="cf")O.param!==void 0&&s[O.param]&&(K.color=s[O.param]);else if(O.value==="fet")O.param!==void 0&&(j=O.param);else if(O.value==="cb"||O.value==="highlight"||O.value==="chcbpat"||O.value==="cbpat")O.param!==void 0&&s[O.param]&&(K.backgroundColor=s[O.param]);else if(O.value==="sub")K.subscript=!0,K.superscript=!1;else if(O.value==="super")K.superscript=!0,K.subscript=!1;else if(O.value==="nosupersub")K.subscript=!1,K.superscript=!1;else if(O.value==="li"){if(O.param!==void 0){let xt=Math.round(O.param/720);b||(y=xt)}}else if(O.value==="ls"){if(O.param!==void 0){b||(y=0),b=!0,W[O.param]||(_++,W[O.param]=`rtf-list-${_}`),E=W[O.param];let xt=tt[O.param]!==void 0?tt[O.param]:O.param;G[xt]&&(w=G[xt])}}else O.value==="ilvl"?O.param!==void 0&&(b=!0,y=O.param):O.value==="pnlvl"?(b=!0,O.param!==void 0&&(y=O.param)):O.value==="levelnfc"||O.value==="pnf"?O.param!==void 0&&(b=!0,O.param===23?w="unordered":w="ordered"):O.value==="pndec"||O.value==="pnord"||O.value==="pnlcltr"||O.value==="pnucltr"?(b||(y=0),b=!0,w="ordered"):O.value==="pnbullet"||O.value==="pncard"?(b||(y=0),b=!0,w="unordered"):O.value==="s"?O.param!==void 0&&O.param>=1&&O.param<=9&&(C=O.param):O.value==="ql"?x="left":O.value==="qc"?x="center":O.value==="qr"?x="right":O.value==="qj"&&(x="justify")}};Et(n,{});let Pt=$();if((Q||Pt&&(Pt.rows.length>0||Pt.currentCells.length>0))&&vt(),lt(),!t.putNotesAtLast&&l.length>0&&(a.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let K of c)if(K.mimeType.startsWith("image/"))try{let Tt=ct.Buffer.from(K.data,"base64");K.ocrText=(await lr(Tt,{...t.ocrConfig})).trim()}catch(Tt){Ce("OCR_FAILED",t,K.name,Tt)}let O=K=>{for(let Tt of K){if(Tt.type==="image"&&Tt.metadata&&"attachmentName"in Tt.metadata){let xt=Tt.metadata,Mt=c.find(Ot=>Ot.name===xt.attachmentName);Mt&&(Mt.ocrText&&(Tt.text=Mt.ocrText),Mt.altText&&(xt.altText=Mt.altText))}Tt.children&&O(Tt.children)}};O(a)}let wt=O=>{for(let K of O){if(K.type==="note"&&K.children){let Tt=xt=>xt.children&&xt.children.length>0?xt.children.map(Tt).join(""):xt.text||"";K.text=K.children.map(Tt).join("").trim()}K.children&&wt(K.children)}};wt(a),wt(l);let St=An("rtf",{},a,c,t,()=>{let O=a.map(K=>K.text).join(t.newlineDelimiter);return t.putNotesAtLast&&l.length>0&&(O+=t.newlineDelimiter+l.map(K=>K.text).join(t.newlineDelimiter)),O});return t.putNotesAtLast&&l.length>0&&a.push(...l),St};function O2(r,t){for(let e of r.content)if(e.type==="group"){if(e.destination===t)return e;let n=O2(e,t);if(n)return n}return null}function hF(r){let t={},e=O2(r,"fonttbl");if(e){for(let n of e.content)if(n.type==="group"){let i,s="";for(let a of n.content)a.type==="control"&&a.value==="f"?i=a.param:a.type==="text"&&(s+=a.value);i!==void 0&&s&&(t[i]=s.replace(/;$/,"").trim())}}return t}function dF(r){let t={},e=O2(r,"colortbl");if(e){let n=0,i=0,s=0,a=0;for(let l of e.content)if(l.type==="control")l.value==="red"&&l.param!==void 0?i=l.param:l.value==="green"&&l.param!==void 0?s=l.param:l.value==="blue"&&l.param!==void 0&&(a=l.param);else if(l.type==="text"&&l.value===";"){let c=`#${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`;t[n]=c,n++,i=0,s=0,a=0}}return t}B();var XD=async(r,t)=>{let e=/word\/document[\d+]?.xml/,n=/word\/footnotes[\d+]?.xml/,i=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,a=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=D=>{let F={},P=(dt,et)=>{let vt=pt(dt,et);if(vt){let bt=vt.getAttribute("w:val");return bt===null?!0:bt==="1"||bt==="true"||bt==="on"}return null},G=P(D,"w:b");G!==null&&(F.bold=G);let H=P(D,"w:i");H!==null&&(F.italic=H);let V=pt(D,"w:u");if(V){let dt=V.getAttribute("w:val");(!dt||dt!=="none")&&(F.underline=!0)}let L=P(D,"w:strike"),tt=P(D,"w:dstrike");L!==null?F.strikethrough=L:tt!==null&&(F.strikethrough=tt);let rt=pt(D,"w:sz");if(rt){let dt=rt.getAttribute("w:val");dt&&(F.size=(parseInt(dt,10)/2).toString()+"pt")}let at=pt(D,"w:color");if(at){let dt=at.getAttribute("w:val");dt&&dt!=="auto"&&(F.color="#"+dt)}let ft=pt(D,"w:shd");if(ft){let dt=ft.getAttribute("w:fill");dt&&dt!=="auto"&&(F.backgroundColor="#"+dt)}let J=pt(D,"w:highlight");if(J){let dt=J.getAttribute("w:val");if(dt&&dt!=="none"){let et={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};F.backgroundColor=et[dt]||dt}}let st=pt(D,"w:rFonts");if(st){let dt=st.getAttribute("w:ascii")||st.getAttribute("w:hAnsi");dt&&(F.font=dt)}let lt=pt(D,"w:vertAlign");if(lt){let dt=lt.getAttribute("w:val");dt==="subscript"?F.subscript=!0:dt==="superscript"&&(F.superscript=!0)}return F},f=D=>{let F=pt(D,"w:ind");if(F){let P={},G=F.getAttribute("w:left")||F.getAttribute("w:start"),H=F.getAttribute("w:right")||F.getAttribute("w:end"),V=F.getAttribute("w:firstLine"),L=F.getAttribute("w:hanging");return G&&(P.left=parseInt(G,10)),H&&(P.right=parseInt(H,10)),V&&(P.firstLine=parseInt(V,10)),L&&(P.hanging=parseInt(L,10)),Object.keys(P).length>0?P:void 0}},p=D=>{let F=pt(D,"mc:Choice");if(F)return Array.from(F.childNodes);let P=pt(D,"mc:Fallback");return Array.from(P?P.childNodes:D.childNodes)},m=await oo(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(i)||!!D.match(s)||!!D.match(l)||!!D.match(c)||!!D.match(u)||!!D.match(h)||!!t.extractAttachments&&!!D.match(a)),y=m.find(D=>D.path.match(l)),x=y?so(y.content.toString()):{},b=m.find(D=>D.path.match(c));if(b){let D=ku(b.content.toString());Object.keys(D).length>0&&(x.customProperties=D)}let w=new Map,C=new Map,E=[],S=[],N=m.filter(D=>D.path.match(a)),k=m.find(D=>D.path.match(u)),M={};if(k){let D=le(k.content.toString()),F=ut(D,"Relationship");for(let P of F){let G=P.getAttribute("Id"),H=P.getAttribute("Target");G&&H&&(M[G]=H)}}let R=m.find(D=>D.path.match(s)),j={};if(R){let D=le(R.content.toString()),F=ut(D,"w:num"),P=ut(D,"w:abstractNum"),G={};for(let H of P){let V=H.getAttribute("w:abstractNumId");V&&(G[V]=H)}for(let H of F){let V=H.getAttribute("w:numId"),tt=pt(H,"w:abstractNumId")?.getAttribute("w:val");if(V&&tt&&G[tt]){j[V]={};let rt=ut(G[tt],"w:lvl");for(let ft of rt){let J=ft.getAttribute("w:ilvl"),st=pt(ft,"w:numFmt"),lt=pt(ft,"w:lvlText"),dt=pt(ft,"w:start");J&&(j[V][J]={numFmt:st?.getAttribute("w:val")||"decimal",lvlText:lt?.getAttribute("w:val")||"",start:parseInt(dt?.getAttribute("w:val")||"1",10)})}let at=ut(H,"w:lvlOverride");for(let ft of at){let J=ft.getAttribute("w:ilvl");if(J&&j[V][J]){let st=pt(ft,"w:startOverride");st&&(j[V][J].start=parseInt(st.getAttribute("w:val")||"1",10))}}}}}let $=m.find(D=>D.path.match(h)),q={};if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:styleId");if(G){let H=pt(P,"w:rPr"),V=pt(P,"w:pPr"),L=H?d(H):{},tt,rt,at;if(V){let ft=pt(V,"w:jc");if(ft){let lt=ft.getAttribute("w:val");(lt==="left"||lt==="center"||lt==="right"||lt==="justify")&&(tt=lt)}let J=pt(V,"w:shd");if(J){let lt=J.getAttribute("w:fill");lt&<!=="auto"&&(rt="#"+lt)}let st=f(V);st&&(at=st)}q[G]={formatting:L,alignment:tt,backgroundColor:rt,paragraphIndentation:at}}}}let Q={};if($){let D=le($.content.toString()),F=pt(D,"w:docDefaults");if(F){let P=pt(F,"w:rPrDefault");if(P){let G=pt(P,"w:rPr");G&&(Q=d(G))}}}let Z;if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:type"),H=P.getAttribute("w:default"),V=P.getAttribute("w:styleId");if(G==="paragraph"&&H==="1"&&V){Z=V;break}}!Z&&q.Normal&&(Z="Normal")}let Y=[],X=[],T={},I={},_=(D,F,P=[])=>{let G=pt(D,"w:numPr"),H=!!G,V=pt(D,"w:pPr"),tt=(V?pt(V,"w:pStyle"):null)?.getAttribute("w:val"),rt=tt?tt.startsWith("Heading")||tt==="Title":!1,at=tt&&q[tt]?q[tt]:{formatting:{}},ft=at.alignment;if(V){let mt=pt(V,"w:jc");if(mt){let ot=mt.getAttribute("w:val");(ot==="left"||ot==="center"||ot==="right"||ot==="justify")&&(ft=ot)}}let J=at.paragraphIndentation;if(V){let mt=f(V);mt&&(J={...J,...mt})}let st=at.backgroundColor;if(V){let mt=pt(V,"w:shd");if(mt){let ot=mt.getAttribute("w:fill");ot&&ot!=="auto"&&(st="#"+ot)}}let lt={...at.formatting};if(V){let mt=pt(V,"w:rPr");if(mt){let ot=d(mt);for(let ht in ot){let gt=ot[ht];gt===!1?delete lt[ht]:gt!==void 0&&(lt[ht]=gt)}}}let dt="",et=[],vt=mt=>{if(Oe(mt)&&mt.nodeName==="w:r"){let ot=mt,ht=pt(ot,"w:rPr"),gt={};for(let wt in lt)gt[wt]=lt[wt];let Et=ht?pt(ht,"w:rStyle"):null,Pt=Et?Et.getAttribute("w:val"):tt;if(Pt&&q[Pt])for(let wt in q[Pt].formatting)gt[wt]=q[Pt].formatting[wt];if(ht){let wt=d(ht);for(let kt in wt){let St=wt[kt];St===!1?delete gt[kt]:St!==void 0&&(gt[kt]=St)}}!gt.backgroundColor&&st&&(gt.backgroundColor=st);for(let wt of ot.childNodes)if(Oe(wt)){if(wt.tagName==="w:t"||wt.tagName==="t"){let kt=wt,St=kt.textContent||"";dt+=St;let O={type:"text",text:St,formatting:gt};t.includeRawContent&&(O.rawContent=ee(kt,F,t));let K=Pt||tt||Z;K&&(O.metadata={style:K}),et.push(O)}else if(t.includeBreakNodes&&(wt.tagName==="w:br"||wt.tagName==="br"||wt.tagName==="w:cr"||wt.tagName==="cr")){let kt=wt,St="textWrapping";if(wt.tagName==="w:cr"||wt.tagName==="cr")St="carriageReturn";else{let Tt=kt.getAttribute("w:type")||kt.getAttribute("type");Tt!==null&&(St=Tt)}let O;St==="textWrapping"&&kt.getAttribute("w:clear")!==null&&(O=kt.getAttribute("w:clear"));let K={type:"break",metadata:{breakType:St,clear:O}};t.includeRawContent&&(K.rawContent=ee(kt,F,t)),et.push(K)}else if(t.includeBreakNodes&&(wt.tagName==="w:lastRenderedPageBreak"||wt.tagName==="lastRenderedPageBreak")){let kt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(kt.rawContent=ee(wt,F,t)),et.push(kt)}}if(t.extractAttachments){let wt=ut(ot,"w:drawing"),kt=ut(ot,"w:pict"),St=[...wt,...kt];for(let O of St){let K=mx(O),Tt="",xt=pt(O,"wp:docPr");xt&&(Tt=xt.getAttribute("descr")||xt.getAttribute("title")||"");let Mt="",Ot=pt(O,"a:blip");if(Ot)Mt=Ot.getAttribute("r:embed")||"";else{let Yt=pt(O,"v:imagedata");Yt&&(Mt=Yt.getAttribute("r:id")||"")}if(Mt&&M[Mt]){let se=M[Mt].split("/").pop();if(se){let _n={type:"image",text:"",metadata:{attachmentName:se,altText:Tt}};t.includeRawContent&&(_n.rawContent=ee(O,F,t)),et.push(_n)}}else{let Yt={type:"image",text:""};t.includeRawContent&&(Yt.rawContent=ee(O,F,t)),et.push(Yt)}}}if(!t.ignoreNotes){let wt=pt(ot,"w:footnoteReference");if(wt){let St=wt.getAttribute("w:id");if(St&&w.has(St)){let O=w.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"footnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}let kt=pt(ot,"w:endnoteReference");if(kt){let St=kt.getAttribute("w:id");if(St&&C.has(St)){let O=C.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"endnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}}}else if(Oe(mt)&&mt.nodeName==="w:hyperlink"){let ot=mt,ht=ot.getAttribute("r:id"),gt=ot.getAttribute("w:anchor"),Et;gt&&!t.ignoreInternalLinks?Et={link:"#"+gt,linkType:"internal"}:ht&&M[ht]&&(Et={link:M[ht],linkType:"external"});let Pt=Array.from(ot.childNodes);for(let wt of Pt){let kt=et.length;if(vt(wt),Et)for(let St=kt;St<et.length;St++)et[St].type==="text"&&(et[St].metadata={...et[St].metadata??{},...Et})}}else if(Oe(mt)&&mt.nodeName==="w:bookmarkStart"){let ot=mt.getAttribute("w:name");ot&&!ot.startsWith("_GoBack")&&!t.ignoreInternalLinks&&bt.push(ot)}else if(Oe(mt)&&(mt.nodeName==="mc:AlternateContent"||mt.nodeName==="AlternateContent")){let ot=p(mt);for(let ht of ot)vt(ht)}else if(Oe(mt)&&(mt.nodeName==="w:pict"||mt.nodeName==="pict"||mt.nodeName==="w:drawing"||mt.nodeName==="drawing")){let ot=ut(mt,"w:txbxContent");for(let ht of ot){let gt=Array.from(ht.childNodes);for(let Et of gt)if(Oe(Et)&&Et.nodeName==="w:p"){let Pt=_(Et,F);et.push(...Pt.children||[]),dt+=Pt.text}}}else if(mt.childNodes.length>0)for(let ot of Array.from(mt.childNodes))vt(ot)},bt=[...P],Ft=Array.from(D.childNodes);for(let mt of Ft)vt(mt);let Ct=bt.length>0?{anchorIds:bt}:{};if(H){let mt=pt(G,"w:numId"),ot=pt(G,"w:ilvl"),ht=mt&&mt.getAttribute("w:val")||"0",gt=ot?parseInt(ot.getAttribute("w:val")||"0",10):0,Et="ordered",Pt=0;if(ht&&j[ht]){let kt=gt.toString();T[ht]||(T[ht]={}),T[ht][kt]||(T[ht][kt]=0),T[ht][kt]++;for(let O=gt+1;O<10;O++)T[ht][O.toString()]&&(T[ht][O.toString()]=0);Et=(j[ht][kt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",I[ht]||(I[ht]={}),I[ht][kt]===void 0?I[ht][kt]=(j[ht][kt]?.start??1)-1:I[ht][kt]++,Pt=I[ht][kt]}let wt={type:"list",text:dt,children:et,metadata:{listType:Et,indentation:gt,paragraphIndentation:J,alignment:ft||"left",listId:ht,itemIndex:Pt,style:tt,...Ct}};return t.includeRawContent&&(wt.rawContent=ee(D,F,t)),wt}else if(rt){let mt=tt&&parseInt(tt.replace("Heading",""),10)||1,ot={type:"heading",text:dt,children:et,metadata:{level:mt,alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(ot.rawContent=ee(D,F,t)),ot}else{let mt={type:"paragraph",text:dt,children:et,metadata:{alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(mt.rawContent=ee(D,F,t)),mt}},W=(D,F,P=[])=>{let G=[],H=Qe(D,"w:tr"),V=new Map;for(let L=0;L<H.length;L++){let tt=H[L],rt=[],at=Qe(tt,"w:tc"),ft=0;for(let st=0;st<at.length;st++){let lt=at[st],dt=pt(lt,"w:tcPr"),et=1;if(dt){let ht=pt(dt,"w:gridSpan");ht&&(et=parseInt(ht.getAttribute("w:val")||"1",10))}let vt=!1,bt=!1;if(dt){let ht=pt(dt,"w:vMerge");ht&&(bt=!0,(ht.getAttribute("w:val")==="restart"||!V.has(ft))&&(vt=!0))}let Ft=[],Ct="",mt=Array.from(lt.childNodes);for(let ht of mt)if(Oe(ht)&&ht.nodeName==="w:p"){let gt=_(ht,F);Ft.push(gt),Ct+=gt.text}else if(Oe(ht)&&ht.nodeName==="w:tbl"){let gt=W(ht,F);Ft.push(gt)}let ot={type:"cell",text:Ct,children:Ft,metadata:{row:L,col:ft}};if(et>1&&(ot.metadata.colSpan=et),bt)if(vt)V.set(ft,{node:ot,span:1}),rt.push(ot);else{let ht=V.get(ft);ht?(ht.span++,ht.node.metadata.rowSpan=ht.span,Ft.length>0&&(ht.node.children||(ht.node.children=[]),ht.node.children.push(...Ft),ht.node.text+=" "+Ct)):rt.push(ot)}else V.delete(ft),rt.push(ot);ft+=et}let J={type:"row",children:rt};G.push(J)}return{type:"table",children:G}};if(!t.ignoreNotes){let D=m.find(P=>P.path.match(n));if(D){let P=le(D.content.toString()),G=D.content.toString(),H=ut(P,"w:footnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");w.set(L,tt.map(rt=>_(rt,G)))}}let F=m.find(P=>P.path.match(i));if(F){let P=le(F.content.toString()),G=F.content.toString(),H=ut(P,"w:endnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");C.set(L,tt.map(rt=>_(rt,G)))}}}for(let D of m){if(D.path.match(a)||D.path.match(s)||D.path.match(u)||D.path.match(h)||D.path.match(n)||D.path.match(i))continue;let F=D.content.toString();t.includeRawContent&&X.push(F);let P=le(F,{locator:t.includeRawContent}),G=pt(P,"w:body");if(G){let H=Array.from(G.childNodes),V=[];for(let L of H)if(Oe(L)){if(L.nodeName==="w:p")Y.push(_(L,F,V)),V=[];else if(L.nodeName==="w:tbl")Y.push(W(L,F,V)),V=[];else if(L.nodeName==="w:bookmarkStart"){let tt=L.getAttribute("w:name");tt&&!tt.startsWith("_GoBack")&&!t.ignoreInternalLinks&&V.push(tt)}}}}if(t.extractAttachments){for(let D of N){let F=Mr(D.path.split("/").pop()||"image",D.content);if(S.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Ce("OCR_FAILED",t,F.name,P)}}if(t.ocr){let D=F=>{for(let P of F){if(P.type==="image"&&"attachmentName"in(P.metadata||{})){let G=P.metadata,H=S.find(V=>V.name===G.attachmentName);H&&H.ocrText&&(P.text=H.ocrText,H.altText=G.altText)}P.children&&D(P.children)}};D(Y)}}t.putNotesAtLast&&E.length>0&&Y.push(...E);let z=()=>Y.map(D=>{let F=P=>{let G="";return P.children?G+=P.children.map(F).filter(H=>H!="").join(P.children[0]?.children?t.newlineDelimiter:""):P.type==="break"?G+=t.newlineDelimiter:G+=P.text||"",G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An("docx",{...x,formatting:Q,styleMap:q},Y,S,t,z)};var Ka=class{static async parseOffice(t,e,n){let i,s={};typeof e=="function"?(i=e,s=n||{}):s=e||{};let a=pv(s),l=[],c=a.onWarning;a.onWarning=f=>{l.push(f),c&&c(f)};let u=ct.Buffer.alloc(0),h=a.fileType??"",d;try{if(!t)throw hn("IMPROPER_ARGUMENTS",a);if(t instanceof ArrayBuffer)u=ct.Buffer.from(t);else if(t instanceof Uint8Array)u=ct.Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(ct.Buffer.isBuffer(t))u=t;else if(typeof t=="string"){d=t,Ng("path-parsing");let p=await Promise.resolve().then(()=>(rN(),iN));if(!p.existsSync(t))throw hn("FILE_DOES_NOT_EXIST",a,t);if(p.lstatSync(t).isDirectory())throw hn("LOCATION_NOT_FOUND",a,t);u=p.readFileSync(t),h=h||t.split(".").pop()||""}else throw hn("INVALID_INPUT",a);if(u.length>0&&!h)try{let{fileTypeFromBuffer:p}=await _2(),m=await p(u);m&&(h=m.ext)}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}else if(u.length>0&&h)try{let{fileTypeFromBuffer:p}=await _2(),m=await p(u);m&&m.ext.toLowerCase()!==h.toLowerCase()&&Ce("BUFFER_TYPE_MISMATCH",a,{detected:m.ext,expected:h})}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}if(!h)throw hn("IMPROPER_BUFFERS",a);let f;switch(h.toLowerCase()){case"docx":f=await XD(u,a);break;case"pptx":f=await qD(u,a);break;case"xlsx":f=await HE(u,a);break;case"odt":case"odp":case"ods":f=await VE(u,a);break;case"pdf":f=await WD(u,a);break;case"rtf":f=await VD(u,a);break;case"csv":f=await Hv(u,a);break;case"html":f=await WE(u,a);break;case"md":f=await qE(u,a);break;default:throw hn("EXTENSION_UNSUPPORTED",a,h)}return f.warnings=l,i&&i(f),f}catch(f){let p=fv(f,a,d);throw i&&i(void 0,p),p}}static async terminateOcr(){await GE()}};B();var cg=class{static async convert(t,e,n){let i={...n?.parseConfig,onWarning:n?.onWarning||n?.parseConfig?.onWarning};i.ocr=!1,Object.keys(i).forEach(c=>i[c]===void 0&&delete i[c]),i.extractAttachments=n?.generatorConfig?.includeImages!==!1||n?.generatorConfig?.includeCharts!==!1;let s=await Ka.parseOffice(t,i),a={...n?.generatorConfig,onWarning:n?.onWarning||n?.generatorConfig?.onWarning},l=await Xs.generate(s,e,a);return l.messages=[...s.warnings||[],...l.messages],l}};var pF=Ka.parseOffice,mF=Ka.terminateOcr,gF=cg.convert,yF=Xs.generate;var bF=Ka;return hN(xF);})();
|
|
753
757
|
/*! Bundled license information:
|
|
754
758
|
|
|
755
759
|
ieee754/index.js:
|
|
@@ -704,14 +704,18 @@ ${i} </tr>
|
|
|
704
704
|
`}return n+=`\\f0\\fs24
|
|
705
705
|
`,n+=e,n+="}",{value:n,messages:this.messages}}async processNodeRecursive(e,n){let i=this.inTable;e.type==="table"&&(this.inTable=!0);let s=await super.processNodeRecursive(e,n);return this.inTable=i,s}async renderBody(e){let n="";this.inTable=!1;let i=async(s,a)=>{let l=this.getSemanticMapping(s);if(l){if(l.tag==="blockquote")return`${this.inTable?"\\pard\\intbl":"\\pard"}\\li720\\ri720\\sa120 ${a}\\par
|
|
706
706
|
`;let c=l.tag.match(/^h([1-6])$/);if(c){let u=parseInt(c[1]),h=24+(6-u)*4;return`${this.inTable?"\\pard\\intbl":"\\pard"}\\s${u}\\sb240\\sa120{\\b\\fs${h} ${a}}\\par
|
|
707
|
-
`}}switch(s.type){case"text":{let c=this.escapeRtf(s.text||""),u=s.formatting,h=s.metadata;if(this.config.includeFormatting&&u){let d="",f="";if(u.bold&&(d+="\\b ",f="\\b0 "+f),u.italic&&(d+="\\i ",f="\\i0 "+f),u.underline&&(d+="\\ul ",f="\\ul0 "+f),u.strikethrough&&(d+="\\strike ",f="\\strike0 "+f),u.color){let p=this.getColorIndex(u.color);d+=`\\cf${p+1} `}if(u.backgroundColor){let p=this.getColorIndex(u.backgroundColor);d+=`\\highlight${p+1} `}if(u.size){let p=parseInt(u.size);d+=`\\fs${p*2} `}c=`{\\
|
|
708
|
-
`}case"paragraph":{let c=this.inTable?"\\pard\\intbl":"\\pard";if(c+="\\sa120",this.config.includeFormatting&&s.metadata){let u=s.metadata;
|
|
709
|
-
`}case"list":{let c=s.metadata,u=
|
|
707
|
+
`}}switch(s.type){case"text":{let c=this.escapeRtf(s.text||""),u=s.formatting,h=s.metadata;if(this.config.includeFormatting&&u){let d="",f="";if(u.bold&&(d+="\\b ",f="\\b0 "+f),u.italic&&(d+="\\i ",f="\\i0 "+f),u.underline&&(d+="\\ul ",f="\\ul0 "+f),u.strikethrough&&(d+="\\strike ",f="\\strike0 "+f),u.color){let p=this.getColorIndex(u.color);d+=`\\cf${p+1} `}if(u.backgroundColor){let p=this.getColorIndex(u.backgroundColor);d+=`\\highlight${p+1} `}if(u.size){let p=parseInt(u.size);d+=`\\fs${p*2} `}c=`{\\f0 ${d}${c}${f}}`}if(h?.link){let d=h.linkType!=="external";if(!this.config.ignoreInternalLinks||!d)return`{\\field{\\*\\fldinst{HYPERLINK "${h.link}"}}{\\fldrslt ${c}}}`}return c}case"heading":{let u=s.metadata?.level||1,h=24+(6-u)*4;return`${this.inTable?"\\pard\\intbl":"\\pard"}\\s${u}\\sb240\\sa120{\\b\\fs${h} ${a}}\\par
|
|
708
|
+
`}case"paragraph":{let c=this.inTable?"\\pard\\intbl":"\\pard";if(c+="\\sa120",this.config.includeFormatting&&s.metadata){let u=s.metadata;u.alignment&&(u.alignment==="center"?c+="\\qc":u.alignment==="right"?c+="\\qr":u.alignment==="justify"&&(c+="\\qj"))}return`${c} ${a}\\par
|
|
709
|
+
`}case"list":{let c=s.metadata,u=c?.indentation||0,h=(u+1)*360,d=c?.listType==="ordered",f=d?`${(c.itemIndex??0)+1}. `:"\\bullet ",p=d?"\\pndec":"\\pnbullet";return`${this.inTable?"\\pard\\intbl":"\\pard"}\\li${h}\\fi-360\\ilvl${u}${p} ${f}${a}\\par
|
|
710
710
|
`}case"table":return`\\pard\\sa0
|
|
711
|
-
${a}`;case"row":return`\\trowd\\trgaph108\\trleft-108
|
|
711
|
+
${a}`;case"row":{let c=s.children||[],h=Math.floor(9e3/(c.length||1)),d="";for(let f=0;f<c.length;f++)d+=`\\clbrdrt\\brdrs\\brdrw10\\clbrdrl\\brdrs\\brdrw10\\clbrdrb\\brdrs\\brdrw10\\clbrdrr\\brdrs\\brdrw10\\cellx${(f+1)*h}`;return`\\trowd\\trgaph108\\trleft-108${d}
|
|
712
712
|
${a}\\row
|
|
713
|
-
|
|
714
|
-
`;case"
|
|
713
|
+
`}case"cell":return`\\pard\\intbl\\sb60\\sa60 ${a}\\cell
|
|
714
|
+
`;case"image":{if(!this.config.includeImages)return"";let u=s.metadata?.attachmentName,h=this.ast.attachments.find(d=>d.name===u);if(h&&h.data){let d=h.extension==="png"?"pngblip":"jpegblip",f=atob(h.data),p="";for(let m=0;m<f.length;m++){let y=f.charCodeAt(m).toString(16);p+=y.length===1?"0"+y:y,m%64===63&&(p+=`
|
|
715
|
+
`)}return`{\\pict\\${d}\\picwgoal4320\\pichgoal3240
|
|
716
|
+
${p}
|
|
717
|
+
}
|
|
718
|
+
`}return""}case"break":return s.metadata?.breakType==="page"?`\\page
|
|
715
719
|
`:`\\line
|
|
716
720
|
`;default:return a}};for(let s of e.content)n+=await this.processNodeRecursive(s,i);return n}getColorIndex(e){let n=e.toUpperCase(),i=this.colorTable.indexOf(n);return i===-1&&(i=this.colorTable.length,this.colorTable.push(n)),i}escapeRtf(e){return e.replace(/\\/g,"\\\\").replace(/{/g,"\\{").replace(/}/g,"\\}").replace(/[^\x00-\x7F]/g,n=>`\\u${n.charCodeAt(0)}?`)}};B();var kg=class extends qn{constructor(t,e){super("text",t,e)}async generate(){let t="",e=this.config.textConfig.newlineDelimiter;this.config.renderMetadata&&this.ast.metadata&&(this.ast.metadata.title&&(t+=`Title: ${this.ast.metadata.title}${e}`),this.ast.metadata.author&&(t+=`Author: ${this.ast.metadata.author}${e}`),this.ast.metadata.created&&(t+=`Created: ${new Date(this.ast.metadata.created).toLocaleString()}${e}`),t+=`-------------------${e}${e}`);let n=async(i,s)=>{if(i.type==="text"||i.type==="code")return i.text||"";if(i.type==="break")return e;if(i.type==="image"){if(!this.config.includeImages)return"";let l=i.metadata;return`[Image: ${l?.altText||l?.attachmentName||"Untitled"}]${e}`}if(i.type==="table"&&this.config.textConfig.preserveLayout)return await this.renderTable(i,n,e);if(i.type==="list"&&this.config.textConfig.preserveLayout){let l=i.metadata,u=" ".repeat(4).repeat(l?.indentation||0),h=l?.listType==="ordered"?`${(l.itemIndex??0)+1}. `:"- ";return`${u}${h}${s.trimStart()}`+(s.endsWith(e)?"":e)}return["paragraph","heading","row","sheet","slide","note","list","table","code"].includes(i.type)?s.trim()===""?"":s+(s.endsWith(e)?"":e):s};for(let i of this.ast.content)t+=await this.processNodeRecursive(i,n);return{value:t.trim(),messages:this.messages}}async renderTable(t,e,n){if(!t.children||t.children.length===0)return"";let i=[],s=[];for(let l of t.children){let c=await this.handleOnNode(l);if(c===!1)continue;if(typeof c=="string"){i.push([c]);continue}let u=[];if(l.children)for(let h=0;h<l.children.length;h++){let d=l.children[h],f=(await this.processNodeRecursive(d,e)).trim().replace(/\r?\n/g," ");u.push(f),s[h]=Math.max(s[h]||0,f.length)}i.push(u)}let a=n;for(let l of i){a+="| ";for(let c=0;c<l.length;c++)a+=(l[c]||"").padEnd(s[c]||0)+" | ";a+=n}return a+n}};var Ka=class{static async generate(t,e,n){switch(e.toLowerCase()){case"text":return new kg(t,n).generate();case"md":return new Tg(t,n).generate();case"html":return new hu(t,n).generate();case"pdf":return new Ng(t,n).generate();case"csv":return new Eg(t,n).generate();case"rtf":return new Ig(t,n).generate();case"chunks":return new gg(t,n).generate();default:throw hn("EXTENSION_UNSUPPORTED",void 0,e)}}};function An(r,t,e,n,i,s){return{config:i,type:r,metadata:t,content:e,attachments:n,warnings:[],toText:s,async to(a,l){return Ka.generate(this,a,l)}}}var Gv=async(r,t)=>{let e=r.toString("utf-8"),n=t.csvDelimiter,i=[],s=[],a="",l=!1;for(let f=0;f<e.length;f++){let p=e[f],m=e[f+1];l?p==='"'?m==='"'?(a+='"',f++):l=!1:a+=p:p==='"'?l=!0:e.substring(f,f+n.length)===n?(s.push(a),a="",f+=n.length-1):p===`
|
|
717
721
|
`?(s.push(a),i.push(s),s=[],a=""):p==="\r"||(a+=p)}(a!==""||s.length>0)&&(s.push(a),i.push(s)),i.length>0&&i[i.length-1].length===1&&i[i.length-1][0]===""&&i.pop();let c=[];i.forEach((f,p)=>{if(f.length===1&&f[0].startsWith("#")){c.push({type:"comment",text:f[0]});return}let m=[];f.forEach((y,x)=>{if(y&&y.trim()!==""){let b={row:p,col:x};m.push({type:"cell",text:y,metadata:b,children:[{type:"text",text:y}]})}}),m.length>0&&c.push({type:"row",children:m})});let h={type:"sheet",metadata:{sheetName:"Sheet1"},children:c,rawContent:t.includeRawContent?e:void 0};return An("csv",{title:"Sheet1"},[h],[],t,()=>i.map(f=>f.filter(p=>p.trim()!=="").join(t.newlineDelimiter)).join(t.newlineDelimiter).replace(/\n{3,}/g,`
|
|
@@ -749,7 +753,7 @@ ${x}
|
|
|
749
753
|
`})))}}}return W.filter(V=>V.text?.trim()||V.children&&V.children.length>0)};function q(T,I,_){let W=[];for(let z of Array.from(T?.childNodes||[])){if(!Oe(z))continue;let D=z,F=D.tagName;if(F==="p:sp")W.push(...$(D,I,_));else if(F==="p:pic"){let P=M(D,I,_);P&&W.push(P)}else if(F==="p:graphicFrame"){let P=j(D,I,_);P&&W.push(P)}else if(F==="p:grpSp"){let P=pt(D,"p:spTree");P&&W.push(...q(P,I,_))}}return W}for(let T of h)if(T.path.match(i)){let I=T.path.match(/slide(\d+)\.xml\.rels/);if(I){let _=parseInt(I[1]);x[_]={};let W=le(T.content.toString()),z=ut(W,"Relationship");for(let D=0;D<z.length;D++){let F=z[D].getAttribute("Id"),P=z[D].getAttribute("Type"),G=z[D].getAttribute("Target");if(F&&P&&G){let H="other";P.includes("relationships/image")?H="image":P.includes("relationships/hyperlink")?H="hyperlink":P.includes("relationships/chart")?H="chart":P.includes("relationships/slide")?H="slide":P.includes("relationships/notesSlide")&&(H="notes");let V=G;G.startsWith("http://")||G.startsWith("https://")||(V=V.split("/").pop()||""),x[_][F]={type:H,target:V}}}}}for(let T of h){if(T.path.match(a)||T.path.match(l)||T.path.match(i)||T.path.match(c))continue;let I=T.content.toString(),_=le(I,{locator:t.includeRawContent});t.includeRawContent&&y.push(I);let W=T.path.match(s),z=W?parseInt(W[1]):0,D=T.path.includes("notesSlide"),F={type:D?"note":"slide",children:[],metadata:{slideNumber:z,...D?{noteId:`slide-note-${z}`}:{}}};t.includeRawContent&&(F.rawContent=ee(_,I,t));let P=pt(_,"p:spTree");P&&F.children?.push(...q(P,z,I)),F.children&&F.children.length>0&&m.push(F)}let Q=[],Z=h.filter(T=>T.path.match(/ppt\/media\/.*/)),Y=h.filter(T=>T.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let I of Z){let _=Mr(I.path.split("/").pop()||"image",I.content);if(Q.push(_),t.ocr&&_.mimeType.startsWith("image/"))try{_.ocrText=(await lr(I.content,{...t.ocrConfig})).trim()}catch(W){Ce("OCR_FAILED",t,_.name,W)}}for(let I of Y){let _={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:I.content.toString("base64"),name:I.path.split("/").pop()||"",extension:"xml"};Q.push(_);try{let W=await dl(I.content);_.chartData=W}catch(W){Ce("CHART_DATA_EXTRACTION_FAILED",t,I.path,W)}}let T=I=>{for(let _ of I){if("attachmentName"in(_.metadata||{})){let W=_.metadata,z=Q.find(D=>D.name===W.attachmentName);z&&(_.type==="image"&&(z.altText=W.altText,z.ocrText&&(_.text=z.ocrText)),_.type==="chart"&&(_.text=z.chartData?.rawTexts.join(t.newlineDelimiter)))}_.children&&T(_.children)}};T(m)}return!t.ignoreNotes&&t.putNotesAtLast&&m.sort((T,I)=>{let _=T.type==="note"?1:0,W=I.type==="note"?1:0;return _-W}),An("pptx",f,m,Q,t,()=>m.map(T=>{let I=_=>{let W="";return _.children?W+=_.children.map(I).filter(z=>z!="").join(_.children[0]?.children?t.newlineDelimiter:""):W+=_.text||"",W};return I(T)}).filter(T=>T!="").join(t.newlineDelimiter))};B();var lF={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},cF={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},k2=class{constructor(t){U(this,"index",0);U(this,"buffer");U(this,"codePage",1252);U(this,"decoders",{});U(this,"pendingBytes",[]);U(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index<this.length;){let n=this.buffer[this.index],i=e[e.length-1];if(n===123){this.index++,this.flushPendingText(i);let s={type:"group",content:[]};i.content.push(s),e.push(s)}else n===125?(this.index++,this.flushPendingText(i),e.length>1&&e.pop()):n===92?(this.index++,this.parseControl(i)):n===13||n===10?this.index++:this.parseText(i)}return this.flushPendingText(t),t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){this.pendingBytes.push(e),this.index++;return}if(e===39){if(this.index++,this.index+1<this.length){let l=String.fromCharCode(this.buffer[this.index],this.buffer[this.index+1]),c=parseInt(l,16);isNaN(c)||this.pendingBytes.push(c),this.index+=2}return}if(this.flushPendingText(t),e===42){t.content.push({type:"control",value:"*"}),this.index++;return}let n="";for(;this.index<this.length;){let l=this.buffer[this.index];if(l>=97&&l<=122||l>=65&&l<=90)n+=String.fromCharCode(l),this.index++;else break}let i,s=!1,a="";for(this.index<this.length&&this.buffer[this.index]===45&&(a+="-",this.index++);this.index<this.length;){let l=this.buffer[this.index];if(l>=48&&l<=57)a+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(i=parseInt(a,10)),n!==""&&this.index<this.length&&this.buffer[this.index]===32&&this.index++,n==="bin"&&i!==void 0&&i>0){this.index+=i;return}n==="ansicpg"&&i!==void 0?this.codePage=i:n==="ansi"?this.codePage=1252:n==="mac"?this.codePage=1e4:n==="pc"?this.codePage=437:n==="pca"&&(this.codePage=850),t.content.push({type:"control",value:n,param:i}),(t.content.length===1&&t.type==="group"||t.content.length===2&&t.content[0].type==="control"&&t.content[0].value==="*")&&(t.destination=n)}parseText(t){for(;this.index<this.length;){let e=this.buffer[this.index];if(e===void 0||e===123||e===125||e===92||e===13||e===10)break;this.pendingBytes.push(e),this.index++}}flushPendingText(t){this.pendingBytes.length>0&&(t.content.push({type:"text",value:this.decodeBytes(this.pendingBytes,this.codePage)}),this.pendingBytes=[])}decodeBytes(t,e){let n=new Uint8Array(t);if(t.some(s=>s>127))try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{}if(!this.decoders[e]){let s=`windows-${e}`;e===1e4?s="macintosh":e===437?s="ibm437":e===850&&(s="ibm850");try{this.decoders[e]=new TextDecoder(s)}catch{if(e!==1252)try{this.decoders[e]=new TextDecoder("windows-1252")}catch{return String.fromCharCode(...t)}else return String.fromCharCode(...t)}}let i=this.decoders[e].decode(n);if(e===1252&&/[\u0080-\u009F]/.test(i)){let s={"\x80":"\u20AC","\x82":"\u201A","\x83":"\u0192","\x84":"\u201E","\x85":"\u2026","\x86":"\u2020","\x87":"\u2021","\x88":"\u02C6","\x89":"\u2030","\x8A":"\u0160","\x8B":"\u2039","\x8C":"\u0152","\x8E":"\u017D","\x91":"\u2018","\x92":"\u2019","\x93":"\u201C","\x94":"\u201D","\x95":"\u2022","\x96":"\u2013","\x97":"\u2014","\x98":"\u02DC","\x99":"\u2122","\x9A":"\u0161","\x9B":"\u203A","\x9C":"\u0153","\x9E":"\u017E","\x9F":"\u0178"};return i.replace(/[\u0080-\u009F]/g,a=>s[a]||a)}return i}},qD=async(r,t)=>{let n=new k2(r).parse(),i=uF(n),s=hF(n),a=[],l=[],c=[],u=[],h=[],d=[],f=[],p={},m=a,y=0,x="left",b=!1,w,C,E,S=[],N,k,M=[],R=0,j=0,$=()=>M.length>0?M[M.length-1]:void 0,q=()=>{M.length===0&&M.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},Q=!1,Z=!1,Y=0,X=[],T={isMergedContinuation:!1},I=0,_=0,W={},z=!1,D=!1,F,P,G={},H=!1,V,L,tt={},rt={},at,ft=(O,K)=>O.bold!==K.bold||O.italic!==K.italic||O.underline!==K.underline||O.strikethrough!==K.strikethrough||O.size!==K.size||O.font!==K.font||O.color!==K.color||O.backgroundColor!==K.backgroundColor||O.subscript!==K.subscript||O.superscript!==K.superscript,J=()=>{if(f.length>0){let O=f.join(""),K={type:"text",text:O,formatting:{...p}};at&&(K.metadata={link:at,linkType:Ft(at)}),h.push(K),u.push(O),f=[]}},st=!1,lt=()=>{J();let O=u.length>0||h.length>0;if(Q&&!Z&&!st&&O){let K=[...u],Tt=[...h],xt=[...d];u=[],h=[],d=[],vt(),u=K,h=Tt,d=xt}if(O){let K=u.join(""),Tt="paragraph",xt;if(C===void 0&&h.length>0){let Ot=h[0];if(Ot.type==="text"&&Ot.formatting?.bold){let Yt=parseInt(Ot.formatting.size||"12");Yt>=14&&K.length<300&&(Yt>=22?C=1:Yt>=18?C=2:Yt>=16?C=3:C=4)}}if(!b&&y>300){let Ot=K.trim();(/^[\u2022\u00b7\-\u25cf\u25cb]/.test(Ot)||/^\d+[.\)]/.test(Ot))&&(b=!0,w=/^\d+[.\)]/.test(Ot)?"ordered":"unordered")}if(C!==void 0&&C>0)Tt="heading",xt={level:C},N=void 0,k=void 0;else if(b){Tt="list";let Ot=E||N,Yt=w||k||"unordered",se=0;if(Ot){rt[Ot]||(rt[Ot]={});let _n=Object.keys(rt[Ot]).map($s=>parseInt($s));for(let $s of _n)$s>y&&delete rt[Ot][$s];rt[Ot][y]===void 0?rt[Ot][y]=0:rt[Ot][y]++,se=rt[Ot][y]}xt={listType:Yt,indentation:y,listId:Ot||"",itemIndex:se,alignment:x},Ot&&(N=Ot),Yt&&(k=Yt)}let Mt={type:Tt,text:K,children:h,formatting:void 0,metadata:{...xt,anchorIds:S.length>0?[...S]:void 0}};t.includeRawContent&&d.length>0&&(Mt.rawContent=d.join("")),Q&&Z?(q(),$().currentCellContent.push(Mt)):m.push(Mt),u=[],h=[],d=[],S=[]}},dt=O=>{lt();let K=O||$();if(!K)return;let Tt={type:"cell",text:K.currentCellContent.map(xt=>xt.text).join(`
|
|
750
754
|
`),children:[...K.currentCellContent],metadata:{row:K.rowIndex,col:K.currentCells.length}};return K.currentCellContent=[],Tt},et=O=>{let K=O||$();if(!K)return;let Tt=dt(K);if(Tt&&(Tt.children&&Tt.children.length>0||Tt.text)&&K.currentCells.push(Tt),K.currentCells.length>0){let xt={type:"row",text:K.currentCells.map(Mt=>Mt.text).filter(Mt=>Mt!=="").join(t.newlineDelimiter),children:[...K.currentCells]};K.rows.push(xt),K.currentCells=[],K.rowIndex++}},vt=()=>{if(st)return;st=!0;let O=$();if(!O){st=!1;return}if(et(O),O.rows.length>0){Y++;let K={type:"table",text:O.rows.map(Tt=>Tt.text).join(`
|
|
751
755
|
`),children:[...O.rows]};M.length>1?M[M.length-2].currentCellContent.push(K):m.push(K)}M.pop(),M.length===0&&(Q=!1,Z=!1),st=!1},bt=O=>{let K,Tt=xt=>{if(xt.type==="text"){let Mt=xt.value,Ot=Mt.match(/HYPERLINK\s+"([^"]+)"/i);if(Ot)return Ot[1];let Yt=Mt.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(Yt)return Yt[1]}else if(xt.type==="group"){let Mt=!1,Ot,Yt=!1;for(let se of xt.content)if(se.type==="text"){let _n=se.value.toUpperCase();_n.includes("HYPERLINK")&&(Mt=!0),_n.includes("\\L")&&(Yt=!0);let $s=se.value.match(/"([^"]+)"/);$s&&Mt&&(Ot=$s[1])}else if(se.type==="group"){let _n=Tt(se);_n&&(Ot=_n)}if(Ot)return Yt&&!Ot.startsWith("#")?"#"+Ot:Ot}};for(let xt of O.content)if(xt.type==="group"){let Mt=Tt(xt);if(Mt)return Mt}return K},Ft=O=>{let K=O.trim();return K.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(K)?"internal":"external"},Ct=O=>{let K="",Tt=xt=>{if(xt.type==="text")K+=xt.value;else if(xt.type==="group")for(let Mt of xt.content)Tt(Mt)};for(let xt of O.content)Tt(xt);return K},mt=O=>{let K,Tt=[];for(let Ot of O.content)if(Ot.type==="control"){let Yt=lF[Ot.value];Yt&&(K=Yt)}else Ot.type==="text"?Tt.push(Ot.value.replace(/[^0-9a-fA-F]/g,"")):Ot.type;let xt=Tt.join("");if(!K||xt.length===0)return;let Mt=cF[K];if(Mt)try{let Ot=ct.Buffer.from(xt,"hex"),Yt=K,se=`image_${c.length+1}.${Yt}`;return{type:"image",mimeType:Mt,data:Ot.toString("base64"),name:se,extension:Yt}}catch{return}},ot=O=>{if(!/^[a-zA-Z]/.test(O.value))return`\\${O.value}`;let K=`\\${O.value}`;return O.param!==void 0&&(K+=O.param),K+=" ",K},ht=O=>{let K="";for(let Tt of O.content)Tt.type==="text"?K+=Tt.value:Tt.type==="group"&&(K+=ht(Tt));return K.trim()},gt=O=>O.value.replace(/([\\{}])/g,"\\$1"),Et=(O,K,Tt=0)=>{if(O.type==="group"){let xt=["fonttbl","colortbl","stylesheet","info","macpict","pmmetafile","wmetafile","dibitmap","bitmap","object","nextGenerator","header","footer","nonshppict","xml","private","upnp","ud","filetbl","operator","author","creatim","revtim","printim","comment","fldinst","listtext","pntext"],Mt=!1,Ot=!1,Yt=!1,se=!1;if(O.destination){if(O.destination==="footnote")Ot=!0;else if(O.destination==="field"){let Ye=bt(O);Ye&&(J(),Yt=!0,at=Ye)}else if(O.destination==="listtable")z=!0;else if(z&&O.destination==="list")D=!0,F=void 0,P=void 0;else if(O.destination==="listoverridetable")H=!0;else if(H&&O.destination==="listoverride")V=void 0,L=void 0;else if(O.destination==="pict")t.extractAttachments?se=!0:Mt=!0;else if(xt.includes(O.destination))Mt=!0;else if(O.content.length>0&&O.content[0].type==="control"&&O.content[0].value==="*"){let Ye=["fldinst","nesttableprops"];if(t.extractAttachments&&Ye.push("shppict","listpicture"),!Ye.includes(O.destination||""))if(O.destination==="bkmkstart"){let Ke=ht(O);Ke&&!S.includes(Ke)&&S.push(Ke),Mt=!0}else O.destination,Mt=!0}}if(O.destination==="listtext"||O.destination==="pntext"){b||(y=0),b=!0;let Ye=Ct(O);if(Ye){let Ke=Ye.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Va=>Ke.includes(Va))||Ke.length===1&&!/[0-9a-zA-Z]/.test(Ke)?w="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(Ke)||/^[a-z][\.\)]/i.test(Ke))&&(w="ordered")}Mt=!0}if(Mt)return;if(d.push("{"),se){let Ye=mt(O);Ye&&(c.push(Ye),!z&&!D&&(lt(),m.push({type:"image",text:"",metadata:{attachmentName:Ye.name||`image_${c.length}`}})));for(let Ke of O.content)if(Ke.type==="control")d.push(ot(Ke));else if(Ke.type==="text")d.push(gt(Ke));else if(Ke.type==="group"){let nu=er=>{for(let Va of er.content)Va.type==="control"?d.push(ot(Va)):Va.type==="text"?d.push(gt(Va)):Va.type==="group"&&(d.push("{"),nu(Va),d.push("}"))};nu(O)}d.push("}");return}let _n=m;if(Ot){if(t.ignoreNotes)return;lt(),R++;let Ye="footnote";j===1?Ye="endnote":j===2&&(Ye=O.content.some(er=>er.type==="control"&&er.value==="ftnalt")?"endnote":"footnote");let Ke={type:"note",children:[],metadata:{noteId:R.toString(),noteType:Ye}};l.push(Ke),m=Ke.children}let $s={...K};for(let Ye of O.content){if(Ye.type==="group"&&Ye.destination==="fldinst"){d.push("{");let Ke=nu=>{for(let er of nu.content)er.type==="control"?d.push(ot(er)):er.type==="text"?d.push(gt(er)):er.type==="group"&&(d.push("{"),Ke(er),d.push("}"))};Ke(Ye),d.push("}");continue}Et(Ye,$s,Tt+1)}O.destination==="listtable"?z=!1:O.destination==="list"?(D=!1,F!==void 0&&P!==void 0&&(G[F]=P)):O.destination==="listoverridetable"?H=!1:H&&O.destination==="listoverride"&&L!==void 0&&V!==void 0&&(tt[L]=V),Ot&&(lt(),m=_n),Yt&&(J(),at=void 0),d.push("}")}else if(O.type==="text"){if(z||H){d.push(gt(O));return}ft(p,K)&&(J(),p={...K}),f.push(O.value),d.push(gt(O))}else if(O.type==="control"){if(d.push(ot(O)),z){if(O.value==="listid")F=O.param;else if(O.value==="levelnfc"||O.value==="levelnfcn"){let xt=O.param!==void 0&&(O.param===0||O.param>=0&&O.param<=4);(!P||P==="unordered"&&xt)&&(P=xt?"ordered":"unordered")}return}if(H){O.value==="listid"?V=O.param:O.value==="ls"&&(L=O.param);return}if(O.value==="par")lt(),p={...K};else if(O.value==="trowd"){let xt=$();Q&&xt&&xt.currentCellContent.length>0?(q(),M.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):Q||(Q=!0,q()),Z=!0,X=[],T={isMergedContinuation:!1},I=0}else if(O.value==="clvmrg")T.isMergedContinuation=!0;else if(O.value==="clmgf")T.isMergedContinuation=!1;else if(O.value==="cellx")X.push({...T}),T={isMergedContinuation:!1};else if(O.value==="cell"){Z=!0;let xt=!1;I<X.length&&(xt=X[I].isMergedContinuation),I++;let Mt=dt();if(Mt&&!xt){let Ot=$();Ot&&Ot.currentCells.push(Mt)}p={...K}}else if(O.value==="nestcell"){if(M.length>1){let Mt=$();Mt&&(Mt.rows.length>0||Mt.currentCells.length>0)&&vt()}Z=!0;let xt=dt();if(xt){let Mt=$();Mt&&Mt.currentCells.push(xt)}p={...K}}else if(O.value==="row")et(),p={...K},I=0,Z=!1;else if(O.value==="nestrow")M.length>1&&vt(),et(),p={...K},I=0;else if(O.value==="intbl")Q=!0,Z=!0,q();else if(O.value==="pard")Z=!1,y=0,x="left",b=!1,w=void 0,C=void 0,E=void 0,K.backgroundColor=void 0;else if(O.value==="tab")ft(p,K)&&(J(),p={...K}),f.push(" ");else if(O.value==="line")ft(p,K)&&(J(),p={...K}),f.push(`
|
|
752
|
-
`);else if(O.value==="lquote")ft(p,K)&&(J(),p={...K}),f.push("\u2018");else if(O.value==="rquote")ft(p,K)&&(J(),p={...K}),f.push("\u2019");else if(O.value==="ldblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201C");else if(O.value==="rdblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201D");else if(O.value==="u"){if(O.param!==void 0){let xt=O.param;xt<0&&(xt+=65536),ft(p,K)&&(J(),p={...K}),f.push(String.fromCharCode(xt))}}else if(O.value==="b")K.bold=O.param!==0;else if(O.value==="i")K.italic=O.param!==0;else if(O.value==="ul")K.underline=O.param!==0;else if(O.value==="ulnone")K.underline=!1;else if(O.value==="strike")K.strikethrough=O.param!==0;else if(O.value==="plain")K.bold=!1,K.italic=!1,K.underline=!1,K.strikethrough=!1,K.subscript=!1,K.superscript=!1,K.size=void 0,K.font=void 0,K.color=void 0,K.backgroundColor=void 0;else if(O.value==="fs")O.param!==void 0&&(K.size=(O.param/2).toString()+"pt");else if(O.value==="f")O.param!==void 0&&i[O.param]&&(K.font=i[O.param]);else if(O.value==="cf")O.param!==void 0&&s[O.param]&&(K.color=s[O.param]);else if(O.value==="fet")O.param!==void 0&&(j=O.param);else if(O.value==="cb"||O.value==="highlight"||O.value==="chcbpat"||O.value==="cbpat")O.param!==void 0&&s[O.param]&&(K.backgroundColor=s[O.param]);else if(O.value==="sub")K.subscript=!0,K.superscript=!1;else if(O.value==="super")K.superscript=!0,K.subscript=!1;else if(O.value==="nosupersub")K.subscript=!1,K.superscript=!1;else if(O.value==="li"){if(O.param!==void 0){let xt=Math.round(O.param/720);b||(y=xt)}}else if(O.value==="ls"){if(O.param!==void 0){b||(y=0),b=!0,W[O.param]||(_++,W[O.param]=`rtf-list-${_}`),E=W[O.param];let xt=tt[O.param]!==void 0?tt[O.param]:O.param;G[xt]&&(w=G[xt])}}else O.value==="ilvl"?O.param!==void 0&&(b=!0,y=O.param):O.value==="pnlvl"?(b=!0,O.param!==void 0&&(y=O.param)):O.value==="levelnfc"||O.value==="pnf"?O.param!==void 0&&(b=!0,O.param===23?w="unordered":w="ordered"):O.value==="pndec"||O.value==="pnord"||O.value==="pnlcltr"||O.value==="pnucltr"?(b||(y=0),b=!0,w="ordered"):O.value==="pnbullet"||O.value==="pncard"?(b||(y=0),b=!0,w="unordered"):O.value==="s"?O.param!==void 0&&O.param>=1&&O.param<=9&&(C=O.param):O.value==="ql"?x="left":O.value==="qc"?x="center":O.value==="qr"?x="right":O.value==="qj"&&(x="justify")}};Et(n,{});let Pt=$();if((Q||Pt&&(Pt.rows.length>0||Pt.currentCells.length>0))&&vt(),lt(),!t.putNotesAtLast&&l.length>0&&(a.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let K of c)if(K.mimeType.startsWith("image/"))try{let Tt=ct.Buffer.from(K.data,"base64");K.ocrText=(await lr(Tt,{...t.ocrConfig})).trim()}catch(Tt){Ce("OCR_FAILED",t,K.name,Tt)}let O=K=>{for(let Tt of K){if(Tt.type==="image"&&Tt.metadata&&"attachmentName"in Tt.metadata){let xt=Tt.metadata,Mt=c.find(Ot=>Ot.name===xt.attachmentName);Mt&&(Mt.ocrText&&(Tt.text=Mt.ocrText),Mt.altText&&(xt.altText=Mt.altText))}Tt.children&&O(Tt.children)}};O(a)}let wt=O=>{for(let K of O){if(K.type==="note"&&K.children){let Tt=xt=>xt.children&&xt.children.length>0?xt.children.map(Tt).join(""):xt.text||"";K.text=K.children.map(Tt).join("").trim()}K.children&&wt(K.children)}};wt(a),wt(l);let St=An("rtf",{},a,c,t,()=>{let O=a.map(K=>K.text).join(t.newlineDelimiter);return t.putNotesAtLast&&l.length>0&&(O+=t.newlineDelimiter+l.map(K=>K.text).join(t.newlineDelimiter)),O});return t.putNotesAtLast&&l.length>0&&a.push(...l),St};function _2(r,t){for(let e of r.content)if(e.type==="group"){if(e.destination===t)return e;let n=_2(e,t);if(n)return n}return null}function uF(r){let t={},e=_2(r,"fonttbl");if(e){for(let n of e.content)if(n.type==="group"){let i,s="";for(let a of n.content)a.type==="control"&&a.value==="f"?i=a.param:a.type==="text"&&(s+=a.value);i!==void 0&&s&&(t[i]=s.replace(/;$/,"").trim())}}return t}function hF(r){let t={},e=_2(r,"colortbl");if(e){let n=0,i=0,s=0,a=0;for(let l of e.content)if(l.type==="control")l.value==="red"&&l.param!==void 0?i=l.param:l.value==="green"&&l.param!==void 0?s=l.param:l.value==="blue"&&l.param!==void 0&&(a=l.param);else if(l.type==="text"&&l.value===";"){let c=`#${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`;t[n]=c,n++,i=0,s=0,a=0}}return t}B();var VD=async(r,t)=>{let e=/word\/document[\d+]?.xml/,n=/word\/footnotes[\d+]?.xml/,i=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,a=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=D=>{let F={},P=(dt,et)=>{let vt=pt(dt,et);if(vt){let bt=vt.getAttribute("w:val");return bt===null?!0:bt==="1"||bt==="true"||bt==="on"}return null},G=P(D,"w:b");G!==null&&(F.bold=G);let H=P(D,"w:i");H!==null&&(F.italic=H);let V=pt(D,"w:u");if(V){let dt=V.getAttribute("w:val");(!dt||dt!=="none")&&(F.underline=!0)}let L=P(D,"w:strike"),tt=P(D,"w:dstrike");L!==null?F.strikethrough=L:tt!==null&&(F.strikethrough=tt);let rt=pt(D,"w:sz");if(rt){let dt=rt.getAttribute("w:val");dt&&(F.size=(parseInt(dt,10)/2).toString()+"pt")}let at=pt(D,"w:color");if(at){let dt=at.getAttribute("w:val");dt&&dt!=="auto"&&(F.color="#"+dt)}let ft=pt(D,"w:shd");if(ft){let dt=ft.getAttribute("w:fill");dt&&dt!=="auto"&&(F.backgroundColor="#"+dt)}let J=pt(D,"w:highlight");if(J){let dt=J.getAttribute("w:val");if(dt&&dt!=="none"){let et={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};F.backgroundColor=et[dt]||dt}}let st=pt(D,"w:rFonts");if(st){let dt=st.getAttribute("w:ascii")||st.getAttribute("w:hAnsi");dt&&(F.font=dt)}let lt=pt(D,"w:vertAlign");if(lt){let dt=lt.getAttribute("w:val");dt==="subscript"?F.subscript=!0:dt==="superscript"&&(F.superscript=!0)}return F},f=D=>{let F=pt(D,"w:ind");if(F){let P={},G=F.getAttribute("w:left")||F.getAttribute("w:start"),H=F.getAttribute("w:right")||F.getAttribute("w:end"),V=F.getAttribute("w:firstLine"),L=F.getAttribute("w:hanging");return G&&(P.left=parseInt(G,10)),H&&(P.right=parseInt(H,10)),V&&(P.firstLine=parseInt(V,10)),L&&(P.hanging=parseInt(L,10)),Object.keys(P).length>0?P:void 0}},p=D=>{let F=pt(D,"mc:Choice");if(F)return Array.from(F.childNodes);let P=pt(D,"mc:Fallback");return Array.from(P?P.childNodes:D.childNodes)},m=await ro(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(i)||!!D.match(s)||!!D.match(l)||!!D.match(c)||!!D.match(u)||!!D.match(h)||!!t.extractAttachments&&!!D.match(a)),y=m.find(D=>D.path.match(l)),x=y?no(y.content.toString()):{},b=m.find(D=>D.path.match(c));if(b){let D=ku(b.content.toString());Object.keys(D).length>0&&(x.customProperties=D)}let w=new Map,C=new Map,E=[],S=[],N=m.filter(D=>D.path.match(a)),k=m.find(D=>D.path.match(u)),M={};if(k){let D=le(k.content.toString()),F=ut(D,"Relationship");for(let P of F){let G=P.getAttribute("Id"),H=P.getAttribute("Target");G&&H&&(M[G]=H)}}let R=m.find(D=>D.path.match(s)),j={};if(R){let D=le(R.content.toString()),F=ut(D,"w:num"),P=ut(D,"w:abstractNum"),G={};for(let H of P){let V=H.getAttribute("w:abstractNumId");V&&(G[V]=H)}for(let H of F){let V=H.getAttribute("w:numId"),tt=pt(H,"w:abstractNumId")?.getAttribute("w:val");if(V&&tt&&G[tt]){j[V]={};let rt=ut(G[tt],"w:lvl");for(let ft of rt){let J=ft.getAttribute("w:ilvl"),st=pt(ft,"w:numFmt"),lt=pt(ft,"w:lvlText"),dt=pt(ft,"w:start");J&&(j[V][J]={numFmt:st?.getAttribute("w:val")||"decimal",lvlText:lt?.getAttribute("w:val")||"",start:parseInt(dt?.getAttribute("w:val")||"1",10)})}let at=ut(H,"w:lvlOverride");for(let ft of at){let J=ft.getAttribute("w:ilvl");if(J&&j[V][J]){let st=pt(ft,"w:startOverride");st&&(j[V][J].start=parseInt(st.getAttribute("w:val")||"1",10))}}}}}let $=m.find(D=>D.path.match(h)),q={};if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:styleId");if(G){let H=pt(P,"w:rPr"),V=pt(P,"w:pPr"),L=H?d(H):{},tt,rt,at;if(V){let ft=pt(V,"w:jc");if(ft){let lt=ft.getAttribute("w:val");(lt==="left"||lt==="center"||lt==="right"||lt==="justify")&&(tt=lt)}let J=pt(V,"w:shd");if(J){let lt=J.getAttribute("w:fill");lt&<!=="auto"&&(rt="#"+lt)}let st=f(V);st&&(at=st)}q[G]={formatting:L,alignment:tt,backgroundColor:rt,paragraphIndentation:at}}}}let Q={};if($){let D=le($.content.toString()),F=pt(D,"w:docDefaults");if(F){let P=pt(F,"w:rPrDefault");if(P){let G=pt(P,"w:rPr");G&&(Q=d(G))}}}let Z;if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:type"),H=P.getAttribute("w:default"),V=P.getAttribute("w:styleId");if(G==="paragraph"&&H==="1"&&V){Z=V;break}}!Z&&q.Normal&&(Z="Normal")}let Y=[],X=[],T={},I={},_=(D,F,P=[])=>{let G=pt(D,"w:numPr"),H=!!G,V=pt(D,"w:pPr"),tt=(V?pt(V,"w:pStyle"):null)?.getAttribute("w:val"),rt=tt?tt.startsWith("Heading")||tt==="Title":!1,at=tt&&q[tt]?q[tt]:{formatting:{}},ft=at.alignment;if(V){let mt=pt(V,"w:jc");if(mt){let ot=mt.getAttribute("w:val");(ot==="left"||ot==="center"||ot==="right"||ot==="justify")&&(ft=ot)}}let J=at.paragraphIndentation;if(V){let mt=f(V);mt&&(J={...J,...mt})}let st=at.backgroundColor;if(V){let mt=pt(V,"w:shd");if(mt){let ot=mt.getAttribute("w:fill");ot&&ot!=="auto"&&(st="#"+ot)}}let lt={...at.formatting};if(V){let mt=pt(V,"w:rPr");if(mt){let ot=d(mt);for(let ht in ot){let gt=ot[ht];gt===!1?delete lt[ht]:gt!==void 0&&(lt[ht]=gt)}}}let dt="",et=[],vt=mt=>{if(Oe(mt)&&mt.nodeName==="w:r"){let ot=mt,ht=pt(ot,"w:rPr"),gt={};for(let wt in lt)gt[wt]=lt[wt];let Et=ht?pt(ht,"w:rStyle"):null,Pt=Et?Et.getAttribute("w:val"):tt;if(Pt&&q[Pt])for(let wt in q[Pt].formatting)gt[wt]=q[Pt].formatting[wt];if(ht){let wt=d(ht);for(let kt in wt){let St=wt[kt];St===!1?delete gt[kt]:St!==void 0&&(gt[kt]=St)}}!gt.backgroundColor&&st&&(gt.backgroundColor=st);for(let wt of ot.childNodes)if(Oe(wt)){if(wt.tagName==="w:t"||wt.tagName==="t"){let kt=wt,St=kt.textContent||"";dt+=St;let O={type:"text",text:St,formatting:gt};t.includeRawContent&&(O.rawContent=ee(kt,F,t));let K=Pt||tt||Z;K&&(O.metadata={style:K}),et.push(O)}else if(t.includeBreakNodes&&(wt.tagName==="w:br"||wt.tagName==="br"||wt.tagName==="w:cr"||wt.tagName==="cr")){let kt=wt,St="textWrapping";if(wt.tagName==="w:cr"||wt.tagName==="cr")St="carriageReturn";else{let Tt=kt.getAttribute("w:type")||kt.getAttribute("type");Tt!==null&&(St=Tt)}let O;St==="textWrapping"&&kt.getAttribute("w:clear")!==null&&(O=kt.getAttribute("w:clear"));let K={type:"break",metadata:{breakType:St,clear:O}};t.includeRawContent&&(K.rawContent=ee(kt,F,t)),et.push(K)}else if(t.includeBreakNodes&&(wt.tagName==="w:lastRenderedPageBreak"||wt.tagName==="lastRenderedPageBreak")){let kt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(kt.rawContent=ee(wt,F,t)),et.push(kt)}}if(t.extractAttachments){let wt=ut(ot,"w:drawing"),kt=ut(ot,"w:pict"),St=[...wt,...kt];for(let O of St){let K=fx(O),Tt="",xt=pt(O,"wp:docPr");xt&&(Tt=xt.getAttribute("descr")||xt.getAttribute("title")||"");let Mt="",Ot=pt(O,"a:blip");if(Ot)Mt=Ot.getAttribute("r:embed")||"";else{let Yt=pt(O,"v:imagedata");Yt&&(Mt=Yt.getAttribute("r:id")||"")}if(Mt&&M[Mt]){let se=M[Mt].split("/").pop();if(se){let _n={type:"image",text:"",metadata:{attachmentName:se,altText:Tt}};t.includeRawContent&&(_n.rawContent=ee(O,F,t)),et.push(_n)}}else{let Yt={type:"image",text:""};t.includeRawContent&&(Yt.rawContent=ee(O,F,t)),et.push(Yt)}}}if(!t.ignoreNotes){let wt=pt(ot,"w:footnoteReference");if(wt){let St=wt.getAttribute("w:id");if(St&&w.has(St)){let O=w.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"footnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}let kt=pt(ot,"w:endnoteReference");if(kt){let St=kt.getAttribute("w:id");if(St&&C.has(St)){let O=C.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"endnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}}}else if(Oe(mt)&&mt.nodeName==="w:hyperlink"){let ot=mt,ht=ot.getAttribute("r:id"),gt=ot.getAttribute("w:anchor"),Et;gt&&!t.ignoreInternalLinks?Et={link:"#"+gt,linkType:"internal"}:ht&&M[ht]&&(Et={link:M[ht],linkType:"external"});let Pt=Array.from(ot.childNodes);for(let wt of Pt){let kt=et.length;if(vt(wt),Et)for(let St=kt;St<et.length;St++)et[St].type==="text"&&(et[St].metadata={...et[St].metadata??{},...Et})}}else if(Oe(mt)&&mt.nodeName==="w:bookmarkStart"){let ot=mt.getAttribute("w:name");ot&&!ot.startsWith("_GoBack")&&!t.ignoreInternalLinks&&bt.push(ot)}else if(Oe(mt)&&(mt.nodeName==="mc:AlternateContent"||mt.nodeName==="AlternateContent")){let ot=p(mt);for(let ht of ot)vt(ht)}else if(Oe(mt)&&(mt.nodeName==="w:pict"||mt.nodeName==="pict"||mt.nodeName==="w:drawing"||mt.nodeName==="drawing")){let ot=ut(mt,"w:txbxContent");for(let ht of ot){let gt=Array.from(ht.childNodes);for(let Et of gt)if(Oe(Et)&&Et.nodeName==="w:p"){let Pt=_(Et,F);et.push(...Pt.children||[]),dt+=Pt.text}}}else if(mt.childNodes.length>0)for(let ot of Array.from(mt.childNodes))vt(ot)},bt=[...P],Ft=Array.from(D.childNodes);for(let mt of Ft)vt(mt);let Ct=bt.length>0?{anchorIds:bt}:{};if(H){let mt=pt(G,"w:numId"),ot=pt(G,"w:ilvl"),ht=mt&&mt.getAttribute("w:val")||"0",gt=ot?parseInt(ot.getAttribute("w:val")||"0",10):0,Et="ordered",Pt=0;if(ht&&j[ht]){let kt=gt.toString();T[ht]||(T[ht]={}),T[ht][kt]||(T[ht][kt]=0),T[ht][kt]++;for(let O=gt+1;O<10;O++)T[ht][O.toString()]&&(T[ht][O.toString()]=0);Et=(j[ht][kt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",I[ht]||(I[ht]={}),I[ht][kt]===void 0?I[ht][kt]=(j[ht][kt]?.start??1)-1:I[ht][kt]++,Pt=I[ht][kt]}let wt={type:"list",text:dt,children:et,metadata:{listType:Et,indentation:gt,paragraphIndentation:J,alignment:ft||"left",listId:ht,itemIndex:Pt,style:tt,...Ct}};return t.includeRawContent&&(wt.rawContent=ee(D,F,t)),wt}else if(rt){let mt=tt&&parseInt(tt.replace("Heading",""),10)||1,ot={type:"heading",text:dt,children:et,metadata:{level:mt,alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(ot.rawContent=ee(D,F,t)),ot}else{let mt={type:"paragraph",text:dt,children:et,metadata:{alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(mt.rawContent=ee(D,F,t)),mt}},W=(D,F,P=[])=>{let G=[],H=Qe(D,"w:tr"),V=new Map;for(let L=0;L<H.length;L++){let tt=H[L],rt=[],at=Qe(tt,"w:tc"),ft=0;for(let st=0;st<at.length;st++){let lt=at[st],dt=pt(lt,"w:tcPr"),et=1;if(dt){let ht=pt(dt,"w:gridSpan");ht&&(et=parseInt(ht.getAttribute("w:val")||"1",10))}let vt=!1,bt=!1;if(dt){let ht=pt(dt,"w:vMerge");ht&&(bt=!0,(ht.getAttribute("w:val")==="restart"||!V.has(ft))&&(vt=!0))}let Ft=[],Ct="",mt=Array.from(lt.childNodes);for(let ht of mt)if(Oe(ht)&&ht.nodeName==="w:p"){let gt=_(ht,F);Ft.push(gt),Ct+=gt.text}else if(Oe(ht)&&ht.nodeName==="w:tbl"){let gt=W(ht,F);Ft.push(gt)}let ot={type:"cell",text:Ct,children:Ft,metadata:{row:L,col:ft}};if(et>1&&(ot.metadata.colSpan=et),bt)if(vt)V.set(ft,{node:ot,span:1}),rt.push(ot);else{let ht=V.get(ft);ht?(ht.span++,ht.node.metadata.rowSpan=ht.span,Ft.length>0&&(ht.node.children||(ht.node.children=[]),ht.node.children.push(...Ft),ht.node.text+=" "+Ct)):rt.push(ot)}else V.delete(ft),rt.push(ot);ft+=et}let J={type:"row",children:rt};G.push(J)}return{type:"table",children:G}};if(!t.ignoreNotes){let D=m.find(P=>P.path.match(n));if(D){let P=le(D.content.toString()),G=D.content.toString(),H=ut(P,"w:footnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");w.set(L,tt.map(rt=>_(rt,G)))}}let F=m.find(P=>P.path.match(i));if(F){let P=le(F.content.toString()),G=F.content.toString(),H=ut(P,"w:endnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");C.set(L,tt.map(rt=>_(rt,G)))}}}for(let D of m){if(D.path.match(a)||D.path.match(s)||D.path.match(u)||D.path.match(h)||D.path.match(n)||D.path.match(i))continue;let F=D.content.toString();t.includeRawContent&&X.push(F);let P=le(F,{locator:t.includeRawContent}),G=pt(P,"w:body");if(G){let H=Array.from(G.childNodes),V=[];for(let L of H)if(Oe(L)){if(L.nodeName==="w:p")Y.push(_(L,F,V)),V=[];else if(L.nodeName==="w:tbl")Y.push(W(L,F,V)),V=[];else if(L.nodeName==="w:bookmarkStart"){let tt=L.getAttribute("w:name");tt&&!tt.startsWith("_GoBack")&&!t.ignoreInternalLinks&&V.push(tt)}}}}if(t.extractAttachments){for(let D of N){let F=Mr(D.path.split("/").pop()||"image",D.content);if(S.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Ce("OCR_FAILED",t,F.name,P)}}if(t.ocr){let D=F=>{for(let P of F){if(P.type==="image"&&"attachmentName"in(P.metadata||{})){let G=P.metadata,H=S.find(V=>V.name===G.attachmentName);H&&H.ocrText&&(P.text=H.ocrText,H.altText=G.altText)}P.children&&D(P.children)}};D(Y)}}t.putNotesAtLast&&E.length>0&&Y.push(...E);let z=()=>Y.map(D=>{let F=P=>{let G="";return P.children?G+=P.children.map(F).filter(H=>H!="").join(P.children[0]?.children?t.newlineDelimiter:""):P.type==="break"?G+=t.newlineDelimiter:G+=P.text||"",G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An("docx",{...x,formatting:Q,styleMap:q},Y,S,t,z)};var rl=class{static async parseOffice(t,e,n){let i,s={};typeof e=="function"?(i=e,s=n||{}):s=e||{};let a=fv(s),l=[],c=a.onWarning;a.onWarning=f=>{l.push(f),c&&c(f)};let u=ct.Buffer.alloc(0),h=a.fileType??"",d;try{if(!t)throw hn("IMPROPER_ARGUMENTS",a);if(t instanceof ArrayBuffer)u=ct.Buffer.from(t);else if(ct.Buffer.isBuffer(t))u=t;else if(typeof t=="string"){d=t,Dg("path-parsing");let p=await Promise.resolve().then(()=>(iN(),nN));if(!p.existsSync(t))throw hn("FILE_DOES_NOT_EXIST",a,t);if(p.lstatSync(t).isDirectory())throw hn("LOCATION_NOT_FOUND",a,t);u=p.readFileSync(t),h=h||t.split(".").pop()||""}else throw hn("INVALID_INPUT",a);if(u.length>0&&!h)try{let{fileTypeFromBuffer:p}=await I2(),m=await p(u);m&&(h=m.ext)}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}else if(u.length>0&&h)try{let{fileTypeFromBuffer:p}=await I2(),m=await p(u);m&&m.ext.toLowerCase()!==h.toLowerCase()&&Ce("BUFFER_TYPE_MISMATCH",a,{detected:m.ext,expected:h})}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}if(!h)throw hn("IMPROPER_BUFFERS",a);let f;switch(h.toLowerCase()){case"docx":f=await VD(u,a);break;case"pptx":f=await WD(u,a);break;case"xlsx":f=await GE(u,a);break;case"odt":case"odp":case"ods":f=await qE(u,a);break;case"pdf":f=await HD(u,a);break;case"rtf":f=await qD(u,a);break;case"csv":f=await Gv(u,a);break;case"html":f=await HE(u,a);break;case"md":f=await WE(u,a);break;default:throw hn("EXTENSION_UNSUPPORTED",a,h)}return f.warnings=l,i&&i(f),f}catch(f){let p=dv(f,a,d);throw i&&i(void 0,p),p}}static async terminateOcr(){await jE()}};B();var yb=class{static async convert(t,e,n){let i={...n?.parseConfig,onWarning:n?.onWarning||n?.parseConfig?.onWarning};i.ocr=!1,Object.keys(i).forEach(c=>i[c]===void 0&&delete i[c]),i.extractAttachments=n?.generatorConfig?.includeImages!==!1||n?.generatorConfig?.includeCharts!==!1;let s=await rl.parseOffice(t,i),a={...n?.generatorConfig,onWarning:n?.onWarning||n?.generatorConfig?.onWarning},l=await Ka.generate(s,e,a);return l.messages=[...s.warnings||[],...l.messages],l}};var M4=rl.parseOffice,O4=rl.terminateOcr,F4=yb.convert,P4=Ka.generate;var R4=rl;export{yb as OfficeConverter,ov as OfficeErrorType,Ka as OfficeGenerator,rl as OfficeParser,lv as OfficeWarningType,F4 as convert,R4 as default,P4 as generate,M4 as parseOffice,O4 as terminateOcr};
|
|
756
|
+
`);else if(O.value==="lquote")ft(p,K)&&(J(),p={...K}),f.push("\u2018");else if(O.value==="rquote")ft(p,K)&&(J(),p={...K}),f.push("\u2019");else if(O.value==="ldblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201C");else if(O.value==="rdblquote")ft(p,K)&&(J(),p={...K}),f.push("\u201D");else if(O.value==="u"){if(O.param!==void 0){let xt=O.param;xt<0&&(xt+=65536),ft(p,K)&&(J(),p={...K}),f.push(String.fromCharCode(xt))}}else if(O.value==="b")K.bold=O.param!==0;else if(O.value==="i")K.italic=O.param!==0;else if(O.value==="ul")K.underline=O.param!==0;else if(O.value==="ulnone")K.underline=!1;else if(O.value==="strike")K.strikethrough=O.param!==0;else if(O.value==="plain")K.bold=!1,K.italic=!1,K.underline=!1,K.strikethrough=!1,K.subscript=!1,K.superscript=!1,K.size=void 0,K.font=void 0,K.color=void 0,K.backgroundColor=void 0;else if(O.value==="fs")O.param!==void 0&&(K.size=(O.param/2).toString()+"pt");else if(O.value==="f")O.param!==void 0&&i[O.param]&&(K.font=i[O.param]);else if(O.value==="cf")O.param!==void 0&&s[O.param]&&(K.color=s[O.param]);else if(O.value==="fet")O.param!==void 0&&(j=O.param);else if(O.value==="cb"||O.value==="highlight"||O.value==="chcbpat"||O.value==="cbpat")O.param!==void 0&&s[O.param]&&(K.backgroundColor=s[O.param]);else if(O.value==="sub")K.subscript=!0,K.superscript=!1;else if(O.value==="super")K.superscript=!0,K.subscript=!1;else if(O.value==="nosupersub")K.subscript=!1,K.superscript=!1;else if(O.value==="li"){if(O.param!==void 0){let xt=Math.round(O.param/720);b||(y=xt)}}else if(O.value==="ls"){if(O.param!==void 0){b||(y=0),b=!0,W[O.param]||(_++,W[O.param]=`rtf-list-${_}`),E=W[O.param];let xt=tt[O.param]!==void 0?tt[O.param]:O.param;G[xt]&&(w=G[xt])}}else O.value==="ilvl"?O.param!==void 0&&(b=!0,y=O.param):O.value==="pnlvl"?(b=!0,O.param!==void 0&&(y=O.param)):O.value==="levelnfc"||O.value==="pnf"?O.param!==void 0&&(b=!0,O.param===23?w="unordered":w="ordered"):O.value==="pndec"||O.value==="pnord"||O.value==="pnlcltr"||O.value==="pnucltr"?(b||(y=0),b=!0,w="ordered"):O.value==="pnbullet"||O.value==="pncard"?(b||(y=0),b=!0,w="unordered"):O.value==="s"?O.param!==void 0&&O.param>=1&&O.param<=9&&(C=O.param):O.value==="ql"?x="left":O.value==="qc"?x="center":O.value==="qr"?x="right":O.value==="qj"&&(x="justify")}};Et(n,{});let Pt=$();if((Q||Pt&&(Pt.rows.length>0||Pt.currentCells.length>0))&&vt(),lt(),!t.putNotesAtLast&&l.length>0&&(a.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let K of c)if(K.mimeType.startsWith("image/"))try{let Tt=ct.Buffer.from(K.data,"base64");K.ocrText=(await lr(Tt,{...t.ocrConfig})).trim()}catch(Tt){Ce("OCR_FAILED",t,K.name,Tt)}let O=K=>{for(let Tt of K){if(Tt.type==="image"&&Tt.metadata&&"attachmentName"in Tt.metadata){let xt=Tt.metadata,Mt=c.find(Ot=>Ot.name===xt.attachmentName);Mt&&(Mt.ocrText&&(Tt.text=Mt.ocrText),Mt.altText&&(xt.altText=Mt.altText))}Tt.children&&O(Tt.children)}};O(a)}let wt=O=>{for(let K of O){if(K.type==="note"&&K.children){let Tt=xt=>xt.children&&xt.children.length>0?xt.children.map(Tt).join(""):xt.text||"";K.text=K.children.map(Tt).join("").trim()}K.children&&wt(K.children)}};wt(a),wt(l);let St=An("rtf",{},a,c,t,()=>{let O=a.map(K=>K.text).join(t.newlineDelimiter);return t.putNotesAtLast&&l.length>0&&(O+=t.newlineDelimiter+l.map(K=>K.text).join(t.newlineDelimiter)),O});return t.putNotesAtLast&&l.length>0&&a.push(...l),St};function _2(r,t){for(let e of r.content)if(e.type==="group"){if(e.destination===t)return e;let n=_2(e,t);if(n)return n}return null}function uF(r){let t={},e=_2(r,"fonttbl");if(e){for(let n of e.content)if(n.type==="group"){let i,s="";for(let a of n.content)a.type==="control"&&a.value==="f"?i=a.param:a.type==="text"&&(s+=a.value);i!==void 0&&s&&(t[i]=s.replace(/;$/,"").trim())}}return t}function hF(r){let t={},e=_2(r,"colortbl");if(e){let n=0,i=0,s=0,a=0;for(let l of e.content)if(l.type==="control")l.value==="red"&&l.param!==void 0?i=l.param:l.value==="green"&&l.param!==void 0?s=l.param:l.value==="blue"&&l.param!==void 0&&(a=l.param);else if(l.type==="text"&&l.value===";"){let c=`#${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`;t[n]=c,n++,i=0,s=0,a=0}}return t}B();var VD=async(r,t)=>{let e=/word\/document[\d+]?.xml/,n=/word\/footnotes[\d+]?.xml/,i=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,a=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=D=>{let F={},P=(dt,et)=>{let vt=pt(dt,et);if(vt){let bt=vt.getAttribute("w:val");return bt===null?!0:bt==="1"||bt==="true"||bt==="on"}return null},G=P(D,"w:b");G!==null&&(F.bold=G);let H=P(D,"w:i");H!==null&&(F.italic=H);let V=pt(D,"w:u");if(V){let dt=V.getAttribute("w:val");(!dt||dt!=="none")&&(F.underline=!0)}let L=P(D,"w:strike"),tt=P(D,"w:dstrike");L!==null?F.strikethrough=L:tt!==null&&(F.strikethrough=tt);let rt=pt(D,"w:sz");if(rt){let dt=rt.getAttribute("w:val");dt&&(F.size=(parseInt(dt,10)/2).toString()+"pt")}let at=pt(D,"w:color");if(at){let dt=at.getAttribute("w:val");dt&&dt!=="auto"&&(F.color="#"+dt)}let ft=pt(D,"w:shd");if(ft){let dt=ft.getAttribute("w:fill");dt&&dt!=="auto"&&(F.backgroundColor="#"+dt)}let J=pt(D,"w:highlight");if(J){let dt=J.getAttribute("w:val");if(dt&&dt!=="none"){let et={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};F.backgroundColor=et[dt]||dt}}let st=pt(D,"w:rFonts");if(st){let dt=st.getAttribute("w:ascii")||st.getAttribute("w:hAnsi");dt&&(F.font=dt)}let lt=pt(D,"w:vertAlign");if(lt){let dt=lt.getAttribute("w:val");dt==="subscript"?F.subscript=!0:dt==="superscript"&&(F.superscript=!0)}return F},f=D=>{let F=pt(D,"w:ind");if(F){let P={},G=F.getAttribute("w:left")||F.getAttribute("w:start"),H=F.getAttribute("w:right")||F.getAttribute("w:end"),V=F.getAttribute("w:firstLine"),L=F.getAttribute("w:hanging");return G&&(P.left=parseInt(G,10)),H&&(P.right=parseInt(H,10)),V&&(P.firstLine=parseInt(V,10)),L&&(P.hanging=parseInt(L,10)),Object.keys(P).length>0?P:void 0}},p=D=>{let F=pt(D,"mc:Choice");if(F)return Array.from(F.childNodes);let P=pt(D,"mc:Fallback");return Array.from(P?P.childNodes:D.childNodes)},m=await ro(r,D=>!!D.match(e)||!!D.match(n)||!!D.match(i)||!!D.match(s)||!!D.match(l)||!!D.match(c)||!!D.match(u)||!!D.match(h)||!!t.extractAttachments&&!!D.match(a)),y=m.find(D=>D.path.match(l)),x=y?no(y.content.toString()):{},b=m.find(D=>D.path.match(c));if(b){let D=ku(b.content.toString());Object.keys(D).length>0&&(x.customProperties=D)}let w=new Map,C=new Map,E=[],S=[],N=m.filter(D=>D.path.match(a)),k=m.find(D=>D.path.match(u)),M={};if(k){let D=le(k.content.toString()),F=ut(D,"Relationship");for(let P of F){let G=P.getAttribute("Id"),H=P.getAttribute("Target");G&&H&&(M[G]=H)}}let R=m.find(D=>D.path.match(s)),j={};if(R){let D=le(R.content.toString()),F=ut(D,"w:num"),P=ut(D,"w:abstractNum"),G={};for(let H of P){let V=H.getAttribute("w:abstractNumId");V&&(G[V]=H)}for(let H of F){let V=H.getAttribute("w:numId"),tt=pt(H,"w:abstractNumId")?.getAttribute("w:val");if(V&&tt&&G[tt]){j[V]={};let rt=ut(G[tt],"w:lvl");for(let ft of rt){let J=ft.getAttribute("w:ilvl"),st=pt(ft,"w:numFmt"),lt=pt(ft,"w:lvlText"),dt=pt(ft,"w:start");J&&(j[V][J]={numFmt:st?.getAttribute("w:val")||"decimal",lvlText:lt?.getAttribute("w:val")||"",start:parseInt(dt?.getAttribute("w:val")||"1",10)})}let at=ut(H,"w:lvlOverride");for(let ft of at){let J=ft.getAttribute("w:ilvl");if(J&&j[V][J]){let st=pt(ft,"w:startOverride");st&&(j[V][J].start=parseInt(st.getAttribute("w:val")||"1",10))}}}}}let $=m.find(D=>D.path.match(h)),q={};if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:styleId");if(G){let H=pt(P,"w:rPr"),V=pt(P,"w:pPr"),L=H?d(H):{},tt,rt,at;if(V){let ft=pt(V,"w:jc");if(ft){let lt=ft.getAttribute("w:val");(lt==="left"||lt==="center"||lt==="right"||lt==="justify")&&(tt=lt)}let J=pt(V,"w:shd");if(J){let lt=J.getAttribute("w:fill");lt&<!=="auto"&&(rt="#"+lt)}let st=f(V);st&&(at=st)}q[G]={formatting:L,alignment:tt,backgroundColor:rt,paragraphIndentation:at}}}}let Q={};if($){let D=le($.content.toString()),F=pt(D,"w:docDefaults");if(F){let P=pt(F,"w:rPrDefault");if(P){let G=pt(P,"w:rPr");G&&(Q=d(G))}}}let Z;if($){let D=le($.content.toString()),F=ut(D,"w:style");for(let P of F){let G=P.getAttribute("w:type"),H=P.getAttribute("w:default"),V=P.getAttribute("w:styleId");if(G==="paragraph"&&H==="1"&&V){Z=V;break}}!Z&&q.Normal&&(Z="Normal")}let Y=[],X=[],T={},I={},_=(D,F,P=[])=>{let G=pt(D,"w:numPr"),H=!!G,V=pt(D,"w:pPr"),tt=(V?pt(V,"w:pStyle"):null)?.getAttribute("w:val"),rt=tt?tt.startsWith("Heading")||tt==="Title":!1,at=tt&&q[tt]?q[tt]:{formatting:{}},ft=at.alignment;if(V){let mt=pt(V,"w:jc");if(mt){let ot=mt.getAttribute("w:val");(ot==="left"||ot==="center"||ot==="right"||ot==="justify")&&(ft=ot)}}let J=at.paragraphIndentation;if(V){let mt=f(V);mt&&(J={...J,...mt})}let st=at.backgroundColor;if(V){let mt=pt(V,"w:shd");if(mt){let ot=mt.getAttribute("w:fill");ot&&ot!=="auto"&&(st="#"+ot)}}let lt={...at.formatting};if(V){let mt=pt(V,"w:rPr");if(mt){let ot=d(mt);for(let ht in ot){let gt=ot[ht];gt===!1?delete lt[ht]:gt!==void 0&&(lt[ht]=gt)}}}let dt="",et=[],vt=mt=>{if(Oe(mt)&&mt.nodeName==="w:r"){let ot=mt,ht=pt(ot,"w:rPr"),gt={};for(let wt in lt)gt[wt]=lt[wt];let Et=ht?pt(ht,"w:rStyle"):null,Pt=Et?Et.getAttribute("w:val"):tt;if(Pt&&q[Pt])for(let wt in q[Pt].formatting)gt[wt]=q[Pt].formatting[wt];if(ht){let wt=d(ht);for(let kt in wt){let St=wt[kt];St===!1?delete gt[kt]:St!==void 0&&(gt[kt]=St)}}!gt.backgroundColor&&st&&(gt.backgroundColor=st);for(let wt of ot.childNodes)if(Oe(wt)){if(wt.tagName==="w:t"||wt.tagName==="t"){let kt=wt,St=kt.textContent||"";dt+=St;let O={type:"text",text:St,formatting:gt};t.includeRawContent&&(O.rawContent=ee(kt,F,t));let K=Pt||tt||Z;K&&(O.metadata={style:K}),et.push(O)}else if(t.includeBreakNodes&&(wt.tagName==="w:br"||wt.tagName==="br"||wt.tagName==="w:cr"||wt.tagName==="cr")){let kt=wt,St="textWrapping";if(wt.tagName==="w:cr"||wt.tagName==="cr")St="carriageReturn";else{let Tt=kt.getAttribute("w:type")||kt.getAttribute("type");Tt!==null&&(St=Tt)}let O;St==="textWrapping"&&kt.getAttribute("w:clear")!==null&&(O=kt.getAttribute("w:clear"));let K={type:"break",metadata:{breakType:St,clear:O}};t.includeRawContent&&(K.rawContent=ee(kt,F,t)),et.push(K)}else if(t.includeBreakNodes&&(wt.tagName==="w:lastRenderedPageBreak"||wt.tagName==="lastRenderedPageBreak")){let kt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(kt.rawContent=ee(wt,F,t)),et.push(kt)}}if(t.extractAttachments){let wt=ut(ot,"w:drawing"),kt=ut(ot,"w:pict"),St=[...wt,...kt];for(let O of St){let K=fx(O),Tt="",xt=pt(O,"wp:docPr");xt&&(Tt=xt.getAttribute("descr")||xt.getAttribute("title")||"");let Mt="",Ot=pt(O,"a:blip");if(Ot)Mt=Ot.getAttribute("r:embed")||"";else{let Yt=pt(O,"v:imagedata");Yt&&(Mt=Yt.getAttribute("r:id")||"")}if(Mt&&M[Mt]){let se=M[Mt].split("/").pop();if(se){let _n={type:"image",text:"",metadata:{attachmentName:se,altText:Tt}};t.includeRawContent&&(_n.rawContent=ee(O,F,t)),et.push(_n)}}else{let Yt={type:"image",text:""};t.includeRawContent&&(Yt.rawContent=ee(O,F,t)),et.push(Yt)}}}if(!t.ignoreNotes){let wt=pt(ot,"w:footnoteReference");if(wt){let St=wt.getAttribute("w:id");if(St&&w.has(St)){let O=w.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"footnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}let kt=pt(ot,"w:endnoteReference");if(kt){let St=kt.getAttribute("w:id");if(St&&C.has(St)){let O=C.get(St),K={type:"note",text:O.map(Tt=>Tt.text).join(" "),children:O,metadata:{noteType:"endnote",noteId:St}};t.putNotesAtLast?E.push(K):et.push(K)}}}}else if(Oe(mt)&&mt.nodeName==="w:hyperlink"){let ot=mt,ht=ot.getAttribute("r:id"),gt=ot.getAttribute("w:anchor"),Et;gt&&!t.ignoreInternalLinks?Et={link:"#"+gt,linkType:"internal"}:ht&&M[ht]&&(Et={link:M[ht],linkType:"external"});let Pt=Array.from(ot.childNodes);for(let wt of Pt){let kt=et.length;if(vt(wt),Et)for(let St=kt;St<et.length;St++)et[St].type==="text"&&(et[St].metadata={...et[St].metadata??{},...Et})}}else if(Oe(mt)&&mt.nodeName==="w:bookmarkStart"){let ot=mt.getAttribute("w:name");ot&&!ot.startsWith("_GoBack")&&!t.ignoreInternalLinks&&bt.push(ot)}else if(Oe(mt)&&(mt.nodeName==="mc:AlternateContent"||mt.nodeName==="AlternateContent")){let ot=p(mt);for(let ht of ot)vt(ht)}else if(Oe(mt)&&(mt.nodeName==="w:pict"||mt.nodeName==="pict"||mt.nodeName==="w:drawing"||mt.nodeName==="drawing")){let ot=ut(mt,"w:txbxContent");for(let ht of ot){let gt=Array.from(ht.childNodes);for(let Et of gt)if(Oe(Et)&&Et.nodeName==="w:p"){let Pt=_(Et,F);et.push(...Pt.children||[]),dt+=Pt.text}}}else if(mt.childNodes.length>0)for(let ot of Array.from(mt.childNodes))vt(ot)},bt=[...P],Ft=Array.from(D.childNodes);for(let mt of Ft)vt(mt);let Ct=bt.length>0?{anchorIds:bt}:{};if(H){let mt=pt(G,"w:numId"),ot=pt(G,"w:ilvl"),ht=mt&&mt.getAttribute("w:val")||"0",gt=ot?parseInt(ot.getAttribute("w:val")||"0",10):0,Et="ordered",Pt=0;if(ht&&j[ht]){let kt=gt.toString();T[ht]||(T[ht]={}),T[ht][kt]||(T[ht][kt]=0),T[ht][kt]++;for(let O=gt+1;O<10;O++)T[ht][O.toString()]&&(T[ht][O.toString()]=0);Et=(j[ht][kt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",I[ht]||(I[ht]={}),I[ht][kt]===void 0?I[ht][kt]=(j[ht][kt]?.start??1)-1:I[ht][kt]++,Pt=I[ht][kt]}let wt={type:"list",text:dt,children:et,metadata:{listType:Et,indentation:gt,paragraphIndentation:J,alignment:ft||"left",listId:ht,itemIndex:Pt,style:tt,...Ct}};return t.includeRawContent&&(wt.rawContent=ee(D,F,t)),wt}else if(rt){let mt=tt&&parseInt(tt.replace("Heading",""),10)||1,ot={type:"heading",text:dt,children:et,metadata:{level:mt,alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(ot.rawContent=ee(D,F,t)),ot}else{let mt={type:"paragraph",text:dt,children:et,metadata:{alignment:ft,paragraphIndentation:J,style:tt??void 0,...Ct}};return t.includeRawContent&&(mt.rawContent=ee(D,F,t)),mt}},W=(D,F,P=[])=>{let G=[],H=Qe(D,"w:tr"),V=new Map;for(let L=0;L<H.length;L++){let tt=H[L],rt=[],at=Qe(tt,"w:tc"),ft=0;for(let st=0;st<at.length;st++){let lt=at[st],dt=pt(lt,"w:tcPr"),et=1;if(dt){let ht=pt(dt,"w:gridSpan");ht&&(et=parseInt(ht.getAttribute("w:val")||"1",10))}let vt=!1,bt=!1;if(dt){let ht=pt(dt,"w:vMerge");ht&&(bt=!0,(ht.getAttribute("w:val")==="restart"||!V.has(ft))&&(vt=!0))}let Ft=[],Ct="",mt=Array.from(lt.childNodes);for(let ht of mt)if(Oe(ht)&&ht.nodeName==="w:p"){let gt=_(ht,F);Ft.push(gt),Ct+=gt.text}else if(Oe(ht)&&ht.nodeName==="w:tbl"){let gt=W(ht,F);Ft.push(gt)}let ot={type:"cell",text:Ct,children:Ft,metadata:{row:L,col:ft}};if(et>1&&(ot.metadata.colSpan=et),bt)if(vt)V.set(ft,{node:ot,span:1}),rt.push(ot);else{let ht=V.get(ft);ht?(ht.span++,ht.node.metadata.rowSpan=ht.span,Ft.length>0&&(ht.node.children||(ht.node.children=[]),ht.node.children.push(...Ft),ht.node.text+=" "+Ct)):rt.push(ot)}else V.delete(ft),rt.push(ot);ft+=et}let J={type:"row",children:rt};G.push(J)}return{type:"table",children:G}};if(!t.ignoreNotes){let D=m.find(P=>P.path.match(n));if(D){let P=le(D.content.toString()),G=D.content.toString(),H=ut(P,"w:footnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");w.set(L,tt.map(rt=>_(rt,G)))}}let F=m.find(P=>P.path.match(i));if(F){let P=le(F.content.toString()),G=F.content.toString(),H=ut(P,"w:endnote");for(let V of H){let L=V.getAttribute("w:id");if(!L||L==="-1"||L==="0")continue;let tt=ut(V,"w:p");C.set(L,tt.map(rt=>_(rt,G)))}}}for(let D of m){if(D.path.match(a)||D.path.match(s)||D.path.match(u)||D.path.match(h)||D.path.match(n)||D.path.match(i))continue;let F=D.content.toString();t.includeRawContent&&X.push(F);let P=le(F,{locator:t.includeRawContent}),G=pt(P,"w:body");if(G){let H=Array.from(G.childNodes),V=[];for(let L of H)if(Oe(L)){if(L.nodeName==="w:p")Y.push(_(L,F,V)),V=[];else if(L.nodeName==="w:tbl")Y.push(W(L,F,V)),V=[];else if(L.nodeName==="w:bookmarkStart"){let tt=L.getAttribute("w:name");tt&&!tt.startsWith("_GoBack")&&!t.ignoreInternalLinks&&V.push(tt)}}}}if(t.extractAttachments){for(let D of N){let F=Mr(D.path.split("/").pop()||"image",D.content);if(S.push(F),t.ocr&&F.mimeType.startsWith("image/"))try{F.ocrText=(await lr(D.content,{...t.ocrConfig})).trim()}catch(P){Ce("OCR_FAILED",t,F.name,P)}}if(t.ocr){let D=F=>{for(let P of F){if(P.type==="image"&&"attachmentName"in(P.metadata||{})){let G=P.metadata,H=S.find(V=>V.name===G.attachmentName);H&&H.ocrText&&(P.text=H.ocrText,H.altText=G.altText)}P.children&&D(P.children)}};D(Y)}}t.putNotesAtLast&&E.length>0&&Y.push(...E);let z=()=>Y.map(D=>{let F=P=>{let G="";return P.children?G+=P.children.map(F).filter(H=>H!="").join(P.children[0]?.children?t.newlineDelimiter:""):P.type==="break"?G+=t.newlineDelimiter:G+=P.text||"",G};return F(D)}).filter(D=>D!="").join(t.newlineDelimiter);return An("docx",{...x,formatting:Q,styleMap:q},Y,S,t,z)};var rl=class{static async parseOffice(t,e,n){let i,s={};typeof e=="function"?(i=e,s=n||{}):s=e||{};let a=fv(s),l=[],c=a.onWarning;a.onWarning=f=>{l.push(f),c&&c(f)};let u=ct.Buffer.alloc(0),h=a.fileType??"",d;try{if(!t)throw hn("IMPROPER_ARGUMENTS",a);if(t instanceof ArrayBuffer)u=ct.Buffer.from(t);else if(t instanceof Uint8Array)u=ct.Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(ct.Buffer.isBuffer(t))u=t;else if(typeof t=="string"){d=t,Dg("path-parsing");let p=await Promise.resolve().then(()=>(iN(),nN));if(!p.existsSync(t))throw hn("FILE_DOES_NOT_EXIST",a,t);if(p.lstatSync(t).isDirectory())throw hn("LOCATION_NOT_FOUND",a,t);u=p.readFileSync(t),h=h||t.split(".").pop()||""}else throw hn("INVALID_INPUT",a);if(u.length>0&&!h)try{let{fileTypeFromBuffer:p}=await I2(),m=await p(u);m&&(h=m.ext)}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}else if(u.length>0&&h)try{let{fileTypeFromBuffer:p}=await I2(),m=await p(u);m&&m.ext.toLowerCase()!==h.toLowerCase()&&Ce("BUFFER_TYPE_MISMATCH",a,{detected:m.ext,expected:h})}catch(p){Ce("FILE_TYPE_DETECTION_FAILED",a,{error:p})}if(!h)throw hn("IMPROPER_BUFFERS",a);let f;switch(h.toLowerCase()){case"docx":f=await VD(u,a);break;case"pptx":f=await WD(u,a);break;case"xlsx":f=await GE(u,a);break;case"odt":case"odp":case"ods":f=await qE(u,a);break;case"pdf":f=await HD(u,a);break;case"rtf":f=await qD(u,a);break;case"csv":f=await Gv(u,a);break;case"html":f=await HE(u,a);break;case"md":f=await WE(u,a);break;default:throw hn("EXTENSION_UNSUPPORTED",a,h)}return f.warnings=l,i&&i(f),f}catch(f){let p=dv(f,a,d);throw i&&i(void 0,p),p}}static async terminateOcr(){await jE()}};B();var yb=class{static async convert(t,e,n){let i={...n?.parseConfig,onWarning:n?.onWarning||n?.parseConfig?.onWarning};i.ocr=!1,Object.keys(i).forEach(c=>i[c]===void 0&&delete i[c]),i.extractAttachments=n?.generatorConfig?.includeImages!==!1||n?.generatorConfig?.includeCharts!==!1;let s=await rl.parseOffice(t,i),a={...n?.generatorConfig,onWarning:n?.onWarning||n?.generatorConfig?.onWarning},l=await Ka.generate(s,e,a);return l.messages=[...s.warnings||[],...l.messages],l}};var M4=rl.parseOffice,O4=rl.terminateOcr,F4=yb.convert,P4=Ka.generate;var R4=rl;export{yb as OfficeConverter,ov as OfficeErrorType,Ka as OfficeGenerator,rl as OfficeParser,lv as OfficeWarningType,F4 as convert,R4 as default,P4 as generate,M4 as parseOffice,O4 as terminateOcr};
|
|
753
757
|
/*! Bundled license information:
|
|
754
758
|
|
|
755
759
|
ieee754/index.js:
|
package/dist/sbom.cdx.json
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.6",
|
|
5
5
|
"version": 1,
|
|
6
|
-
"serialNumber": "urn:uuid:
|
|
6
|
+
"serialNumber": "urn:uuid:f7b4727c-cc25-4873-89af-c1967daf7038",
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-05-
|
|
8
|
+
"timestamp": "2026-05-15T21:23:51.910Z",
|
|
9
9
|
"tools": {
|
|
10
10
|
"components": [
|
|
11
11
|
{
|
|
12
12
|
"type": "application",
|
|
13
13
|
"name": "npm",
|
|
14
|
-
"version": "11.
|
|
14
|
+
"version": "11.12.1"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"type": "application",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"component": {
|
|
83
83
|
"type": "application",
|
|
84
84
|
"name": "officeparser",
|
|
85
|
-
"version": "7.0.
|
|
86
|
-
"bom-ref": "officeparser@7.0.
|
|
85
|
+
"version": "7.0.3",
|
|
86
|
+
"bom-ref": "officeparser@7.0.3",
|
|
87
87
|
"author": "Harsh Ankur",
|
|
88
88
|
"description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf, .csv, .md, .html) and generating high-fidelity outputs in Markdown, HTML, CSV, RTF, and RAG-focused chunks.",
|
|
89
89
|
"licenses": [
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
],
|
|
97
|
-
"purl": "pkg:npm/officeparser@7.0.
|
|
97
|
+
"purl": "pkg:npm/officeparser@7.0.3?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2Fharshankur%2FofficeParser.git",
|
|
98
98
|
"externalReferences": [
|
|
99
99
|
{
|
|
100
100
|
"url": "git+https://github.com/harshankur/officeParser.git",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"name": "xmldom",
|
|
127
127
|
"group": "@xmldom",
|
|
128
128
|
"version": "0.9.10",
|
|
129
|
-
"bom-ref": "officeparser@7.0.
|
|
129
|
+
"bom-ref": "officeparser@7.0.3|@xmldom/xmldom@0.9.10",
|
|
130
130
|
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
|
131
131
|
"licenses": [
|
|
132
132
|
{
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"type": "library",
|
|
177
177
|
"name": "fflate",
|
|
178
178
|
"version": "0.8.2",
|
|
179
|
-
"bom-ref": "officeparser@7.0.
|
|
179
|
+
"bom-ref": "officeparser@7.0.3|fflate@0.8.2",
|
|
180
180
|
"author": "Arjun Barrett",
|
|
181
181
|
"description": "High performance (de)compression in an 8kB package",
|
|
182
182
|
"licenses": [
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
"type": "library",
|
|
228
228
|
"name": "file-type",
|
|
229
229
|
"version": "22.0.1",
|
|
230
|
-
"bom-ref": "officeparser@7.0.
|
|
230
|
+
"bom-ref": "officeparser@7.0.3|file-type@22.0.1",
|
|
231
231
|
"author": "Sindre Sorhus",
|
|
232
232
|
"description": "Detect the file type of a file, stream, or data",
|
|
233
233
|
"licenses": [
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
"type": "library",
|
|
279
279
|
"name": "pdfjs-dist",
|
|
280
280
|
"version": "5.6.205",
|
|
281
|
-
"bom-ref": "officeparser@7.0.
|
|
281
|
+
"bom-ref": "officeparser@7.0.3|pdfjs-dist@5.6.205",
|
|
282
282
|
"description": "Generic build of Mozilla's PDF.js library.",
|
|
283
283
|
"licenses": [
|
|
284
284
|
{
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
"type": "library",
|
|
329
329
|
"name": "tesseract.js",
|
|
330
330
|
"version": "7.0.0",
|
|
331
|
-
"bom-ref": "officeparser@7.0.
|
|
331
|
+
"bom-ref": "officeparser@7.0.3|tesseract.js@7.0.0",
|
|
332
332
|
"description": "Pure Javascript Multilingual OCR",
|
|
333
333
|
"licenses": [
|
|
334
334
|
{
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
"name": "inflate",
|
|
380
380
|
"group": "@tokenizer",
|
|
381
381
|
"version": "0.4.1",
|
|
382
|
-
"bom-ref": "officeparser@7.0.
|
|
382
|
+
"bom-ref": "officeparser@7.0.3|@tokenizer/inflate@0.4.1",
|
|
383
383
|
"author": "Borewit",
|
|
384
384
|
"description": "Tokenized zip support",
|
|
385
385
|
"licenses": [
|
|
@@ -430,7 +430,7 @@
|
|
|
430
430
|
"type": "library",
|
|
431
431
|
"name": "strtok3",
|
|
432
432
|
"version": "10.3.5",
|
|
433
|
-
"bom-ref": "officeparser@7.0.
|
|
433
|
+
"bom-ref": "officeparser@7.0.3|strtok3@10.3.5",
|
|
434
434
|
"author": "Borewit",
|
|
435
435
|
"description": "A promise based streaming tokenizer",
|
|
436
436
|
"licenses": [
|
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
"type": "library",
|
|
482
482
|
"name": "token-types",
|
|
483
483
|
"version": "6.1.2",
|
|
484
|
-
"bom-ref": "officeparser@7.0.
|
|
484
|
+
"bom-ref": "officeparser@7.0.3|token-types@6.1.2",
|
|
485
485
|
"author": "Borewit",
|
|
486
486
|
"description": "Common token types for decoding and encoding numeric and string values",
|
|
487
487
|
"licenses": [
|
|
@@ -532,7 +532,7 @@
|
|
|
532
532
|
"type": "library",
|
|
533
533
|
"name": "uint8array-extras",
|
|
534
534
|
"version": "1.5.0",
|
|
535
|
-
"bom-ref": "officeparser@7.0.
|
|
535
|
+
"bom-ref": "officeparser@7.0.3|uint8array-extras@1.5.0",
|
|
536
536
|
"author": "Sindre Sorhus",
|
|
537
537
|
"description": "Useful utilities for working with Uint8Array (and Buffer)",
|
|
538
538
|
"licenses": [
|
|
@@ -584,7 +584,7 @@
|
|
|
584
584
|
"name": "canvas",
|
|
585
585
|
"group": "@napi-rs",
|
|
586
586
|
"version": "0.1.97",
|
|
587
|
-
"bom-ref": "officeparser@7.0.
|
|
587
|
+
"bom-ref": "officeparser@7.0.3|@napi-rs/canvas@0.1.97",
|
|
588
588
|
"description": "Canvas for Node.js with skia backend",
|
|
589
589
|
"scope": "optional",
|
|
590
590
|
"licenses": [
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
"type": "library",
|
|
636
636
|
"name": "node-readable-to-web-readable-stream",
|
|
637
637
|
"version": "0.4.2",
|
|
638
|
-
"bom-ref": "officeparser@7.0.
|
|
638
|
+
"bom-ref": "officeparser@7.0.3|node-readable-to-web-readable-stream@0.4.2",
|
|
639
639
|
"author": "Borewit",
|
|
640
640
|
"description": "Convert Node Readable to Web API ReadableStream",
|
|
641
641
|
"scope": "optional",
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
"type": "library",
|
|
688
688
|
"name": "bmp-js",
|
|
689
689
|
"version": "0.1.0",
|
|
690
|
-
"bom-ref": "officeparser@7.0.
|
|
690
|
+
"bom-ref": "officeparser@7.0.3|bmp-js@0.1.0",
|
|
691
691
|
"author": "shaozilee",
|
|
692
692
|
"description": "A pure javascript BMP encoder and decoder",
|
|
693
693
|
"licenses": [
|
|
@@ -738,7 +738,7 @@
|
|
|
738
738
|
"type": "library",
|
|
739
739
|
"name": "idb-keyval",
|
|
740
740
|
"version": "6.2.2",
|
|
741
|
-
"bom-ref": "officeparser@7.0.
|
|
741
|
+
"bom-ref": "officeparser@7.0.3|idb-keyval@6.2.2",
|
|
742
742
|
"author": "Jake Archibald",
|
|
743
743
|
"description": "A super-simple-small keyval store built on top of IndexedDB",
|
|
744
744
|
"licenses": [
|
|
@@ -789,7 +789,7 @@
|
|
|
789
789
|
"type": "library",
|
|
790
790
|
"name": "is-url",
|
|
791
791
|
"version": "1.2.4",
|
|
792
|
-
"bom-ref": "officeparser@7.0.
|
|
792
|
+
"bom-ref": "officeparser@7.0.3|is-url@1.2.4",
|
|
793
793
|
"description": "Check whether a string is a URL.",
|
|
794
794
|
"licenses": [
|
|
795
795
|
{
|
|
@@ -839,7 +839,7 @@
|
|
|
839
839
|
"type": "library",
|
|
840
840
|
"name": "node-fetch",
|
|
841
841
|
"version": "2.7.0",
|
|
842
|
-
"bom-ref": "officeparser@7.0.
|
|
842
|
+
"bom-ref": "officeparser@7.0.3|node-fetch@2.7.0",
|
|
843
843
|
"author": "David Frank",
|
|
844
844
|
"description": "A light-weight module that brings window.fetch to node.js",
|
|
845
845
|
"licenses": [
|
|
@@ -890,7 +890,7 @@
|
|
|
890
890
|
"type": "library",
|
|
891
891
|
"name": "opencollective-postinstall",
|
|
892
892
|
"version": "2.0.3",
|
|
893
|
-
"bom-ref": "officeparser@7.0.
|
|
893
|
+
"bom-ref": "officeparser@7.0.3|opencollective-postinstall@2.0.3",
|
|
894
894
|
"author": "Xavier Damman",
|
|
895
895
|
"description": "Lightweight npm postinstall message to invite people to donate to your collective",
|
|
896
896
|
"licenses": [
|
|
@@ -941,7 +941,7 @@
|
|
|
941
941
|
"type": "library",
|
|
942
942
|
"name": "regenerator-runtime",
|
|
943
943
|
"version": "0.13.11",
|
|
944
|
-
"bom-ref": "officeparser@7.0.
|
|
944
|
+
"bom-ref": "officeparser@7.0.3|regenerator-runtime@0.13.11",
|
|
945
945
|
"author": "Ben Newman",
|
|
946
946
|
"description": "Runtime for Regenerator-compiled generator and async functions.",
|
|
947
947
|
"licenses": [
|
|
@@ -992,7 +992,7 @@
|
|
|
992
992
|
"type": "library",
|
|
993
993
|
"name": "tesseract.js-core",
|
|
994
994
|
"version": "7.0.0",
|
|
995
|
-
"bom-ref": "officeparser@7.0.
|
|
995
|
+
"bom-ref": "officeparser@7.0.3|tesseract.js-core@7.0.0",
|
|
996
996
|
"author": "antimatter15",
|
|
997
997
|
"description": "Tesseract C++ API in Pure Javascript",
|
|
998
998
|
"licenses": [
|
|
@@ -1043,7 +1043,7 @@
|
|
|
1043
1043
|
"type": "library",
|
|
1044
1044
|
"name": "wasm-feature-detect",
|
|
1045
1045
|
"version": "1.8.0",
|
|
1046
|
-
"bom-ref": "officeparser@7.0.
|
|
1046
|
+
"bom-ref": "officeparser@7.0.3|wasm-feature-detect@1.8.0",
|
|
1047
1047
|
"author": "Surma",
|
|
1048
1048
|
"description": "A small library to detect which features of WebAssembly are supported in your current browser.",
|
|
1049
1049
|
"licenses": [
|
|
@@ -1094,7 +1094,7 @@
|
|
|
1094
1094
|
"type": "library",
|
|
1095
1095
|
"name": "zlibjs",
|
|
1096
1096
|
"version": "0.3.1",
|
|
1097
|
-
"bom-ref": "officeparser@7.0.
|
|
1097
|
+
"bom-ref": "officeparser@7.0.3|zlibjs@0.3.1",
|
|
1098
1098
|
"author": "Yuta Imaya",
|
|
1099
1099
|
"description": "zlib, gzip and zip implementation in JavaScript",
|
|
1100
1100
|
"licenses": [
|
|
@@ -1145,7 +1145,7 @@
|
|
|
1145
1145
|
"type": "library",
|
|
1146
1146
|
"name": "debug",
|
|
1147
1147
|
"version": "4.4.3",
|
|
1148
|
-
"bom-ref": "officeparser@7.0.
|
|
1148
|
+
"bom-ref": "officeparser@7.0.3|debug@4.4.3",
|
|
1149
1149
|
"author": "Josh Junon",
|
|
1150
1150
|
"description": "Lightweight debugging utility for Node.js and the browser",
|
|
1151
1151
|
"licenses": [
|
|
@@ -1197,7 +1197,7 @@
|
|
|
1197
1197
|
"name": "token",
|
|
1198
1198
|
"group": "@tokenizer",
|
|
1199
1199
|
"version": "0.3.0",
|
|
1200
|
-
"bom-ref": "officeparser@7.0.
|
|
1200
|
+
"bom-ref": "officeparser@7.0.3|@tokenizer/token@0.3.0",
|
|
1201
1201
|
"author": "Borewit",
|
|
1202
1202
|
"description": "TypeScript definition for strtok3 token",
|
|
1203
1203
|
"licenses": [
|
|
@@ -1249,7 +1249,7 @@
|
|
|
1249
1249
|
"name": "text-codec",
|
|
1250
1250
|
"group": "@borewit",
|
|
1251
1251
|
"version": "0.2.2",
|
|
1252
|
-
"bom-ref": "officeparser@7.0.
|
|
1252
|
+
"bom-ref": "officeparser@7.0.3|@borewit/text-codec@0.2.2",
|
|
1253
1253
|
"author": "Borewit",
|
|
1254
1254
|
"description": "Text Decoder",
|
|
1255
1255
|
"licenses": [
|
|
@@ -1300,7 +1300,7 @@
|
|
|
1300
1300
|
"type": "library",
|
|
1301
1301
|
"name": "ieee754",
|
|
1302
1302
|
"version": "1.2.1",
|
|
1303
|
-
"bom-ref": "officeparser@7.0.
|
|
1303
|
+
"bom-ref": "officeparser@7.0.3|ieee754@1.2.1",
|
|
1304
1304
|
"author": "Feross Aboukhadijeh",
|
|
1305
1305
|
"description": "Read/write IEEE754 floating point numbers from/to a Buffer or array-like object",
|
|
1306
1306
|
"licenses": [
|
|
@@ -1352,7 +1352,7 @@
|
|
|
1352
1352
|
"name": "canvas-linux-x64-gnu",
|
|
1353
1353
|
"group": "@napi-rs",
|
|
1354
1354
|
"version": "0.1.97",
|
|
1355
|
-
"bom-ref": "officeparser@7.0.
|
|
1355
|
+
"bom-ref": "officeparser@7.0.3|@napi-rs/canvas-linux-x64-gnu@0.1.97",
|
|
1356
1356
|
"description": "Canvas for Node.js with skia backend",
|
|
1357
1357
|
"scope": "optional",
|
|
1358
1358
|
"licenses": [
|
|
@@ -1404,7 +1404,7 @@
|
|
|
1404
1404
|
"name": "canvas-linux-x64-musl",
|
|
1405
1405
|
"group": "@napi-rs",
|
|
1406
1406
|
"version": "0.1.97",
|
|
1407
|
-
"bom-ref": "officeparser@7.0.
|
|
1407
|
+
"bom-ref": "officeparser@7.0.3|@napi-rs/canvas-linux-x64-musl@0.1.97",
|
|
1408
1408
|
"description": "Canvas for Node.js with skia backend",
|
|
1409
1409
|
"scope": "optional",
|
|
1410
1410
|
"licenses": [
|
|
@@ -1455,7 +1455,7 @@
|
|
|
1455
1455
|
"type": "library",
|
|
1456
1456
|
"name": "whatwg-url",
|
|
1457
1457
|
"version": "5.0.0",
|
|
1458
|
-
"bom-ref": "officeparser@7.0.
|
|
1458
|
+
"bom-ref": "officeparser@7.0.3|whatwg-url@5.0.0",
|
|
1459
1459
|
"author": "Sebastian Mayr",
|
|
1460
1460
|
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery",
|
|
1461
1461
|
"licenses": [
|
|
@@ -1506,7 +1506,7 @@
|
|
|
1506
1506
|
"type": "library",
|
|
1507
1507
|
"name": "ms",
|
|
1508
1508
|
"version": "2.1.3",
|
|
1509
|
-
"bom-ref": "officeparser@7.0.
|
|
1509
|
+
"bom-ref": "officeparser@7.0.3|ms@2.1.3",
|
|
1510
1510
|
"description": "Tiny millisecond conversion utility",
|
|
1511
1511
|
"licenses": [
|
|
1512
1512
|
{
|
|
@@ -1556,7 +1556,7 @@
|
|
|
1556
1556
|
"type": "library",
|
|
1557
1557
|
"name": "tr46",
|
|
1558
1558
|
"version": "0.0.3",
|
|
1559
|
-
"bom-ref": "officeparser@7.0.
|
|
1559
|
+
"bom-ref": "officeparser@7.0.3|tr46@0.0.3",
|
|
1560
1560
|
"author": "Sebastian Mayr",
|
|
1561
1561
|
"description": "An implementation of the Unicode TR46 spec",
|
|
1562
1562
|
"licenses": [
|
|
@@ -1607,7 +1607,7 @@
|
|
|
1607
1607
|
"type": "library",
|
|
1608
1608
|
"name": "webidl-conversions",
|
|
1609
1609
|
"version": "3.0.1",
|
|
1610
|
-
"bom-ref": "officeparser@7.0.
|
|
1610
|
+
"bom-ref": "officeparser@7.0.3|webidl-conversions@3.0.1",
|
|
1611
1611
|
"author": "Domenic Denicola",
|
|
1612
1612
|
"description": "Implements the WebIDL algorithms for converting to and from JavaScript values",
|
|
1613
1613
|
"licenses": [
|
|
@@ -1657,151 +1657,151 @@
|
|
|
1657
1657
|
],
|
|
1658
1658
|
"dependencies": [
|
|
1659
1659
|
{
|
|
1660
|
-
"ref": "officeparser@7.0.
|
|
1660
|
+
"ref": "officeparser@7.0.3",
|
|
1661
1661
|
"dependsOn": [
|
|
1662
|
-
"officeparser@7.0.
|
|
1663
|
-
"officeparser@7.0.
|
|
1664
|
-
"officeparser@7.0.
|
|
1665
|
-
"officeparser@7.0.
|
|
1666
|
-
"officeparser@7.0.
|
|
1662
|
+
"officeparser@7.0.3|@xmldom/xmldom@0.9.10",
|
|
1663
|
+
"officeparser@7.0.3|fflate@0.8.2",
|
|
1664
|
+
"officeparser@7.0.3|file-type@22.0.1",
|
|
1665
|
+
"officeparser@7.0.3|pdfjs-dist@5.6.205",
|
|
1666
|
+
"officeparser@7.0.3|tesseract.js@7.0.0"
|
|
1667
1667
|
]
|
|
1668
1668
|
},
|
|
1669
1669
|
{
|
|
1670
|
-
"ref": "officeparser@7.0.
|
|
1670
|
+
"ref": "officeparser@7.0.3|@xmldom/xmldom@0.9.10"
|
|
1671
1671
|
},
|
|
1672
1672
|
{
|
|
1673
|
-
"ref": "officeparser@7.0.
|
|
1673
|
+
"ref": "officeparser@7.0.3|fflate@0.8.2"
|
|
1674
1674
|
},
|
|
1675
1675
|
{
|
|
1676
|
-
"ref": "officeparser@7.0.
|
|
1676
|
+
"ref": "officeparser@7.0.3|file-type@22.0.1",
|
|
1677
1677
|
"dependsOn": [
|
|
1678
|
-
"officeparser@7.0.
|
|
1679
|
-
"officeparser@7.0.
|
|
1680
|
-
"officeparser@7.0.
|
|
1681
|
-
"officeparser@7.0.
|
|
1678
|
+
"officeparser@7.0.3|@tokenizer/inflate@0.4.1",
|
|
1679
|
+
"officeparser@7.0.3|strtok3@10.3.5",
|
|
1680
|
+
"officeparser@7.0.3|token-types@6.1.2",
|
|
1681
|
+
"officeparser@7.0.3|uint8array-extras@1.5.0"
|
|
1682
1682
|
]
|
|
1683
1683
|
},
|
|
1684
1684
|
{
|
|
1685
|
-
"ref": "officeparser@7.0.
|
|
1685
|
+
"ref": "officeparser@7.0.3|pdfjs-dist@5.6.205",
|
|
1686
1686
|
"dependsOn": [
|
|
1687
|
-
"officeparser@7.0.
|
|
1688
|
-
"officeparser@7.0.
|
|
1687
|
+
"officeparser@7.0.3|@napi-rs/canvas@0.1.97",
|
|
1688
|
+
"officeparser@7.0.3|node-readable-to-web-readable-stream@0.4.2"
|
|
1689
1689
|
]
|
|
1690
1690
|
},
|
|
1691
1691
|
{
|
|
1692
|
-
"ref": "officeparser@7.0.
|
|
1692
|
+
"ref": "officeparser@7.0.3|tesseract.js@7.0.0",
|
|
1693
1693
|
"dependsOn": [
|
|
1694
|
-
"officeparser@7.0.
|
|
1695
|
-
"officeparser@7.0.
|
|
1696
|
-
"officeparser@7.0.
|
|
1697
|
-
"officeparser@7.0.
|
|
1698
|
-
"officeparser@7.0.
|
|
1699
|
-
"officeparser@7.0.
|
|
1700
|
-
"officeparser@7.0.
|
|
1701
|
-
"officeparser@7.0.
|
|
1702
|
-
"officeparser@7.0.
|
|
1694
|
+
"officeparser@7.0.3|bmp-js@0.1.0",
|
|
1695
|
+
"officeparser@7.0.3|idb-keyval@6.2.2",
|
|
1696
|
+
"officeparser@7.0.3|is-url@1.2.4",
|
|
1697
|
+
"officeparser@7.0.3|node-fetch@2.7.0",
|
|
1698
|
+
"officeparser@7.0.3|opencollective-postinstall@2.0.3",
|
|
1699
|
+
"officeparser@7.0.3|regenerator-runtime@0.13.11",
|
|
1700
|
+
"officeparser@7.0.3|tesseract.js-core@7.0.0",
|
|
1701
|
+
"officeparser@7.0.3|wasm-feature-detect@1.8.0",
|
|
1702
|
+
"officeparser@7.0.3|zlibjs@0.3.1"
|
|
1703
1703
|
]
|
|
1704
1704
|
},
|
|
1705
1705
|
{
|
|
1706
|
-
"ref": "officeparser@7.0.
|
|
1706
|
+
"ref": "officeparser@7.0.3|@tokenizer/inflate@0.4.1",
|
|
1707
1707
|
"dependsOn": [
|
|
1708
|
-
"officeparser@7.0.
|
|
1709
|
-
"officeparser@7.0.
|
|
1708
|
+
"officeparser@7.0.3|debug@4.4.3",
|
|
1709
|
+
"officeparser@7.0.3|token-types@6.1.2"
|
|
1710
1710
|
]
|
|
1711
1711
|
},
|
|
1712
1712
|
{
|
|
1713
|
-
"ref": "officeparser@7.0.
|
|
1713
|
+
"ref": "officeparser@7.0.3|strtok3@10.3.5",
|
|
1714
1714
|
"dependsOn": [
|
|
1715
|
-
"officeparser@7.0.
|
|
1715
|
+
"officeparser@7.0.3|@tokenizer/token@0.3.0"
|
|
1716
1716
|
]
|
|
1717
1717
|
},
|
|
1718
1718
|
{
|
|
1719
|
-
"ref": "officeparser@7.0.
|
|
1719
|
+
"ref": "officeparser@7.0.3|token-types@6.1.2",
|
|
1720
1720
|
"dependsOn": [
|
|
1721
|
-
"officeparser@7.0.
|
|
1722
|
-
"officeparser@7.0.
|
|
1723
|
-
"officeparser@7.0.
|
|
1721
|
+
"officeparser@7.0.3|@borewit/text-codec@0.2.2",
|
|
1722
|
+
"officeparser@7.0.3|@tokenizer/token@0.3.0",
|
|
1723
|
+
"officeparser@7.0.3|ieee754@1.2.1"
|
|
1724
1724
|
]
|
|
1725
1725
|
},
|
|
1726
1726
|
{
|
|
1727
|
-
"ref": "officeparser@7.0.
|
|
1727
|
+
"ref": "officeparser@7.0.3|uint8array-extras@1.5.0"
|
|
1728
1728
|
},
|
|
1729
1729
|
{
|
|
1730
|
-
"ref": "officeparser@7.0.
|
|
1730
|
+
"ref": "officeparser@7.0.3|@napi-rs/canvas@0.1.97",
|
|
1731
1731
|
"dependsOn": [
|
|
1732
|
-
"officeparser@7.0.
|
|
1733
|
-
"officeparser@7.0.
|
|
1732
|
+
"officeparser@7.0.3|@napi-rs/canvas-linux-x64-gnu@0.1.97",
|
|
1733
|
+
"officeparser@7.0.3|@napi-rs/canvas-linux-x64-musl@0.1.97"
|
|
1734
1734
|
]
|
|
1735
1735
|
},
|
|
1736
1736
|
{
|
|
1737
|
-
"ref": "officeparser@7.0.
|
|
1737
|
+
"ref": "officeparser@7.0.3|node-readable-to-web-readable-stream@0.4.2"
|
|
1738
1738
|
},
|
|
1739
1739
|
{
|
|
1740
|
-
"ref": "officeparser@7.0.
|
|
1740
|
+
"ref": "officeparser@7.0.3|bmp-js@0.1.0"
|
|
1741
1741
|
},
|
|
1742
1742
|
{
|
|
1743
|
-
"ref": "officeparser@7.0.
|
|
1743
|
+
"ref": "officeparser@7.0.3|idb-keyval@6.2.2"
|
|
1744
1744
|
},
|
|
1745
1745
|
{
|
|
1746
|
-
"ref": "officeparser@7.0.
|
|
1746
|
+
"ref": "officeparser@7.0.3|is-url@1.2.4"
|
|
1747
1747
|
},
|
|
1748
1748
|
{
|
|
1749
|
-
"ref": "officeparser@7.0.
|
|
1749
|
+
"ref": "officeparser@7.0.3|node-fetch@2.7.0",
|
|
1750
1750
|
"dependsOn": [
|
|
1751
|
-
"officeparser@7.0.
|
|
1751
|
+
"officeparser@7.0.3|whatwg-url@5.0.0"
|
|
1752
1752
|
]
|
|
1753
1753
|
},
|
|
1754
1754
|
{
|
|
1755
|
-
"ref": "officeparser@7.0.
|
|
1755
|
+
"ref": "officeparser@7.0.3|opencollective-postinstall@2.0.3"
|
|
1756
1756
|
},
|
|
1757
1757
|
{
|
|
1758
|
-
"ref": "officeparser@7.0.
|
|
1758
|
+
"ref": "officeparser@7.0.3|regenerator-runtime@0.13.11"
|
|
1759
1759
|
},
|
|
1760
1760
|
{
|
|
1761
|
-
"ref": "officeparser@7.0.
|
|
1761
|
+
"ref": "officeparser@7.0.3|tesseract.js-core@7.0.0"
|
|
1762
1762
|
},
|
|
1763
1763
|
{
|
|
1764
|
-
"ref": "officeparser@7.0.
|
|
1764
|
+
"ref": "officeparser@7.0.3|wasm-feature-detect@1.8.0"
|
|
1765
1765
|
},
|
|
1766
1766
|
{
|
|
1767
|
-
"ref": "officeparser@7.0.
|
|
1767
|
+
"ref": "officeparser@7.0.3|zlibjs@0.3.1"
|
|
1768
1768
|
},
|
|
1769
1769
|
{
|
|
1770
|
-
"ref": "officeparser@7.0.
|
|
1770
|
+
"ref": "officeparser@7.0.3|debug@4.4.3",
|
|
1771
1771
|
"dependsOn": [
|
|
1772
|
-
"officeparser@7.0.
|
|
1772
|
+
"officeparser@7.0.3|ms@2.1.3"
|
|
1773
1773
|
]
|
|
1774
1774
|
},
|
|
1775
1775
|
{
|
|
1776
|
-
"ref": "officeparser@7.0.
|
|
1776
|
+
"ref": "officeparser@7.0.3|@tokenizer/token@0.3.0"
|
|
1777
1777
|
},
|
|
1778
1778
|
{
|
|
1779
|
-
"ref": "officeparser@7.0.
|
|
1779
|
+
"ref": "officeparser@7.0.3|@borewit/text-codec@0.2.2"
|
|
1780
1780
|
},
|
|
1781
1781
|
{
|
|
1782
|
-
"ref": "officeparser@7.0.
|
|
1782
|
+
"ref": "officeparser@7.0.3|ieee754@1.2.1"
|
|
1783
1783
|
},
|
|
1784
1784
|
{
|
|
1785
|
-
"ref": "officeparser@7.0.
|
|
1785
|
+
"ref": "officeparser@7.0.3|@napi-rs/canvas-linux-x64-gnu@0.1.97"
|
|
1786
1786
|
},
|
|
1787
1787
|
{
|
|
1788
|
-
"ref": "officeparser@7.0.
|
|
1788
|
+
"ref": "officeparser@7.0.3|@napi-rs/canvas-linux-x64-musl@0.1.97"
|
|
1789
1789
|
},
|
|
1790
1790
|
{
|
|
1791
|
-
"ref": "officeparser@7.0.
|
|
1791
|
+
"ref": "officeparser@7.0.3|whatwg-url@5.0.0",
|
|
1792
1792
|
"dependsOn": [
|
|
1793
|
-
"officeparser@7.0.
|
|
1794
|
-
"officeparser@7.0.
|
|
1793
|
+
"officeparser@7.0.3|tr46@0.0.3",
|
|
1794
|
+
"officeparser@7.0.3|webidl-conversions@3.0.1"
|
|
1795
1795
|
]
|
|
1796
1796
|
},
|
|
1797
1797
|
{
|
|
1798
|
-
"ref": "officeparser@7.0.
|
|
1798
|
+
"ref": "officeparser@7.0.3|ms@2.1.3"
|
|
1799
1799
|
},
|
|
1800
1800
|
{
|
|
1801
|
-
"ref": "officeparser@7.0.
|
|
1801
|
+
"ref": "officeparser@7.0.3|tr46@0.0.3"
|
|
1802
1802
|
},
|
|
1803
1803
|
{
|
|
1804
|
-
"ref": "officeparser@7.0.
|
|
1804
|
+
"ref": "officeparser@7.0.3|webidl-conversions@3.0.1"
|
|
1805
1805
|
}
|
|
1806
1806
|
]
|
|
1807
1807
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare enum OfficeErrorType {
|
|
|
15
15
|
IMPROPER_ARGUMENTS = "IMPROPER_ARGUMENTS",
|
|
16
16
|
/** Error occurred while reading or processing file buffers */
|
|
17
17
|
IMPROPER_BUFFERS = "IMPROPER_BUFFERS",
|
|
18
|
-
/** Input type is not a supported type (string, Buffer, ArrayBuffer) */
|
|
18
|
+
/** Input type is not a supported type (string, Buffer, ArrayBuffer, Uint8Array) */
|
|
19
19
|
INVALID_INPUT = "INVALID_INPUT",
|
|
20
20
|
/** PDF worker source is missing (required in browser) */
|
|
21
21
|
PDF_WORKER_MISSING = "PDF_WORKER_MISSING",
|
package/dist/types.js
CHANGED
|
@@ -19,7 +19,7 @@ var OfficeErrorType;
|
|
|
19
19
|
OfficeErrorType["IMPROPER_ARGUMENTS"] = "IMPROPER_ARGUMENTS";
|
|
20
20
|
/** Error occurred while reading or processing file buffers */
|
|
21
21
|
OfficeErrorType["IMPROPER_BUFFERS"] = "IMPROPER_BUFFERS";
|
|
22
|
-
/** Input type is not a supported type (string, Buffer, ArrayBuffer) */
|
|
22
|
+
/** Input type is not a supported type (string, Buffer, ArrayBuffer, Uint8Array) */
|
|
23
23
|
OfficeErrorType["INVALID_INPUT"] = "INVALID_INPUT";
|
|
24
24
|
/** PDF worker source is missing (required in browser) */
|
|
25
25
|
OfficeErrorType["PDF_WORKER_MISSING"] = "PDF_WORKER_MISSING";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "officeparser",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3",
|
|
4
4
|
"description": "A robust, strictly-typed Node.js and Browser library for parsing office files (.docx, .pptx, .xlsx, .odt, .odp, .ods, .pdf, .rtf, .csv, .md, .html) and generating high-fidelity outputs in Markdown, HTML, CSV, RTF, and RAG-focused chunks.",
|
|
5
5
|
"funding": "https://github.com/sponsors/harshankur",
|
|
6
6
|
"main": "dist/index.js",
|