revise 2.2.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -1182
- package/LICENSE +24 -41
- package/README.md +103 -26
- package/agent.d.ts +139 -0
- package/chunks/chunk-U5X47PZ6.js +135 -0
- package/chunks/chunk-U6YKQBKL.js +15 -0
- package/chunks/chunk-ZLQVPMBN.js +1650 -0
- package/chunks/package-5SHL5FOJ.js +14 -0
- package/chunks/render-QD5VWKSV.js +109 -0
- package/cli-output.schema.json +1984 -0
- package/cli.js +3609 -0
- package/document.d.ts +320 -0
- package/docx.d.ts +73 -0
- package/errors.d.ts +14 -0
- package/index.d.ts +13 -975
- package/index.js +31 -1
- package/legacy/editor.d.ts +19 -0
- package/legacy/editor.js +16 -0
- package/legacy/server.d.ts +37 -0
- package/legacy/server.js +25 -0
- package/legacy/style.css +2 -0
- package/package.d.ts +23 -0
- package/package.json +49 -55
- package/render.d.ts +27 -0
- package/FONT-LICENSE-HAN-EXT-B.txt +0 -91
- package/FONT-LICENSE-KATEX.txt +0 -95
- package/FONT-LICENSE-LIBERATION.txt +0 -102
- package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +0 -93
- package/FONT-LICENSE-NOTO-SANS-SC.txt +0 -93
- package/FONT-LICENSE-NOTO.txt +0 -94
- package/FONT-LICENSE-SOURCE-CODE-PRO.txt +0 -94
- package/FONT-LICENSE-SOURCE-SERIF-4.txt +0 -93
- package/THIRD-PARTY-NOTICES.md +0 -3376
- package/assets/historyMaterializeWorker-B51R08XN.js +0 -612
- package/backend.d.ts +0 -161
- package/backend.js +0 -3
- package/chunks/AgentPageRenderer-CH8kSTJn.js +0 -1
- package/chunks/AgentPageRenderer-P23XVguo.js +0 -1
- package/chunks/AttachmentDocumentImporter-B1WOaa7d.js +0 -1
- package/chunks/AttachmentDocumentImporter-CT_PJp_e.js +0 -1
- package/chunks/BidiText-Swm5fl9J.js +0 -160
- package/chunks/ColorParserFull-BKH72fK8.js +0 -446
- package/chunks/DocumentMutator-btiDK57e.js +0 -31
- package/chunks/DocumentScrubber-CMPfm_HF.js +0 -18
- package/chunks/DocumentScrubber-Cm2kH8op.js +0 -1
- package/chunks/DocumentScrubber-bJoKijol.js +0 -1
- package/chunks/DocumentStylesheet-DreoD7sD.js +0 -7
- package/chunks/DocxConverter-BcVG-p5K.js +0 -13
- package/chunks/DocxConverter-D2bO5RE-.js +0 -1125
- package/chunks/DocxConverter-haCfRuWb.js +0 -13
- package/chunks/DocxGraft-BRKh4mHQ.js +0 -1
- package/chunks/DocxGraft-BxSQtl12.js +0 -7
- package/chunks/DocxGraft-C9MBQCnf.js +0 -1
- package/chunks/FileImporter-CszqRfVU.js +0 -1
- package/chunks/FileImporter-DObFoCCn.js +0 -1
- package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +0 -3
- package/chunks/HtmlConverter-DwXB4IDh.js +0 -267
- package/chunks/ListNumbering-Qlu6AuRZ.js +0 -23
- package/chunks/MarkdownConverter-CUC8GgsS.js +0 -57
- package/chunks/MathRenderer-DT6GyJXb.js +0 -68
- package/chunks/OdtConverter-7h9HHMpL.js +0 -125
- package/chunks/OdtConverter-Ct4qypJk.js +0 -6
- package/chunks/OdtConverter-DFl__sJc.js +0 -6
- package/chunks/OfficeImportShared-BY6FdZ8d.js +0 -1
- package/chunks/OfficeImportShared-BrZoDM0j.js +0 -30
- package/chunks/OfficeImportShared-Bvm-mOyj.js +0 -1
- package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +0 -36
- package/chunks/PdfConverter-1wyvoT7X.js +0 -21
- package/chunks/PdfConverter-BAoEHILo.js +0 -21
- package/chunks/PdfConverter-CKEvFj11.js +0 -448
- package/chunks/PdfImportService-BhLPp5uG.js +0 -2
- package/chunks/PdfImportService-xbzrN__L.js +0 -2
- package/chunks/RtfConverter-Bxn-enp8.js +0 -15
- package/chunks/RtfConverter-LZPzBDSr.js +0 -15
- package/chunks/RtfConverter-_bacXqr1.js +0 -186
- package/chunks/TableBorders-CwnF3jvH.js +0 -30
- package/chunks/TableGrid-DbroRucl.js +0 -12
- package/chunks/TextFileDecoder--rsVs3NR.js +0 -9
- package/chunks/TxtConverter-C7FOwHpH.js +0 -14
- package/chunks/UnicodeUtils-CXtusU4g.js +0 -10
- package/chunks/XmlConverter-7oo8oeQB.js +0 -2
- package/chunks/XmlConverter-DGORHJcZ.js +0 -96
- package/chunks/XmlConverter-DeLHReK_.js +0 -2
- package/chunks/__vite-browser-external-l0sNRNKZ.js +0 -0
- package/chunks/_commonjsHelpers-DaMA6jEr.js +0 -2
- package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +0 -1
- package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +0 -1
- package/chunks/ar-ComXvtmh.js +0 -13
- package/chunks/backend-DecaBz-I.js +0 -490
- package/chunks/base64-sSPOzq-u.js +0 -198
- package/chunks/browser-module-CFmqfGkE.js +0 -1791
- package/chunks/browser-module-Dj5o3kuL.js +0 -3
- package/chunks/browser-module-UuM_O36W.js +0 -3
- package/chunks/bundle.min-DRpfgV69.js +0 -782
- package/chunks/capture-1btcWcPF.js +0 -9
- package/chunks/carrier-DQeng6yq.js +0 -6
- package/chunks/de-BkbpIKxx.js +0 -13
- package/chunks/es-CKkXujOF.js +0 -13
- package/chunks/fil-piIHMc8F.js +0 -13
- package/chunks/footnoteFlatten-DUQticYy.js +0 -6
- package/chunks/fr-DuA8qLje.js +0 -13
- package/chunks/graftExport-CYnStOdU.js +0 -82
- package/chunks/html2canvas.esm-CntiHiYW.js +0 -997
- package/chunks/index-2TBhRkX7.js +0 -387
- package/chunks/index-BWdRWxoH.js +0 -1807
- package/chunks/index-Bf14eTEW.js +0 -1096
- package/chunks/index-BwcX_r62.js +0 -387
- package/chunks/index.es-CI0QPo8w.js +0 -780
- package/chunks/index.es-CI7cDExj.js +0 -5
- package/chunks/index.es-DHpGt6Y5.js +0 -5
- package/chunks/ja-DgrSs555.js +0 -13
- package/chunks/jspdf.es.min--GshOuIm.js +0 -77
- package/chunks/jspdf.es.min-DU74zN8b.js +0 -1792
- package/chunks/jspdf.es.min-DurJZ1zW.js +0 -77
- package/chunks/jszip.min-CPW0h1Kx.js +0 -476
- package/chunks/katex-DWj8TvwO.js +0 -1462
- package/chunks/pdf-BLWDCiFF.js +0 -1828
- package/chunks/persistInlineDocumentImages-DQj2iaqg.js +0 -1
- package/chunks/pseudoLocale-BoYTjmiK.js +0 -1
- package/chunks/pseudoLocale-DG2NnZmz.js +0 -1
- package/chunks/purify.es-BwLardii.js +0 -107
- package/chunks/serverDocumentSession-CJ1EH3Tp.js +0 -15
- package/chunks/signatures-Bwt_OGik.js +0 -17
- package/chunks/suggestionAuthorship-B-IuLQlE.js +0 -1
- package/chunks/tree-sitter-D6zWWUMP.js +0 -4
- package/chunks/wasmInline.generated-CBYFkdSM.js +0 -1
- package/chunks/web-tree-sitter-BXGZGnNj.js +0 -2
- package/chunks/zh-9OF3SWWO.js +0 -13
- package/full.js +0 -1
- package/root.d.ts +0 -5
- package/root.js +0 -2
- package/serverToolContract.d.ts +0 -391
- package/serverToolInputs.generated.d.ts +0 -250
- package/style.css +0 -1
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
import*as w from"yjs";import"y-protocols/awareness";const lr=[{id:"markdown",label:"Markdown",extensions:[".md",".markdown"],mimeType:"text/markdown",binary:!1,import:!0,export:!0},{id:"txt",label:"Pl\
|
|
2
|
-
ain text",extensions:[".txt"],mimeType:"text/plain",binary:!1,import:!0,export:!0},{id:"html",label:"HTML",extensions:[".html",".htm"],mimeType:"text/html",binary:!1,import:!0,export:!0},{id:"docx",label:"\
|
|
3
|
-
Word (DOCX)",extensions:[".docx"],mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",binary:!0,import:!0,export:!0},{id:"pdf",label:"PDF",extensions:[".pdf"],mimeType:"\
|
|
4
|
-
application/pdf",binary:!0,import:!1,export:!0},{id:"rtf",label:"Rich Text Format (RTF)",extensions:[".rtf"],mimeType:"application/rtf",binary:!1,import:!0,export:!1},{id:"xml",label:"XML",extensions:[
|
|
5
|
-
".xml"],mimeType:"application/xml",binary:!1,import:!0,export:!1},{id:"odt",label:"OpenDocument Text (ODT)",extensions:[".odt"],mimeType:"application/vnd.oasis.opendocument.text",binary:!0,import:!0,export:!1}];
|
|
6
|
-
function ur(e){return lr.find(t=>t.extensions.some(n=>e.toLowerCase().endsWith(n)))}async function dr(e,t,n,r){const i={name:t||`document.${n}`,arrayBuffer:async()=>new Uint8Array(e).buffer},s=async()=>(await import("./TextFileDecoder--rsVs3NR.js")).
|
|
7
|
-
decodeTextBytes(e,{kind:n==="html"?"html":"plain",mimeType:r});switch(n){case"xml":return(await import("./XmlConverter-DGORHJcZ.js")).XmlConverter.fromBytes(e);case"markdown":return(await import("./MarkdownConverter-CUC8GgsS.js")).
|
|
8
|
-
MarkdownConverter.fromMarkdown(await s());case"txt":return(await import("./TxtConverter-C7FOwHpH.js")).TxtConverter.fromText(await s());case"html":{const o=await s(),{htmlHasMathMl:a,loadMathMlToLatex:c}=await import("./MathRenderer-DT6GyJXb.js").
|
|
9
|
-
then(u=>u.f);a(o)&&await c();const{cssNeedsFullColorParser:l,loadFullColorParser:d}=await Promise.resolve().then(()=>Vo);return l(o)&&await d(),(await import("./HtmlConverter-DwXB4IDh.js")).HtmlConverter.
|
|
10
|
-
fromHtml(o)}case"docx":{const o=await(await import("./DocxConverter-D2bO5RE-.js")).DocxConverter.parseFile(i,{retainSource:!0}),a=new Uint8Array(e);return o.pendingDocxCarrier={bytes:a,hash:await(await import("./DocxGraft-BxSQtl12.js")).
|
|
11
|
-
hashBytes(a)},o}case"rtf":return(await import("./RtfConverter-_bacXqr1.js")).RtfConverter.parseFile(i);case"odt":return(await import("./OdtConverter-7h9HHMpL.js")).OdtConverter.parseFile(i);default:throw new Error(
|
|
12
|
-
"This format does not support headless import: "+n)}}async function Gt(e,t,n={}){switch(t){case"markdown":return(await import("./MarkdownConverter-CUC8GgsS.js")).MarkdownConverter.toMarkdown(e);case"t\
|
|
13
|
-
xt":return(await import("./TxtConverter-C7FOwHpH.js")).TxtConverter.toText(e,n.text);case"html":return(await import("./HtmlConverter-DwXB4IDh.js")).HtmlConverter.toStyledHtml(e,n.html);case"docx":return(await import("./DocxConverter-D2bO5RE-.js")).
|
|
14
|
-
DocxConverter.toBlob(e,n.syntaxTheme,n.docx);case"pdf":return(await import("./PdfConverter-CKEvFj11.js")).PdfConverter.toBlob(e,n.title,n.syntaxTheme);default:throw new Error("This format is import-on\
|
|
15
|
-
ly: "+t)}}class fr extends Error{constructor(t){super(t.message),this.failure=t,this.name="ReviseToolError",this.callId=t.callId,this.tool=t.tool,this.code=t.code}}const ae=["lineSpacing","spaceBefore",
|
|
16
|
-
"spaceAfter"];function gr(e,t){for(const n of ae)t[n]!==void 0?e.setAttribute(n,String(t[n])):e.doc&&e.removeAttribute(n)}const Dt=128,pr=1<<29,L=(e,t)=>e>>>t|e<<32-t,mr=e=>L(e,2)^L(e,13)^L(e,22),hr=e=>L(
|
|
17
|
-
e,6)^L(e,11)^L(e,25),br=e=>L(e,7)^L(e,18)^e>>>3,yr=e=>L(e,17)^L(e,19)^e>>>10,xr=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,
|
|
18
|
-
607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,
|
|
19
|
-
3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,
|
|
20
|
-
430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wr=new Uint32Array([1779033703,
|
|
21
|
-
3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class kr{constructor(){const t=new ArrayBuffer(320);this._H=new Uint32Array(t,0,8),this._H.set(wr),this._W=new Uint32Array(
|
|
22
|
-
t,64,64)}_updateHash(){const t=this._H,n=this._W;for(let u=16;u<64;u++)n[u]=yr(n[u-2])+n[u-7]+br(n[u-15])+n[u-16];let r=t[0],i=t[1],s=t[2],o=t[3],a=t[4],c=t[5],l=t[6],d=t[7];for(let u=0,g,p;u<64;u++)g=
|
|
23
|
-
d+hr(a)+(a&c^~a&l)+xr[u]+n[u]>>>0,p=mr(r)+(r&i^r&s^i&s)>>>0,d=l,l=c,c=a,a=o+g>>>0,o=s,s=i,i=r,r=g+p>>>0;t[0]+=r,t[1]+=i,t[2]+=s,t[3]+=o,t[4]+=a,t[5]+=c,t[6]+=l,t[7]+=d}digest(t){let n=0;for(;n+56<=t.length;){
|
|
24
|
-
let o=0;for(;o<16&&n+3<t.length;o++)this._W[o]=t[n++]<<24|t[n++]<<16|t[n++]<<8|t[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<t.length;)this._W[o]|=t[n]<<(3-n%4)*8,n++;this._W[o]|=Dt<<(3-n%4)*8}this._updateHash()}
|
|
25
|
-
const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<t.length;i++)for(let o=3;o>=0&&n<t.length;o--)this._W[i]|=t[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=Dt<<(3-n%4)*8),this._W[14]=t.byteLength/pr,this.
|
|
26
|
-
_W[15]=t.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const Sr=e=>new kr().digest(e),Pe="revi\
|
|
27
|
-
se:styles:v1",Wt="sharedStylesVersion",vr=Symbol.for("revise.shared-styles.migration"),E="_reviseTextStyle",Ae="_reviseParagraphStyle",Pr=Object.freeze({_reviseStyleUnset:1}),z=new Set(["fontFamily","\
|
|
28
|
-
fontSize","bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","superscript","subscript","hidden","color","backgroundColor","letterSpacing","lang","code","docxRunPro\
|
|
29
|
-
pertyResets","oxmlRPr"]),se=new Set(["align","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","direction","tabStops","borders","shading","leftIndent","firstLineIndent","pagination"]);class J extends Error{constructor(){
|
|
30
|
-
super(...arguments),this.name="SharedStyleError"}}function Ve(e){return JSON.stringify(Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null).sort(([t],[n])=>t<n?-1:t>n?1:0)))}function _t(e,t){return`${e}\
|
|
31
|
-
:${Array.from(Sr(new TextEncoder().encode(t)).subarray(0,16),n=>n.toString(16).padStart(2,"0")).join("")}`}function G(e){return!!e?.share.has("metadata")&&e.getMap("metadata").get(Wt)===1}function Je(e,t,n){
|
|
32
|
-
const r=Ve(n),i=_t(t,r),s=e.getMap(Pe),o=s.get(i);if(o!==void 0&&o!==r)throw new J("Shared style identity collision or modified definition");return o===void 0&&s.set(i,r),i}const Ut=new WeakMap;function Ke(e,t,n){
|
|
33
|
-
if(t==null)return{};if(!e||typeof t!="string"||!t.startsWith(`${n}:`))throw new J("Invalid shared style reference");const r=e.getMap(Pe).get(t);if(typeof r!="string")throw new J("Missing shared style \
|
|
34
|
-
definition; resync the document");let i=Ut.get(e);i||Ut.set(e,i=new Map);const s=i.get(t);if(s?.json===r)return s.marks;if(_t(n,r)!==t)throw new J("Modified shared style definition");const o=JSON.parse(
|
|
35
|
-
r),a=n==="t"?z:se;if(!o||typeof o!="object"||Array.isArray(o)||Object.entries(o).some(([c,l])=>!a.has(c)||!["string","number","boolean"].includes(typeof l)))throw new J("Invalid shared style propertie\
|
|
36
|
-
s");return Object.freeze(o),i.size>=4096&&i.clear(),i.set(t,{json:r,marks:o}),o}function Ar(e,t={}){const n={...Ke(e.doc,t[E],"t"),...t};delete n[E];for(const[r,i]of Object.entries(t))z.has(r)&&i!==null&&
|
|
37
|
-
typeof i=="object"&&i._reviseStyleUnset===1&&Object.keys(i).length===1&&delete n[r];return n}function ce(e){if(!G(e.doc))return e.toDelta();const t=[];for(const n of e.toDelta()){const r=Ar(e,n.attributes),
|
|
38
|
-
i={...n};Object.keys(r).length?i.attributes=r:delete i.attributes;const s=t[t.length-1];s&&typeof s.insert=="string"&&typeof i.insert=="string"&&Ve(s.attributes??{})===Ve(i.attributes??{})?s.insert+=i.
|
|
39
|
-
insert:t.push(i)}return t}function Ht(e,t,n,r){if(E in r)throw new J("Existing style bases are immutable");if(!e.doc||!G(e.doc)||!Object.keys(r).some(i=>z.has(i))){e.format(t,n,r);return}e.doc.transact(
|
|
40
|
-
()=>{let i=t;for(const s of qt(e,t,n,r))e.format(i,s.retain,s.attributes),i+=s.retain})}function qt(e,t,n,r){if(!Object.entries(r).some(([o,a])=>z.has(o)&&a===null))return[{retain:n,attributes:r}];const i=[];
|
|
41
|
-
let s=0;for(const o of e.toDelta()){const a=s+(typeof o.insert=="string"?o.insert.length:1),c=Math.min(a,t+n)-Math.max(s,t);if(c>0){const l=Ke(e.doc,o.attributes?.[E],"t");i.push({retain:c,attributes:Object.
|
|
42
|
-
fromEntries(Object.entries(r).map(([d,u])=>[d,z.has(d)&&u===null&&d in l?Pr:u]))})}if(s=a,s>=t+n)break}return i}function Ne(e,t){const n=Object.fromEntries(Object.entries(t).filter(([i,s])=>z.has(i)&&
|
|
43
|
-
s!==null&&s!==void 0));if(Object.keys(n).length<2)return{...t};const r=Object.fromEntries(Object.entries(t).filter(([i])=>!z.has(i)));return r[E]=Je(e,"t",n),r}function le(e,t,n,r){if(!r||!e.doc||!G(e.
|
|
44
|
-
doc)){e.insert(t,n,r);return}e.doc.transact(()=>e.insert(t,n,Ne(e.doc,r)))}function Nr(e,t,n){if(!e.doc||!G(e.doc)){e.applyDelta(t,n);return}e.doc.transact(()=>{let r=0;const i=t.flatMap(s=>{const o=r;
|
|
45
|
-
return s.retain!==void 0?r+=s.retain:s.delete!==void 0&&(r+=s.delete),s.attributes?s.insert!==void 0?[{...s,attributes:Ne(e.doc,s.attributes)}]:s.retain!==void 0?qt(e,o,s.retain,s.attributes):[s]:[s]});
|
|
46
|
-
e.applyDelta(i,n)})}function K(e,t){const n=e.getAttribute(t);return n!=null||!se.has(t)||!e.doc?n:Ke(e.doc,e.getAttribute(Ae),"p")[t]}function Ye(e,t){e.doc&&G(e.doc)&&se.has(t)?e.setAttribute(t,""):
|
|
47
|
-
e.removeAttribute(t)}function Ir(e,t){const n=Object.fromEntries(Object.entries(t).filter(([r,i])=>se.has(r)&&i!==""));return Object.keys(n).length<2?t:{...Object.fromEntries(Object.entries(t).filter(
|
|
48
|
-
([r])=>!(r in n))),[Ae]:Je(e,"p",n)}}function Mr(e,t){if(!t.exclusive)throw new J("Shared style migration requires exclusive access");let n=0,r=0;const i=e.getMap(Pe).size;return e.transact(()=>{G(e)||
|
|
49
|
-
e.getMap("metadata").set(Wt,1);const s=o=>{if(o?.constructor?.name==="YXmlText"||o?.constructor?.name==="YText"){let a=0;for(const c of o.toDelta()){const l=typeof c.insert=="string"?c.insert.length:1,
|
|
50
|
-
d=c.attributes??{};if(!d[E]){const u=Ne(e,d);if(u[E]){const g={[E]:u[E]};for(const p of Object.keys(d))z.has(p)&&(g[p]=null);o.format(a,l,g),n++}}a+=l}}else if(typeof o?.toArray=="function"){if(o.nodeName===
|
|
51
|
-
"paragraph"&&!o.getAttribute(Ae)){const a={};for(const c of se){const l=o.getAttribute(c);typeof l=="string"&&l!==""&&(a[c]=l)}if(Object.keys(a).length>=2){o.setAttribute(Ae,Je(e,"p",a));for(const c of Object.
|
|
52
|
-
keys(a))o.removeAttribute(c);r++}}for(const a of o.toArray())s(a)}};for(const o of["content","chrome","notes"])e.share.has(o)&&s(e.getXmlFragment(o))},vr),{textSpans:n,paragraphs:r,definitions:e.getMap(
|
|
53
|
-
Pe).size-i}}const Fr=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function Vt(e){if(!Number.isFinite(e)||e<1)return"";let t=Math.
|
|
54
|
-
floor(e),n="";for(const[r,i]of Fr)for(;t>=r;)n+=i,t-=r;return n}function Cr(e){if(!/^[mdclxvi]+$/.test(e))return null;const t={m:1e3,d:500,c:100,l:50,x:10,v:5,i:1};let n=0;for(let r=0;r<e.length;r++){
|
|
55
|
-
const i=t[e[r]],s=t[e[r+1]]??0;n+=i<s?-i:i}return Vt(n)===e?n:null}function Tr(e,t){return t==="endnote"?Vt(e):String(e)}function Rr(e){return/^\d+$/.test(e)?"footnote":Cr(e)!==null?"endnote":"footnot\
|
|
56
|
-
e"}const Jt=10*(96/72);function Or(e){const t=n=>{if(!n||typeof n!="object")return;if(Array.isArray(n)){n.forEach(t);return}const r=n;if(r.type==="text"){typeof r.marks?.fontSize!="number"&&(r.marks={
|
|
57
|
-
...r.marks??{},fontSize:Jt});return}t(r.children)};t(e)}function Kt(e){const t=e.notes;if(!t||t.length===0)return;const n=new Map;let r;const i=a=>{if(!a||typeof a!="object")return;if(Array.isArray(a)){
|
|
58
|
-
for(const l of a)i(l);return}const c=a;if(c.type==="text"){r===void 0&&typeof c.text=="string"&&c.text.length>0&&(r=c.marks?.fontFamily),c.marks?.footnoteRef&&!n.has(c.marks.footnoteRef)&&n.set(c.marks.
|
|
59
|
-
footnoteRef,c.marks?.fontFamily);return}c.children&&i(c.children)};i(e.children);let s=!1;const o=t.map(a=>{const c=a.id,l=n.has(c)?n.get(c)??r:r;let d=!1;const u=a.children.map(g=>{if(g.type!=="parag\
|
|
60
|
-
raph"||!Array.isArray(g.children))return g;let p=!1;const f=g.children.map(h=>{if(h.type!=="text")return h;const b=h.marks??{};if(b.fontFamily===l||l===void 0&&b.fontFamily===void 0)return h;p=!0;const x={
|
|
61
|
-
...b};return l===void 0?delete x.fontFamily:x.fontFamily=l,{...h,marks:x}});return p?(d=!0,{...g,children:f}):g});return d?(s=!0,{...a,children:u}):a});s&&(e.notes=o)}const Yt=["bold","italic","underl\
|
|
62
|
-
ine","strikethrough","doubleStrikethrough","smallCaps","allCaps","hidden","letterSpacing","lang","code","latex","superscript","subscript","fontSize","color","backgroundColor","fontFamily","link","foot\
|
|
63
|
-
noteRef","footnotePendingBody","footnotePendingKind","sdtInline"],jr=[...Yt,"aiGenerated","comment","field","bookmark","fieldInstr","oxmlRange","docxRunPropertyResets","oxmlRPr","__htmlClassName"],Lr=[
|
|
64
|
-
"bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","hidden","letterSpacing","code","latex","superscript","subscript","fontFamily","fontSize","color","backgroundCol\
|
|
65
|
-
or","link","footnotePendingBody"],Er=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","letterSpacing","code","superscript","subscript","fontSize","color","backg\
|
|
66
|
-
roundColor","fontFamily","oxmlRPr"];function Br(e){if(!e)return;const t={};for(const n of Er)n in e&&e[n]!==void 0&&e[n]!==!1&&(t[n]=e[n]);return e.footnoteRef&&delete t.superscript,Object.keys(t).length>
|
|
67
|
-
0?t:void 0}const Xr=["align","heading","leftIndent","firstLineIndent","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","keepNext","keepLines","widowControl","styleId","direction","borders",
|
|
68
|
-
"shading","tabStops"];function $r(e,t){return Xr.every(n=>e[n]===t[n])}const ue={style:"single",width:1,color:"#A6A6A6"};function Qt(e={}){return JSON.stringify({bottom:{...ue,...e}})}const zr={thin:{},
|
|
69
|
-
thick:{width:3},double:{style:"double"},dashed:{style:"dashed"},dotted:{style:"dotted",width:2},stars:{style:"stars"},diamonds:{style:"diamonds"}},Gr=[{pattern:/^-\*\*-$/,style:"stars",contexts:["typi\
|
|
70
|
-
ng","markdown"]},{pattern:/^-<>-$/,style:"diamonds",contexts:["typing","markdown"]},{pattern:/^-{3,}$/,style:"thin",contexts:["typing"]},{pattern:/^_{3,}$/,style:"thick",contexts:["typing"]},{pattern:/^={3,}$/,
|
|
71
|
-
style:"double",contexts:["typing"]},{pattern:/^\*{3,}$/,style:"dotted",contexts:["typing"]},{pattern:/^([-*_])[ \t]*(?:\1[ \t]*){2,}$/,style:"thin",contexts:["markdown"]}];function Dr(e,t){let n;{if(/^ {4,}/.
|
|
72
|
-
test(e))return null;n=e.trim()}for(const r of Gr)if(r.contexts.includes(t)&&r.pattern.test(n))return r.style;return null}const Wr=new Set(["single","dashed","dotted","double","none","stars","diamonds"]);
|
|
73
|
-
function Zt(e){if(e.type!=="paragraph"||!e.borders||e.shading!==void 0||e.heading!==void 0||e.styleId!==void 0||e.align!==void 0||e.leftIndent!==void 0||e.firstLineIndent!==void 0||e.tabStops!==void 0||
|
|
74
|
-
e.children.some(s=>s.text!==""))return null;let t;try{t=JSON.parse(e.borders)}catch{return null}const n=s=>s!=null&&s.style!=="none",r=t?.bottom;if(!n(r)||n(t.top)||n(t.left)||n(t.right))return null;const i=r.
|
|
75
|
-
style;return{style:i&&Wr.has(i)?i:ue.style,width:r.width??ue.width,color:r.color??ue.color}}const _r=e=>Zt(e)!==null,Ur=new Set(["left","right","center","decimal"]),Hr=new Set(["dot","hyphen","undersc\
|
|
76
|
-
ore"]),Ie=new Map,qr=512;function Vr(e){if(!e)return null;const t=Ie.get(e);if(t!==void 0)return t;let n=null;try{const r=JSON.parse(e);if(Array.isArray(r)){const i=[];for(const s of r)if(s&&typeof s==
|
|
77
|
-
"object"&&typeof s.pos=="number"&&Number.isFinite(s.pos)&&s.pos>=0&&typeof s.align=="string"&&Ur.has(s.align)){const o={pos:s.pos,align:s.align};typeof s.leader=="string"&&Hr.has(s.leader)&&(o.leader=
|
|
78
|
-
s.leader),i.push(o)}i.length>0&&(i.sort((s,o)=>s.pos-o.pos),n=i)}}catch{n=null}return Ie.size>=qr&&Ie.clear(),Ie.set(e,n),n}function Me(e){const t=[];return e.keepNext&&t.push("keepNext"),e.keepLines&&
|
|
79
|
-
t.push("keepLines"),e.widowControl===!1&&t.push("noWidow"),t.length>0?t.join(","):void 0}function Fe(e,t){if(!t)return;const n=new Set(t.split(","));n.has("keepNext")&&(e.keepNext=!0),n.has("keepLines")&&
|
|
80
|
-
(e.keepLines=!0),n.has("noWidow")&&(e.widowControl=!1)}function Jr(e,t){return e.variant===t.variant&&e.startNumber===t.startNumber&&e.numberingChainId===t.numberingChainId&&e.numberingFormat===t.numberingFormat&&
|
|
81
|
-
e.lineSpacing===t.lineSpacing&&e.spaceBefore===t.spaceBefore&&e.spaceAfter===t.spaceAfter&&e.contextualSpacing===t.contextualSpacing}const en=e=>"type"in e&&e.type==="doc",Kr=e=>en(e)?!0:"type"in e?e.
|
|
82
|
-
type==="container"||e.type==="footnote"||e.type==="header-footer"||e.type==="table-cell":!1;function P(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let n=0;n<
|
|
83
|
-
6;n++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}function Yr(e=[{type:"text",text:"",marks:{}}]){return{type:"paragraph",id:P(),children:e}}function Qr(e,t={}){return{type:"math",id:P(),
|
|
84
|
-
content:e,displayMode:t.displayMode??"block",align:t.align??"center"}}function Zr(e){return{type:"paragraph",id:P(),children:[{type:"text",text:"",marks:{}}],borders:Qt(e)}}const Qe=[{value:"arial",label:"\
|
|
85
|
-
Arial",cssValue:"Arial, sans-serif"},{value:"helvetica",label:"Helvetica",cssValue:"Helvetica, Arial, sans-serif"},{value:"times",label:"Times New Roman",cssValue:"'Times New Roman', Times, serif"},{value:"\
|
|
86
|
-
computermodern",label:"Computer Modern",cssValue:"KaTeX_Main, 'Times New Roman', serif"},{value:"georgia",label:"Georgia",cssValue:"Georgia, serif"},{value:"sourceserif4",label:"Source Serif 4",cssValue:"\
|
|
87
|
-
'Source Serif 4', serif"},{value:"garamond",label:"Garamond",cssValue:"Garamond, 'Times New Roman', serif"},{value:"palatino",label:"Palatino",cssValue:"'Palatino Linotype', Palatino, serif"},{value:"\
|
|
88
|
-
bookman",label:"Bookman",cssValue:"'Bookman Old Style', Bookman, serif"},{value:"verdana",label:"Verdana",cssValue:"Verdana, Geneva, sans-serif"},{value:"trebuchet",label:"Trebuchet MS",cssValue:"'Tre\
|
|
89
|
-
buchet MS', Helvetica, sans-serif"},{value:"courier",label:"Courier New",cssValue:"'Courier New', Courier, monospace"},{value:"lucida",label:"Lucida Console",cssValue:"'Lucida Console', Monaco, monosp\
|
|
90
|
-
ace"},{value:"impact",label:"Impact",cssValue:"Impact, Charcoal, sans-serif"},{value:"comicsans",label:"Comic Sans MS",cssValue:"'Comic Sans MS', cursive"}];function eo(e){if(!e||e==="default")return"\
|
|
91
|
-
Arial, sans-serif";const t=Qe.find(n=>n.value.includes(e.split(",")[0].trim()));return t?t.cssValue:"inherit"}const tn={calibri:"'Calibri', 'Carlito', 'Helvetica Neue', Arial, sans-serif",cambria:"'Ca\
|
|
92
|
-
mbria', 'Caladea', Georgia, serif",aptos:"'Aptos', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif","segoe ui":"'Segoe UI', 'Helvetica Neue', Arial, sans-serif",candara:"'Candara', 'Trebuchet MS', san\
|
|
93
|
-
s-serif",constantia:"'Constantia', Georgia, serif",corbel:"'Corbel', 'Segoe UI', sans-serif",tahoma:"Tahoma, 'Segoe UI', Geneva, sans-serif","franklin gothic":"'Franklin Gothic', 'Franklin Gothic Medi\
|
|
94
|
-
um', 'Arial Narrow', sans-serif","franklin gothic medium":"'Franklin Gothic Medium', 'Arial Narrow', sans-serif","century gothic":"'Century Gothic', 'Avant Garde', 'Futura', sans-serif","book antiqua":"\
|
|
95
|
-
'Book Antiqua', 'Palatino Linotype', Palatino, serif","century schoolbook":"'Century Schoolbook', 'New Century Schoolbook', serif","sitka text":"'Sitka Text', Georgia, serif",consolas:"Consolas, Menlo\
|
|
96
|
-
, Monaco, 'Courier New', monospace","helvetica neue":"'Helvetica Neue', Helvetica, Arial, sans-serif",avenir:"Avenir, 'Avenir Next', 'Century Gothic', sans-serif","avenir next":"'Avenir Next', Avenir,\
|
|
97
|
-
'Century Gothic', sans-serif",futura:"Futura, 'Century Gothic', sans-serif","gill sans":"'Gill Sans', 'Gill Sans MT', Calibri, sans-serif",optima:"Optima, Candara, 'Segoe UI', sans-serif",baskerville:"\
|
|
98
|
-
Baskerville, 'Libre Baskerville', Georgia, serif",didot:"Didot, 'Bodoni MT', Georgia, serif","hoefler text":"'Hoefler Text', Baskerville, Georgia, serif",charter:"Charter, 'Bitstream Charter', Georgia\
|
|
99
|
-
, serif","american typewriter":"'American Typewriter', 'Courier New', monospace",menlo:"Menlo, Consolas, Monaco, monospace",monaco:"Monaco, Menlo, Consolas, monospace",seravek:"Seravek, 'Segoe UI', sa\
|
|
100
|
-
ns-serif",roboto:"Roboto, 'Helvetica Neue', Arial, sans-serif","open sans":"'Open Sans', 'Segoe UI', Arial, sans-serif",lato:"Lato, 'Helvetica Neue', Arial, sans-serif",montserrat:"Montserrat, 'Centur\
|
|
101
|
-
y Gothic', sans-serif",inter:"Inter, 'Helvetica Neue', Arial, sans-serif","source sans pro":"'Source Sans Pro', 'Segoe UI', sans-serif","noto sans":"'Noto Sans', 'Helvetica Neue', Arial, sans-serif","\
|
|
102
|
-
noto serif":"'Noto Serif', Georgia, serif","pt serif":"'PT Serif', Georgia, serif","pt sans":"'PT Sans', 'Helvetica Neue', Arial, sans-serif",merriweather:"Merriweather, Georgia, serif","liberation sa\
|
|
103
|
-
ns":"'Liberation Sans', Arial, sans-serif","liberation serif":"'Liberation Serif', 'Times New Roman', serif",carlito:"'Carlito', 'Calibri', 'Helvetica Neue', sans-serif",caladea:"'Caladea', 'Cambria',\
|
|
104
|
-
Georgia, serif"},to=["times","georgia","garamond","cambria","palatino","antiqua","baskerville","didot","bodoni","hoefler","charter","constantia","caladea","schoolbook","sitka","minion","merriweather",
|
|
105
|
-
"playfair","caslon","sabon","utopia","serif"],no=["mono","courier","consol","menlo","monaco","typewriter","code","andale"];function Ze(e){const t=e.toLowerCase();return no.some(n=>t.includes(n))?"mono\
|
|
106
|
-
space":to.some(n=>t.includes(n))?"serif":"sans-serif"}function D(e){return e.trim().replace(/^["']|["']$/g,"")}function et(e){return/[^a-zA-Z0-9-]/.test(e)?`'${e}'`:e}const tt=new Map,ro=["'Revise Not\
|
|
107
|
-
o SC'","'Revise Noto JP'","'Revise Noto KR'","'Revise Han Ext B'","'Revise Noto Arabic'","'Revise Noto Hebrew'","'Revise Noto Devanagari'","'Revise Noto Bengali'","'Revise Noto Gurmukhi'","'Revise Not\
|
|
108
|
-
o Gujarati'","'Revise Noto Oriya'","'Revise Noto Tamil'","'Revise Noto Telugu'","'Revise Noto Kannada'","'Revise Noto Malayalam'","'Revise Noto Sinhala'","'Revise Noto Thai'","'Revise Noto Lao'","'Rev\
|
|
109
|
-
ise Noto Khmer'","'Revise Noto Myanmar'","'Revise Noto Armenian'","'Revise Noto Kartvelian'","'Revise Noto Ethiopic'","'Revise Noto Syriac'","'Revise Noto Thaana'","'Revise Noto Tibetan'","'Revise Not\
|
|
110
|
-
o Symbols'","'Revise Noto Symbols 2'","'Revise Noto Emoji'"],nn=ro.join(", ");function oo(e){const t=e?.toLowerCase().split(/[-_]/)[0];if(t==="ja")return"'Revise Noto JP'";if(t==="ko")return"'Revise N\
|
|
111
|
-
oto KR'";if(t==="zh")return"'Revise Noto SC'"}function io(e){if(e.includes("Revise Noto"))return e;const t=e.split(","),n=t.at(-1)?.trim();return n&&Ce.has(D(n).toLowerCase())?`${t.slice(0,-1).join(",")}\
|
|
112
|
-
, ${nn}, ${n}`:`${e}, ${nn}`}let nt={};function rn(e){!e||Object.keys(e).length===0||(nt={...nt,...e},tt.clear())}function ao(e){const t=nt[e.toLowerCase()];if(!t)return;const n=[et(e)];if(t.alt&&t.alt.
|
|
113
|
-
toLowerCase()!==e.toLowerCase()){const r=tn[t.alt.toLowerCase()];n.push(r??et(t.alt))}return n.push(t.generic??Ze(e)),so(n.join(", "))}function so(e){const t=e.split(",").map(a=>a.trim()).filter(Boolean),
|
|
114
|
-
n=t.filter(a=>Ce.has(D(a).toLowerCase())),r=t.filter(a=>!Ce.has(D(a).toLowerCase())),i=new Set,s=r.filter(a=>{const c=D(a).toLowerCase();return i.has(c)?!1:(i.add(c),!0)}),o=n.at(-1);return o?[...s,o].
|
|
115
|
-
join(", "):s.join(", ")}function co(e){const t=tt.get(e);if(t!==void 0)return t;let n;if(e.includes(","))n=e;else{const r=D(e);n=tn[r.toLowerCase()]??ao(r)??`${et(r)}, ${Ze(r)}`}return n=io(n),tt.set(
|
|
116
|
-
e,n),n}const Ce=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),on="mmmmmmmmmmlliWQ@#0123456789",an=72;let Q;function lo(){
|
|
117
|
-
if(Q!==void 0)return Q;if(typeof document>"u")return Q=null,null;try{const e=document.createElement("canvas");e.width=4,e.height=4,Q=e.getContext("2d")}catch{Q=null}return Q??null}const sn=new Map;function uo(e){
|
|
118
|
-
const t=D(e.split(",")[0]);if(!t)return!1;if(Ce.has(t.toLowerCase()))return!0;const n=t.toLowerCase(),r=sn.get(n);if(r!==void 0)return r;const i=lo();if(!i)return!1;let s=!1;try{for(const o of["monosp\
|
|
119
|
-
ace","sans-serif","serif"]){i.font=`${an}px ${o}`;const a=i.measureText(on).width;i.font=`${an}px '${t}', ${o}`;const c=i.measureText(on).width;if(a>0&&Math.abs(c-a)>.5){s=!0;break}}}catch{s=!1}return sn.
|
|
120
|
-
set(n,s),s}function fo(){return typeof window<"u"&&"queryLocalFonts"in window}let de=null;async function go(){if(de)return de;const e=await window.queryLocalFonts();return de=e,e}async function po(){if(!fo())
|
|
121
|
-
return"denied";try{return(await navigator.permissions.query({name:"local-fonts"})).state}catch{return"prompt"}}async function mo(){return de?!0:await po()==="granted"}async function ho(){return de||(await mo()?
|
|
122
|
-
await go():null)}function bo(e){if(e.length<4)return"unknown";const t=String.fromCharCode(e[0],e[1],e[2],e[3]);return t==="OTTO"?"otf":t==="ttcf"?"ttc":t==="true"||e[0]===0&&e[1]===1&&e[2]===0&&e[3]===
|
|
123
|
-
0?"ttf":"unknown"}function yo(e){const t=(e??"").toLowerCase();return{bold:t.includes("bold")||t.includes("black")||t.includes("heavy"),italic:t.includes("italic")||t.includes("oblique")}}const xo=new Set(
|
|
124
|
-
Qe.map(e=>D(e.cssValue.split(",")[0]).toLowerCase()));function wo(e){const t=new Map,n=i=>{const s=i.marks?.fontFamily;if(!s)return;const o=D(s.split(",")[0]);if(!o)return;const a=o.toLowerCase();t.has(
|
|
125
|
-
a)||t.set(a,{value:s,family:o,available:uo(o),builtin:xo.has(a)})},r=i=>{if(!(!i||typeof i!="object")){if(i.type==="text"){n(i);return}if(Array.isArray(i.children))for(const s of i.children)r(s)}};for(const i of e.
|
|
126
|
-
children)r(i);for(const i of e.chrome??[])r(i);for(const i of e.notes??[])r(i);return Array.from(t.values())}const Te=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","al\
|
|
127
|
-
lCaps","hidden","superscript","subscript"],ko=new Set(["color","highlight"]);function So(e){return Te.filter(t=>e[t]===!1)}function cn(e){const t=Array.from(new Set((e??"").split(",").map(n=>n.trim()).
|
|
128
|
-
filter(n=>ko.has(n)))).sort();return t.length>0?t.join(","):void 0}function vo(e,t,n){const r=new Set((t??"").split(",").map(s=>s.trim()).filter(Boolean));for(const s of Te)r.has(s)&&(e[s]=!1);const i=cn(
|
|
129
|
-
n);i&&(e.docxRunPropertyResets=i)}const fe="Arial, sans-serif",Po=new Set(Te);function rt(e){const t=ln(e);for(const n of Po)e?.[n]===!1&&(t[n]=!1);return t}function ln(e){const t={};for(const[n,r]of Object.
|
|
130
|
-
entries(e??{}))r===!0?t[n]=!0:(typeof r=="string"&&r!==""||typeof r=="number")&&(t[n]=r);return t.fontFamily||(t.fontFamily=fe),t}function Ao(e){const t=e;return JSON.stringify(Object.keys(t).sort().map(
|
|
131
|
-
n=>[n,t[n]]))}function un(e){const t=[];let n=null;for(const r of e){const i=Ao(r.marks??{}),s=t[t.length-1];if(s&&i===n){t[t.length-1]={...s,text:s.text+r.text};continue}t.push(r),n=i}return t}const No=72/
|
|
132
|
-
96,Io={paddingPx:16,borderColor:"#cccccc",borderWidthPx:1},Mo={cellPaddingPx:8,borderColor:"#cccccc",borderWidthPx:1},Fo={maxIndentLevel:2,sublistIndentPx:20,markerWidthPx:20,variantIndentPx:{todo:35,
|
|
133
|
-
ordered:30,unordered:25},todoCheckboxSizePx:16,todoCheckboxRadiusPx:3,todoCheckboxOffsetPx:4},Co={fontSizePx:14,lineHeightMultiplier:1.5,paddingPx:12,borderRadiusPx:4,diagramMinHeightPx:120,diagramSourceGapPx:10},
|
|
134
|
-
To={gutterPx:26,verticalPaddingPx:4,blockSpacingPx:2,separatorSpacePx:18,inlineEndnoteGapPx:10,separatorToContentPx:12,newPageSeparatorOffsetPx:6,minimumBodyLinesBeforeFootnotes:2,bodyKeepSlackPx:6,separatorWidthMinPx:96,
|
|
135
|
-
separatorWidthFraction:.3},W={paddingYPx:10,levelIndentPx:24,pageNumberGapPx:6,labelClipGapPx:12,leaderStartGapPx:4,minimumLeaderWidthPx:8},Ro={displayHeightPx:20,indicatorInsetXPx:0,indicatorWidthPx:36,
|
|
136
|
-
caretOffsetXPx:12,iconInsetXPx:2,iconInsetYPx:2},Oo={blockInsertMarkerMarginXPx:16,blockInsertMarkerOffsetYPx:13,blockInsertMarkerArmPx:4,blockInsertMarkerLineWidthPx:2,breakTintOpacity:.12,breakIconOpacity:.55,
|
|
137
|
-
tocTintOpacity:.08,placeholderTintOpacity:.25,tableTintOpacity:{insert:.08,delete:.06},tableRowTintOpacity:{insert:.2,delete:.15},tableRowRailOpacity:.8,tableCellRailWidthPx:2,pendingBreakLabelFontSizePx:10,
|
|
138
|
-
pendingBreakRuleStartPx:24,pendingBreakLabelGapPx:8,pendingBreakDashPx:3,pendingBreakRuleOpacity:.65,pendingBreakLabelOpacity:.9};let Z=null,ot=null;function dn(){return Z?Promise.resolve(Z):(ot||(ot=
|
|
139
|
-
import("./ColorParserFull-BKH72fK8.js").then(e=>(Z=e.parseCssColorFull,Z))),ot)}const jo=/\b(?:hwb|lab|lch|oklab|oklch|color|color-mix|device-cmyk|calc|var)\s*\(|\b(?:rgba?|hsla?)\s*\([^)]*(?:%|deg|rad|grad|turn|none)/i;
|
|
140
|
-
function Lo(e){return jo.test(e)}const Eo=Object.fromEntries("aliceblue:f0f8ff,antiquewhite:faebd7,aqua:00ffff,aquamarine:7fffd4,azure:f0ffff,beige:f5f5dc,bisque:ffe4c4,black:000000,blanchedalmond:ffe\
|
|
141
|
-
bcd,blue:0000ff,blueviolet:8a2be2,brown:a52a2a,burlywood:deb887,cadetblue:5f9ea0,chartreuse:7fff00,chocolate:d2691e,coral:ff7f50,cornflowerblue:6495ed,cornsilk:fff8dc,crimson:dc143c,cyan:00ffff,darkbl\
|
|
142
|
-
ue:00008b,darkcyan:008b8b,darkgoldenrod:b8860b,darkgray:a9a9a9,darkgreen:006400,darkgrey:a9a9a9,darkkhaki:bdb76b,darkmagenta:8b008b,darkolivegreen:556b2f,darkorange:ff8c00,darkorchid:9932cc,darkred:8b\
|
|
143
|
-
0000,darksalmon:e9967a,darkseagreen:8fbc8f,darkslateblue:483d8b,darkslategray:2f4f4f,darkslategrey:2f4f4f,darkturquoise:00ced1,darkviolet:9400d3,deeppink:ff1493,deepskyblue:00bfff,dimgray:696969,dimgr\
|
|
144
|
-
ey:696969,dodgerblue:1e90ff,firebrick:b22222,floralwhite:fffaf0,forestgreen:228b22,fuchsia:ff00ff,gainsboro:dcdcdc,ghostwhite:f8f8ff,gold:ffd700,goldenrod:daa520,gray:808080,green:008000,greenyellow:a\
|
|
145
|
-
dff2f,grey:808080,honeydew:f0fff0,hotpink:ff69b4,indianred:cd5c5c,indigo:4b0082,ivory:fffff0,khaki:f0e68c,lavender:e6e6fa,lavenderblush:fff0f5,lawngreen:7cfc00,lemonchiffon:fffacd,lightblue:add8e6,lig\
|
|
146
|
-
htcoral:f08080,lightcyan:e0ffff,lightgoldenrodyellow:fafad2,lightgray:d3d3d3,lightgreen:90ee90,lightgrey:d3d3d3,lightpink:ffb6c1,lightsalmon:ffa07a,lightseagreen:20b2aa,lightskyblue:87cefa,lightslateg\
|
|
147
|
-
ray:778899,lightslategrey:778899,lightsteelblue:b0c4de,lightyellow:ffffe0,lime:00ff00,limegreen:32cd32,linen:faf0e6,magenta:ff00ff,maroon:800000,mediumaquamarine:66cdaa,mediumblue:0000cd,mediumorchid:\
|
|
148
|
-
ba55d3,mediumpurple:9370db,mediumseagreen:3cb371,mediumslateblue:7b68ee,mediumspringgreen:00fa9a,mediumturquoise:48d1cc,mediumvioletred:c71585,midnightblue:191970,mintcream:f5fffa,mistyrose:ffe4e1,moc\
|
|
149
|
-
casin:ffe4b5,navajowhite:ffdead,navy:000080,oldlace:fdf5e6,olive:808000,olivedrab:6b8e23,orange:ffa500,orangered:ff4500,orchid:da70d6,palegoldenrod:eee8aa,palegreen:98fb98,paleturquoise:afeeee,palevio\
|
|
150
|
-
letred:db7093,papayawhip:ffefd5,peachpuff:ffdab9,peru:cd853f,pink:ffc0cb,plum:dda0dd,powderblue:b0e0e6,purple:800080,rebeccapurple:663399,red:ff0000,rosybrown:bc8f8f,royalblue:4169e1,saddlebrown:8b451\
|
|
151
|
-
3,salmon:fa8072,sandybrown:f4a460,seagreen:2e8b57,seashell:fff5ee,sienna:a0522d,silver:c0c0c0,skyblue:87ceeb,slateblue:6a5acd,slategray:708090,slategrey:708090,snow:fffafa,springgreen:00ff7f,steelblue\
|
|
152
|
-
:4682b4,tan:d2b48c,teal:008080,thistle:d8bfd8,tomato:ff6347,turquoise:40e0d0,violet:ee82ee,wheat:f5deb3,white:ffffff,whitesmoke:f5f5f5,yellow:ffff00,yellowgreen:9acd32".split(",").map(e=>e.split(":"))),
|
|
153
|
-
A="(-?\\d+(?:\\.\\d+)?|-?\\.\\d+)",Bo=new RegExp(`^rgba?\\(\\s*${A}\\s*,\\s*${A}\\s*,\\s*${A}\\s*(?:,\\s*${A}\\s*)?\\)$`,"i"),Xo=new RegExp(`^rgba?\\(\\s*${A}\\s+${A}\\s+${A}\\s*(?:\\/\\s*${A}\\s*)?\\)$`,
|
|
154
|
-
"i"),$o=new RegExp(`^hsla?\\(\\s*${A}\\s*,\\s*${A}%\\s*,\\s*${A}%\\s*(?:,\\s*${A}\\s*)?\\)$`,"i"),zo=new RegExp(`^hsla?\\(\\s*${A}\\s+${A}%\\s+${A}%\\s*(?:\\/\\s*${A}\\s*)?\\)$`,"i"),it=e=>Math.max(0,
|
|
155
|
-
Math.min(255,Math.round(e))),Re=e=>Math.max(0,Math.min(1,e));function fn(e){const t=e.length;if(t!==3&&t!==4&&t!==6&&t!==8||!/^[0-9a-f]+$/i.test(e))return null;const n=t<=4?e.split("").map(a=>a+a).join(
|
|
156
|
-
""):e,r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16),o=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{r,g:i,b:s,a:o}}function Go(e){if(e[0]==="#")return fn(e.
|
|
157
|
-
slice(1));const t=e.toLowerCase();if(t==="transparent")return{r:0,g:0,b:0,a:0};const n=Eo[t];if(n)return fn(n);if(/^[a-z]+$/.test(t))return null;let r=t.match(Bo)??t.match(Xo);if(r)return{r:it(Number(
|
|
158
|
-
r[1])),g:it(Number(r[2])),b:it(Number(r[3])),a:r[4]===void 0?1:Re(Number(r[4]))};if(r=t.match($o)??t.match(zo),r){const i=(Number(r[1])%360+360)%360/360;return{...st(i,Re(Number(r[2])/100),Re(Number(r[3])/
|
|
159
|
-
100)),a:r[4]===void 0?1:Re(Number(r[4]))}}}function ge(e){const t=e.trim();if(!t)return null;const n=Go(t);return n!==void 0?n:Z?Z(t):(dn(),null)}function pe(e){const t=ge(e);return t?{r:t.r,g:t.g,b:t.
|
|
160
|
-
b}:null}function at({r:e,g:t,b:n}){const r=e/255,i=t/255,s=n/255,o=Math.max(r,i,s),a=Math.min(r,i,s),c=(o+a)/2;if(o===a)return{h:0,s:0,l:c};const l=o-a,d=c>.5?l/(2-o-a):l/(o+a);let u;return o===r?u=((i-
|
|
161
|
-
s)/l+(i<s?6:0))/6:o===i?u=((s-r)/l+2)/6:u=((r-i)/l+4)/6,{h:u,s:d,l:c}}function st(e,t,n){if(t===0){const o=Math.round(n*255);return{r:o,g:o,b:o}}const r=(o,a,c)=>(c<0&&(c+=1),c>1&&(c-=1),c<1/6?o+(a-o)*
|
|
162
|
-
6*c:c<1/2?a:c<2/3?o+(a-o)*(2/3-c)*6:o),i=n<.5?n*(1+t):n+t-n*t,s=2*n-i;return{r:Math.round(r(s,i,e+1/3)*255),g:Math.round(r(s,i,e)*255),b:Math.round(r(s,i,e-1/3)*255)}}function ct({r:e,g:t,b:n}){const r=i=>i.
|
|
163
|
-
toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function lt(e){if(!e)return;const t=ge(e);return t&&t.a>0?ct(t):void 0}const Do=.08,Wo=.2,_o=.85;function ut(e){const t=pe(e);if(!t)return!0;
|
|
164
|
-
const{s:n,l:r}=at(t);return n<=Do&&(r<=Wo||r>=_o)}const gn=.3,Uo=.8,pn=new Map;function mn(e,t){const n=`${e}|${t?1:0}`,r=pn.get(n);if(r!==void 0)return r;const i=Ho(e,t);return pn.set(n,i),i}function Ho(e,t){
|
|
165
|
-
const n=pe(e);if(!n||ut(e))return null;if(!t)return e;const{h:r,s:i,l:s}=at(n),o=1-s,a=gn+o*(Uo-gn);return ct(st(r,i,a))}function qo({r:e,g:t,b:n}){const r=i=>{const s=i/255;return s<=.03928?s/12.92:((s+
|
|
166
|
-
.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function hn(e,t){if(!t)return;const n=ge(t);if(!(!n||n.a<.5))return e&&pe(e)?e:qo(n)>.179?"#000000":"#ffffff"}const Vo=Object.freeze(Object.defineProperty(
|
|
167
|
-
{__proto__:null,cssNeedsFullColorParser:Lo,hslToRgb:st,isEffectivelyDefaultInk:ut,loadFullColorParser:dn,normalizeTextColor:lt,parseCssColor:pe,parseCssColorWithAlpha:ge,resolveTextColorOnFill:hn,resolveThemedTextColor:mn,
|
|
168
|
-
rgbToHex:ct,rgbToHsl:at},Symbol.toStringTag,{value:"Module"})),dt=3,ft=6,gt=96;function bn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=ft&&e<=gt}function Jo(e){const t={};if(!e)return t;const n=e.
|
|
169
|
-
match(/font-family:\s*([^;]+)/i);n&&(t.fontFamily=n[1].trim());const r=e.match(/font-size:\s*(\d+(?:\.\d+)?)px/i);if(r){const o=parseFloat(r[1]);bn(o)&&(t.fontSize=o)}const i=e.match(/(?:^|;)\s*color\s*:\s*([^;]+)/i),
|
|
170
|
-
s=i?lt(i[1].trim()):null;return s&&(t.color=s),t}function Ko(e){const t=e.style,n=t?.direction||e.getAttribute("dir"),r=t?.textAlign,i={};return(n==="rtl"||n==="ltr")&&(i.direction=n),(r==="left"||r===
|
|
171
|
-
"right"||r==="center"||r==="justify")&&(i.align=r),r==="start"&&(i.align=n==="rtl"?"right":"left"),r==="end"&&(i.align=n==="rtl"?"left":"right"),i}function Yo(e,t,n,r,i,s,o=1){const a=e.direction==="r\
|
|
172
|
-
tl",c=e.align&&e.align!=="justify"?e.align:a?"right":"left",l=n+r,d=(t.level-1)*W.levelIndentPx*o,u=s(i),g=a?n:l-u,p=i?(W.pageNumberGapPx+W.labelClipGapPx)*o:0,f=a?n+u+p:n+d,h=a?l-d:l-u-p,b=Math.max(h-
|
|
173
|
-
f,0);let x=t.text;if(s(x)>b){const R=Array.from(x);for(;R.length&&s(R.join("")+"…")>b;)R.pop();x=s("…")<=b?R.join("")+"…":""}const y=s(x),v=c==="right"?h:c==="center"?(f+h)/2:f,F=c==="right"?v-y:
|
|
174
|
-
c==="center"?v-y/2:v,U=a?g+u+W.pageNumberGapPx*o:F+y+W.leaderStartGapPx*o,X=a?F-W.leaderStartGapPx*o:g-W.pageNumberGapPx*o;return{text:x,textX:v,align:c,numberX:g,leaderStart:U,leaderEnd:X,rtl:a}}function Qo(e){
|
|
175
|
-
return`TOC \\o "1-${e}" \\h \\z \\u`}function yn(e){const t=e?.match(/\\o\s+"?(\d)\s*-\s*(\d)"?/);if(!t)return dt;const n=parseInt(t[2],10);return Number.isFinite(n)?Math.min(Math.max(n,1),6):dt}function xn(e){
|
|
176
|
-
return typeof e.levels=="number"&&Number.isFinite(e.levels)?Math.min(Math.max(Math.round(e.levels),1),6):e.instr?yn(e.instr):dt}function Zo(e){return e.instr??Qo(xn(e))}function ei(e,t){const n=[];if(!e)
|
|
177
|
-
return n;const r=i=>{for(const s of i)if(s.type==="paragraph"){const o=s.heading;if(typeof o=="number"&&o>=1&&o<=t){const a=s.children.map(c=>c.type==="text"?c.text:"").join("").trim();a.length>0&&s.id&&
|
|
178
|
-
n.push({blockId:s.id,text:a,level:o})}}else if(s.type==="container")r(s.children);else if(s.type==="table")for(const o of s.children)for(const a of o.children)r(a.children)};return r(e.children),n}const C=96,
|
|
179
|
-
ti=1,ni=ti*C,ri="'Source Code Pro', Consolas, Monaco, 'Courier New', monospace",oi=.5,j=C*oi,wn=1,ii=1,ai=/^(-?\d+(?:\.\d+)?)(px|pt|in|cm|mm)?$/i;function si(e){return typeof e!="number"||!Number.isFinite(
|
|
180
|
-
e)?0:Math.max(0,e)}function pt(e){return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.round(e))}function mt(e){if(typeof e!="number"||!Number.isFinite(e))return 0;const t=Math.round(e);return t<
|
|
181
|
-
0?-1:t>0?1:0}function Oe(e){const t=pt(e);return t>0?t:void 0}function je(e){const t=mt(e);return t===0?void 0:t}function ci(e){return pt(e.leftIndent)}function li(e){return mt(e.firstLineIndent)}function kn(e,t=j){
|
|
182
|
-
return bt(ci(e),t)}function Sn(e,t=j){const n=li(e);return Math.sign(n)*bt(Math.abs(n),t)}function ht(e,t,n=j){const r=kn(e,n),i=Sn(e,n);return r+(t===0?i:0)}function ui(e,t,n,r=j){return n==="rtl"?0:
|
|
183
|
-
ht(e,t,r)}function di(e,t,n,r=j){return Math.max(ii,e-ht(t,n,r))}function vn(e,t=j){return!Number.isFinite(t)||t<=0?0:Math.max(0,Math.round(si(e)/t))}function bt(e,t=j){return!Number.isFinite(t)||t<=0?
|
|
184
|
-
0:Math.max(0,Math.round(e))*t}function ee(e,t){const n=t?.indentStepPx??j;if(t?.firstLine){const i=t?.storedAsUnits?mt(e):e&&e<0?-1:vn(e,n)>0?wn:0;return i===0?void 0:i}const r=t?.storedAsUnits?pt(e):
|
|
185
|
-
vn(e,n);return r>0?r:void 0}function fi(e){if(!e)return;const t=e.trim().match(ai);if(!t)return;const n=Number.parseFloat(t[1]);if(!Number.isFinite(n))return;const r=(t[2]||"px").toLowerCase(),i={px:1,
|
|
186
|
-
pt:C/72,in:C,cm:C/2.54,mm:C/25.4};return n*i[r]}function gi(e,t){const n=fi(e);if(n!==void 0)return n===0?0:t?.firstLine?n<0?-1:wn:ee(n,{indentStepPx:t?.indentStepPx,storedAsUnits:!1,firstLine:t?.firstLine})}
|
|
187
|
-
function Pn(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function yt(e){return e instanceof w.XmlElement||Pn(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute==
|
|
188
|
-
"function"}function pi(e){return e instanceof w.XmlText||Pn(e,"YXmlText")&&typeof e.toDelta=="function"}const mi="Arial, sans-serif",T=[{attr:"structuralSuggestionId",kind:"string"},{attr:"structuralS\
|
|
189
|
-
uggestionKind",kind:"enum",enum:["insert","delete","split","merge","change"]},{attr:"structuralSuggestionRole",kind:"enum",enum:["before","after"]},{attr:"structuralSuggestionLabel",kind:"string"},{attr:"\
|
|
190
|
-
structuralSuggestionRecord",kind:"string"},{attr:"structuralSuggestionRecords",kind:"string"}],I=[{attr:"diffState",kind:"enum",enum:["insert","delete","equal"]},{attr:"suggestionId",kind:"string"}];function hi(e){
|
|
191
|
-
return(_[e]?.attrs??[]).map(t=>t.attr)}const bi=[...T.map(e=>e.attr),...I.map(e=>e.attr)],_=Object.fromEntries([{type:"paragraph",attrs:[{attr:"heading",kind:"int"},{attr:"align",kind:"string"},{attr:"\
|
|
192
|
-
lineSpacing",kind:"float"},{attr:"spaceBefore",kind:"float"},{attr:"spaceAfter",kind:"float"},{attr:"contextualSpacing",kind:"boolean"},{attr:"styleId",kind:"string"},{attr:"direction",kind:"string"},
|
|
193
|
-
{attr:"tabStops",kind:"string"},{attr:"borders",kind:"string"},{attr:"shading",kind:"string"},{attr:"oxmlAttrs",kind:"string"},{attr:"oxmlPPr",kind:"string"},{attr:"leftIndent",kind:"float"},{attr:"fi\
|
|
194
|
-
rstLineIndent",kind:"float"},...T,...I],children:"text"},{type:"list",attrs:[{attr:"variant",kind:"string"},{attr:"startNumber",kind:"int"},{attr:"numberingChainId",kind:"string"},{attr:"numberingForm\
|
|
195
|
-
at",kind:"string"},...ae.map(e=>({attr:e,kind:"float"})),{attr:"contextualSpacing",kind:"boolean"},...T,...I],children:"list-items"},{type:"list-item",attrs:[...ae.map(e=>({attr:e,kind:"float"})),{attr:"\
|
|
196
|
-
checked",kind:"boolean"},{attr:"indentLevel",kind:"int",validate:e=>e>0},{attr:"direction",kind:"string"},...T],children:"text"},{type:"table",attrs:[{attr:"columnWidths",kind:"json"},{attr:"tableWidt\
|
|
197
|
-
h",kind:"int"},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"borderColor",kind:"string"},{attr:"borderWidth",kind:"int"},{attr:"borders",kind:"string"},{attr:"cellPadding",kind:"int"},
|
|
198
|
-
{attr:"hasHeader",kind:"booleanTrue"},{attr:"docxTablePropertyOverrides",kind:"string"},{attr:"oxmlTblPr",kind:"string"},...T,...I],children:"table-rows"},{type:"table-row",attrs:[{attr:"oxmlAttrs",kind:"\
|
|
199
|
-
string"},{attr:"oxmlTrPr",kind:"string"},...I,...T],children:"blocks"},{type:"table-cell",attrs:[{attr:"verticalAlign",kind:"string"},{attr:"backgroundColor",kind:"string"},{attr:"borders",kind:"strin\
|
|
200
|
-
g"},{attr:"padding",kind:"string"},{attr:"colSpan",kind:"int",validate:e=>e>1},{attr:"rowSpan",kind:"int",validate:e=>e>1},{attr:"oxmlTcPr",kind:"string"},...I,...T],children:"blocks"},{type:"containe\
|
|
201
|
-
r",attrs:[{attr:"borderColor",kind:"string"},{attr:"padding",kind:"int"},...T,...I],children:"blocks"},{type:"header-footer",attrs:[{attr:"side",kind:"enum",enum:["header","footer"]},{attr:"slot",kind:"\
|
|
202
|
-
enum",enum:["default","first","even"]},{attr:"sectionIndex",kind:"int",validate:e=>e>=0}],children:"blocks"},{type:"footnote",attrs:[{attr:"noteKind",kind:"enum",enum:["endnote"]},...T,...I],children:"\
|
|
203
|
-
blocks"},{type:"code",attrs:[{attr:"language",kind:"string"},{attr:"toolCallId",kind:"string"},{attr:"renderDiagram",kind:"boolean"},{attr:"showDiagramSource",kind:"boolean"},...I,...T],children:"rawt\
|
|
204
|
-
ext"},{type:"math",attrs:[{attr:"displayMode",kind:"enum",enum:["inline","block"]},{attr:"align",kind:"enum",enum:["left","center","right"]},{attr:"showDiagramSource",kind:"boolean"},...I,...T],children:"\
|
|
205
|
-
rawtext"},{type:"image",attrs:[{attr:"src",kind:"string"},{attr:"sourceUrl",kind:"string"},{attr:"width",kind:"int"},{attr:"height",kind:"int"},{attr:"alt",kind:"string"},{attr:"align",kind:"string"},
|
|
206
|
-
{attr:"uploading",kind:"boolean"},{attr:"tempId",kind:"string"},{attr:"originalFormat",kind:"enum",enum:["emf","wmf"]},{attr:"originalDataUrl",kind:"string"},{attr:"anchorXml",kind:"string"},...I,...T],
|
|
207
|
-
children:"none"},{type:"page-break",attrs:[...I],children:"none"},{type:"docx-raw",attrs:[{attr:"xml",kind:"string"},{attr:"tagName",kind:"string"},{attr:"detail",kind:"string"},{attr:"origin",kind:"e\
|
|
208
|
-
num",enum:["run","body"]},...T,...I],children:"none"},{type:"section-break",attrs:[{attr:"layout",kind:"json"},{attr:"breakType",kind:"enum",enum:["nextPage","continuous","evenPage","oddPage"]},...I],
|
|
209
|
-
children:"none"},{type:"toc",attrs:[{attr:"direction",kind:"enum",enum:["rtl","ltr"]},{attr:"align",kind:"enum",enum:["left","center","right","justify"]},{attr:"levels",kind:"int",validate:e=>e>=1&&e<=
|
|
210
|
-
6},{attr:"instr",kind:"string"},{attr:"fontFamily",kind:"string"},{attr:"fontSize",kind:"float",validate:e=>e>=ft&&e<=gt},{attr:"color",kind:"string"},...I],children:"none"},{type:"placeholder",attrs:[
|
|
211
|
-
{attr:"height",kind:"int"}],children:"none"}].map(e=>[e.type,e])),yi={image:{src:"",width:200,height:200},code:{content:""},math:{displayMode:"block"},placeholder:{height:100},list:{variant:"unordered"}};
|
|
212
|
-
function xi(e,t){if(!(t==null||t===""))switch(e.kind){case"string":return t;case"int":{const n=parseInt(t,10);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"float":{const n=parseFloat(
|
|
213
|
-
t);return Number.isNaN(n)||e.validate&&!e.validate(n)?void 0:n}case"boolean":return t==="true"?!0:t==="false"?!1:void 0;case"booleanTrue":return t==="true"?!0:void 0;case"json":try{return JSON.parse(t)}catch{
|
|
214
|
-
return}case"enum":return e.enum?.includes(t)?t:void 0}}function An(e,t){if(t==null)return null;switch(e.kind){case"string":case"enum":return typeof t=="string"&&t!==""?t:null;case"int":case"float":return typeof t==
|
|
215
|
-
"number"?String(t):null;case"boolean":return typeof t=="boolean"?String(t):null;case"booleanTrue":return t===!0?"true":null;case"json":return JSON.stringify(t)}}function wi(e){const t=[],n=ce(e);for(const r of n){
|
|
216
|
-
if(typeof r.insert!="string")continue;const i=r.attributes||{},s={type:"text",text:r.insert,marks:rt(i)};t.push(s)}return un(t)}function Nn(e){for(let t=0;t<e.length;t++){const n=e.get(t);if(pi(n))return n}
|
|
217
|
-
return null}function In(e){const t=K(e,"_emptyTextMarks");let n={fontFamily:mi};if(t)try{n=JSON.parse(t)}catch{}return[{type:"text",text:"",marks:n}]}function ki(e){const t=Nn(e);if(!t)return In(e);const n=wi(
|
|
218
|
-
t);return n.length>0?n:In(e)}function Si(e,t){for(const[n,r]of[["leftIndent",!1],["firstLineIndent",!0]])if(typeof e[n]=="number"){if(e[n]===0)continue;const i=ee(e[n],{indentStepPx:t.indentStepPx,storedAsUnits:t.
|
|
219
|
-
storedAsUnits,firstLine:r});i===void 0?delete e[n]:e[n]=i}}function me(e,t,n,r){const i=e.nodeName,s=_[i]??_.paragraph,o=_[i]?i:"paragraph",a={type:o,id:K(e,"id")||P()};for(const l of s.attrs){const d=xi(
|
|
220
|
-
l,K(e,l.attr));d!==void 0&&(a[l.field??l.attr]=d)}o==="paragraph"&&Fe(a,K(e,"pagination"));const c=yi[o];if(c)for(const[l,d]of Object.entries(c))a[l]===void 0&&(a[l]=d);switch(s.children){case"text":a.
|
|
221
|
-
children=ki(e);break;case"rawtext":{const l=Nn(e);a.content=l?l.toString():"";break}case"blocks":{const l=[];for(const d of e.toArray())if(yt(d)){const u=r?r(d):me(d,t);u&&l.push(u)}a.children=l;break}case"\
|
|
222
|
-
list-items":{const l=[];for(const d of e.toArray())if(yt(d)&&d.nodeName==="list-item"){const u=r?r(d):me(d,t);u&&l.push(u)}a.children=l;break}case"table-rows":{const l=[];for(const d of e.toArray())if(yt(
|
|
223
|
-
d)&&d.nodeName==="table-row"){const u=r?r(d):me(d,t);u&&l.push(u)}a.children=l,a.columnWidths===void 0&&(a.columnWidths=[]);break}}return(o==="paragraph"||s.children==="text")&&Si(a,t),a}function vi(e,t){
|
|
224
|
-
const n=new w.XmlText,r=new Set;for(const o of e){const a=o;if(a?.type==="text"&&a.marks)for(const c of Object.keys(a.marks))r.add(c)}let i=0;for(const o of e){const a=o;if(a?.type!=="text"||!a.text)continue;
|
|
225
|
-
const c=a.marks??{};if(t&&G(t)){n.insert(i,a.text,Ne(t,c)),i+=a.text.length;continue}le(n,i,a.text);for(const l of r)Ht(n,i,a.text.length,{[l]:l in c?c[l]:null});i+=a.text.length}let s=null;if(i===0){
|
|
226
|
-
const o=e.find(a=>a?.type==="text"&&a.text.length===0&&a.marks&&Object.keys(a.marks).length>0);o?.marks&&(s=o.marks)}return{yText:n,emptyMarks:s}}function Pi(e,t,n){const r=_[t.type];if(!r)return;let i={
|
|
227
|
-
id:String(t.id??P())};for(const s of r.attrs){const o=s.field??s.attr;let a=t[o];o==="leftIndent"&&typeof a=="number"?a=a===0?0:Oe(a):o==="firstLineIndent"&&typeof a=="number"&&(a=a===0?0:je(a));const c=An(
|
|
228
|
-
s,a);c!==null&&(i[s.attr]=c)}if(r.type==="paragraph"){const s=Me(t);s!==void 0&&(i.pagination=s)}t.type==="paragraph"&&n&&G(n)&&(i=Ir(n,i));for(const[s,o]of Object.entries(i))e.setAttribute(s,o)}function Ai(e,t){
|
|
229
|
-
const n=t,r=_[n.type];if(!r)return;const i=String(n.id??P());e.getAttribute("id")!==i&&e.setAttribute("id",i);for(const s of r.attrs){const o=s.field??s.attr;let a=n[o];o==="leftIndent"&&typeof a=="nu\
|
|
230
|
-
mber"?a=a===0?0:Oe(a):o==="firstLineIndent"&&typeof a=="number"&&(a=a===0?0:je(a));const c=An(s,a);if(c===null){const l=K(e,s.attr);l!==void 0&&l!==""&&Ye(e,s.attr)}else K(e,s.attr)!==c&&e.setAttribute(
|
|
231
|
-
s.attr,c)}if(r.type==="paragraph"){const s=Me(n);s===void 0?Ye(e,"pagination"):e.setAttribute("pagination",s)}}function Mn(e,t){const n=e.children;if(!Array.isArray(n))return e;const r=n.flatMap(i=>{if(i?.
|
|
232
|
-
type==="text"){const s=t(i);return Array.isArray(s)?s:[s]}return[Mn(i,t)]});return{...e,children:r}}function xt(e,t){const n=e,r=_[n.type]??_.paragraph,i=new w.XmlElement(r.type);Pi(i,n,t);let s=0;switch(r.
|
|
233
|
-
children){case"text":{const{yText:o,emptyMarks:a}=vi(n.children??[],t);i.insert(s++,[o]),a&&i.setAttribute("_emptyTextMarks",JSON.stringify(a));break}case"rawtext":{const o=new w.XmlText,a=typeof n.content==
|
|
234
|
-
"string"?n.content:"";a&&le(o,0,a),i.insert(s++,[o]);break}case"blocks":case"list-items":case"table-rows":{const o=n.children??[];for(const a of o)i.insert(s++,[xt(a,t)]);break}}return i}function he(e,t,n,r){
|
|
235
|
-
const i=s=>e.find(o=>o.type==="header-footer"&&o.side===t&&o.slot===n&&o.sectionIndex===s);if(r!==void 0){const s=i(r);if(s)return s}return i(void 0)}function Ni(e,t,n,r){if(n===1){const i=he(e,t,"fir\
|
|
236
|
-
st",r);if(i)return i}if(n%2===0){const i=he(e,t,"even",r);if(i)return i}return he(e,t,"default",r)}const be=[void 0,"center","right"];function Ii(e,t){const n=be[e];return{type:"paragraph",id:P(),children:[
|
|
237
|
-
{type:"text",text:"",...t?{marks:{fontFamily:t}}:{}}],...n?{align:n}:{}}}function Mi(e,t){if(!t)return e;let n=!1;const r=e.children.map(i=>i.type!=="text"||i.marks?.fontFamily?i:(n=!0,{...i,marks:{...i.
|
|
238
|
-
marks??{},fontFamily:t}}));return n?{...e,children:r}:e}function Fi(e,t){const n=be[t];return!n||e.align?e:{...e,align:n}}function Fn(e,t,n,r,i){const s=n??[],o=a=>s[a]?Mi(Fi(s[a],a),r):Ii(a,r);return{
|
|
239
|
-
type:"header-footer",id:P(),side:e,slot:t,...i!==void 0?{sectionIndex:i}:{},children:[o(0),o(1),o(2)]}}function Cn(e){return!!e?.children.some(t=>t.type==="text"&&t.text.trim()!=="")}function Ci(e){return e.
|
|
240
|
-
children.some(t=>Cn(t))}function Tn(e){const t=e.children,n=[2,1,0].find(i=>Cn(t[i]))??-1;if(n===-1)return;const r=[];for(let i=0;i<=n;i++){i>0&&r.push({type:"text",text:" "});for(const s of t[i]?.children??
|
|
241
|
-
[])s.type==="text"&&s.text&&r.push(s)}return{type:"paragraph",id:e.id?`${e.id}-zone`:P(),children:r}}function Rn(e){const t=[[],[],[]],n=e?.[0],r=!!n?.children.some(o=>o.type==="text"&&o.text.includes(
|
|
242
|
-
" "));let i=!r&&n?.align==="right"?2:!r&&n?.align==="center"?1:0;const s=n?.children??[];for(const o of s)o.type==="text"&&o.text.split(" ").forEach((a,c)=>{c>0&&i<2&&(i+=1),a&&t[i].push({type:"text",
|
|
243
|
-
text:a,...o.marks?{marks:{...o.marks}}:{}})});for(const o of e?.slice(1)??[])for(const a of o.children)a.type==="text"&&a.text&&t[0].push({...a});return t.map((o,a)=>({type:"paragraph",id:P(),children:o.
|
|
244
|
-
length>0?o:[{type:"text",text:""}],...be[a]?{align:be[a]}:{}}))}function On(e){const t={},n={};for(const r of e){if(r.type!=="header-footer"||r.sectionIndex!==void 0)continue;const i=Tn(r);if(!i)continue;
|
|
245
|
-
const s=r.side==="header"?t:n;s[r.slot]=[i]}return{...Object.keys(t).length>0?{headers:t}:{},...Object.keys(n).length>0?{footers:n}:{}}}function Ti(e,t){const n={},r={};for(const i of["header","footer"])
|
|
246
|
-
for(const s of["default","first","even"]){const o=he(e,i,s,t);if(!o)continue;const a=Tn(o);if(!a)continue;const c=i==="header"?n:r;c[s]=[a]}return{...Object.keys(n).length>0?{headers:n}:{},...Object.keys(
|
|
247
|
-
r).length>0?{footers:r}:{}}}function Ri(e){return e.some(t=>t.type==="header-footer"&&t.sectionIndex!==void 0)}function wt(e,t,n){const r=[];for(const[i,s]of[["header",e],["footer",t]])if(s)for(const o of[
|
|
248
|
-
"default","first","even"]){const a=s[o];!a||a.length===0||r.push(Fn(i,o,Rn(a),n))}return r}function Oi(e){for(const t of e)if(!(t.type==="header-footer"||t.type==="footnote")){if(t.type==="paragraph"){
|
|
249
|
-
for(const n of t.children)if(n.type==="text"&&n.marks?.fontFamily)return n.marks.fontFamily}else if(t.type==="list"){for(const n of t.children)for(const r of n.children)if(r.type==="text"&&r.marks?.fontFamily)
|
|
250
|
-
return r.marks.fontFamily}}}function ji(e,t){const n=[...e.chrome??[],...e.children.filter(r=>r.type==="header-footer")];for(const r of n){if(r.id===t)return{block:r,columnIndex:0};const i=r.children.
|
|
251
|
-
findIndex(s=>s.id===t);if(i!==-1)return{block:r,columnIndex:i}}return null}const jn=["decimal","lowerRoman","upperRoman"],Li=3999,Ei=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,
|
|
252
|
-
"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function kt(e){return typeof e=="string"&&jn.includes(e)}function Bi(e){let t=e,n="";for(const[r,i]of Ei)for(;t>=r;)n+=i,t-=r;return n}function Ln(e,t="\
|
|
253
|
-
decimal"){if(!Number.isFinite(e))return"";const n=Math.round(e);if((t==="lowerRoman"||t==="upperRoman")&&n>=1&&n<=Li){const r=Bi(n);return t==="lowerRoman"?r.toLowerCase():r}return String(n)}const St=[
|
|
254
|
-
"top","right","bottom","left"],Xi=["single","double","dotted","dashed"];function te(e){if(e===null||e==="")return null;if(e===void 0)return;if(typeof e=="string")try{e=JSON.parse(e)}catch{return}if(!e||
|
|
255
|
-
typeof e!="object"||Array.isArray(e))return;const t=e,n={offsetFrom:t.offsetFrom==="page"?"page":"text",display:t.display==="firstPage"||t.display==="notFirstPage"?t.display:"allPages",zOrder:t.zOrder===
|
|
256
|
-
"back"?"back":"front"};for(const r of St){const i=t[r];if(i!=null){if(!Xi.includes(i.style)||typeof i.color!="string"||!/^#[0-9a-f]{6}$/i.test(i.color)||typeof i.widthPt!="number"||!Number.isFinite(i.
|
|
257
|
-
widthPt)||i.widthPt<.25||i.widthPt>12||typeof i.spacePt!="number"||!Number.isFinite(i.spacePt)||i.spacePt<0||i.spacePt>31)return;n[r]={style:i.style,color:i.color.toLowerCase(),widthPt:i.widthPt,spacePt:i.
|
|
258
|
-
spacePt}}}return n}function $i(e){const t=te(e);return t===void 0?void 0:t===null?"":JSON.stringify(t)}function zi(e,t,n,r,i){if(!e||e.display==="firstPage"&&!i||e.display==="notFirstPage"&&i)return[];
|
|
259
|
-
const s=u=>{const g=e[u]?.spacePt??0,p=(e[u]?.widthPt??0)/2;return e.offsetFrom==="page"?g+p:r[u]-g-p},o=Math.max(0,s("left")),a=Math.min(t,t-s("right")),c=Math.max(0,s("top")),l=Math.min(n,n-s("botto\
|
|
260
|
-
m")),d={top:[o,c,a,c],right:[a,c,a,l],bottom:[o,l,a,l],left:[o,c,o,l]};return St.flatMap(u=>{const g=e[u];if(!g)return[];const[p,f,h,b]=d[u];return[{...g,x1:p,y1:f,x2:h,y2:b}]})}function Gi(e){if(!e)return;
|
|
261
|
-
const t={offsetFrom:e.getAttribute("w:offsetFrom")==="page"?"page":"text",display:e.getAttribute("w:display")||"allPages",zOrder:e.getAttribute("w:zOrder")==="back"?"back":"front"};for(const n of St){
|
|
262
|
-
const r=Array.from(e.children).find(o=>o.localName===n);if(!r)continue;const i=r.getAttribute("w:val");if(i==="none"||i==="nil")continue;if(r.hasAttribute("w:themeColor")||["1","true","on"].includes(r.
|
|
263
|
-
getAttribute("w:shadow")??"")||["1","true","on"].includes(r.getAttribute("w:frame")??"")||Array.from(r.attributes).some(o=>o.namespaceURI==="http://schemas.openxmlformats.org/officeDocument/2006/relat\
|
|
264
|
-
ionships"))return;const s=r.getAttribute("w:color")||"auto";t[n]={style:i,color:s==="auto"?"#000000":`#${s}`,widthPt:Number(r.getAttribute("w:sz")||8)/8,spacePt:Number(r.getAttribute("w:space")||0)}}return te(
|
|
265
|
-
t)??void 0}function En(e){const t=te(e?.pageBorders),n=e?.oxmlSectPr||"";if(t===void 0)return n||void 0;const r=n.replace(/<w:pgBorders\b[^>]*(?:\/>|>[\s\S]*?<\/w:pgBorders>)/g,"");if(t===null)return r||
|
|
266
|
-
void 0;const i=["top","left","bottom","right"].map(s=>{const o=t[s];return o?`<w:${s} w:val="${o.style}" w:color="${o.color.slice(1).toUpperCase()}" w:sz="${Math.round(o.widthPt*8)}" w:space="${Math.round(
|
|
267
|
-
o.spacePt)}"/>`:""}).join("");return`${r}<w:pgBorders w:offsetFrom="${t.offsetFrom}" w:display="${t.display}" w:zOrder="${t.zOrder}">${i}</w:pgBorders>`}function Di(e,t){const n=/<w:pgBorders\b/.test(
|
|
268
|
-
t?.oxmlSectPr??"");return En({pageBorders:t?.pageBorders!==void 0?t.pageBorders:n?void 0:e?.pageBorders,oxmlSectPr:t?.oxmlSectPr})}const ye=(e,t,n)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?
|
|
269
|
-
e:void 0;function vt(e){let t=e;if(typeof e=="string"){const n=e.trim();if(n==="")return null;try{t=JSON.parse(n)}catch{return null}}return!t||typeof t!="object"||Array.isArray(t)?null:t}function Bn(e){
|
|
270
|
-
const t=vt(e);if(!t)return null;const n=typeof t.countBy=="number"&&Number.isFinite(t.countBy)&&t.countBy>=1?Math.round(t.countBy):1,r=typeof t.start=="number"&&Number.isFinite(t.start)&&t.start>=1?Math.
|
|
271
|
-
round(t.start):1,i=t.restart==="newSection"||t.restart==="continuous"?t.restart:"newPage",s=typeof t.distancePx=="number"&&Number.isFinite(t.distancePx)&&t.distancePx>=0?t.distancePx:void 0;return{countBy:n,
|
|
272
|
-
start:r,restart:i,...s!==void 0?{distancePx:s}:{}}}function Pt(e){const t=vt(e);if(!t)return null;const n=ye(t.rows,1,200),r=ye(t.pitchPx,8,96);if(n===void 0||r===void 0)return null;const i=ye(t.firstBaselinePx,
|
|
273
|
-
0,2e3),s=ye(t.distancePx,0,400),o=typeof t.fontFamily=="string"&&t.fontFamily.trim()!==""&&t.fontFamily.length<=200?t.fontFamily.trim():void 0,a=ye(t.fontSizePx,4,96);return{rows:Math.round(n),pitchPx:r,
|
|
274
|
-
...i!==void 0?{firstBaselinePx:i}:{},...s!==void 0?{distancePx:s}:{},...o!==void 0?{fontFamily:o}:{},...a!==void 0?{fontSizePx:a}:{}}}function Wi(e){const t=vt(e);return t?Pt({rows:t.gridLines,pitchPx:t.
|
|
275
|
-
gridPitchPx,fontFamily:t.fontFamily}):null}function Xn(e){if(e)return JSON.stringify({rows:e.rows,pitchPx:e.pitchPx,...e.firstBaselinePx!==void 0?{firstBaselinePx:e.firstBaselinePx}:{},...e.distancePx!==
|
|
276
|
-
void 0?{distancePx:e.distancePx}:{},...e.fontFamily?{fontFamily:e.fontFamily}:{},...e.fontSizePx!==void 0?{fontSizePx:e.fontSizePx}:{}})}function $n(e){if(e)return JSON.stringify({countBy:e.countBy,start:e.
|
|
277
|
-
start,restart:e.restart,...e.distancePx!==void 0?{distancePx:e.distancePx}:{}})}const At=1,m={pageBorders:"pageBorders",pageSize:"pageSize",orientation:"pageOrientation",marginPx:"pageMarginPx",marginTopPx:"\
|
|
278
|
-
pageMarginTopPx",marginRightPx:"pageMarginRightPx",marginBottomPx:"pageMarginBottomPx",marginLeftPx:"pageMarginLeftPx",indentStepPx:"indentStepPx",blockSpacingPx:"blockSpacingPx",showPageNumbers:"show\
|
|
279
|
-
PageNumbers",pageNumberPosition:"pageNumberPosition",pageNumberStart:"pageNumberStart",pageNumberFormat:"pageNumberFormat",pageNumberRestart:"pageNumberRestart",paragraphIndentStorageVersion:"paragrap\
|
|
280
|
-
hIndentStorageVersion",hyphenationEnabled:"hyphenationEnabled",lineNumbering:"lineNumbering",pleadingGrid:"pleadingGrid",columnCount:"columnCount",columnGapTwips:"columnGapTwips",oxmlSectPr:"oxmlSectP\
|
|
281
|
-
r"},_i=["top-left","top-right","bottom-left","bottom-right"];function Nt(e){return typeof e=="string"&&_i.includes(e)}const Le={letter:{width:8.5,height:11},tabloid:{width:11,height:17},legal:{width:8.5,
|
|
282
|
-
height:14},statement:{width:5.5,height:8.5},executive:{width:7.25,height:10.5},folio:{width:8.5,height:13},a3:{width:11.6929,height:16.5354},a4:{width:8.2677,height:11.6929},a5:{width:5.8268,height:8.2677},
|
|
283
|
-
b4:{width:9.8425,height:13.8976},b5:{width:6.9291,height:9.8425}},Ui=["apa7"],Hi=2.54,qi=Object.entries(Le).map(([e,t])=>({pageSize:e,width:Math.min(t.width,t.height),height:Math.max(t.width,t.height)}));
|
|
284
|
-
function Vi(e){return typeof e=="string"&&Ui.includes(e)}function It(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(Le,e)}function Ji(e){if(typeof e=="number")return Number.isFinite(
|
|
285
|
-
e)?e:void 0;if(typeof e!="string")return;const t=e.trim().match(/^(-?(?:\d+(?:\.\d+)?|\.\d+))\s*(px|in|cm)?$/i);if(!t)return;const n=Number.parseFloat(t[1]);if(Number.isFinite(n))switch((t[2]??"px").toLowerCase()){case"\
|
|
286
|
-
px":return n;case"in":return Y(n);case"cm":return Y(n/Hi);default:return}}function Ki(e,t){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0)return;const n=e>t?"landscape":"portrait",r=Ee(Math.min(
|
|
287
|
-
e,t)),i=Ee(Math.max(e,t));let s=M.pageSize,o=Number.POSITIVE_INFINITY;for(const a of qi){const c=Math.abs(r-a.width)+Math.abs(i-a.height);c<o&&(o=c,s=a.pageSize)}return{pageSize:s,orientation:n}}const Yi=0,
|
|
288
|
-
Qi=3*C,Zi=.125*C,ea=2*C,ta=0,na=2*C,ra=12,zn=1,oa=99999,M={pageSize:"letter",orientation:"portrait",marginLeftPx:ni,indentStepPx:j,blockSpacingPx:ra,pageNumberPosition:"top-right",pageNumberStart:1,pageNumberFormat:"\
|
|
289
|
-
decimal",columnCount:1,columnGapTwips:720};function ne(e,t,n){return Math.max(t,Math.min(n,e))}function xe(e){return typeof e!="number"||!Number.isFinite(e)?M.marginLeftPx:ne(e,Yi,Qi)}function ia(e){return typeof e!=
|
|
290
|
-
"number"||!Number.isFinite(e)?M.indentStepPx:ne(e,Zi,ea)}function aa(e){return typeof e!="number"||!Number.isFinite(e)?M.blockSpacingPx:ne(e,ta,na)}function sa(e){return Nt(e)?e:M.pageNumberPosition}function ca(e){
|
|
291
|
-
return typeof e!="number"||!Number.isFinite(e)?M.pageNumberStart:ne(Math.round(e),zn,oa)}function la(e){return typeof e!="number"||!Number.isFinite(e)?M.columnCount:ne(Math.round(e),1,12)}function ua(e){
|
|
292
|
-
return typeof e!="number"||!Number.isFinite(e)?M.columnGapTwips:ne(Math.round(e),0,14400)}function B(e){const t=e?.pageSize&&It(e.pageSize)?e.pageSize:M.pageSize,n=e?.orientation==="landscape"||e?.orientation===
|
|
293
|
-
"portrait"?e.orientation:M.orientation,r=xe(e?.marginPx);return{pageSize:t,orientation:n,pageBorders:te(e?.pageBorders),marginTopPx:xe(e?.marginTopPx??r),marginRightPx:xe(e?.marginRightPx??r),marginBottomPx:xe(
|
|
294
|
-
e?.marginBottomPx??r),marginLeftPx:xe(e?.marginLeftPx??r),indentStepPx:ia(e?.indentStepPx),blockSpacingPx:aa(e?.blockSpacingPx),showPageNumbers:e?.showPageNumbers===!0,pageNumberPosition:sa(e?.pageNumberPosition),
|
|
295
|
-
pageNumberStart:ca(e?.pageNumberStart),pageNumberFormat:kt(e?.pageNumberFormat)?e.pageNumberFormat:M.pageNumberFormat,...e?.pageNumberRestart===!0?{pageNumberRestart:!0}:{},noteMode:e?.noteMode==="end\
|
|
296
|
-
notes"?"endnotes":"footnotes",columnCount:la(e?.columnCount),columnGapTwips:ua(e?.columnGapTwips),hyphenationEnabled:e?.hyphenationEnabled===!0,...(()=>{const i=e?.lineNumbering,s=e?.pleadingGrid,o=Wi(
|
|
297
|
-
i),a=s!==void 0?Pt(s):o;return{lineNumbering:o||a?null:Bn(i),pleadingGrid:a}})(),...(()=>{const i=e?.oxmlSectPr;return typeof i=="string"&&i?{oxmlSectPr:i}:{}})()}}function da(e){const t=Le[e.pageSize],
|
|
298
|
-
n=t.width*C,r=t.height*C;return e.orientation==="landscape"?{pageWidth:r,pageHeight:n}:{pageWidth:n,pageHeight:r}}function Ee(e){return Number.isFinite(e)?e/C:0}function Y(e){return Number.isFinite(e)?
|
|
299
|
-
e*C:0}const Be=1440,fa=72;function Gn(e){return Y(e/Be)}function ga(e){return Ee(e)*Be}function pa(e){return e/Be*fa}function ma(e){return e/Be}const ha=Gn(M.columnGapTwips),ba=[1,2,3];function ya(e){
|
|
300
|
-
return typeof e=="number"&&ba.includes(e)}function Dn(e,t){if(!t)return e??void 0;const n={...e??{}};for(const[r,i]of Object.entries(t))i!==void 0&&(n[r]=i);return t.pageBorders===void 0&&/<w:pgBorders\b/.
|
|
301
|
-
test(t.oxmlSectPr??"")&&delete n.pageBorders,n}function xa(e,t){return B(Dn(e,t))}function Wn(e,t){return Math.max(zn,e.pageNumberStart+t)}function wa(e,t){return Ln(Wn(e,t),e.pageNumberFormat)}function ka(e){
|
|
302
|
-
switch(e){case"apa7":return{pageLayout:B({pageSize:"letter",orientation:"portrait",marginTopPx:Y(1),marginRightPx:Y(1),marginBottomPx:Y(1),marginLeftPx:Y(1),indentStepPx:j,blockSpacingPx:0,showPageNumbers:!0,
|
|
303
|
-
pageNumberPosition:"top-right",pageNumberStart:1}),pageless:!1}}}function Sa(e){const t=e.startsWith("top"),n=e.endsWith("right");return{side:t?"headers":"footers",paragraph:{type:"paragraph",id:`pgnu\
|
|
304
|
-
m-${Math.random().toString(36).slice(2,8)}`,...n?{align:"right"}:{},children:[{type:"text",text:"1",marks:{field:"page"}}]}}}const va=[m.pageBorders,m.pageSize,m.orientation,m.marginTopPx,m.marginRightPx,
|
|
305
|
-
m.marginBottomPx,m.marginLeftPx,m.marginPx,m.indentStepPx,m.blockSpacingPx,m.showPageNumbers,m.pageNumberPosition,m.pageNumberStart,m.pageNumberFormat,m.pageNumberRestart,m.hyphenationEnabled,m.lineNumbering,
|
|
306
|
-
m.pleadingGrid,m.columnCount,m.columnGapTwips,m.oxmlSectPr];function Mt(e,t){if(e.set(m.paragraphIndentStorageVersion,At),!t)return;const n=B(t),r=$i(n.pageBorders);r!==void 0?e.set(m.pageBorders,r):e.
|
|
307
|
-
delete(m.pageBorders),e.set(m.pageSize,n.pageSize),e.set(m.orientation,n.orientation),e.set(m.marginTopPx,n.marginTopPx),e.set(m.marginRightPx,n.marginRightPx),e.set(m.marginBottomPx,n.marginBottomPx),
|
|
308
|
-
e.set(m.marginLeftPx,n.marginLeftPx),n.marginTopPx===n.marginRightPx&&n.marginTopPx===n.marginBottomPx&&n.marginTopPx===n.marginLeftPx?e.set(m.marginPx,n.marginTopPx):e.delete(m.marginPx),e.set(m.indentStepPx,
|
|
309
|
-
n.indentStepPx),e.set(m.blockSpacingPx,n.blockSpacingPx),e.set(m.showPageNumbers,n.showPageNumbers),e.set(m.pageNumberPosition,n.pageNumberPosition),e.set(m.pageNumberStart,n.pageNumberStart),n.pageNumberFormat!==
|
|
310
|
-
M.pageNumberFormat?e.set(m.pageNumberFormat,n.pageNumberFormat):e.delete(m.pageNumberFormat),n.pageNumberRestart===!0?e.set(m.pageNumberRestart,!0):e.delete(m.pageNumberRestart),n.hyphenationEnabled?e.
|
|
311
|
-
set(m.hyphenationEnabled,!0):e.delete(m.hyphenationEnabled);const i=$n(n.lineNumbering);i!==void 0?e.set(m.lineNumbering,i):e.delete(m.lineNumbering);const s=Xn(n.pleadingGrid);s!==void 0?e.set(m.pleadingGrid,
|
|
312
|
-
s):e.delete(m.pleadingGrid),n.columnCount!==M.columnCount?e.set(m.columnCount,n.columnCount):e.delete(m.columnCount),n.columnGapTwips!==M.columnGapTwips?e.set(m.columnGapTwips,n.columnGapTwips):e.delete(
|
|
313
|
-
m.columnGapTwips),n.oxmlSectPr?e.set(m.oxmlSectPr,n.oxmlSectPr):e.delete(m.oxmlSectPr)}function Xe(e){if(!va.some(F=>e.has(F)))return;const t=e.get(m.pageSize),n=e.get(m.orientation),r=e.get(m.marginTopPx),
|
|
314
|
-
i=e.get(m.marginRightPx),s=e.get(m.marginBottomPx),o=e.get(m.marginLeftPx),a=e.get(m.marginPx),c=e.get(m.indentStepPx),l=e.get(m.blockSpacingPx),d=e.get(m.showPageNumbers),u=e.get(m.pageNumberPosition),
|
|
315
|
-
g=e.get(m.pageNumberStart),p=e.get(m.hyphenationEnabled),f=e.get(m.lineNumbering),h=e.get(m.pleadingGrid),b=e.get(m.columnCount),x=e.get(m.columnGapTwips),y=e.get(m.oxmlSectPr),v=It(t)?t:void 0;return B(
|
|
316
|
-
{pageSize:v,orientation:n==="portrait"||n==="landscape"?n:void 0,marginTopPx:typeof r=="number"?r:void 0,marginRightPx:typeof i=="number"?i:void 0,marginBottomPx:typeof s=="number"?s:void 0,marginLeftPx:typeof o==
|
|
317
|
-
"number"?o:void 0,marginPx:typeof a=="number"?a:void 0,indentStepPx:typeof c=="number"?c:void 0,blockSpacingPx:typeof l=="number"?l:void 0,showPageNumbers:typeof d=="boolean"?d:void 0,pageNumberPosition:Nt(
|
|
318
|
-
u)?u:void 0,pageNumberStart:typeof g=="number"?g:void 0,pageNumberFormat:kt(e.get(m.pageNumberFormat))?e.get(m.pageNumberFormat):void 0,pageNumberRestart:e.get(m.pageNumberRestart)===!0?!0:void 0,hyphenationEnabled:typeof p==
|
|
319
|
-
"boolean"?p:void 0,pageBorders:te(e.get(m.pageBorders)),lineNumbering:typeof f=="string"?f:void 0,pleadingGrid:typeof h=="string"?h:void 0,columnCount:typeof b=="number"?b:void 0,columnGapTwips:typeof x==
|
|
320
|
-
"number"?x:void 0,oxmlSectPr:typeof y=="string"&&y?y:void 0})}function _n(e,t){for(const[n,r]of e.afterState){const i=e.beforeState.get(n)??0;if(i>=r)continue;const s=e.doc.store.clients.get(n);if(s)for(let o=w.
|
|
321
|
-
findIndexSS(s,i);o<s.length&&s[o].id.clock<r;o++){const a=s[o];a instanceof w.Item&&t(a)}}}function we(e,t){return typeof e=="object"&&e!==null&&e.constructor?.name===t}function N(e){return e instanceof
|
|
322
|
-
w.XmlElement||we(e,"YXmlElement")&&typeof e.nodeName=="string"&&typeof e.getAttribute=="function"&&typeof e.setAttribute=="function"&&typeof e.get=="function"&&typeof e.length=="number"}function Pa(e){
|
|
323
|
-
return e instanceof w.XmlText||we(e,"YXmlText")&&typeof e.insert=="function"&&typeof e.toDelta=="function"&&typeof e.toString=="function"}function Un(e){return e instanceof w.Map||we(e,"YMap")&&typeof e.
|
|
324
|
-
get=="function"&&typeof e.set=="function"&&typeof e.forEach=="function"}function Aa(e){return e instanceof w.Array||we(e,"YArray")&&typeof e.get=="function"&&typeof e.insert=="function"&&typeof e.delete==
|
|
325
|
-
"function"&&typeof e.length=="number"}function Na(e){return e instanceof w.YXmlEvent||we(e,"YXmlEvent")&&typeof e.childListChanged=="boolean"}function Ft(e){return e.get(m.paragraphIndentStorageVersion)===
|
|
326
|
-
At}const Ct=new WeakMap;function Ia(e){let t=Ct.get(e);if(!t){const n=new Map,r=[Ge(e),e.getXmlFragment("chrome"),e.getXmlFragment("notes")];let i=new WeakMap,s=new WeakMap;const o=u=>{const g=u.getAttribute(
|
|
327
|
-
"id");g&&(n.set(g,u),s.set(u,g));const p=new Set(u.toArray().filter(N));i.set(u,p);for(const f of p)o(f)},a=u=>{const g=s.get(u);g&&n.get(g)===u&&n.delete(g);for(const p of i.get(u)??[])a(p);i.delete(
|
|
328
|
-
u),s.delete(u)},c=u=>{const g=i.get(u)??new Set,p=new Set(u.toArray().filter(N));for(const f of g)p.has(f)||a(f);for(const f of p)g.has(f)||o(f);i.set(u,p)},l=()=>{n.clear(),i=new WeakMap,s=new WeakMap;
|
|
329
|
-
for(const u of r)c(u)};l();const d=u=>{for(const g of u){if(!Na(g))continue;const p=g.target;if(g.changes.added.size||g.changes.deleted.size){const f=i.get(p)??new Set;for(const h of g.changes.deleted)
|
|
330
|
-
for(const b of h.content.getContent())N(b)&&f.delete(b)&&a(b);for(const h of g.changes.added)for(const b of h.content.getContent())N(b)&&!f.has(b)&&(f.add(b),o(b));i.set(p,f)}if(N(p)&&g.changes.keys.has(
|
|
331
|
-
"id")){const f=s.get(p);f&&n.get(f)===p&&n.delete(f),s.delete(p);const h=p.getAttribute("id");h&&(n.set(h,p),s.set(p,h))}}};for(const u of r)u.observeDeep(d);t={index:n,observer:d,rebuild:l},Ct.set(e,
|
|
332
|
-
t)}return t.index}function $e(e){return e.share.has("paragraphs")?e.getArray("paragraphs").length>0:!1}function Tt(e){return e.share.has("content")?e.getXmlFragment("content").length>0:!1}function Rt(e){
|
|
333
|
-
return!!(Tt(e)||$e(e))}function Ma(e){if(!$e(e)||Tt(e))return;const t=e.getArray("paragraphs"),n=e.getXmlFragment("content"),r=e.getMap("metadata"),i=r?.get("defaultFontFamily"),s=Xe(r),o=B(s).indentStepPx,
|
|
334
|
-
a=Ft(r);e.transact(()=>{t.forEach(c=>{const l=Ot(c,i,o,a);l&&n.push([l])}),t.delete(0,t.length)})}function Ot(e,t,n,r=!1){const i=e.get("type")||"paragraph",s=e.get("id")||P();switch(i){case"page-brea\
|
|
335
|
-
k":{const o=new w.XmlElement("page-break");o.setAttribute("id",s);const a=e.get("diffState"),c=e.get("suggestionId");return(a==="insert"||a==="delete"||a==="equal")&&o.setAttribute("diffState",a),typeof c==
|
|
336
|
-
"string"&&o.setAttribute("suggestionId",c),o}case"section-break":{const o=new w.XmlElement("section-break");o.setAttribute("id",s);const a=e.get("layout");typeof a=="string"&&o.setAttribute("layout",a);
|
|
337
|
-
const c=e.get("breakType");typeof c=="string"&&o.setAttribute("breakType",c);const l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&o.setAttribute("diffSta\
|
|
338
|
-
te",l),typeof d=="string"&&o.setAttribute("suggestionId",d),o}case"toc":{const o=new w.XmlElement("toc");o.setAttribute("id",s);const a=e.get("levels");typeof a=="number"&&a>=1&&a<=6&&o.setAttribute("\
|
|
339
|
-
levels",String(a));const c=e.get("instr");typeof c=="string"&&c!==""&&o.setAttribute("instr",c);const l=e.get("direction"),d=e.get("align");(l==="rtl"||l==="ltr")&&o.setAttribute("direction",l),(d==="\
|
|
340
|
-
left"||d==="center"||d==="right"||d==="justify")&&o.setAttribute("align",d);const u=e.get("fontFamily");typeof u=="string"&&u!==""&&o.setAttribute("fontFamily",u);const g=e.get("fontSize");typeof g=="\
|
|
341
|
-
number"&&g>0&&o.setAttribute("fontSize",String(g));const p=e.get("color");typeof p=="string"&&p!==""&&o.setAttribute("color",p);const f=e.get("diffState"),h=e.get("suggestionId");return(f==="insert"||
|
|
342
|
-
f==="delete"||f==="equal")&&o.setAttribute("diffState",f),typeof h=="string"&&o.setAttribute("suggestionId",h),o}case"placeholder":{const o=new w.XmlElement("placeholder");return o.setAttribute("id",s),
|
|
343
|
-
o.setAttribute("height",String(e.get("height")||100)),o}case"image":{const o=new w.XmlElement("image");o.setAttribute("id",s);const a=e.get("diffState"),c=e.get("suggestionId");return(a==="insert"||a===
|
|
344
|
-
"delete"||a==="equal")&&o.setAttribute("diffState",a),typeof c=="string"&&o.setAttribute("suggestionId",c),o.setAttribute("src",e.get("src")||""),e.get("sourceUrl")&&o.setAttribute("sourceUrl",e.get("\
|
|
345
|
-
sourceUrl")),o.setAttribute("width",String(e.get("width")||200)),o.setAttribute("height",String(e.get("height")||200)),e.get("alt")&&o.setAttribute("alt",e.get("alt")),e.get("align")&&o.setAttribute("\
|
|
346
|
-
align",e.get("align")),e.get("uploading")!==void 0&&o.setAttribute("uploading",String(e.get("uploading"))),e.get("tempId")&&o.setAttribute("tempId",e.get("tempId")),e.get("originalFormat")&&o.setAttribute(
|
|
347
|
-
"originalFormat",e.get("originalFormat")),e.get("originalDataUrl")&&o.setAttribute("originalDataUrl",e.get("originalDataUrl")),e.get("anchorXml")&&o.setAttribute("anchorXml",e.get("anchorXml")),o}case"\
|
|
348
|
-
list":{const o=new w.XmlElement("list");o.setAttribute("id",s),o.setAttribute("variant",e.get("variant")||"unordered"),e.get("startNumber")!==void 0&&o.setAttribute("startNumber",String(e.get("startNu\
|
|
349
|
-
mber"))),e.get("numberingChainId")&&o.setAttribute("numberingChainId",e.get("numberingChainId")),e.get("numberingFormat")&&o.setAttribute("numberingFormat",e.get("numberingFormat"));const a=e.get("ite\
|
|
350
|
-
ms");return a&&a.forEach(c=>{const l=Fa(c,t);l&&o.push([l])}),o}case"footnote":{const o=new w.XmlElement("footnote");o.setAttribute("id",s),e.get("noteKind")==="endnote"&&o.setAttribute("noteKind","en\
|
|
351
|
-
dnote");const a=e.get("children");return a&&a.forEach(c=>{const l=Ot(c,t,n,r);l&&o.push([l])}),o}case"container":{const o=new w.XmlElement("container");o.setAttribute("id",s),e.get("borderColor")&&o.setAttribute(
|
|
352
|
-
"borderColor",e.get("borderColor")),typeof e.get("padding")=="number"&&o.setAttribute("padding",String(e.get("padding")));const a=e.get("children");return a&&a.forEach(c=>{const l=Ot(c,t,n,r);l&&o.push(
|
|
353
|
-
[l])}),o}case"paragraph":default:{const o=new w.XmlElement("paragraph");o.setAttribute("id",s),e.get("heading")!==void 0&&o.setAttribute("heading",String(e.get("heading"))),e.get("align")!==void 0&&o.
|
|
354
|
-
setAttribute("align",e.get("align")),e.get("lineSpacing")!==void 0&&o.setAttribute("lineSpacing",String(e.get("lineSpacing")));{const f={};Fe(f,e.get("pagination"));const h=Me(f);h!==void 0&&o.setAttribute(
|
|
355
|
-
"pagination",h)}{const f=e.get("styleId");typeof f=="string"&&f&&o.setAttribute("styleId",f)}{const f=e.get("direction");(f==="rtl"||f==="ltr")&&o.setAttribute("direction",f)}{const f=e.get("tabStops");
|
|
356
|
-
typeof f=="string"&&f&&o.setAttribute("tabStops",f)}{const f=e.get("borders");typeof f=="string"&&f&&o.setAttribute("borders",f)}{const f=e.get("shading");typeof f=="string"&&f&&o.setAttribute("shadin\
|
|
357
|
-
g",f)}const a=e.get("leftIndent"),c=a===0?0:Oe(ee(a,{indentStepPx:n,storedAsUnits:r}));c!==void 0&&o.setAttribute("leftIndent",String(c));const l=e.get("firstLineIndent"),d=l===0?0:je(ee(l,{indentStepPx:n,
|
|
358
|
-
storedAsUnits:r,firstLine:!0}));d!==void 0&&o.setAttribute("firstLineIndent",String(d));const u=e.get("content"),g=new w.XmlText;if(u){const f=ce(u);let h=0;for(const b of f)if(typeof b.insert=="strin\
|
|
359
|
-
g"){const x=b.attributes||{};t&&!x.fontFamily&&(x.fontFamily=t),le(g,h,b.insert,x),h+=b.insert.length}}const p=e.get("_emptyTextMarks");return p&&o.setAttribute("_emptyTextMarks",JSON.stringify(p)),o.
|
|
360
|
-
push([g]),o}}}function Fa(e,t){if(!e)return null;const n=new w.XmlElement("list-item");n.setAttribute("id",e.get("id")||P()),e.get("checked")!==void 0&&n.setAttribute("checked",String(e.get("checked"))),
|
|
361
|
-
typeof e.get("indentLevel")=="number"&&e.get("indentLevel")>0&&n.setAttribute("indentLevel",String(e.get("indentLevel"))),(e.get("direction")==="rtl"||e.get("direction")==="ltr")&&n.setAttribute("dire\
|
|
362
|
-
ction",e.get("direction"));const r=e.get("content"),i=new w.XmlText;if(r){const o=ce(r);let a=0;for(const c of o)if(typeof c.insert=="string"){const l=c.attributes||{};t&&!l.fontFamily&&(l.fontFamily=
|
|
363
|
-
t),le(i,a,c.insert,l),a+=c.insert.length}}const s=e.get("_emptyTextMarks");return s&&n.setAttribute("_emptyTextMarks",JSON.stringify(s)),n.push([i]),n}const Hn={indentStepPx:B(void 0).indentStepPx,storedAsUnits:!1};
|
|
364
|
-
function qn(e,t,n=!1){return ee(e,{indentStepPx:t.indentStepPx,storedAsUnits:t.storedAsUnits,firstLine:n})}function Ca(e,t){return Ta(e,t)}function Ta(e,t){const n=new w.Doc({gc:!0,autoLoad:!1,shouldLoad:!1}),
|
|
365
|
-
r=n.getXmlFragment("content"),i=n.getMap("metadata");if(t?.sharedStyles&&i.set("sharedStylesVersion",1),e.title&&i.set("title",e.title),e.pageless!==void 0?i.set("pageless",e.pageless):i.has("pageless")||
|
|
366
|
-
i.set("pageless",!1),Mt(i,e.pageLayout),e.coreProperties&&Object.keys(e.coreProperties).length>0&&i.set("coreProperties",e.coreProperties),e.fontSubstitutes&&Object.keys(e.fontSubstitutes).length>0&&i.
|
|
367
|
-
set("fontSubstitutes",e.fontSubstitutes),e.comments&&e.comments.length>0){const s=n.getMap("comments");for(const o of e.comments)s.set(o.id,o)}if(e.sdtWrappers&&e.sdtWrappers.length>0){const s=n.getMap(
|
|
368
|
-
"sdt-wrappers");for(const o of e.sdtWrappers)s.set(o.id,o)}if(e.oxmlRanges&&e.oxmlRanges.length>0){const s=n.getMap("oxml-ranges");for(const o of e.oxmlRanges)s.set(o.id,o)}return e.stylesXml&&i.set("\
|
|
369
|
-
stylesXml",e.stylesXml),e.stylesheet&&e.stylesheet.paragraphStyles.length>0&&i.set("stylesheet",e.stylesheet),e.docxSource&&i.set("docxSource",e.docxSource),e.watermark&&i.set("watermark",e.watermark),
|
|
370
|
-
e.chromeImages&&e.chromeImages.length>0&&i.set("chromeImages",e.chromeImages),n.transact(()=>{const s=n.getXmlFragment("chrome"),o=e.chrome&&e.chrome.length>0?e.chrome:e.children.some(l=>l.type==="hea\
|
|
371
|
-
der-footer")?e.children.filter(l=>l.type==="header-footer"):wt(e.headers,e.footers),a=n.getXmlFragment("notes"),c=e.notes&&e.notes.length>0?e.notes:e.children.filter(l=>l.type==="footnote");e.children.
|
|
372
|
-
forEach(l=>{l.type==="header-footer"||l.type==="footnote"||re(l,r)}),o.forEach(l=>{re(l,s)}),c.forEach(l=>{re(l,a)})}),n}function Vn(e,t){const n=e.getXmlFragment("content"),r=e.getMap("metadata");e.transact(
|
|
373
|
-
()=>{if(t.title&&r.set("title",t.title),t.pageless!==void 0&&r.set("pageless",t.pageless),Mt(r,t.pageLayout),t.coreProperties&&Object.keys(t.coreProperties).length>0&&r.set("coreProperties",t.coreProperties),
|
|
374
|
-
t.fontSubstitutes&&Object.keys(t.fontSubstitutes).length>0&&r.set("fontSubstitutes",t.fontSubstitutes),t.comments&&t.comments.length>0){const c=e.getMap("comments");for(const l of t.comments)c.set(l.id,
|
|
375
|
-
l)}if(t.sdtWrappers&&t.sdtWrappers.length>0){const c=e.getMap("sdt-wrappers");for(const l of t.sdtWrappers)c.set(l.id,l)}if(t.oxmlRanges&&t.oxmlRanges.length>0){const c=e.getMap("oxml-ranges");for(const l of t.
|
|
376
|
-
oxmlRanges)c.set(l.id,l)}t.stylesXml&&r.set("stylesXml",t.stylesXml),t.stylesheet&&t.stylesheet.paragraphStyles.length>0&&r.set("stylesheet",t.stylesheet),t.docxSource&&r.set("docxSource",t.docxSource),
|
|
377
|
-
t.watermark&&r.set("watermark",t.watermark),t.chromeImages&&t.chromeImages.length>0&&r.set("chromeImages",t.chromeImages);const i=e.getXmlFragment("chrome"),s=t.chrome&&t.chrome.length>0?t.chrome:t.children.
|
|
378
|
-
some(c=>c.type==="header-footer")?t.children.filter(c=>c.type==="header-footer"):wt(t.headers,t.footers),o=e.getXmlFragment("notes"),a=t.notes&&t.notes.length>0?t.notes:t.children.filter(c=>c.type==="\
|
|
379
|
-
footnote");t.children.forEach(c=>{c.type==="header-footer"||c.type==="footnote"||re(c,n)}),s.forEach(c=>{re(c,i)}),a.forEach(c=>{re(c,o)})})}function Ra(e,t){const n=er(e,t);if(!n)return null;const r=e.
|
|
380
|
-
getMap("metadata"),i=B(Xe(r));return ze(n,{indentStepPx:i.indentStepPx,storedAsUnits:Ft(r)})}function Jn(e){const t=e.getMap("metadata"),n=t?.get("title"),r=t?.get("pageless"),i=Xe(t),s={indentStepPx:B(
|
|
381
|
-
i).indentStepPx,storedAsUnits:Ft(t)},o=e.getXmlFragment("content");let a;if(o.length>0){a=[];for(const S of o.toArray())if(N(S)){const k=ze(S,s);k&&a.push(k)}}else{const S=e.getArray("paragraphs"),k=t?.
|
|
382
|
-
get("defaultFontFamily");a=[],S.forEach($=>{const O=ke($,k,s);O&&a.push(O)})}const c={type:"doc",children:a};n&&(c.title=n),r!==void 0&&(c.pageless=r),i&&(c.pageLayout=i);const l=t?.get("corePropertie\
|
|
383
|
-
s");l&&typeof l=="object"&&Object.keys(l).length>0&&(c.coreProperties={...l});const d=t?.get("fontSubstitutes");d&&typeof d=="object"&&Object.keys(d).length>0&&(c.fontSubstitutes={...d},rn(c.fontSubstitutes));
|
|
384
|
-
const u=e.getXmlFragment("chrome"),g=[];for(const S of u.toArray())if(N(S)){const k=ze(S,s);k&&k.type==="header-footer"&&g.push(k)}g.length>0&&(c.chrome=g);const p=e.getXmlFragment("notes"),f=[];for(const S of p.
|
|
385
|
-
toArray())if(N(S)){const k=ze(S,s);k&&k.type==="footnote"&&f.push(k)}const h=c.children.filter(S=>S.type==="footnote");h.length>0&&(c.children=c.children.filter(S=>S.type!=="footnote"),f.push(...h)),f.
|
|
386
|
-
length>0&&(c.notes=f,Kt(c));const b=On(g),x=t?.get("headers"),y=t?.get("footers"),v=b.headers??(x&&Object.keys(x).length>0?x:void 0),F=b.footers??(y&&Object.keys(y).length>0?y:void 0);v&&(c.headers=v),
|
|
387
|
-
F&&(c.footers=F);const U=e.getMap("comments");if(U.size>0){const S=[];U.forEach(k=>{k&&typeof k=="object"&&S.push(k)}),S.length>0&&(S.sort((k,$)=>(k.createdAt??"").localeCompare($.createdAt??"")),c.comments=
|
|
388
|
-
S)}const X=e.getMap("sdt-wrappers");if(X.size>0){const S=[];if(X.forEach(k=>{k&&typeof k=="object"&&S.push(k)}),S.length>0){const k=new Map;c.children.forEach((O,ve)=>{O.id&&k.set(O.id,ve)});const $=O=>O.
|
|
389
|
-
blockIds?.[0]??O.startBlockId??"";S.sort((O,ve)=>(k.get($(O))??Number.MAX_SAFE_INTEGER)-(k.get($(ve))??Number.MAX_SAFE_INTEGER)||O.id.localeCompare(ve.id)),c.sdtWrappers=S}}const R=e.getMap("oxml-rang\
|
|
390
|
-
es");if(R.size>0){const S=[];R.forEach(k=>{k&&typeof k=="object"&&S.push(k)}),S.length>0&&(S.sort((k,$)=>k.id.localeCompare($.id)),c.oxmlRanges=S)}const H=e.getMap("metadata").get("stylesXml");typeof H==
|
|
391
|
-
"string"&&H.length>0&&(c.stylesXml=H);const q=e.getMap("metadata").get("stylesheet");q&&typeof q=="object"&&Array.isArray(q.paragraphStyles)&&q.paragraphStyles.length>0&&(c.stylesheet=q);const V=e.getMap(
|
|
392
|
-
"metadata").get("docxSource");V&&typeof V=="object"&&Array.isArray(V.spans)&&(c.docxSource=V);const He=e.getMap("metadata").get("watermark");typeof He=="string"&&He.length>0&&(c.watermark=He);const qe=e.
|
|
393
|
-
getMap("metadata").get("chromeImages");return Array.isArray(qe)&&qe.length>0&&(c.chromeImages=qe),c}function re(e,t){t.push([xt(e,t.doc??void 0)])}function ze(e,t=Hn){return me(e,t)}function ke(e,t,n=Hn){
|
|
394
|
-
const r=e.get("type")||"paragraph",i=e.get("id")||P();switch(r){case"page-break":const s={type:"page-break",id:i};{const o=e.get("diffState"),a=e.get("suggestionId");(o==="insert"||o==="delete"||o==="\
|
|
395
|
-
equal")&&(s.diffState=o),typeof a=="string"&&(s.suggestionId=a)}return s;case"section-break":{const o={type:"section-break",id:i},a=e.get("layout");if(typeof a=="string")try{o.layout=JSON.parse(a)}catch{}
|
|
396
|
-
const c=e.get("breakType");(c==="nextPage"||c==="continuous"||c==="evenPage"||c==="oddPage")&&(o.breakType=c);const l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l===
|
|
397
|
-
"equal")&&(o.diffState=l),typeof d=="string"&&(o.suggestionId=d),o}case"toc":{const o={type:"toc",id:i},a=e.get("levels");typeof a=="number"&&a>=1&&a<=6&&(o.levels=a);const c=e.get("instr");typeof c==
|
|
398
|
-
"string"&&c!==""&&(o.instr=c);const l=e.get("direction"),d=e.get("align");(l==="rtl"||l==="ltr")&&(o.direction=l),(d==="left"||d==="center"||d==="right"||d==="justify")&&(o.align=d);const u=e.get("fon\
|
|
399
|
-
tFamily");typeof u=="string"&&u!==""&&(o.fontFamily=u);const g=e.get("fontSize");typeof g=="number"&&g>0&&(o.fontSize=g);const p=e.get("color");typeof p=="string"&&p!==""&&(o.color=p);const f=e.get("d\
|
|
400
|
-
iffState"),h=e.get("suggestionId");return(f==="insert"||f==="delete"||f==="equal")&&(o.diffState=f),typeof h=="string"&&(o.suggestionId=h),o}case"placeholder":return{type:"placeholder",id:i,height:e.get(
|
|
401
|
-
"height")||100};case"image":{const o={type:"image",id:i,src:e.get("src")||"",sourceUrl:e.get("sourceUrl")||void 0,width:e.get("width")||200,height:e.get("height")||200,alt:e.get("alt")||void 0,align:e.
|
|
402
|
-
get("align")||void 0},a=e.get("diffState"),c=e.get("suggestionId");(a==="insert"||a==="delete"||a==="equal")&&(o.diffState=a),typeof c=="string"&&(o.suggestionId=c);const l=e.get("uploading");l!==void 0&&
|
|
403
|
-
(o.uploading=l);const d=e.get("tempId");d&&(o.tempId=d);const u=e.get("originalFormat");(u==="emf"||u==="wmf")&&(o.originalFormat=u);const g=e.get("originalDataUrl");typeof g=="string"&&g&&(o.originalDataUrl=
|
|
404
|
-
g);const p=e.get("anchorXml");return typeof p=="string"&&p&&(o.anchorXml=p),o}case"list":{const o=e.get("items"),a=[];o&&o.forEach(g=>{const p=Oa(g);p&&a.push(p)});const c={type:"list",id:i,variant:e.
|
|
405
|
-
get("variant")||"unordered",children:a},l=e.get("startNumber");l!==void 0&&(c.startNumber=l);const d=e.get("numberingChainId");d&&(c.numberingChainId=d);const u=e.get("numberingFormat");return u&&(c.numberingFormat=
|
|
406
|
-
u),c}case"footnote":{const o=e.get("children"),a=[];o&&o.forEach(l=>{const d=ke(l,t,n);d&&a.push(d)});const c={type:"footnote",id:i,children:a};return e.get("noteKind")==="endnote"&&(c.noteKind="endno\
|
|
407
|
-
te"),c}case"container":{const o=e.get("children"),a=[];o&&o.forEach(u=>{const g=ke(u,t,n);g&&a.push(g)});const c={type:"container",id:i,children:a},l=e.get("borderColor");l&&(c.borderColor=l);const d=e.
|
|
408
|
-
get("padding");return typeof d=="number"&&(c.padding=d),c}case"table":{const o=e.get("children"),a=[];o&&o.forEach(y=>{const v=y.get("id")||P(),F=y.get("children"),U=[];F&&F.forEach(q=>{const V=ke(q,t,
|
|
409
|
-
n);V&&U.push(V)});const X={type:"table-row",id:v,children:U},R=y.get("oxmlAttrs");typeof R=="string"&&R&&(X.oxmlAttrs=R);const H=y.get("oxmlTrPr");typeof H=="string"&&H&&(X.oxmlTrPr=H),a.push(X)});const c=e.
|
|
410
|
-
get("columnWidths")||[],l={type:"table",id:i,children:a,columnWidths:c},d=e.get("tableWidth"),u=e.get("align"),g=e.get("borderColor"),p=e.get("borderWidth"),f=e.get("borders"),h=e.get("cellPadding"),b=e.
|
|
411
|
-
get("hasHeader");d!==void 0&&(l.tableWidth=d),(u==="left"||u==="center"||u==="right")&&(l.align=u),g&&(l.borderColor=g),p!==void 0&&(l.borderWidth=p),typeof f=="string"&&f&&(l.borders=f),h!==void 0&&(l.
|
|
412
|
-
cellPadding=h),b!==void 0&&(l.hasHeader=b);const x=e.get("oxmlTblPr");return typeof x=="string"&&x&&(l.oxmlTblPr=x),l}case"table-cell":{const o=e.get("children"),a=[];o&&o.forEach(b=>{const x=ke(b,t,n);
|
|
413
|
-
x&&a.push(x)});const c={type:"table-cell",id:i,children:a},l=e.get("verticalAlign"),d=e.get("backgroundColor");l&&(c.verticalAlign=l),d&&(c.backgroundColor=d);const u=e.get("borders"),g=e.get("padding");
|
|
414
|
-
typeof u=="string"&&u&&(c.borders=u),typeof g=="string"&&g&&(c.padding=g);const p=Number(e.get("colSpan")),f=Number(e.get("rowSpan"));Number.isFinite(p)&&p>1&&(c.colSpan=p),Number.isFinite(f)&&f>1&&(c.
|
|
415
|
-
rowSpan=f);const h=e.get("oxmlTcPr");return typeof h=="string"&&h&&(c.oxmlTcPr=h),c}case"code":{const o=e.get("renderDiagram"),a=e.get("showDiagramSource"),c={type:"code",id:i,content:e.get("content")||
|
|
416
|
-
"",language:e.get("language")||void 0,renderDiagram:typeof o=="boolean"?o:void 0,showDiagramSource:typeof a=="boolean"?a:void 0},l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="\
|
|
417
|
-
delete"||l==="equal")&&(c.diffState=l),typeof d=="string"&&(c.suggestionId=d),c}case"math":{const o=e.get("displayMode")||"block",a={type:"math",id:i,content:e.get("content")||"",displayMode:o},c=e.get(
|
|
418
|
-
"align");(c==="left"||c==="center"||c==="right"||c==="justify")&&(a.align=c);const l=e.get("diffState"),d=e.get("suggestionId");return(l==="insert"||l==="delete"||l==="equal")&&(a.diffState=l),typeof d==
|
|
419
|
-
"string"&&(a.suggestionId=d),e.get("showDiagramSource")===!0&&(a.showDiagramSource=!0),a}case"paragraph":default:{const o={type:"paragraph",id:i,children:[]},a=e.get("heading"),c=e.get("align"),l=e.get(
|
|
420
|
-
"lineSpacing"),d=e.get("leftIndent"),u=e.get("firstLineIndent"),g=e.get("structuralSuggestionId"),p=e.get("structuralSuggestionKind"),f=e.get("structuralSuggestionRole");a!==void 0&&(o.heading=a),c!==
|
|
421
|
-
void 0&&(o.align=c),l!==void 0&&(o.lineSpacing=l),Fe(o,e.get("pagination"));{const y=e.get("styleId");typeof y=="string"&&y&&(o.styleId=y)}{const y=e.get("direction");(y==="rtl"||y==="ltr")&&(o.direction=
|
|
422
|
-
y)}{const y=e.get("tabStops");typeof y=="string"&&y&&(o.tabStops=y)}{const y=e.get("borders");typeof y=="string"&&y&&(o.borders=y)}{const y=e.get("shading");typeof y=="string"&&y&&(o.shading=y)}{const y=e.
|
|
423
|
-
get("oxmlAttrs");typeof y=="string"&&y&&(o.oxmlAttrs=y);const v=e.get("oxmlPPr");typeof v=="string"&&v&&(o.oxmlPPr=v)}typeof g=="string"&&(o.structuralSuggestionId=g),(p==="insert"||p==="delete"||p===
|
|
424
|
-
"split"||p==="merge"||p==="change")&&(o.structuralSuggestionKind=p),(f==="before"||f==="after")&&(o.structuralSuggestionRole=f);const h=qn(d,n);d===0?o.leftIndent=0:h!==void 0&&(o.leftIndent=h);const b=qn(
|
|
425
|
-
u,n,!0);u===0?o.firstLineIndent=0:b!==void 0&&(o.firstLineIndent=b);const x=e.get("content");if(x){const y=Kn(x);if(y.length>0)o.children=y;else{const v=e.get("_emptyTextMarks"),F={type:"text",text:""};
|
|
426
|
-
v&&Object.keys(v).length>0?F.marks=v:F.marks={fontFamily:fe},o.children=[F]}}else o.children=[{type:"text",text:"",marks:{fontFamily:fe}}];return t&&o.children.forEach(y=>{y.type==="text"&&(y.marks={fontFamily:t,
|
|
427
|
-
...y.marks||{}})}),o}}}function Oa(e){if(!e)return null;const t={type:"list-item",id:e.get("id")||P(),children:[]},n=e.get("checked");n!==void 0&&(t.checked=n);const r=e.get("indentLevel");typeof r=="\
|
|
428
|
-
number"&&r>0&&(t.indentLevel=r);for(const o of ae){const a=e.get(o);typeof a=="number"&&Number.isFinite(a)&&a>=0&&(t[o]=a)}const i=e.get("direction");(i==="rtl"||i==="ltr")&&(t.direction=i);const s=e.
|
|
429
|
-
get("content");if(s){const o=Kn(s);if(o.length>0)t.children=o;else{const a=e.get("_emptyTextMarks");t.children=[{type:"text",text:"",marks:a||{fontFamily:fe}}]}}else t.children=[{type:"text",text:"",marks:{
|
|
430
|
-
fontFamily:fe}}];return t}function Kn(e){const t=[];return ce(e).forEach(n=>{if(typeof n.insert=="string"){const r=n.attributes||{},i={type:"text",text:n.insert};i.marks=rt(r),t.push(i)}}),un(t)}function Ge(e){
|
|
431
|
-
return e.getXmlFragment("content")}const Yn="block-id-repair";function ja(e,t){let n=0;const r=i=>{for(const s of i.toArray())N(s)&&(s.getAttribute("id")===t&&n++,r(s))};for(const i of["content","chro\
|
|
432
|
-
me","notes"])e.share.has(i)&&r(e.getXmlFragment(i));return n}function La(e){const t=new Set,n=r=>{if(r instanceof w.XmlFragment){if(N(r)){const i=r.getAttribute("id");i&&t.add(i)}for(const i of r.toArray())
|
|
433
|
-
n(i)}};return _n(e,r=>{if(r.deleted)return;const i=r.content;if(i instanceof w.ContentType)n(i.type);else if(r.parentSub==="id"&&N(r.parent)){const s=r.parent.getAttribute("id");s&&t.add(s)}}),t}function De(e,t,n){
|
|
434
|
-
if(Array.isArray(e))return e.map(i=>De(i,t,n));if(!e||typeof e!="object")return e;const r=e;return Object.fromEntries(Object.entries(r).map(([i,s])=>{const o=i==="id"&&typeof r.type=="string"&&!["bloc\
|
|
435
|
-
k-change","block-insert","block-delete","table-change","inline-text","inline-format","paragraph-split","paragraph-merge"].includes(r.type);return s===t&&(o||/^(blockId|tableId|rowId|cellId|itemId|firstBlockId|secondBlockId|anchorBlockId|insertedBlockId|cleanupTrailingParagraphId)$/.
|
|
436
|
-
test(i))?[i,n]:(i==="blockIds"||i==="sequenceBlockIds")&&Array.isArray(s)?[i,s.map(a=>a===t?n:a)]:[i,De(s,t,n)]}))}function Ea(e,t,n){for(const r of["structuralSuggestionRecord","structuralSuggestionR\
|
|
437
|
-
ecords"]){const i=e.getAttribute(r);if(i)try{const s=De(JSON.parse(i),t,n);e.setAttribute(r,JSON.stringify(s));const o=e.doc?.share.get("liveSuggestions");if(Un(o))for(const a of Array.isArray(s)?s:[s])
|
|
438
|
-
a?.id&&o.has(a.id)&&o.set(a.id,De(o.get(a.id),t,n))}catch{}}}function Ba(e){let t=P();for(;e.has(t);)t=P();return t}function Qn(e,t,n,r,i){const s=e.toArray();for(let o=s.length-1;o>=0;o--){const a=s[o];
|
|
439
|
-
N(a)&&i.has(a)&&e.delete(o,1)}for(const o of e.toArray()){if(!N(o))continue;const a=o.getAttribute("id");if(a)if(t.has(a)){const c=o._item.id,l=`dup_${c.client.toString(36)}_${c.clock.toString(36)}`;let d=l;
|
|
440
|
-
for(let u=1;r.has(d);u++)d=`${l}_${u}`;r.add(d),o.setAttribute("id",d),Ea(o,a,d),n.push({oldId:a,newId:d}),t.add(d)}else t.add(a);Qn(o,t,n,r,i)}}function Zn(e,t,n){for(const r of e.toArray()){if(!Un(r))
|
|
441
|
-
continue;const i=r.get("id");if(typeof i=="string"&&i.length>0)if(t.has(i)){const s=Ba(t);r.set("id",s),n.push({oldId:i,newId:s}),t.add(s)}else t.add(i);r.forEach(s=>{Aa(s)&&Zn(s,t,n)})}}function Xa(e,t={}){
|
|
442
|
-
const n=new Set,r=[],i=[],s={duplicatesFound:0,remappedIds:r,droppedIds:i},o=e.share.has("paragraphs")&&e.getArray("paragraphs").length>0,a=t.transaction?La(t.transaction):null;if(a&&a.size===0&&!o)return s;
|
|
443
|
-
const c=["content","chrome","notes"].filter(f=>e.share.has(f)).map(f=>e.getXmlFragment(f)),l=new Set,d=new Map;let u=!1;const g=f=>{for(const h of f.toArray()){if(!N(h))continue;const b=h.getAttribute(
|
|
444
|
-
"id");if(b&&(l.has(b)&&(u=!0),l.add(b),!a||a.has(b))){const x=d.get(b);x?x.push(h):d.set(b,[h])}g(h)}};if(c.forEach(g),!u&&!o)return s;const p=new Set;if(t.shouldDrop)for(const f of d.values()){if(f.length<
|
|
445
|
-
2)continue;const h=f.filter(b=>t.shouldDrop(b));if(!(h.length===0||h.length===f.length))for(const b of h)p.add(b),i.push(b.getAttribute("id"))}return e.transact(()=>{for(const f of c)Qn(f,n,r,l,p);if(o){
|
|
446
|
-
const f=e.getArray("paragraphs");Zn(f,n,r)}},Yn),{duplicatesFound:r.length+i.length,remappedIds:r,droppedIds:i}}function $a(e){return Tt(e)?Ge(e).length:$e(e)?e.getArray("paragraphs").length:0}function er(e,t){
|
|
447
|
-
const n=Ia(e),r=n.get(t)??null,i=r?r._item:null;return r&&!i?.deleted&&r.getAttribute("id")===t?r:(Ct.get(e).rebuild(),n.get(t)??null)}function oe(e,t){const n=e.toArray();for(let r=0;r<n.length;r++){
|
|
448
|
-
const i=n[r];if(N(i)){if(i.getAttribute("id")===t)return{yBlock:i,yParent:e,index:r};if(i.nodeName==="list"||i.nodeName==="container"||i.nodeName==="footnote"||i.nodeName==="header-footer"||i.nodeName===
|
|
449
|
-
"table-cell"){const s=oe(i,t);if(s)return s}if(i.nodeName==="table"){const s=i.toArray();for(let o=0;o<s.length;o++){const a=s[o];if(N(a)&&a.nodeName==="table-row"){if(a.getAttribute("id")===t)return{
|
|
450
|
-
yBlock:a,yParent:i,index:o};const c=oe(a,t);if(c)return c}}}if(i.nodeName==="table-row"){const s=oe(i,t);if(s)return s}}}return null}function za(e,t){const n=Ge(e),r=oe(n,t);return r||oe(e.getXmlFragment(
|
|
451
|
-
"chrome"),t)||oe(e.getXmlFragment("notes"),t)}function Ga(e){for(const t of e.toArray())if(Pa(t))return t;return null}let Da=0;function Wa(){const e=Date.now().toString(36),t=Math.random().toString(36).
|
|
452
|
-
substring(2,9),n=(Da++).toString(36);return`${e}-${t}-${n}`}const tr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function nr(){const e=new Uint8Array(8);crypto.getRandomValues(e);
|
|
453
|
-
let t="";for(let n=0;n<8;n++)t+=tr[e[n]%tr.length];return t}const jt="seed-claims",_a="revise:seed-race-repair";function Lt(e){const t=[];for(const n of e.toArray())if(n instanceof w.XmlElement){const r=n.
|
|
454
|
-
getAttribute("id");r&&t.push(r)}return t}function rr(e){return{blockIds:Lt(e.getXmlFragment("content")),chromeIds:Lt(e.getXmlFragment("chrome")),noteIds:Lt(e.getXmlFragment("notes")),commentIds:[...e.
|
|
455
|
-
getMap("comments").keys()],sdtIds:[...e.getMap("sdt-wrappers").keys()],oxmlRangeIds:[...e.getMap("oxml-ranges").keys()]}}function ie(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function or(e,t){
|
|
456
|
-
const n=rr(e);e.transact(()=>{Vn(e,t);const r=rr(e),i={clientId:e.clientID,blockIds:ie(r.blockIds,n.blockIds),chromeIds:ie(r.chromeIds,n.chromeIds),noteIds:ie(r.noteIds,n.noteIds),commentIds:ie(r.commentIds,
|
|
457
|
-
n.commentIds),sdtIds:ie(r.sdtIds,n.sdtIds),oxmlRangeIds:ie(r.oxmlRangeIds,n.oxmlRangeIds)},s=`${Date.now().toString(36).padStart(9,"0")}-${nr()}`;e.getMap("metadata").set("seedNonce",s),e.getMap(jt).set(
|
|
458
|
-
s,i)})}function ir(e){const t=e._item;return typeof t?.id?.client=="number"?t.id.client:null}function Et(e,t,n,r){if(t.size===0)return 0;const i=new Set,s=[],o=new Set;if(r!==void 0){for(const a of e.
|
|
459
|
-
toArray())if(a instanceof w.XmlElement&&ir(a)===r){const c=a.getAttribute("id");c&&o.add(c)}}for(let a=0;a<e.length;a++){const c=e.get(a);if(!(c instanceof w.XmlElement))continue;const l=c.getAttribute(
|
|
460
|
-
"id")??"";t.has(l)&&(n.has(l)&&(r!==void 0&&o.has(l)?ir(c)===r&&!i.has(l):!i.has(l))?i.add(l):s.push(a))}for(let a=s.length-1;a>=0;a--)e.delete(s[a],1);return s.length}function Bt(e){const t=e.getMap(
|
|
461
|
-
jt);if(t.size<2)return null;const n=e.getMap("metadata").get("seedNonce"),r=[...t.keys()].sort(),i=typeof n=="string"&&t.has(n)?n:r[0],s=[i,...r.filter(d=>d!==i)],o=t.get(s[0]),a=new Set([...o?.blockIds??
|
|
462
|
-
[],...o?.chromeIds??[],...o?.noteIds??[]]),c=s.slice(1);let l=0;return e.transact(()=>{for(const d of c){const u=t.get(d);if(u){l+=Et(e.getXmlFragment("content"),new Set(u.blockIds??[]),a,o?.clientId),
|
|
463
|
-
Et(e.getXmlFragment("chrome"),new Set(u.chromeIds??[]),a,o?.clientId),Et(e.getXmlFragment("notes"),new Set(u.noteIds??[]),a,o?.clientId);const g=new Set([...o?.commentIds??[],...o?.sdtIds??[],...o?.oxmlRangeIds??
|
|
464
|
-
[]]);for(const p of u.commentIds??[])g.has(p)||e.getMap("comments").delete(p);for(const p of u.sdtIds??[])g.has(p)||e.getMap("sdt-wrappers").delete(p);for(const p of u.oxmlRangeIds??[])g.has(p)||e.getMap(
|
|
465
|
-
"oxml-ranges").delete(p)}t.delete(d)}},_a),{losingClaims:c.length,removedBlocks:l}}function Ua(e,t){const n=e.getMap(jt),r=()=>{const i=Bt(e);i&&t&&t(i)};return n.observe(r),r(),()=>n.unobserve(r)}const ar=[
|
|
466
|
-
"content","chrome","notes","comments","annotations","metadata","sdt-wrappers","paragraphs","docx-carrier","oxml-ranges","seed-claims"];function Xt(){return new w.Doc({gc:!0,autoLoad:!1,shouldLoad:!1})}
|
|
467
|
-
function Ha(e){const t=ar.filter(n=>e.share.has(n));if(!(t.length===0||e.share.has("content")||e.share.has("paragraphs")))throw new Error(`Revise collaboration: this Y.Doc already uses ${t.map(n=>`"${n}\
|
|
468
|
-
"`).join(", ")}, which the editor reserves for its own document. Give the editor its own document — pass \`connect\` and let it build one — or keep your data in a separate Y.Doc.`)}const $t=["wind\
|
|
469
|
-
ow","document","DOMParser","XMLSerializer","Node","Element","HTMLElement","NodeFilter","XPathResult","File"];let We=null;function qa(e){const t=globalThis;if(t.__reviseServerRuntime=!0,$t.every(r=>t[r]))
|
|
470
|
-
return;const n=e().window;for(const r of $t)t[r]??(t[r]=n[r]);t.navigator??(t.navigator=n.navigator)}function Se(){if(!We){const e=Va();e.catch(()=>{We=null}),We=e}return We}async function Va(){const e=globalThis;
|
|
471
|
-
if(e.__reviseServerRuntime=!0,!e.File){const{File:i}=await import("node:buffer");i&&(e.File=i)}if($t.every(i=>e[i]))return;let t;try{t=await import("jsdom")}catch(i){const s=new Error("revise/server n\
|
|
472
|
-
eeds the optional peer dependency jsdom in Node. Install it with: npm i jsdom");throw s.cause=i,s}const{JSDOM:n,VirtualConsole:r}=t;qa(()=>new n("<!doctype html><html><body></body></html>",{virtualConsole:new r,
|
|
473
|
-
url:"https://headless.revise-sdk.invalid/"}))}const Ja=["docx","odt","rtf","markdown","txt","html"];function Ka(e){const t=ur(e);if(t&&Ja.includes(t.id))return t.id;throw new Error(`Revise: cannot rea\
|
|
474
|
-
d "${e}" on the server. Readable formats: .docx, .odt, .rtf, .md, .txt, .html.`)}async function zt(e,t){await Se();const n=Ka(t);return dr(e,t,n)}async function _e(e,t){await Se();const n=await Gt(e,"\
|
|
475
|
-
docx",{docx:t?.originalDocx?{graft:{originalDocx:t.originalDocx}}:void 0});return new Uint8Array(await n.arrayBuffer())}async function Ya(e,t){const n=await zt(e,t),r=Xt();return or(r,n),await sr(r,n,
|
|
476
|
-
e),r}async function sr(e,t,n){if(!t.docxSource?.sourceHash)return;const{storeDocxCarrier:r}=await import("./DocxGraft-BxSQtl12.js");await r(e,n,{hash:t.docxSource.sourceHash})}async function Qa(e,t,n){
|
|
477
|
-
if(Rt(e))return Bt(e),!1;const r=await zt(t,n);return or(e,r),await sr(e,r,t),!0}function Ue(e){return Jn(e)}async function cr(e){const{loadDocxCarrier:t}=await import("./DocxGraft-BxSQtl12.js"),n=t(e);
|
|
478
|
-
return _e(Ue(e),{...n?{originalDocx:n.bytes}:{}})}async function Za(e,t={}){await Se();const{format:n="docx",mode:r="review",title:i}=t,s=typeof e.getXmlFragment=="function";if(n==="docx"&&r==="review")
|
|
479
|
-
return s?cr(e):_e(e);let o=s?Ue(e):e;if(r==="final"){const{scrubDocument:l}=await import("./DocumentScrubber-CMPfm_HF.js");o=l(o,{removeComments:!0,resolveSuggestions:"accept"}).doc}if(n==="docx")return _e(
|
|
480
|
-
o);const{DocumentMutator:a}=await import("./DocumentMutator-btiDK57e.js").then(l=>l.x);o=a.materializeAcceptedSuggestions(o);const c=await Gt(o,n,n==="html"?{html:{title:i,includeWrapper:!0}}:{});return typeof c==
|
|
481
|
-
"string"?new TextEncoder().encode(c):new Uint8Array(await c.arrayBuffer())}async function es(e){const{computeSourceFidelity:t,getDocxCarrierMeta:n}=await import("./DocxGraft-BxSQtl12.js");return t(Ue(
|
|
482
|
-
e),n(e))}function ts(e){return Rt(e)}function ns(e){return w.encodeStateAsUpdate(e)}function rs(e){const t=Xt();return w.applyUpdate(t,e,"revise-backend"),t}async function os(e,t){await Se();const{createServerDocumentSession:n}=await import("./serverDocumentSession-CJ1EH3Tp.js");
|
|
483
|
-
return n(e,t)}export{Mn as $,Ko as A,Jo as B,Yr as C,vo as D,Xe as E,At as F,me as G,ue as H,On as I,Kt as J,Te as K,Ye as L,xt as M,za as N,ce as O,m as P,le as Q,fr as R,Qe as S,Br as T,er as U,Ge as V,
|
|
484
|
-
Ht as W,Ga as X,jr as Y,xa as Z,Nr as _,da as a,rn as a$,Me as a0,$r as a1,bn as a2,ft as a3,gt as a4,Yt as a5,_n as a6,hi as a7,bi as a8,Oi as a9,Vi as aA,ka as aB,It as aC,Ji as aD,ya as aE,Nt as aF,
|
|
485
|
-
Bn as aG,$n as aH,Pt as aI,Xn as aJ,Ki as aK,Mt as aL,Xa as aM,Fe as aN,Ma as aO,ga as aP,ee as aQ,ei as aR,_r as aS,Or as aT,Rr as aU,Dr as aV,Zr as aW,zr as aX,Qr as aY,eo as aZ,Le as a_,be as aa,wt as ab,
|
|
486
|
-
he as ac,Fn as ad,Ti as ae,Sa as af,Ci as ag,Wa as ah,Tr as ai,Jt as aj,$e as ak,$a as al,gr as am,Jr as an,ae as ao,Lr as ap,ja as aq,Ai as ar,Ra as as,Vn as at,Yn as au,ji as av,Dn as aw,te as ax,kt as ay,
|
|
487
|
-
jn as az,Se as b,Rn as b0,Gi as b1,Ri as b2,Di as b3,En as b4,Zo as b5,yn as b6,Vr as b7,ln as b8,rt as b9,oo as bA,ri as bB,di as bC,hn as bD,mn as bE,ui as bF,kn as bG,Sn as bH,Ro as bI,ge as bJ,zt as bK,
|
|
488
|
-
_e as bL,Ya as bM,Qa as bN,Ue as bO,cr as bP,Za as bQ,es as bR,ts as bS,ns as bT,rs as bU,os as bV,Bt as bW,Xt as bX,Ha as bY,ar as bZ,j as ba,No as bb,Fo as bc,bo as bd,wo as be,pa as bf,Ln as bg,zi as bh,
|
|
489
|
-
wa as bi,ht as bj,To as bk,W as bl,Yo as bm,Io as bn,Mo as bo,Co as bp,ho as bq,yo as br,Ze as bs,pe as bt,Ni as bu,ha as bv,Oo as bw,nr as bx,Kr as by,co as bz,ma as c,Ca as d,So as e,xn as f,Wn as g,
|
|
490
|
-
Rt as h,en as i,Zt as j,lt as k,ut as l,Mr as m,cn as n,Ua as o,Ee as p,gi as q,B as r,Oe as s,Gn as t,bt as u,je as v,P as w,K as x,Jn as y,Qt as z};
|