@docx-editor.dev/core 2.17.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +35 -8
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +9 -11
- package/dist/binding.js +1 -1
- package/dist/chunk-2ZEU42EA.js +2 -0
- package/dist/chunk-4DB7ZFQN.js +1 -0
- package/dist/chunk-4KMSEFIG.js +3 -0
- package/dist/chunk-72BDQFHY.js +18 -0
- package/dist/chunk-77DD4EBC.cjs +11 -0
- package/dist/chunk-BEOPUDAB.js +5 -0
- package/dist/chunk-CG7CP632.cjs +1 -0
- package/dist/chunk-CJCFEXTA.js +11 -0
- package/dist/chunk-DQS4KZUX.js +4 -0
- package/dist/chunk-FZ2BIMCY.cjs +2 -0
- package/dist/chunk-GUPITGJQ.cjs +2 -0
- package/dist/chunk-KDYD5TAW.cjs +1 -0
- package/dist/chunk-LQ6XWTKQ.cjs +18 -0
- package/dist/chunk-MDP5SNK4.cjs +3 -0
- package/dist/chunk-MRPPCGCX.cjs +20 -0
- package/dist/chunk-MSIFK7TJ.js +1 -0
- package/dist/chunk-NJONXJJY.cjs +4 -0
- package/dist/chunk-OODFC5R2.js +1 -0
- package/dist/chunk-P6VGDI57.js +2 -0
- package/dist/{chunk-UIB2MDE3.cjs → chunk-PBM6WERF.cjs} +1 -1
- package/dist/chunk-QBMAXYN7.js +20 -0
- package/dist/chunk-SUEX3CL7.cjs +5 -0
- package/dist/{chunk-UXAWPVH6.js → chunk-THCGTV53.js} +1 -1
- package/dist/{chunk-NO7U62I2.cjs → chunk-YVYEJBLL.cjs} +1 -1
- package/dist/chunk-ZKQX2PNF.cjs +1 -0
- package/dist/{chunk-XXLS6O6B.js → chunk-ZMM5RNM6.js} +1 -1
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +2 -4
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.cjs +1 -1
- package/dist/collaboration.d.ts +4 -6
- package/dist/collaboration.js +1 -1
- package/dist/contracts/editor.d.ts +9 -8
- package/dist/contracts/modules.d.ts +7 -9
- package/dist/{custom-node-writes-ClTkWM7s.d.ts → custom-node-writes-BqIv94ei.d.ts} +14 -2
- package/dist/document-protection-BL5zp8cU.d.ts +19 -0
- package/dist/{editor-BlerWPyk.d.ts → editor-WXbTSXx1.d.ts} +14 -7
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -1
- package/dist/editor.d.ts +271 -30
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -2
- package/dist/export.d.ts +15 -12
- package/dist/export.js +2 -2
- package/dist/{failure-BnGjoXf0.d.ts → failure-DNNmwsgD.d.ts} +1 -1
- package/dist/{font-resolver-DtADJcLL.d.ts → font-resolver-BSrKnTeR.d.ts} +5 -3
- package/dist/harfbuzz.wasm +0 -0
- package/dist/{headless-document-view-BDSeMGoK.d.ts → headless-document-view-C4ttQJ5H.d.ts} +11 -3
- package/dist/{index-D51bUVBE.d.ts → index-C3As-Xxp.d.ts} +133 -19
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -19
- package/dist/index.js +1 -1
- package/dist/{layout-shaping-rTElghj2.d.ts → layout-shaping-Dqu3JW3p.d.ts} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +23 -20
- package/dist/layout.js +1 -1
- package/dist/{note-properties-D5_fXW9K.d.ts → note-properties-RjYgbmXe.d.ts} +2 -2
- package/dist/{omml-equation-C9AJfWy5.d.ts → omml-equation-hcP9AUFX.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +16 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-K-Djpjjw.d.ts → protocol-OdRd17KZ.d.ts} +172 -7
- package/dist/{review-items-CiliAz8H.d.ts → review-items-CJz-kAW8.d.ts} +2 -2
- package/dist/{review-paragraph-order-BlSnyg9a.d.ts → review-paragraph-order--jLHXIcd.d.ts} +3 -3
- package/dist/{revision-projection-JiDclAFU.d.ts → revision-projection-BIHO_qvw.d.ts} +1 -1
- package/dist/{semantic-cell-selection-C-VsxNee.d.ts → semantic-cell-selection-lCYAVCCF.d.ts} +6 -24
- package/dist/{semantic-interaction-2vPh96Ey.d.ts → semantic-interaction-0vQXcMZk.d.ts} +2 -19
- package/dist/{semantic-paint-BEjYcsPK.d.ts → semantic-paint-BSan4pBk.d.ts} +10 -2
- package/dist/{semantic-records-Bc-MGXbM.d.ts → semantic-records-ZcYuB4-H.d.ts} +59 -13
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +49 -42
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-C71G7rIv.d.ts → tree-op-types-DbdM7fJV.d.ts} +84 -4
- package/dist/{tree-package-fragment-DRJkmfTW.d.ts → tree-package-fragment-1pdDnhZ_.d.ts} +491 -23
- package/dist/{tree-session-contract-Cp5W25RC.d.ts → tree-session-contract-Cgn6fQ-M.d.ts} +34 -9
- package/package.json +4 -4
- package/dist/chunk-27YEILW4.cjs +0 -20
- package/dist/chunk-4RDCLCLB.js +0 -2
- package/dist/chunk-7QG5FJ4X.js +0 -1
- package/dist/chunk-BML3CNUT.js +0 -2
- package/dist/chunk-CHRMIA3I.js +0 -20
- package/dist/chunk-FRRMJK2G.js +0 -5
- package/dist/chunk-G5GLQ4SX.cjs +0 -1
- package/dist/chunk-JP253KIZ.cjs +0 -2
- package/dist/chunk-JROG4U3Z.cjs +0 -21
- package/dist/chunk-MBXGQN6J.js +0 -1
- package/dist/chunk-MDMM3XVQ.js +0 -11
- package/dist/chunk-NPZX5O23.cjs +0 -2
- package/dist/chunk-OISZDVXT.cjs +0 -5
- package/dist/chunk-PRNYSOQL.cjs +0 -1
- package/dist/chunk-RXPOTTQQ.js +0 -21
- package/dist/chunk-T7JERNXT.cjs +0 -2
- package/dist/chunk-TDMGSCCL.cjs +0 -1
- package/dist/chunk-VYQTZIYH.js +0 -1
- package/dist/chunk-W7GY2IJC.js +0 -2
- package/dist/chunk-ZFBNCHRP.cjs +0 -11
- package/dist/hf-references-kSSFMq9X.d.ts +0 -70
- package/dist/tree-store-BRfhZceK.d.ts +0 -416
- /package/dist/{dist-OSUJGKTK.js → dist-PKZR6RSH.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {kd,Rd,ua,b,Na,vc,md,uc,ra,sd,nd,Qd,jd,I,fd,G,J,F,A,Q,Xd,fe,$d,be,ae}from'./chunk-72BDQFHY.js';import {Za,X,Y,Ga,Ca,Da,Ra,Na as Na$1}from'./chunk-4KMSEFIG.js';import {yb,Nf,Pd,sh,Ve,Va,fb,W,Ua,Ta,jb,ib,Sa,og,uh}from'./chunk-CJCFEXTA.js';var xt=Object.freeze({}),wt=Object.freeze([]);function bt(e){let t=Object.keys(e);if(t.length===0)return xt;let r={};for(let n of t){let o=e[n];o!==void 0&&(r[n]=o);}return Object.freeze(r)}function Pt(e){let t=new Map(Ve(e.part())),r=new Set([e.part()]);for(let o of e.headerFooterPartsBySection())for(let a of [o.headers,o.footers])for(let i of a.values())if(!r.has(i)){r.add(i);for(let[s,p]of Ve(i))t.has(s)||t.set(s,p);}let n=e.currentPackage();for(let o of ["footnote","endnote"]){let a=Nf(n,o);if(!(!a||r.has(a))){r.add(a);for(let[i,s]of Ve(a))t.has(i)||t.set(i,s);}}return t}function vt(e,t){let r=fe(e,t);if(!r)return null;let n=e.pages[r.pageIndex];if(!n)return null;let o=$d(n),a=be(e,t.paragraphId,r.pageIndex),i=Object.freeze({x:r.x+a.x,y:r.y+a.y,height:r.height});return Object.freeze({anchor:Object.freeze({...t}),pageIndex:r.pageIndex,pageContent:i,pageStack:Object.freeze({x:o.x+i.x,y:o.y+i.y})})}function St(e,t){let r=[];for(let n of t.values()){let o=vt(e,n);o&&r.push(o);}return r.length===0?wt:Object.freeze(r)}function Ue(e,t){return {documentMetadata:bt(e.documentProperties()),destinations:St(t,Pt(e))}}function ar(e,t){let r=e.destinations;if(r){for(let n of r)if(n.anchor.name===t)return n}}function Ye(e={}){return Object.freeze({async decode(t,r,n){let o=yb(t,r);if(!o)throw new Error(`Unsupported or malformed ${r} image`);if(o.pixelWidth>n.maxDimension||o.pixelHeight>n.maxDimension||o.pixelWidth>n.maxPixels/o.pixelHeight)throw new Error("Image dimensions exceed resource limits");return Object.freeze({pixelWidth:o.pixelWidth,pixelHeight:o.pixelHeight,dpiX:o.dpiX??96,dpiY:o.dpiY??96})},...e.convertPreserved?{convertPreserved:e.convertPreserved}:{}})}var Xe=new WeakMap,It=new Set(["shape","rect","roundrect","oval","line","group","arc","curve","polyline","image"]);function Rt(e){let t=Xe.get(e.root);if(t)return t;let r=new Set,n=[{node:e.root,scope:Va(),depth:0,mcSelected:false}],o=0;for(;n.length;){let{node:i,scope:s,depth:p,mcSelected:h}=n.pop();if(++o>fb||p>W){r.add("scan-limit");break}if(i.kind==="textValue")continue;if(o+n.length+i.children.length>fb){r.add("scan-limit");break}let y=Ua(s,i),c=Ta(i)?i:void 0;if(c){if(jb(c,y).drawing)continue;let l=ib(c,y);l.refused&&r.add("scan-limit"),l.branch&&n.push({node:l.branch,scope:y,depth:p+1,mcSelected:true});continue}if(!(!h&&Sa(i))){if(i.namespaceUri==="urn:schemas-microsoft-com:vml"&&i.localName==="textbox"){r.add("legacy-textbox");continue}i.namespaceUri==="urn:schemas-microsoft-com:vml"&&It.has(i.localName)&&!i.children.some(l=>l.kind!=="textValue"&&l.namespaceUri==="urn:schemas-microsoft-com:vml"&&l.localName==="textbox")&&r.add("legacy-drawing");for(let l of i.children)n.push({node:l,scope:y,depth:p+1,mcSelected:h});}}let a=Object.freeze([...r]);return Xe.set(e.root,a),a}function qe(e){let t=new Set([e.part()]);for(let r of e.headerFooterPartsBySection())for(let n of [r.headers,r.footers])for(let o of n.values())t.add(o);for(let r of ["footnote","endnote"]){let n=Nf(e.currentPackage(),r);n&&t.add(n);}return Object.freeze([...t].flatMap(r=>Rt(r).map(n=>Object.freeze({code:n,partName:r.name}))))}function Je(e){let t=e.defaultTabStopPt?.(),r=e.view.part().name,n={view:e.view,measurer:e.measurer,producer:e.producer,cache:e.cache,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:t,compatibilityMode:e.compatibilityMode?.(),inlineDrawingLayoutForPart:e.inlineDrawingLayoutForPart,drawingTokenForParagraphForPart:e.drawingTokenForParagraphForPart,drawingLayoutEpochForPart:e.drawingLayoutEpochForPart,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},o=kd(n),a={view:e.view,revision:e.revision,measurer:e.measurer,cache:e.cache,session:e.session,producer:e.producer,styleCascade:e.styleCascade,numberingIndex:e.numberingIndex,defaultTabStopPt:t,furniture:e.furniture,compatibilityMode:e.compatibilityMode,linkProjectors:e.linkProjectors,projectFieldLink:e.projectFieldLink,inlineDrawingLayout:e.inlineDrawingLayout,drawingTokenForParagraph:e.drawingTokenForParagraph,drawingLayoutEpoch:e.drawingLayoutEpoch,displayMode:e.displayMode,revisionAuthorFilter:e.revisionAuthorFilter},i={measurer:a.measurer,cache:a.cache,session:a.session,producer:a.producer,styleCascade:a.styleCascade?.(),defaultTabStopPt:a.defaultTabStopPt,compatibilityMode:a.compatibilityMode?.(),numberingIndex:a.numberingIndex?.(),sectionFurniture:a.furniture.sectionFurniture(),furniture:a.furniture.furniture(),projectLink:a.linkProjectors.projectLink,projectFieldLink:a.projectFieldLink,documentProperties:a.view.documentProperties(),inlineDrawingLayout:a.inlineDrawingLayout,drawingTokenForParagraph:a.drawingTokenForParagraph,drawingLayoutEpoch:a.drawingLayoutEpoch,projectionTokenForParagraph:s=>a.linkProjectors.tokenForParagraphForPart(r,s),projectionTokenForTable:s=>a.linkProjectors.tokenForTableForPart(r,s),projectionEpoch:a.linkProjectors.epochForPart(r),notes:o,displayMode:a.displayMode,revisionAuthorFilter:a.revisionAuthorFilter};return Rd(a.view.part(),a.revision,i)}var Ot=65536;function et(e,t){return {x:t.x-e.contentBox.x,y:t.y-e.contentBox.y}}function kt(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function Dt(e,t,r){return e.rootStory!==t?false:t==="footnote"||t==="endnote"?e.noteScopeId===r:true}function Et(e,t){if(t.story!=="textbox"||t.textboxPath.length===0)return null;let r=null;return F(e,n=>{if(r||!Dt(t,n.story,n.noteScopeId))return;let o=n.story==="header"||n.story==="footer"?a=>A(a,n.origin,{x:e.box.x,y:e.box.y}):void 0;J(n.host,(a,i)=>{if(r||i.textboxDepth===0)return;let s=i.textboxPath.map(p=>p.drawingNodeId);kt(s,t.textboxPath)&&(r=et(e,i.storyOrigin));},n.origin,o);}),r}function Mt(e,t){if(t.story==="textbox")return Et(e,t)??{x:0,y:0};switch(t.rootStory){case "body":return {x:0,y:0};case "header":return e.header?ae(e,e.header.box):{x:0,y:0};case "footer":return e.footer?ae(e,e.footer.box):{x:0,y:0};case "footnote":case "endnote":{let n=(t.rootStory==="footnote"?e.footnotes:e.endnotes)?.notes.find(o=>o.scopeId===t.noteScopeId);return n?ae(e,n.box):{x:0,y:0}}case "note-separator":{let r=t.noteAreaKind==="endnotes"?e.endnotes:e.footnotes;return r?.separator?ae(e,r.separator.box):{x:0,y:0}}default:return {x:0,y:0}}}function tt(e){return Object.freeze({x:e.x,y:e.y,width:e.width,height:e.height})}function rt(e,t){let r=$d(e);return Object.freeze({x:r.x+t.x,y:r.y+t.y,width:t.width,height:t.height})}function Lt(e,t){let r=fe(e,{paragraphId:t.source.start.paragraphId,offset:t.source.start.offset},{preferredPageIndex:t.pageIndex});if(!r||r.pageIndex!==t.pageIndex)return;let n=e.pages[r.pageIndex];if(!n)return;let o=Mt(n,t),a=Object.freeze([tt({x:r.x+o.x,y:r.y+o.y,width:0,height:r.height})]);return Object.freeze({pageContent:a,pageStack:Object.freeze(a.map(i=>rt(n,i)))})}function At(e,t,r){let n=r.filter(i=>i.pageIndex===t.pageIndex);if(n.length===0)return nt(t)?Lt(e,t):void 0;let o=e.pages[t.pageIndex];if(!o)return;let a=Object.freeze(n.map(i=>tt(i)));return Object.freeze({pageContent:a,pageStack:Object.freeze(a.map(i=>rt(o,i)))})}function nt(e){return e.source.start.paragraphId===e.source.end.paragraphId&&e.source.start.offset===e.source.end.offset}function Ze(e,t){return `${e}\0${t}`}function Tt(e,t,r){let n=Math.max(e.start,t.offset),o=Math.min(e.end,r.offset);return o>n?{start:n,end:o}:null}function Ft(e,t){let r=new Map,n=new Map,o=new Set,a=0;let i=(s,p)=>{if(a>=Ot)return false;a+=1;let h=Ze(s.pageIndex,p),y=n.get(h);return y?y.push(s):n.set(h,[s]),true};for(let[s,p]of t.entries())for(let[h,y]of p.occurrences.entries()){if(nt(y)||y.source.start.paragraphId!==y.source.end.paragraphId)continue;o.add(y.pageIndex);let c=`${s}\0${h}`,l={paragraphId:y.source.start.paragraphId,offset:y.source.start.offset},f={paragraphId:y.source.end.paragraphId,offset:y.source.end.offset},x=l.offset<=f.offset?{from:l,to:f}:{from:f,to:l};i({key:c,from:x.from,to:x.to,pageIndex:y.pageIndex},x.from.paragraphId);}if(n.size===0)return r;for(let s of e.pages)o.has(s.index)&&F(s,p=>{let h=p.story==="header"||p.story==="footer"?y=>A(y,p.origin,{x:s.box.x,y:s.box.y}):void 0;J(p.host,(y,c)=>{let l=et(s,c.storyOrigin);for(let f of y.lines)for(let x of Q(f)){let u=n.get(Ze(s.index,x.paragraphId));if(u)for(let g of u){let w=Tt(x,g.from,g.to);if(!w)continue;let b=Xd(f,w.start,void 0,x),v=Xd(f,w.end,void 0,x),R=r.get(g.key)??[];R.push({pageIndex:s.index,x:Math.min(b,v)+l.x,y:f.box.y+l.y,width:Math.abs(v-b),height:f.box.height}),r.set(g.key,R);}}},p.origin,h);});return r}function ot(e,t){let r=false;for(let o of t)if(o.occurrences.length!==0){r=true;break}if(!r)return t;let n=Ft(e,t);return t.map((o,a)=>{if(o.occurrences.length===0)return o;let i=o.occurrences.map((s,p)=>{let h=`${a}\0${p}`,y=At(e,s,n.get(h)??[]);return y?{...s,geometry:y}:s});return {...o,occurrences:Object.freeze(i)}})}function jt(e){let t=new Map,r=[{node:e.root,depth:0}];for(;r.length>0;){let{node:n,depth:o}=r.pop();if(!(n.kind==="textValue"||o>64)){n.kind==="paragraph"&&!t.has(n.id)&&t.set(n.id,t.size);for(let a=n.children.length-1;a>=0;a-=1)r.push({node:n.children[a],depth:o+1});}}return t}function at(){let e=new Map,t=n=>{let o=e.get(n.root);if(o)return o;let a=jt(n);return e.set(n.root,a),a},r={retainRevisionItems:false,revisionSites:uh,locations:Na$1,commentAnchors:og,deepOrder:t};return Object.freeze({collectReviewItems:n=>Ra(n,r),deepParagraphOrderOfPart:t})}function Nt(e,t){if(t)return true;let r=e.map(n=>n.root);for(;r.length>0;){let n=r.pop();if(sh(n))return true;if(n.kind!=="textValue")for(let o of n.children)r.push(o);}return false}function Ct(e,t){let r=[],n=new Set([t.name]),o=a=>{!a||n.has(a.name)||(n.add(a.name),r.push(a));};for(let a of Pd(e)){for(let i of a.headers.values())o(i);for(let i of a.footers.values())o(i);}return o(Nf(e,"footnote")),o(Nf(e,"endnote")),r}function _t(e,t){switch(t.story){case "body":return e.mainDocumentPart;case "header":case "footer":return t.host.partName;case "footnote":return Nf(e,"footnote")?.name??null;case "endnote":return Nf(e,"endnote")?.name??null;case "note-separator":return Nf(e,t.noteAreaKind==="footnotes"?"footnote":"endnote")?.name??null;default:return t}}function Bt(e,t){let r=new Map;for(let n of e){let o=t.get(n.partName),a=o?.get(n.start.paragraphId),i=o?.get(n.end.paragraphId);if(a===void 0||i===void 0)continue;let s=Math.min(a,i),p=Math.max(a,i),h=r.get(n.partName);r.set(n.partName,{lower:Math.min(h?.lower??s,s),upper:Math.max(h?.upper??p,p)});}return r}function Vt(e,t,r,n,o){let a=new Map(r.map(c=>[c.name,o(c)])),i=Bt(n,a),s=new Map,p=new Map,h=(c,l,f,x,u,g,w)=>{let b=a.get(c)?.get(u),v=i.get(c);if(b===void 0||!v||b<v.lower||b>v.upper)return;let R=s.get(c)??new Map;s.set(c,R);let V=p.get(c)??new Map;p.set(c,V);let C=JSON.stringify([l.story,l.noteScopeId,l.noteAreaKind]),Y=f==="textbox"?JSON.stringify([C,"textbox",x]):C,K=R.get(u)??[],z=`${u}\0${l.page.index}\0${Y}`,F=V.get(z);F||(F={pageIndex:l.page.index,story:f,rootStory:l.story,textboxPath:x,noteScopeId:l.noteScopeId,noteAreaKind:l.noteAreaKind,laneKey:Y,intervals:[],intervalKeys:new Set},V.set(z,F),K.push(F),R.set(u,K));let m=`${g}\0${w}`;F.intervalKeys?.has(m)||(F.intervalKeys?.add(m),F.intervals.push({start:g,end:w}));};G(e,c=>{let l=_t(t,c);!l||!i.has(l)||J(c.host,(f,x)=>{let u=x.textboxDepth>0?"textbox":c.story,g=x.textboxPath.map(b=>b.drawingNodeId),w=[];for(let b of f.lines){for(let v of b.spans)w.push(v.range);for(let v of b.drawings??[])w.push({paragraphId:v.paragraphId,start:v.start,end:v.start+1});}w.length===0&&w.push({paragraphId:f.range.paragraphId,start:f.range.start,end:f.range.end});for(let{paragraphId:b,start:v,end:R}of w)h(l,c,u,g,b,v,R);});}),I(e,c=>{let l=c.drawing.ownerPartName;i.has(l)&&h(l,c.root,c.story,c.textboxPath.map(f=>f.drawingNodeId),c.drawing.paragraphId,c.drawing.start,c.drawing.start+1);});for(let c of s.values())for(let l of c.values())for(let f of l){f.intervals.sort((u,g)=>u.start-g.start||u.end-g.end);let x=[];for(let u of f.intervals){let g=x.at(-1);g&&u.start<=g.end?g.end=Math.max(g.end,u.end):x.push({...u});}f.intervals.splice(0,f.intervals.length,...x),f.intervalKeys=void 0;}let y=new Map;for(let[c,l]of s){let f=a.get(c);if(!f)continue;let x=[];for(let[u,g]of l){let w=f.get(u);w!==void 0&&x.push({paragraphId:u,position:w,laneKeys:new Set(g.map(({laneKey:b})=>b))});}x.sort((u,g)=>u.position-g.position),y.set(c,x);}return {byPart:s,orderByPart:a,visibleByPart:y}}function it(e,t){let r=0,n=e.length;for(;r<n;){let o=r+n>>>1;e[o].position<t?r=o+1:n=o;}return r}function Kt(e,t){if(e.start.paragraphId===e.end.paragraphId)return [e.start.paragraphId];let r=t.orderByPart.get(e.partName),n=t.visibleByPart.get(e.partName),o=r?.get(e.start.paragraphId),a=r?.get(e.end.paragraphId);if(!r||!n||o===void 0||a===void 0)return [e.start.paragraphId,e.end.paragraphId];let i=Math.min(o,a),s=Math.max(o,a),p=new Set(t.byPart.get(e.partName)?.get(e.start.paragraphId)?.map(({laneKey:c})=>c)??[]),h=new Set(t.byPart.get(e.partName)?.get(e.end.paragraphId)?.map(({laneKey:c})=>c)??[]),y=new Set([...p].filter(c=>h.has(c)));return y.size===0?[e.start.paragraphId,e.end.paragraphId]:n.slice(it(n,i),it(n,s+1)).filter(c=>[...c.laneKeys].some(l=>y.has(l))).map(c=>c.paragraphId)}function zt(e,t,r,n){return n?e.intervals.filter(a=>a.start<=t&&t<a.end).length>0?[{start:t,end:t}]:[]:e.intervals.flatMap(o=>{if(o.start===o.end)return [];let a={start:Math.max(o.start,t),end:Math.min(o.end,r)};return a.end>a.start?[a]:[]})}function Wt(e,t){let r=Number.NEGATIVE_INFINITY;for(let n of e)for(let o of n.intervals)r=Math.max(r,o.end);return t!==r?new Set:new Set(e.filter(n=>n.intervals.some(o=>o.end===r)))}function st(e,t,r){let n=[],o=new Set;for(let[a,i]of e.entries()){let s=r===void 0?void 0:r===null?"neutral":a<r?"replaced":"replacement";for(let p of Kt(i,t)){let h=t.byPart.get(i.partName)?.get(p)??[],c=i.start.paragraphId===i.end.paragraphId&&i.start.offset===i.end.offset,l=p===i.start.paragraphId?i.start.offset:0,f=p===i.end.paragraphId?i.end.offset:Number.POSITIVE_INFINITY,x=c?Wt(h,l):new Set;for(let u of h){let g=zt(u,l,f,c);c&&g.length===0&&x.has(u)&&(g=[{start:l,end:l}]);for(let w of g){let b=`${u.pageIndex}\0${u.story}\0${u.noteScopeId??""}\0${u.noteAreaKind??""}\0${u.textboxPath.join("\0")}\0${i.partName}\0${p}\0${w.start}\0${w.end}\0${s??""}`;o.has(b)||(o.add(b),n.push({pageIndex:u.pageIndex,physicalPageNumber:u.pageIndex+1,story:u.story,rootStory:u.rootStory,textboxPath:u.textboxPath,noteScopeId:u.noteScopeId,noteAreaKind:u.noteAreaKind,...s?{revisionRole:s}:{},source:{partName:i.partName,start:{paragraphId:p,offset:w.start},end:{paragraphId:p,offset:w.end}}}));}}}}return n}function dt(e,t){let r=2166136261,n=2654435769;for(let o=0;o<t.length;o+=1){let a=t.charCodeAt(o);r=Math.imul(r^a,16777619)>>>0,n=Math.imul(n^a+o,2246822507)>>>0,n^=n>>>13;}return `${e}_${t.length.toString(36)}_${r.toString(36)}_${n.toString(36)}`}function ct(e,t,r=dt){let n=new Map;for(let a of t){let i=r(e,a),s=n.get(i)??new Set;s.add(a),n.set(i,s);}let o=new Map;for(let[a,i]of n){let s=[...i].sort();for(let[p,h]of s.entries())o.set(h,s.length===1?a:`${a}_${p.toString(36)}`);}return o}function $t(e){let t=new Set,r=new Set;for(let n of e){if(n.kind==="comment"){t.add(n.id),n.parentId!==void 0&&t.add(n.parentId),n.parentRevisionId!==void 0&&r.add(n.parentRevisionId);for(let o of n.replyIds)t.add(o);}if(n.kind==="revision"){r.add(n.id),n.pairedWith!==void 0&&r.add(n.pairedWith);for(let o of n.replyIds)t.add(o);}}return {comment:ct("comment",t),revision:ct("change",r)}}function B(e,t,r){return e.get(r)??dt(t,r)}function Ht(e,t,r){return e.kind==="revision"?{kind:"tracked-change",id:B(r.revision,"change",e.id),change:e.revisionKind,...e.markDirection?{markDirection:e.markDirection}:{},author:e.author,...e.date!==void 0?{date:e.date}:{},text:e.text,replacedText:e.replacedText,nesting:e.nesting,...e.replacedRangeCount!==void 0?{replacedRangeCount:e.replacedRangeCount}:{},readOnly:e.readOnly,...e.pairedWith!==void 0?{pairedWith:B(r.revision,"change",e.pairedWith)}:{},replyIds:e.replyIds.map(n=>B(r.comment,"comment",n)),occurrences:t?st(e.ranges,t,e.revisionKind==="replace"?e.replacedRangeCount??null:void 0):[]}:e.kind!=="comment"?null:{kind:"comment",id:B(r.comment,"comment",e.id),author:e.comment.author,initials:Da(e.comment),...e.comment.date!==void 0?{date:e.comment.date}:{},text:Ca(e.comment),resolved:e.resolved,...e.parentId!==void 0?{parentId:B(r.comment,"comment",e.parentId)}:{},...e.parentRevisionId!==void 0?{parentRevisionId:B(r.revision,"change",e.parentRevisionId)}:{},replyIds:e.replyIds.map(n=>B(r.comment,"comment",n)),orphaned:e.orphaned,occurrences:t&&e.range?st([e.range],t):[]}}function ut(e,t){let r=t.parts.get(t.mainDocumentPart);if(!r)return [];let n=Ct(t,r),o=[r,...n],a=t.parts.get(X(t,r.name));if(!Nt(o,a))return [];let i=at(),s=i.collectReviewItems({storyPart:r,furnitureParts:n,commentsPart:a,commentsExtendedPart:t.parts.get(Y(t,r.name))});if(s.length===0)return [];let p=s.flatMap(c=>Ga(c)),h=p.length>0?Vt(e,t,o,p,i.deepParagraphOrderOfPart):null,y=$t(s);return s.map(c=>Ht(c,h,y)).filter(c=>c!==null)}var Gt=new Set(["part","validatedHandle"]);function lt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function U(e,t,r,n,o){if(!(n!==void 0&&Gt.has(n))){if(typeof e=="function")throw new TypeError("Semantic layout publication encountered a function value");if(!(e===null||typeof e!="object")&&!o?.has(e)){if(r.has(e))throw new TypeError("Semantic layout publication encountered a cyclic record graph");if(!t.has(e)){t.add(e),r.add(e);try{if(Array.isArray(e)){for(let a of e)U(a,t,r,void 0,o);Object.freeze(e);return}if(!lt(e))throw new TypeError("Semantic layout publication encountered a non-record value");for(let a of Reflect.ownKeys(e)){let i=Object.getOwnPropertyDescriptor(e,a);if(i){if(!("value"in i))throw new TypeError("Semantic layout publication encountered an accessor property");U(i.value,t,r,a,o);}}Object.freeze(e);}finally{r.delete(e);}}}}}function pt(e){if(!lt(e))throw new TypeError("Semantic layout publication encountered a non-record value");let t=new Set;for(let n of e.pages)if(!(n===null||typeof n!="object"))for(let o of ["header","footer"]){let a=Object.getOwnPropertyDescriptor(n,o);if(!a||!("value"in a))continue;let i=a.value;if(i===null||typeof i!="object"||t.has(i))continue;let s=new Set;s.add(e),U(i,new Set,s,o),t.add(i);}let r=(n,o)=>{let a=new Set;for(let i of n){let s=new Set;s.add(e),U(i,a,s,void 0,o);}Object.freeze(n);};for(let n of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,n);if(!o)continue;if(!("value"in o))throw new TypeError("Semantic layout publication encountered an accessor property");if(n==="pages"&&Array.isArray(o.value)){r(o.value,t);continue}if(n==="reviewArtifacts"&&Array.isArray(o.value)){r(o.value);continue}let a=new Set;a.add(e),U(o.value,new Set,a,n);}return Object.freeze(e),e}var Ut=Object.freeze([]),k=class extends Error{constructor(r,n,o){super(n,o);this.code=r;this.name="ExportResourceError";}code};function Yt(e){try{return e instanceof k}catch{return false}}function Xt(e){try{return e instanceof fd}catch{return false}}function qt(e){try{return e instanceof Error&&typeof e.message=="string"&&e.message.length>0?e.message:null}catch{return null}}function Jt(e){if(Yt(e))return e;let t=Xt(e),r=qt(e),n=r?`: ${r}`:"",o=new k(t?"layoutInvariant":"layoutFailed",t?`Authored geometry could not be represented within the bounded page model${n}`:`Export layout failed${n}`);return Object.defineProperty(o,"cause",{configurable:true,value:e}),o}function Qt(e){if(e===void 0)return 6e4;if(!Number.isFinite(e)||e<=0)throw new RangeError("resourceTimeoutMs must be a positive finite number");return Math.max(1,e)}function mt(e){if(e==="all-markup"||e==="proposed"||e==="original")return e;throw new RangeError("displayMode must be all-markup, proposed, or original")}var Zt=50,se=64;function er(e){switch(e.kind){case "pending":return true;case "ready":case "unrenderable":case "external":case "missing":return false;default:return e}}function tr(e){let t=false;return I(e,({drawing:r})=>{er(r.resource)&&(t=true);}),t}function yt(e){return !ArrayBuffer.isView(e)}function nn(e,t={}){if(t.signal?.aborted)return {ok:false,reason:"aborted"};let r=mt(t.displayMode??ua),n=yt(e),o=yt(e)?{ok:true,view:e}:Za(e);if(!o.ok)return o;let a=o.view,i=t.reuseAcrossRevisions??n,s=Qt(t.resourceTimeoutMs),p=t.measurer??b(),h=t.producer??(t.measurer?"host-export-measurer":"export-fixed-measurer"),y=Na({retainAcrossPasses:i}),c=0,l=new Set,f=()=>{c+=1;for(let m of l)m();l.clear();},x=vc({session:a,decodePort:t.imageDecodePort??Ye(t.convertPreservedImage?{convertPreserved:t.convertPreservedImage}:void 0),onResourcesChanged:f}),u={view:a,measurer:p,paragraphCache:y,sessions:new Map,completed:new Map,inFlight:new Map,styles:uc(a),fieldLinks:new Map,links:md(a),drawingBundle:x,furniture:new Map},g=new AbortController,w=t.signal,b$1=false,v=()=>b$1?new k("aborted","Export resource settlement was aborted"):new k("disposed","Export session has been disposed"),R=()=>{b$1=true,V();};function V(){let m=u;if(m){u=null,w?.removeEventListener("abort",R),g.abort(w?.reason),m.drawingBundle.dispose(),m.paragraphCache.clear();for(let P of m.completed.values())ra(P.internal),sd(P.internal);for(let P of m.fieldLinks.values())P.registry.clear();m.fieldLinks.clear(),m.completed.clear(),m.inFlight.clear(),m.furniture.clear(),m.sessions.clear(),f();}}w?.addEventListener("abort",R,{once:true}),w?.aborted&&R();let C=()=>{if(!u)throw v();if(g.signal.aborted)throw new k("aborted","Export resource settlement was aborted")},Y=(m,P,D,d)=>c!==m||u?.view.packageRevision()!==P||u?.view.currentPackage()!==D?Promise.resolve():(C(),new Promise((_,O)=>{let E=false,j,M=A=>{E||(E=true,j!==void 0&&clearTimeout(j),l.delete(L),g.signal.removeEventListener("abort",W),A?O(A):_());},L=()=>M(),W=()=>M(new k("aborted","Export resource settlement was aborted")),$=()=>{if(u?.view.packageRevision()!==P||u?.view.currentPackage()!==D){M();return}let A=d-Date.now();if(A<=0){M(new k("timedOut",`Image resources did not settle within ${s}ms`));return}j=setTimeout($,Math.min(Zt,A));};if(l.add(L),g.signal.addEventListener("abort",W,{once:true}),c!==m||u?.view.packageRevision()!==P||u?.view.currentPackage()!==D){M();return}$();})),K=async(m,P=0,D=Date.now()+s)=>{if(C(),Date.now()>=D)throw new k("timedOut",`Export layout did not stabilize within ${s}ms`);let d=u,_=D,O=d.view.packageRevision(),E=d.view.currentPackage(),j=d.completed.get(m);if(j&&j.revision===O&&j.pkg===E)return j.published;let M=()=>{if(d.view.packageRevision()===O&&d.view.currentPackage()===E)return null;if(P>=se-1)throw new k("nonConvergent","Document revision did not stabilize during export layout");return K(m,P+1,_)},L=d.fieldLinks.get(m);if(!L||L.revision!==O||L.pkg!==E){let I=L?.registry??nd();I.clear(),L={revision:O,pkg:E,registry:I},d.fieldLinks.set(m,L),d.furniture.delete(m);}let W=L.registry,$=d.sessions.get(m)??Qd();d.sessions.set(m,$);let A=d.furniture.get(m);A||(A=jd({view:d.view,measurer:d.measurer,producer:h,cache:d.paragraphCache,styleCascade:d.styles.styleCascade,numberingIndex:d.styles.numberingIndex,defaultTabStopPt:d.styles.defaultTabStopPt,compatibilityMode:d.styles.compatibilityMode,displayMode:m,revisionAuthorFilter:void 0,inlineDrawingLayoutForPart:I=>d.drawingBundle.contextForPart(I),drawingLayoutTokenForPart:I=>d.drawingBundle.cacheTokenForPart(I),drawingTokenForParagraphForPart:(I,ee)=>d.drawingBundle.drawingTokenForParagraph(ee,I),linkProjectors:d.links,projectFieldLink:I=>W.project(I)}),d.furniture.set(m,A));for(let I=0;I<se;I+=1){let ee=c;d.drawingBundle.sync(d.view);let ce=M();if(ce)return ce;let N=Je({view:d.view,revision:d.view.packageRevision(),measurer:d.measurer,cache:d.paragraphCache,session:$,producer:h,styleCascade:d.styles.styleCascade,defaultTabStopPt:d.styles.defaultTabStopPt,numberingIndex:d.styles.numberingIndex,furniture:A,compatibilityMode:d.styles.compatibilityMode,linkProjectors:d.links,projectFieldLink:S=>W.project(S),inlineDrawingLayout:d.drawingBundle.bodyContext,inlineDrawingLayoutForPart:S=>d.drawingBundle.contextForPart(S),drawingTokenForParagraph:S=>d.drawingBundle.drawingTokenForParagraph(S,d.view.part().name),drawingTokenForParagraphForPart:(S,X)=>d.drawingBundle.drawingTokenForParagraph(X,S),drawingLayoutEpoch:d.drawingBundle.cacheTokenForPart(d.view.part().name),drawingLayoutEpochForPart:S=>d.drawingBundle.cacheTokenForPart(S),displayMode:m,revisionAuthorFilter:void 0});if(!tr(N)){let S=M();if(S)return S;i||(ra(N),sd(N),d.paragraphCache.clear(),d.sessions.delete(m),d.furniture.delete(m));let X=ut(N,E),ft=X.length===0?Ut:Object.freeze(ot(N,X)),gt=Ue(d.view,N),ht={...N,...gt,contentWarnings:qe(d.view),reviewArtifacts:ft},le=pt(ht);return d.completed.set(m,{revision:O,pkg:E,internal:N,published:le}),le}let de=ee;for(;d.drawingBundle.pendingResourceCount()>0;){await Y(de,O,E,_),de=c,C();let S=M();if(S)return S}C();let ue=M();if(ue)return ue}throw new k("nonConvergent",`Image resources did not reach quiescence after ${se} layout passes`)},z=m=>{let P;try{P=mt(m);}catch(O){return Promise.reject(O)}if(!u)return Promise.reject(v());let D=u,d=D.inFlight.get(P);if(d)return d;let _=K(P).catch(O=>{throw Jt(O)}).finally(()=>D.inFlight.delete(P));return D.inFlight.set(P,_),_};return {ok:true,session:{layout:()=>z(r),layoutFor:z,validatedImageBytes(m){let P=u;return !P||m.resource.kind!=="ready"?null:P.drawingBundle.mintValidatedBytes(m.resource.validatedHandle,m.resource.contentId)?.slice()??null},dispose:V}}}export{Je as a,ar as b,Ye as c,k as d,nn as e};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
'use strict';var chunkLQ6XWTKQ_cjs=require('./chunk-LQ6XWTKQ.cjs'),chunkMDP5SNK4_cjs=require('./chunk-MDP5SNK4.cjs'),chunk77DD4EBC_cjs=require('./chunk-77DD4EBC.cjs');var nr=Symbol("validated-resolved-font"),rr=4,ee=64*1024*1024,D=256,W=128*1024*1024,j=class extends Error{name="FontResolutionError";request;code;limit;actual;diagnostic;expectedHash;actualHash;constructor(t,n,r={}){super(`Font resolution failed (${t}) for ${V(n)}`),this.code=t,this.request=K(n),this.limit=r.limit,this.actual=r.actual,this.diagnostic=r.diagnostic,this.expectedHash=r.expectedHash,this.actualHash=r.actualHash;}},Gt=e=>{if(e.family.trim().length===0)throw new TypeError("Font family must not be empty");if(!Number.isInteger(e.weight)||e.weight<1||e.weight>1e3)throw new RangeError("Font weight must be an integer from 1 through 1000");if(e.style!=="normal"&&e.style!=="italic")throw new TypeError("Font style must be normal or italic")},K=e=>(Gt(e),Object.freeze({family:e.family,weight:e.weight,style:e.style})),Ye=e=>{let t={family:e.family,weight:e.weight,style:e.style};return K(t)},Ht=Symbol("prepared-font-resource"),$e=new WeakMap,or=new Uint8Array(0),jt=Object.getPrototypeOf(Uint8Array.prototype),ar=Object.getOwnPropertyDescriptor(jt,"length").get,ir=Object.getOwnPropertyDescriptor(jt,"byteLength").get;function te(e){if(!ArrayBuffer.isView(e))throw new TypeError("Font bytes must be a genuine byte array");let t,n;try{t=ar.call(e),n=ir.call(e);}catch{throw new TypeError("Font bytes must be a genuine byte array")}if(t!==n)throw new TypeError("Font bytes must use one-byte elements");return n}function Wt(e){let t=new Uint8Array(te(e));return Uint8Array.prototype.set.call(t,e),t}function Vt(e,t){let n=K(e.request);if(e.availability==="forbidden"){let s=Object.freeze({...e,request:n,actualHash:null,[Ht]:true});return $e.set(s,null),s}let r=Wt(e.bytes);t?.onOwnedByteCopy?.(),t?.onHash?.();let o=chunk77DD4EBC_cjs.a(r),a=Object.freeze({...e,request:n,bytes:r,actualHash:o,[Ht]:true});return $e.set(a,o),a}function ne(e){return $e.get(e)}var Kt=e=>{if(!Number.isFinite(e.heightEm)||!Number.isFinite(e.baselineEm)||e.heightEm<=0||e.heightEm>rr||e.baselineEm<0||e.baselineEm>e.heightEm)throw new RangeError("Font substitution line metrics must fit within a bounded em box");return Object.freeze({heightEm:e.heightEm,baselineEm:e.baselineEm})},V=e=>(Gt(e),JSON.stringify([e.family.trim().toLowerCase(),e.weight,e.style])),Ze=class{[nr]=true;id;identity;request;family;byteLength;hash;faceIndex;substitution;constructor(t,n){if(t.id.length===0)throw new TypeError("Resolved font id must not be empty");if(!Number.isInteger(t.faceIndex)||t.faceIndex<0)throw new RangeError("Font face index must be a non-negative integer");this.id=t.id,this.request=K(t.request),this.family=this.request.family,this.hash=t.hash,this.faceIndex=t.faceIndex,this.identity=`${this.hash}#${this.faceIndex}`,this.byteLength=t.byteLength,this.substitution=null,n&&(this.substitution=Object.freeze({requested:K(n.requested),resolved:K(n.resolved),...n.lineMetrics?{lineMetrics:Kt(n.lineMetrics)}:{}})),Object.freeze(this);}get bytes(){return Oe(this).slice()}},Xt=new WeakSet,qt=new WeakMap,Yt=new WeakMap,$t=(e,t,n,r)=>{let o=new Ze(e,r);return qt.set(o,t),Yt.set(o,n),Xt.add(o),o},Oe=e=>{re(e);let t=qt.get(e);if(!t)throw new TypeError("Resolved font has no owned byte capability");return t},Ie=e=>{re(e);let t=Yt.get(e);if(!t)throw new TypeError("Resolved font has no admitted table metadata");return t},re=e=>{if(typeof e!="object"||e===null||!Xt.has(e))throw new TypeError("Shaping requires a validated resolved font")},Zt=(e,t)=>e[t]<<8|e[t+1],Q=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Ut=(e,t)=>{if(t>e.byteLength-12)return {valid:false,diagnostic:"truncated sfnt header"};let n=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if(!(e[t]===0&&e[t+1]===1&&e[t+2]===0&&e[t+3]===0)&&n!=="OTTO"&&n!=="true"&&n!=="typ1")return {valid:false,diagnostic:"unsupported sfnt signature"};let o=Zt(e,t+4),a=t+12+o*16;if(!Number.isSafeInteger(a)||a>e.byteLength)return {valid:false,diagnostic:"truncated sfnt table directory"};for(let s=0;s<o;s+=1){let l=t+12+s*16,i=Q(e,l+8),d=Q(e,l+12);if(i>e.byteLength||d>e.byteLength-i)return {valid:false,diagnostic:"sfnt table range exceeds font bytes"}}return {valid:true}},sr=(e,t)=>{let r=String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?Q(e,12+t*4):0,o=Zt(e,r+4),a=new Set;for(let s=0;s<o;s+=1){let l=r+12+s*16;a.add(String.fromCharCode(e[l],e[l+1],e[l+2],e[l+3]));}return Object.freeze(a)},Te=(e,t)=>{if(!Number.isSafeInteger(t)||t<0)return {valid:false,diagnostic:"invalid font face index"};if(e.byteLength<12)return {valid:false,diagnostic:"truncated sfnt header"};if(String.fromCharCode(e[0],e[1],e[2],e[3])!=="ttcf")return t!==0?{valid:false,diagnostic:"standalone sfnt has only face index zero"}:Ut(e,0);let r=Q(e,4);if(r!==65536&&r!==131072)return {valid:false,diagnostic:"unsupported TTC version"};let o=Q(e,8),a=12+o*4;if(o===0||!Number.isSafeInteger(a)||a>e.byteLength||t>=o)return {valid:false,diagnostic:"invalid TTC face directory"};let s=Q(e,12+t*4);return s<a?{valid:false,diagnostic:"invalid TTC face offset"}:Ut(e,s)},lr=(e,t,n,r)=>{if(e.availability==="forbidden")return {kind:"forbidden"};let o=te(e.bytes);if(o>t)return {kind:"overLimit",actual:o};let a=ne(e),s=a===void 0?Wt(e.bytes):e.bytes;a===void 0&&r?.onOwnedByteCopy?.(),a===void 0&&r?.onHash?.();let l=a??chunk77DD4EBC_cjs.a(s);if(e.hash!==l)return {kind:"hashMismatch",expectedHash:e.hash,actualHash:l};let i=Te(s,e.faceIndex);if(!i.valid)return {kind:"malformed",diagnostic:i.diagnostic};r?.onTableScan?.();let d=sr(s,e.faceIndex);try{let f=n(s,e.faceIndex);if(!f.valid)return {kind:"malformed",diagnostic:f.diagnostic}}catch(f){return {kind:"malformed",diagnostic:f instanceof Error?f.message:"font validator threw"}}let c={kind:"resolved",font:$t({...e,byteLength:s.byteLength},s,d)};return r?.onAdmission?.(),c},Je=e=>{let t=e.epoch,n=e.maxFontBytes,r=e.validateFont,o=e.instrumentation,a=e.resources,s=e.substitutions;if(!Number.isSafeInteger(t)||t<0)throw new RangeError("Font resource epoch must be a non-negative safe integer");if(!Number.isSafeInteger(n)||n<=0||n>ee)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${ee}`);if(typeof r!="function")throw new TypeError("Font snapshot requires a validator");let l=a.length,i=s?.length??0;if(l>D)throw new RangeError(`Font source count must not exceed ${D}`);if(i>D)throw new RangeError(`Font substitution count must not exceed ${D}`);let d=0,c=[];for(let m=0;m<l;m+=1){let u=a[m];if(ne(u)!==void 0){let v=u.availability==="forbidden"?0:te(u.bytes);if(v>W-d)throw new RangeError(`Aggregate font bytes must not exceed ${W}`);d+=v,c.push(u);continue}let g=Ye(u.request),y=u.id,E=u.hash,F=u.faceIndex,T=u.availability,h=T==="forbidden"?or:u.bytes,p=T==="forbidden"?0:te(h);if(p>W-d)throw new RangeError(`Aggregate font bytes must not exceed ${W}`);d+=p,c.push(Object.freeze({request:g,id:y,bytes:h,hash:E,faceIndex:F,...T?{availability:T}:{}}));}let f=[];if(s)for(let m=0;m<i;m+=1){let u=s[m],g=Ye(u.from),y=Ye(u.to),E=u.lineMetrics;f.push(Object.freeze({from:g,to:y,...E?{lineMetrics:Object.freeze({heightEm:E.heightEm,baselineEm:E.baselineEm})}:{}}));}let S=new Map;for(let m of c){let u=V(m.request);S.has(u)||S.set(u,lr(m,n,r,o));}let b=new Map;for(let m of f){let u=V(m.from);b.has(u)||b.set(u,Object.freeze({to:K(m.to),...m.lineMetrics?{lineMetrics:Kt(m.lineMetrics)}:{}}));}return Object.freeze({epoch:t,resolve:m=>{let u=K(m),g=V(u),y=b.get(g),E=y?.to??u,F=S.get(V(E));return F?F.kind==="forbidden"?new j("forbidden",u):F.kind==="overLimit"?new j("overLimit",u,{limit:n,actual:F.actual}):F.kind==="malformed"?new j("malformed",u,{diagnostic:F.diagnostic}):F.kind==="hashMismatch"?new j("hashMismatch",u,{expectedHash:F.expectedHash,actualHash:F.actualHash}):y?$t({request:F.font.request,id:F.font.id,hash:F.font.hash,faceIndex:F.font.faceIndex,byteLength:F.font.byteLength},Oe(F.font),Ie(F.font),{requested:u,resolved:y.to,...y.lineMetrics?{lineMetrics:y.lineMetrics}:{}}):F.font:new j("missing",u)}})};var M=e=>{if(!Number.isSafeInteger(e))throw new RangeError("Fixed-point value must be a safe integer");return e},Le=(e,t)=>{if(e.trim().length===0||/[\u0000-\u001f\u007f]/.test(e))throw new TypeError(`${t} must be non-blank and contain no control characters`)},dr=(e,t)=>{if(!/^[\x20-\x7e]{4}$/.test(e))throw new TypeError(`${t} must be a four-byte ASCII tag`)},Jt=(e,t,n)=>{let r=Object.entries(e).sort(([a],[s])=>a<s?-1:a>s?1:0),o=Object.create(null);for(let[a,s]of r){if(dr(a,`${t} key`),!Number.isFinite(s)||n&&(!Number.isSafeInteger(s)||s<0))throw new RangeError(`${t} value must be ${n?"a non-negative safe integer":"finite"}`);if(n&&s>4294967295)throw new RangeError(`${t} value must fit an unsigned 32-bit integer`);o[a]=s;}return Object.freeze(o)},Qe=e=>Object.freeze({family:e.family,weight:e.weight,style:e.style}),cr=e=>e?Object.freeze({requested:Qe(e.requested),resolved:Qe(e.resolved),...e.lineMetrics?{lineMetrics:Object.freeze({...e.lineMetrics})}:{}}):void 0,Qt=new WeakSet,tt=e=>{if(re(e),!Qt.has(e)){if(e.identity!==`${e.hash}#${e.faceIndex}`)throw new TypeError("Resolved font identity does not match hash and face index");if(!Number.isSafeInteger(e.byteLength)||e.byteLength<0)throw new TypeError("Resolved font byte length is invalid");Qt.add(e);}},et=e=>(tt(e),e),Ae=e=>(tt(e),Object.freeze({identity:e.identity,id:e.id,family:e.family,request:Qe(e.request),hash:e.hash,faceIndex:e.faceIndex,byteLength:e.byteLength,substitution:cr(e.substitution)??null})),Y=e=>{if(Le(e.shapingLibrary.name,"shaping library name"),Le(e.shapingLibrary.version,"shaping library version"),Le(e.unicodeDataVersion,"Unicode data version"),!/^\d+(?:\.\d+){0,3}(?:[-+][0-9A-Za-z.-]+)?$/.test(e.shapingLibrary.version))throw new TypeError("shaping library version must be a numeric version");if(!/^\d+(?:\.\d+){1,2}$/.test(e.unicodeDataVersion))throw new TypeError("Unicode data version must be a dotted numeric version");if(!/^[A-Z][a-z]{3}$/.test(e.script))throw new TypeError("script must be a four-letter ISO 15924 code");if(Le(e.language,"language"),!/^(?:und|[A-Za-z]{2,8})(?:-[A-Za-z0-9]{1,8})*$/.test(e.language))throw new TypeError("language must be a BCP 47 language tag");if(e.direction!=="ltr"&&e.direction!=="rtl")throw new TypeError("direction must be ltr or rtl");if(!["none","NFC","NFD","NFKC","NFKD"].includes(e.normalization))throw new TypeError("invalid normalization policy");if(!["halfAwayFromZero","halfToEven","towardZero"].includes(e.roundingMode))throw new TypeError("invalid fixed-point rounding mode");if(!Number.isSafeInteger(e.fixedPointScale)||e.fixedPointScale<=0)throw new RangeError("fixed-point scale must be a positive safe integer");let t=et(e.font),n=e.fallbackOrder.map(et),r=new Set;for(let o of n){let a=JSON.stringify(Ae(o));if(r.has(a))throw new TypeError("fallback order contains a duplicate font");r.add(a);}return Object.freeze({font:t,variationAxes:Jt(e.variationAxes,"variation axis",false),shapingLibrary:Object.freeze({name:e.shapingLibrary.name,version:e.shapingLibrary.version}),unicodeDataVersion:e.unicodeDataVersion,normalization:e.normalization,script:e.script,language:e.language,direction:e.direction,features:Jt(e.features,"OpenType feature",true),fallbackOrder:Object.freeze([...n]),fixedPointScale:e.fixedPointScale,roundingMode:e.roundingMode})},tn=e=>{let t=Y(e);return Object.freeze({font:Ae(t.font),variationAxes:Object.freeze(Object.entries(t.variationAxes).map(n=>Object.freeze(n))),shapingLibrary:Object.freeze({name:t.shapingLibrary.name,version:t.shapingLibrary.version}),unicodeDataVersion:t.unicodeDataVersion,normalization:t.normalization,script:t.script,language:t.language,direction:t.direction,features:Object.freeze(Object.entries(t.features).map(n=>Object.freeze(n))),fallbackOrder:Object.freeze(t.fallbackOrder.map(Ae)),fixedPointScale:t.fixedPointScale,roundingMode:t.roundingMode})},nt=e=>JSON.stringify(tn(e)),q=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},A=e=>{try{return M(e)}catch{throw new RangeError("Shaped run contains a non-integer fixed-point value")}},en=new WeakMap,Be=e=>{let t=en.get(e);if(t)return t;tt(e);let n=JSON.stringify({identity:e.identity,id:e.id,family:e.family,request:e.request,hash:e.hash,faceIndex:e.faceIndex,byteLength:e.byteLength,substitution:e.substitution??null});return en.set(e,n),n},Pe=(e,t)=>{let n=Y(t);if(e.direction!=="ltr"&&e.direction!=="rtl")throw new TypeError("Shaped run direction must be ltr or rtl");if(e.direction!==n.direction)throw new TypeError("Shaped run direction does not match shaping environment");if(q(e.bidiLevel,"bidi level"),(e.bidiLevel&1)===1!=(e.direction==="rtl"))throw new TypeError("Shaped run direction does not match bidi level parity");let r=new Map,o=e.glyphs.map(i=>{q(i.id,"glyph id"),q(i.cluster,"glyph cluster");let d=r.get(i.outline);if(!d){if(!Number.isSafeInteger(i.outline.unitsPerEm)||i.outline.unitsPerEm<=0)throw new RangeError("Glyph outline units per em must be a positive safe integer");d=Object.isFrozen(i.outline)?i.outline:Object.freeze({path:i.outline.path,unitsPerEm:i.outline.unitsPerEm}),r.set(i.outline,d);}return Object.freeze({id:i.id,cluster:i.cluster,originX:A(i.originX),originY:A(i.originY),advanceX:A(i.advanceX),advanceY:A(i.advanceY),offsetX:A(i.offsetX),offsetY:A(i.offsetY),outline:d})}),a=e.fontSpans.map(i=>{if(q(i.glyphStart,"font span start"),q(i.glyphEnd,"font span end"),i.glyphEnd<=i.glyphStart||i.glyphEnd>o.length)throw new RangeError("Font span glyph range is invalid");i.fallbackIndex!==null&&q(i.fallbackIndex,"fallback index");let d=et(i.font);if(i.fallbackIndex===null){if(Be(d)!==Be(n.font))throw new TypeError("Shaped primary font does not match shaping environment")}else {let c=n.fallbackOrder[i.fallbackIndex];if(!c)throw new RangeError("Shaped fallback index is outside fallback order");if(Be(d)!==Be(c))throw new TypeError("Shaped fallback font does not match shaping environment provenance")}return Object.freeze({...i,font:d})});for(let i=0;i<a.length;i+=1){let d=i===0?0:a[i-1].glyphEnd;if(a[i].glyphStart!==d)throw new RangeError("Font spans must cover glyphs contiguously")}if(o.length===0&&a.length!==0||o.length>0&&a.at(-1)?.glyphEnd!==o.length)throw new RangeError("Font spans must cover every glyph exactly once");let s=e.clusters.map(i=>{for(let[c,f]of [["cluster text start",i.textStart],["cluster text end",i.textEnd],["cluster glyph start",i.glyphStart],["cluster glyph end",i.glyphEnd],["cluster font span",i.fontSpan]])q(f,c);if(i.textEnd<=i.textStart||i.textEnd>e.text.length||i.glyphEnd<=i.glyphStart||i.glyphEnd>o.length)throw new RangeError("Shaped cluster range is invalid");let d=a[i.fontSpan];if(!d||i.glyphStart<d.glyphStart||i.glyphEnd>d.glyphEnd)throw new RangeError("Shaped cluster does not belong to its declared font span");return Object.freeze({...i,advance:A(i.advance),caretEdges:Object.freeze(i.caretEdges.map(A))})}),l=Object.freeze({ascent:A(e.metrics.ascent),descent:A(e.metrics.descent),lineGap:A(e.metrics.lineGap)});return Object.freeze({text:e.text,direction:e.direction,bidiLevel:e.bidiLevel,glyphs:Object.freeze(o),clusters:Object.freeze(s),fontSpans:Object.freeze(a),metrics:l})},ur=(e,t)=>{let n=Pe(e,t);return Object.freeze({text:n.text,direction:n.direction,script:t.script,language:t.language,bidiLevel:n.bidiLevel,glyphs:n.glyphs,clusters:n.clusters,fontSpans:Object.freeze(n.fontSpans.map(r=>Object.freeze({glyphStart:r.glyphStart,glyphEnd:r.glyphEnd,fallbackIndex:r.fallbackIndex,font:Ae(r.font)}))),metrics:n.metrics})};function ae(e){try{let t=new URL(e);return t.username!==""||t.password!==""||t.search!==""||t.hash!==""?`${t.protocol}//${t.host}${t.pathname}\u2026`:e}catch{let t=e.search(/[?#]/);return t===-1?e:`${e.slice(0,t)}\u2026`}}function nn(e){return e.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s"')]+/gi,t=>ae(t))}function yr(e){if(typeof e!="string"&&!(e instanceof URL))throw new TypeError(`setHarfBuzzWasmUrl: expected a string or URL, received ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new TypeError("setHarfBuzzWasmUrl: expected a non-empty URL");throw new Error("setHarfBuzzWasmUrl is not supported by the CommonJS build, which loads the shaper from node_modules and finds its binary on disk. Import the ESM build instead.");}function rn(e){return e instanceof Error&&/process\.getBuiltinModule/.test(e.message)}function on(e){return `the text shaper cannot start on this Node version: the ESM build reaches Node builtins through \`process.getBuiltinModule\`, added in Node 20.16.0 and 22.3.0. Upgrade Node; \`setHarfBuzzWasmUrl\` does not apply here. (${nn(e instanceof Error?e.message:String(e))})`}function an(e){let t=nn(e instanceof Error?e.message:String(e));return `the HarfBuzz WASM binary could not be loaded from ${"its bundled location"}. If this bundler does not emit \`new URL(..., import.meta.url)\` assets (esbuild, Bun, and library builds that inline dynamic imports), serve \`@docx-editor.dev/core/harfbuzz.wasm\` yourself, point \`setHarfBuzzWasmUrl\` from '@docx-editor.dev/core/layout' at it before creating an editor, and reload the page. (${t})`}function sn(e,t){let n=`expected HarfBuzz ${e}, loaded ${t}`;return `${n}. The bundled binary does not match this build of the engine.`}var $=Object.freeze({name:"HarfBuzz",version:"14.4.0"}),fe=null,ue=null;function ot(){return fe?Promise.resolve():ue||(ue=import('harfbuzzjs').then(e=>{let t=e.versionString();if(t!==$.version)throw new w("shapingLibraryMismatch",{diagnostic:sn($.version,t)});fe=e;}).catch(e=>{throw ue=null,e instanceof w?e:rn(e)?new w("unsupportedRuntime",{diagnostic:on(e),cause:e}):new w("wasmUnavailable",{diagnostic:an(e),cause:e})}),ue)}function hr(){return fe!==null}function mr(){if(!fe)throw new w("notInitialized",{diagnostic:"Call initializeHarfBuzz() before creating a text shaper"});return fe}var w=class extends Error{name="HarfBuzzShapingError";code;limit;actual;diagnostic;constructor(t,n={}){super(`HarfBuzz shaping failed (${t})`,{cause:n.cause}),this.code=t,this.limit=n.limit,this.actual=n.actual,this.diagnostic=n.diagnostic;}},gr=16*1024*1024,br=1e6,Sr=1e6,xr=1e6,Rr=4,Fr=512,vr=1024*1024,Er=16*1024*1024,Cr=32*1024*1024,wr=64*1024*1024,Or=64*1024*1024,Ir=1e6,Tr=1e6,Lr=1e6,Br=64,Ar=4096,Pr=4*1024*1024,_r=64*1024*1024,Mr=64*1024*1024,zr=256*1024*1024,Nr=new Set(["COLR","CPAL","CBDT","CBLC","sbix","SVG "]),ln=["cmap","head","hhea","hmtx","maxp"],kr=(e,t)=>e[t]<<8|e[t+1],Dr=(e,t)=>e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]>>>0,Hr=(e,t)=>String.fromCharCode(e[0],e[1],e[2],e[3])==="ttcf"?Dr(e,12+t*4):0,Ur=(e,t)=>{let n=Hr(e,t),r=kr(e,n+4),o=new Set;for(let a=0;a<r;a+=1){let s=n+12+a*16;o.add(String.fromCharCode(e[s],e[s+1],e[s+2],e[s+3]));}return o},Gr=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),jr=(e,t)=>{let n=Te(e,t);if(!n.valid)return n;let r=Ur(e,t);for(let o of ln)if(!r.has(o))return {valid:false,diagnostic:`missing required ${o} table`};return {valid:true}},at=jr,z=(e,t,n)=>{if(!Number.isSafeInteger(e)||e<=0||e>n)throw new RangeError(`${t} must be a positive safe integer no greater than ${n}`);return e},Wr=(e,t,n)=>{let r=e<0n,o=r?-e:e,a=o/t,s=o%t;if(n!=="towardZero"){let d=s*2n;(d>t||d===t&&(n==="halfAwayFromZero"||n==="halfToEven"&&a%2n!==0n))&&(a+=1n);}let l=r?-a:a,i=Number(l);if(!Number.isSafeInteger(i))throw new RangeError("Shaped fixed-point value exceeds the safe integer range");return i},dn=(e,t,n,r)=>{if(!Number.isSafeInteger(e))throw new RangeError("font units must be a safe integer");if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("fixed-point denominator must be a positive safe integer");if(!Number.isSafeInteger(n)||n<0)throw new RangeError("fixed-point numerator must be a non-negative safe integer");return M(Wr(BigInt(e)*BigInt(n),BigInt(t),r))},Vr=(e,t,n,r)=>{if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("font size must be a positive integer number of half points");if(t>Math.floor(Number.MAX_SAFE_INTEGER/n))throw new RangeError("font size and fixed-point scale product exceeds the safe integer range");let o=t*n,a=e*2;return s=>dn(s,a,o,r)},Kr=(e,t)=>{if(t.length===0)return [];let n=[...new Set(t.map(s=>s.cluster))].sort((s,l)=>s-l),r=new Map;for(let s=0;s<n.length;s+=1)r.set(n[s],n[s+1]??e.length);let o=[],a=0;for(;a<t.length;){let s=t[a].cluster,l=a+1;for(;l<t.length&&t[l].cluster===s;)l+=1;let i=t.slice(a,l).reduce((c,f)=>c+f.advanceX,0),d=M(i);o.push({textStart:s,textEnd:r.get(s),glyphStart:a,glyphEnd:l,advance:d,caretEdges:Object.freeze([M(0),d]),fontSpan:0}),a=l;}return o},N=64,H=8,Z=8,Xr=32,cn=N+2*H,qr=N+H+Z,Yr=N+H+Z,$r=N+H+Z,un=N+8*H,pn=N+8*Z+H,Zr=N+6*Z+H,Jr=N+3*Z+2*H,Qr=N+3*Z,ye=e=>N+e.length*Uint16Array.BYTES_PER_ELEMENT,it=e=>$r+ye(e),pe=e=>Xr+e*H,eo=(e,t)=>cn+ye(e)+qr+it(t),to=e=>un+ye(e)+pe(e.length)+e.length*pn,no=e=>{let t=new Set(e.glyphs.map(n=>n.outline));return un+ye(e.text)+pe(e.glyphs.length)+e.glyphs.length*pn+pe(e.clusters.length)+e.clusters.length*Zr+e.clusters.reduce((n,r)=>n+pe(r.caretEdges.length),0)+pe(e.fontSpans.length)+e.fontSpans.length*Jr+Qr+[...t].reduce((n,r)=>n+it(r.path),0)},ro=(e,t)=>cn+ye(e)+Yr+t,rt=class{#t;#c;#u;#p;#f;#g;#b;#y;#h;#s;#m;#l;#e;#o=new Map;#a=new Map;#n=new Map;#i=0;#r=0;#d;constructor(t,n){this.#t=t,this.#c=z(n.maxFontBytes??gr,"maximum font bytes",Or),this.#u=z(n.maxInputUtf16??br,"maximum input UTF-16 code units",Ir),this.#p=z(n.maxCodepoints??Sr,"maximum input code points",Tr),this.#f=z(n.maxGlyphs??xr,"maximum shaped glyphs",Lr),this.#g=z(n.maxCachedFaces??Rr,"maximum cached faces",Br),this.#b=z(n.maxCachedShapes??Fr,"maximum cached shape results",Ar),this.#y=z(n.maxOutlineBytes??vr,"maximum outline bytes",Pr),this.#h=z(n.maxCachedOutlineBytes??Er,"maximum cached outline bytes",_r),this.#s=z(n.maxShapedRunBytes??Cr,"maximum shaped run bytes",Mr),this.#m=z(n.maxCachedShapeBytes??wr,"maximum cached shape bytes",zr),this.#l=n.instrumentation?.onFaceCacheEvent,this.#e=n.instrumentation,this.#d=new this.#t.Buffer;}dispose(){this.#o.clear(),this.#a.clear(),this.#n.clear(),this.#i=0,this.#r=0,this.#e?.onOutlineCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#e?.onShapeCacheEvent?.(Object.freeze({kind:"cleared",retainedBytes:0})),this.#d=void 0;}#x(t,n){let r=this.#o.get(t.identity);if(r)return this.#o.delete(t.identity),this.#o.set(t.identity,r),this.#l?.(Object.freeze({kind:"hit",identity:t.identity})),r;let o=Ie(t);for(let c of ln)if(!o.has(c))throw new w("malformedFont",{diagnostic:`missing required ${c} table`});this.#e?.onByteCopy?.();let a=new this.#t.Blob(Gr(n)),s=new this.#t.Face(a,t.faceIndex),l=new this.#t.Font(s),i=l.hExtents();if(!Number.isSafeInteger(s.upem)||s.upem<=0||!Number.isSafeInteger(i.ascender)||!Number.isSafeInteger(i.descender)||!Number.isSafeInteger(i.lineGap))throw new w("malformedFont",{diagnostic:"invalid font units or horizontal metrics"});if(l.setScale(s.upem,s.upem),this.#o.size>=this.#g){let c=this.#o.keys().next().value;c!==void 0&&(this.#o.delete(c),this.#l?.(Object.freeze({kind:"evicted",identity:c})));}let d={identity:t.identity,blob:a,face:s,font:l,unitsPerEm:s.upem};return this.#o.set(t.identity,d),this.#l?.(Object.freeze({kind:"created",identity:t.identity})),d}#R(t,n,r){let o=JSON.stringify([t.identity,t.unitsPerEm,r,n]),a=this.#a.get(o);if(a)return this.#a.delete(o),this.#a.set(o,a),this.#e?.onOutlineCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#i})),a.outline;this.#e?.onOutlinePathCall?.();let s=t.font.glyphToPath(n),l=it(s);if(l>this.#y)throw new w("outlineOverLimit",{limit:this.#y,actual:l});let i=Object.freeze({path:s,unitsPerEm:t.unitsPerEm}),d=eo(o,s);if(d>this.#h)return this.#e?.onOutlineCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#i})),i;for(;this.#i+d>this.#h;){let c=this.#a.keys().next().value;if(c===void 0)break;let f=this.#a.get(c);this.#a.delete(c),this.#i-=f.bytes,this.#e?.onOutlineCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#i}));}return this.#a.set(o,{outline:i,bytes:d}),this.#i+=d,this.#e?.onOutlineCacheEvent?.(Object.freeze({kind:"created",retainedBytes:this.#i})),i}#S(t){if(t.length>this.#u)throw new w("textOverLimit",{limit:this.#u,actual:t.length});let n=0;for(let r=0;r<t.length;){let o=t.codePointAt(r);if(r+=o>65535?2:1,n+=1,n>this.#p)throw new w("codepointsOverLimit",{limit:this.#p,actual:n})}}shape(t){if(!this.#d)throw new w("disposed");if(re(t.environment.font),t.environment.font.byteLength>this.#c)throw new w("fontOverLimit",{limit:this.#c,actual:t.environment.font.byteLength});this.#S(t.text);let n=to(t.text);if(n>this.#s)throw new w("shapedRunOverLimit",{limit:this.#s,actual:n});let r=Y(t.environment),o=JSON.stringify([t.text,t.fontSizeHalfPoints,t.bidiLevel,nt(r)]),a=this.#n.get(o);if(a)return this.#n.delete(o),this.#n.set(o,a),this.#e?.onShapeCacheEvent?.(Object.freeze({kind:"hit",retainedBytes:this.#r})),a.run;if(this.#e?.onShapeCacheEvent?.(Object.freeze({kind:"miss",retainedBytes:this.#r})),r.shapingLibrary.name!==$.name||r.shapingLibrary.version!==$.version)throw new w("shapingLibraryMismatch");if(r.normalization!=="none")throw new w("unsupportedNormalization");if(!Number.isSafeInteger(t.bidiLevel)||t.bidiLevel<0||(t.bidiLevel&1)===1!=(r.direction==="rtl"))throw new w("invalidBidiLevel");if(Object.keys(r.variationAxes).length>0)throw new w("unsupportedVariationAxes");if(r.fallbackOrder.length>0)throw new w("unsupportedFallback");let s=Oe(r.font),l=Ie(r.font);if([...Nr].some(d=>l.has(d)))throw new w("unsupportedColorFont");let i=t.text;this.#S(i);try{let d=this.#x(r.font,s),{face:c,font:f}=d,S=this.#d;S.reset(),S.addText(i),S.setDirection(r.direction==="rtl"?this.#t.Direction.RTL:this.#t.Direction.LTR),S.setScript(r.script),S.setLanguage(r.language),S.setClusterLevel(this.#t.ClusterLevel.MONOTONE_CHARACTERS);let b=Object.entries(r.features).map(([R,C])=>new this.#t.Feature(R,C));this.#e?.onShapeCall?.(),this.#t.shape(f,S,b);let x=S.getGlyphInfosAndPositions();if(x.length>this.#f)throw new w("glyphOverLimit",{limit:this.#f,actual:x.length});let m=Vr(c.upem,t.fontSizeHalfPoints,r.fixedPointScale,r.roundingMode),u=M(0),g=M(0),y=new Map,E=JSON.stringify(Object.entries(r.variationAxes).sort(([R],[C])=>R.localeCompare(C))),F=x.map(R=>{let C=m(R.xAdvance??0),O=m(R.yAdvance??0),I={id:R.codepoint,cluster:R.cluster,originX:u,originY:g,advanceX:C,advanceY:O,offsetX:m(R.xOffset??0),offsetY:m(R.yOffset??0),outline:y.get(R.codepoint)??(()=>{let L=this.#R(d,R.codepoint,E);return y.set(R.codepoint,L),L})()};return u=M(u+C),g=M(g+O),I}),T=f.hExtents(),h=Pe({text:i,direction:r.direction,bidiLevel:t.bidiLevel,glyphs:F,clusters:Kr(i,F),fontSpans:F.length===0?[]:[{glyphStart:0,glyphEnd:F.length,font:r.font,fallbackIndex:null}],metrics:{ascent:m(T.ascender),descent:m(-T.descender),lineGap:m(T.lineGap)}},r),p=no(h);if(p>this.#s)throw new w("shapedRunOverLimit",{limit:this.#s,actual:p});let v=ro(o,p);if(v>this.#m)return this.#e?.onShapeCacheEvent?.(Object.freeze({kind:"skipped",retainedBytes:this.#r})),h;for(;this.#n.size>=this.#b||this.#r+v>this.#m;){let R=this.#n.keys().next().value;if(R===void 0)break;let C=this.#n.get(R);this.#n.delete(R),this.#r-=C.bytes,this.#e?.onShapeCacheEvent?.(Object.freeze({kind:"evicted",retainedBytes:this.#r}));}return this.#n.set(o,{run:h,bytes:v}),this.#r+=v,this.#e?.onShapeCacheEvent?.(Object.freeze({kind:"stored",retainedBytes:this.#r})),h}catch(d){throw d instanceof w?d:new w("malformedFont",{diagnostic:d instanceof Error?d.message:"HarfBuzz shaping failed"})}}},st=(e={})=>new rt(mr(),e);var fn=Object.freeze({maxFontBytes:16*1024*1024,maxInputUtf16:1e6,maxCodepoints:1e6,maxGlyphs:1e6,maxCachedFaces:4,maxCachedShapes:512,maxOutlineBytes:1024*1024,maxCachedOutlineBytes:16*1024*1024,maxShapedRunBytes:32*1024*1024,maxCachedShapeBytes:64*1024*1024});function yn(e){let t={maxFontBytes:e.maxFontBytes,maxInputUtf16:e.maxInputUtf16,maxCodepoints:e.maxCodepoints,maxGlyphs:e.maxGlyphs,maxOutlineBytes:e.maxOutlineBytes,maxShapedRunBytes:e.maxShapedRunBytes},n=["docx-editor-layout-harfbuzz-execution-policy",1,Object.entries(t).sort(([r],[o])=>r<o?-1:r>o?1:0).map(([r,o])=>Object.freeze([r,o]))];return `layout-shaper-policy:sha256:${chunk77DD4EBC_cjs.a(new TextEncoder().encode(JSON.stringify(n)))}`}var oo=Object.freeze({}),hn=D,ao="16.0.0",io="none",so=1e3,lo="halfToEven",bn="cluster-edges-only",co="Latn",uo=new Uint8Array(0);var U=class extends Error{code="overLimit";constructor(t){super(t),this.name="LayoutShapingConfigurationError";}};function po(e,t){let n=e.epoch,r=e.maxFontBytes,o=e.sources,a=e.substitutions,s=e.defaultFont,l=e.language;if(!Number.isSafeInteger(r)||r<=0||r>ee)throw new U(`Font byte ceiling must not exceed the engine hard maximum of ${ee}`);let i=o.length,d=a?.length??0;if(i===0||i>D)throw new U(`Font source count must be between 1 and ${D}`);if(d>hn)throw new U(`Font substitution count must not exceed ${hn}`);let c=0,f=[];for(let x=0;x<i;x+=1){let m=o[x],u=m.request,g=m.availability,y=m.id,E=m.hash,F=m.faceIndex,T=g==="forbidden",h=T?uo:m.bytes;if(!T){if(typeof y!="string"||y.length===0)throw new TypeError("Resolved font id must not be empty");let p;try{p=te(h);}catch{throw new U(`Font source ${y} must provide genuine bytes`)}if(p>r)throw new U(`Font source ${y} exceeds the per-font byte ceiling`);if(c+=p,c>W)throw new U(`Font sources exceed the aggregate byte ceiling of ${W}`)}f.push(t&&ne(m)!==void 0?m:Object.freeze({request:Object.freeze({family:u.family,weight:u.weight,style:u.style}),id:y,bytes:h,hash:E,faceIndex:F,...g?{availability:g}:{}}));}let S;if(a){S=[];for(let x=0;x<d;x+=1){let m=a[x],u=m.from,g=m.to,y=m.lineMetrics;S.push(Object.freeze({from:Object.freeze({family:u.family,weight:u.weight,style:u.style}),to:Object.freeze({family:g.family,weight:g.weight,style:g.style}),...y?{lineMetrics:Object.freeze({heightEm:y.heightEm,baselineEm:y.baselineEm})}:{}}));}}let b={epoch:n,maxFontBytes:r,sources:Object.freeze(f),substitutions:S?Object.freeze(S):void 0,defaultFont:Object.freeze({family:s.family,sizeHalfPoints:s.sizeHalfPoints}),language:l};return Object.freeze(b)}function mn(e,t){let n=e.map((o,a)=>({value:o,index:a,key:V(t(o))})),r=new Set;for(let o of n){if(r.has(o.key))return e;r.add(o.key);}return n.sort((o,a)=>o.key<a.key?-1:o.key>a.key?1:o.index-a.index).map(({value:o})=>o)}function fo(e,t){let n={family:e.family},r={sizeHalfPoints:e.sizeHalfPoints};return {...n,...t?r:{}}}function gn(e,t){let n=i=>({family:i.family,weight:i.weight,style:i.style}),r=t?e.sources:mn(e.sources,i=>i.request),o=e.substitutions??[],a=t?o:mn(o,i=>i.from),s={sources:r.map(i=>{let d=i.availability??"available",c={request:n(i.request),availability:d};if(d==="forbidden")return {...c,...t?{id:i.id,faceIndex:i.faceIndex,declaredHash:i.hash}:{}};let f=ne(i);if(f==null)throw new TypeError("Font configuration identity requires prepared source bytes");return {...c,...t?{id:i.id}:{},faceIndex:i.faceIndex,declaredHash:i.hash,actualHash:f,byteLength:i.bytes.byteLength}}),substitutions:a.map(i=>({from:n(i.from),to:n(i.to),lineMetrics:i.lineMetrics?{heightEm:i.lineMetrics.heightEm,baselineEm:i.lineMetrics.baselineEm}:null})),defaultFont:fo(e.defaultFont,t),language:e.language||"en"},l={epoch:e.epoch,maxFontBytes:e.maxFontBytes};return {version:1,...t?l:{},...s}}var yo=Symbol("prepared-layout-font-configuration"),_e=new WeakMap;function ho(e){return _e.has(e)}function mo(e){let t=_e.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.configuration}function ka(e){let t=_e.get(e);if(!t)throw new TypeError("Invalid prepared layout font configuration");return t.sharedShapingFingerprint}function lt(e,t){return Sn(e,t,false)}function Da(e,t){return Sn(e,t,true)}function Sn(e,t,n){let r=po(e,n),o=Object.freeze({epoch:r.epoch,maxFontBytes:r.maxFontBytes,sources:Object.freeze(r.sources.map(f=>n&&ne(f)!==void 0?f:Vt(f,{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash}))),substitutions:r.substitutions,defaultFont:r.defaultFont,language:r.language}),a=new TextEncoder,s=gn(o,true),l=a.encode(JSON.stringify(s)),i=gn(o,false),d=a.encode(JSON.stringify(i)),c=Object.freeze({[yo]:true,fingerprint:`font-config:${chunk77DD4EBC_cjs.a(l)}`});return _e.set(c,{configuration:o,sharedShapingFingerprint:`shared-font-config:${chunk77DD4EBC_cjs.a(d)}`}),c}function go(e){return lt(e).fingerprint}function bo(e,t){let n=new TextEncoder().encode(JSON.stringify({version:1,environment:e,executionPolicy:yn(t),ligatureCaretPolicy:bn,fallback:chunkLQ6XWTKQ_cjs.a}));return `shaping:${chunk77DD4EBC_cjs.a(n)}`}async function xn(e,t,n,r){let a=ho(e)?e:lt(e,t),s=mo(a),{epoch:l,maxFontBytes:i,sources:d,substitutions:c,defaultFont:f}=s,S=s.language||"en",b=a.fingerprint,x=Je({epoch:l,maxFontBytes:i,resources:d,substitutions:c,validateFont:at,instrumentation:{onOwnedByteCopy:t?.onFontByteCopy,onHash:t?.onFontHash,onAdmission:t?.onFontAdmission}});await ot();let m=Object.freeze({script:co,variationAxes:Object.freeze({}),shapingLibrary:$,unicodeDataVersion:ao,normalization:io,language:S,features:oo,fixedPointScale:so,roundingMode:lo});return Object.freeze({fonts:x,shaper:n??st(r),defaultFont:f,environment:m,ligatureCaretPolicy:bn,operation:Object.freeze({resourceEpoch:x.epoch,configEpoch:l,extensionFingerprint:b,shapingHash:bo(m,r),producerVersion:1})})}async function So(e,t){return xn(e,t,void 0,fn)}async function Ha(e,t,n,r){return xn(e,r,t,n)}function xo(e){e.shaper.dispose?.();}function dt(e){let t=new Set([0,e.text.length]);for(let r of chunkLQ6XWTKQ_cjs.r(e.text))t.add(r.utf16From),t.add(r.utf16To);let n=new Set([0,e.text.length]);for(let r of e.clusters)n.add(r.textStart),n.add(r.textEnd);return [...t].filter(r=>n.has(r)).sort((r,o)=>r-o)}function Me(e,t){return dt(e).includes(t)}function Ro(e,t){return Me(e,t)}function Fo(e,t,n){return n>=t&&Me(e,t)&&Me(e,n)}function vo(e){let t=chunkLQ6XWTKQ_cjs.r(e.text);return dt(e).map(n=>n===e.text.length?t.length:t.findIndex(r=>r.utf16From===n))}var ut="und";function En(){return typeof Intl.Segmenter=="function"}function Eo(){let e=Intl.Segmenter;if(typeof e!="function")throw new Error(`Intl.Segmenter is required for word segmentation (locale: ${ut})`);return e}function Cn(){let e=new(Eo())(ut,{granularity:"word"});return {segment(t){let n=[];for(let r of e.segment(t)){let o=r.index,a=o+r.segment.length;n.push({utf16From:o,utf16To:a,wordLike:r.isWordLike===true});}return n}}}var Co=/^[\p{L}\p{N}']$/u,wo=/^\s$/u;function Rn(e){return Co.test(e)}function Fn(e){return wo.test(e)}function ct(e,t,n,r){let o=e[t],a=e[n-1];return {utf16From:o.utf16From,utf16To:a.utf16To,wordLike:r}}function wn(e){let t=chunkLQ6XWTKQ_cjs.r(e);if(t.length===0)return [];let n=[],r=0;for(;r<t.length;){let o=t[r];if(Fn(o.text)){let a=r+1;for(;a<t.length&&Fn(t[a].text);)a+=1;n.push(ct(t,r,a,false)),r=a;continue}if(Rn(o.text)){let a=r+1;for(;a<t.length&&Rn(t[a].text);)a+=1;n.push(ct(t,r,a,true)),r=a;continue}n.push(ct(t,r,r+1,false)),r+=1;}return n}function On(){return {segment:wn}}function In(e={}){let t=e.isIntlAvailable??En,n=e.createIntlBoundary??Cn,r=e.createFallbackBoundary??On;if(!t())return r();try{return n()}catch{return r()}}var vn;function Tn(){return vn??=In(),vn}function Oo(e,t=Tn()){return t.segment(e)}function Io(e,t){return t.map(n=>({graphemeFrom:chunkLQ6XWTKQ_cjs.v(e,n.utf16From),graphemeTo:chunkLQ6XWTKQ_cjs.v(e,n.utf16To),wordLike:n.wordLike}))}var Ln={resourceEpoch:"resource-scoped",configEpoch:"coarse-gate",extensionFingerprint:"coarse-gate",shapingHash:"coarse-gate",producerVersion:"coarse-gate"},yt=Object.keys(Ln),Bn=yt.filter(e=>Ln[e]==="coarse-gate"),ze=(e,t)=>{if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer`)},ie=(e,t)=>{if(e.trim().length===0)throw new TypeError(`${t} must not be blank`)},To={resourceEpoch:ze,configEpoch:ze,extensionFingerprint:ie,shapingHash:ie,producerVersion:ze},Lo=(e,t)=>{To[t](e[t],t);},se=e=>{for(let t of yt)Lo(e,t);return Object.freeze({resourceEpoch:e.resourceEpoch,configEpoch:e.configEpoch,extensionFingerprint:e.extensionFingerprint,shapingHash:e.shapingHash,producerVersion:e.producerVersion})},Bo=(e,t)=>{let n=se(e),r=se(t),o=yt.filter(a=>n[a]!==r[a]);return o.length===0?Object.freeze({status:"current"}):Object.freeze({status:"restart",changed:Object.freeze(o)})},pt=e=>{let t=e.map(({key:n,fingerprint:r})=>(ie(n,"resource dependency key"),ie(r,"resource dependency fingerprint"),Object.freeze({key:n,fingerprint:r}))).sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:0);for(let n=1;n<t.length;n+=1)if(t[n-1].key===t[n].key)throw new TypeError(`Duplicate resource dependency: ${t[n].key}`);return Object.freeze(t)},Ao=e=>(ze(e.revision,"revision"),ie(e.dependencyFingerprint,"dependencyFingerprint"),ie(e.inputFingerprint,"inputFingerprint"),Object.freeze({revision:e.revision,dependencyFingerprint:e.dependencyFingerprint,inputFingerprint:e.inputFingerprint,resourceDependencies:pt(e.resourceDependencies),...se(e)})),Po=(e,t)=>{let n=pt(e),r=pt(t),o=Math.max(n.length,r.length);for(let a=0;a<o;a+=1){let s=n[a],l=r[a];if(s?.key!==l?.key||s?.fingerprint!==l?.fingerprint)return {hit:false,reason:"resource-changed",resourceKey:s?.key??l.key}}return null};function _o(e,t){if(e.dependencyFingerprint!==t.dependencyFingerprint)return {hit:false,reason:"dependency-changed"};if(e.inputFingerprint!==t.inputFingerprint)return {hit:false,reason:"input-changed"};let n=Po(e.resourceDependencies,t.resourceDependencies);if(n)return n;for(let r of Bn)if(e[r]!==t[r])return {hit:false,reason:"epoch-changed",epoch:r};return null}var ft=class{entries=new Map;get(t,n){let r=this.entries.get(t);if(!r)return {hit:false,reason:"absent"};let o=_o(r.provenance,n);return o||{hit:true,value:r.value,provenance:r.provenance}}set(t,n,r){this.entries.set(t,{value:n,provenance:Ao(r)});}evictEpoch(t){let n=se(t),r=0;for(let[o,a]of this.entries){let s=a.provenance;Bn.some(l=>s[l]!==n[l])&&(this.entries.delete(o),r+=1);}return r}evictResources(t,n){let r=se(t),o=this.evictEpoch(r);for(let[a,s]of this.entries)s.provenance.resourceDependencies.some(i=>n.get(i.key)!==i.fingerprint)&&(this.entries.delete(a),o+=1);return o}get size(){return this.entries.size}};function An(e){return e.projected===true?null:e.range}function zo(e,t,n){let{page:r,story:o,host:a,noteScopeId:s,noteAreaKind:l}=e,i=o==="header"||o==="footer"?d=>chunkLQ6XWTKQ_cjs.A(d,e.origin,{x:r.box.x,y:r.box.y}):void 0;chunkLQ6XWTKQ_cjs.J(a,(d,c)=>{let{textboxDepth:f,textboxOwner:S,textboxPath:b,storyOrigin:x}=c,m=f===0?o:"textbox";for(let u of d.lines){let g=[...chunkLQ6XWTKQ_cjs.Q(u)].sort((y,E)=>(t.get(y.paragraphId)??Number.MAX_SAFE_INTEGER)-(t.get(E.paragraphId)??Number.MAX_SAFE_INTEGER));for(let y of g)for(let E of y.spans)n({page:r,story:m,rootStory:o,root:e,storyOrigin:x,absoluteBox:Object.freeze({x:x.x+E.box.x,y:x.y+E.box.y,width:E.box.width,height:E.box.height}),noteScopeId:s,noteAreaKind:l,textboxDepth:f,textboxOwner:S,textboxPath:b,paragraph:d,paragraphId:y.paragraphId,line:u,span:E,sourceRange:An(E)});}},e.origin,i);}function No(e,t){let n=new Map(chunkLQ6XWTKQ_cjs.W(e).map((r,o)=>[r,o]));chunkLQ6XWTKQ_cjs.G(e,r=>zo(r,n,t));}var zn="Calibri, Carlito, Helvetica, Arial, sans-serif",ti=new Map([["calibri","Carlito"]]),ko=65536,Do=256;function Pn(e,t){return e===void 0?Math.max(1,Math.floor(t)):Number.isFinite(e)&&e>0?Math.max(1,Math.floor(e)):1}function _n(e){let t=new Map,n=0;return {get(r){let o=t.get(r);if(o!==void 0)return t.delete(r),t.set(r,o),o},set(r,o){for(t.has(r)&&t.delete(r),t.set(r,o);t.size>e;){let a=t.keys().next();if(a.done)break;t.delete(a.value),n+=1;}},get size(){return t.size},get evictions(){return n}}}var Mn=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Nn(e=null){return e!=null&&typeof e.measureText=="function"}function kn(e={}){let t=e.scale??1;if(!(t>0)||!Number.isFinite(t))return null;let n=e.fallbackFamily??zn,r=e.context??null;if(!Nn(r))return null;let o=r,a=_n(Pn(e.maxWidthEntries,ko)),s=_n(Pn(e.maxMetricsEntries,Do)),l=e.fontAlias,i=c=>{let f=c.fontFamily&&Mn.test(c.fontFamily)?c.fontFamily:null,S=f?l?.(f):void 0,b=S&&Mn.test(S)?S:null,x=f?b?`"${b}", "${f}", ${n}`:`"${f}", ${n}`:n,m=c.bold?"bold":"normal",u=c.italic?"italic":"normal",g=c.smallCaps?"small-caps":"normal",y=c.fontSizePt*(c.verticalAlign==="baseline"?1:.75)*t;return `${u} ${g} ${m} ${y}px ${x}`},d=(c,f,S)=>c/t*(S.horizontalScalePercent/100)+f.length*S.characterSpacingPt;return {measure(c,f){if(c.length===0)return 0;let S=i(f),b=`${S}\0${c}`,x=a.get(b);if(x!==void 0)return d(x,c,f);o.font=S;let m=o.measureText(c).width;return a.set(b,m),d(m,c,f)},inkBounds(c,f){if(!c||c.length>2||f.shaping?.direction==="rtl"||chunkLQ6XWTKQ_cjs.r(c).length!==1)return;o.font=i(f);let S=o.textAlign,b=o.direction,x;try{S!==void 0&&(o.textAlign="left"),b!==void 0&&(o.direction="ltr"),x=o.measureText(c);}finally{S!==void 0&&(o.textAlign=S),b!==void 0&&(o.direction=b);}let m=x.actualBoundingBoxLeft,u=x.actualBoundingBoxRight;if(m===void 0||u===void 0||!Number.isFinite(m)||!Number.isFinite(u))return;let g=f.horizontalScalePercent/(100*t);return {left:-m*g,right:u*g}},lineMetrics(c){let f=c.fontSizePt*(c.verticalAlign==="baseline"?1:.75),S=i(c),b=s.get(S);if(b)return b;let x=f*1.15,m=f*.8;o.font=S;let u=o.measureText("Hxg"),g=u.fontBoundingBoxAscent,y=u.fontBoundingBoxDescent;if(typeof g=="number"&&Number.isFinite(g)&&g>0&&(m=g/t,typeof y=="number"&&Number.isFinite(y)&&y>=0)){let F=(g+y)/t;F>0&&(x=Math.max(F,x));}x>0||(x=f*1.15);let E={height:x,baseline:m};return s.set(S,E),E}}}function Ho(e=1,t={}){let n=kn({...t,scale:t.scale??e});return n?{measurer:n,producer:t.fontAlias?"canvas-measurer+embedded":"canvas-measurer"}:{measurer:chunkLQ6XWTKQ_cjs.b(),producer:"fixed-measurer"}}function Uo(e){let t;return n=>{t===void 0&&(t=chunkLQ6XWTKQ_cjs.qa(e.pages)?.hosts??null);let r=t?.get(n);return r?chunkLQ6XWTKQ_cjs.oa(r.pageNumber,r.format):null}}function Dn(e,t){let n=chunkLQ6XWTKQ_cjs.Ja(e,t.displayMode??chunkLQ6XWTKQ_cjs.ua),r=chunkLQ6XWTKQ_cjs.Rb({numberingIndex:t.numberingIndex,styleCascade:t.styleCascade},n).listItems,o=t.package?{footnotesPart:chunk77DD4EBC_cjs.Nf(t.package,"footnote"),endnotesPart:chunk77DD4EBC_cjs.Nf(t.package,"endnote")}:void 0,a=chunkLQ6XWTKQ_cjs.ic(n,r,o,t.package?chunkLQ6XWTKQ_cjs.fc(t.package,e,n):void 0,t.displayMode??chunkLQ6XWTKQ_cjs.ua);return {blocks:n,notes:o,context:a}}function Hn(e,t,n,r,o){for(let a of t){if(r.length>=chunk77DD4EBC_cjs.gh)return;if(n.tokenForParagraph(a.id)!==""&&chunk77DD4EBC_cjs.jh(e,a.id)===null)for(let s of chunk77DD4EBC_cjs.ih(a)){if(r.length>=chunk77DD4EBC_cjs.gh)return;if(!s.rewritable)continue;let l=chunkLQ6XWTKQ_cjs.ta(s.instruction);if(l===null)continue;let i=n.liveValueOf(s.fieldNodeId,l);if(i===null&&o&&n.pageRefProjectionOf){let d=n.pageRefProjectionOf(s.fieldNodeId,l);if(d){let c=o(d.targetParagraphId);c!==null&&c.length>0&&chunkLQ6XWTKQ_cjs.pa(d.calibration,d.cached,c,Number.NaN)&&(i=c);}}i===null||i===s.cachedText||i.length>chunk77DD4EBC_cjs.hh||i.includes(`
|
|
2
|
+
`)||i.includes("\r")||r.push({paragraphId:a.id,fieldNodeId:s.fieldNodeId,text:i});}}}function Go(e,t){let{blocks:n,context:r}=Dn(e,t);if(r===null)return null;let o=[];return Hn(e,chunkLQ6XWTKQ_cjs.Pb(n),r,o,t.pageRefPageNumberOf),o.length===0?null:{op:"refreshFieldResults",updates:o}}function ui(e,t){let{notes:n,context:r}=Dn(e,t);if(r===null||n===void 0)return [];let o=[],a=[{noteKind:"footnote",notesPart:n.footnotesPart},{noteKind:"endnote",notesPart:n.endnotesPart}];for(let{noteKind:s,notesPart:l}of a){if(!l)continue;let i=[];for(let d of chunkLQ6XWTKQ_cjs.gc(l,t.displayMode??chunkLQ6XWTKQ_cjs.ua)){if(i.length>=chunk77DD4EBC_cjs.gh)break;Hn(l,chunkLQ6XWTKQ_cjs.Pb(d),r,i);}i.length>0&&o.push({noteKind:s,op:{op:"refreshFieldResults",updates:i}});}return o}function jo(e){return e.box}function Un(e,t){if(e.kind==="paragraph"){t.add(e.paragraphId);return}for(let n of e.rows)for(let r of n.cells)for(let o of r.blocks)Un(o,t);}function Wo(e){let t=new Map,n=(o,a,s)=>{if(!(o.kind==="textValue"||s>chunk77DD4EBC_cjs.wc*4)){for(let l of o.children)if(l.kind!=="textValue"){if(l.kind==="paragraph"){for(let i of r)t.get(i)?.push(l.id);n(l,l.id,s+1);continue}if(l.kind==="contentControl"){t.set(l.id,[]),r.push(l.id);let i=chunk77DD4EBC_cjs.Gc(l);i&&n(i,a,s+1),r.pop();let d=t.get(l.id);d&&d.length===0&&a!==null&&d.push(a);continue}n(l,a,s+1);}}},r=[];return n(e,null,0),t}function Vo(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return {x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function Ko(e,t){let n=chunk77DD4EBC_cjs.Kc(e.root);if(n.length===0)return Xo;let r=new Map;t.pages.forEach((s,l)=>{(d=>{for(let c of d){let f=new Set;Un(c,f);for(let S of f){let b=r.get(S)??[];b.push({pageIndex:l,box:jo(c)}),r.set(S,b);}}})(s.fragments);});let o=Wo(e.root),a=[];for(let s of n){let l=chunk77DD4EBC_cjs.Ic(s.node),i=[...s.ancestors.map(S=>chunk77DD4EBC_cjs.Ic(S).lock),l.lock],d=o.get(s.node.id)??[],c=new Map;for(let S of d)for(let b of r.get(S)??[]){let x=c.get(b.pageIndex);c.set(b.pageIndex,x?Vo(x,b.box):b.box);}let f=[...c.entries()].sort((S,b)=>S[0]-b[0]).map(([S,b])=>({pageIndex:S,...b}));a.push({controlId:s.node.id,type:l.type,level:chunk77DD4EBC_cjs.Jc(s.node),depth:s.depth,lock:l.lock,effectiveLock:chunk77DD4EBC_cjs.Nc(i),showingPlaceholder:l.showingPlaceholder,temporary:l.temporary,...l.tag===void 0?{}:{tag:l.tag},...l.alias===void 0?{}:{alias:l.alias},...l.id===void 0?{}:{id:l.id},...l.dataBinding===void 0?{}:{dataBinding:l.dataBinding},paragraphIds:d,fragments:f});}return a}var Xo=Object.freeze([]);function jn(e,t,n){let r=e.lines?.find(o=>{let a=o.spans;if(!a)return n<o.range.end;let s=a.filter(l=>l.range.paragraphId===t);return s.length===a.length?n<o.range.end:s.length>0&&n<s[s.length-1].range.end});return r?r.box.y:e.fragmentY}function oa(e,t){let n=new Map;for(let r of e.pages)for(let[o,a]of aa(r,t))n.has(o)||n.set(o,a);return n}var Gn=new WeakMap;function aa(e,t){let n=Gn.get(t);n||(n=new WeakMap,Gn.set(t,n));let r=n.get(e);if(r)return r;let o=new Map;for(let a of t(e)){let s=new Set([a.paragraphId]);for(let l of a.lines??[])for(let i of l.spans??[])s.add(i.range.paragraphId);for(let l of s)o.has(l)||o.set(l,{pageIndex:e.index,contentY:e.contentBox.y,fragmentY:a.box.y,...a.lines?{lines:a.lines}:{}});}return n.set(e,o),o}function ia(e,t){let n=chunkMDP5SNK4_cjs.Ha(e);if(!n)return null;let r=t.get(n.start.paragraphId);return r?{pageIndex:r.pageIndex,y:r.contentY+jn(r,n.start.paragraphId,n.start.offset)}:null}var ht=new WeakMap;function sa(e){let t=ht.get(e);if(t!==void 0)return t??void 0;let n=e.path;if(!n.startsWith("M")||n.length>1e6||/[^MLQCZ0-9eE+.,\s-]/u.test(n))return;let r=1/0,o=-1/0,a=n.matchAll(/([MLQCZ])([^MLQCZ]*)/gu);for(let l of a){let i=l[1]==="Z"?0:l[1]==="C"?6:l[1]==="Q"?4:2,d=l[2].trim().split(/[\s,]+/u).filter(Boolean).map(Number);if(d.length!==i||d.some(c=>!Number.isFinite(c))){ht.set(e,null);return}for(let c=0;c<d.length;c+=2)r=Math.min(r,d[c]),o=Math.max(o,d[c]);}let s=Number.isFinite(r)&&Number.isFinite(o)?{left:r,right:o}:void 0;return ht.set(e,s??null),s}function Wn(e,t,n,r){if(e.clusters.length!==1||e.glyphs.length===0)return;let o=1/0,a=-1/0;for(let l of e.glyphs){if(l.id===0)return;let i=sa(l.outline),d=l.outline.unitsPerEm;if(!i||!(d>0))return;let c=(l.originX+l.offsetX)/n;o=Math.min(o,c+i.left*t/d),a=Math.max(a,c+i.right*t/d);}let s={left:o*r,right:a*r};return Number.isFinite(s.left)&&Number.isFinite(s.right)?s:void 0}var la="abcdefghijklmnopqrstuvwxyz";function he(e){let t=Math.round(e.fontSizePt*2);return Math.max(1,t)}function J(e,t,n,r,o){return e.shape({text:o,fontSizeHalfPoints:he(r),bidiLevel:r.shaping?.direction==="rtl"?1:0,environment:Y({...t,font:n,direction:r.shaping?.direction??"ltr",script:r.shaping?.script==="Zyyy"?t.script:r.shaping?.script??t.script,features:r.smallCaps?{...t.features,smcp:1}:t.features,fallbackOrder:[]})})}function Ne(e,t,n,r,o){let a=o.get(n);if(a!==void 0)return a;let s=true;try{for(let l of la){let i=J(e,t,n,{...r,smallCaps:!0},l),d=J(e,t,n,{...r,smallCaps:!1},l);if(!(i.glyphs.length!==d.glyphs.length||i.glyphs.some((f,S)=>f.id!==d.glyphs[S]?.id))){s=!1;break}}}catch{s=false;}return o.set(n,s),s}var da=.5,ca=4,Vn=4096,me=e=>e.verticalAlign==="baseline"?1:.75;function Kn(e){let t="environment"in e?e.environment:void 0,n="environment"in e?void 0:e,{shaper:r,resolveFont:o,fallback:a}=e,s=t??{shapingLibrary:n.shapingLibrary,unicodeDataVersion:n.unicodeDataVersion,script:n?.script??"Latn",fixedPointScale:n?.fixedPointScale??1e3,normalization:n?.normalization??"none",features:n?.features??{},roundingMode:n?.roundingMode??"halfToEven",language:n?.language??"en",variationAxes:{}},l=new WeakMap,i=new WeakMap,d=new WeakMap,c=new WeakMap,f=new WeakMap,S=new Array(Vn),b=0,x=(h,p,v)=>{let R=S[b];R&&R.cache.delete(R.text),h.set(p,v),S[b]={cache:h,text:p},b=(b+1)%Vn;},m=h=>{let p=c.get(h);if(p!==void 0)return p;let v=o(h);return c.set(h,v),v},u=(h,p,v)=>{let R=v?i:l,C=R.get(h);C||(C=new Map,R.set(h,C));let O=C.get(p);return O||(O=new Map,C.set(p,O)),O},g=new WeakMap,y=h=>{if(!h.shaping?.wordSpacingPt)return h;let p=g.get(h);return p||(p={...h,shaping:{...h.shaping,wordSpacingPt:void 0}},g.set(h,p)),p},E=(h,p)=>p.shaping?.wordSpacingPt?chunkLQ6XWTKQ_cjs.Pc(h)*p.shaping.wordSpacingPt:0,F=(h,p)=>a.measure(h,y(p))+E(h,p),T=(h,p)=>{let v=Math.max(0,a.measure(h,y(p))),R=a.caretAdvances?.(h,y(p))??chunkLQ6XWTKQ_cjs.Nc(h,v);if(!R||R.length!==h.length+1)return chunkLQ6XWTKQ_cjs.Nc(h,F(h,p));let C=Math.max(0,F(h,p)),O=0,I=0;return R.map((L,B)=>{if(B===0)return 0;h[B-1]===" "&&I++;let k=L+I*(p.shaping?.wordSpacingPt??0);return O=Math.max(O,Math.min(C,Number.isFinite(k)?k:O)),B===h.length?C:O})};return {measure(h,p){if(h.length===0)return 0;let v=m(p);if(!v)return F(h,p);let R=u(v,he(p),p.smallCaps),C=p.shaping?`1:${JSON.stringify([p.shaping.script,p.shaping.direction,h])}`:`0:${h}`,O=R.get(C);if(O===void 0){let I=0;try{if(p.smallCaps&&!Ne(r,s,v,p,f))return F(h,p);let L=J(r,s,v,p,h);if(L.glyphs.some(B=>B.id===0))return F(h,p);for(let B of L.glyphs)I+=B.advanceX;}catch{return F(h,p)}O=I/s.fixedPointScale,x(R,C,O);}return O*me(p)*(p.horizontalScalePercent/100)+h.length*p.characterSpacingPt+E(h,p)},inkBounds(h,p){if(!h||h.length>2||p.shaping?.direction==="rtl"||chunkLQ6XWTKQ_cjs.r(h).length!==1)return;let v=m(p);if(!v)return a.inkBounds?.(h,p);try{if(p.smallCaps&&!Ne(r,s,v,p,f))return a.inkBounds?.(h,p);let R=J(r,s,v,p,h);return Wn(R,he(p)/2,s.fixedPointScale,me(p)*p.horizontalScalePercent/100)}catch{return}},caretAdvances(h,p){let v=m(p);if(!v)return T(h,p);try{if(p.smallCaps&&!Ne(r,s,v,p,f))return T(h,p);let R=J(r,s,v,p,h);return R.glyphs.some(C=>C.id===0)?T(h,p):chunkLQ6XWTKQ_cjs.Oc(h,R,me(p)*(p.horizontalScalePercent/100)/s.fixedPointScale,p.characterSpacingPt,p.shaping?.wordSpacingPt??0)??chunkLQ6XWTKQ_cjs.Nc(h,R.glyphs.reduce((C,O)=>C+O.advanceX,0)*me(p)*(p.horizontalScalePercent/100)/s.fixedPointScale+h.length*p.characterSpacingPt+E(h,p))}catch{return T(h,p)}},lineMetrics(h){let p=m(h);if(!p)return a.lineMetrics(h);let v=me(h),R=d.get(p);R||(R=new Map,d.set(p,R));let C=he(h),O=R.get(C);if(O)return v===1?O:{height:O.height*v,baseline:O.baseline*v};let I,L=true,B=p.substitution?.lineMetrics;if(B){let k=C/2;I={height:B.heightEm*k,baseline:B.baselineEm*k};}else try{let k=J(r,s,p,h," "),gt=k.metrics.ascent/s.fixedPointScale,Qn=k.metrics.descent/s.fixedPointScale,er=C/2,De=gt+Qn,bt=er*ca,St=De>bt?bt/De:1,xt=De*St,tr=Math.min(Math.max(0,k.metrics.lineGap/s.fixedPointScale),xt*da),Rt=xt+tr;Rt>0?I={height:Rt,baseline:gt*St}:(I=a.lineMetrics(h),L=!1);}catch{I=a.lineMetrics(h),L=false;}return L?(R.set(C,I),v===1?I:{height:I.height*v,baseline:I.baseline*v}):I}}}function ua(e,t){return Kn({...t,shaper:e.shaper,environment:e.environment})}function pa(e){let{layout:t,viewport:n}=e,r=new Set;if(!n){for(let i of t.pages)r.add(i.index);return r}let o=Math.max(0,Math.trunc(e.overscanPages??1)),a=n.top+n.height,s=-1,l=-1;for(let i of t.pages){let d=i.box.y;d+i.box.height>=n.top&&d<=a&&(s===-1&&(s=i.index),l=i.index);}if(s===-1){let i=fa(t,n.top);i!==null&&(s=i,l=i);}if(s!==-1){let i=Math.max(0,s-o),d=Math.min(t.pages.length-1,l+o);for(let c=i;c<=d;c+=1)r.add(c);}for(let i of e.pinnedPages??[])i>=0&&i<t.pages.length&&r.add(i);return r}function fa(e,t){let n=null,r=Number.POSITIVE_INFINITY;for(let o of e.pages){let a=t<o.box.y?o.box.y-t:t>o.box.y+o.box.height?t-(o.box.y+o.box.height):0;a<r&&(r=a,n=o.index);}return n}var Xn=["text-local","paragraph-local","flow-structural","global"];function qn(e,t){return Xn.indexOf(t)>Xn.indexOf(e)?t:e}function ya(e){return {impact:"text-local",paragraphIds:new Set,created:new Set,deleted:new Set,dependencyKeys:new Set,structural:false,revision:e}}function ha(e){let{run:t,currentRevision:n,publish:r,schedule:o}=e,a=null,s=null,l=null,i=0,d=0;function c(u){let g=e.runCooperatively;if(!g)return t(u);let y=g(u);l=y;try{for(;;){let E=y.step();if(E)return E;if(n()!==u.revision)return y.cancel(),d+=1,null;if(l!==y)return null}}finally{l===y&&(l=null);}}function f(u){let g=b(n());g.impact=qn(g.impact,u.impact),g.structural=g.structural||u.structural;for(let y of u.paragraphIds)g.paragraphIds.add(y);for(let y of u.created)g.created.add(y);for(let y of u.deleted)g.deleted.add(y);for(let y of u.dependencyKeys)g.dependencyKeys.add(y);}let S=u=>({impact:u.impact,paragraphIds:u.paragraphIds,created:u.created,deleted:u.deleted,dependencyKeys:u.dependencyKeys,structural:u.structural,revision:u.revision});function b(u){return a||(a=ya(u)),a.revision=Math.max(a.revision,u),a}function x(){!o||s||(s=o(()=>{s=null,m();}));}function m(){s&&(s(),s=null),l&&(l.cancel(),l=null,d+=1);let u=a;if(!u)return false;a=null;let g=S(u),y=c(g);return !y||y.revision!==n()?(i+=1,f(g),x(),false):(r(y,g),true)}return {notify(u){let g=b(n());g.impact=qn(g.impact,u.impact);for(let y of u.dirty)g.paragraphIds.add(y);for(let y of u.created)g.created.add(y),g.paragraphIds.add(y);for(let y of u.deleted)g.deleted.add(y),g.paragraphIds.add(y);for(let y of u.dependencyKeys)g.dependencyKeys.add(y);for(let y of u.splitJoin)g.structural=true,"split"in y?(g.paragraphIds.add(y.split.from),g.paragraphIds.add(y.split.tail)):(g.paragraphIds.add(y.join.kept),g.paragraphIds.add(y.join.removed));(u.impact==="flow-structural"||u.impact==="global")&&(g.structural=true),x();},invalidateAll(u,g){let y=b(u);y.impact="flow-structural",y.structural=true,g&&y.dependencyKeys.add(g),x();},flush:m,pending:()=>a?S(a):null,cancel(){s?.(),s=null,l?.cancel(),l=null,a=null;},get staleDiscards(){return i},get cancelledRuns(){return d}}}var Yn=new WeakMap;function G(e){let t=Yn.get(e);if(t)return t;let n=new Map,r=new Map,o=new Map,a=new Map,s=(i,d,c,f)=>{for(let S of i){if(S.kind==="paragraph")continue;let b=S.tableId;a.set(b,Math.max(a.get(b)??0,(S.columnEdges?.length??1)-1));let x=o.get(b);x||(x=new Map,o.set(b,x),n.set(b,[]),r.set(b,new Map));for(let m of S.rows){let u=x.get(m.id);u===void 0&&(u=x.size,x.set(m.id,u),r.get(b).set(u,m.cells));for(let g of m.cells)n.get(b).push({pageIndex:d,tableId:b,row:m,cell:g,rowIndex:u,isHeaderRepeat:m.isHeaderRepeat,offsetX:c,offsetY:f}),s(g.blocks,d,c,f);}}};for(let i of e.pages){s(i.fragments,i.index,0,0);for(let d of [i.header,i.footer])d&&s(d.fragments,i.index,d.box.x-i.contentBox.x,d.box.y-i.contentBox.y);for(let d of [i.footnotes,i.endnotes])if(d)for(let c of d.notes)s(c.fragments,i.index,c.box.x-i.contentBox.x,c.box.y-i.contentBox.y);}let l=new Map;for(let[i,d]of n)l.set(i,{placed:d,rows:r.get(i)??new Map,columnCount:a.get(i)??0});return Yn.set(e,l),l}function Zn(e){let t=e.columnCount;for(let n of e.rows.values())for(let r of n)t=Math.max(t,X(r).to+1);return t}var X=e=>({from:e.gridColumn,to:e.gridColumn+Math.max(1,e.gridSpan)-1});function ma(e,t,n){if(t.tableId!==n.tableId)return null;let r=G(e).get(t.tableId);if(!r)return null;let o=Math.min(t.rowIndex,n.rowIndex),a=Math.max(t.rowIndex,n.rowIndex),s=Math.min(X(t).from,X(n).from),l=Math.max(X(t).to,X(n).to),i=b=>{let{from:x,to:m}=X(b);return m>=s&&x<=l},d=b=>(r.rows.get(b)??[]).some(x=>x.vMergeContinue&&i(x)),c=r.rows.size+Zn(r)+2;for(let b=0;!(b>c);b+=1){let x=false;for(let[m,u]of r.rows)if(!(m<o||m>a))for(let g of u){if(!i(g))continue;let{from:y,to:E}=X(g);y<s&&(s=y,x=true),E>l&&(l=E,x=true);}for(;o>0&&d(o);)o-=1,x=true;for(;d(a+1);)a+=1,x=true;if(!x)break}let f=[],S=new Set;for(let b of r.placed){if(b.isHeaderRepeat||b.rowIndex<o||b.rowIndex>a)continue;let{from:x,to:m}=X(b.cell);m<s||x>l||S.has(b.cell.id)||(S.add(b.cell.id),f.push(b.cell.id));}return f.length===0?null:{kind:"cells",tableId:t.tableId,cellIds:f,rows:{from:o,to:a},columns:{from:s,to:l},text:ga(e,t.tableId,f)}}function _i(e,t){return Jn(e,t,true)}function ke(e,t){return Jn(e,t,false)}function Jn(e,t,n){let r=new Set(t),o=[],a=new Set;for(let s of G(e).values())for(let l of s.placed)if(!(l.isHeaderRepeat||!r.has(l.cell.id)))for(let i of l.cell.blocks)n&&i.kind!=="paragraph"||le(i,o,a);return o}function le(e,t,n){if(e.kind==="paragraph"){for(let r of chunkLQ6XWTKQ_cjs.T(e))n.has(r)||(n.add(r),t.push(r));return}for(let r of e.rows)if(!r.isHeaderRepeat)for(let o of r.cells)for(let a of o.blocks)le(a,t,n);}function ga(e,t,n){let r=ke(e,n),o=r[0],a=r[r.length-1];return !o||!a?ba(e,t):{anchor:{paragraphId:o,offset:0},head:{paragraphId:a,offset:chunkLQ6XWTKQ_cjs.je(e,a).length}}}function ba(e,t){let n=G(e).get(t);for(let o of n?.placed??[]){if(o.isHeaderRepeat)continue;let a=[];for(let l of o.cell.blocks)le(l,a,new Set);let s=a[0];if(s){let l={paragraphId:s,offset:0};return {anchor:l,head:l}}}for(let o of e.pages)for(let a of chunkLQ6XWTKQ_cjs.B(o)){let s={paragraphId:a.paragraphId,offset:0};return {anchor:s,head:s}}let r={paragraphId:"",offset:0};return {anchor:r,head:r}}function Sa(e){let t=[...chunkLQ6XWTKQ_cjs.B(e)];for(let n of [e.header,e.footer])n&&t.push(...chunkLQ6XWTKQ_cjs.C(n.fragments));for(let n of [e.footnotes,e.endnotes])if(n)for(let r of n.notes)t.push(...chunkLQ6XWTKQ_cjs.C(r.fragments));return t}function xa(e,t){let n=new Set(ke(e,t)),r=[],o=new Set;for(let a of e.pages)for(let s of Sa(a))if(n.has(s.paragraphId))for(let l of s.lines)for(let i of l.spans){let d=`${i.range.paragraphId}:${i.range.start}:${i.range.end}`;o.has(d)||(o.add(d),r.push(i));}return r}function Ra(e,t){let n=new Set(t),r=[];for(let o of G(e).values())for(let a of o.placed)n.has(a.cell.id)&&r.push({pageIndex:a.pageIndex,x:a.cell.box.x+a.offsetX,y:a.cell.box.y+a.offsetY,width:a.cell.box.width,height:a.cell.box.height});return r}function Fa(e,t){let n=G(e).get(t.tableId);if(!n)return "";let r=new Set(t.cellIds),o=n.placed.some(l=>l.cell.logicalGridColumn!==void 0),a=new Map,s=new Set;for(let l of n.placed){if(l.isHeaderRepeat||!r.has(l.cell.id)||s.has(l.cell.id))continue;s.add(l.cell.id);let i=ke(e,[l.cell.id]).map(f=>chunkLQ6XWTKQ_cjs.je(e,f)).join(`
|
|
3
|
+
`),d=a.get(l.rowIndex),c=l.cell.gridColumn+(o?Math.max(1,l.cell.gridSpan)-1:0);d?d.set(c,i):a.set(l.rowIndex,new Map([[c,i]]));}return [...a.keys()].sort((l,i)=>l-i).map(l=>{let i=a.get(l),d=[];for(let c=0;c<=t.columns.to-t.columns.from;c+=1){let f=o?t.columns.to-c:t.columns.from+c;d.push(i.get(f)??"");}return d.join(" ")}).join(`
|
|
4
|
+
`)}function mt(e,t){let n=null,r=-1;for(let[o,a]of G(e))for(let s of a.placed){if(s.isHeaderRepeat)continue;let l=[];for(let d of s.cell.blocks)le(d,l,new Set);if(!l.includes(t))continue;let i=o.length;i<=r||(r=i,n={tableId:o,rows:a.rows.size,columns:Zn(a),rowIndex:s.rowIndex,columnIndex:s.cell.logicalGridColumn??s.cell.gridColumn});}return n}function Mi(e,t,n){if(n){let a=mt(e,t);if(!a||a.tableId!==n.tableId)return null;let s=n.cellIds[0];if(!s)return null;let l=G(e).get(n.tableId);if(!l)return null;for(let i of l.placed)if(i.cell.id===s)return {tableId:n.tableId,rowId:i.row.id,cellId:s,cellIds:n.cellIds,gridColumnIndex:i.cell.logicalGridColumn??i.cell.gridColumn,isHeaderRepeat:i.isHeaderRepeat};return null}let r=mt(e,t);if(!r)return null;let o=G(e).get(r.tableId);if(!o)return null;for(let a of o.placed){if(a.isHeaderRepeat)continue;let s=[];for(let l of a.cell.blocks)le(l,s,new Set);if(s.includes(t))return {tableId:r.tableId,rowId:a.row.id,cellId:a.cell.id,cellIds:[a.cell.id],gridColumnIndex:a.cell.logicalGridColumn??a.cell.gridColumn,isHeaderRepeat:a.row.isHeaderRepeat}}return null}var $n=new WeakMap;function zi(e,t){let n=$n.get(e);if(n)return n.get(t)??null;let r=new Map;for(let[o,a]of G(e))for(let s of a.placed){if(s.isHeaderRepeat)continue;let l=[];for(let d of s.cell.blocks)le(d,l,new Set);let i={tableId:o,rowId:s.row.id,cellId:s.cell.id,rowIndex:s.rowIndex,gridColumn:s.cell.gridColumn,gridSpan:s.cell.gridSpan};for(let d of l){let c=r.get(d);c&&c.tableId.length>=o.length||r.set(d,i);}}return $n.set(e,r),r.get(t)??null}exports.$=No;exports.A=ho;exports.Aa=zi;exports.B=mo;exports.C=ka;exports.D=lt;exports.E=Da;exports.F=go;exports.G=So;exports.H=Ha;exports.I=xo;exports.J=dt;exports.K=Me;exports.L=Ro;exports.M=Fo;exports.N=vo;exports.O=ut;exports.P=En;exports.Q=Cn;exports.R=wn;exports.S=On;exports.T=In;exports.U=Tn;exports.V=Oo;exports.W=Io;exports.X=se;exports.Y=Bo;exports.Z=ft;exports._=An;exports.a=ee;exports.aa=zn;exports.b=D;exports.ba=ti;exports.c=W;exports.ca=Nn;exports.d=j;exports.da=kn;exports.e=te;exports.ea=Ho;exports.f=Vt;exports.fa=Uo;exports.g=V;exports.ga=Go;exports.h=Oe;exports.ha=ui;exports.i=Te;exports.ia=Ko;exports.j=Je;exports.ja=jn;exports.k=M;exports.ka=oa;exports.l=Y;exports.la=ia;exports.m=tn;exports.ma=J;exports.n=nt;exports.na=Ne;exports.o=Pe;exports.oa=Kn;exports.p=ur;exports.pa=ua;exports.q=yr;exports.qa=pa;exports.r=$;exports.ra=ha;exports.s=ot;exports.sa=ma;exports.t=hr;exports.ta=_i;exports.u=w;exports.ua=ke;exports.v=at;exports.va=xa;exports.w=dn;exports.wa=Ra;exports.x=st;exports.xa=Fa;exports.y=fn;exports.ya=mt;exports.z=U;exports.za=Mi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {g,a,b,e,c,f}from'./chunk-DQS4KZUX.js';import {Gb,X as X$1,_,aa,ba,$,jc,Y as Y$1,Z as Z$1,rc,Qb,hd,gd,Mc,Hb,oc,Jb}from'./chunk-72BDQFHY.js';import {a as a$1}from'./chunk-4DB7ZFQN.js';import {la,da,ma,Hd,a as a$2}from'./chunk-CJCFEXTA.js';var Te=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function D(e){let n=new Map;for(let t of e)if(Array.isArray(t)){for(let r of t.slice(0,2048)){if(typeof r!="string"||!Te.test(r))continue;let o=r.toLowerCase();if(n.has(o)||n.set(o,r),n.size===2048)break}if(n.size===2048)break}return Object.freeze([...n.values()])}function Ge(e){let n=e&&"failures"in e?e.failures:void 0;return e==null||(e.sources?.length??0)===0&&(e.substitutions?.length??0)===0&&(n===void 0||Array.isArray(n)&&n.length===0)?void 0:e}var We=64,we=Object.freeze({family:"Calibri",sizeHalfPoints:22});function Se(e,...n){let t=[e,...n],r=[],o=new Set;for(let a of t)for(let d of a.sources??[]){let c=g(d.request);o.has(c)||(o.add(c),r.push(d));}let s=[],i=new Set;for(let a of t)for(let d of a.substitutions??[]){let c=g(d.from);o.has(c)||i.has(c)||(i.add(c),s.push(d));}let u=D(t.map(a=>a.supportedFamilies));return Object.freeze({...u.length?{supportedFamilies:u}:{},epoch:e.epoch??0,maxFontBytes:e.maxFontBytes??a,sources:Object.freeze(r),...s.length>0?{substitutions:Object.freeze(s)}:{},defaultFont:e.defaultFont??we,...e.language!==void 0?{language:e.language}:{}})}var Ne=/^[\p{L}\p{N}\p{M} \-.+_]{1,64}$/u;function Ee(e){let n=e?.defaultFont?.family;return n!==void 0&&Ne.test(n)?n:we.family}var Ie="docx-editor.dev/font-resolver",Ce=Symbol.for("docx-editor.dev/font-resolver");function tn(e){let n={value:true,enumerable:false,configurable:true};try{Object.defineProperty(e,Ce,n),Object.defineProperty(e,Ie,n);}catch(t){throw new TypeError("defineFontResolver cannot mark a frozen or sealed function; mark it before freezing, or wrap it in a fresh function and mark that.",{cause:t})}return e}function on(e){return typeof e=="function"&&e[Ce]===true}var X=e=>`${e.family.trim().toLowerCase()} ${e.weight} ${e.style}`;function Me(e,n,t){let r=new Map(e.map(o=>[X(o),o]));for(let[o,s]of n)r.set(o,s);for(let o of t)r.has(X(o.to))&&r.set(X(o.from),o.from);return [...r.values()]}async function rn(e,n,t={}){return ve(e,n,t)}async function sn(e,n,t={}){return ve(e,n,t)}async function ve(e,n,t){let r=e.map(_e),o,s=[],i=[],u=new Map,a$1=new Set,d=0,c=[],f=new Set,m=[],S=n.resolvedFaces??[],E=n.defaultFamily;for(let b$1=0;b$1<e.length;b$1+=1){ke(n.signal);let k=e[b$1],I=Me(S,u,c),P;try{let x=r[b$1],O;if(x){let l=await Re(x,n.signal);if(!l.ok)throw l.cause;O=l.value;}else if(typeof k=="function"){let l=await Re(Promise.resolve(k(Le(n,E,I,d))).then(p=>({ok:!0,value:p}),p=>({ok:!1,cause:p})),n.signal);if(!l.ok)throw l.cause;O=l.value;}else O=k;if(O==null)continue;if(typeof O=="function"){Z(t,k,b$1,new TypeError("A font origin answered with a function; pass the resolver itself rather than a function returning one"));continue}let R="failures"in O?O.failures:void 0,M=[];if(Array.isArray(R)){let l=Math.min(R.length,b);for(let p=0;p<l;p++)M.push(R[p]);R.length>l&&M.push(new Error("Additional font-origin failures were omitted"));}else R!==void 0&&M.push(R);let C=Be(O,a$1,d,f,o?"maxFontBytes"in o&&o.maxFontBytes!==void 0?o.maxFontBytes:a:void 0,t.reserveOwnedBytes,t.instrumentation);P=C;for(let l of new Set([...C.dropped,...M]))Z(t,k,b$1,l);let w=C.fragment;w.supportedFamilies&&s.push(w.supportedFamilies),m.push(...M);let $=(w.sources??[]).map(l=>(g(l.request),[X(l.request),l.request])),y=[...w.substitutions??[]];!o&&"defaultFont"in w&&(E=Ee(w)),o||(o=w);let g$1=new Set(C.sourceKeys);if(g$1.size>0){c=c.filter(l=>!g$1.has(g(l.from)));for(let l of g$1)f.delete(l);}i.push(...w.sources??[]);for(let l of C.sourceKeys)a$1.add(l);d+=C.ownedBytes;for(let[l,p]of $)u.set(l,p);for(let l of y)c.push(l),f.add(g(l.from));}catch(x){if(P?.releaseOwnedBytes?.(),n.signal?.aborted)throw n.signal.reason??x;if(x instanceof V)throw x.cause;Z(t,k,b$1,x);continue}}if(!o)return;let{epoch:N,...j}=Se({...o,supportedFamilies:D(s),sources:i,substitutions:c});return m.length===0?j:{...j,failures:Object.freeze(m)}}var V=class extends Error{constructor(t){super("Unable to reserve owned font bytes");this.cause=t;this.name="FontOwnershipReservationError";}cause},Y=class extends RangeError{};async function Re(e,n){if(!n)return e;ke(n);let t,r=new Promise((s,i)=>{t=i;}),o=()=>t?.(n.reason);n.addEventListener("abort",o,{once:true});try{return await Promise.race([e,r])}finally{n.removeEventListener("abort",o);}}function _e(e){if(e===null||typeof e!="object")return;let n;try{n=e.then;}catch(t){return Promise.resolve({ok:false,cause:t})}if(typeof n=="function")return Promise.resolve(e).then(t=>({ok:true,value:t}),t=>({ok:false,cause:t}))}function Be(e$1,n,t,r,o,s,i){let u=e$1.sources??[],a$1=e$1.substitutions??[],d="maxFontBytes"in e$1?e$1.maxFontBytes:void 0,c$1="defaultFont"in e$1?e$1.defaultFont:void 0,f$1="epoch"in e$1?e$1.epoch:void 0,m="language"in e$1?e$1.language:void 0;if(!Array.isArray(u)||!Array.isArray(a$1))throw new TypeError("Font origin sources and substitutions must be arrays");let S=u.length,E=a$1.length;if(S>b)throw new RangeError(`Font source count must not exceed ${b}`);if(E>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let N=d??a;if(!Number.isSafeInteger(N)||N<=0||N>a)throw new RangeError(`Font byte ceiling must be a positive safe integer no greater than ${a}`);let j=o??N,b$1=0,k=[],I=new Set,P=[],x=[];for(let y=0;y<S;y+=1){let g$1=u[y];try{let l=Q(g$1.request),p=g$1.availability,B=g$1.faceIndex,h=g$1.hash,A=g$1.id,L=g(l);if(p!==void 0&&p!=="available"&&p!=="forbidden")throw new TypeError("Font source availability must be available or forbidden");if(!Number.isSafeInteger(B)||B<0)throw new RangeError("Font face index must be a non-negative safe integer");if(typeof h!="string"||h.length===0)throw new TypeError("Font source hash must be a non-empty string");let K;if(p!=="forbidden"){if(typeof A!="string"||A.length===0)throw new TypeError("Font source id must be a non-empty string");K=g$1.bytes;let J=e(K);if(J>j)throw new RangeError("Font source exceeds the effective base byte ceiling");if(n.has(L)||I.has(L))continue;if(t+b$1+J>c)throw new RangeError(`Font sources exceed the aggregate byte ceiling of ${c}`);b$1+=J;}else K=new Uint8Array(0);if(n.has(L)||I.has(L))continue;if(n.size+I.size>=b)throw new Y(`Font source count must not exceed ${b}`);I.add(L),k.push(L),P.push(Object.freeze({request:l,id:A,bytes:K,hash:h,faceIndex:B,...p?{availability:p}:{}}));}catch(l){if(l instanceof Y)throw l;x.push(l);}}let O=new Set,R=[];for(let y=0;y<E;y+=1){let g$1=a$1[y];try{let l=Q(g$1.from),p=Q(g$1.to);g(l),g(p);let B=g$1.lineMetrics,h=B?Object.freeze({heightEm:B.heightEm,baselineEm:B.baselineEm}):void 0;if(h&&(!Number.isFinite(h.heightEm)||!Number.isFinite(h.baselineEm)||h.heightEm<=0||h.heightEm>4||h.baselineEm<0||h.baselineEm>h.heightEm))throw new RangeError("Font substitution line metrics must fit within a bounded em box");let A=g(l);if(n.has(A)||I.has(A)||r.has(A)||O.has(A))continue;O.add(A),R.push(Object.freeze({from:l,to:p,...h?{lineMetrics:h}:{}}));}catch(l){x.push(l);}}if((S>0||E>0)&&P.length===0&&R.length===0&&x.length>0)throw x[0];let M=r.size;for(let y of I)r.has(y)&&(M-=1);if(M+O.size>b)throw new RangeError(`Font substitution count must not exceed ${b}`);let C;if(c$1!==void 0){let y=c$1.family,g$1=c$1.sizeHalfPoints;if(g({family:y,weight:400,style:"normal"}),!Number.isSafeInteger(g$1)||g$1<=0)throw new RangeError("Default font size must be a positive safe integer in half-points");C=Object.freeze({family:y,sizeHalfPoints:g$1});}if(f$1!==void 0&&(!Number.isSafeInteger(f$1)||f$1<0))throw new RangeError("Font configuration epoch must be a non-negative safe integer");if(m!==void 0&&typeof m!="string")throw new TypeError("Font shaping language must be a string");let w;if(b$1>0&&s)try{w=s(b$1);}catch(y){throw new V(y)}let $;try{$=P.map(y=>f(y,i));}catch(y){throw w?.(),y}return {fragment:Object.freeze({supportedFamilies:D([e$1.supportedFamilies]),sources:Object.freeze($),substitutions:Object.freeze(R),...f$1!==void 0?{epoch:f$1}:{},...d!==void 0?{maxFontBytes:d}:{},...C?{defaultFont:C}:{},...m!==void 0?{language:m}:{}}),sourceKeys:Object.freeze(k),ownedBytes:b$1,dropped:Object.freeze(x),releaseOwnedBytes:w}}function Pe(e){return !Number.isSafeInteger(e)||e<=0?0:e>c?c:e}function Le(e,n,t,r){let{committedSourceBytes:o,...s}=e,i=Pe(r);return {...s,defaultFamily:n,...t.length>0?{resolvedFaces:t}:{},...i>0?{committedSourceBytes:i}:{}}}function Q(e){return Object.freeze({family:e.family,weight:e.weight,style:e.style})}function ke(e){if(e?.aborted)throw e.reason??new DOMException("Font resolution was aborted","AbortError")}function Z(e,n,t,r){let o;try{typeof n=="function"&&n.name.length>0&&(o=n.name);}catch{}let s=Object.freeze({originIndex:t,...o!==void 0?{originName:o}:{},cause:r});if(e.onOriginFailure)try{let u=e.onOriginFailure(s);Promise.resolve(u).catch(a=>{console.warn("[fonts] font-origin diagnostic callback failed",a);});return}catch(u){console.warn("[fonts] font-origin diagnostic callback failed",u);}let i="";try{r instanceof Error&&r.message.length>0&&(i=`: ${r.message}`);}catch{}console.warn(`[fonts] a font origin failed and was skipped${i}`,r);}function G(e){let n=new WeakMap;return (t,r)=>{let o=new Set;for(let s of t){let i=[{node:s,context:r,next:0}],u=a=>{i.pop();let d=i.at(-1)?.found??o;for(let c of a)d.add(c);};for(;i.length;){let a=i[i.length-1],d=n.get(a.node);if(d?.key===a.context.key){u(d.families);continue}if(!a.children){let m=e(a.node,a.context);a.children=m.children,a.found=new Set(m.families);}let c=a.children[a.next++];if(c){i.push({...c,next:0});continue}let f=[...a.found];f.length<=256?n.set(a.node,{key:a.context.key,families:f}):n.delete(a.node),u(f);}}return [...o]}}function W(e,n){return e.children.flatMap(t=>t.kind==="textValue"?[]:[{node:t,context:n}])}function qe(e,n){let{styles:t,theme:r,supplementalFamilies:o,depth:s}=n;if(e.kind==="table"){let a=Mc(e,468,s,t),d=[];for(let c of a?.rows??[])for(let f of c.cells){let m={...n,depth:s+1,cellStyle:f.styleFormatting,key:`${n.baseKey}|${s+1}|${JSON.stringify(f.styleFormatting)}`};for(let S of f.blocks)d.push({node:S,context:m});}return {children:d.reverse()}}let i=new Set;if(e.kind==="paragraph"){let a=e.children.find(c=>c.kind==="paragraphProperties"),d=Hb(t,a,n.cellStyle).runProperties;for(let c of oc(e,d,void 0,(f,m)=>Jb(f,m,t),void 0,void 0,"all-markup",void 0,void 0,r)){if(!c.text||c.fontSlot!=="eastAsia"&&!o.has(c.style.fontFamily??""))continue;let f=a$1((c.fontSlot==="eastAsia"?c.style.fontFamilyEastAsia:c.style.fontFamily)??void 0);f&&i.add(f);}}let u=e.localName==="txbxContent"?{...n,cellStyle:void 0,key:`${n.baseKey}|${s}|undefined`}:n;return {families:[...i],children:W(e,u).reverse()}}function ze(){let e=G(qe),n,t;return (r,o,s)=>{if(!n||t!==o||n.theme!==s){let i=Gb(o,s);t=o,n={key:`${i.cacheToken}|0|undefined`,baseKey:i.cacheToken,styles:i,theme:s,depth:0,supplementalFamilies:new Set([...Object.values(s.majorSupplemental??{}),...Object.values(s.minorSupplemental??{})])};}return e([...r].reverse(),n)}}function yn(e,n,t){return ze()(e,n,t)}function ee(e,n){return e.attributes.find(t=>t.localName===n)?.value}var De=G((e,n)=>{let t=[];if(e.namespaceUri===da){if(e.localName==="fldSimple"){let r=jc(ee(e,"instr")??"")?.font;r&&t.push(r);}if(e.localName==="p")for(let r of je(e))t.push(r);}return {families:t,children:W(e,n)}});function Cn(e){let n=new Map;for(let t of De(e,{key:""})){let r=a$1(t);r!==null&&!n.has(r.toLowerCase())&&n.set(r.toLowerCase(),r);}return [...n.values()]}function je(e){let n=[],t=X$1(),r=[];for(let o=e.children.length-1;o>=0;o-=1){let s=e.children[o];s.kind!=="textValue"&&r.push({node:s,containerDepth:0});}for(;r.length>0;){let{node:o,containerDepth:s}=r.pop();if(s>=la||o.namespaceUri===da&&o.localName==="p")continue;if(o.namespaceUri===da&&o.localName==="fldChar"){let u=ee(o,"fldCharType");u==="begin"?_(t):u==="separate"?(t.nesting===1&&Ae(t,n),aa(t)):u==="end"&&(t.nesting===1&&Ae(t,n),ba(t));continue}if(o.namespaceUri===da&&(o.localName==="instrText"||o.localName==="delInstrText")){$(t,$e(o),o.localName==="delInstrText");continue}if(o.namespaceUri===da&&o.localName==="fldSimple"){let u=jc(ee(o,"instr")??"");u?.font&&n.push(u.font);}let i=ma(o,s);for(let u=o.children.length-1;u>=0;u-=1){let a=o.children[u];a.kind!=="textValue"&&r.push({node:a,containerDepth:i});}}return Y$1(t),n}function Ae(e,n){let t=Z$1(e);if(t.overflow)return;let r=jc(t.instruction);r?.font&&n.push(r.font);}function $e(e){let n="",t=[...e.children].reverse();for(;t.length>0&&n.length<=256;){let r=t.pop();if(r.kind==="textValue")n+=r.value;else for(let o=r.children.length-1;o>=0;o-=1)t.push(r.children[o]);}return n}function vn(e,n,t,r){if(!n)return [];let o=rc(n),s=Gb(t,r),i=new Map;for(let u of e)for(let a of Ke(u)){let d=Hd(a.children),c=f=>{if(f)for(let m of f.values())for(let S of [m.markerStyle.fontFamily,m.markerStyle.fontFamilyEastAsia]){let E=a$1(S??void 0);if(E===null)continue;let N=E.toLowerCase();i.has(N)||i.set(N,E);}};c(Qb(d,o,s));for(let f of d){let m=hd(f);for(let S of m.contents)c(gd(S,o,s));}}return [...i.values()].sort((u,a)=>u.localeCompare(a))}function Ke(e){if(e.localName==="document"){for(let n of e.children)if(n.kind!=="textValue"&&n.localName==="body")return [n];return []}if(e.localName==="footnotes"||e.localName==="endnotes"){let n=[];for(let t of e.children)t.kind!=="textValue"&&(t.localName==="footnote"||t.localName==="endnote")&&n.push(t);return n}return [e]}var Ue={regular:{weight:400,style:"normal"},bold:{weight:700,style:"normal"},italic:{weight:400,style:"italic"},boldItalic:{weight:700,style:"italic"}};function Tn(e,n){let t=[],r=[],o=0;for(let s of e){let i=s.bytes.byteLength;if(!Number.isSafeInteger(i)||i>n||i>a||i>c-o){r.push(s);continue}o+=i,t.push(s);}return {sources:t,dropped:r}}function Nn(e,n,t){let r=n.reduce((s,i)=>s+i.bytes.byteLength,0),o=new Set(n.filter(s=>s.request.family.trim().length>0).map(s=>g(s.request)));return He(e,{maxFontBytes:t,aggregateBudget:Math.max(0,c-r),shadowedRequests:o})}function He(e,n){let t=[],r=[],o=n.aggregateBudget,s=new Set;for(let i of e){let u=Ue[i.style],a=Object.freeze({family:i.family,weight:u.weight,style:u.style});if(i.family.trim().length===0){r.push({request:a,partName:i.partName,reason:"malformed"});continue}let d=g(a);if(!(n.shadowedRequests?.has(d)||s.has(d))){if(s.add(d),i.bytes.byteLength>n.maxFontBytes||i.bytes.byteLength>o){r.push({request:a,partName:i.partName,reason:"overLimit"});continue}o-=i.bytes.byteLength,t.push({request:a,id:`embedded:${i.partName}#${i.style}`,bytes:i.bytes,hash:a$2(i.bytes),faceIndex:0});}}return {sources:t,dropped:r}}export{D as a,Ge as b,We as c,we as d,Se as e,Ee as f,Ie as g,Ce as h,tn as i,on as j,rn as k,sn as l,Tn as m,Nn as n,He as o,G as p,W as q,ze as r,yn as s,Cn as t,je as u,vn as v};
|