@zeke-02/docx-editor 0.0.35 → 0.5.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 +34 -29
- package/dist/{ClipboardManager-C1l58nzE.d.ts → ClipboardManager-CVKX0v9q.d.ts} +1 -1
- package/dist/{ClipboardManager-Cjb_v74d.d.mts → ClipboardManager-V3aaMnWE.d.mts} +1 -1
- package/dist/{DocumentAgent-E8OX_8j0.d.mts → DocumentAgent-BWflKHpH.d.mts} +1 -1
- package/dist/{DocumentAgent-iedmc_8s.d.ts → DocumentAgent-DsdXtetF.d.ts} +1 -1
- package/dist/{FindReplaceDialog-YW3R4FHM.mjs → FindReplaceDialog-L3YF5HIS.mjs} +1 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +1 -0
- package/dist/{FootnotePropertiesDialog-LNFJXQUG.mjs → FootnotePropertiesDialog-TNVJJCY6.mjs} +1 -1
- package/dist/{FootnotePropertiesDialog-7QX54WQT.js → FootnotePropertiesDialog-XQ7NIFIU.js} +1 -1
- package/dist/{HyperlinkDialog-HNYTXDCB.mjs → HyperlinkDialog-FR4IZZ7E.mjs} +1 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +1 -0
- package/dist/{ImagePositionDialog-M65BYQQE.js → ImagePositionDialog-2YXRAGZS.js} +1 -1
- package/dist/{ImagePositionDialog-B4RLP2W5.mjs → ImagePositionDialog-JSZSIKF5.mjs} +1 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +1 -0
- package/dist/{ImagePropertiesDialog-O4WQSF5M.js → ImagePropertiesDialog-HG4K3IE7.js} +1 -1
- package/dist/PageSetupDialog-GALVJMUB.js +1 -0
- package/dist/PageSetupDialog-TGQIAMI7.mjs +1 -0
- package/dist/SplitCellDialog-JIAC3RYV.js +1 -0
- package/dist/SplitCellDialog-NP3JJYHD.mjs +1 -0
- package/dist/{TablePropertiesDialog-WOZ4ES3H.js → TablePropertiesDialog-T7D4HSVP.js} +1 -1
- package/dist/TablePropertiesDialog-TIK4AA5M.mjs +1 -0
- package/dist/{clipboard-BWhM0CRj.d.mts → TableToolbar-DUgmob2I.d.ts} +227 -135
- package/dist/{clipboard-BvkuNZub.d.ts → TableToolbar-YL74HNS1.d.mts} +227 -135
- package/dist/{agentApi-mv532p8I.d.mts → agentApi-DLt94vXk.d.mts} +83 -5
- package/dist/{agentApi-mv532p8I.d.ts → agentApi-DLt94vXk.d.ts} +83 -5
- package/dist/chunk-23SXXIZS.js +111 -0
- package/dist/chunk-3F52AP2Q.js +1 -0
- package/dist/chunk-42O5GXM5.mjs +82 -0
- package/dist/chunk-54ULJEHM.mjs +1 -0
- package/dist/chunk-5XK326FI.mjs +1 -0
- package/dist/chunk-76IYR7C7.mjs +1 -0
- package/dist/chunk-AGRIVA4G.js +1 -0
- package/dist/chunk-BTCQ2QI3.mjs +3 -0
- package/dist/chunk-BXRC4U3X.mjs +2 -0
- package/dist/chunk-CPAYKE6X.mjs +1 -0
- package/dist/chunk-DACWLFKI.mjs +1 -0
- package/dist/{chunk-377ZVTSE.js → chunk-EHFEG3TX.js} +1 -1
- package/dist/chunk-EPBFWE36.js +2 -0
- package/dist/chunk-FXES3YDB.js +82 -0
- package/dist/chunk-HI66BSGS.mjs +9 -0
- package/dist/chunk-INTPVEO6.mjs +9 -0
- package/dist/chunk-IOAGVW6Q.mjs +2 -0
- package/dist/chunk-JCEWC5QL.mjs +4 -0
- package/dist/chunk-JTIUFACT.js +1 -0
- package/dist/{chunk-KCOGY3V2.js → chunk-LUF7PWIC.js} +4 -4
- package/dist/chunk-LVGJKS7Y.mjs +24 -0
- package/dist/chunk-MGEN6GOE.mjs +2 -0
- package/dist/chunk-MOE2ZGUE.js +18 -0
- package/dist/chunk-MWLHJWB6.js +9 -0
- package/dist/chunk-OFYVDN3U.mjs +2 -0
- package/dist/chunk-P4VSHBGZ.js +2 -0
- package/dist/chunk-P5FQHIES.mjs +1 -0
- package/dist/chunk-PBC7XAYZ.js +3 -0
- package/dist/chunk-PEMB6SZT.js +2 -0
- package/dist/chunk-PKEOQIQO.mjs +2 -0
- package/dist/chunk-PQMSZTBB.js +9 -0
- package/dist/chunk-Q7UDQXAF.js +1 -0
- package/dist/chunk-QGTAIC5E.js +1 -0
- package/dist/chunk-R3QMYPL5.mjs +59 -0
- package/dist/chunk-RBUTXXQJ.mjs +18 -0
- package/dist/chunk-RRWYZ2TS.mjs +111 -0
- package/dist/chunk-S3STEPVO.js +182 -0
- package/dist/{chunk-AU5NVRHP.js → chunk-SFUM35DH.js} +2 -2
- package/dist/chunk-SNLC6EK2.js +1 -0
- package/dist/chunk-TMTLIGLZ.js +59 -0
- package/dist/{chunk-RTFUE3KK.mjs → chunk-TSE2PWFX.mjs} +3 -3
- package/dist/chunk-UKESXQS5.mjs +182 -0
- package/dist/chunk-UWYD42WV.js +4 -0
- package/dist/chunk-UXVACQCY.mjs +1 -0
- package/dist/{chunk-Z26WOH6R.mjs → chunk-W4EIKDM6.mjs} +2 -2
- package/dist/chunk-WNS2RBQD.js +2 -0
- package/dist/chunk-YC5KZSYD.js +24 -0
- package/dist/chunk-Z3KMSHUP.js +1 -0
- package/dist/core-plugins-reexport.d.mts +4 -4
- package/dist/core-plugins-reexport.d.ts +4 -4
- package/dist/core-plugins-reexport.js +1 -1
- package/dist/core-plugins-reexport.mjs +1 -1
- package/dist/core-reexport.d.mts +47 -16
- package/dist/core-reexport.d.ts +47 -16
- package/dist/core-reexport.js +1 -1
- package/dist/core-reexport.mjs +1 -1
- package/dist/{colorResolver-C5fQ4fxP.d.mts → documentSerializer-DtS_-oGA.d.mts} +378 -376
- package/dist/{colorResolver-Bp9flT3l.d.ts → documentSerializer-Wj1p2ASa.d.ts} +378 -376
- package/dist/executor-C3VXF7QA.mjs +1 -0
- package/dist/executor-GDBV3AGV.js +1 -0
- package/dist/headless-reexport.d.mts +14 -12
- package/dist/headless-reexport.d.ts +14 -12
- package/dist/headless-reexport.js +1 -4
- package/dist/headless-reexport.mjs +1 -4
- package/dist/index.css +1 -1
- package/dist/index.d.mts +284 -172
- package/dist/index.d.ts +284 -172
- package/dist/index.js +17 -9
- package/dist/index.mjs +17 -9
- package/dist/{fontLoader-0G00frKD.d.mts → insertOperations-BTH1Asas.d.mts} +86 -86
- package/dist/{fontLoader-DPdt4JvW.d.ts → insertOperations-CbUnXAXH.d.ts} +86 -86
- package/dist/layout-bridge-EA4DJ227.js +1 -0
- package/dist/layout-bridge-XDPSO6GO.mjs +1 -0
- package/dist/mcp-reexport.d.mts +2 -2
- package/dist/mcp-reexport.d.ts +2 -2
- package/dist/mcp-reexport.js +8 -8
- package/dist/mcp-reexport.mjs +7 -7
- package/dist/processTemplate-MJ2PCSO5.js +1 -0
- package/dist/{processTemplate-LRHXOWMZ.mjs → processTemplate-W2C5PXZB.mjs} +1 -1
- package/dist/{react-1OO-DXvx.d.ts → react-B0W16SV6.d.ts} +384 -166
- package/dist/{react-B1dSZ_w1.d.mts → react-D0Pn1nww.d.mts} +384 -166
- package/dist/react.css +1 -1
- package/dist/react.d.mts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{registry-BWGKcKc1.d.ts → registry-CH9V-IX0.d.ts} +1 -1
- package/dist/{registry-8XOdjHGC.d.mts → registry-CWBKYlNW.d.mts} +1 -1
- package/dist/styles.css +1 -1
- package/dist/{types-DIBvJ7AJ.d.mts → types-UDsUq8D3.d.mts} +1 -1
- package/dist/{types-CfAiObQo.d.ts → types-jbivc9Lj.d.ts} +1 -1
- package/dist/ui.d.mts +33 -83
- package/dist/ui.d.ts +33 -83
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/dist/{variableDetector-DNO18eZ1.d.mts → variableDetector-CdQ7ZTzA.d.mts} +1 -1
- package/dist/{variableDetector-BIJFVpkl.d.ts → variableDetector-DsRV3A9z.d.ts} +1 -1
- package/i18n/de.json +49 -2
- package/i18n/en.json +55 -8
- package/i18n/he.json +792 -0
- package/i18n/pl.json +49 -2
- package/i18n/pt-BR.json +792 -0
- package/i18n/tr.json +792 -0
- package/i18n/zh-CN.json +792 -0
- package/package.json +17 -5
- package/dist/FindReplaceDialog-KNJETYJX.js +0 -1
- package/dist/HyperlinkDialog-GBAYMTUE.js +0 -1
- package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +0 -1
- package/dist/PageSetupDialog-2GIBTKMJ.js +0 -1
- package/dist/PageSetupDialog-Q7SHEZIJ.mjs +0 -1
- package/dist/TablePropertiesDialog-LMXWX3FI.mjs +0 -1
- package/dist/chunk-2HDYCD2Q.mjs +0 -1
- package/dist/chunk-37SLIJPH.mjs +0 -58
- package/dist/chunk-3OKYQQQ5.js +0 -111
- package/dist/chunk-4VUZBV2S.js +0 -1
- package/dist/chunk-6YRWZ32V.js +0 -261
- package/dist/chunk-7MGFEP2R.mjs +0 -26
- package/dist/chunk-7QTNB64A.mjs +0 -9
- package/dist/chunk-AARNCPWR.js +0 -1
- package/dist/chunk-DC65PJYE.js +0 -4
- package/dist/chunk-DLVLK5FT.mjs +0 -24
- package/dist/chunk-EV3CM6TU.js +0 -1
- package/dist/chunk-FVUGBRDD.js +0 -1
- package/dist/chunk-FW5LYOOZ.mjs +0 -111
- package/dist/chunk-GZOCOWWB.mjs +0 -2
- package/dist/chunk-KUL2SDYC.js +0 -26
- package/dist/chunk-LYBG4YI7.mjs +0 -1
- package/dist/chunk-M5F4SK3W.mjs +0 -1
- package/dist/chunk-P7WEP4JU.js +0 -9
- package/dist/chunk-PB7VMDDP.js +0 -24
- package/dist/chunk-QAZ4233N.mjs +0 -1
- package/dist/chunk-QSUPYUOP.js +0 -2
- package/dist/chunk-QTSXJRP6.mjs +0 -1
- package/dist/chunk-S67UBZDL.mjs +0 -261
- package/dist/chunk-SE5EN2QL.js +0 -1
- package/dist/chunk-X5A54T6S.mjs +0 -4
- package/dist/chunk-YKBSKEBS.mjs +0 -2
- package/dist/chunk-ZJNGMDRE.js +0 -58
- package/dist/executor-L2MVKMXO.js +0 -1
- package/dist/executor-XKBCCVNY.mjs +0 -1
- package/dist/processTemplate-5ZST2Q5L.js +0 -1
- package/dist/selectionRects-DEX5THEG.js +0 -1
- package/dist/selectionRects-SQTAHMCH.mjs +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
function g(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function E(e){return e?/\s/.test(e):false}function Y(e){return e?/[\p{P}]/u.test(e):false}function q(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let o=t;for(;o>0&&E(e[o-1]);)o--;if(o===0)return 0;for(;o>0&&g(e[o-1]);)o--;return o}function J(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let o=t;for(;o<e.length&&g(e[o]);)o++;for(;o<e.length&&E(e[o]);)o++;return o}function L(e,t){if(t>=e.length)return e.length;let o=t;for(;o<e.length&&g(e[o]);)o++;for(;o<e.length&&!g(e[o]);)o++;return o}function D(e,t){if(t<=0)return 0;let o=t;for(;o>0&&!g(e[o-1]);)o--;for(;o>0&&g(e[o-1]);)o--;return o}function H(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 l=n.getBoundingClientRect().top,i=0,c=t;for(;i<c;){let s=Math.floor((i+c)/2);n.setStart(e,s),n.collapse(true);let d=n.getBoundingClientRect();Math.abs(d.top-l)<2?c=s:i=s+1;}return {node:e,offset:i}}return null}function P(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 i=r.getBoundingClientRect().top,c=t,s=n;for(;c<s;){let d=Math.ceil((c+s)/2);r.setStart(e,d),r.collapse(true);let m=r.getBoundingClientRect();Math.abs(m.top-i)<2?c=d:s=d-1;}return {node:e,offset:c}}return null}function Q(){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 T(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 C(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 W(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||"",l=o.focusOffset,i;return e==="left"?i=D(r,l):i=L(r,l),t?C(n,i):T(n,i),true}function I(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 i=e==="start"?H(n,o.focusOffset):P(n,o.focusOffset);if(i)return t?C(i.node,i.offset):T(i.node,i.offset),true}let r=n.textContent||"",l=e==="start"?0:r.length;return t?C(n,l):T(n,l),true}function _(e){let{key:t,ctrlKey:o,metaKey:n,shiftKey:r,altKey:l}=e,i=o||n;switch(t){case "ArrowLeft":if(i)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(i)return {direction:"right",unit:"word",extend:r};break;case "Home":return i?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return i?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function Z(e,t){let o=_(e);if(!o)return false;switch(o.unit){case "word":if((o.direction==="left"||o.direction==="right")&&W(o.direction,o.extend))return e.preventDefault(),true;break;case "line":let n=o.direction==="left"?"start":"end";if(I(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 ee(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function te(){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,l=n;for(;r>0&&g(o[r-1]);)r--;for(;l<o.length&&g(o[l]);)l++;if(r===l)return false;let i=document.createRange();return i.setStart(t,r),i.setEnd(t,l),e.removeAllRanges(),e.addRange(i),true}function oe(){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,l=n;for(;r>0&&g(o[r-1]);)r--;for(;l<o.length&&g(o[l]);)l++;return r===l?null:o.slice(r,l)}function ne(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 u={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 f(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 re(){return [{action:"Move by word (left)",shortcut:f(u.wordLeft)},{action:"Move by word (right)",shortcut:f(u.wordRight)},{action:"Select word (left)",shortcut:f(u.selectWordLeft)},{action:"Select word (right)",shortcut:f(u.selectWordRight)},{action:"Go to line start",shortcut:f(u.lineStart)},{action:"Go to line end",shortcut:f(u.lineEnd)},{action:"Select to line start",shortcut:f(u.selectToLineStart)},{action:"Select to line end",shortcut:f(u.selectToLineEnd)},{action:"Go to document start",shortcut:f(u.documentStart)},{action:"Go to document end",shortcut:f(u.documentEnd)},{action:"Select to document start",shortcut:f(u.selectToDocumentStart)},{action:"Select to document end",shortcut:f(u.selectToDocumentEnd)}]}var w={backgroundColor:"rgba(26, 115, 232, 0.3)",borderRadius:0,zIndex:0,opacity:1,mixBlendMode:"multiply"},ie={backgroundColor:"rgba(0, 120, 215, 0.4)",borderColor:"rgba(0, 120, 215, 0.6)",borderRadius:1,zIndex:0,opacity:1},le={backgroundColor:"--docx-selection-bg",borderColor:"--docx-selection-border",textColor:"--docx-selection-text"};function R(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=[],l=0,i=0;if(e){let c=e.getBoundingClientRect();l=c.left+e.scrollLeft,i=c.top+e.scrollTop;}for(let c=0;c<n.length;c++){let s=n[c];s.width===0&&s.height===0||r.push({left:s.left-l,top:s.top-i,width:s.width,height:s.height});}return r}function B(e,t=2){if(e.length<=1)return e;let o=[...e].sort((l,i)=>Math.abs(l.top-i.top)<t?l.left-i.left:l.top-i.top),n=[],r={...o[0]};for(let l=1;l<o.length;l++){let i=o[l],c=Math.abs(i.top-r.top)<t,s=i.left<=r.left+r.width+t;if(c&&s){let d=Math.max(r.left+r.width,i.left+i.width);r.width=d-r.left,r.height=Math.max(r.height,i.height);}else n.push(r),r={...i};}return n.push(r),n}function F(e){let t=R(e);return B(t)}function ce(e,t=w){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 se(e,t=w){let o=t.backgroundColor;return `
|
|
2
|
+
${e}::selection,
|
|
3
|
+
${e} *::selection {
|
|
4
|
+
background-color: ${o} !important;
|
|
5
|
+
color: inherit !important;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
${e}::-moz-selection,
|
|
9
|
+
${e} *::-moz-selection {
|
|
10
|
+
background-color: ${o} !important;
|
|
11
|
+
color: inherit !important;
|
|
12
|
+
}
|
|
13
|
+
`}function ae(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function de(){let e=window.getSelection();return e?e.toString():""}function ue(e){let t=window.getSelection();if(!t||t.rangeCount===0)return false;let o=t.getRangeAt(0);return e.contains(o.commonAncestorContainer)}function fe(){let e=window.getSelection();return !e||e.rangeCount===0?null:e.getRangeAt(0).getBoundingClientRect()}function ge(e,t,o,n,r){try{let l=document.createRange();return l.setStart(t,o),l.setEnd(n,r),l}catch{return null}}function he(e){let t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e));}function pe(){let e=window.getSelection();e&&e.removeAllRanges();}function $(){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 me(){let e=window.getSelection();if(!e||e.rangeCount===0||!$())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 h=null;function be(e=w){z();let t=`
|
|
14
|
+
/* DOCX Editor Selection Highlighting */
|
|
15
|
+
|
|
16
|
+
/* Base selection style for all editable content */
|
|
17
|
+
.docx-editor [contenteditable="true"]::selection,
|
|
18
|
+
.docx-editor [contenteditable="true"] *::selection,
|
|
19
|
+
.docx-run-editable::selection,
|
|
20
|
+
.docx-run-editable *::selection {
|
|
21
|
+
background-color: ${e.backgroundColor} !important;
|
|
22
|
+
color: inherit !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Firefox selection */
|
|
26
|
+
.docx-editor [contenteditable="true"]::-moz-selection,
|
|
27
|
+
.docx-editor [contenteditable="true"] *::-moz-selection,
|
|
28
|
+
.docx-run-editable::-moz-selection,
|
|
29
|
+
.docx-run-editable *::-moz-selection {
|
|
30
|
+
background-color: ${e.backgroundColor} !important;
|
|
31
|
+
color: inherit !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Ensure selection is visible against all backgrounds */
|
|
35
|
+
.docx-run-highlighted::selection,
|
|
36
|
+
.docx-run-highlighted *::selection {
|
|
37
|
+
/* For highlighted (yellow background) text, use darker selection */
|
|
38
|
+
background-color: rgba(26, 115, 232, 0.5) !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.docx-run-highlighted::-moz-selection,
|
|
42
|
+
.docx-run-highlighted *::-moz-selection {
|
|
43
|
+
background-color: rgba(26, 115, 232, 0.5) !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Selection in dark text */
|
|
47
|
+
.docx-run-dark-bg::selection,
|
|
48
|
+
.docx-run-dark-bg *::selection {
|
|
49
|
+
/* Use lighter selection for dark backgrounds */
|
|
50
|
+
background-color: rgba(100, 181, 246, 0.5) !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.docx-run-dark-bg::-moz-selection,
|
|
54
|
+
.docx-run-dark-bg *::-moz-selection {
|
|
55
|
+
background-color: rgba(100, 181, 246, 0.5) !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Programmatic highlight class */
|
|
59
|
+
.docx-selection-highlight {
|
|
60
|
+
background-color: ${e.backgroundColor};
|
|
61
|
+
${e.borderRadius?`border-radius: ${e.borderRadius}px;`:""}
|
|
62
|
+
${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:""}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Find/replace highlight */
|
|
66
|
+
.docx-find-highlight {
|
|
67
|
+
background-color: rgba(255, 235, 59, 0.5);
|
|
68
|
+
border-radius: 2px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.docx-find-highlight-current {
|
|
72
|
+
background-color: rgba(255, 152, 0, 0.6);
|
|
73
|
+
border-radius: 2px;
|
|
74
|
+
outline: 2px solid rgba(255, 152, 0, 0.8);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* AI action selection preview */
|
|
78
|
+
.docx-ai-selection-preview {
|
|
79
|
+
background-color: rgba(156, 39, 176, 0.2);
|
|
80
|
+
border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
|
|
81
|
+
}
|
|
82
|
+
`;h=document.createElement("style"),h.id="docx-selection-styles",h.textContent=t,document.head.appendChild(h);}function z(){h&&(h.remove(),h=null);let e=document.getElementById("docx-selection-styles");e&&e.remove();}function xe(){return h!==null||document.getElementById("docx-selection-styles")!==null}function Se(e,t,o=true){return ()=>{if(!e){t([]);return}let n=o?F(e):R(e);t(n);}}var Te=/[\p{L}\p{N}\p{M}_''\-]/u,Ce=/\s/;function N(e){return !e||e.length===0?false:Te.test(e)}function A(e){return !e||e.length===0?false:Ce.test(e)}function p(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(A(o)){let n=t,r=t;for(;n>0&&A(e[n-1]);)n--;for(;r<e.length&&A(e[r]);)r++;return [n,r]}if(N(o)){let n=t,r=t;for(;n>0&&N(e[n-1]);)n--;for(;r<e.length&&N(e[r]);)r++;return [n,r]}return [t,t+1]}function we(e,t){let[o,n]=p(e,t);return e.slice(o,n)}function ye(e,t){let[o,n]=p(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function O(){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,[l,i]=p(n,r);if(i>l)return t.setStart(o,l),t.setEnd(o,i),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=X(n);if(r.length>0){let l=t.startOffset,i=null,c=l;if(l<n.childNodes.length){let s=n.childNodes[l];if(s.nodeType===Node.TEXT_NODE)i=s,c=0;else if(s instanceof Element){let d=X(s);d.length>0&&(i=d[0],c=0);}}if(!i&&r.length>0&&(i=r[0],c=0),i){let s=i.textContent||"",[d,m]=p(s,c);if(m>d){let b=document.createRange();return b.setStart(i,d),b.setEnd(i,m),e.removeAllRanges(),e.addRange(b),true}}}}return false}function Ee(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,l]=p(n,t);if(l>r){let i=document.createRange();return i.setStart(e,r),i.setEnd(e,l),o.removeAllRanges(),o.addRange(i),true}return false}function Re(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return O();let o=t.startContainer,n=t.endContainer,r=t.startOffset,l=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let i=o.textContent||"",[c]=p(i,t.startOffset);r=c;}if(n.nodeType===Node.TEXT_NODE){let i=n.textContent||"",c=Math.max(0,t.endOffset-1),[,s]=p(i,c);l=s;}try{return t.setStart(o,r),t.setEnd(n,l),e.removeAllRanges(),e.addRange(t),!0}catch(i){return console.warn("Could not expand selection to word boundaries:",i),false}}function U(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=Ne(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function Ne(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 X(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 k=0,S=null,v=null,Ae=500;function G(){k=0,v=null,S&&(clearTimeout(S),S=null);}function j(e){return e.target!==v&&G(),k++,v=e.target,S&&clearTimeout(S),S=setTimeout(G,Ae),Math.min(k,3)}function ke(){return e=>{e.ctrlKey||e.metaKey||e.altKey||O();}}function ve(){return e=>{if(j(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;U();}}}function V(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function Oe(e,t,o,n){let r=V(e,t,o),l=Math.floor(r/Math.max(n,1)),i=r-l*n,c=Array.from({length:n},(s,d)=>l+(d<i?1:0));return [...e.slice(0,t),...c,...e.slice(t+o)]}function Me(e,t,o,n,r,l){let i=o-t.rowspan,c=n-t.colspan,s=r+i,d=t.row+t.rowspan,m=t.col+t.colspan,b=[];for(let a of e){if(a===t)continue;let x=a.row+a.rowspan,y=a.col+a.colspan,M=a.row<d&&x>t.row,K=a.col<m&&y>t.col;b.push({data:a.data,row:a.row>=d?a.row+i:a.row,col:a.col>=m?a.col+c:a.col,rowspan:a.rowspan+(i>0&&M&&!K?i:0),colspan:a.colspan+(c>0&&K&&!M?c:0)});}for(let a=0;a<o;a++)for(let x=0;x<n;x++){let y=a===0&&x===0;b.push({data:l(y,a,x),row:t.row+a,col:t.col+x,rowspan:1,colspan:1});}return {anchors:b,deltaRows:i,deltaCols:c,newRowCount:s}}function Ke(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 l=n.col;l<n.col+n.colspan;l++)o.set(`${r}-${l}`,n);}return {byStart:t,byCoveredSlot:o}}function Le(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}export{Ee as $,R as A,B,F as C,ce as D,se as E,ae as F,de as G,ue as H,fe as I,ge as J,he as K,pe as L,$ as M,me as N,be as O,z as P,xe as Q,Se as R,V as S,Oe as T,Me as U,Ke as V,Le as W,p as X,we as Y,ye as Z,O as _,g as a,Re as aa,E as b,U as ba,Y as c,j as ca,q as d,ke as da,J as e,ve as ea,L as f,D as g,H as h,P as i,Q as j,T as k,C as l,W as m,I as n,_ as o,Z as p,ee as q,te as r,oe as s,ne as t,u,f as v,re as w,w as x,ie as y,le as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(n){return n/1440*96}function o(n){return n/96*1440}function P(n){return n==null||isNaN(n)?0:Math.round(n*96/914400)}function _(n){return Math.round(n/96*914400)}function I(n){return Math.round(n/914400*1440)}function E(n){return Math.round(n/1440*914400)}function i(n){return n/72*96}function m(n){return n/144*96}function N(n){return n/2}function H(n){return n/576*96}function e(n,t=2){let r=Math.pow(10,t);return Math.round(n*r)/r}function b(n){return `${e(n)}px`}export{u as a,o as b,P as c,_ as d,I as e,E as f,i as g,m as h,N as i,H as j,b as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-W53SI3XW.mjs';import {d}from'./chunk-54ULJEHM.mjs';function R(s,t){let a=b$1.getCommandHandler(t.type);if(a)return a(s,t);switch(t.type){case "insertText":return E(s,t);case "replaceText":return B(s,t);case "deleteText":return S(s,t);case "formatText":return V(s,t);case "formatParagraph":return $(s,t);case "applyStyle":return H(s,t);case "insertTable":return A(s,t);case "insertImage":return F(s,t);case "insertHyperlink":return j(s,t);case "removeHyperlink":return N(s,t);case "insertParagraphBreak":return v(s,t);case "mergeParagraphs":return M(s,t);case "splitParagraph":return O(s,t);case "setVariable":return _(s,t);case "applyVariables":return J(s,t);default:let r=t;throw new Error(`Unknown command type: ${r.type}`)}}function q(s,t){return t.reduce((a,r)=>R(a,r),s)}function h(s){return JSON.parse(JSON.stringify(s))}function g(s,t){let a=0;for(let r=0;r<s.content.length;r++)if(s.content[r].type==="paragraph"){if(a===t)return r;a++;}return -1}function I(s){let t="";for(let a of s.content)if(a.type==="run")for(let r of a.content)r.type==="text"&&(t+=r.text);else if(a.type==="hyperlink"){for(let r of a.children)if(r.type==="run")for(let e of r.content)e.type==="text"&&(t+=e.text);}return t}function b(s,t){return {type:"run",formatting:t,content:[{type:"text",text:s}]}}function C(s,t,a,r){let e=[],o=0,p=false;for(let n of s.content)if(n.type==="run"){let c=n.content.filter(l=>l.type==="text").map(l=>l.text).join(""),i=o,u=o+c.length;if(!p&&t>=i&&t<=u){let l=t-i;l>0&&e.push({...n,content:[{type:"text",text:c.slice(0,l)}]}),e.push(b(a,r||n.formatting)),l<c.length&&e.push({...n,content:[{type:"text",text:c.slice(l)}]}),p=true;}else e.push(n);o=u;}else e.push(n);return p||e.push(b(a,r)),e}function y(s,t,a){let r=[],e=0;for(let o of s.content)if(o.type==="run"){let p=o.content.filter(i=>i.type==="text").map(i=>i.text).join(""),n=e,c=e+p.length;if(c<=t||n>=a)r.push(o);else {let i="";n<t&&(i+=p.slice(0,t-n)),c>a&&(i+=p.slice(a-n)),i.length>0&&r.push({...o,content:[{type:"text",text:i}]});}e=c;}else r.push(o);return r}function D(s,t,a,r){let e=[],o=0;for(let p of s.content)if(p.type==="run"){let n=p.content.filter(u=>u.type==="text").map(u=>u.text).join(""),c=o,i=o+n.length;if(i<=t||c>=a)e.push(p);else if(c>=t&&i<=a)e.push({...p,formatting:{...p.formatting,...r}});else {let u=Math.max(t,c),l=Math.min(a,i);c<u&&e.push({...p,content:[{type:"text",text:n.slice(0,u-c)}]}),e.push({...p,formatting:{...p.formatting,...r},content:[{type:"text",text:n.slice(u-c,l-c)}]}),i>l&&e.push({...p,content:[{type:"text",text:n.slice(l-c)}]});}o=i;}else e.push(p);return e}function E(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e];return o.content=C(o,t.position.offset,t.text,t.formatting),a}function B(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset),n.content=C(n,e.offset,t.text,t.formatting);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length),n.content=C(n,e.offset,t.text,t.formatting);let i=[];for(let u=e.paragraphIndex+1;u<=o.paragraphIndex;u++)i.push(g(r,u));for(let u=i.length-1;u>=0;u--)i[u]!==-1&&r.content.splice(i[u],1);}return a}function S(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=y(n,e.offset,o.offset);}else {let p=g(r,e.paragraphIndex),n=r.content[p],c=I(n);n.content=y(n,e.offset,c.length);let i=g(r,o.paragraphIndex),u=r.content[i];u.content=y(u,0,o.offset),n.content.push(...u.content);let l=[];for(let f=e.paragraphIndex+1;f<=o.paragraphIndex;f++)l.push(g(r,f));for(let f=l.length-1;f>=0;f--)l[f]!==-1&&r.content.splice(l[f],1);}return a}function V(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex===o.paragraphIndex){let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p];n.content=D(n,e.offset,o.offset,t.formatting);}else for(let p=e.paragraphIndex;p<=o.paragraphIndex;p++){let n=g(r,p);if(n===-1)continue;let c=r.content[n],i=I(c),u=0,l=i.length;p===e.paragraphIndex&&(u=e.offset),p===o.paragraphIndex&&(l=o.offset),c.content=D(c,u,l,t.formatting);}return a}function $(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];if(o.formatting={...o.formatting,...t.formatting},"numPr"in t.formatting){let p=t.formatting.numPr;if(p&&p.numId!==void 0&&p.numId!==0){let n=p.ilvl??0,c=p.numId===1,i=c?"\u2022":"1.";if(a.package.numbering){let u=a.package.numbering.nums.find(l=>l.numId===p.numId);if(u){let l=a.package.numbering.abstractNums.find(f=>f.abstractNumId===u.abstractNumId);if(l){let f=l.levels.find(x=>x.ilvl===n);f&&(i=f.lvlText||i);}}}o.listRendering={level:n,numId:p.numId,marker:i,isBullet:c};}else delete o.listRendering;}return a}function H(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e];return o.formatting={...o.formatting,styleId:t.styleId},a}function A(s,t){let a=h(s),r=a.package.document,e=[];for(let n=0;n<t.rows;n++){let c=[];for(let i=0;i<t.columns;i++){let u=t.data?.[n]?.[i]||"";c.push({type:"tableCell",content:[{type:"paragraph",content:u?[b(u)]:[]}]});}e.push({type:"tableRow",formatting:n===0&&t.hasHeader?{header:true}:void 0,cells:c});}let o={type:"table",rows:e},p=g(r,t.position.paragraphIndex);return p===-1?r.content.push(o):r.content.splice(p+1,0,o),a}function F(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],n={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:t.src,alt:t.alt,size:{width:d(t.width||100),height:d(t.height||100)},wrap:{type:"inline"}}}]},c=C(o,t.position.offset,"",void 0),i=false,u=0;for(let l=0;l<c.length;l++){let f=c[l];if(f.type==="run"){let x=f.content.filter(d=>d.type==="text").map(d=>d.text).join("");if(u+=x.length,!i&&u>=t.position.offset){c.splice(l+1,0,n),i=true;break}}}return i||c.push(n),o.content=c,a}function j(s,t){let a=h(s),r=a.package.document,{start:e,end:o}=t.range;if(e.paragraphIndex!==o.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let p=g(r,e.paragraphIndex);if(p===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let n=r.content[p],c=I(n),i=t.displayText||c.slice(e.offset,o.offset);n.content=y(n,e.offset,o.offset);let u={type:"hyperlink",href:t.url,tooltip:t.tooltip,children:[b(i)]},l=false,f=0,x=[];for(let d of n.content)if(d.type==="run"){let P=d.content.filter(m=>m.type==="text").map(m=>m.text).join(""),k=f+P.length;if(!l&&f<=e.offset&&e.offset<=k){let m=e.offset-f;m>0&&x.push({...d,content:[{type:"text",text:P.slice(0,m)}]}),x.push(u),m<P.length&&x.push({...d,content:[{type:"text",text:P.slice(m)}]}),l=true;}else x.push(d);f=k;}else x.push(d);return l||x.push(u),n.content=x,a}function N(s,t){let a=h(s),r=a.package.document,{start:e}=t.range,o=g(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let p=r.content[o],n=[];for(let c of p.content)if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&n.push(i);else n.push(c);return p.content=n,a}function v(s,t){let a=h(s),r=a.package.document,e=g(r,t.position.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.position.paragraphIndex} not found`);let o=r.content[e],p=I(o),n=y({...o,content:[...o.content]},t.position.offset,p.length),c=y({...o,content:[...o.content]},0,t.position.offset);o.content=n;let i={type:"paragraph",formatting:o.formatting,content:c};return r.content.splice(e+1,0,i),a}function M(s,t){let a=h(s),r=a.package.document,e=g(r,t.paragraphIndex);if(e===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let o=r.content[e],p=[];for(let n=1;n<=t.count;n++){let c=g(r,t.paragraphIndex+n);if(c!==-1){let i=r.content[c];o.content.push(...i.content),p.push(c);}}for(let n=p.length-1;n>=0;n--)r.content.splice(p[n],1);return a}function O(s,t){return v(s,{position:t.position})}function _(s,t){let a=h(s);return a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t.name)||a.templateVariables.push(t.name),a}function J(s,t){let a=h(s),r=a.package.document;function e(n){for(let c of n.content)if(c.type==="text")for(let[i,u]of Object.entries(t.values)){let l=new RegExp(`\\{${i}\\}`,"g");c.text=c.text.replace(l,u);}}function o(n){for(let c of n.content)if(c.type==="run")e(c);else if(c.type==="hyperlink")for(let i of c.children)i.type==="run"&&e(i);}function p(n){if(n.type==="paragraph")o(n);else if(n.type==="table")for(let c of n.rows)for(let i of c.cells)for(let u of i.content)p(u);}for(let n of r.content)p(n);return a}export{R as a,q as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){return Math.floor(Math.random()*4294967296).toString(16).toUpperCase().padStart(8,"0")}export{t as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function h(){return {type:"break",breakType:"page"}}function P(){return {type:"break",breakType:"column"}}function x(e){return {type:"break",breakType:"textWrapping",clear:e}}function b(){return {type:"run",content:[h()]}}function l(){return {type:"paragraph",content:[],formatting:{pageBreakBefore:true}}}function k(e){return e.content.filter(t=>t.type==="run")}function y(e,t){let{paragraphIndex:a}=t,n=[...e.package.document.content||[]],r=l();return n.splice(a+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:n}}}}function B(){return {type:"paragraph",content:[],formatting:{borders:{bottom:{style:"single",color:{rgb:"000000"},size:12,space:1}},spaceBefore:120,spaceAfter:120}}}function C(e,t){let{paragraphIndex:a}=t,n=[...e.package.document.content||[]],r=B();return n.splice(a+1,0,r),{...e,package:{...e.package,document:{...e.package.document,content:n}}}}function i(e){return e.type==="break"&&e.breakType==="page"}function d(e){return e.type==="break"&&e.breakType==="column"}function R(e){return e.type==="break"&&e.breakType==="textWrapping"}function I(e){return e.type==="break"}function g(e){return e.formatting?.pageBreakBefore===true}function D(e){let t=0;for(let a of e.package.document.content||[])if(a.type==="paragraph"){let n=a;g(n)&&t++;let r=k(n);for(let u of r)for(let o of u.content)i(o)&&t++;}return t}function T(e){let t=[],a=e.package.document.content||[];for(let n=0;n<a.length;n++){let r=a[n];if(r.type==="paragraph"){let u=r;g(u)&&t.push({paragraphIndex:n});let o=k(u);for(let p=0;p<o.length;p++){let s=o[p];for(let c of s.content)i(c)&&t.push({paragraphIndex:n,runIndex:p});}}}return t}function z(e,t){let{paragraphIndex:a,runIndex:n}=t,r=[...e.package.document.content||[]],u=r[a];if(u.type!=="paragraph")return e;let o=u;if(g(o)&&n===void 0)return r[a]={...o,formatting:{...o.formatting,pageBreakBefore:false}},{...e,package:{...e.package,document:{...e.package.document,content:r}}};if(n!==void 0){let p=[],s=0;for(let c of o.content)if(c.type==="run"){if(s===n){let f=c.content.filter(m=>!i(m));f.length>0&&p.push({...c,content:f});}else p.push(c);s++;}else p.push(c);return r[a]={...o,content:p},{...e,package:{...e.package,document:{...e.package.document,content:r}}}}return e}exports.a=h;exports.b=P;exports.c=x;exports.d=b;exports.e=l;exports.f=y;exports.g=B;exports.h=C;exports.i=i;exports.j=d;exports.k=R;exports.l=I;exports.m=g;exports.n=D;exports.o=T;exports.p=z;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b,a,o,d as d$1}from'./chunk-CPAYKE6X.mjs';import {i,h,k as k$1,a as a$1,j as j$1}from'./chunk-54ULJEHM.mjs';var re="application/x-docx-editor",d={HTML:"text/html",PLAIN:"text/plain"};function se(e){if(!e)return [];let t=()=>{if(!e.items||e.items.length===0)return [];let a=[];for(let l of Array.from(e.items)){if(l.kind!=="file"||!l.type.startsWith("image/"))continue;let c=l.getAsFile();c&&a.push(c);}return a},n=()=>!e.files||e.files.length===0?[]:Array.from(e.files).filter(a=>a.type.startsWith("image/")),i=t(),o=i.length?i:n();if(o.length<=1)return o;let r=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml","image/bmp","image/tiff"],s=a=>{let l=a[0],c=r.indexOf(l.type);c<0&&(c=Number.MAX_SAFE_INTEGER);for(let m of a.slice(1)){let b=r.indexOf(m.type);if(b<0&&(b=Number.MAX_SAFE_INTEGER),b<c){l=m,c=b;continue}b===c&&m.size>l.size&&(l=m);}return l},u=new Map;for(let a of o){let l=a.name?.trim()??"",m=(l?l.replace(/\.[^/.]+$/,"").toLowerCase():"")||`size:${a.size}`,b=u.get(m);b?b.push(a):u.set(m,[a]);}let g=[];for(let a of u.values())g.push(s(a));return g}async function A(e,t={}){let{includeFormatting:n=true,onError:i,theme:o}=t;try{let r=F(e,n,o);return await S(r)}catch(r){return i?.(r),false}}async function ae(e,t={}){let{includeFormatting:n=true,onError:i,theme:o}=t;try{let r=j(e,n,o);return await S(r)}catch(r){return i?.(r),false}}function F(e,t=true,n){let i=e.map(L).join(""),o=t?O(e,n):v(i),r=JSON.stringify(e);return {plainText:i,html:o,internal:r}}function j(e,t=true,n){let i=e.map(X).join(`
|
|
2
|
+
`),o=t?Q(e,n):v(i),r=JSON.stringify(e);return {plainText:i,html:o,internal:r}}async function S(e){try{if(navigator.clipboard&&navigator.clipboard.write){let t=[new ClipboardItem({[d.PLAIN]:new Blob([e.plainText],{type:d.PLAIN}),[d.HTML]:new Blob([e.html],{type:d.HTML})})];return await navigator.clipboard.write(t),!0}return P(e)}catch{return P(e)}}function P(e){let t=document.createElement("div");t.innerHTML=e.html,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t);try{let n=window.getSelection();if(!n)return !1;let i=document.createRange();i.selectNodeContents(t),n.removeAllRanges(),n.addRange(i);let o=document.execCommand("copy");return n.removeAllRanges(),o}finally{document.body.removeChild(t);}}async function le(e={}){let{cleanWordFormatting:t=true,onError:n}=e;try{if(navigator.clipboard&&navigator.clipboard.read){let i=await navigator.clipboard.read();return await z(i,t)}return null}catch(i){return n?.(i),null}}async function z(e,t){let n="",i="";for(let o of e)o.types.includes(d.HTML)&&(n=await(await o.getType(d.HTML)).text()),o.types.includes(d.PLAIN)&&(i=await(await o.getType(d.PLAIN)).text());return D(n,i,t)}function W(e,t={}){let{cleanWordFormatting:n=true}=t,i=e.clipboardData;if(!i)return null;let o=i.getData(d.HTML),r=i.getData(d.PLAIN);return D(o,r,n)}function D(e,t,n=true){let i=$(e),o=K(e);if(o){let u=e.match(/data-docx-editor-content="([^"]+)"/);if(u)try{return {runs:JSON.parse(decodeURIComponent(u[1])),fromWord:!1,fromEditor:!0,plainText:t}}catch{}}let r=e;return i&&n&&(r=U(e)),{runs:q(r,t),fromWord:i,fromEditor:o,plainText:t}}function $(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 K(e){return e.includes("data-docx-editor")||e.includes("docx-run")||e.includes("docx-paragraph")}function U(e){let t=e;return t=t.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,""),t=t.replace(/<!--[\s\S]*?-->/g,""),t=t.replace(/<\?xml[^>]*>/gi,""),t=t.replace(/<o:[^>]*>[\s\S]*?<\/o:[^>]*>/gi,""),t=t.replace(/<o:[^>]*\/>/gi,""),t=t.replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,""),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 q(e,t){if(!e||e.trim()==="")return t?[k(t)]:[];let n=document.createElement("div");n.innerHTML=e;let i=[];return T(n,i,{}),i.length===0&&t?[k(t)]:i}function T(e,t,n){if(e.nodeType===Node.TEXT_NODE){let s=e.textContent||"";(s.trim()||s.includes(" "))&&t.push(k(s,n));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let i=e,o=i.tagName.toLowerCase(),r={...n,...J(i)};switch(o){case "br":t.push(H(r));return;case "p":case "div":for(let s of i.childNodes)T(s,t,r);i.nextSibling&&t.push(H(r));return;case "b":case "strong":r.bold=true;break;case "i":case "em":r.italic=true;break;case "u":r.underline={style:"single"};break;case "s":case "strike":case "del":r.strike=true;break;case "sup":r.vertAlign="superscript";break;case "sub":r.vertAlign="subscript";break;case "code":case "pre":r.fontFamily={ascii:"Courier New"};break}for(let s of i.childNodes)T(s,t,r);}function J(e){let t={},n=e.style;(n.fontWeight==="bold"||parseInt(n.fontWeight)>=700)&&(t.bold=true),n.fontStyle==="italic"&&(t.italic=true);let i=n.textDecoration||n.textDecorationLine;if(i&&(i.includes("underline")&&(t.underline={style:"single"}),i.includes("line-through")&&(t.strike=true)),n.fontSize){let o=parseFloat(n.fontSize);isNaN(o)||(t.fontSize=Math.round(o/1.333*2));}if(n.fontFamily){let o=n.fontFamily.replace(/["']/g,"").split(",")[0].trim();o&&(t.fontFamily={ascii:o});}if(n.color){let o=I(n.color);o&&(t.color={rgb:o});}if(n.backgroundColor&&n.backgroundColor!=="transparent"){let o=I(n.backgroundColor);o&&(t.shading={fill:{rgb:o}});}return t}function I(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 n=parseInt(t[1]).toString(16).padStart(2,"0"),i=parseInt(t[2]).toString(16).padStart(2,"0"),o=parseInt(t[3]).toString(16).padStart(2,"0");return (n+i+o).toUpperCase()}return null}function L(e){return e.content.map(t=>t.type==="text"?t.text:t.type==="tab"?" ":t.type==="break"&&t.breakType==="textWrapping"?`
|
|
3
|
+
`:"").join("")}function X(e){return (e.content||[]).map(t=>t.type==="run"?L(t):"").join("")}function O(e,t){return e.map(n=>V(n,t)).join("")}function Q(e,t){return e.map(n=>`<p>${O(n.content?.filter(i=>i.type==="run")||[],t)}</p>`).join("")}function V(e,t){let n=L(e);if(!n)return "";let i=v(n),o=e.formatting;if(!o)return i;o.bold&&(i=`<strong>${i}</strong>`),o.italic&&(i=`<em>${i}</em>`),o.underline&&(i=`<u>${i}</u>`),o.strike&&(i=`<s>${i}</s>`),o.vertAlign==="superscript"&&(i=`<sup>${i}</sup>`),o.vertAlign==="subscript"&&(i=`<sub>${i}</sub>`);let r=[];if(o.fontSize){let g=o.fontSize/2;r.push(`font-size: ${g}pt`);}o.fontFamily?.ascii&&r.push(`font-family: "${o.fontFamily.ascii}"`);let s=b(o.color,t);s&&r.push(`color: #${s}`);let u=b(o.shading?.fill,t);return u&&r.push(`background-color: #${u}`),r.length>0&&(i=`<span style="${r.join("; ")}">${i}</span>`),i}function v(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function k(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function H(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function ce(e){let{onCopy:t,onCut:n,onPaste:i,clipboardOptions:o={}}=e;return {handleCopy:async a=>{if(!t)return;let l=t();if(!l)return;a.preventDefault();let c=F(l.runs);a.clipboardData?(a.clipboardData.setData(d.PLAIN,c.plainText),a.clipboardData.setData(d.HTML,c.html)):await S(c);},handleCut:async a=>{if(!n)return;let l=n();if(!l)return;a.preventDefault();let c=F(l.runs);a.clipboardData?(a.clipboardData.setData(d.PLAIN,c.plainText),a.clipboardData.setData(d.HTML,c.html)):await S(c);},handlePaste:a=>{if(!i)return;a.preventDefault();let l=W(a,o);l&&i(l);},handleKeyDown:async a=>{let l=a.ctrlKey||a.metaKey;if(l&&a.key==="c"&&!a.shiftKey&&t){let c=t();c&&await A(c.runs,o);}if(l&&a.key==="x"&&!a.shiftKey&&n){let c=n();c&&await A(c.runs,o);}}}}var Y={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1172},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1074},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15}},Z={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function ee(e){let t=e.toLowerCase();return t.includes("mono")||t.includes("courier")||t.includes("consolas")||t.includes("console")||t.includes("code")||t.includes("terminal")?"monospace":t.includes("times")||t.includes("georgia")||t.includes("garamond")||t.includes("palatino")||t.includes("baskerville")||t.includes("bodoni")||t.includes("cambria")||t.includes("mincho")||t.includes("ming")||t.includes("song")||t.includes("serif")?"serif":t.includes("script")||t.includes("cursive")||t.includes("comic")||t.includes("brush")||t.includes("hand")?"cursive":"sans-serif"}function M(e){let t=e.trim().toLowerCase(),n=Y[t];if(n)return {googleFont:n.googleFont,cssFallback:n.fallbackStack.map(B).join(", "),originalFont:e,hasGoogleEquivalent:true,singleLineRatio:n.singleLineRatio};let i=ee(e),o=Z[i];return {googleFont:null,cssFallback:`${B(e)}, ${o}`,originalFont:e,hasGoogleEquivalent:false,singleLineRatio:1.15}}function B(e){return ["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(e.toLowerCase())?e:/[\s,'"()]/.test(e)?`"${e.replace(/"/g,'\\"')}"`:e}function G(e,t){if(!t)return null;let i=e.toLowerCase().startsWith("major")?t.majorFont:t.minorFont;if(!i)return null;let o=e.toLowerCase();return o.includes("eastasia")||o.includes("ea")?i.ea??i.latin??null:o.includes("cs")||o.includes("bidi")?i.cs??i.latin??null:i.latin??null}function be(e,t){if(!e)return {};let n={};if(e.fontFamily){let s=null;if(e.fontFamily.asciiTheme&&t?.fontScheme&&(s=G(e.fontFamily.asciiTheme,t.fontScheme)),s||(s=e.fontFamily.ascii||e.fontFamily.hAnsi||e.fontFamily.eastAsia||e.fontFamily.cs||null),s){let u=M(s);n.fontFamily=u.cssFallback;}}if(e.fontSize!==void 0&&(n.fontSize=`${i(e.fontSize)}pt`),e.bold&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic"),e.color&&(n.color=a(e.color,t)),e.highlight&&e.highlight!=="none"&&(n.backgroundColor=o(e.highlight)),e.shading){let s=_(e.shading,t);s&&!n.backgroundColor&&(n.backgroundColor=s);}let i$1=[],o$1=[],r=[];if(e.underline&&e.underline.style!=="none"){i$1.push("underline");let s=te(e.underline.style);s!=="solid"&&o$1.push(s),e.underline.color&&r.push(a(e.underline.color,t));}if(e.strike&&i$1.push("line-through"),e.doubleStrike&&i$1.push("line-through"),i$1.length>0&&(n.textDecoration=i$1.join(" "),o$1.length>0&&(n.textDecorationStyle=o$1[0]),r.length>0&&(n.textDecorationColor=r[0])),e.vertAlign)switch(e.vertAlign){case "superscript":n.verticalAlign="super",n.fontSize||(n.fontSize="0.83em");break;case "subscript":n.verticalAlign="sub",n.fontSize||(n.fontSize="0.83em");break}if(e.position&&e.position!==0){let s=h(e.position);n.position="relative",n.top=k$1(-s);}return e.allCaps?n.textTransform="uppercase":e.smallCaps&&(n.fontVariant="small-caps"),e.spacing!==void 0&&e.spacing!==0&&(n.letterSpacing=k$1(a$1(e.spacing))),e.scale!==void 0&&e.scale!==100&&(n.transform=`scaleX(${e.scale/100})`,n.display="inline-block"),e.hidden&&(n.display="none"),e.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),e.shadow&&!e.emboss&&!e.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.rtl&&(n.direction="rtl"),n}function me(e,t){if(!e)return {};let n={};if(e.alignment&&(n.textAlign=ne(e.alignment)),e.spaceBefore!==void 0&&(n.marginTop=k$1(a$1(e.spaceBefore))),e.spaceAfter!==void 0&&(n.marginBottom=k$1(a$1(e.spaceAfter))),e.lineSpacing!==void 0&&e.lineSpacing>0)switch(e.lineSpacingRule){case "exact":{let i=a$1(e.lineSpacing);i>0&&(n.lineHeight=k$1(i));break}case "atLeast":{let i=a$1(e.lineSpacing);i>0&&(n.minHeight=k$1(i),n.lineHeight=k$1(i));break}default:{let i=e.lineSpacing/240;i>0&&(n.lineHeight=i.toString());break}}if(e.indentLeft!==void 0&&(n.marginLeft=k$1(a$1(e.indentLeft))),e.indentRight!==void 0&&(n.marginRight=k$1(a$1(e.indentRight))),e.indentFirstLine!==void 0&&(e.hangingIndent?n.textIndent=k$1(a$1(e.indentFirstLine)):n.textIndent=k$1(a$1(e.indentFirstLine))),e.borders&&(e.borders.top&&Object.assign(n,C(e.borders.top,"Top",t)),e.borders.bottom&&Object.assign(n,C(e.borders.bottom,"Bottom",t)),e.borders.left&&Object.assign(n,C(e.borders.left,"Left",t)),e.borders.right&&Object.assign(n,C(e.borders.right,"Right",t))),e.shading){let i=_(e.shading,t);i&&(n.backgroundColor=i);}return e.bidi&&(n.direction="rtl"),e.pageBreakBefore&&(n.pageBreakBefore="always"),e.keepNext&&(n.pageBreakAfter="avoid"),e.keepLines&&(n.pageBreakInside="avoid"),n}function C(e,t="",n){if(!e||e.style==="none"||e.style==="nil")return {};let i={},o=e.size?j$1(e.size):1,r=e.color?a(e.color,n):"#000000",s=ie(e.style),u=`border${t}Width`,g=`border${t}Style`,a$1=`border${t}Color`;return i[u]=k$1(Math.max(1,o)),i[g]=s,i[a$1]=r,i}function _(e,t){return !e||e.pattern==="clear"||e.pattern==="nil"?"":e.fill?e.fill.auto||e.fill.rgb==="auto"||e.fill.rgb==="FFFFFF"?"":d$1(e.fill,t):e.pattern==="solid"&&e.color?d$1(e.color,t):e.pattern&&e.pattern.startsWith("pct")&&e.color?d$1(e.color,t):""}function te(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 ne(e){switch(e){case "center":return "center";case "right":return "right";case "both":case "distribute":return "justify";default:return "left"}}function ie(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 ye(e){let t=[];return e.descendants((n,i)=>{if(n.type.name==="paragraph"){let o=n.attrs.outlineLevel,r=n.attrs.styleId,s=o;if(s==null&&r){let u=r.match(/^[Hh]eading(\d)$/);u&&(s=parseInt(u[1],10)-1);}if(s!=null&&s>=0&&s<=8){let u="";n.forEach(g=>{g.isText&&(u+=g.text||"");}),u.trim()&&t.push({text:u.trim(),level:s,pmPos:i});}}}),t}export{re as a,d as b,se as c,A as d,ae as e,F as f,j as g,S as h,le as i,W as j,D as k,$ as l,K as m,U as n,q as o,ce as p,M as q,be as r,me as s,C as t,ye as u};
|