[{"data":1,"prerenderedAt":1282},["ShallowReactive",2],{"lit-docx-doc:\u002F":3,"lit-docx-source:recipes\u002Fread-text.ts":415,"lit-docx-source:recipes\u002Fcreate-report.ts":416,"mdc--wlncsa-key":417,"mdc--1ezb2t-key":1023},{"id":4,"title":5,"body":6,"description":403,"extension":404,"keywords":405,"locale":407,"meta":408,"navigation":409,"order":50,"path":410,"section":411,"seo":412,"stem":413,"__hash__":414},"docs\u002Findex.zh-CN.md","快速开始",{"type":7,"value":8,"toc":396},"minimark",[9,30,34,37,62,65,68,78,82,86,106,117,205,217,228,232,243,247,262,336,343,346,349,392],[10,11,12,16,17,20,21,25,26,29],"p",{},[13,14,15],"code",{},"@quirekit\u002Flit-docx"," 做两件事：",[13,18,19],{},"parseDocx"," 把 DOCX 文件读成 ",[22,23,24],"strong",{},"LitAST","（一棵普通 JSON 对象组成的文档树），",[13,27,28],{},"generateDocx"," 把 LitAST 写回 DOCX。它不依赖任何编辑器，也不读写文件系统，只处理字节，因此同一份代码可以跑在浏览器和 Node 中。它是 QuireKit 商业组件，以编译产物分发：开发与评估免费，免费版可带评估提示用于生产，设置授权码后去除提示；个人、教育、开源项目与小团队可免费申请社区授权码。",[31,32,33],"h2",{"id":33},"安装",[10,35,36],{},"lit-docx 目前是预览版，尚未发布到 npm。发布后的安装方式：",[38,39,44],"pre",{"className":40,"code":41,"language":42,"meta":43,"style":43},"language-bash shiki shiki-themes github-light github-light github-dark","pnpm add @quirekit\u002Flit-docx\n","bash","",[13,45,46],{"__ignoreMap":43},[47,48,51,55,59],"span",{"class":49,"line":50},"line",1,[47,52,54],{"class":53},"sgQzM","pnpm",[47,56,58],{"class":57},"s-HEn"," add",[47,60,61],{"class":57}," @quirekit\u002Flit-docx\n",[10,63,64],{},"运行环境要求 Node 18 及以上，或现代浏览器。包同时提供 ESM 与 CommonJS 两种格式。",[31,66,67],{"id":67},"在浏览器中试一试",[10,69,70,71,74,75,77],{},"下面的示例完全在当前页面中运行。默认载入一份由 lit-docx 生成的示例报告，也可以切换到“我的文件”打开自己的 ",[13,72,73],{},".docx","；解析结果可以看排版预览或 LitAST，再从 LitAST 生成新的 ",[13,76,73],{},"。",[79,80],"docs-demo",{"name":81},"demos\u002Fround-trip",[31,83,85],{"id":84},"读取一个-docx","读取一个 DOCX",[10,87,88,90,91,94,95,98,99,102,103,77],{},[13,89,19],{}," 接收完整文件的字节（",[13,92,93],{},"Uint8Array","），返回文档树 ",[13,96,97],{},"ast"," 与非致命警告 ",[13,100,101],{},"warnings","。不是 DOCX 的文件会抛出 ",[13,104,105],{},"DocxPackageError",[10,107,108,109,112,113,116],{},"先理解两个步骤：拿到文件字节，再解析文档。下面假设 ",[13,110,111],{},"file"," 是用户通过文件选择器选中的浏览器 ",[13,114,115],{},"File","：",[38,118,123],{"className":119,"code":120,"filename":121,"language":122,"meta":43,"style":43},"language-ts shiki shiki-themes github-light github-light github-dark","import { parseDocx } from '@quirekit\u002Flit-docx'\nconst bytes = new Uint8Array(await file.arrayBuffer())\nconst { ast, warnings } = await parseDocx(bytes)\n","读取浏览器文件","ts",[13,124,125,141,175],{"__ignoreMap":43},[47,126,127,131,135,138],{"class":49,"line":50},[47,128,130],{"class":129},"sDD9d","import",[47,132,134],{"class":133},"sVPnS"," { parseDocx } ",[47,136,137],{"class":129},"from",[47,139,140],{"class":57}," '@quirekit\u002Flit-docx'\n",[47,142,144,147,151,154,157,160,163,166,169,172],{"class":49,"line":143},2,[47,145,146],{"class":129},"const",[47,148,150],{"class":149},"sUNQB"," bytes",[47,152,153],{"class":129}," =",[47,155,156],{"class":129}," new",[47,158,159],{"class":53}," Uint8Array",[47,161,162],{"class":133},"(",[47,164,165],{"class":129},"await",[47,167,168],{"class":133}," file.",[47,170,171],{"class":53},"arrayBuffer",[47,173,174],{"class":133},"())\n",[47,176,178,180,183,185,188,190,193,196,199,202],{"class":49,"line":177},3,[47,179,146],{"class":129},[47,181,182],{"class":133}," { ",[47,184,97],{"class":149},[47,186,187],{"class":133},", ",[47,189,101],{"class":149},[47,191,192],{"class":133}," } ",[47,194,195],{"class":129},"=",[47,197,198],{"class":129}," await",[47,200,201],{"class":53}," parseDocx",[47,203,204],{"class":133},"(bytes)\n",[10,206,207,209,210,212,213,216],{},[13,208,97],{}," 是后续遍历或修改的文档树，",[13,211,101],{}," 是需要向用户说明的解析问题。Node 中可以用 ",[13,214,215],{},"readFile()"," 取得字节，解析调用不变。",[10,218,219,220,223,224,227],{},"需要提取段落文字时，再看以下完整模块：",[13,221,222],{},"recipes\u002Fread-text.ts"," 负责读文件与调用解析，",[13,225,226],{},"shared\u002Ftext.ts"," 负责遍历文字。",[229,230],"docs-recipe",{"name":231},"recipes\u002Fread-text",[10,233,234,235,238,239,242],{},"这里的 ",[13,236,237],{},"collectParagraphText"," 只是递归遍历节点：段落与标题的文字都在它们的 ",[13,240,241],{},"text"," 子节点里。",[31,244,246],{"id":245},"生成一个-docx","生成一个 DOCX",[10,248,249,250,253,254,257,258,261],{},"LitAST 就是普通对象，可以手写，也可以用包里的 ",[13,251,252],{},"docx"," 创作辅助函数来写，二者生成的结构完全相同。上面示例里的报告就是这样生成的：标题、带格式的文字、无序列表、带边框和底纹表头的表格、链接，以及带页眉页脚的 A4 页面设置。完整报告由 ",[13,255,256],{},"shared\u002Freport.ts"," 构造；",[13,259,260],{},"recipes\u002Fcreate-report.ts"," 只负责生成字节并写入文件。先从一个段落开始，理解生成过程：",[38,263,266],{"className":119,"code":264,"filename":265,"language":122,"meta":43,"style":43},"import { generateDocx } from '@quirekit\u002Flit-docx'\nconst bytes = await generateDocx({\n  type: 'document',\n  children: [{ type: 'paragraph', children: [{ type: 'text', text: '你好' }] }],\n})\n","生成一个段落",[13,267,268,279,295,306,330],{"__ignoreMap":43},[47,269,270,272,275,277],{"class":49,"line":50},[47,271,130],{"class":129},[47,273,274],{"class":133}," { generateDocx } ",[47,276,137],{"class":129},[47,278,140],{"class":57},[47,280,281,283,285,287,289,292],{"class":49,"line":143},[47,282,146],{"class":129},[47,284,150],{"class":149},[47,286,153],{"class":129},[47,288,198],{"class":129},[47,290,291],{"class":53}," generateDocx",[47,293,294],{"class":133},"({\n",[47,296,297,300,303],{"class":49,"line":177},[47,298,299],{"class":133},"  type: ",[47,301,302],{"class":57},"'document'",[47,304,305],{"class":133},",\n",[47,307,309,312,315,318,321,324,327],{"class":49,"line":308},4,[47,310,311],{"class":133},"  children: [{ type: ",[47,313,314],{"class":57},"'paragraph'",[47,316,317],{"class":133},", children: [{ type: ",[47,319,320],{"class":57},"'text'",[47,322,323],{"class":133},", text: ",[47,325,326],{"class":57},"'你好'",[47,328,329],{"class":133}," }] }],\n",[47,331,333],{"class":49,"line":332},5,[47,334,335],{"class":133},"})\n",[10,337,338,339,342],{},"返回的 ",[13,340,341],{},"bytes"," 可以写入 Node 文件，也可以在浏览器中下载。下面按文件查阅完整报告：",[229,344],{"name":345},"recipes\u002Fcreate-report",[31,347,348],{"id":348},"接下来",[350,351,352,361,371,378,385],"ul",{},[353,354,355,360],"li",{},[356,357,359],"a",{"href":358},"\u002Fguide\u002Freading","读取 DOCX","：输入类型、解析选项、警告与错误。",[353,362,363,367,368,370],{},[356,364,366],{"href":365},"\u002Fguide\u002Fgenerating","生成 DOCX","：手写节点与 ",[13,369,252],{}," 辅助函数，以及单位约定。",[353,372,373,377],{},[356,374,376],{"href":375},"\u002Fguide\u002Flitast","LitAST 节点模型","：有哪些节点和标记，各自长什么样。",[353,379,380,384],{},[356,381,383],{"href":382},"\u002Fguide\u002Fround-trip","往返与保留","：读进来再写回去时，哪些内容会原样保留，哪些不会。",[353,386,387,391],{},[356,388,390],{"href":389},"\u002Fsupport","支持范围","：各项 Word 功能在读取和生成两个方向上的支持情况。",[393,394,395],"style",{},"html pre.shiki code .sgQzM, html code.shiki .sgQzM{--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s-HEn, html code.shiki .s-HEn{--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sDD9d, html code.shiki .sDD9d{--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVPnS, html code.shiki .sVPnS{--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sUNQB, html code.shiki .sUNQB{--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF}",{"title":43,"searchDepth":143,"depth":143,"links":397},[398,399,400,401,402],{"id":33,"depth":143,"text":33},{"id":67,"depth":143,"text":67},{"id":84,"depth":143,"text":85},{"id":245,"depth":143,"text":246},{"id":348,"depth":143,"text":348},"把 DOCX 读成一棵可遍历的 LitAST，再从 LitAST 生成 DOCX；浏览器与 Node 通用。","md",[33,19,28,406],"入门","zh-CN",{},true,"\u002F","开始使用",{"title":5,"description":403},"index.zh-CN","IBaxE9KuSLBVOl9SvkfNQHKjDIs_B5VAAyXug9KAI9o","import { readFile } from \"node:fs\u002Fpromises\";\nimport { DocxPackageError, parseDocx } from \"@quirekit\u002Flit-docx\";\nimport { collectParagraphText } from \"..\u002Fshared\u002Ftext\";\n\n\u002F**\n * Reads a DOCX file and prints its paragraphs and parser warnings.\n * @param path - DOCX file on disk.\n * @returns Resolves after printing.\n *\u002F\nexport async function printDocx(path: string): Promise\u003Cvoid> {\n  try {\n    const { ast, warnings } = await parseDocx(new Uint8Array(await readFile(path)));\n    for (const line of collectParagraphText(ast)) console.log(line);\n    for (const warning of warnings) console.warn(`[${warning.code}] ${warning.message}`);\n  } catch (error) {\n    \u002F\u002F Not a DOCX ZIP package at all, or an encrypted \u002F legacy .doc container.\n    if (error instanceof DocxPackageError) console.error(`Cannot open ${path}: ${error.code}`);\n    else throw error;\n  }\n}\n","import { writeFile } from \"node:fs\u002Fpromises\";\nimport { generateDocx } from \"@quirekit\u002Flit-docx\";\nimport { createReport } from \"..\u002Fshared\u002Freport\";\n\n\u002F**\n * Writes the report to disk.\n * @param path - Destination `.docx` path.\n * @returns Resolves once the file is written.\n *\u002F\nexport async function writeReport(path: string): Promise\u003Cvoid> {\n  await writeFile(path, await generateDocx(createReport()));\n}\n",{"data":418,"body":419},{},{"type":420,"children":421},"root",[422,1018],{"type":423,"tag":38,"props":424,"children":426},"element",{"className":119,"code":425,"language":122,"meta":43,"style":43},"import { readFile } from \"node:fs\u002Fpromises\";\nimport { DocxPackageError, parseDocx } from \"@quirekit\u002Flit-docx\";\nimport { collectParagraphText } from \"..\u002Fshared\u002Ftext\";\n\n\u002F**\n * Reads a DOCX file and prints its paragraphs and parser warnings.\n * @param path - DOCX file on disk.\n * @returns Resolves after printing.\n *\u002F\nexport async function printDocx(path: string): Promise\u003Cvoid> {\n  try {\n    const { ast, warnings } = await parseDocx(new Uint8Array(await readFile(path)));\n    for (const line of collectParagraphText(ast)) console.log(line);\n    for (const warning of warnings) console.warn(`[${warning.code}] ${warning.message}`);\n  } catch (error) {\n    \u002F\u002F Not a DOCX ZIP package at all, or an encrypted \u002F legacy .doc container.\n    if (error instanceof DocxPackageError) console.error(`Cannot open ${path}: ${error.code}`);\n    else throw error;\n  }\n}\n\n",[427],{"type":423,"tag":13,"props":428,"children":429},{"__ignoreMap":43},[430,459,484,509,517,526,535,559,577,586,661,675,747,795,881,900,909,981,1000,1009],{"type":423,"tag":47,"props":431,"children":432},{"class":49,"line":50},[433,438,444,448,454],{"type":423,"tag":47,"props":434,"children":436},{"style":435},"--shiki-default:#D73A49;--shiki-light:#D73A49;--shiki-dark:#F97583",[437],{"type":241,"value":130},{"type":423,"tag":47,"props":439,"children":441},{"style":440},"--shiki-default:#24292E;--shiki-light:#24292E;--shiki-dark:#E1E4E8",[442],{"type":241,"value":443}," { readFile } ",{"type":423,"tag":47,"props":445,"children":446},{"style":435},[447],{"type":241,"value":137},{"type":423,"tag":47,"props":449,"children":451},{"style":450},"--shiki-default:#032F62;--shiki-light:#032F62;--shiki-dark:#9ECBFF",[452],{"type":241,"value":453}," \"node:fs\u002Fpromises\"",{"type":423,"tag":47,"props":455,"children":456},{"style":440},[457],{"type":241,"value":458},";\n",{"type":423,"tag":47,"props":460,"children":461},{"class":49,"line":143},[462,466,471,475,480],{"type":423,"tag":47,"props":463,"children":464},{"style":435},[465],{"type":241,"value":130},{"type":423,"tag":47,"props":467,"children":468},{"style":440},[469],{"type":241,"value":470}," { DocxPackageError, parseDocx } ",{"type":423,"tag":47,"props":472,"children":473},{"style":435},[474],{"type":241,"value":137},{"type":423,"tag":47,"props":476,"children":477},{"style":450},[478],{"type":241,"value":479}," \"@quirekit\u002Flit-docx\"",{"type":423,"tag":47,"props":481,"children":482},{"style":440},[483],{"type":241,"value":458},{"type":423,"tag":47,"props":485,"children":486},{"class":49,"line":177},[487,491,496,500,505],{"type":423,"tag":47,"props":488,"children":489},{"style":435},[490],{"type":241,"value":130},{"type":423,"tag":47,"props":492,"children":493},{"style":440},[494],{"type":241,"value":495}," { collectParagraphText } ",{"type":423,"tag":47,"props":497,"children":498},{"style":435},[499],{"type":241,"value":137},{"type":423,"tag":47,"props":501,"children":502},{"style":450},[503],{"type":241,"value":504}," \"..\u002Fshared\u002Ftext\"",{"type":423,"tag":47,"props":506,"children":507},{"style":440},[508],{"type":241,"value":458},{"type":423,"tag":47,"props":510,"children":511},{"class":49,"line":308},[512],{"type":423,"tag":47,"props":513,"children":514},{"emptyLinePlaceholder":409},[515],{"type":241,"value":516},"\n",{"type":423,"tag":47,"props":518,"children":519},{"class":49,"line":332},[520],{"type":423,"tag":47,"props":521,"children":523},{"style":522},"--shiki-default:#6A737D;--shiki-light:#6A737D;--shiki-dark:#6A737D",[524],{"type":241,"value":525},"\u002F**\n",{"type":423,"tag":47,"props":527,"children":529},{"class":49,"line":528},6,[530],{"type":423,"tag":47,"props":531,"children":532},{"style":522},[533],{"type":241,"value":534}," * Reads a DOCX file and prints its paragraphs and parser warnings.\n",{"type":423,"tag":47,"props":536,"children":538},{"class":49,"line":537},7,[539,544,549,554],{"type":423,"tag":47,"props":540,"children":541},{"style":522},[542],{"type":241,"value":543}," * ",{"type":423,"tag":47,"props":545,"children":546},{"style":435},[547],{"type":241,"value":548},"@param",{"type":423,"tag":47,"props":550,"children":551},{"style":440},[552],{"type":241,"value":553}," path",{"type":423,"tag":47,"props":555,"children":556},{"style":522},[557],{"type":241,"value":558}," - DOCX file on disk.\n",{"type":423,"tag":47,"props":560,"children":562},{"class":49,"line":561},8,[563,567,572],{"type":423,"tag":47,"props":564,"children":565},{"style":522},[566],{"type":241,"value":543},{"type":423,"tag":47,"props":568,"children":569},{"style":435},[570],{"type":241,"value":571},"@returns",{"type":423,"tag":47,"props":573,"children":574},{"style":522},[575],{"type":241,"value":576}," Resolves after printing.\n",{"type":423,"tag":47,"props":578,"children":580},{"class":49,"line":579},9,[581],{"type":423,"tag":47,"props":582,"children":583},{"style":522},[584],{"type":241,"value":585}," *\u002F\n",{"type":423,"tag":47,"props":587,"children":589},{"class":49,"line":588},10,[590,595,600,605,611,615,621,626,632,637,641,646,651,656],{"type":423,"tag":47,"props":591,"children":592},{"style":435},[593],{"type":241,"value":594},"export",{"type":423,"tag":47,"props":596,"children":597},{"style":435},[598],{"type":241,"value":599}," async",{"type":423,"tag":47,"props":601,"children":602},{"style":435},[603],{"type":241,"value":604}," function",{"type":423,"tag":47,"props":606,"children":608},{"style":607},"--shiki-default:#6F42C1;--shiki-light:#6F42C1;--shiki-dark:#B392F0",[609],{"type":241,"value":610}," printDocx",{"type":423,"tag":47,"props":612,"children":613},{"style":440},[614],{"type":241,"value":162},{"type":423,"tag":47,"props":616,"children":618},{"style":617},"--shiki-default:#E36209;--shiki-light:#E36209;--shiki-dark:#FFAB70",[619],{"type":241,"value":620},"path",{"type":423,"tag":47,"props":622,"children":623},{"style":435},[624],{"type":241,"value":625},":",{"type":423,"tag":47,"props":627,"children":629},{"style":628},"--shiki-default:#005CC5;--shiki-light:#005CC5;--shiki-dark:#79B8FF",[630],{"type":241,"value":631}," string",{"type":423,"tag":47,"props":633,"children":634},{"style":440},[635],{"type":241,"value":636},")",{"type":423,"tag":47,"props":638,"children":639},{"style":435},[640],{"type":241,"value":625},{"type":423,"tag":47,"props":642,"children":643},{"style":607},[644],{"type":241,"value":645}," Promise",{"type":423,"tag":47,"props":647,"children":648},{"style":440},[649],{"type":241,"value":650},"\u003C",{"type":423,"tag":47,"props":652,"children":653},{"style":628},[654],{"type":241,"value":655},"void",{"type":423,"tag":47,"props":657,"children":658},{"style":440},[659],{"type":241,"value":660},"> {\n",{"type":423,"tag":47,"props":662,"children":664},{"class":49,"line":663},11,[665,670],{"type":423,"tag":47,"props":666,"children":667},{"style":435},[668],{"type":241,"value":669},"  try",{"type":423,"tag":47,"props":671,"children":672},{"style":440},[673],{"type":241,"value":674}," {\n",{"type":423,"tag":47,"props":676,"children":678},{"class":49,"line":677},12,[679,684,688,692,696,700,704,708,712,716,720,725,729,733,737,742],{"type":423,"tag":47,"props":680,"children":681},{"style":435},[682],{"type":241,"value":683},"    const",{"type":423,"tag":47,"props":685,"children":686},{"style":440},[687],{"type":241,"value":182},{"type":423,"tag":47,"props":689,"children":690},{"style":628},[691],{"type":241,"value":97},{"type":423,"tag":47,"props":693,"children":694},{"style":440},[695],{"type":241,"value":187},{"type":423,"tag":47,"props":697,"children":698},{"style":628},[699],{"type":241,"value":101},{"type":423,"tag":47,"props":701,"children":702},{"style":440},[703],{"type":241,"value":192},{"type":423,"tag":47,"props":705,"children":706},{"style":435},[707],{"type":241,"value":195},{"type":423,"tag":47,"props":709,"children":710},{"style":435},[711],{"type":241,"value":198},{"type":423,"tag":47,"props":713,"children":714},{"style":607},[715],{"type":241,"value":201},{"type":423,"tag":47,"props":717,"children":718},{"style":440},[719],{"type":241,"value":162},{"type":423,"tag":47,"props":721,"children":722},{"style":435},[723],{"type":241,"value":724},"new",{"type":423,"tag":47,"props":726,"children":727},{"style":607},[728],{"type":241,"value":159},{"type":423,"tag":47,"props":730,"children":731},{"style":440},[732],{"type":241,"value":162},{"type":423,"tag":47,"props":734,"children":735},{"style":435},[736],{"type":241,"value":165},{"type":423,"tag":47,"props":738,"children":739},{"style":607},[740],{"type":241,"value":741}," readFile",{"type":423,"tag":47,"props":743,"children":744},{"style":440},[745],{"type":241,"value":746},"(path)));\n",{"type":423,"tag":47,"props":748,"children":750},{"class":49,"line":749},13,[751,756,761,765,770,775,780,785,790],{"type":423,"tag":47,"props":752,"children":753},{"style":435},[754],{"type":241,"value":755},"    for",{"type":423,"tag":47,"props":757,"children":758},{"style":440},[759],{"type":241,"value":760}," (",{"type":423,"tag":47,"props":762,"children":763},{"style":435},[764],{"type":241,"value":146},{"type":423,"tag":47,"props":766,"children":767},{"style":628},[768],{"type":241,"value":769}," line",{"type":423,"tag":47,"props":771,"children":772},{"style":435},[773],{"type":241,"value":774}," of",{"type":423,"tag":47,"props":776,"children":777},{"style":607},[778],{"type":241,"value":779}," collectParagraphText",{"type":423,"tag":47,"props":781,"children":782},{"style":440},[783],{"type":241,"value":784},"(ast)) console.",{"type":423,"tag":47,"props":786,"children":787},{"style":607},[788],{"type":241,"value":789},"log",{"type":423,"tag":47,"props":791,"children":792},{"style":440},[793],{"type":241,"value":794},"(line);\n",{"type":423,"tag":47,"props":796,"children":798},{"class":49,"line":797},14,[799,803,807,811,816,820,825,830,834,839,844,849,853,858,862,866,871,876],{"type":423,"tag":47,"props":800,"children":801},{"style":435},[802],{"type":241,"value":755},{"type":423,"tag":47,"props":804,"children":805},{"style":440},[806],{"type":241,"value":760},{"type":423,"tag":47,"props":808,"children":809},{"style":435},[810],{"type":241,"value":146},{"type":423,"tag":47,"props":812,"children":813},{"style":628},[814],{"type":241,"value":815}," warning",{"type":423,"tag":47,"props":817,"children":818},{"style":435},[819],{"type":241,"value":774},{"type":423,"tag":47,"props":821,"children":822},{"style":440},[823],{"type":241,"value":824}," warnings) console.",{"type":423,"tag":47,"props":826,"children":827},{"style":607},[828],{"type":241,"value":829},"warn",{"type":423,"tag":47,"props":831,"children":832},{"style":440},[833],{"type":241,"value":162},{"type":423,"tag":47,"props":835,"children":836},{"style":450},[837],{"type":241,"value":838},"`[${",{"type":423,"tag":47,"props":840,"children":841},{"style":440},[842],{"type":241,"value":843},"warning",{"type":423,"tag":47,"props":845,"children":846},{"style":450},[847],{"type":241,"value":848},".",{"type":423,"tag":47,"props":850,"children":851},{"style":440},[852],{"type":241,"value":13},{"type":423,"tag":47,"props":854,"children":855},{"style":450},[856],{"type":241,"value":857},"}] ${",{"type":423,"tag":47,"props":859,"children":860},{"style":440},[861],{"type":241,"value":843},{"type":423,"tag":47,"props":863,"children":864},{"style":450},[865],{"type":241,"value":848},{"type":423,"tag":47,"props":867,"children":868},{"style":440},[869],{"type":241,"value":870},"message",{"type":423,"tag":47,"props":872,"children":873},{"style":450},[874],{"type":241,"value":875},"}`",{"type":423,"tag":47,"props":877,"children":878},{"style":440},[879],{"type":241,"value":880},");\n",{"type":423,"tag":47,"props":882,"children":884},{"class":49,"line":883},15,[885,890,895],{"type":423,"tag":47,"props":886,"children":887},{"style":440},[888],{"type":241,"value":889},"  } ",{"type":423,"tag":47,"props":891,"children":892},{"style":435},[893],{"type":241,"value":894},"catch",{"type":423,"tag":47,"props":896,"children":897},{"style":440},[898],{"type":241,"value":899}," (error) {\n",{"type":423,"tag":47,"props":901,"children":903},{"class":49,"line":902},16,[904],{"type":423,"tag":47,"props":905,"children":906},{"style":522},[907],{"type":241,"value":908},"    \u002F\u002F Not a DOCX ZIP package at all, or an encrypted \u002F legacy .doc container.\n",{"type":423,"tag":47,"props":910,"children":912},{"class":49,"line":911},17,[913,918,923,928,933,938,943,947,952,956,961,965,969,973,977],{"type":423,"tag":47,"props":914,"children":915},{"style":435},[916],{"type":241,"value":917},"    if",{"type":423,"tag":47,"props":919,"children":920},{"style":440},[921],{"type":241,"value":922}," (error ",{"type":423,"tag":47,"props":924,"children":925},{"style":435},[926],{"type":241,"value":927},"instanceof",{"type":423,"tag":47,"props":929,"children":930},{"style":607},[931],{"type":241,"value":932}," DocxPackageError",{"type":423,"tag":47,"props":934,"children":935},{"style":440},[936],{"type":241,"value":937},") console.",{"type":423,"tag":47,"props":939,"children":940},{"style":607},[941],{"type":241,"value":942},"error",{"type":423,"tag":47,"props":944,"children":945},{"style":440},[946],{"type":241,"value":162},{"type":423,"tag":47,"props":948,"children":949},{"style":450},[950],{"type":241,"value":951},"`Cannot open ${",{"type":423,"tag":47,"props":953,"children":954},{"style":440},[955],{"type":241,"value":620},{"type":423,"tag":47,"props":957,"children":958},{"style":450},[959],{"type":241,"value":960},"}: ${",{"type":423,"tag":47,"props":962,"children":963},{"style":440},[964],{"type":241,"value":942},{"type":423,"tag":47,"props":966,"children":967},{"style":450},[968],{"type":241,"value":848},{"type":423,"tag":47,"props":970,"children":971},{"style":440},[972],{"type":241,"value":13},{"type":423,"tag":47,"props":974,"children":975},{"style":450},[976],{"type":241,"value":875},{"type":423,"tag":47,"props":978,"children":979},{"style":440},[980],{"type":241,"value":880},{"type":423,"tag":47,"props":982,"children":984},{"class":49,"line":983},18,[985,990,995],{"type":423,"tag":47,"props":986,"children":987},{"style":435},[988],{"type":241,"value":989},"    else",{"type":423,"tag":47,"props":991,"children":992},{"style":435},[993],{"type":241,"value":994}," throw",{"type":423,"tag":47,"props":996,"children":997},{"style":440},[998],{"type":241,"value":999}," error;\n",{"type":423,"tag":47,"props":1001,"children":1003},{"class":49,"line":1002},19,[1004],{"type":423,"tag":47,"props":1005,"children":1006},{"style":440},[1007],{"type":241,"value":1008},"  }\n",{"type":423,"tag":47,"props":1010,"children":1012},{"class":49,"line":1011},20,[1013],{"type":423,"tag":47,"props":1014,"children":1015},{"style":440},[1016],{"type":241,"value":1017},"}\n",{"type":423,"tag":393,"props":1019,"children":1020},{},[1021],{"type":241,"value":1022},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"data":1024,"body":1025},{},{"type":420,"children":1026},[1027,1278],{"type":423,"tag":38,"props":1028,"children":1030},{"className":119,"code":1029,"language":122,"meta":43,"style":43},"import { writeFile } from \"node:fs\u002Fpromises\";\nimport { generateDocx } from \"@quirekit\u002Flit-docx\";\nimport { createReport } from \"..\u002Fshared\u002Freport\";\n\n\u002F**\n * Writes the report to disk.\n * @param path - Destination `.docx` path.\n * @returns Resolves once the file is written.\n *\u002F\nexport async function writeReport(path: string): Promise\u003Cvoid> {\n  await writeFile(path, await generateDocx(createReport()));\n}\n\n",[1031],{"type":423,"tag":13,"props":1032,"children":1033},{"__ignoreMap":43},[1034,1058,1081,1106,1113,1120,1128,1148,1164,1171,1231,1271],{"type":423,"tag":47,"props":1035,"children":1036},{"class":49,"line":50},[1037,1041,1046,1050,1054],{"type":423,"tag":47,"props":1038,"children":1039},{"style":435},[1040],{"type":241,"value":130},{"type":423,"tag":47,"props":1042,"children":1043},{"style":440},[1044],{"type":241,"value":1045}," { writeFile } ",{"type":423,"tag":47,"props":1047,"children":1048},{"style":435},[1049],{"type":241,"value":137},{"type":423,"tag":47,"props":1051,"children":1052},{"style":450},[1053],{"type":241,"value":453},{"type":423,"tag":47,"props":1055,"children":1056},{"style":440},[1057],{"type":241,"value":458},{"type":423,"tag":47,"props":1059,"children":1060},{"class":49,"line":143},[1061,1065,1069,1073,1077],{"type":423,"tag":47,"props":1062,"children":1063},{"style":435},[1064],{"type":241,"value":130},{"type":423,"tag":47,"props":1066,"children":1067},{"style":440},[1068],{"type":241,"value":274},{"type":423,"tag":47,"props":1070,"children":1071},{"style":435},[1072],{"type":241,"value":137},{"type":423,"tag":47,"props":1074,"children":1075},{"style":450},[1076],{"type":241,"value":479},{"type":423,"tag":47,"props":1078,"children":1079},{"style":440},[1080],{"type":241,"value":458},{"type":423,"tag":47,"props":1082,"children":1083},{"class":49,"line":177},[1084,1088,1093,1097,1102],{"type":423,"tag":47,"props":1085,"children":1086},{"style":435},[1087],{"type":241,"value":130},{"type":423,"tag":47,"props":1089,"children":1090},{"style":440},[1091],{"type":241,"value":1092}," { createReport } ",{"type":423,"tag":47,"props":1094,"children":1095},{"style":435},[1096],{"type":241,"value":137},{"type":423,"tag":47,"props":1098,"children":1099},{"style":450},[1100],{"type":241,"value":1101}," \"..\u002Fshared\u002Freport\"",{"type":423,"tag":47,"props":1103,"children":1104},{"style":440},[1105],{"type":241,"value":458},{"type":423,"tag":47,"props":1107,"children":1108},{"class":49,"line":308},[1109],{"type":423,"tag":47,"props":1110,"children":1111},{"emptyLinePlaceholder":409},[1112],{"type":241,"value":516},{"type":423,"tag":47,"props":1114,"children":1115},{"class":49,"line":332},[1116],{"type":423,"tag":47,"props":1117,"children":1118},{"style":522},[1119],{"type":241,"value":525},{"type":423,"tag":47,"props":1121,"children":1122},{"class":49,"line":528},[1123],{"type":423,"tag":47,"props":1124,"children":1125},{"style":522},[1126],{"type":241,"value":1127}," * Writes the report to disk.\n",{"type":423,"tag":47,"props":1129,"children":1130},{"class":49,"line":537},[1131,1135,1139,1143],{"type":423,"tag":47,"props":1132,"children":1133},{"style":522},[1134],{"type":241,"value":543},{"type":423,"tag":47,"props":1136,"children":1137},{"style":435},[1138],{"type":241,"value":548},{"type":423,"tag":47,"props":1140,"children":1141},{"style":440},[1142],{"type":241,"value":553},{"type":423,"tag":47,"props":1144,"children":1145},{"style":522},[1146],{"type":241,"value":1147}," - Destination `.docx` path.\n",{"type":423,"tag":47,"props":1149,"children":1150},{"class":49,"line":561},[1151,1155,1159],{"type":423,"tag":47,"props":1152,"children":1153},{"style":522},[1154],{"type":241,"value":543},{"type":423,"tag":47,"props":1156,"children":1157},{"style":435},[1158],{"type":241,"value":571},{"type":423,"tag":47,"props":1160,"children":1161},{"style":522},[1162],{"type":241,"value":1163}," Resolves once the file is written.\n",{"type":423,"tag":47,"props":1165,"children":1166},{"class":49,"line":579},[1167],{"type":423,"tag":47,"props":1168,"children":1169},{"style":522},[1170],{"type":241,"value":585},{"type":423,"tag":47,"props":1172,"children":1173},{"class":49,"line":588},[1174,1178,1182,1186,1191,1195,1199,1203,1207,1211,1215,1219,1223,1227],{"type":423,"tag":47,"props":1175,"children":1176},{"style":435},[1177],{"type":241,"value":594},{"type":423,"tag":47,"props":1179,"children":1180},{"style":435},[1181],{"type":241,"value":599},{"type":423,"tag":47,"props":1183,"children":1184},{"style":435},[1185],{"type":241,"value":604},{"type":423,"tag":47,"props":1187,"children":1188},{"style":607},[1189],{"type":241,"value":1190}," writeReport",{"type":423,"tag":47,"props":1192,"children":1193},{"style":440},[1194],{"type":241,"value":162},{"type":423,"tag":47,"props":1196,"children":1197},{"style":617},[1198],{"type":241,"value":620},{"type":423,"tag":47,"props":1200,"children":1201},{"style":435},[1202],{"type":241,"value":625},{"type":423,"tag":47,"props":1204,"children":1205},{"style":628},[1206],{"type":241,"value":631},{"type":423,"tag":47,"props":1208,"children":1209},{"style":440},[1210],{"type":241,"value":636},{"type":423,"tag":47,"props":1212,"children":1213},{"style":435},[1214],{"type":241,"value":625},{"type":423,"tag":47,"props":1216,"children":1217},{"style":607},[1218],{"type":241,"value":645},{"type":423,"tag":47,"props":1220,"children":1221},{"style":440},[1222],{"type":241,"value":650},{"type":423,"tag":47,"props":1224,"children":1225},{"style":628},[1226],{"type":241,"value":655},{"type":423,"tag":47,"props":1228,"children":1229},{"style":440},[1230],{"type":241,"value":660},{"type":423,"tag":47,"props":1232,"children":1233},{"class":49,"line":663},[1234,1239,1244,1249,1253,1257,1261,1266],{"type":423,"tag":47,"props":1235,"children":1236},{"style":435},[1237],{"type":241,"value":1238},"  await",{"type":423,"tag":47,"props":1240,"children":1241},{"style":607},[1242],{"type":241,"value":1243}," writeFile",{"type":423,"tag":47,"props":1245,"children":1246},{"style":440},[1247],{"type":241,"value":1248},"(path, ",{"type":423,"tag":47,"props":1250,"children":1251},{"style":435},[1252],{"type":241,"value":165},{"type":423,"tag":47,"props":1254,"children":1255},{"style":607},[1256],{"type":241,"value":291},{"type":423,"tag":47,"props":1258,"children":1259},{"style":440},[1260],{"type":241,"value":162},{"type":423,"tag":47,"props":1262,"children":1263},{"style":607},[1264],{"type":241,"value":1265},"createReport",{"type":423,"tag":47,"props":1267,"children":1268},{"style":440},[1269],{"type":241,"value":1270},"()));\n",{"type":423,"tag":47,"props":1272,"children":1273},{"class":49,"line":677},[1274],{"type":423,"tag":47,"props":1275,"children":1276},{"style":440},[1277],{"type":241,"value":1017},{"type":423,"tag":393,"props":1279,"children":1280},{},[1281],{"type":241,"value":1022},1793045343568]