@betteroffice/docx 0.0.1 → 0.0.2
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 +19 -0
- package/dist/chunk-AEQOEQJ7.mjs +57 -0
- package/dist/chunk-AZ52IWB6.mjs +16 -0
- package/dist/{chunk-SINEY6ZF.mjs → chunk-B4IR6YP4.mjs} +1 -1
- package/dist/chunk-IFT6DUJX.mjs +1 -0
- package/dist/{chunk-H3JCIGWK.mjs → chunk-NJHOPXZW.mjs} +1 -1
- package/dist/chunk-NTQM4EYN.mjs +1 -0
- package/dist/{chunk-KXNZFTTK.mjs → chunk-WBH3SXI6.mjs} +1 -1
- package/dist/collaboration/index.d.mts +64 -0
- package/dist/collaboration/index.mjs +1 -0
- package/dist/{content-sSHuWw49.d.mts → content-DLFHRQav.d.mts} +8 -8
- package/dist/core.d.mts +148 -341
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-p-ijSzdh.d.mts → displayListQueries-UGc_XBUv.d.mts} +1 -1
- package/dist/docx/index.d.mts +40 -520
- package/dist/docx/index.mjs +2 -2
- package/dist/editor/index.d.mts +35 -151
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-Bx6DK6-2.d.mts → fontLoader-aSewHMKF.d.mts} +65 -63
- package/dist/{formatting-DoL7KBSL.d.mts → formatting-D1EPSaJP.d.mts} +1 -1
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/index-Bwxm3oiC.d.mts +934 -0
- package/dist/layout/index.d.mts +18 -240
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +10 -58
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +10 -11
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +8 -9
- package/dist/plugin-api/index.d.mts +191 -6
- package/dist/plugin-api/resolveItemPositions.d.mts +4 -5
- package/dist/{rustDisplayList-dqunvwxH.d.mts → rustDisplayList-CX78djsZ.d.mts} +5 -5
- package/dist/rustMeasureSource-D1KsQvVC.d.mts +106 -0
- package/dist/selectiveSave-CVoajSKE.d.mts +56 -0
- package/dist/styles/index.d.mts +4 -39
- package/dist/styles/index.mjs +1 -1
- package/dist/{styles-VxNcXLdi.d.mts → styles-Dn_o3Vo5.d.mts} +2 -2
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +40 -14
- package/dist/{types-DNrYr6yQ.d.mts → types-DMkDbvEu.d.mts} +3 -71
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +110 -576
- package/dist/utils/index.mjs +1 -84
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/utils/units.d.mts +33 -2
- package/dist/wasm-BGQBTR2J.mjs +1 -0
- package/dist/wasm-edit.d.mts +13 -5
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -881
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +16 -139
- package/dist/Subscribable-DOz6Ohoo.d.mts +0 -33
- package/dist/agent/index.d.mts +0 -531
- package/dist/agent/index.mjs +0 -1
- package/dist/chunk-34K66SY4.mjs +0 -1
- package/dist/chunk-4RCISPPE.mjs +0 -1
- package/dist/chunk-52GB3Y42.mjs +0 -1
- package/dist/chunk-6PW4CWUG.mjs +0 -1
- package/dist/chunk-7DEIW7FL.mjs +0 -1
- package/dist/chunk-7PCO5I2O.mjs +0 -1
- package/dist/chunk-BI3B33LI.mjs +0 -1
- package/dist/chunk-BIQWVK5P.mjs +0 -2
- package/dist/chunk-DXKG3HQ5.mjs +0 -16
- package/dist/chunk-FPZBTOD6.mjs +0 -1
- package/dist/chunk-FZIA7OFY.mjs +0 -1
- package/dist/chunk-GWKJ2Y4Y.mjs +0 -1
- package/dist/chunk-HJGAQIU7.mjs +0 -2
- package/dist/chunk-I6KKMUUC.mjs +0 -1
- package/dist/chunk-IL5JZJT7.mjs +0 -1
- package/dist/chunk-JY6ILTNS.mjs +0 -1
- package/dist/chunk-KEE52TT5.mjs +0 -1
- package/dist/chunk-KVKLLTDP.mjs +0 -58
- package/dist/chunk-L5ISVQ3W.mjs +0 -1
- package/dist/chunk-LDUWIM7M.mjs +0 -1
- package/dist/chunk-N5Q3YN64.mjs +0 -1
- package/dist/chunk-NEWOMDTX.mjs +0 -1
- package/dist/chunk-O2QSE2I7.mjs +0 -1
- package/dist/chunk-OJOHXQNQ.mjs +0 -1
- package/dist/chunk-OMR3TWCD.mjs +0 -2
- package/dist/chunk-P3KDV4M2.mjs +0 -1
- package/dist/chunk-Q7PO7V73.mjs +0 -1
- package/dist/chunk-QOUFE3VX.mjs +0 -1
- package/dist/chunk-TYHI7RAD.mjs +0 -1
- package/dist/chunk-UIEJWORW.mjs +0 -1
- package/dist/chunk-VAOUFAUH.mjs +0 -1
- package/dist/chunk-VBOTMRXV.mjs +0 -1
- package/dist/chunk-VCER63GQ.mjs +0 -1
- package/dist/chunk-WAUF2UC7.mjs +0 -2
- package/dist/chunk-X4XDO3LZ.mjs +0 -1
- package/dist/chunk-XQBCCJBO.mjs +0 -9
- package/dist/chunk-XWUOLYRQ.mjs +0 -2
- package/dist/chunk-XYH6XWP3.mjs +0 -10
- package/dist/chunk-YBIM6UJV.mjs +0 -8
- package/dist/chunk-YCIH2Q3E.mjs +0 -1
- package/dist/chunk-ZOV5KL7C.mjs +0 -1
- package/dist/colorResolver-n0o7H7ep.d.mts +0 -290
- package/dist/core-plugins.d.mts +0 -37
- package/dist/core-plugins.mjs +0 -1
- package/dist/docx/parser.d.mts +0 -41
- package/dist/docx/parser.mjs +0 -1
- package/dist/docx/rezip.d.mts +0 -148
- package/dist/docx/rezip.mjs +0 -1
- package/dist/docx/serializer/index.d.mts +0 -42
- package/dist/docx/serializer/index.mjs +0 -1
- package/dist/editorTree-DO5PyDK8.d.mts +0 -37
- package/dist/executor-7O2RBJ2B.mjs +0 -1
- package/dist/headerFooterLayout-0zPT64Qc.d.mts +0 -316
- package/dist/headless.d.mts +0 -69
- package/dist/headless.mjs +0 -1
- package/dist/layout/flow/index.d.mts +0 -149
- package/dist/layout/flow/index.mjs +0 -1
- package/dist/layout/measure/index.d.mts +0 -324
- package/dist/layout/measure/index.mjs +0 -1
- package/dist/layout/pagination/types.d.mts +0 -4
- package/dist/layout/pagination/types.mjs +0 -1
- package/dist/managers/AutoSaveManager.d.mts +0 -81
- package/dist/managers/AutoSaveManager.mjs +0 -1
- package/dist/managers/TableSelectionManager.d.mts +0 -74
- package/dist/managers/TableSelectionManager.mjs +0 -1
- package/dist/managers/types.d.mts +0 -113
- package/dist/managers/types.mjs +0 -0
- package/dist/mcp-cli.mjs +0 -142
- package/dist/mcp.d.mts +0 -162
- package/dist/mcp.mjs +0 -16
- package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +0 -109
- package/dist/measuredBlock-DZwz8zhD.d.mts +0 -26
- package/dist/plugin-api/types.d.mts +0 -193
- package/dist/plugin-api/types.mjs +0 -0
- package/dist/processTemplate-HDUIZFJ5.mjs +0 -1
- package/dist/registry-DMM5VTdT.d.mts +0 -165
- package/dist/rustPagination-Bj2hq013.d.mts +0 -106
- package/dist/sectionConfigs-DW3J8q0X.d.mts +0 -55
- package/dist/selectionContext-Buc9BCU1.d.mts +0 -570
- package/dist/selectiveSave-oFBJ1n71.d.mts +0 -16
- package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +0 -23
- package/dist/settingsParser-CcGvtmCK.d.mts +0 -33
- package/dist/types/agentApi.d.mts +0 -456
- package/dist/types/agentApi.mjs +0 -1
- package/dist/types-dYdjUZMo.d.mts +0 -311
- package/dist/units-O5Y02RKQ.d.mts +0 -34
- package/dist/utils/headingCollector.d.mts +0 -28
- package/dist/utils/headingCollector.mjs +0 -1
- package/dist/utils/highlightColors.d.mts +0 -14
- package/dist/utils/highlightColors.mjs +0 -1
- package/dist/utils/textSelection.d.mts +0 -92
- package/dist/utils/textSelection.mjs +0 -1
- package/dist/variableDetector-Borj29SF.d.mts +0 -115
- package/dist/wasm-FZQ5XB2Y.mjs +0 -1
- package/dist/watermarkApi-DCxjutkg.d.mts +0 -38
package/dist/utils/index.mjs
CHANGED
|
@@ -1,84 +1 @@
|
|
|
1
|
-
export{a as collectHeadings}from'../chunk-TYHI7RAD.mjs';export{k as createDoubleClickWordSelector,l as createTripleClickParagraphSelector,h as expandSelectionToWordBoundaries,e as findWordAt,c as findWordBoundaries,d as getWordAt,j as handleClickForMultiClick,i as selectParagraphAtCursor,f as selectWordAtCursor,g as selectWordInTextNode}from'../chunk-4RCISPPE.mjs';export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'../chunk-34K66SY4.mjs';export{b as createDocumentWithText,a as createEmptyDocument}from'../chunk-VAOUFAUH.mjs';import {i,b as b$1}from'../chunk-L5ISVQ3W.mjs';export{j as colorsEqual,g as createRgbColor,f as createThemeColor,h as ensureHexPrefix,c as isBlack,d as isWhite,e as parseColorString,a as resolveHighlightColor,i as resolveHighlightToCss,b as resolveShadingColor}from'../chunk-L5ISVQ3W.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'../chunk-O2QSE2I7.mjs';export{a as sanitizeHref}from'../chunk-ZOV5KL7C.mjs';import {e,d as d$1}from'../chunk-FZIA7OFY.mjs';export{i as blendColors,g as darkenColor,k as generateThemeTintShadeMatrix,f as getContrastingColor,j as getThemeTintShadeHex,h as lightenColor,d as resolveColor,e as resolveColorToHex}from'../chunk-FZIA7OFY.mjs';import {l,k,q as q$1,g,f,n}from'../chunk-3UBMCDME.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-3UBMCDME.mjs';import {o,d,e as e$1}from'../chunk-DXKG3HQ5.mjs';export{s as FONT_MAPPING,o as canRenderFont,c as deobfuscateFont,B as extractEmbeddedFontFaces,x as extractFontsFromDocument,A as getEmbeddedFontFaces,z as getEmbeddedFontFamilies,t as getGoogleFontEquivalent,l as getLoadedFonts,h as isFontLoaded,j as isGoogleFontsEnabled,k as isLoading,b as isValidFontKey,y as loadDocumentFonts,C as loadEmbeddedFonts,f as loadFont,r as loadFontDefinitions,p as loadFontFromBuffer,q as loadFontFromUrl,u as loadFontWithMapping,g as loadFonts,v as loadFontsWithMapping,n as onFontError,m as onFontsLoaded,w as preloadCommonFonts,i as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-DXKG3HQ5.mjs';import'../chunk-FPZBTOD6.mjs';import'../chunk-H3JCIGWK.mjs';import'../chunk-SINEY6ZF.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';import wo from'dompurify';var Fo;function Ro(){return Fo??(Fo=wo(window))}var Ao="application/x-docx-editor",h={HTML:"text/html",PLAIN:"text/plain"};function Po(e){if(!e)return [];let t=()=>{if(!e.items||e.items.length===0)return [];let a=[];for(let d of Array.from(e.items)){if(d.kind!=="file"||!d.type.startsWith("image/"))continue;let f=d.getAsFile();f&&a.push(f);}return a},o=()=>!e.files||e.files.length===0?[]:Array.from(e.files).filter(a=>a.type.startsWith("image/")),n=t(),r=n.length?n:o();if(r.length<=1)return r;let i=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml","image/bmp","image/tiff"],s=a=>{let d=a[0],f=i.indexOf(d.type);f<0&&(f=Number.MAX_SAFE_INTEGER);for(let u of a.slice(1)){let m=i.indexOf(u.type);if(m<0&&(m=Number.MAX_SAFE_INTEGER),m<f){d=u,f=m;continue}m===f&&u.size>d.size&&(d=u);}return d},l=new Map;for(let a of r){let d=a.name?.trim()??"",u=(d?d.replace(/\.[^/.]+$/,"").toLowerCase():"")||`size:${a.size}`,m=l.get(u);m?m.push(a):l.set(u,[a]);}let c=[];for(let a of l.values())c.push(s(a));return c}async function j(e,t={}){let{includeFormatting:o=true,onError:n,theme:r}=t;try{let i=N(e,o,r);return await P(i)}catch(i){return n?.(i),false}}async function Eo(e,t={}){let{includeFormatting:o=true,onError:n,theme:r}=t;try{let i=ae(e,o,r);return await P(i)}catch(i){return n?.(i),false}}function N(e,t=true,o){let n=e.map(Y).join(""),r=t?pe(e,o):q(n),i=JSON.stringify(e);return {plainText:n,html:r,internal:i}}function ae(e,t=true,o){let n=e.map(Lo).join(`
|
|
2
|
-
`),r=t?Ho(e,o):q(n),i=JSON.stringify(e);return {plainText:n,html:r,internal:i}}async function P(e){try{if(navigator.clipboard&&navigator.clipboard.write){let t=[new ClipboardItem({[h.PLAIN]:new Blob([e.plainText],{type:h.PLAIN}),[h.HTML]:new Blob([e.html],{type:h.HTML})})];return await navigator.clipboard.write(t),!0}return ne(e)}catch{return ne(e)}}function ne(e){let t=document.createElement("div");t.innerHTML=e.html,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t);try{let o=window.getSelection();if(!o)return !1;let n=document.createRange();n.selectNodeContents(t),o.removeAllRanges(),o.addRange(n);let r=document.execCommand("copy");return o.removeAllRanges(),r}finally{document.body.removeChild(t);}}async function ko(e={}){let{cleanWordFormatting:t=true,onError:o}=e;try{if(navigator.clipboard&&navigator.clipboard.read){let n=await navigator.clipboard.read();return await vo(n,t)}return null}catch(n){return o?.(n),null}}async function vo(e,t){let o="",n="";for(let r of e)r.types.includes(h.HTML)&&(o=await(await r.getType(h.HTML)).text()),r.types.includes(h.PLAIN)&&(n=await(await r.getType(h.PLAIN)).text());return V(o,n,t)}function le(e,t={}){let{cleanWordFormatting:o=true}=t,n=e.clipboardData;if(!n)return null;let r=n.getData(h.HTML),i=n.getData(h.PLAIN);return V(r,i,o)}function V(e,t,o=true){let n=ce(e),r=de(e);if(r){let l=e.match(/data-docx-editor-content="([^"]+)"/);if(l)try{return {runs:JSON.parse(decodeURIComponent(l[1])),fromWord:!1,fromEditor:!0,plainText:t}}catch{}}let i=e;return n&&o&&(i=ue(e)),{runs:fe(i,t),fromWord:n,fromEditor:r,plainText:t}}function ce(e){return e.includes("urn:schemas-microsoft-com:office")||e.includes("mso-")||e.includes("MsoNormal")||e.includes('class="Mso')||e.includes("<!--[if gte mso")}function de(e){return e.includes("data-docx-editor")||e.includes("docx-run")||e.includes("docx-paragraph")}function No(e){let t="",o=0;for(;o<e.length;){let n=e.indexOf("<!--",o);if(n===-1){t+=e.slice(o);break}t+=e.slice(o,n);let r=e.indexOf("-->",n+4);if(r===-1)break;o=r+3;}return t}function re(e,t){let o="<"+t,n="</"+t,r=e.toLowerCase(),i="",s=0;for(;s<e.length;){let l=r.indexOf(o,s);if(l===-1){i+=e.slice(s);break}let c=e.indexOf(">",l),a=c===-1?-1:r.indexOf(n,c+1),d=a===-1?-1:e.indexOf(">",a);if(d===-1){i+=e.slice(s);break}i+=e.slice(s,l),s=d+1;}return i}function ue(e){let t=e;return t=No(t),t=t.replace(/<\?xml[^>]*>/gi,""),t=re(t,"o:"),t=t.replace(/<o:[^>]*\/>/gi,""),t=re(t,"w:"),t=t.replace(/<w:[^>]*\/>/gi,""),t=t.replace(/\s*mso-[^:;]+:[^;]+;?/gi,""),t=t.replace(/\s*style="\s*"/gi,""),t=t.replace(/\s*class="[^"]*Mso[^"]*"/gi,""),t=t.replace(/<span[^>]*>\s*<\/span>/gi,""),t=t.replace(/<\/?font[^>]*>/gi,""),t=t.replace(/\s+/g," ").trim(),t}function fe(e,t){if(!e||e.trim()==="")return t?[X(t)]:[];let o=Ro().sanitize(e),r=new DOMParser().parseFromString(o,"text/html").body,i=[];return U(r,i,{}),i.length===0&&t?[X(t)]:i}function U(e,t,o){if(e.nodeType===Node.TEXT_NODE){let s=e.textContent||"";(s.trim()||s.includes(" "))&&t.push(X(s,o));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=n.tagName.toLowerCase(),i={...o,...Do(n)};switch(r){case "br":t.push(se(i));return;case "p":case "div":for(let s of n.childNodes)U(s,t,i);n.nextSibling&&t.push(se(i));return;case "b":case "strong":i.bold=true;break;case "i":case "em":i.italic=true;break;case "u":i.underline={style:"single"};break;case "s":case "strike":case "del":i.strike=true;break;case "sup":i.vertAlign="superscript";break;case "sub":i.vertAlign="subscript";break;case "code":case "pre":i.fontFamily={ascii:"Courier New"};break}for(let s of n.childNodes)U(s,t,i);}function Do(e){let t={},o=e.style;(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(t.bold=true),o.fontStyle==="italic"&&(t.italic=true);let n=o.textDecoration||o.textDecorationLine;if(n&&(n.includes("underline")&&(t.underline={style:"single"}),n.includes("line-through")&&(t.strike=true)),o.fontSize){let r=parseFloat(o.fontSize);isNaN(r)||(t.fontSize=Math.round(r/1.333*2));}if(o.fontFamily){let r=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();r&&(t.fontFamily={ascii:r});}if(o.color){let r=ie(o.color);r&&(t.color={rgb:r});}if(o.backgroundColor&&o.backgroundColor!=="transparent"){let r=ie(o.backgroundColor);r&&(t.shading={fill:{rgb:r}});}return t}function ie(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let o=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),r=parseInt(t[3]).toString(16).padStart(2,"0");return (o+n+r).toUpperCase()}return null}function Y(e){return e.content.map(t=>t.type==="text"?t.text:t.type==="tab"?" ":t.type==="break"&&t.breakType==="textWrapping"?`
|
|
3
|
-
`:"").join("")}function Lo(e){return (e.content||[]).map(t=>t.type==="run"?Y(t):"").join("")}function pe(e,t){return e.map(o=>Oo(o,t)).join("")}function Ho(e,t){return e.map(o=>`<p>${pe(o.content?.filter(n=>n.type==="run")||[],t)}</p>`).join("")}function Oo(e$1,t){let o=Y(e$1);if(!o)return "";let n=q(o),r=e$1.formatting;if(!r)return n;r.bold&&(n=`<strong>${n}</strong>`),r.italic&&(n=`<em>${n}</em>`),r.underline&&(n=`<u>${n}</u>`),r.strike&&(n=`<s>${n}</s>`),r.vertAlign==="superscript"&&(n=`<sup>${n}</sup>`),r.vertAlign==="subscript"&&(n=`<sub>${n}</sub>`);let i=[];if(r.fontSize){let c=r.fontSize/2;i.push(`font-size: ${c}pt`);}r.fontFamily?.ascii&&i.push(`font-family: "${r.fontFamily.ascii}"`);let s=e(r.color,t);s&&i.push(`color: #${s}`);let l=e(r.shading?.fill,t);return l&&i.push(`background-color: #${l}`),i.length>0&&(n=`<span style="${i.join("; ")}">${n}</span>`),n}function q(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function X(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function se(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function Mo(e){let{onCopy:t,onCut:o,onPaste:n,clipboardOptions:r={}}=e;return {handleCopy:async a=>{if(!t)return;let d=t();if(!d)return;a.preventDefault();let f=N(d.runs);a.clipboardData?(a.clipboardData.setData(h.PLAIN,f.plainText),a.clipboardData.setData(h.HTML,f.html)):await P(f);},handleCut:async a=>{if(!o)return;let d=o();if(!d)return;a.preventDefault();let f=N(d.runs);a.clipboardData?(a.clipboardData.setData(h.PLAIN,f.plainText),a.clipboardData.setData(h.HTML,f.html)):await P(f);},handlePaste:a=>{if(!n)return;a.preventDefault();let d=le(a,r);d&&n(d);},handleKeyDown:async a=>{let d=a.ctrlKey||a.metaKey;if(d&&a.key==="c"&&!a.shiftKey&&t){let f=t();f&&await j(f.runs,r);}if(d&&a.key==="x"&&!a.shiftKey&&o){let f=o();f&&await j(f.runs,r);}}}}function he(e){let t=new Set,o=e.package;if(o.theme&&Io(o.theme,t),o.styles&&Bo(o.styles,t),o.document)for(let n of o.document.content)E(n,t);if(o.headers)for(let n of o.headers.values())me(n,t);if(o.footers)for(let n of o.footers.values())me(n,t);if(o.footnotes)for(let n of o.footnotes)Uo(n,t);if(o.endnotes)for(let n of o.endnotes)Xo(n,t);return Array.from(t).sort()}function Io(e,t){let o=e.fontScheme;o&&(o.majorFont&&ge(o.majorFont,t),o.minorFont&&ge(o.minorFont,t));}function ge(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function Bo(e,t){e.docDefaults&&(e.docDefaults.rPr&&R(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&R(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&R(o.rPr,t),o.pPr?.runProperties&&R(o.pPr.runProperties,t);}function R(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function _o(e,t){e.runProperties&&R(e.runProperties,t);}function E(e,t){e.type==="paragraph"?Wo(e,t):e.type==="table"&&zo(e,t);}function Wo(e,t){e.formatting&&_o(e.formatting,t);for(let o of e.content)Ko(o,t);}function Ko(e,t){if(e.type==="run")D(e,t);else if(e.type==="hyperlink")$o(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&D(o,t);if("fieldResult"in e)for(let o of e.fieldResult)D(o,t);}}function D(e,t){e.formatting&&R(e.formatting,t);}function $o(e,t){for(let o of e.children)o.type==="run"&&D(o,t);}function zo(e,t){for(let o of e.rows)Go(o,t);}function Go(e,t){for(let o of e.cells)jo(o,t);}function jo(e,t){for(let o of e.content)E(o,t);}function me(e,t){for(let o of e.content)E(o,t);}function Uo(e,t){for(let o of e.content)E(o,t);}function Xo(e,t){for(let o of e.content)E(o,t);}var Vo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function be(e,t={}){let o$1=t.canRender??o,n=new Set;for(let l of t.exclude??[])n.add(l.trim().toLowerCase());let r=new Set;for(let l of t.embeddedFamilies??[])r.add(l.trim().toLowerCase());let i=[],s=new Set;for(let l of e){let c=l.trim(),a=c.toLowerCase();!c||Vo.has(a)||n.has(a)||s.has(a)||!r.has(a)&&!o$1(c)||(s.add(a),i.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return i}function Yo(e,t={}){return be(he(e),t)}function qo(e,t){if(!e||e.length===0)return [];let o=new Set;for(let i of t)o.add(i.trim().toLowerCase());let n=new Set,r=[];for(let i of e){let s=i.name.trim().toLowerCase();o.has(s)||n.has(s)||(n.add(s),r.push(i));}return r}function Jo(e,t){if(!e)return {};let o={};if(e.fontFamily){let s=null;if(e.fontFamily.asciiTheme&&t?.fontScheme&&(s=e$1(e.fontFamily.asciiTheme,t.fontScheme)),s||(s=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),s){let l=d(s);o.fontFamily=l.cssFallback;}}if(e.fontSize!==void 0&&(o.fontSize=`${l(e.fontSize)}pt`),e.bold&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic"),e.color&&(o.color=d$1(e.color,t)),e.highlight&&e.highlight!=="none"&&(o.backgroundColor=i(e.highlight)),e.shading){let s=L(e.shading,t);s&&!o.backgroundColor&&(o.backgroundColor=s);}let n=[],r=[],i$1=[];if(e.underline&&e.underline.style!=="none"){n.push("underline");let s=Zo(e.underline.style);s!=="solid"&&r.push(s),e.underline.color&&i$1.push(d$1(e.underline.color,t));}if(e.strike&&n.push("line-through"),e.doubleStrike&&n.push("line-through"),n.length>0&&(o.textDecoration=n.join(" "),r.length>0&&(o.textDecorationStyle=r[0]),i$1.length>0&&(o.textDecorationColor=i$1[0])),e.vertAlign)switch(e.vertAlign){case "superscript":o.verticalAlign="super",o.fontSize||(o.fontSize="0.83em");break;case "subscript":o.verticalAlign="sub",o.fontSize||(o.fontSize="0.83em");break}if(e.position&&e.position!==0){let s=k(e.position);o.position="relative",o.top=q$1(-s);}return e.allCaps?o.textTransform="uppercase":e.smallCaps&&(o.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(o.letterSpacing=q$1(g(e.spacing))),e.scale!==void 0&&e.scale!==100&&(o.transform=`scaleX(${e.scale/100})`,o.display="inline-block"),e.hidden&&(o.display="none"),e.emboss&&(o.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(o.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(o.WebkitTextStroke="1px currentColor",o.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(o.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(o.direction="rtl"),o}function Qo(e,t){if(!e)return {};let o={};if(e.alignment&&(o.textAlign=en(e.alignment)),e.beforeAutospacing?o.marginTop=q$1(f):e.spaceBefore!==void 0&&(o.marginTop=q$1(g(e.spaceBefore))),e.afterAutospacing?o.marginBottom=q$1(f):e.spaceAfter!==void 0&&(o.marginBottom=q$1(g(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let n=g(e.lineSpacing);n>0&&(o.lineHeight=q$1(n));break}case "atLeast":{let n=g(e.lineSpacing);n>0&&(o.minHeight=q$1(n),o.lineHeight=q$1(n));break}default:{let n=e.lineSpacing/240;n>0&&(o.lineHeight=n.toString());break}}if(e.indentLeft!==void 0&&(o.marginLeft=q$1(g(e.indentLeft))),e.indentRight!==void 0&&(o.marginRight=q$1(g(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?o.textIndent=q$1(g(e.indentFirstLine)):o.textIndent=q$1(g(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(o,T(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(o,T(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(o,T(e.borders.left,"Left",t)),e.borders.right&&Object.assign(o,T(e.borders.right,"Right",t))),e.shading){let n=L(e.shading,t);n&&(o.backgroundColor=n);}return e.bidi&&(o.direction="rtl"),e.pageBreakBefore&&(o.pageBreakBefore="always"),e.keepNext&&(o.pageBreakAfter="avoid"),e.keepLines&&(o.pageBreakInside="avoid"),o}function T(e,t="",o){if(!e||e.style==="none"||e.style==="nil")return {};let n$1={},r=e.size?n(e.size):1,i=e.color?d$1(e.color,o):"#000000",s=tn(e.style),l=`border${t}Width`,c=`border${t}Style`,a=`border${t}Color`;return n$1[l]=q$1(Math.max(1,r)),n$1[c]=s,n$1[a]=i,n$1}function L(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":b$1(e.fill,t):e.pattern==="solid"&&e.color?b$1(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?b$1(e.color,t):""}function Zo(e){switch(e){case "double":return "double";case "dotted":case "dottedHeavy":return "dotted";case "dash":case "dashedHeavy":case "dashLong":case "dashLongHeavy":case "dotDash":case "dashDotHeavy":case "dotDotDash":case "dashDotDotHeavy":return "dashed";case "wave":case "wavyHeavy":case "wavyDouble":return "wavy";default:return "solid"}}function en(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function tn(e){switch(e){case "none":case "nil":return "none";case "double":case "triple":return "double";case "dotted":return "dotted";case "dashed":case "dashSmallGap":return "dashed";case "threeDEmboss":return "ridge";case "threeDEngrave":return "groove";case "outset":return "outset";case "inset":return "inset";default:return "solid"}}function on(...e){let t={};for(let o of e)o&&Object.assign(t,o);return t}function nn(e,t){if(!e)return {};let o={};if(e.verticalAlign&&(o.verticalAlign=e.verticalAlign),e.textDirection&&(e.textDirection.includes("rl")||e.textDirection.includes("Rl"))&&(o.direction="rtl"),e.shading){let n=L(e.shading,t);n&&(o.backgroundColor=n);}return e.borders&&(e.borders.top&&Object.assign(o,T(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(o,T(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(o,T(e.borders.left,"Left",t)),e.borders.right&&Object.assign(o,T(e.borders.right,"Right",t))),e.margins&&(e.margins.top?.value&&(o.paddingTop=q$1(g(e.margins.top.value))),e.margins.bottom?.value&&(o.paddingBottom=q$1(g(e.margins.bottom.value))),e.margins.left?.value&&(o.paddingLeft=q$1(g(e.margins.left.value))),e.margins.right?.value&&(o.paddingRight=q$1(g(e.margins.right.value)))),o}function rn(e,t){if(!e)return {};let o={};if(e.pageWidth&&(o.width=q$1(g(e.pageWidth))),e.pageHeight&&(o.minHeight=q$1(g(e.pageHeight))),e.marginTop&&(o.paddingTop=q$1(g(e.marginTop))),e.marginBottom&&(o.paddingBottom=q$1(g(e.marginBottom))),e.marginLeft&&(o.paddingLeft=q$1(g(e.marginLeft))),e.marginRight&&(o.paddingRight=q$1(g(e.marginRight))),e.background?.color){let n=d$1(e.background.color,t);n&&(o.backgroundColor=n);}return o}function C(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function J(e){return e?/\s/.test(e):false}function sn(e){return e?/[\p{P}]/u.test(e):false}function an(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let o=t;for(;o>0&&J(e[o-1]);)o--;if(o===0)return 0;for(;o>0&&C(e[o-1]);)o--;return o}function ln(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let o=t;for(;o<e.length&&C(e[o]);)o++;for(;o<e.length&&J(e[o]);)o++;return o}function xe(e,t){if(t>=e.length)return e.length;let o=t;for(;o<e.length&&C(e[o]);)o++;for(;o<e.length&&!C(e[o]);)o++;return o}function ye(e,t){if(t<=0)return 0;let o=t;for(;o>0&&!C(e[o-1]);)o--;for(;o>0&&C(e[o-1]);)o--;return o}function Se(e,t){if(!window.getSelection())return null;let n=document.createRange();if(e.nodeType===Node.TEXT_NODE){n.setStart(e,Math.min(t,e.textContent?.length||0)),n.collapse(true);let i=n.getBoundingClientRect().top,s=0,l=t;for(;s<l;){let c=Math.floor((s+l)/2);n.setStart(e,c),n.collapse(true);let a=n.getBoundingClientRect();Math.abs(a.top-i)<2?l=c:s=c+1;}return {node:e,offset:s}}return null}function Ce(e,t){if(!window.getSelection())return null;let n=e.textContent?.length||0,r=document.createRange();if(e.nodeType===Node.TEXT_NODE){r.setStart(e,Math.min(t,n)),r.collapse(true);let s=r.getBoundingClientRect().top,l=t,c=n;for(;l<c;){let a=Math.ceil((l+c)/2);r.setStart(e,a),r.collapse(true);let d=r.getBoundingClientRect();Math.abs(d.top-s)<2?l=a:c=a-1;}return {node:e,offset:l}}return null}function cn(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);return {node:t.startContainer,offset:t.startOffset,anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,text:e.toString()}}function H(e,t){let o=window.getSelection();if(!o)return;let n=document.createRange(),r=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;n.setStart(e,Math.min(t,r)),n.collapse(true),o.removeAllRanges(),o.addRange(n);}function O(e,t){let o=window.getSelection();if(!(!o||!o.anchorNode))try{o.extend(e,Math.min(t,e.textContent?.length||0));}catch{let n=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;o.setBaseAndExtent(o.anchorNode,o.anchorOffset,e,Math.min(t,n));}}function Te(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n||n.nodeType!==Node.TEXT_NODE)return false;let r=n.textContent||"",i=o.focusOffset,s;return e==="left"?s=ye(r,i):s=xe(r,i),t?O(n,s):H(n,s),true}function we(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n)return false;if(n.nodeType===Node.TEXT_NODE){let s=e==="start"?Se(n,o.focusOffset):Ce(n,o.focusOffset);if(s)return t?O(s.node,s.offset):H(s.node,s.offset),true}let r=n.textContent||"",i=e==="start"?0:r.length;return t?O(n,i):H(n,i),true}function Fe(e){let{key:t,ctrlKey:o,metaKey:n,shiftKey:r,altKey:i}=e,s=o||n;switch(t){case "ArrowLeft":if(s)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(s)return {direction:"right",unit:"word",extend:r};break;case "Home":return s?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return s?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function dn(e,t){let o=Fe(e);if(!o)return false;switch(o.unit){case "word":if((o.direction==="left"||o.direction==="right")&&Te(o.direction,o.extend))return e.preventDefault(),true;break;case "line":let n=o.direction==="left"?"start":"end";if(we(n,o.extend))return e.preventDefault(),true;break;case "document":if(o.direction==="left"&&t?.onDocumentStart)return e.preventDefault(),t.onDocumentStart(),true;if(o.direction==="right"&&t?.onDocumentEnd)return e.preventDefault(),t.onDocumentEnd(),true;break}return false}function un(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function fn(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return false;let o=t.textContent||"",n=e.focusOffset,r=n,i=n;for(;r>0&&C(o[r-1]);)r--;for(;i<o.length&&C(o[i]);)i++;if(r===i)return false;let s=document.createRange();return s.setStart(t,r),s.setEnd(t,i),e.removeAllRanges(),e.addRange(s),true}function pn(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return null;let o=t.textContent||"",n=e.focusOffset,r=n,i=n;for(;r>0&&C(o[r-1]);)r--;for(;i<o.length&&C(o[i]);)i++;return r===i?null:o.slice(r,i)}function gn(e,t){let o=e.ctrlKey||e.metaKey,n=t.ctrlKey||t.metaKey;return e.key.toLowerCase()===t.key.toLowerCase()&&o===!!n&&e.shiftKey===!!t.shiftKey&&e.altKey===!!t.altKey}var b={wordLeft:{key:"ArrowLeft",ctrlKey:true},wordRight:{key:"ArrowRight",ctrlKey:true},selectWordLeft:{key:"ArrowLeft",ctrlKey:true,shiftKey:true},selectWordRight:{key:"ArrowRight",ctrlKey:true,shiftKey:true},lineStart:{key:"Home"},lineEnd:{key:"End"},selectToLineStart:{key:"Home",shiftKey:true},selectToLineEnd:{key:"End",shiftKey:true},documentStart:{key:"Home",ctrlKey:true},documentEnd:{key:"End",ctrlKey:true},selectToDocumentStart:{key:"Home",ctrlKey:true,shiftKey:true},selectToDocumentEnd:{key:"End",ctrlKey:true,shiftKey:true}};function x(e){let t=[];if(e.ctrlKey||e.metaKey){let n=typeof navigator<"u"&&/Mac/i.test(navigator.platform);t.push(n?"\u2318":"Ctrl");}e.shiftKey&&t.push("Shift"),e.altKey&&t.push("Alt");let o=e.key;return o==="ArrowLeft"?o="\u2190":o==="ArrowRight"?o="\u2192":o==="ArrowUp"?o="\u2191":o==="ArrowDown"&&(o="\u2193"),t.push(o),t.join("+")}function mn(){return [{action:"Move by word (left)",shortcut:x(b.wordLeft)},{action:"Move by word (right)",shortcut:x(b.wordRight)},{action:"Select word (left)",shortcut:x(b.selectWordLeft)},{action:"Select word (right)",shortcut:x(b.selectWordRight)},{action:"Go to line start",shortcut:x(b.lineStart)},{action:"Go to line end",shortcut:x(b.lineEnd)},{action:"Select to line start",shortcut:x(b.selectToLineStart)},{action:"Select to line end",shortcut:x(b.selectToLineEnd)},{action:"Go to document start",shortcut:x(b.documentStart)},{action:"Go to document end",shortcut:x(b.documentEnd)},{action:"Select to document start",shortcut:x(b.selectToDocumentStart)},{action:"Select to document end",shortcut:x(b.selectToDocumentEnd)}]}var M={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},hn={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},bn={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function Q(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return [];let o=t.getRangeAt(0);if(e&&!e.contains(o.commonAncestorContainer))return [];let n=o.getClientRects(),r=[],i=0,s=0;if(e){let l=e.getBoundingClientRect();i=l.left+e.scrollLeft,s=l.top+e.scrollTop;}for(let l=0;l<n.length;l++){let c=n[l];c.width===0&&c.height===0||r.push({left:c.left-i,top:c.top-s,width:c.width,height:c.height});}return r}function Re(e,t=2){if(e.length<=1)return e;let o=[...e].sort((i,s)=>Math.abs(i.top-s.top)<t?i.left-s.left:i.top-s.top),n=[],r={...o[0]};for(let i=1;i<o.length;i++){let s=o[i],l=Math.abs(s.top-r.top)<t,c=s.left<=r.left+r.width+t;if(l&&c){let a=Math.max(r.left+r.width,s.left+s.width);r.width=a-r.left,r.height=Math.max(r.height,s.height);}else n.push(r),r={...s};}return n.push(r),n}function Ae(e){let t=Q(e);return Re(t)}function xn(e,t=M){return {position:"absolute",left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:t.backgroundColor,borderRadius:t.borderRadius?`${t.borderRadius}px`:void 0,border:t.borderColor?`1px solid ${t.borderColor}`:void 0,zIndex:t.zIndex??0,opacity:t.opacity??1,mixBlendMode:t.mixBlendMode,pointerEvents:"none",userSelect:"none"}}function yn(e,t=M){let o=t.backgroundColor;return `
|
|
4
|
-
${e}::selection,
|
|
5
|
-
${e} *::selection {
|
|
6
|
-
background-color: ${o} !important;
|
|
7
|
-
color: inherit !important;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
${e}::-moz-selection,
|
|
11
|
-
${e} *::-moz-selection {
|
|
12
|
-
background-color: ${o} !important;
|
|
13
|
-
color: inherit !important;
|
|
14
|
-
}
|
|
15
|
-
`}function Sn(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function Cn(){let e=window.getSelection();return e?e.toString():""}function Tn(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let o=t.getRangeAt(0);return e.contains(o.commonAncestorContainer)}function wn(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function Fn(e,t,o,n,r){try{let i=document.createRange();return i.setStart(t,o),i.setEnd(n,r),i}catch{return null}}function Rn(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function An(){let e=window.getSelection();e&&e.removeAllRanges();}function Pe(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.anchorNode,o=e.focusNode;return !t||!o?false:t===o?e.focusOffset<e.anchorOffset:(t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_PRECEDING)!==0}function Pn(){let e=window.getSelection();if(!e||e.rangeCount===0||!Pe())return;let t=e.getRangeAt(0),o=document.createRange();o.setStart(t.startContainer,t.startOffset),o.setEnd(t.endContainer,t.endOffset),e.removeAllRanges(),e.addRange(o);}var w=null;function En(e=M){Ee();let t=`
|
|
16
|
-
/* DOCX Editor Selection Highlighting */
|
|
17
|
-
|
|
18
|
-
/* Base selection style for all editable content */
|
|
19
|
-
.docx-editor [contenteditable="true"]::selection,
|
|
20
|
-
.docx-editor [contenteditable="true"] *::selection,
|
|
21
|
-
.docx-run-editable::selection,
|
|
22
|
-
.docx-run-editable *::selection {
|
|
23
|
-
background-color: ${e.backgroundColor} !important;
|
|
24
|
-
color: inherit !important;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Firefox selection */
|
|
28
|
-
.docx-editor [contenteditable="true"]::-moz-selection,
|
|
29
|
-
.docx-editor [contenteditable="true"] *::-moz-selection,
|
|
30
|
-
.docx-run-editable::-moz-selection,
|
|
31
|
-
.docx-run-editable *::-moz-selection {
|
|
32
|
-
background-color: ${e.backgroundColor} !important;
|
|
33
|
-
color: inherit !important;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* Ensure selection is visible against all backgrounds */
|
|
37
|
-
.docx-run-highlighted::selection,
|
|
38
|
-
.docx-run-highlighted *::selection {
|
|
39
|
-
/* For highlighted (yellow background) text, use darker selection */
|
|
40
|
-
background-color: rgba(26, 115, 232, 0.5) !important;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.docx-run-highlighted::-moz-selection,
|
|
44
|
-
.docx-run-highlighted *::-moz-selection {
|
|
45
|
-
background-color: rgba(26, 115, 232, 0.5) !important;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Selection in dark text */
|
|
49
|
-
.docx-run-dark-bg::selection,
|
|
50
|
-
.docx-run-dark-bg *::selection {
|
|
51
|
-
/* Use lighter selection for dark backgrounds */
|
|
52
|
-
background-color: rgba(100, 181, 246, 0.5) !important;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.docx-run-dark-bg::-moz-selection,
|
|
56
|
-
.docx-run-dark-bg *::-moz-selection {
|
|
57
|
-
background-color: rgba(100, 181, 246, 0.5) !important;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Programmatic highlight class */
|
|
61
|
-
.docx-selection-highlight {
|
|
62
|
-
background-color: ${e.backgroundColor};
|
|
63
|
-
${e.borderRadius?`border-radius: ${e.borderRadius}px;`:""}
|
|
64
|
-
${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:""}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/* Find/replace highlight */
|
|
68
|
-
.docx-find-highlight {
|
|
69
|
-
background-color: rgba(255, 235, 59, 0.5);
|
|
70
|
-
border-radius: 2px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.docx-find-highlight-current {
|
|
74
|
-
background-color: rgba(255, 152, 0, 0.6);
|
|
75
|
-
border-radius: 2px;
|
|
76
|
-
outline: 2px solid rgba(255, 152, 0, 0.8);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/* AI action selection preview */
|
|
80
|
-
.docx-ai-selection-preview {
|
|
81
|
-
background-color: rgba(156, 39, 176, 0.2);
|
|
82
|
-
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
83
|
-
}
|
|
84
|
-
`;w=document.createElement("style"),w.id="docx-selection-styles",w.textContent=t,document.head.appendChild(w);}function Ee(){w&&(w.remove(),w=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function kn(){return w!==null||document.getElementById("docx-selection-styles")!==null}function vn(e,t,o=true){return ()=>{if(!e){t([]);return}let n=o?Ae(e):Q(e);t(n);}}var ke="rgba(255, 235, 59, 0.55)",Nn=1200,I="docx-paragraph-flash",Z=new WeakMap;function Dn(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Ln(e){return e?.color?.trim()||ke}function Hn(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function ve(e,t){if(!t||!t.trim())return [];let o=Dn(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function Ne(e,t){let o=0,n=Ln(t),r=Hn(t);for(let i of e){o++;let s=Z.get(i);s!==void 0&&clearTimeout(s),i.classList.remove(I),i.offsetWidth,i.style.setProperty("--docx-paragraph-flash-color",n),i.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),i.classList.add(I);let l=setTimeout(()=>{i.classList.remove(I),i.style.removeProperty("--docx-paragraph-flash-color"),i.style.removeProperty("--docx-paragraph-flash-duration"),Z.delete(i);},r);Z.set(i,l);}return o}function On(e,t,o){let n=ve(e,t);return Ne(n,o)>0}function De(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function Mn(e,t,o,n){let r=De(e,t,o),i=Math.floor(r/Math.max(n,1)),s=r-i*n,l=Array.from({length:n},(c,a)=>i+(a<s?1:0));return [...e.slice(0,t),...l,...e.slice(t+o)]}function In(e,t,o,n,r,i){let s=o-t.rowspan,l=n-t.colspan,c=r+s,a=t.row+t.rowspan,d=t.col+t.colspan,f=[];for(let u of e){if(u===t)continue;let m=u.row+u.rowspan,B=u.col+u.colspan,ee=u.row<a&&m>t.row,te=u.col<d&&B>t.col;f.push({data:u.data,row:u.row>=a?u.row+s:u.row,col:u.col>=d?u.col+l:u.col,rowspan:u.rowspan+(s>0&&ee&&!te?s:0),colspan:u.colspan+(l>0&&te&&!ee?l:0)});}for(let u=0;u<o;u++)for(let m=0;m<n;m++){let B=u===0&&m===0;f.push({data:i(B,u,m),row:t.row+u,col:t.col+m,rowspan:1,colspan:1});}return {anchors:f,deltaRows:s,deltaCols:l,newRowCount:c}}function Bn(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let i=n.col;i<n.col+n.colspan;i++)o.set(`${r}-${i}`,n);}return {byStart:t,byCoveredSlot:o}}function _n(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}async function Wn(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var Le="(prefers-color-scheme: dark)";function He(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Kn(){return He()?window.matchMedia(Le).matches:false}function $n(e,t){return e==="dark"||e==="system"&&t}function zn(e){if(!He())return ()=>{};let t=window.matchMedia(Le);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gn=-1;function jn(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Un(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}export{h as CLIPBOARD_TYPES,ke as DEFAULT_PARAGRAPH_FLASH_COLOR,Nn as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,M as DEFAULT_SELECTION_STYLE,hn as HIGH_CONTRAST_SELECTION_STYLE,Ao as INTERNAL_CLIPBOARD_TYPE,b as NAVIGATION_SHORTCUTS,I as PARAGRAPH_FLASH_CLASS_NAME,Gn as PENDING_COMMENT_ID,bn as SELECTION_CSS_VARS,kn as areSelectionStylesInjected,T as borderToStyle,Bn as buildAnchorMaps,ue as cleanWordHtml,An as clearSelection,_n as computeSplitDialogDefaults,In as computeSplitLayout,Eo as copyParagraphs,j as copyRuns,Mo as createClipboardHandlers,Un as createComment,jn as createCommentIdAllocator,vn as createSelectionChangeHandler,x as describeShortcut,qo as excludeFontsByName,fn as expandSelectionToWord,O as extendSelectionTo,xe as findNextWordStart,ve as findParagraphFragmentsByParaId,ye as findPreviousWordStart,Ce as findVisualLineEnd,Se as findVisualLineStart,ln as findWordEnd,an as findWordStart,Ne as flashParagraphElements,On as flashParagraphFragmentsByParaId,yn as generateSelectionCSS,Po as getClipboardImageFiles,xn as getHighlightRectStyle,Ae as getMergedSelectionRects,mn as getNavigationShortcutDescriptions,Yo as getRenderableDocumentFonts,Cn as getSelectedText,wn as getSelectionBoundingRect,cn as getSelectionInfo,Q as getSelectionRects,pn as getWordAtCursor,dn as handleNavigationKey,le as handlePasteEvent,Sn as hasActiveSelection,Fn as highlightTextRange,fe as htmlToRuns,En as injectSelectionStyles,de as isEditorHtml,un as isNavigationKey,sn as isPunctuation,Pe as isSelectionBackwards,Tn as isSelectionWithin,J as isWhitespace,C as isWordCharacter,ce as isWordHtml,gn as matchesShortcut,Re as mergeAdjacentRects,on as mergeStyles,Te as moveByWord,we as moveToLineEdge,Pn as normalizeSelectionDirection,Qo as paragraphToStyle,ae as paragraphsToClipboardContent,V as parseClipboardHtml,Fe as parseNavigationAction,Kn as prefersColorSchemeDark,Wn as readDocxFileFromInput,ko as readFromClipboard,Mn as redistributeColumnWidths,Ee as removeSelectionStyles,$n as resolveIsDark,L as resolveShadingFill,N as runsToClipboardContent,rn as sectionToStyle,Rn as selectRange,be as selectRenderableFonts,H as setSelectionPosition,zn as subscribeSystemDark,De as sumColumnWidths,nn as tableCellToStyle,Jo as textToStyle,P as writeToClipboard};
|
|
1
|
+
export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-IFT6DUJX.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-3UBMCDME.mjs';import {o,e}from'../chunk-AZ52IWB6.mjs';export{s as FONT_MAPPING,o as canRenderFont,d as deobfuscateFont,B as extractEmbeddedFontFaces,x as extractFontsFromDocument,A as getEmbeddedFontFaces,z as getEmbeddedFontFamilies,t as getGoogleFontEquivalent,l as getLoadedFonts,h as isFontLoaded,j as isGoogleFontsEnabled,k as isLoading,c as isValidFontKey,y as loadDocumentFonts,C as loadEmbeddedFonts,f as loadFont,r as loadFontDefinitions,p as loadFontFromBuffer,q as loadFontFromUrl,u as loadFontWithMapping,g as loadFonts,v as loadFontsWithMapping,n as onFontError,m as onFontsLoaded,w as preloadCommonFonts,i as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-AZ52IWB6.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e$1,t={}){let o$1=t.canRender??o,n=new Set;for(let i of t.exclude??[])n.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e$1){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n.has(f)||a.has(f)||!r.has(f)&&!o$1(c)||(a.add(f),s.push({name:c,fontFamily:e(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { a as Style } from '../styles-Dn_o3Vo5.mjs';
|
|
2
|
+
import '../formatting-D1EPSaJP.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Paragraph-style preview + option resolution — shared between the React and
|
package/dist/utils/units.d.mts
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Pixels per inch at standard DPI
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
declare const PIXELS_PER_INCH = 96;
|
|
7
|
+
/**
|
|
8
|
+
* Convert EMUs to pixels (at 96 DPI)
|
|
9
|
+
*
|
|
10
|
+
* 1 inch = 914400 EMUs = 96 pixels
|
|
11
|
+
* Returns 0 for null/undefined/NaN inputs.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
declare function emuToPixels(emu: number | undefined | null): number;
|
|
16
|
+
/**
|
|
17
|
+
* Convert pixels to EMUs.
|
|
18
|
+
* EMU coordinates in OOXML are integer-typed (xs:long); rounding here keeps
|
|
19
|
+
* floating-point drift (e.g. 52 px → 495299.99999999994) out of the document.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
declare function pixelsToEmu(px: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Convert points to pixels (at 96 DPI)
|
|
26
|
+
*
|
|
27
|
+
* 1 inch = 72 points = 96 pixels
|
|
28
|
+
* → 1 point = 96/72 pixels = 4/3 pixels
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
declare function pointsToPixels(points: number): number;
|
|
2
33
|
|
|
3
34
|
/**
|
|
4
35
|
* Unit Conversion Utilities - Convert OOXML units to CSS/pixels
|
|
@@ -75,4 +106,4 @@ declare function clamp(value: number, min: number, max: number): number;
|
|
|
75
106
|
*/
|
|
76
107
|
declare function formatPx(px: number): string;
|
|
77
108
|
|
|
78
|
-
export { AUTO_PARAGRAPH_SPACING_PX, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToTwips, pointsToHalfPoints, roundPixels, twipsToEmu, twipsToPixels };
|
|
109
|
+
export { AUTO_PARAGRAPH_SPACING_PX, PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,a as preloadEditWasm}from'./chunk-NTQM4EYN.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|
package/dist/wasm-edit.d.mts
CHANGED
|
@@ -112,6 +112,7 @@ declare class EditSession {
|
|
|
112
112
|
* Clear this editing wasm's resident measurement fonts.
|
|
113
113
|
*/
|
|
114
114
|
clear_measure_fonts(): void;
|
|
115
|
+
clear_update_event_observation(): void;
|
|
115
116
|
/**
|
|
116
117
|
* Drops the update observer registered by [`EditSession::set_update_observer`].
|
|
117
118
|
*/
|
|
@@ -158,10 +159,13 @@ declare class EditSession {
|
|
|
158
159
|
* Region-scoped range geometry without a display-list JSON round trip.
|
|
159
160
|
*/
|
|
160
161
|
display_range_rects_region_json(region: string, r_id: string, from: number, to: number): string;
|
|
162
|
+
drain_update_event(): Uint8Array;
|
|
163
|
+
encode_diff(remote_state_vector: Uint8Array): Uint8Array;
|
|
161
164
|
/**
|
|
162
165
|
* Full document state as one yrs v1 update (Yjs wire format).
|
|
163
166
|
*/
|
|
164
167
|
encode_state(): Uint8Array;
|
|
168
|
+
encode_state_vector(): Uint8Array;
|
|
165
169
|
/**
|
|
166
170
|
* Applies a set-valued, tri-state inline formatting delta over
|
|
167
171
|
* `[start, end)` in one transaction. Omitted fields are kept and `null`
|
|
@@ -206,6 +210,11 @@ declare class EditSession {
|
|
|
206
210
|
* remains the migration parity bridge until binary frames consume it.
|
|
207
211
|
*/
|
|
208
212
|
layout_document_json(input: string): string;
|
|
213
|
+
/**
|
|
214
|
+
* Paginate and compose section/page regions inside the resident engine.
|
|
215
|
+
*/
|
|
216
|
+
layout_document_with_regions_json(input: string): string;
|
|
217
|
+
layout_font_requirements_json(input: string): string;
|
|
209
218
|
/**
|
|
210
219
|
* Every tracked-change run/paragraph-mark revision across all stories,
|
|
211
220
|
* in deterministic story/position order.
|
|
@@ -387,6 +396,7 @@ declare class EditSession {
|
|
|
387
396
|
* `{"firstParaId","secondParaId","revisionId": string|null}`.
|
|
388
397
|
*/
|
|
389
398
|
split_paragraph(story: string, para_id: string, offset: number, author_name?: string | null, author_date?: string | null): string;
|
|
399
|
+
start_update_event_observation(): void;
|
|
390
400
|
/**
|
|
391
401
|
* The story's `canonical-stream-v1` FNV-1a checksum as a decimal string
|
|
392
402
|
* (u64 exceeds JS safe-integer range). The coexistence watchdog compares
|
|
@@ -438,11 +448,9 @@ declare class EditSession {
|
|
|
438
448
|
*/
|
|
439
449
|
undo_depth(): number;
|
|
440
450
|
/**
|
|
441
|
-
* Lowers a story
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
* non-native content (e.g. an opaque page-break blob) until that class is
|
|
445
|
-
* promoted to native; the host falls back to the PM render path there.
|
|
451
|
+
* Lowers a story through the resident Rust bridge. Errors with an
|
|
452
|
+
* unsupported-embed message on any non-native content until that class is
|
|
453
|
+
* promoted to native.
|
|
446
454
|
* `env_json` carries theme colors, the default tab stop, and list numeric
|
|
447
455
|
* ids (see [`parse_render_env`]).
|
|
448
456
|
*/
|
package/dist/wasm-edit.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as createEditSession,a as preloadEditWasm}from'./chunk-
|
|
1
|
+
export{b as createEditSession,a as preloadEditWasm}from'./chunk-NTQM4EYN.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|
package/dist/wasm-opc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as preloadOpcWasm,c as rezipContainer,b as unzipContainer}from'./chunk-
|
|
1
|
+
export{a as preloadOpcWasm,c as rezipContainer,b as unzipContainer}from'./chunk-NJHOPXZW.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|
package/dist/wasm-parse.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as parseDocxS9Wire,c as parseRelationshipsXmlWire,a as preloadParseWasm,d as serializeDocxS10Wire,e as serializeDocxS11Wire,f as serializeDocxS12Wire,g as writeDocxS13Wire}from'./chunk-
|
|
1
|
+
export{b as parseDocxS9Wire,c as parseRelationshipsXmlWire,a as preloadParseWasm,d as serializeDocxS10Wire,e as serializeDocxS11Wire,f as serializeDocxS12Wire,g as writeDocxS13Wire}from'./chunk-B4IR6YP4.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|