revise 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +14 -2
  3. package/THIRD-PARTY-NOTICES.md +52 -0
  4. package/chunks/{AgentPageRenderer-CHHktDQ1.js → AgentPageRenderer-BO0UO8ti.js} +1 -1
  5. package/chunks/{AgentPageRenderer-CN-N65JC.js → AgentPageRenderer-BRSnnwix.js} +1 -1
  6. package/chunks/{AttachmentDocumentImporter-DnHC9t7I.js → AttachmentDocumentImporter-B9MxjcAh.js} +1 -1
  7. package/chunks/{AttachmentDocumentImporter-Dqg7IPtK.js → AttachmentDocumentImporter-C2cOyOT7.js} +1 -1
  8. package/chunks/{DocumentScrubber-Ch_bOtHW.js → DocumentScrubber-C1FMsdbb.js} +1 -1
  9. package/chunks/{DocumentScrubber-DRzACkWJ.js → DocumentScrubber-DV8tz9HA.js} +1 -1
  10. package/chunks/{DocxConverter-BGPkGmyg.js → DocxConverter-Bm0HkBVD.js} +1 -1
  11. package/chunks/{DocxConverter-DeurS5EF.js → DocxConverter-Cu4eNMv8.js} +1 -1
  12. package/chunks/{DocxGraft-D71OgoMh.js → DocxGraft-BVF-KvfZ.js} +1 -1
  13. package/chunks/{DocxGraft-QLkGEcwQ.js → DocxGraft-CRgF0kbP.js} +1 -1
  14. package/chunks/{FileImporter-BIT0ZBDY.js → FileImporter-BQFBpy3w.js} +1 -1
  15. package/chunks/{FileImporter-Cgwoawuk.js → FileImporter-DGLb3Sr7.js} +1 -1
  16. package/chunks/{OdtConverter-2pm0SH5c.js → OdtConverter-BBJp0He7.js} +1 -1
  17. package/chunks/{OdtConverter-CSUQTfVp.js → OdtConverter-vMtWnHmN.js} +1 -1
  18. package/chunks/{OfficeImportShared-C_mYnG5V.js → OfficeImportShared-B-G9c4l3.js} +1 -1
  19. package/chunks/{OfficeImportShared-O-d47J7O.js → OfficeImportShared-D1HPkK6E.js} +1 -1
  20. package/chunks/{PdfConverter-BYg_pr5J.js → PdfConverter-BHxQ97xQ.js} +1 -1
  21. package/chunks/{PdfConverter-Z2HlY84F.js → PdfConverter-CVg1iezA.js} +1 -1
  22. package/chunks/{PdfImportService-C2gwK1Sq.js → PdfImportService-BwPyr7mK.js} +1 -1
  23. package/chunks/{PdfImportService-CxtUtxM6.js → PdfImportService-C7Ge9he-.js} +1 -1
  24. package/chunks/{RtfConverter-BrtojpDV.js → RtfConverter-Bp4De2LK.js} +1 -1
  25. package/chunks/{RtfConverter-DlztsAoK.js → RtfConverter-CSgz-99v.js} +1 -1
  26. package/chunks/{XmlConverter-3XWISlqr.js → XmlConverter-CKtlZBRJ.js} +1 -1
  27. package/chunks/{XmlConverter-B1Kcohr0.js → XmlConverter-Ce5hiL1o.js} +1 -1
  28. package/chunks/{ar-vDYSGTpE.js → ar-DXz701oH.js} +2 -2
  29. package/chunks/{browser-module-BVdVmrPb.js → browser-module-CGEsouXc.js} +1 -1
  30. package/chunks/{browser-module-CWlRHeO2.js → browser-module-Do0GxPwC.js} +1 -1
  31. package/chunks/{de-CWX4cvtt.js → de-BNDFsx8u.js} +2 -2
  32. package/chunks/{es-DoAhvF6_.js → es-K9xXHK7j.js} +2 -2
  33. package/chunks/{fil-DdAeD8Br.js → fil-DzR-wN9l.js} +2 -2
  34. package/chunks/{fr-CazsUjNQ.js → fr-B3SqCksc.js} +2 -2
  35. package/chunks/{index-DcIXw_KB.js → index-DSAJ-J8p.js} +195 -195
  36. package/chunks/{index-D9_PwgOX.js → index-DuQIqmgC.js} +195 -195
  37. package/chunks/{ja-alh_QHTB.js → ja-u4zSoY8E.js} +2 -2
  38. package/chunks/{pseudoLocale-Bld5ZUFr.js → pseudoLocale-Cu4gNRZy.js} +1 -1
  39. package/chunks/{pseudoLocale-CLm3_c4X.js → pseudoLocale-DgJzKByn.js} +1 -1
  40. package/chunks/{zh-20eXwzFZ.js → zh-Dpo4C1RV.js} +2 -2
  41. package/cli-shim.js +1 -1
  42. package/full.js +1 -1
  43. package/index.d.ts +6 -0
  44. package/index.js +1 -1
  45. package/package.json +7 -6
  46. package/server.d.ts +40 -0
  47. package/server.js +54 -0
  48. package/style.css +1 -1
  49. package/version.js +2 -2
  50. package/legacy/server.d.ts +0 -37
  51. package/legacy/server.js +0 -41
@@ -1,4 +1,4 @@
1
- import{F as P,H as S}from"./index-D9_PwgOX.js";import{N as _,k as Z,m as E,r as C,l as q,f as U,e as J,a as G,i as O,s as K,c as k,b as Q,p as Y,d as tt,n as W,M as et,g as nt}from"./OfficeImportShared-C_mYnG5V.js";class st{static async parseFile(e){const t=(await import("./index-D9_PwgOX.js").then(d=>d.j)).default,n=await e.arrayBuffer(),s=await t.loadAsync(new Uint8Array(n)),a=s.file("content.xml");if(!a)throw new Error("Invalid ODT file: missing content.xml");const o=await a.async("text"),l=await s.file("styles.xml")?.async("text"),c=new Set;for(const d of[o,l??""])for(const u of d.matchAll(/xlink:href="([^"]+)"/g))c.add(R(ct(u[1])));const h=new Map;return await Promise.all([...c].map(async d=>{const u=s.file(d);u&&!u.dir&&h.set(d,await u.async("uint8array"))})),this.fromContentXml(o,l,{parts:h})}static fromContentXml(e,t,n={}){const s=new DOMParser,a=s.parseFromString(e,"application/xml"),o=t?s.parseFromString(t,"application/xml"):null;return new at(a,o,n).read()}}class F{constructor(e){this.styles=new Map,this.defaults=new Map,this.listStyles=new Map,this.fontFaces=new Map,this.textCache=new Map,this.paraCache=new Map;for(const t of e)this.collect(t)}collect(e){for(const t of w(e,"font-face")){const n=r(t,"name"),s=r(t,"font-family");n&&this.fontFaces.set(n,L(s||n))}for(const t of w(e,"default-style")){const n=r(t,"family")||"paragraph";this.defaults.set(n,this.parseStyle(t,n))}for(const t of w(e,"style")){const n=r(t,"name");if(!n)continue;const s=r(t,"family")||"paragraph";this.styles.set(`${s}:${n}`,this.parseStyle(t,s))}for(const t of w(e,"list-style")){const n=r(t,"name");if(!n)continue;const s=new Map;for(const a of b(t)){const o=parseInt(r(a,"level")||"1",10);if(a.localName==="list-level-style-number"){const l=r(a,"num-format");s.set(o,{ordered:l!=="",unnumbered:l==="",startValue:parseInt(r(a,"start-value")||"1",10)||1})}else(a.localName==="list-level-style-bullet"||a.localName==="list-level-style-image")&&s.set(o,{ordered:!1,unnumbered:!1,startValue:1})}this.listStyles.set(n,s)}}parseStyle(e,t){const n={family:t,parentName:r(e,"parent-style-name")||void 0,text:{},para:{},listStyleName:r(e,"list-style-name")??void 0,masterPageName:r(e,"master-page-name")||void 0},s=r(e,"default-outline-level");s&&(n.outlineLevel=parseInt(s,10)||void 0);const a=g(e,"text-properties");a&&(n.text=this.parseTextProps(a));const o=g(e,"paragraph-properties");o&&(n.para=ot(o));const l=g(e,"table-cell-properties");if(l){n.cellBackground=B(r(l,"background-color"));const d=r(l,"vertical-align");(d==="middle"||d==="bottom"||d==="top")&&(n.cellVerticalAlign=d)}const c=g(e,"table-column-properties");if(c){n.columnWidth=k(r(c,"column-width"));const d=r(c,"rel-column-width");d&&(n.relColumnWidth=parseFloat(d)||void 0)}const h=g(e,"graphic-properties");return h&&(n.horizontalPos=r(h,"horizontal-pos")??void 0),n}parseTextProps(e){const t={},n=r(e,"font-weight");n&&(t.bold=n==="bold"||parseInt(n,10)>=600);const s=r(e,"font-style");s&&(t.italic=s==="italic"||s==="oblique");const a=r(e,"text-underline-style");a&&(t.underline=a!=="none");const o=r(e,"text-line-through-style");if(o){const x=o!=="none";x&&r(e,"text-line-through-type")==="double"?(t.doubleStrikethrough=!0,t.strikethrough=!1):t.strikethrough=x}const l=r(e,"text-position");if(l){const x=l.trim().split(/\s+/)[0],N=x==="super"?1:x==="sub"?-1:parseFloat(x);t.superscript=N>0,t.subscript=N<0}const c=r(e,"font-variant");c&&(t.smallCaps=c==="small-caps");const h=r(e,"text-transform");h&&(t.allCaps=h==="uppercase");const d=r(e,"display");d&&(t.hidden=d==="none");const u=r(e,"font-name"),i=r(e,"font-family");u?t.fontFamily=this.fontFaces.get(u)??L(u):i&&(t.fontFamily=L(i));const p=r(e,"font-size");if(p)if(p.trim().endsWith("%"))t.fontSizePercent=parseFloat(p);else{const x=k(p);x&&(t.fontSizePx=x)}const m=r(e,"color");m&&(t.color=W(m));const y=r(e,"background-color");y&&(t.backgroundColor=B(y));const v=r(e,"letter-spacing");if(v){const x=v==="normal"?null:k(v);t.letterSpacing=x?C(x):null}return t}get(e,t){return t?this.styles.get(`${e}:${t}`):void 0}chain(e,t){const n=[];let s=t;for(let o=0;s&&o<16;o++){const l=this.get(e,s);if(!l)break;n.push(l),s=l.parentName}const a=this.defaults.get(e);return a&&n.push(a),n.reverse()}resolveText(e,t,n){const s=`${e}:${t??""}|${n?JSON.stringify(n):""}`,a=this.textCache.get(s);if(a)return a;const o={};let l=n?.fontSizePx;const c=e==="paragraph"?this.chain(e,t):this.chain(e,t).filter(i=>i!==this.defaults.get(e));for(const i of c){const p=i.text;p.fontSizePx!==void 0?l=p.fontSizePx:p.fontSizePercent!==void 0&&l!==void 0&&(l=l*p.fontSizePercent/100);for(const[m,y]of Object.entries(p))m==="fontSizePx"||m==="fontSizePercent"||y!==void 0&&(o[m]=y)}const h={...n?.marks??{}},d=["bold","italic","underline","strikethrough","doubleStrikethrough","superscript","subscript","smallCaps","allCaps","hidden"];for(const i of d)o[i]===!0?h[i]=!0:o[i]===!1&&delete h[i];typeof o.fontFamily=="string"&&(h.fontFamily=o.fontFamily),typeof o.color=="string"&&(o.color==="#000000"?delete h.color:h.color=o.color),o.backgroundColor===null?delete h.backgroundColor:typeof o.backgroundColor=="string"&&(h.backgroundColor=o.backgroundColor),o.letterSpacing===null?delete h.letterSpacing:typeof o.letterSpacing=="number"&&(h.letterSpacing=o.letterSpacing),l!==void 0&&(h.fontSize=C(l));const u={marks:h,fontSizePx:l};return this.textCache.set(s,u),u}resolvePara(e){const t=e??"",n=this.paraCache.get(t);if(n)return n;const s={};for(const a of this.chain("paragraph",e))for(const[o,l]of Object.entries(a.para))l!==void 0&&(s[o]=l);return this.paraCache.set(t,s),s}findInChain(e,t,n){const s=this.chain(e,t).reverse();for(const a of s){const o=n(a);if(o!==void 0)return o}}listLevel(e,t){if(!e)return;const n=this.listStyles.get(e);if(n)return n.get(t)??n.get(1)}hasListStyle(e){return!!e&&this.listStyles.has(e)}}function ot(f){const e={},t=r(f,"text-align");t&&(e.align=t==="center"?"center":t==="justify"?"justify":t==="end"||t==="right"?"right":null);const n=k(r(f,"margin-top"));n!==void 0&&(e.marginTop=n);const s=k(r(f,"margin-bottom"));s!==void 0&&(e.marginBottom=s);const a=k(r(f,"margin-left")??r(f,"margin-start"));a!==void 0&&(e.marginLeft=a);const o=k(r(f,"text-indent"));o!==void 0&&(e.textIndent=o);const l=r(f,"line-height");l&&(e.lineHeight=l.trim().endsWith("%")?parseFloat(l)/100:null);const c=r(f,"background-color");c&&(e.background=B(c));const h=r(f,"keep-with-next");h&&(e.keepNext=h==="always");const d=r(f,"writing-mode");d&&(e.rtl=d.startsWith("rl")),r(f,"break-before")==="page"&&(e.breakBefore=!0),r(f,"break-after")==="page"&&(e.breakAfter=!0);const u={},i=j(r(f,"border"));for(const p of["top","bottom","left","right"]){const m=j(r(f,`border-${p}`))??i;m&&(u[p]=m)}return Object.keys(u).length>0&&(e.borders=JSON.stringify(u)),e}function j(f){if(!f)return null;const e=f.trim().toLowerCase();if(!e||e==="none"||e==="hidden")return null;const t=e.match(/\b(solid|dashed|dotted|double)\b/),n=t?t[1]==="solid"?"single":t[1]:"single",s=e.match(/([\d.]+)\s*(pt|px|cm|mm|in)/);let a=1;if(s){const l=k(`${s[1]}${s[2]}`)??1;a=Math.min(8,Math.max(1,Math.round(l)))}const o=e.match(/#[0-9a-f]{3,8}/);return{style:n,width:a,color:o?o[0]:"#000000"}}function B(f){if(f)return f.trim().toLowerCase()==="transparent"?null:W(f)}function L(f){return f.split(",")[0].trim().replace(/^['"]|['"]$/g,"")}const rt="urn:oasis:names:tc:opendocument:xmlns:text:1.0";class at{constructor(e,t,n){this.content=e,this.stylesDoc=t,this.options=n,this.notes=new _("odtfn"),this.comments=[],this.openComments=new Map,this.changes=new Map,this.activeInsertions=[],this.expandedDeletions=new Set,this.listChains={byXmlId:new Map,lastByStyle:new Map,counter:0},this.commentCounter=0,this.firstParagraphStyle=null;const s=t?g(t.documentElement,"styles"):null,a=t?g(t.documentElement,"automatic-styles"):null,o=[t?g(t.documentElement,"font-face-decls"):null,g(e.documentElement,"font-face-decls")].filter(c=>!!c),l=g(e.documentElement,"automatic-styles");if(this.bodyStyles=new F([...o,s,l].filter(c=>!!c)),this.chromeStyles=new F([...o,s,a].filter(c=>!!c)),!t){const c=g(e.documentElement,"styles");c&&(this.bodyStyles=new F([...o,c,l].filter(h=>!!h)))}this.styles=this.bodyStyles}read(){const e=M(this.content.documentElement,"text");e&&this.collectTrackedChanges(e);const t=e?this.convertChildren(e):[];for(;t[0]?.type==="page-break";)t.shift();it(t),t.length===0&&t.push(P());const n={type:"doc",children:t};this.notes.notes.length>0&&(n.notes=this.notes.notes);const s=Z(this.comments,[n.children,n.notes??[]]);s.length>0&&(n.comments=s);const a=this.masterPage();if(a){this.styles=this.chromeStyles;const o=this.readChrome(a);this.styles=this.bodyStyles,o.headers&&(n.headers=o.headers),o.footers&&(n.footers=o.footers);const l=this.pageLayout(a);l&&(n.pageLayout=l)}return n}convertChildren(e){const t=[];for(const n of b(e))t.push(...this.convertBlock(n));return t}convertBlock(e){switch(e.localName){case"h":case"p":return this.convertParagraph(e);case"list":return this.convertList(e);case"numbered-paragraph":return this.convertChildren(e);case"table":{const t=this.convertTable(e);return t?[t]:[]}case"section":case"index-body":case"index-title":return this.convertChildren(e);case"change-start":case"change-end":case"change":{const t=e.ownerDocument.createElementNS(rt,"text:p");t.appendChild(e.cloneNode(!0));const n=this.collectInline(t,{chrome:!1,paragraphId:""}).filter(s=>s.kind==="run").map(s=>s.node);return n.length>0?[P(E(n))]:[]}case"table-of-content":case"alphabetical-index":case"illustration-index":case"table-index":case"object-index":case"user-index":case"bibliography":{const t=g(e,"index-body");return t?this.convertChildren(t):[]}case"frame":case"a":return this.frameBlocks(e,{});default:return[]}}convertParagraph(e){const t=r(e,"style-name");this.firstParagraphStyle===null&&(this.firstParagraphStyle=t??"");const n=this.styles.resolvePara(t),s=S(),a=this.collectInline(e,{chrome:!1,paragraphId:s,paragraphAlign:n.align??void 0}),o=[];let l=[],c=!1;const h=u=>{const i=l.filter(m=>m.text.length>0||m.marks?.footnoteRef);if(i.length===0&&!u)return;const p=this.buildParagraph(e,t,n,i);c||(p.id=s,c=!0),o.push(p),l=[]};let d=!1;for(const u of a)u.kind==="run"?l.push(u.node):(h(!1),o.push(u.block),d=!0);return h(!d),n.breakBefore&&o.unshift({type:"page-break",id:S()}),n.breakAfter&&o.push({type:"page-break",id:S()}),o}buildParagraph(e,t,n,s){const a=P(s.length>0?E(s):[{type:"text",text:"",marks:{}}]);if(e.localName==="h"){const o=parseInt(r(e,"outline-level")||"1",10)||1;a.heading=Math.min(Math.max(o,1),6)}else{const o=this.styles.findInChain("paragraph",t,l=>l.outlineLevel);o&&o>0&&(a.heading=Math.min(o,6))}return this.applyParaProps(a,n),a}applyParaProps(e,t){if(t.align&&(e.align=t.align),t.rtl&&(e.direction="rtl"),e.spaceBefore=C(Math.max(0,t.marginTop??0)),e.spaceAfter=C(Math.max(0,t.marginBottom??0)),t.marginLeft!==void 0){const n=q(t.marginLeft);n&&(e.leftIndent=n)}if(t.textIndent!==void 0){const n=U(t.textIndent);n&&(e.firstLineIndent=n)}typeof t.lineHeight=="number"&&t.lineHeight>0&&(e.lineSpacing=C(t.lineHeight)),t.keepNext&&(e.keepNext=!0),t.background&&t.background!=="#ffffff"&&(e.shading=t.background),t.borders&&(e.borders=t.borders)}convertList(e){const t=[];let n=null;const s=this.listStyleFor(e),a=this.chainFor(e,s),o=()=>{if(!n||n.items.length===0){n=null;return}const c={type:"list",id:S(),variant:n.ordered?"ordered":"unordered",children:n.items};n.ordered&&(a?(c.numberingChainId=a.id,a.restart&&n.start!==void 0&&n.start!==1?c.startNumber=n.start:a.restart&&n.start,a.restart=!1):n.start!==void 0&&n.start!==1&&(c.startNumber=n.start)),n.props&&(c.spaceBefore=C(Math.max(0,n.props.marginTop??0)),c.spaceAfter=C(Math.max(0,n.props.marginBottom??0)),typeof n.props.lineHeight=="number"&&n.props.lineHeight>0&&(c.lineSpacing=C(n.props.lineHeight))),t.push(c),n=null},l=(c,h,d)=>{const u=r(c,"style-name")||d;for(const i of b(c)){if(i.localName!=="list-item"&&i.localName!=="list-header")continue;const p=i.localName==="list-header",m=r(i,"start-value");for(const y of b(i)){if(y.localName==="list"){l(y,h+1,u);continue}if(y.localName!=="p"&&y.localName!=="h"){o(),t.push(...this.convertBlock(y));continue}const v=r(y,"style-name"),x=u??this.styles.findInChain("paragraph",v,I=>I.listStyleName||void 0),N=this.styles.listLevel(x,h+1);if(p||y.localName==="h"||N?.unnumbered){o(),t.push(...this.convertParagraph(y));continue}const D=N?N.ordered:!1;n&&n.items.length>0&&h===0&&n.ordered!==D&&o(),n||(n={items:[],ordered:D,props:this.styles.resolvePara(v)}),n.items.length===0&&(m?n.start=parseInt(m,10)||void 0:N&&N.startValue!==1&&(!a||a.restart)&&(n.start=N.startValue));const $=S(),z=this.styles.resolvePara(v),X=this.collectInline(y,{chrome:!1,paragraphId:$,paragraphAlign:z.align??void 0}),A=[],T=[];for(const I of X)I.kind==="run"?A.push(I.node):T.push(I.block);n.items.push({type:"list-item",id:$,children:A.length>0?E(A):[{type:"text",text:"",marks:{}}],...h>0?{indentLevel:Math.min(h,8)}:{},...z.rtl?{direction:"rtl"}:{}}),T.length>0&&(o(),t.push(...T))}}};return l(e,0,s),o(),t}listStyleFor(e){const t=r(e,"style-name");if(t&&this.styles.hasListStyle(t))return t;const n=M(e,"p")??M(e,"h"),s=n?r(n,"style-name"):null;return this.styles.findInChain("paragraph",s,a=>a.listStyleName||void 0)??t??void 0}chainFor(e,t){const n=r(e,"id"),s=r(e,"continue-list"),a=r(e,"continue-numbering")==="true";let o;s?o=this.listChains.byXmlId.get(s):a&&t&&(o=this.listChains.lastByStyle.get(t));const l=!o;return o||(o=`odt-list-${++this.listChains.counter}`),n&&this.listChains.byXmlId.set(n,o),t&&this.listChains.lastByStyle.set(t,o),{id:o,restart:l}}convertTable(e){const t=[],n=[],s=[],a=l=>{for(const c of b(l))if(c.localName==="table-column"){const h=this.styles.get("table-column",r(c,"style-name")),d=h?.relColumnWidth??h?.columnWidth??0,u=Math.min(64,Math.max(1,parseInt(r(c,"number-columns-repeated")||"1",10)||1));for(let i=0;i<u;i++)s.push(d)}else(c.localName==="table-columns"||c.localName==="table-column-group")&&a(c)};a(e);const o=l=>{for(const c of b(l))c.localName==="table-row"?n.push(c):(c.localName==="table-header-rows"||c.localName==="table-rows"||c.localName==="table-row-group")&&o(c)};o(e);for(const l of n){const c=[];for(const h of b(l)){if(h.localName!=="table-cell")continue;const d=this.convertChildren(h).filter(v=>v.type!=="page-break"),u={type:"table-cell",id:S(),children:d.length>0?d:[P()]},i=H(r(h,"number-columns-spanned")),p=H(r(h,"number-rows-spanned"));i>1&&(u.colSpan=i),p>1&&(u.rowSpan=p);const m=this.styles.get("table-cell",r(h,"style-name"));m?.cellBackground&&(u.backgroundColor=m.cellBackground),m?.cellVerticalAlign&&m.cellVerticalAlign!=="top"&&(u.verticalAlign=m.cellVerticalAlign),c.push(u);const y=parseInt(r(h,"number-columns-repeated")||"1",10)-1;for(let v=0;v<y&&v<20;v++)c.push(J())}c.length>0&&t.push({type:"table-row",id:S(),children:c})}return G(t,{columnWidths:s.every(l=>l>0)?s:void 0,hasHeader:b(e).some(l=>l.localName==="table-header-rows")})}collectInline(e,t){const n=[],s=(l,c)=>{if(!l)return;const h=this.decorate(c),d=n[n.length-1];d?.kind==="run"&&!d.node.marks?.footnoteRef&&nt(d.node.marks,h)?d.node.text+=l:n.push({kind:"run",node:{type:"text",text:l,marks:{...h}}})},a=(l,c,h)=>{if(l.nodeType===Node.TEXT_NODE){const i=h?{...c.marks,link:h}:c.marks;let p=(l.textContent??"").replace(/[ \t\r\n]+/g," ");const m=n[n.length-1],y=m?.kind==="run"?m.node.text:"";p.startsWith(" ")&&(n.length===0||y.endsWith(" "))&&(p=p.slice(1)),s(p,i);return}if(l.nodeType!==Node.ELEMENT_NODE)return;const d=l,u=h?{...c.marks,link:h}:c.marks;switch(d.localName){case"span":{const i=this.styles.resolveText("text",r(d,"style-name"),c);d.childNodes.forEach(p=>a(p,i,h));return}case"a":{const i=d.getAttributeNS("http://www.w3.org/1999/xlink","href")||d.getAttribute("xlink:href")||void 0,p=r(d,"style-name")?this.styles.resolveText("text",r(d,"style-name"),c):c,m=i&&!i.startsWith("#")?tt(i)??h:h;d.childNodes.forEach(y=>a(y,p,m));return}case"s":{const i=parseInt(r(d,"c")||"1",10);s(" ".repeat(Math.min(Math.max(i,1),100)),u);return}case"tab":s(" ",u);return;case"line-break":s(`
1
+ import{F as P,H as S}from"./index-DSAJ-J8p.js";import{N as _,k as Z,m as E,r as C,l as q,f as U,e as J,a as G,i as O,s as K,c as k,b as Q,p as Y,d as tt,n as W,M as et,g as nt}from"./OfficeImportShared-B-G9c4l3.js";class st{static async parseFile(e){const t=(await import("./index-DSAJ-J8p.js").then(d=>d.j)).default,n=await e.arrayBuffer(),s=await t.loadAsync(new Uint8Array(n)),a=s.file("content.xml");if(!a)throw new Error("Invalid ODT file: missing content.xml");const o=await a.async("text"),l=await s.file("styles.xml")?.async("text"),c=new Set;for(const d of[o,l??""])for(const u of d.matchAll(/xlink:href="([^"]+)"/g))c.add(R(ct(u[1])));const h=new Map;return await Promise.all([...c].map(async d=>{const u=s.file(d);u&&!u.dir&&h.set(d,await u.async("uint8array"))})),this.fromContentXml(o,l,{parts:h})}static fromContentXml(e,t,n={}){const s=new DOMParser,a=s.parseFromString(e,"application/xml"),o=t?s.parseFromString(t,"application/xml"):null;return new at(a,o,n).read()}}class F{constructor(e){this.styles=new Map,this.defaults=new Map,this.listStyles=new Map,this.fontFaces=new Map,this.textCache=new Map,this.paraCache=new Map;for(const t of e)this.collect(t)}collect(e){for(const t of w(e,"font-face")){const n=r(t,"name"),s=r(t,"font-family");n&&this.fontFaces.set(n,L(s||n))}for(const t of w(e,"default-style")){const n=r(t,"family")||"paragraph";this.defaults.set(n,this.parseStyle(t,n))}for(const t of w(e,"style")){const n=r(t,"name");if(!n)continue;const s=r(t,"family")||"paragraph";this.styles.set(`${s}:${n}`,this.parseStyle(t,s))}for(const t of w(e,"list-style")){const n=r(t,"name");if(!n)continue;const s=new Map;for(const a of b(t)){const o=parseInt(r(a,"level")||"1",10);if(a.localName==="list-level-style-number"){const l=r(a,"num-format");s.set(o,{ordered:l!=="",unnumbered:l==="",startValue:parseInt(r(a,"start-value")||"1",10)||1})}else(a.localName==="list-level-style-bullet"||a.localName==="list-level-style-image")&&s.set(o,{ordered:!1,unnumbered:!1,startValue:1})}this.listStyles.set(n,s)}}parseStyle(e,t){const n={family:t,parentName:r(e,"parent-style-name")||void 0,text:{},para:{},listStyleName:r(e,"list-style-name")??void 0,masterPageName:r(e,"master-page-name")||void 0},s=r(e,"default-outline-level");s&&(n.outlineLevel=parseInt(s,10)||void 0);const a=g(e,"text-properties");a&&(n.text=this.parseTextProps(a));const o=g(e,"paragraph-properties");o&&(n.para=ot(o));const l=g(e,"table-cell-properties");if(l){n.cellBackground=B(r(l,"background-color"));const d=r(l,"vertical-align");(d==="middle"||d==="bottom"||d==="top")&&(n.cellVerticalAlign=d)}const c=g(e,"table-column-properties");if(c){n.columnWidth=k(r(c,"column-width"));const d=r(c,"rel-column-width");d&&(n.relColumnWidth=parseFloat(d)||void 0)}const h=g(e,"graphic-properties");return h&&(n.horizontalPos=r(h,"horizontal-pos")??void 0),n}parseTextProps(e){const t={},n=r(e,"font-weight");n&&(t.bold=n==="bold"||parseInt(n,10)>=600);const s=r(e,"font-style");s&&(t.italic=s==="italic"||s==="oblique");const a=r(e,"text-underline-style");a&&(t.underline=a!=="none");const o=r(e,"text-line-through-style");if(o){const x=o!=="none";x&&r(e,"text-line-through-type")==="double"?(t.doubleStrikethrough=!0,t.strikethrough=!1):t.strikethrough=x}const l=r(e,"text-position");if(l){const x=l.trim().split(/\s+/)[0],N=x==="super"?1:x==="sub"?-1:parseFloat(x);t.superscript=N>0,t.subscript=N<0}const c=r(e,"font-variant");c&&(t.smallCaps=c==="small-caps");const h=r(e,"text-transform");h&&(t.allCaps=h==="uppercase");const d=r(e,"display");d&&(t.hidden=d==="none");const u=r(e,"font-name"),i=r(e,"font-family");u?t.fontFamily=this.fontFaces.get(u)??L(u):i&&(t.fontFamily=L(i));const p=r(e,"font-size");if(p)if(p.trim().endsWith("%"))t.fontSizePercent=parseFloat(p);else{const x=k(p);x&&(t.fontSizePx=x)}const m=r(e,"color");m&&(t.color=W(m));const y=r(e,"background-color");y&&(t.backgroundColor=B(y));const v=r(e,"letter-spacing");if(v){const x=v==="normal"?null:k(v);t.letterSpacing=x?C(x):null}return t}get(e,t){return t?this.styles.get(`${e}:${t}`):void 0}chain(e,t){const n=[];let s=t;for(let o=0;s&&o<16;o++){const l=this.get(e,s);if(!l)break;n.push(l),s=l.parentName}const a=this.defaults.get(e);return a&&n.push(a),n.reverse()}resolveText(e,t,n){const s=`${e}:${t??""}|${n?JSON.stringify(n):""}`,a=this.textCache.get(s);if(a)return a;const o={};let l=n?.fontSizePx;const c=e==="paragraph"?this.chain(e,t):this.chain(e,t).filter(i=>i!==this.defaults.get(e));for(const i of c){const p=i.text;p.fontSizePx!==void 0?l=p.fontSizePx:p.fontSizePercent!==void 0&&l!==void 0&&(l=l*p.fontSizePercent/100);for(const[m,y]of Object.entries(p))m==="fontSizePx"||m==="fontSizePercent"||y!==void 0&&(o[m]=y)}const h={...n?.marks??{}},d=["bold","italic","underline","strikethrough","doubleStrikethrough","superscript","subscript","smallCaps","allCaps","hidden"];for(const i of d)o[i]===!0?h[i]=!0:o[i]===!1&&delete h[i];typeof o.fontFamily=="string"&&(h.fontFamily=o.fontFamily),typeof o.color=="string"&&(o.color==="#000000"?delete h.color:h.color=o.color),o.backgroundColor===null?delete h.backgroundColor:typeof o.backgroundColor=="string"&&(h.backgroundColor=o.backgroundColor),o.letterSpacing===null?delete h.letterSpacing:typeof o.letterSpacing=="number"&&(h.letterSpacing=o.letterSpacing),l!==void 0&&(h.fontSize=C(l));const u={marks:h,fontSizePx:l};return this.textCache.set(s,u),u}resolvePara(e){const t=e??"",n=this.paraCache.get(t);if(n)return n;const s={};for(const a of this.chain("paragraph",e))for(const[o,l]of Object.entries(a.para))l!==void 0&&(s[o]=l);return this.paraCache.set(t,s),s}findInChain(e,t,n){const s=this.chain(e,t).reverse();for(const a of s){const o=n(a);if(o!==void 0)return o}}listLevel(e,t){if(!e)return;const n=this.listStyles.get(e);if(n)return n.get(t)??n.get(1)}hasListStyle(e){return!!e&&this.listStyles.has(e)}}function ot(f){const e={},t=r(f,"text-align");t&&(e.align=t==="center"?"center":t==="justify"?"justify":t==="end"||t==="right"?"right":null);const n=k(r(f,"margin-top"));n!==void 0&&(e.marginTop=n);const s=k(r(f,"margin-bottom"));s!==void 0&&(e.marginBottom=s);const a=k(r(f,"margin-left")??r(f,"margin-start"));a!==void 0&&(e.marginLeft=a);const o=k(r(f,"text-indent"));o!==void 0&&(e.textIndent=o);const l=r(f,"line-height");l&&(e.lineHeight=l.trim().endsWith("%")?parseFloat(l)/100:null);const c=r(f,"background-color");c&&(e.background=B(c));const h=r(f,"keep-with-next");h&&(e.keepNext=h==="always");const d=r(f,"writing-mode");d&&(e.rtl=d.startsWith("rl")),r(f,"break-before")==="page"&&(e.breakBefore=!0),r(f,"break-after")==="page"&&(e.breakAfter=!0);const u={},i=j(r(f,"border"));for(const p of["top","bottom","left","right"]){const m=j(r(f,`border-${p}`))??i;m&&(u[p]=m)}return Object.keys(u).length>0&&(e.borders=JSON.stringify(u)),e}function j(f){if(!f)return null;const e=f.trim().toLowerCase();if(!e||e==="none"||e==="hidden")return null;const t=e.match(/\b(solid|dashed|dotted|double)\b/),n=t?t[1]==="solid"?"single":t[1]:"single",s=e.match(/([\d.]+)\s*(pt|px|cm|mm|in)/);let a=1;if(s){const l=k(`${s[1]}${s[2]}`)??1;a=Math.min(8,Math.max(1,Math.round(l)))}const o=e.match(/#[0-9a-f]{3,8}/);return{style:n,width:a,color:o?o[0]:"#000000"}}function B(f){if(f)return f.trim().toLowerCase()==="transparent"?null:W(f)}function L(f){return f.split(",")[0].trim().replace(/^['"]|['"]$/g,"")}const rt="urn:oasis:names:tc:opendocument:xmlns:text:1.0";class at{constructor(e,t,n){this.content=e,this.stylesDoc=t,this.options=n,this.notes=new _("odtfn"),this.comments=[],this.openComments=new Map,this.changes=new Map,this.activeInsertions=[],this.expandedDeletions=new Set,this.listChains={byXmlId:new Map,lastByStyle:new Map,counter:0},this.commentCounter=0,this.firstParagraphStyle=null;const s=t?g(t.documentElement,"styles"):null,a=t?g(t.documentElement,"automatic-styles"):null,o=[t?g(t.documentElement,"font-face-decls"):null,g(e.documentElement,"font-face-decls")].filter(c=>!!c),l=g(e.documentElement,"automatic-styles");if(this.bodyStyles=new F([...o,s,l].filter(c=>!!c)),this.chromeStyles=new F([...o,s,a].filter(c=>!!c)),!t){const c=g(e.documentElement,"styles");c&&(this.bodyStyles=new F([...o,c,l].filter(h=>!!h)))}this.styles=this.bodyStyles}read(){const e=M(this.content.documentElement,"text");e&&this.collectTrackedChanges(e);const t=e?this.convertChildren(e):[];for(;t[0]?.type==="page-break";)t.shift();it(t),t.length===0&&t.push(P());const n={type:"doc",children:t};this.notes.notes.length>0&&(n.notes=this.notes.notes);const s=Z(this.comments,[n.children,n.notes??[]]);s.length>0&&(n.comments=s);const a=this.masterPage();if(a){this.styles=this.chromeStyles;const o=this.readChrome(a);this.styles=this.bodyStyles,o.headers&&(n.headers=o.headers),o.footers&&(n.footers=o.footers);const l=this.pageLayout(a);l&&(n.pageLayout=l)}return n}convertChildren(e){const t=[];for(const n of b(e))t.push(...this.convertBlock(n));return t}convertBlock(e){switch(e.localName){case"h":case"p":return this.convertParagraph(e);case"list":return this.convertList(e);case"numbered-paragraph":return this.convertChildren(e);case"table":{const t=this.convertTable(e);return t?[t]:[]}case"section":case"index-body":case"index-title":return this.convertChildren(e);case"change-start":case"change-end":case"change":{const t=e.ownerDocument.createElementNS(rt,"text:p");t.appendChild(e.cloneNode(!0));const n=this.collectInline(t,{chrome:!1,paragraphId:""}).filter(s=>s.kind==="run").map(s=>s.node);return n.length>0?[P(E(n))]:[]}case"table-of-content":case"alphabetical-index":case"illustration-index":case"table-index":case"object-index":case"user-index":case"bibliography":{const t=g(e,"index-body");return t?this.convertChildren(t):[]}case"frame":case"a":return this.frameBlocks(e,{});default:return[]}}convertParagraph(e){const t=r(e,"style-name");this.firstParagraphStyle===null&&(this.firstParagraphStyle=t??"");const n=this.styles.resolvePara(t),s=S(),a=this.collectInline(e,{chrome:!1,paragraphId:s,paragraphAlign:n.align??void 0}),o=[];let l=[],c=!1;const h=u=>{const i=l.filter(m=>m.text.length>0||m.marks?.footnoteRef);if(i.length===0&&!u)return;const p=this.buildParagraph(e,t,n,i);c||(p.id=s,c=!0),o.push(p),l=[]};let d=!1;for(const u of a)u.kind==="run"?l.push(u.node):(h(!1),o.push(u.block),d=!0);return h(!d),n.breakBefore&&o.unshift({type:"page-break",id:S()}),n.breakAfter&&o.push({type:"page-break",id:S()}),o}buildParagraph(e,t,n,s){const a=P(s.length>0?E(s):[{type:"text",text:"",marks:{}}]);if(e.localName==="h"){const o=parseInt(r(e,"outline-level")||"1",10)||1;a.heading=Math.min(Math.max(o,1),6)}else{const o=this.styles.findInChain("paragraph",t,l=>l.outlineLevel);o&&o>0&&(a.heading=Math.min(o,6))}return this.applyParaProps(a,n),a}applyParaProps(e,t){if(t.align&&(e.align=t.align),t.rtl&&(e.direction="rtl"),e.spaceBefore=C(Math.max(0,t.marginTop??0)),e.spaceAfter=C(Math.max(0,t.marginBottom??0)),t.marginLeft!==void 0){const n=q(t.marginLeft);n&&(e.leftIndent=n)}if(t.textIndent!==void 0){const n=U(t.textIndent);n&&(e.firstLineIndent=n)}typeof t.lineHeight=="number"&&t.lineHeight>0&&(e.lineSpacing=C(t.lineHeight)),t.keepNext&&(e.keepNext=!0),t.background&&t.background!=="#ffffff"&&(e.shading=t.background),t.borders&&(e.borders=t.borders)}convertList(e){const t=[];let n=null;const s=this.listStyleFor(e),a=this.chainFor(e,s),o=()=>{if(!n||n.items.length===0){n=null;return}const c={type:"list",id:S(),variant:n.ordered?"ordered":"unordered",children:n.items};n.ordered&&(a?(c.numberingChainId=a.id,a.restart&&n.start!==void 0&&n.start!==1?c.startNumber=n.start:a.restart&&n.start,a.restart=!1):n.start!==void 0&&n.start!==1&&(c.startNumber=n.start)),n.props&&(c.spaceBefore=C(Math.max(0,n.props.marginTop??0)),c.spaceAfter=C(Math.max(0,n.props.marginBottom??0)),typeof n.props.lineHeight=="number"&&n.props.lineHeight>0&&(c.lineSpacing=C(n.props.lineHeight))),t.push(c),n=null},l=(c,h,d)=>{const u=r(c,"style-name")||d;for(const i of b(c)){if(i.localName!=="list-item"&&i.localName!=="list-header")continue;const p=i.localName==="list-header",m=r(i,"start-value");for(const y of b(i)){if(y.localName==="list"){l(y,h+1,u);continue}if(y.localName!=="p"&&y.localName!=="h"){o(),t.push(...this.convertBlock(y));continue}const v=r(y,"style-name"),x=u??this.styles.findInChain("paragraph",v,I=>I.listStyleName||void 0),N=this.styles.listLevel(x,h+1);if(p||y.localName==="h"||N?.unnumbered){o(),t.push(...this.convertParagraph(y));continue}const D=N?N.ordered:!1;n&&n.items.length>0&&h===0&&n.ordered!==D&&o(),n||(n={items:[],ordered:D,props:this.styles.resolvePara(v)}),n.items.length===0&&(m?n.start=parseInt(m,10)||void 0:N&&N.startValue!==1&&(!a||a.restart)&&(n.start=N.startValue));const $=S(),z=this.styles.resolvePara(v),X=this.collectInline(y,{chrome:!1,paragraphId:$,paragraphAlign:z.align??void 0}),A=[],T=[];for(const I of X)I.kind==="run"?A.push(I.node):T.push(I.block);n.items.push({type:"list-item",id:$,children:A.length>0?E(A):[{type:"text",text:"",marks:{}}],...h>0?{indentLevel:Math.min(h,8)}:{},...z.rtl?{direction:"rtl"}:{}}),T.length>0&&(o(),t.push(...T))}}};return l(e,0,s),o(),t}listStyleFor(e){const t=r(e,"style-name");if(t&&this.styles.hasListStyle(t))return t;const n=M(e,"p")??M(e,"h"),s=n?r(n,"style-name"):null;return this.styles.findInChain("paragraph",s,a=>a.listStyleName||void 0)??t??void 0}chainFor(e,t){const n=r(e,"id"),s=r(e,"continue-list"),a=r(e,"continue-numbering")==="true";let o;s?o=this.listChains.byXmlId.get(s):a&&t&&(o=this.listChains.lastByStyle.get(t));const l=!o;return o||(o=`odt-list-${++this.listChains.counter}`),n&&this.listChains.byXmlId.set(n,o),t&&this.listChains.lastByStyle.set(t,o),{id:o,restart:l}}convertTable(e){const t=[],n=[],s=[],a=l=>{for(const c of b(l))if(c.localName==="table-column"){const h=this.styles.get("table-column",r(c,"style-name")),d=h?.relColumnWidth??h?.columnWidth??0,u=Math.min(64,Math.max(1,parseInt(r(c,"number-columns-repeated")||"1",10)||1));for(let i=0;i<u;i++)s.push(d)}else(c.localName==="table-columns"||c.localName==="table-column-group")&&a(c)};a(e);const o=l=>{for(const c of b(l))c.localName==="table-row"?n.push(c):(c.localName==="table-header-rows"||c.localName==="table-rows"||c.localName==="table-row-group")&&o(c)};o(e);for(const l of n){const c=[];for(const h of b(l)){if(h.localName!=="table-cell")continue;const d=this.convertChildren(h).filter(v=>v.type!=="page-break"),u={type:"table-cell",id:S(),children:d.length>0?d:[P()]},i=H(r(h,"number-columns-spanned")),p=H(r(h,"number-rows-spanned"));i>1&&(u.colSpan=i),p>1&&(u.rowSpan=p);const m=this.styles.get("table-cell",r(h,"style-name"));m?.cellBackground&&(u.backgroundColor=m.cellBackground),m?.cellVerticalAlign&&m.cellVerticalAlign!=="top"&&(u.verticalAlign=m.cellVerticalAlign),c.push(u);const y=parseInt(r(h,"number-columns-repeated")||"1",10)-1;for(let v=0;v<y&&v<20;v++)c.push(J())}c.length>0&&t.push({type:"table-row",id:S(),children:c})}return G(t,{columnWidths:s.every(l=>l>0)?s:void 0,hasHeader:b(e).some(l=>l.localName==="table-header-rows")})}collectInline(e,t){const n=[],s=(l,c)=>{if(!l)return;const h=this.decorate(c),d=n[n.length-1];d?.kind==="run"&&!d.node.marks?.footnoteRef&&nt(d.node.marks,h)?d.node.text+=l:n.push({kind:"run",node:{type:"text",text:l,marks:{...h}}})},a=(l,c,h)=>{if(l.nodeType===Node.TEXT_NODE){const i=h?{...c.marks,link:h}:c.marks;let p=(l.textContent??"").replace(/[ \t\r\n]+/g," ");const m=n[n.length-1],y=m?.kind==="run"?m.node.text:"";p.startsWith(" ")&&(n.length===0||y.endsWith(" "))&&(p=p.slice(1)),s(p,i);return}if(l.nodeType!==Node.ELEMENT_NODE)return;const d=l,u=h?{...c.marks,link:h}:c.marks;switch(d.localName){case"span":{const i=this.styles.resolveText("text",r(d,"style-name"),c);d.childNodes.forEach(p=>a(p,i,h));return}case"a":{const i=d.getAttributeNS("http://www.w3.org/1999/xlink","href")||d.getAttribute("xlink:href")||void 0,p=r(d,"style-name")?this.styles.resolveText("text",r(d,"style-name"),c):c,m=i&&!i.startsWith("#")?tt(i)??h:h;d.childNodes.forEach(y=>a(y,p,m));return}case"s":{const i=parseInt(r(d,"c")||"1",10);s(" ".repeat(Math.min(Math.max(i,1),100)),u);return}case"tab":s(" ",u);return;case"line-break":s(`
2
2
  `,u);return;case"page-number":s(d.textContent||"1",{...u,field:"page"});return;case"page-count":s(d.textContent||"1",{...u,field:"numPages"});return;case"note":{if(t.chrome)return;const i=r(d,"note-class")==="endnote"?"endnote":"footnote",p=g(d,"note-body"),m=p?this.convertChildren(p):[];n.push({kind:"run",node:this.notes.add(i,m,this.decorate(u))});return}case"annotation":t.chrome||this.addAnnotation(d,t);return;case"annotation-end":{const i=r(d,"name");i&&this.openComments.delete(i);return}case"change-start":{const i=r(d,"change-id"),p=i?this.changes.get(i):void 0;i&&p?.kind==="insertion"&&this.activeInsertions.push(i);return}case"change-end":{const i=r(d,"change-id"),p=i?this.activeInsertions.indexOf(i):-1;p>=0&&this.activeInsertions.splice(p,1);return}case"change":{const i=r(d,"change-id"),p=i?this.changes.get(i):void 0;if(!i||p?.kind!=="deletion"||this.expandedDeletions.has(i))return;this.expandedDeletions.add(i);const m=O("deletion",`odtrev-${i}`,p.author,p.date);p.deleted.forEach((y,v)=>{v>0&&n.push({kind:"run",node:{type:"text",text:`
3
3
  `,marks:V(u,m)}});for(const x of this.collectInline(y,t))x.kind==="run"&&n.push({kind:"run",node:{...x.node,marks:V(x.node.marks??{},m)}})});return}case"frame":case"custom-shape":case"rect":case"ellipse":case"polygon":case"path":case"g":if(t.chrome)return;for(const i of this.frameBlocks(d,t))n.push({kind:"block",block:i});return;case"ruby-text":case"title":case"desc":case"bookmark":case"bookmark-start":case"bookmark-end":case"soft-page-break":case"reference-mark":case"reference-mark-start":case"reference-mark-end":case"hidden-text":case"hidden-paragraph":case"note-citation":case"sequence-decls":case"variable-decls":case"user-field-decls":return;default:d.childNodes.forEach(i=>a(i,c,h))}},o=this.styles.resolveText("paragraph",r(e,"style-name"));return e.childNodes.forEach(l=>a(l,o)),n}decorate(e){let t=e;this.openComments.size>0&&(t={...t,comment:[...this.openComments.values()].join(",")});const n=this.activeInsertions[this.activeInsertions.length-1];if(n){const s=this.changes.get(n);t={...t,...O("insertion",`odtrev-${n}`,s.author,s.date)}}return t}addAnnotation(e,t){this.commentCounter++;const n=`odtcmt-${this.commentCounter}`;let s="",a="",o;const l=[];for(const i of b(e))i.localName==="creator"?s=i.textContent?.trim()??"":i.localName==="creator-initials"||i.localName==="sender-initials"?a=i.textContent?.trim()??"":i.localName==="date"&&(o=i.textContent?.trim());for(const i of[...w(e,"p"),...w(e,"h")])l.push(lt(i));const c=o?Date.parse(o.endsWith("Z")||/[+-]\d\d:\d\d$/.test(o)?o:`${o}Z`):NaN,h=r(e,"name"),d=r(e,"parent-name"),u={id:n,author:s||a||"Unknown",...a?{initials:a}:{},createdAt:new Date(Number.isFinite(c)?c:0).toISOString(),bodyMd:l.map(i=>i.trim()).filter(i=>i.length>0).join(`
4
4
 
@@ -1,4 +1,4 @@
1
- import{F as P,H as S}from"./index-DcIXw_KB.js";import{N as _,k as Z,m as E,r as C,l as q,f as U,e as J,a as G,i as O,s as K,c as k,b as Q,p as Y,d as tt,n as W,M as et,g as nt}from"./OfficeImportShared-O-d47J7O.js";class st{static async parseFile(e){const t=(await import("./index-DcIXw_KB.js").then(d=>d.j)).default,n=await e.arrayBuffer(),s=await t.loadAsync(new Uint8Array(n)),a=s.file("content.xml");if(!a)throw new Error("Invalid ODT file: missing content.xml");const o=await a.async("text"),l=await s.file("styles.xml")?.async("text"),c=new Set;for(const d of[o,l??""])for(const u of d.matchAll(/xlink:href="([^"]+)"/g))c.add(R(ct(u[1])));const h=new Map;return await Promise.all([...c].map(async d=>{const u=s.file(d);u&&!u.dir&&h.set(d,await u.async("uint8array"))})),this.fromContentXml(o,l,{parts:h})}static fromContentXml(e,t,n={}){const s=new DOMParser,a=s.parseFromString(e,"application/xml"),o=t?s.parseFromString(t,"application/xml"):null;return new at(a,o,n).read()}}class F{constructor(e){this.styles=new Map,this.defaults=new Map,this.listStyles=new Map,this.fontFaces=new Map,this.textCache=new Map,this.paraCache=new Map;for(const t of e)this.collect(t)}collect(e){for(const t of w(e,"font-face")){const n=r(t,"name"),s=r(t,"font-family");n&&this.fontFaces.set(n,L(s||n))}for(const t of w(e,"default-style")){const n=r(t,"family")||"paragraph";this.defaults.set(n,this.parseStyle(t,n))}for(const t of w(e,"style")){const n=r(t,"name");if(!n)continue;const s=r(t,"family")||"paragraph";this.styles.set(`${s}:${n}`,this.parseStyle(t,s))}for(const t of w(e,"list-style")){const n=r(t,"name");if(!n)continue;const s=new Map;for(const a of b(t)){const o=parseInt(r(a,"level")||"1",10);if(a.localName==="list-level-style-number"){const l=r(a,"num-format");s.set(o,{ordered:l!=="",unnumbered:l==="",startValue:parseInt(r(a,"start-value")||"1",10)||1})}else(a.localName==="list-level-style-bullet"||a.localName==="list-level-style-image")&&s.set(o,{ordered:!1,unnumbered:!1,startValue:1})}this.listStyles.set(n,s)}}parseStyle(e,t){const n={family:t,parentName:r(e,"parent-style-name")||void 0,text:{},para:{},listStyleName:r(e,"list-style-name")??void 0,masterPageName:r(e,"master-page-name")||void 0},s=r(e,"default-outline-level");s&&(n.outlineLevel=parseInt(s,10)||void 0);const a=g(e,"text-properties");a&&(n.text=this.parseTextProps(a));const o=g(e,"paragraph-properties");o&&(n.para=ot(o));const l=g(e,"table-cell-properties");if(l){n.cellBackground=B(r(l,"background-color"));const d=r(l,"vertical-align");(d==="middle"||d==="bottom"||d==="top")&&(n.cellVerticalAlign=d)}const c=g(e,"table-column-properties");if(c){n.columnWidth=k(r(c,"column-width"));const d=r(c,"rel-column-width");d&&(n.relColumnWidth=parseFloat(d)||void 0)}const h=g(e,"graphic-properties");return h&&(n.horizontalPos=r(h,"horizontal-pos")??void 0),n}parseTextProps(e){const t={},n=r(e,"font-weight");n&&(t.bold=n==="bold"||parseInt(n,10)>=600);const s=r(e,"font-style");s&&(t.italic=s==="italic"||s==="oblique");const a=r(e,"text-underline-style");a&&(t.underline=a!=="none");const o=r(e,"text-line-through-style");if(o){const x=o!=="none";x&&r(e,"text-line-through-type")==="double"?(t.doubleStrikethrough=!0,t.strikethrough=!1):t.strikethrough=x}const l=r(e,"text-position");if(l){const x=l.trim().split(/\s+/)[0],N=x==="super"?1:x==="sub"?-1:parseFloat(x);t.superscript=N>0,t.subscript=N<0}const c=r(e,"font-variant");c&&(t.smallCaps=c==="small-caps");const h=r(e,"text-transform");h&&(t.allCaps=h==="uppercase");const d=r(e,"display");d&&(t.hidden=d==="none");const u=r(e,"font-name"),i=r(e,"font-family");u?t.fontFamily=this.fontFaces.get(u)??L(u):i&&(t.fontFamily=L(i));const p=r(e,"font-size");if(p)if(p.trim().endsWith("%"))t.fontSizePercent=parseFloat(p);else{const x=k(p);x&&(t.fontSizePx=x)}const m=r(e,"color");m&&(t.color=W(m));const y=r(e,"background-color");y&&(t.backgroundColor=B(y));const v=r(e,"letter-spacing");if(v){const x=v==="normal"?null:k(v);t.letterSpacing=x?C(x):null}return t}get(e,t){return t?this.styles.get(`${e}:${t}`):void 0}chain(e,t){const n=[];let s=t;for(let o=0;s&&o<16;o++){const l=this.get(e,s);if(!l)break;n.push(l),s=l.parentName}const a=this.defaults.get(e);return a&&n.push(a),n.reverse()}resolveText(e,t,n){const s=`${e}:${t??""}|${n?JSON.stringify(n):""}`,a=this.textCache.get(s);if(a)return a;const o={};let l=n?.fontSizePx;const c=e==="paragraph"?this.chain(e,t):this.chain(e,t).filter(i=>i!==this.defaults.get(e));for(const i of c){const p=i.text;p.fontSizePx!==void 0?l=p.fontSizePx:p.fontSizePercent!==void 0&&l!==void 0&&(l=l*p.fontSizePercent/100);for(const[m,y]of Object.entries(p))m==="fontSizePx"||m==="fontSizePercent"||y!==void 0&&(o[m]=y)}const h={...n?.marks??{}},d=["bold","italic","underline","strikethrough","doubleStrikethrough","superscript","subscript","smallCaps","allCaps","hidden"];for(const i of d)o[i]===!0?h[i]=!0:o[i]===!1&&delete h[i];typeof o.fontFamily=="string"&&(h.fontFamily=o.fontFamily),typeof o.color=="string"&&(o.color==="#000000"?delete h.color:h.color=o.color),o.backgroundColor===null?delete h.backgroundColor:typeof o.backgroundColor=="string"&&(h.backgroundColor=o.backgroundColor),o.letterSpacing===null?delete h.letterSpacing:typeof o.letterSpacing=="number"&&(h.letterSpacing=o.letterSpacing),l!==void 0&&(h.fontSize=C(l));const u={marks:h,fontSizePx:l};return this.textCache.set(s,u),u}resolvePara(e){const t=e??"",n=this.paraCache.get(t);if(n)return n;const s={};for(const a of this.chain("paragraph",e))for(const[o,l]of Object.entries(a.para))l!==void 0&&(s[o]=l);return this.paraCache.set(t,s),s}findInChain(e,t,n){const s=this.chain(e,t).reverse();for(const a of s){const o=n(a);if(o!==void 0)return o}}listLevel(e,t){if(!e)return;const n=this.listStyles.get(e);if(n)return n.get(t)??n.get(1)}hasListStyle(e){return!!e&&this.listStyles.has(e)}}function ot(f){const e={},t=r(f,"text-align");t&&(e.align=t==="center"?"center":t==="justify"?"justify":t==="end"||t==="right"?"right":null);const n=k(r(f,"margin-top"));n!==void 0&&(e.marginTop=n);const s=k(r(f,"margin-bottom"));s!==void 0&&(e.marginBottom=s);const a=k(r(f,"margin-left")??r(f,"margin-start"));a!==void 0&&(e.marginLeft=a);const o=k(r(f,"text-indent"));o!==void 0&&(e.textIndent=o);const l=r(f,"line-height");l&&(e.lineHeight=l.trim().endsWith("%")?parseFloat(l)/100:null);const c=r(f,"background-color");c&&(e.background=B(c));const h=r(f,"keep-with-next");h&&(e.keepNext=h==="always");const d=r(f,"writing-mode");d&&(e.rtl=d.startsWith("rl")),r(f,"break-before")==="page"&&(e.breakBefore=!0),r(f,"break-after")==="page"&&(e.breakAfter=!0);const u={},i=j(r(f,"border"));for(const p of["top","bottom","left","right"]){const m=j(r(f,`border-${p}`))??i;m&&(u[p]=m)}return Object.keys(u).length>0&&(e.borders=JSON.stringify(u)),e}function j(f){if(!f)return null;const e=f.trim().toLowerCase();if(!e||e==="none"||e==="hidden")return null;const t=e.match(/\b(solid|dashed|dotted|double)\b/),n=t?t[1]==="solid"?"single":t[1]:"single",s=e.match(/([\d.]+)\s*(pt|px|cm|mm|in)/);let a=1;if(s){const l=k(`${s[1]}${s[2]}`)??1;a=Math.min(8,Math.max(1,Math.round(l)))}const o=e.match(/#[0-9a-f]{3,8}/);return{style:n,width:a,color:o?o[0]:"#000000"}}function B(f){if(f)return f.trim().toLowerCase()==="transparent"?null:W(f)}function L(f){return f.split(",")[0].trim().replace(/^['"]|['"]$/g,"")}const rt="urn:oasis:names:tc:opendocument:xmlns:text:1.0";class at{constructor(e,t,n){this.content=e,this.stylesDoc=t,this.options=n,this.notes=new _("odtfn"),this.comments=[],this.openComments=new Map,this.changes=new Map,this.activeInsertions=[],this.expandedDeletions=new Set,this.listChains={byXmlId:new Map,lastByStyle:new Map,counter:0},this.commentCounter=0,this.firstParagraphStyle=null;const s=t?g(t.documentElement,"styles"):null,a=t?g(t.documentElement,"automatic-styles"):null,o=[t?g(t.documentElement,"font-face-decls"):null,g(e.documentElement,"font-face-decls")].filter(c=>!!c),l=g(e.documentElement,"automatic-styles");if(this.bodyStyles=new F([...o,s,l].filter(c=>!!c)),this.chromeStyles=new F([...o,s,a].filter(c=>!!c)),!t){const c=g(e.documentElement,"styles");c&&(this.bodyStyles=new F([...o,c,l].filter(h=>!!h)))}this.styles=this.bodyStyles}read(){const e=M(this.content.documentElement,"text");e&&this.collectTrackedChanges(e);const t=e?this.convertChildren(e):[];for(;t[0]?.type==="page-break";)t.shift();it(t),t.length===0&&t.push(P());const n={type:"doc",children:t};this.notes.notes.length>0&&(n.notes=this.notes.notes);const s=Z(this.comments,[n.children,n.notes??[]]);s.length>0&&(n.comments=s);const a=this.masterPage();if(a){this.styles=this.chromeStyles;const o=this.readChrome(a);this.styles=this.bodyStyles,o.headers&&(n.headers=o.headers),o.footers&&(n.footers=o.footers);const l=this.pageLayout(a);l&&(n.pageLayout=l)}return n}convertChildren(e){const t=[];for(const n of b(e))t.push(...this.convertBlock(n));return t}convertBlock(e){switch(e.localName){case"h":case"p":return this.convertParagraph(e);case"list":return this.convertList(e);case"numbered-paragraph":return this.convertChildren(e);case"table":{const t=this.convertTable(e);return t?[t]:[]}case"section":case"index-body":case"index-title":return this.convertChildren(e);case"change-start":case"change-end":case"change":{const t=e.ownerDocument.createElementNS(rt,"text:p");t.appendChild(e.cloneNode(!0));const n=this.collectInline(t,{chrome:!1,paragraphId:""}).filter(s=>s.kind==="run").map(s=>s.node);return n.length>0?[P(E(n))]:[]}case"table-of-content":case"alphabetical-index":case"illustration-index":case"table-index":case"object-index":case"user-index":case"bibliography":{const t=g(e,"index-body");return t?this.convertChildren(t):[]}case"frame":case"a":return this.frameBlocks(e,{});default:return[]}}convertParagraph(e){const t=r(e,"style-name");this.firstParagraphStyle===null&&(this.firstParagraphStyle=t??"");const n=this.styles.resolvePara(t),s=S(),a=this.collectInline(e,{chrome:!1,paragraphId:s,paragraphAlign:n.align??void 0}),o=[];let l=[],c=!1;const h=u=>{const i=l.filter(m=>m.text.length>0||m.marks?.footnoteRef);if(i.length===0&&!u)return;const p=this.buildParagraph(e,t,n,i);c||(p.id=s,c=!0),o.push(p),l=[]};let d=!1;for(const u of a)u.kind==="run"?l.push(u.node):(h(!1),o.push(u.block),d=!0);return h(!d),n.breakBefore&&o.unshift({type:"page-break",id:S()}),n.breakAfter&&o.push({type:"page-break",id:S()}),o}buildParagraph(e,t,n,s){const a=P(s.length>0?E(s):[{type:"text",text:"",marks:{}}]);if(e.localName==="h"){const o=parseInt(r(e,"outline-level")||"1",10)||1;a.heading=Math.min(Math.max(o,1),6)}else{const o=this.styles.findInChain("paragraph",t,l=>l.outlineLevel);o&&o>0&&(a.heading=Math.min(o,6))}return this.applyParaProps(a,n),a}applyParaProps(e,t){if(t.align&&(e.align=t.align),t.rtl&&(e.direction="rtl"),e.spaceBefore=C(Math.max(0,t.marginTop??0)),e.spaceAfter=C(Math.max(0,t.marginBottom??0)),t.marginLeft!==void 0){const n=q(t.marginLeft);n&&(e.leftIndent=n)}if(t.textIndent!==void 0){const n=U(t.textIndent);n&&(e.firstLineIndent=n)}typeof t.lineHeight=="number"&&t.lineHeight>0&&(e.lineSpacing=C(t.lineHeight)),t.keepNext&&(e.keepNext=!0),t.background&&t.background!=="#ffffff"&&(e.shading=t.background),t.borders&&(e.borders=t.borders)}convertList(e){const t=[];let n=null;const s=this.listStyleFor(e),a=this.chainFor(e,s),o=()=>{if(!n||n.items.length===0){n=null;return}const c={type:"list",id:S(),variant:n.ordered?"ordered":"unordered",children:n.items};n.ordered&&(a?(c.numberingChainId=a.id,a.restart&&n.start!==void 0&&n.start!==1?c.startNumber=n.start:a.restart&&n.start,a.restart=!1):n.start!==void 0&&n.start!==1&&(c.startNumber=n.start)),n.props&&(c.spaceBefore=C(Math.max(0,n.props.marginTop??0)),c.spaceAfter=C(Math.max(0,n.props.marginBottom??0)),typeof n.props.lineHeight=="number"&&n.props.lineHeight>0&&(c.lineSpacing=C(n.props.lineHeight))),t.push(c),n=null},l=(c,h,d)=>{const u=r(c,"style-name")||d;for(const i of b(c)){if(i.localName!=="list-item"&&i.localName!=="list-header")continue;const p=i.localName==="list-header",m=r(i,"start-value");for(const y of b(i)){if(y.localName==="list"){l(y,h+1,u);continue}if(y.localName!=="p"&&y.localName!=="h"){o(),t.push(...this.convertBlock(y));continue}const v=r(y,"style-name"),x=u??this.styles.findInChain("paragraph",v,I=>I.listStyleName||void 0),N=this.styles.listLevel(x,h+1);if(p||y.localName==="h"||N?.unnumbered){o(),t.push(...this.convertParagraph(y));continue}const D=N?N.ordered:!1;n&&n.items.length>0&&h===0&&n.ordered!==D&&o(),n||(n={items:[],ordered:D,props:this.styles.resolvePara(v)}),n.items.length===0&&(m?n.start=parseInt(m,10)||void 0:N&&N.startValue!==1&&(!a||a.restart)&&(n.start=N.startValue));const $=S(),z=this.styles.resolvePara(v),X=this.collectInline(y,{chrome:!1,paragraphId:$,paragraphAlign:z.align??void 0}),A=[],T=[];for(const I of X)I.kind==="run"?A.push(I.node):T.push(I.block);n.items.push({type:"list-item",id:$,children:A.length>0?E(A):[{type:"text",text:"",marks:{}}],...h>0?{indentLevel:Math.min(h,8)}:{},...z.rtl?{direction:"rtl"}:{}}),T.length>0&&(o(),t.push(...T))}}};return l(e,0,s),o(),t}listStyleFor(e){const t=r(e,"style-name");if(t&&this.styles.hasListStyle(t))return t;const n=M(e,"p")??M(e,"h"),s=n?r(n,"style-name"):null;return this.styles.findInChain("paragraph",s,a=>a.listStyleName||void 0)??t??void 0}chainFor(e,t){const n=r(e,"id"),s=r(e,"continue-list"),a=r(e,"continue-numbering")==="true";let o;s?o=this.listChains.byXmlId.get(s):a&&t&&(o=this.listChains.lastByStyle.get(t));const l=!o;return o||(o=`odt-list-${++this.listChains.counter}`),n&&this.listChains.byXmlId.set(n,o),t&&this.listChains.lastByStyle.set(t,o),{id:o,restart:l}}convertTable(e){const t=[],n=[],s=[],a=l=>{for(const c of b(l))if(c.localName==="table-column"){const h=this.styles.get("table-column",r(c,"style-name")),d=h?.relColumnWidth??h?.columnWidth??0,u=Math.min(64,Math.max(1,parseInt(r(c,"number-columns-repeated")||"1",10)||1));for(let i=0;i<u;i++)s.push(d)}else(c.localName==="table-columns"||c.localName==="table-column-group")&&a(c)};a(e);const o=l=>{for(const c of b(l))c.localName==="table-row"?n.push(c):(c.localName==="table-header-rows"||c.localName==="table-rows"||c.localName==="table-row-group")&&o(c)};o(e);for(const l of n){const c=[];for(const h of b(l)){if(h.localName!=="table-cell")continue;const d=this.convertChildren(h).filter(v=>v.type!=="page-break"),u={type:"table-cell",id:S(),children:d.length>0?d:[P()]},i=H(r(h,"number-columns-spanned")),p=H(r(h,"number-rows-spanned"));i>1&&(u.colSpan=i),p>1&&(u.rowSpan=p);const m=this.styles.get("table-cell",r(h,"style-name"));m?.cellBackground&&(u.backgroundColor=m.cellBackground),m?.cellVerticalAlign&&m.cellVerticalAlign!=="top"&&(u.verticalAlign=m.cellVerticalAlign),c.push(u);const y=parseInt(r(h,"number-columns-repeated")||"1",10)-1;for(let v=0;v<y&&v<20;v++)c.push(J())}c.length>0&&t.push({type:"table-row",id:S(),children:c})}return G(t,{columnWidths:s.every(l=>l>0)?s:void 0,hasHeader:b(e).some(l=>l.localName==="table-header-rows")})}collectInline(e,t){const n=[],s=(l,c)=>{if(!l)return;const h=this.decorate(c),d=n[n.length-1];d?.kind==="run"&&!d.node.marks?.footnoteRef&&nt(d.node.marks,h)?d.node.text+=l:n.push({kind:"run",node:{type:"text",text:l,marks:{...h}}})},a=(l,c,h)=>{if(l.nodeType===Node.TEXT_NODE){const i=h?{...c.marks,link:h}:c.marks;let p=(l.textContent??"").replace(/[ \t\r\n]+/g," ");const m=n[n.length-1],y=m?.kind==="run"?m.node.text:"";p.startsWith(" ")&&(n.length===0||y.endsWith(" "))&&(p=p.slice(1)),s(p,i);return}if(l.nodeType!==Node.ELEMENT_NODE)return;const d=l,u=h?{...c.marks,link:h}:c.marks;switch(d.localName){case"span":{const i=this.styles.resolveText("text",r(d,"style-name"),c);d.childNodes.forEach(p=>a(p,i,h));return}case"a":{const i=d.getAttributeNS("http://www.w3.org/1999/xlink","href")||d.getAttribute("xlink:href")||void 0,p=r(d,"style-name")?this.styles.resolveText("text",r(d,"style-name"),c):c,m=i&&!i.startsWith("#")?tt(i)??h:h;d.childNodes.forEach(y=>a(y,p,m));return}case"s":{const i=parseInt(r(d,"c")||"1",10);s(" ".repeat(Math.min(Math.max(i,1),100)),u);return}case"tab":s(" ",u);return;case"line-break":s(`
1
+ import{F as P,H as S}from"./index-DuQIqmgC.js";import{N as _,k as Z,m as E,r as C,l as q,f as U,e as J,a as G,i as O,s as K,c as k,b as Q,p as Y,d as tt,n as W,M as et,g as nt}from"./OfficeImportShared-D1HPkK6E.js";class st{static async parseFile(e){const t=(await import("./index-DuQIqmgC.js").then(d=>d.j)).default,n=await e.arrayBuffer(),s=await t.loadAsync(new Uint8Array(n)),a=s.file("content.xml");if(!a)throw new Error("Invalid ODT file: missing content.xml");const o=await a.async("text"),l=await s.file("styles.xml")?.async("text"),c=new Set;for(const d of[o,l??""])for(const u of d.matchAll(/xlink:href="([^"]+)"/g))c.add(R(ct(u[1])));const h=new Map;return await Promise.all([...c].map(async d=>{const u=s.file(d);u&&!u.dir&&h.set(d,await u.async("uint8array"))})),this.fromContentXml(o,l,{parts:h})}static fromContentXml(e,t,n={}){const s=new DOMParser,a=s.parseFromString(e,"application/xml"),o=t?s.parseFromString(t,"application/xml"):null;return new at(a,o,n).read()}}class F{constructor(e){this.styles=new Map,this.defaults=new Map,this.listStyles=new Map,this.fontFaces=new Map,this.textCache=new Map,this.paraCache=new Map;for(const t of e)this.collect(t)}collect(e){for(const t of w(e,"font-face")){const n=r(t,"name"),s=r(t,"font-family");n&&this.fontFaces.set(n,L(s||n))}for(const t of w(e,"default-style")){const n=r(t,"family")||"paragraph";this.defaults.set(n,this.parseStyle(t,n))}for(const t of w(e,"style")){const n=r(t,"name");if(!n)continue;const s=r(t,"family")||"paragraph";this.styles.set(`${s}:${n}`,this.parseStyle(t,s))}for(const t of w(e,"list-style")){const n=r(t,"name");if(!n)continue;const s=new Map;for(const a of b(t)){const o=parseInt(r(a,"level")||"1",10);if(a.localName==="list-level-style-number"){const l=r(a,"num-format");s.set(o,{ordered:l!=="",unnumbered:l==="",startValue:parseInt(r(a,"start-value")||"1",10)||1})}else(a.localName==="list-level-style-bullet"||a.localName==="list-level-style-image")&&s.set(o,{ordered:!1,unnumbered:!1,startValue:1})}this.listStyles.set(n,s)}}parseStyle(e,t){const n={family:t,parentName:r(e,"parent-style-name")||void 0,text:{},para:{},listStyleName:r(e,"list-style-name")??void 0,masterPageName:r(e,"master-page-name")||void 0},s=r(e,"default-outline-level");s&&(n.outlineLevel=parseInt(s,10)||void 0);const a=g(e,"text-properties");a&&(n.text=this.parseTextProps(a));const o=g(e,"paragraph-properties");o&&(n.para=ot(o));const l=g(e,"table-cell-properties");if(l){n.cellBackground=B(r(l,"background-color"));const d=r(l,"vertical-align");(d==="middle"||d==="bottom"||d==="top")&&(n.cellVerticalAlign=d)}const c=g(e,"table-column-properties");if(c){n.columnWidth=k(r(c,"column-width"));const d=r(c,"rel-column-width");d&&(n.relColumnWidth=parseFloat(d)||void 0)}const h=g(e,"graphic-properties");return h&&(n.horizontalPos=r(h,"horizontal-pos")??void 0),n}parseTextProps(e){const t={},n=r(e,"font-weight");n&&(t.bold=n==="bold"||parseInt(n,10)>=600);const s=r(e,"font-style");s&&(t.italic=s==="italic"||s==="oblique");const a=r(e,"text-underline-style");a&&(t.underline=a!=="none");const o=r(e,"text-line-through-style");if(o){const x=o!=="none";x&&r(e,"text-line-through-type")==="double"?(t.doubleStrikethrough=!0,t.strikethrough=!1):t.strikethrough=x}const l=r(e,"text-position");if(l){const x=l.trim().split(/\s+/)[0],N=x==="super"?1:x==="sub"?-1:parseFloat(x);t.superscript=N>0,t.subscript=N<0}const c=r(e,"font-variant");c&&(t.smallCaps=c==="small-caps");const h=r(e,"text-transform");h&&(t.allCaps=h==="uppercase");const d=r(e,"display");d&&(t.hidden=d==="none");const u=r(e,"font-name"),i=r(e,"font-family");u?t.fontFamily=this.fontFaces.get(u)??L(u):i&&(t.fontFamily=L(i));const p=r(e,"font-size");if(p)if(p.trim().endsWith("%"))t.fontSizePercent=parseFloat(p);else{const x=k(p);x&&(t.fontSizePx=x)}const m=r(e,"color");m&&(t.color=W(m));const y=r(e,"background-color");y&&(t.backgroundColor=B(y));const v=r(e,"letter-spacing");if(v){const x=v==="normal"?null:k(v);t.letterSpacing=x?C(x):null}return t}get(e,t){return t?this.styles.get(`${e}:${t}`):void 0}chain(e,t){const n=[];let s=t;for(let o=0;s&&o<16;o++){const l=this.get(e,s);if(!l)break;n.push(l),s=l.parentName}const a=this.defaults.get(e);return a&&n.push(a),n.reverse()}resolveText(e,t,n){const s=`${e}:${t??""}|${n?JSON.stringify(n):""}`,a=this.textCache.get(s);if(a)return a;const o={};let l=n?.fontSizePx;const c=e==="paragraph"?this.chain(e,t):this.chain(e,t).filter(i=>i!==this.defaults.get(e));for(const i of c){const p=i.text;p.fontSizePx!==void 0?l=p.fontSizePx:p.fontSizePercent!==void 0&&l!==void 0&&(l=l*p.fontSizePercent/100);for(const[m,y]of Object.entries(p))m==="fontSizePx"||m==="fontSizePercent"||y!==void 0&&(o[m]=y)}const h={...n?.marks??{}},d=["bold","italic","underline","strikethrough","doubleStrikethrough","superscript","subscript","smallCaps","allCaps","hidden"];for(const i of d)o[i]===!0?h[i]=!0:o[i]===!1&&delete h[i];typeof o.fontFamily=="string"&&(h.fontFamily=o.fontFamily),typeof o.color=="string"&&(o.color==="#000000"?delete h.color:h.color=o.color),o.backgroundColor===null?delete h.backgroundColor:typeof o.backgroundColor=="string"&&(h.backgroundColor=o.backgroundColor),o.letterSpacing===null?delete h.letterSpacing:typeof o.letterSpacing=="number"&&(h.letterSpacing=o.letterSpacing),l!==void 0&&(h.fontSize=C(l));const u={marks:h,fontSizePx:l};return this.textCache.set(s,u),u}resolvePara(e){const t=e??"",n=this.paraCache.get(t);if(n)return n;const s={};for(const a of this.chain("paragraph",e))for(const[o,l]of Object.entries(a.para))l!==void 0&&(s[o]=l);return this.paraCache.set(t,s),s}findInChain(e,t,n){const s=this.chain(e,t).reverse();for(const a of s){const o=n(a);if(o!==void 0)return o}}listLevel(e,t){if(!e)return;const n=this.listStyles.get(e);if(n)return n.get(t)??n.get(1)}hasListStyle(e){return!!e&&this.listStyles.has(e)}}function ot(f){const e={},t=r(f,"text-align");t&&(e.align=t==="center"?"center":t==="justify"?"justify":t==="end"||t==="right"?"right":null);const n=k(r(f,"margin-top"));n!==void 0&&(e.marginTop=n);const s=k(r(f,"margin-bottom"));s!==void 0&&(e.marginBottom=s);const a=k(r(f,"margin-left")??r(f,"margin-start"));a!==void 0&&(e.marginLeft=a);const o=k(r(f,"text-indent"));o!==void 0&&(e.textIndent=o);const l=r(f,"line-height");l&&(e.lineHeight=l.trim().endsWith("%")?parseFloat(l)/100:null);const c=r(f,"background-color");c&&(e.background=B(c));const h=r(f,"keep-with-next");h&&(e.keepNext=h==="always");const d=r(f,"writing-mode");d&&(e.rtl=d.startsWith("rl")),r(f,"break-before")==="page"&&(e.breakBefore=!0),r(f,"break-after")==="page"&&(e.breakAfter=!0);const u={},i=j(r(f,"border"));for(const p of["top","bottom","left","right"]){const m=j(r(f,`border-${p}`))??i;m&&(u[p]=m)}return Object.keys(u).length>0&&(e.borders=JSON.stringify(u)),e}function j(f){if(!f)return null;const e=f.trim().toLowerCase();if(!e||e==="none"||e==="hidden")return null;const t=e.match(/\b(solid|dashed|dotted|double)\b/),n=t?t[1]==="solid"?"single":t[1]:"single",s=e.match(/([\d.]+)\s*(pt|px|cm|mm|in)/);let a=1;if(s){const l=k(`${s[1]}${s[2]}`)??1;a=Math.min(8,Math.max(1,Math.round(l)))}const o=e.match(/#[0-9a-f]{3,8}/);return{style:n,width:a,color:o?o[0]:"#000000"}}function B(f){if(f)return f.trim().toLowerCase()==="transparent"?null:W(f)}function L(f){return f.split(",")[0].trim().replace(/^['"]|['"]$/g,"")}const rt="urn:oasis:names:tc:opendocument:xmlns:text:1.0";class at{constructor(e,t,n){this.content=e,this.stylesDoc=t,this.options=n,this.notes=new _("odtfn"),this.comments=[],this.openComments=new Map,this.changes=new Map,this.activeInsertions=[],this.expandedDeletions=new Set,this.listChains={byXmlId:new Map,lastByStyle:new Map,counter:0},this.commentCounter=0,this.firstParagraphStyle=null;const s=t?g(t.documentElement,"styles"):null,a=t?g(t.documentElement,"automatic-styles"):null,o=[t?g(t.documentElement,"font-face-decls"):null,g(e.documentElement,"font-face-decls")].filter(c=>!!c),l=g(e.documentElement,"automatic-styles");if(this.bodyStyles=new F([...o,s,l].filter(c=>!!c)),this.chromeStyles=new F([...o,s,a].filter(c=>!!c)),!t){const c=g(e.documentElement,"styles");c&&(this.bodyStyles=new F([...o,c,l].filter(h=>!!h)))}this.styles=this.bodyStyles}read(){const e=M(this.content.documentElement,"text");e&&this.collectTrackedChanges(e);const t=e?this.convertChildren(e):[];for(;t[0]?.type==="page-break";)t.shift();it(t),t.length===0&&t.push(P());const n={type:"doc",children:t};this.notes.notes.length>0&&(n.notes=this.notes.notes);const s=Z(this.comments,[n.children,n.notes??[]]);s.length>0&&(n.comments=s);const a=this.masterPage();if(a){this.styles=this.chromeStyles;const o=this.readChrome(a);this.styles=this.bodyStyles,o.headers&&(n.headers=o.headers),o.footers&&(n.footers=o.footers);const l=this.pageLayout(a);l&&(n.pageLayout=l)}return n}convertChildren(e){const t=[];for(const n of b(e))t.push(...this.convertBlock(n));return t}convertBlock(e){switch(e.localName){case"h":case"p":return this.convertParagraph(e);case"list":return this.convertList(e);case"numbered-paragraph":return this.convertChildren(e);case"table":{const t=this.convertTable(e);return t?[t]:[]}case"section":case"index-body":case"index-title":return this.convertChildren(e);case"change-start":case"change-end":case"change":{const t=e.ownerDocument.createElementNS(rt,"text:p");t.appendChild(e.cloneNode(!0));const n=this.collectInline(t,{chrome:!1,paragraphId:""}).filter(s=>s.kind==="run").map(s=>s.node);return n.length>0?[P(E(n))]:[]}case"table-of-content":case"alphabetical-index":case"illustration-index":case"table-index":case"object-index":case"user-index":case"bibliography":{const t=g(e,"index-body");return t?this.convertChildren(t):[]}case"frame":case"a":return this.frameBlocks(e,{});default:return[]}}convertParagraph(e){const t=r(e,"style-name");this.firstParagraphStyle===null&&(this.firstParagraphStyle=t??"");const n=this.styles.resolvePara(t),s=S(),a=this.collectInline(e,{chrome:!1,paragraphId:s,paragraphAlign:n.align??void 0}),o=[];let l=[],c=!1;const h=u=>{const i=l.filter(m=>m.text.length>0||m.marks?.footnoteRef);if(i.length===0&&!u)return;const p=this.buildParagraph(e,t,n,i);c||(p.id=s,c=!0),o.push(p),l=[]};let d=!1;for(const u of a)u.kind==="run"?l.push(u.node):(h(!1),o.push(u.block),d=!0);return h(!d),n.breakBefore&&o.unshift({type:"page-break",id:S()}),n.breakAfter&&o.push({type:"page-break",id:S()}),o}buildParagraph(e,t,n,s){const a=P(s.length>0?E(s):[{type:"text",text:"",marks:{}}]);if(e.localName==="h"){const o=parseInt(r(e,"outline-level")||"1",10)||1;a.heading=Math.min(Math.max(o,1),6)}else{const o=this.styles.findInChain("paragraph",t,l=>l.outlineLevel);o&&o>0&&(a.heading=Math.min(o,6))}return this.applyParaProps(a,n),a}applyParaProps(e,t){if(t.align&&(e.align=t.align),t.rtl&&(e.direction="rtl"),e.spaceBefore=C(Math.max(0,t.marginTop??0)),e.spaceAfter=C(Math.max(0,t.marginBottom??0)),t.marginLeft!==void 0){const n=q(t.marginLeft);n&&(e.leftIndent=n)}if(t.textIndent!==void 0){const n=U(t.textIndent);n&&(e.firstLineIndent=n)}typeof t.lineHeight=="number"&&t.lineHeight>0&&(e.lineSpacing=C(t.lineHeight)),t.keepNext&&(e.keepNext=!0),t.background&&t.background!=="#ffffff"&&(e.shading=t.background),t.borders&&(e.borders=t.borders)}convertList(e){const t=[];let n=null;const s=this.listStyleFor(e),a=this.chainFor(e,s),o=()=>{if(!n||n.items.length===0){n=null;return}const c={type:"list",id:S(),variant:n.ordered?"ordered":"unordered",children:n.items};n.ordered&&(a?(c.numberingChainId=a.id,a.restart&&n.start!==void 0&&n.start!==1?c.startNumber=n.start:a.restart&&n.start,a.restart=!1):n.start!==void 0&&n.start!==1&&(c.startNumber=n.start)),n.props&&(c.spaceBefore=C(Math.max(0,n.props.marginTop??0)),c.spaceAfter=C(Math.max(0,n.props.marginBottom??0)),typeof n.props.lineHeight=="number"&&n.props.lineHeight>0&&(c.lineSpacing=C(n.props.lineHeight))),t.push(c),n=null},l=(c,h,d)=>{const u=r(c,"style-name")||d;for(const i of b(c)){if(i.localName!=="list-item"&&i.localName!=="list-header")continue;const p=i.localName==="list-header",m=r(i,"start-value");for(const y of b(i)){if(y.localName==="list"){l(y,h+1,u);continue}if(y.localName!=="p"&&y.localName!=="h"){o(),t.push(...this.convertBlock(y));continue}const v=r(y,"style-name"),x=u??this.styles.findInChain("paragraph",v,I=>I.listStyleName||void 0),N=this.styles.listLevel(x,h+1);if(p||y.localName==="h"||N?.unnumbered){o(),t.push(...this.convertParagraph(y));continue}const D=N?N.ordered:!1;n&&n.items.length>0&&h===0&&n.ordered!==D&&o(),n||(n={items:[],ordered:D,props:this.styles.resolvePara(v)}),n.items.length===0&&(m?n.start=parseInt(m,10)||void 0:N&&N.startValue!==1&&(!a||a.restart)&&(n.start=N.startValue));const $=S(),z=this.styles.resolvePara(v),X=this.collectInline(y,{chrome:!1,paragraphId:$,paragraphAlign:z.align??void 0}),A=[],T=[];for(const I of X)I.kind==="run"?A.push(I.node):T.push(I.block);n.items.push({type:"list-item",id:$,children:A.length>0?E(A):[{type:"text",text:"",marks:{}}],...h>0?{indentLevel:Math.min(h,8)}:{},...z.rtl?{direction:"rtl"}:{}}),T.length>0&&(o(),t.push(...T))}}};return l(e,0,s),o(),t}listStyleFor(e){const t=r(e,"style-name");if(t&&this.styles.hasListStyle(t))return t;const n=M(e,"p")??M(e,"h"),s=n?r(n,"style-name"):null;return this.styles.findInChain("paragraph",s,a=>a.listStyleName||void 0)??t??void 0}chainFor(e,t){const n=r(e,"id"),s=r(e,"continue-list"),a=r(e,"continue-numbering")==="true";let o;s?o=this.listChains.byXmlId.get(s):a&&t&&(o=this.listChains.lastByStyle.get(t));const l=!o;return o||(o=`odt-list-${++this.listChains.counter}`),n&&this.listChains.byXmlId.set(n,o),t&&this.listChains.lastByStyle.set(t,o),{id:o,restart:l}}convertTable(e){const t=[],n=[],s=[],a=l=>{for(const c of b(l))if(c.localName==="table-column"){const h=this.styles.get("table-column",r(c,"style-name")),d=h?.relColumnWidth??h?.columnWidth??0,u=Math.min(64,Math.max(1,parseInt(r(c,"number-columns-repeated")||"1",10)||1));for(let i=0;i<u;i++)s.push(d)}else(c.localName==="table-columns"||c.localName==="table-column-group")&&a(c)};a(e);const o=l=>{for(const c of b(l))c.localName==="table-row"?n.push(c):(c.localName==="table-header-rows"||c.localName==="table-rows"||c.localName==="table-row-group")&&o(c)};o(e);for(const l of n){const c=[];for(const h of b(l)){if(h.localName!=="table-cell")continue;const d=this.convertChildren(h).filter(v=>v.type!=="page-break"),u={type:"table-cell",id:S(),children:d.length>0?d:[P()]},i=H(r(h,"number-columns-spanned")),p=H(r(h,"number-rows-spanned"));i>1&&(u.colSpan=i),p>1&&(u.rowSpan=p);const m=this.styles.get("table-cell",r(h,"style-name"));m?.cellBackground&&(u.backgroundColor=m.cellBackground),m?.cellVerticalAlign&&m.cellVerticalAlign!=="top"&&(u.verticalAlign=m.cellVerticalAlign),c.push(u);const y=parseInt(r(h,"number-columns-repeated")||"1",10)-1;for(let v=0;v<y&&v<20;v++)c.push(J())}c.length>0&&t.push({type:"table-row",id:S(),children:c})}return G(t,{columnWidths:s.every(l=>l>0)?s:void 0,hasHeader:b(e).some(l=>l.localName==="table-header-rows")})}collectInline(e,t){const n=[],s=(l,c)=>{if(!l)return;const h=this.decorate(c),d=n[n.length-1];d?.kind==="run"&&!d.node.marks?.footnoteRef&&nt(d.node.marks,h)?d.node.text+=l:n.push({kind:"run",node:{type:"text",text:l,marks:{...h}}})},a=(l,c,h)=>{if(l.nodeType===Node.TEXT_NODE){const i=h?{...c.marks,link:h}:c.marks;let p=(l.textContent??"").replace(/[ \t\r\n]+/g," ");const m=n[n.length-1],y=m?.kind==="run"?m.node.text:"";p.startsWith(" ")&&(n.length===0||y.endsWith(" "))&&(p=p.slice(1)),s(p,i);return}if(l.nodeType!==Node.ELEMENT_NODE)return;const d=l,u=h?{...c.marks,link:h}:c.marks;switch(d.localName){case"span":{const i=this.styles.resolveText("text",r(d,"style-name"),c);d.childNodes.forEach(p=>a(p,i,h));return}case"a":{const i=d.getAttributeNS("http://www.w3.org/1999/xlink","href")||d.getAttribute("xlink:href")||void 0,p=r(d,"style-name")?this.styles.resolveText("text",r(d,"style-name"),c):c,m=i&&!i.startsWith("#")?tt(i)??h:h;d.childNodes.forEach(y=>a(y,p,m));return}case"s":{const i=parseInt(r(d,"c")||"1",10);s(" ".repeat(Math.min(Math.max(i,1),100)),u);return}case"tab":s(" ",u);return;case"line-break":s(`
2
2
  `,u);return;case"page-number":s(d.textContent||"1",{...u,field:"page"});return;case"page-count":s(d.textContent||"1",{...u,field:"numPages"});return;case"note":{if(t.chrome)return;const i=r(d,"note-class")==="endnote"?"endnote":"footnote",p=g(d,"note-body"),m=p?this.convertChildren(p):[];n.push({kind:"run",node:this.notes.add(i,m,this.decorate(u))});return}case"annotation":t.chrome||this.addAnnotation(d,t);return;case"annotation-end":{const i=r(d,"name");i&&this.openComments.delete(i);return}case"change-start":{const i=r(d,"change-id"),p=i?this.changes.get(i):void 0;i&&p?.kind==="insertion"&&this.activeInsertions.push(i);return}case"change-end":{const i=r(d,"change-id"),p=i?this.activeInsertions.indexOf(i):-1;p>=0&&this.activeInsertions.splice(p,1);return}case"change":{const i=r(d,"change-id"),p=i?this.changes.get(i):void 0;if(!i||p?.kind!=="deletion"||this.expandedDeletions.has(i))return;this.expandedDeletions.add(i);const m=O("deletion",`odtrev-${i}`,p.author,p.date);p.deleted.forEach((y,v)=>{v>0&&n.push({kind:"run",node:{type:"text",text:`
3
3
  `,marks:V(u,m)}});for(const x of this.collectInline(y,t))x.kind==="run"&&n.push({kind:"run",node:{...x.node,marks:V(x.node.marks??{},m)}})});return}case"frame":case"custom-shape":case"rect":case"ellipse":case"polygon":case"path":case"g":if(t.chrome)return;for(const i of this.frameBlocks(d,t))n.push({kind:"block",block:i});return;case"ruby-text":case"title":case"desc":case"bookmark":case"bookmark-start":case"bookmark-end":case"soft-page-break":case"reference-mark":case"reference-mark-start":case"reference-mark-end":case"hidden-text":case"hidden-paragraph":case"note-citation":case"sequence-decls":case"variable-decls":case"user-field-decls":return;default:d.childNodes.forEach(i=>a(i,c,h))}},o=this.styles.resolveText("paragraph",r(e,"style-name"));return e.childNodes.forEach(l=>a(l,o)),n}decorate(e){let t=e;this.openComments.size>0&&(t={...t,comment:[...this.openComments.values()].join(",")});const n=this.activeInsertions[this.activeInsertions.length-1];if(n){const s=this.changes.get(n);t={...t,...O("insertion",`odtrev-${n}`,s.author,s.date)}}return t}addAnnotation(e,t){this.commentCounter++;const n=`odtcmt-${this.commentCounter}`;let s="",a="",o;const l=[];for(const i of b(e))i.localName==="creator"?s=i.textContent?.trim()??"":i.localName==="creator-initials"||i.localName==="sender-initials"?a=i.textContent?.trim()??"":i.localName==="date"&&(o=i.textContent?.trim());for(const i of[...w(e,"p"),...w(e,"h")])l.push(lt(i));const c=o?Date.parse(o.endsWith("Z")||/[+-]\d\d:\d\d$/.test(o)?o:`${o}Z`):NaN,h=r(e,"name"),d=r(e,"parent-name"),u={id:n,author:s||a||"Unknown",...a?{initials:a}:{},createdAt:new Date(Number.isFinite(c)?c:0).toISOString(),bodyMd:l.map(i=>i.trim()).filter(i=>i.length>0).join(`
4
4
 
@@ -1 +1 @@
1
- import{F as l,I as P,J as M,K as m,P as g,H as f,L as y,R as v,M as S}from"./index-D9_PwgOX.js";const k=new Set(["http","https","mailto","tel","ftp"]);function $(n){const t=n?.trim();if(!t)return;const e=t.replace(/[\u0000- \u007f]/g,"");if(e.startsWith("//")||e.startsWith("\\\\"))return;const r=/^([a-z][a-z0-9+.-]*):/i.exec(e)?.[1];if(!(r&&!k.has(r.toLowerCase())))return t}function j(n){return n/15}function d(n){return Math.round(n*100)/100}function A(n){if(!n)return;const t=/^\s*(-?\d*\.?\d+)\s*(pt|px|cm|mm|in|pc|em)\s*$/i.exec(n);if(!t)return;const e=parseFloat(t[1]);if(Number.isFinite(e))switch(t[2].toLowerCase()){case"px":return e;case"pt":return e*96/72;case"pc":return e*16;case"in":return e*96;case"cm":return e*96/2.54;case"mm":return e*96/25.4;case"em":return e*16;default:return}}function L(n){if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1})}function F(n){if(n<0)return-1;if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1,firstLine:!0})}function C(n){const t={};if(n.widthPx&&n.heightPx){const s=S(n.widthPx,n.heightPx);s&&N(s.pageSize,n)&&(t.pageSize=s.pageSize,t.orientation=n.landscape?"landscape":s.orientation)}const e=s=>s!==void 0&&Number.isFinite(s)&&s>=0&&s<=288?Math.round(s):void 0,r=e(n.marginTopPx),i=e(n.marginRightPx),a=e(n.marginBottomPx),c=e(n.marginLeftPx);return r!==void 0&&(t.marginTopPx=r),i!==void 0&&(t.marginRightPx=i),a!==void 0&&(t.marginBottomPx=a),c!==void 0&&(t.marginLeftPx=c),Object.keys(t).length>0?t:void 0}const I={letter:[8.5,11],tabloid:[11,17],legal:[8.5,14],statement:[5.5,8.5],executive:[7.25,10.5],folio:[8.5,13],a3:[11.69,16.54],a4:[8.27,11.69],a5:[5.83,8.27],b4:[9.84,13.9],b5:[6.93,9.84]};function N(n,t){const e=I[n];if(!e||!t.widthPx||!t.heightPx)return!1;const r=Math.min(t.widthPx,t.heightPx)/96,i=Math.max(t.widthPx,t.heightPx)/96;return Math.abs(r-e[0])<.25&&Math.abs(i-e[1])<.25}function z(n){if(!n)return;const t=n.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return"#"+t.slice(1).split("").map(e=>e+e).join("")}function W(n,t,e){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(n)}${r(t)}${r(e)}`}function E(n){let t="";for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode.apply(null,Array.from(n.subarray(e,e+32768)));return btoa(t)}const R={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"};function T(n){if(n.length<4)return;const t=n;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return"png";if(t[0]===255&&t[1]===216)return"jpeg";if(t[0]===71&&t[1]===73&&t[2]===70)return"gif";if(t[0]===66&&t[1]===77)return"bmp";if(t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return"webp";if(t.length>=44&&t[0]===1&&t[1]===0&&t[40]===32&&t[41]===69&&t[42]===77&&t[43]===70)return"emf";if(t[0]===215&&t[1]===205&&t[2]===198&&t[3]===154||(t[0]===1||t[0]===2)&&t[1]===0&&t[2]===9&&t[3]===0)return"wmf";const e=new TextDecoder("utf-8").decode(n.subarray(0,256));if(/<svg[\s>]/i.test(e)||/^\s*<\?xml[^>]*>\s*(<!--[\s\S]*?-->\s*)*<svg/i.test(e))return"svg"}function B(n,t,e,r={}){const i=`data:${R[t]};base64,${E(n)}`,a=Math.max(1,Math.round(e.width&&e.width>0?e.width:200)),c=Math.max(1,Math.round(e.height&&e.height>0?e.height:200)),s={type:"image",id:f(),src:i,width:a,height:c};return r.alt&&(s.alt=r.alt),r.align&&(s.align=r.align),(t==="emf"||t==="wmf")&&(s.originalFormat=t,s.originalDataUrl=i),s}function p(){return{type:"table-cell",id:f(),children:[l()]}}const x=1e3,D=1e5;function b(n){return Math.max(1,Math.min(x,Math.floor(D/Math.max(1,n))))}function H(n,t={}){const e=n.filter(o=>o.children.length>0);if(e.length===0)return null;const r=b(e.length);for(const o of e)O(o,r);const i=y({children:e,columnWidths:[]}),a=i.cols;if(a===0)return null;for(let o=0;o<e.length;o++){let u=0;for(let h=0;h<a;h++)i.occupancy[o]?.[h]||u++;for(let h=0;h<u;h++)e[o].children.push(p())}let c=Array(a).fill(100/a);const s=t.columnWidths;if(s&&s.length===a&&s.every(o=>Number.isFinite(o)&&o>0)){const o=s.reduce((u,h)=>u+h,0);c=s.map(u=>d(u/o*100))}return{type:"table",id:f(),children:e,columnWidths:c,...t.hasHeader?{hasHeader:!0}:{}}}function O(n,t){const e=n.children;if(e.length>t){const i=e[t-1];for(const a of e.slice(t))i.children.push(...a.children);e.length=t}let r=0;e.forEach((i,a)=>{const c=t-r-(e.length-1-a),s=Math.min(i.colSpan??1,Math.max(1,c));s>1?i.colSpan=s:delete i.colSpan,r+=s})}class U{constructor(t){this.prefix=t,this.notes=[],this.counters={footnote:0,endnote:0}}add(t,e,r={}){this.counters[t]+=1;const i=`${this.prefix}-${this.notes.length+1}`,a=e.length>0?e:[l()];P(a),this.notes.push({type:"footnote",id:i,...t==="endnote"?{noteKind:"endnote"}:{},children:a});const{footnoteRef:c,superscript:s,subscript:o,...u}=r;return{type:"text",text:M(this.counters[t],t),marks:{...u,footnoteRef:i,superscript:!0}}}}function K(n,t,e,r){const i=e?.trim()===v;return{...n==="insertion"?{insertion:!0}:{deletion:!0},suggestionId:t,suggestionSource:i?"agent":"manual",suggestionAuthorType:i?"ai":"human",suggestionLabel:n==="insertion"?"Insert":"Delete",...r!==void 0&&Number.isFinite(r)?{suggestionCreatedAt:r}:{},...e?{suggestionAuthorName:e}:{}}}function J(n,t){const e=new Set,r=i=>{if(!i||typeof i!="object")return;if(Array.isArray(i)){i.forEach(r);return}const a=i;a.marks?.comment&&a.marks.comment.split(",").forEach(c=>e.add(c)),r(a.children)};return t.forEach(r),n.filter(i=>e.has(i.id)||i.anchorBlockId!==void 0||i.parentId!==void 0&&e.has(i.parentId))}function G(n){const t=[];for(const e of n){const r=t[t.length-1];r&&w(r.marks,e.marks)?r.text+=e.text:t.push({...e,...e.marks?{marks:{...e.marks}}:{}})}return t}function w(n,t){const e=n??{},r=t??{},i=new Set([...Object.keys(e),...Object.keys(r)]);for(const a of i)if(e[a]!==r[a])return!1;return!0}export{x as M,U as N,H as a,B as b,A as c,$ as d,p as e,F as f,w as g,W as h,K as i,b as j,J as k,L as l,G as m,z as n,C as p,d as r,T as s,j as t};
1
+ import{F as l,I as P,J as M,K as m,P as g,H as f,L as y,R as v,M as S}from"./index-DSAJ-J8p.js";const k=new Set(["http","https","mailto","tel","ftp"]);function $(n){const t=n?.trim();if(!t)return;const e=t.replace(/[\u0000- \u007f]/g,"");if(e.startsWith("//")||e.startsWith("\\\\"))return;const r=/^([a-z][a-z0-9+.-]*):/i.exec(e)?.[1];if(!(r&&!k.has(r.toLowerCase())))return t}function j(n){return n/15}function d(n){return Math.round(n*100)/100}function A(n){if(!n)return;const t=/^\s*(-?\d*\.?\d+)\s*(pt|px|cm|mm|in|pc|em)\s*$/i.exec(n);if(!t)return;const e=parseFloat(t[1]);if(Number.isFinite(e))switch(t[2].toLowerCase()){case"px":return e;case"pt":return e*96/72;case"pc":return e*16;case"in":return e*96;case"cm":return e*96/2.54;case"mm":return e*96/25.4;case"em":return e*16;default:return}}function L(n){if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1})}function F(n){if(n<0)return-1;if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1,firstLine:!0})}function C(n){const t={};if(n.widthPx&&n.heightPx){const s=S(n.widthPx,n.heightPx);s&&N(s.pageSize,n)&&(t.pageSize=s.pageSize,t.orientation=n.landscape?"landscape":s.orientation)}const e=s=>s!==void 0&&Number.isFinite(s)&&s>=0&&s<=288?Math.round(s):void 0,r=e(n.marginTopPx),i=e(n.marginRightPx),a=e(n.marginBottomPx),c=e(n.marginLeftPx);return r!==void 0&&(t.marginTopPx=r),i!==void 0&&(t.marginRightPx=i),a!==void 0&&(t.marginBottomPx=a),c!==void 0&&(t.marginLeftPx=c),Object.keys(t).length>0?t:void 0}const I={letter:[8.5,11],tabloid:[11,17],legal:[8.5,14],statement:[5.5,8.5],executive:[7.25,10.5],folio:[8.5,13],a3:[11.69,16.54],a4:[8.27,11.69],a5:[5.83,8.27],b4:[9.84,13.9],b5:[6.93,9.84]};function N(n,t){const e=I[n];if(!e||!t.widthPx||!t.heightPx)return!1;const r=Math.min(t.widthPx,t.heightPx)/96,i=Math.max(t.widthPx,t.heightPx)/96;return Math.abs(r-e[0])<.25&&Math.abs(i-e[1])<.25}function z(n){if(!n)return;const t=n.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return"#"+t.slice(1).split("").map(e=>e+e).join("")}function W(n,t,e){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(n)}${r(t)}${r(e)}`}function E(n){let t="";for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode.apply(null,Array.from(n.subarray(e,e+32768)));return btoa(t)}const R={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"};function T(n){if(n.length<4)return;const t=n;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return"png";if(t[0]===255&&t[1]===216)return"jpeg";if(t[0]===71&&t[1]===73&&t[2]===70)return"gif";if(t[0]===66&&t[1]===77)return"bmp";if(t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return"webp";if(t.length>=44&&t[0]===1&&t[1]===0&&t[40]===32&&t[41]===69&&t[42]===77&&t[43]===70)return"emf";if(t[0]===215&&t[1]===205&&t[2]===198&&t[3]===154||(t[0]===1||t[0]===2)&&t[1]===0&&t[2]===9&&t[3]===0)return"wmf";const e=new TextDecoder("utf-8").decode(n.subarray(0,256));if(/<svg[\s>]/i.test(e)||/^\s*<\?xml[^>]*>\s*(<!--[\s\S]*?-->\s*)*<svg/i.test(e))return"svg"}function B(n,t,e,r={}){const i=`data:${R[t]};base64,${E(n)}`,a=Math.max(1,Math.round(e.width&&e.width>0?e.width:200)),c=Math.max(1,Math.round(e.height&&e.height>0?e.height:200)),s={type:"image",id:f(),src:i,width:a,height:c};return r.alt&&(s.alt=r.alt),r.align&&(s.align=r.align),(t==="emf"||t==="wmf")&&(s.originalFormat=t,s.originalDataUrl=i),s}function p(){return{type:"table-cell",id:f(),children:[l()]}}const x=1e3,D=1e5;function b(n){return Math.max(1,Math.min(x,Math.floor(D/Math.max(1,n))))}function H(n,t={}){const e=n.filter(o=>o.children.length>0);if(e.length===0)return null;const r=b(e.length);for(const o of e)O(o,r);const i=y({children:e,columnWidths:[]}),a=i.cols;if(a===0)return null;for(let o=0;o<e.length;o++){let u=0;for(let h=0;h<a;h++)i.occupancy[o]?.[h]||u++;for(let h=0;h<u;h++)e[o].children.push(p())}let c=Array(a).fill(100/a);const s=t.columnWidths;if(s&&s.length===a&&s.every(o=>Number.isFinite(o)&&o>0)){const o=s.reduce((u,h)=>u+h,0);c=s.map(u=>d(u/o*100))}return{type:"table",id:f(),children:e,columnWidths:c,...t.hasHeader?{hasHeader:!0}:{}}}function O(n,t){const e=n.children;if(e.length>t){const i=e[t-1];for(const a of e.slice(t))i.children.push(...a.children);e.length=t}let r=0;e.forEach((i,a)=>{const c=t-r-(e.length-1-a),s=Math.min(i.colSpan??1,Math.max(1,c));s>1?i.colSpan=s:delete i.colSpan,r+=s})}class U{constructor(t){this.prefix=t,this.notes=[],this.counters={footnote:0,endnote:0}}add(t,e,r={}){this.counters[t]+=1;const i=`${this.prefix}-${this.notes.length+1}`,a=e.length>0?e:[l()];P(a),this.notes.push({type:"footnote",id:i,...t==="endnote"?{noteKind:"endnote"}:{},children:a});const{footnoteRef:c,superscript:s,subscript:o,...u}=r;return{type:"text",text:M(this.counters[t],t),marks:{...u,footnoteRef:i,superscript:!0}}}}function K(n,t,e,r){const i=e?.trim()===v;return{...n==="insertion"?{insertion:!0}:{deletion:!0},suggestionId:t,suggestionSource:i?"agent":"manual",suggestionAuthorType:i?"ai":"human",suggestionLabel:n==="insertion"?"Insert":"Delete",...r!==void 0&&Number.isFinite(r)?{suggestionCreatedAt:r}:{},...e?{suggestionAuthorName:e}:{}}}function J(n,t){const e=new Set,r=i=>{if(!i||typeof i!="object")return;if(Array.isArray(i)){i.forEach(r);return}const a=i;a.marks?.comment&&a.marks.comment.split(",").forEach(c=>e.add(c)),r(a.children)};return t.forEach(r),n.filter(i=>e.has(i.id)||i.anchorBlockId!==void 0||i.parentId!==void 0&&e.has(i.parentId))}function G(n){const t=[];for(const e of n){const r=t[t.length-1];r&&w(r.marks,e.marks)?r.text+=e.text:t.push({...e,...e.marks?{marks:{...e.marks}}:{}})}return t}function w(n,t){const e=n??{},r=t??{},i=new Set([...Object.keys(e),...Object.keys(r)]);for(const a of i)if(e[a]!==r[a])return!1;return!0}export{x as M,U as N,H as a,B as b,A as c,$ as d,p as e,F as f,w as g,W as h,K as i,b as j,J as k,L as l,G as m,z as n,C as p,d as r,T as s,j as t};
@@ -1 +1 @@
1
- import{F as l,I as P,J as M,K as m,P as g,H as f,L as y,R as v,M as S}from"./index-DcIXw_KB.js";const k=new Set(["http","https","mailto","tel","ftp"]);function $(n){const t=n?.trim();if(!t)return;const e=t.replace(/[\u0000- \u007f]/g,"");if(e.startsWith("//")||e.startsWith("\\\\"))return;const r=/^([a-z][a-z0-9+.-]*):/i.exec(e)?.[1];if(!(r&&!k.has(r.toLowerCase())))return t}function j(n){return n/15}function d(n){return Math.round(n*100)/100}function A(n){if(!n)return;const t=/^\s*(-?\d*\.?\d+)\s*(pt|px|cm|mm|in|pc|em)\s*$/i.exec(n);if(!t)return;const e=parseFloat(t[1]);if(Number.isFinite(e))switch(t[2].toLowerCase()){case"px":return e;case"pt":return e*96/72;case"pc":return e*16;case"in":return e*96;case"cm":return e*96/2.54;case"mm":return e*96/25.4;case"em":return e*16;default:return}}function L(n){if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1})}function F(n){if(n<0)return-1;if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1,firstLine:!0})}function C(n){const t={};if(n.widthPx&&n.heightPx){const s=S(n.widthPx,n.heightPx);s&&N(s.pageSize,n)&&(t.pageSize=s.pageSize,t.orientation=n.landscape?"landscape":s.orientation)}const e=s=>s!==void 0&&Number.isFinite(s)&&s>=0&&s<=288?Math.round(s):void 0,r=e(n.marginTopPx),i=e(n.marginRightPx),a=e(n.marginBottomPx),c=e(n.marginLeftPx);return r!==void 0&&(t.marginTopPx=r),i!==void 0&&(t.marginRightPx=i),a!==void 0&&(t.marginBottomPx=a),c!==void 0&&(t.marginLeftPx=c),Object.keys(t).length>0?t:void 0}const I={letter:[8.5,11],tabloid:[11,17],legal:[8.5,14],statement:[5.5,8.5],executive:[7.25,10.5],folio:[8.5,13],a3:[11.69,16.54],a4:[8.27,11.69],a5:[5.83,8.27],b4:[9.84,13.9],b5:[6.93,9.84]};function N(n,t){const e=I[n];if(!e||!t.widthPx||!t.heightPx)return!1;const r=Math.min(t.widthPx,t.heightPx)/96,i=Math.max(t.widthPx,t.heightPx)/96;return Math.abs(r-e[0])<.25&&Math.abs(i-e[1])<.25}function z(n){if(!n)return;const t=n.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return"#"+t.slice(1).split("").map(e=>e+e).join("")}function W(n,t,e){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(n)}${r(t)}${r(e)}`}function E(n){let t="";for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode.apply(null,Array.from(n.subarray(e,e+32768)));return btoa(t)}const R={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"};function T(n){if(n.length<4)return;const t=n;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return"png";if(t[0]===255&&t[1]===216)return"jpeg";if(t[0]===71&&t[1]===73&&t[2]===70)return"gif";if(t[0]===66&&t[1]===77)return"bmp";if(t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return"webp";if(t.length>=44&&t[0]===1&&t[1]===0&&t[40]===32&&t[41]===69&&t[42]===77&&t[43]===70)return"emf";if(t[0]===215&&t[1]===205&&t[2]===198&&t[3]===154||(t[0]===1||t[0]===2)&&t[1]===0&&t[2]===9&&t[3]===0)return"wmf";const e=new TextDecoder("utf-8").decode(n.subarray(0,256));if(/<svg[\s>]/i.test(e)||/^\s*<\?xml[^>]*>\s*(<!--[\s\S]*?-->\s*)*<svg/i.test(e))return"svg"}function B(n,t,e,r={}){const i=`data:${R[t]};base64,${E(n)}`,a=Math.max(1,Math.round(e.width&&e.width>0?e.width:200)),c=Math.max(1,Math.round(e.height&&e.height>0?e.height:200)),s={type:"image",id:f(),src:i,width:a,height:c};return r.alt&&(s.alt=r.alt),r.align&&(s.align=r.align),(t==="emf"||t==="wmf")&&(s.originalFormat=t,s.originalDataUrl=i),s}function p(){return{type:"table-cell",id:f(),children:[l()]}}const x=1e3,D=1e5;function b(n){return Math.max(1,Math.min(x,Math.floor(D/Math.max(1,n))))}function H(n,t={}){const e=n.filter(o=>o.children.length>0);if(e.length===0)return null;const r=b(e.length);for(const o of e)O(o,r);const i=y({children:e,columnWidths:[]}),a=i.cols;if(a===0)return null;for(let o=0;o<e.length;o++){let u=0;for(let h=0;h<a;h++)i.occupancy[o]?.[h]||u++;for(let h=0;h<u;h++)e[o].children.push(p())}let c=Array(a).fill(100/a);const s=t.columnWidths;if(s&&s.length===a&&s.every(o=>Number.isFinite(o)&&o>0)){const o=s.reduce((u,h)=>u+h,0);c=s.map(u=>d(u/o*100))}return{type:"table",id:f(),children:e,columnWidths:c,...t.hasHeader?{hasHeader:!0}:{}}}function O(n,t){const e=n.children;if(e.length>t){const i=e[t-1];for(const a of e.slice(t))i.children.push(...a.children);e.length=t}let r=0;e.forEach((i,a)=>{const c=t-r-(e.length-1-a),s=Math.min(i.colSpan??1,Math.max(1,c));s>1?i.colSpan=s:delete i.colSpan,r+=s})}class U{constructor(t){this.prefix=t,this.notes=[],this.counters={footnote:0,endnote:0}}add(t,e,r={}){this.counters[t]+=1;const i=`${this.prefix}-${this.notes.length+1}`,a=e.length>0?e:[l()];P(a),this.notes.push({type:"footnote",id:i,...t==="endnote"?{noteKind:"endnote"}:{},children:a});const{footnoteRef:c,superscript:s,subscript:o,...u}=r;return{type:"text",text:M(this.counters[t],t),marks:{...u,footnoteRef:i,superscript:!0}}}}function K(n,t,e,r){const i=e?.trim()===v;return{...n==="insertion"?{insertion:!0}:{deletion:!0},suggestionId:t,suggestionSource:i?"agent":"manual",suggestionAuthorType:i?"ai":"human",suggestionLabel:n==="insertion"?"Insert":"Delete",...r!==void 0&&Number.isFinite(r)?{suggestionCreatedAt:r}:{},...e?{suggestionAuthorName:e}:{}}}function J(n,t){const e=new Set,r=i=>{if(!i||typeof i!="object")return;if(Array.isArray(i)){i.forEach(r);return}const a=i;a.marks?.comment&&a.marks.comment.split(",").forEach(c=>e.add(c)),r(a.children)};return t.forEach(r),n.filter(i=>e.has(i.id)||i.anchorBlockId!==void 0||i.parentId!==void 0&&e.has(i.parentId))}function G(n){const t=[];for(const e of n){const r=t[t.length-1];r&&w(r.marks,e.marks)?r.text+=e.text:t.push({...e,...e.marks?{marks:{...e.marks}}:{}})}return t}function w(n,t){const e=n??{},r=t??{},i=new Set([...Object.keys(e),...Object.keys(r)]);for(const a of i)if(e[a]!==r[a])return!1;return!0}export{x as M,U as N,H as a,B as b,A as c,$ as d,p as e,F as f,w as g,W as h,K as i,b as j,J as k,L as l,G as m,z as n,C as p,d as r,T as s,j as t};
1
+ import{F as l,I as P,J as M,K as m,P as g,H as f,L as y,R as v,M as S}from"./index-DuQIqmgC.js";const k=new Set(["http","https","mailto","tel","ftp"]);function $(n){const t=n?.trim();if(!t)return;const e=t.replace(/[\u0000- \u007f]/g,"");if(e.startsWith("//")||e.startsWith("\\\\"))return;const r=/^([a-z][a-z0-9+.-]*):/i.exec(e)?.[1];if(!(r&&!k.has(r.toLowerCase())))return t}function j(n){return n/15}function d(n){return Math.round(n*100)/100}function A(n){if(!n)return;const t=/^\s*(-?\d*\.?\d+)\s*(pt|px|cm|mm|in|pc|em)\s*$/i.exec(n);if(!t)return;const e=parseFloat(t[1]);if(Number.isFinite(e))switch(t[2].toLowerCase()){case"px":return e;case"pt":return e*96/72;case"pc":return e*16;case"in":return e*96;case"cm":return e*96/2.54;case"mm":return e*96/25.4;case"em":return e*16;default:return}}function L(n){if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1})}function F(n){if(n<0)return-1;if(n>0)return m(n,{indentStepPx:g,storedAsUnits:!1,firstLine:!0})}function C(n){const t={};if(n.widthPx&&n.heightPx){const s=S(n.widthPx,n.heightPx);s&&N(s.pageSize,n)&&(t.pageSize=s.pageSize,t.orientation=n.landscape?"landscape":s.orientation)}const e=s=>s!==void 0&&Number.isFinite(s)&&s>=0&&s<=288?Math.round(s):void 0,r=e(n.marginTopPx),i=e(n.marginRightPx),a=e(n.marginBottomPx),c=e(n.marginLeftPx);return r!==void 0&&(t.marginTopPx=r),i!==void 0&&(t.marginRightPx=i),a!==void 0&&(t.marginBottomPx=a),c!==void 0&&(t.marginLeftPx=c),Object.keys(t).length>0?t:void 0}const I={letter:[8.5,11],tabloid:[11,17],legal:[8.5,14],statement:[5.5,8.5],executive:[7.25,10.5],folio:[8.5,13],a3:[11.69,16.54],a4:[8.27,11.69],a5:[5.83,8.27],b4:[9.84,13.9],b5:[6.93,9.84]};function N(n,t){const e=I[n];if(!e||!t.widthPx||!t.heightPx)return!1;const r=Math.min(t.widthPx,t.heightPx)/96,i=Math.max(t.widthPx,t.heightPx)/96;return Math.abs(r-e[0])<.25&&Math.abs(i-e[1])<.25}function z(n){if(!n)return;const t=n.trim().toLowerCase();if(/^#[0-9a-f]{6}$/.test(t))return t;if(/^#[0-9a-f]{3}$/.test(t))return"#"+t.slice(1).split("").map(e=>e+e).join("")}function W(n,t,e){const r=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${r(n)}${r(t)}${r(e)}`}function E(n){let t="";for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode.apply(null,Array.from(n.subarray(e,e+32768)));return btoa(t)}const R={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"};function T(n){if(n.length<4)return;const t=n;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return"png";if(t[0]===255&&t[1]===216)return"jpeg";if(t[0]===71&&t[1]===73&&t[2]===70)return"gif";if(t[0]===66&&t[1]===77)return"bmp";if(t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80)return"webp";if(t.length>=44&&t[0]===1&&t[1]===0&&t[40]===32&&t[41]===69&&t[42]===77&&t[43]===70)return"emf";if(t[0]===215&&t[1]===205&&t[2]===198&&t[3]===154||(t[0]===1||t[0]===2)&&t[1]===0&&t[2]===9&&t[3]===0)return"wmf";const e=new TextDecoder("utf-8").decode(n.subarray(0,256));if(/<svg[\s>]/i.test(e)||/^\s*<\?xml[^>]*>\s*(<!--[\s\S]*?-->\s*)*<svg/i.test(e))return"svg"}function B(n,t,e,r={}){const i=`data:${R[t]};base64,${E(n)}`,a=Math.max(1,Math.round(e.width&&e.width>0?e.width:200)),c=Math.max(1,Math.round(e.height&&e.height>0?e.height:200)),s={type:"image",id:f(),src:i,width:a,height:c};return r.alt&&(s.alt=r.alt),r.align&&(s.align=r.align),(t==="emf"||t==="wmf")&&(s.originalFormat=t,s.originalDataUrl=i),s}function p(){return{type:"table-cell",id:f(),children:[l()]}}const x=1e3,D=1e5;function b(n){return Math.max(1,Math.min(x,Math.floor(D/Math.max(1,n))))}function H(n,t={}){const e=n.filter(o=>o.children.length>0);if(e.length===0)return null;const r=b(e.length);for(const o of e)O(o,r);const i=y({children:e,columnWidths:[]}),a=i.cols;if(a===0)return null;for(let o=0;o<e.length;o++){let u=0;for(let h=0;h<a;h++)i.occupancy[o]?.[h]||u++;for(let h=0;h<u;h++)e[o].children.push(p())}let c=Array(a).fill(100/a);const s=t.columnWidths;if(s&&s.length===a&&s.every(o=>Number.isFinite(o)&&o>0)){const o=s.reduce((u,h)=>u+h,0);c=s.map(u=>d(u/o*100))}return{type:"table",id:f(),children:e,columnWidths:c,...t.hasHeader?{hasHeader:!0}:{}}}function O(n,t){const e=n.children;if(e.length>t){const i=e[t-1];for(const a of e.slice(t))i.children.push(...a.children);e.length=t}let r=0;e.forEach((i,a)=>{const c=t-r-(e.length-1-a),s=Math.min(i.colSpan??1,Math.max(1,c));s>1?i.colSpan=s:delete i.colSpan,r+=s})}class U{constructor(t){this.prefix=t,this.notes=[],this.counters={footnote:0,endnote:0}}add(t,e,r={}){this.counters[t]+=1;const i=`${this.prefix}-${this.notes.length+1}`,a=e.length>0?e:[l()];P(a),this.notes.push({type:"footnote",id:i,...t==="endnote"?{noteKind:"endnote"}:{},children:a});const{footnoteRef:c,superscript:s,subscript:o,...u}=r;return{type:"text",text:M(this.counters[t],t),marks:{...u,footnoteRef:i,superscript:!0}}}}function K(n,t,e,r){const i=e?.trim()===v;return{...n==="insertion"?{insertion:!0}:{deletion:!0},suggestionId:t,suggestionSource:i?"agent":"manual",suggestionAuthorType:i?"ai":"human",suggestionLabel:n==="insertion"?"Insert":"Delete",...r!==void 0&&Number.isFinite(r)?{suggestionCreatedAt:r}:{},...e?{suggestionAuthorName:e}:{}}}function J(n,t){const e=new Set,r=i=>{if(!i||typeof i!="object")return;if(Array.isArray(i)){i.forEach(r);return}const a=i;a.marks?.comment&&a.marks.comment.split(",").forEach(c=>e.add(c)),r(a.children)};return t.forEach(r),n.filter(i=>e.has(i.id)||i.anchorBlockId!==void 0||i.parentId!==void 0&&e.has(i.parentId))}function G(n){const t=[];for(const e of n){const r=t[t.length-1];r&&w(r.marks,e.marks)?r.text+=e.text:t.push({...e,...e.marks?{marks:{...e.marks}}:{}})}return t}function w(n,t){const e=n??{},r=t??{},i=new Set([...Object.keys(e),...Object.keys(r)]);for(const a of i)if(e[a]!==r[a])return!1;return!0}export{x as M,U as N,H as a,B as b,A as c,$ as d,p as e,F as f,w as g,W as h,K as i,b as j,J as k,L as l,G as m,z as n,C as p,d as r,T as s,j as t};