n8n-nodes-adeu 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,7 +95,7 @@ ${u}`,a++;else break}e.push([l,s]),n=a;}return e}y(go,"_merge_footnote_sections"
95
95
  Did you mean the literal "${r}"? It appears in the document (\u2026${l}\u2026). If you used a regex, drop the ^/$ anchors \u2014 they match the start/end of the entire document, not a line.`}return ""}static _PREVIEW_WRAPPER_PAIRS=[["{--","--}"],["{++","++}"],["{==","==}"],["{>>","<<}"]];static _tidy_preview_context(e,n){e=e.replace(/\{>>[\s\S]*?<<\}/g,"");for(let[r,s]of V._PREVIEW_WRAPPER_PAIRS)if(n==="before"){let i=0,o=0,l=0;for(;l<e.length;)e.startsWith(r,l)?(i+=1,l+=r.length):e.startsWith(s,l)?(i===0?o=l+s.length:i-=1,l+=s.length):l+=1;e=e.substring(o);}else {let i=[],o=0;for(;o<e.length;)e.startsWith(r,o)?(i.push(o),o+=r.length):e.startsWith(s,o)?(i.length>0&&i.pop(),o+=s.length):o+=1;i.length>0&&(e=e.substring(0,i[0]));}return n==="before"?e=e.replace(/^[-+=<>]{0,2}\}/,""):e=e.replace(/\{[-+=<>]{0,2}$/,""),e}_capture_preview_context(e){if(e.type!=="modify")return;let n=e._resolved_start_idx;if(n==null)return;let s=(e._active_mapper_ref||this.mapper).full_text;if(!s)return;let i=(e.target_text||"").length,o=s.substring(Math.max(0,n-ye),n),l=s.substring(n+i,n+i+ye);e._preview_context=[V._tidy_preview_context(o,"before"),V._tidy_preview_context(l,"after")];}_capture_parent_preview_context(e){if(!e||e.type!=="modify"||e._preview_context||!e._preview_span)return;let[n,r]=e._preview_span,i=(e._preview_mapper_ref||this.mapper).full_text;if(!i)return;let o=i.substring(Math.max(0,n-ye),n),l=i.substring(n+r,n+r+ye);e._preview_context=[V._tidy_preview_context(o,"before"),V._tidy_preview_context(l,"after")];}_build_full_match_preview(e){let[n,r]=e._preview_context,s=e._preview_matched_text||"",i=e._preview_new_text!==void 0&&e._preview_new_text!==null?e._preview_new_text:e.new_text||"",[o,l]=this._parse_markdown_style(s),[a,u]=this._parse_markdown_style(i);l&&l.startsWith("Heading")&&(n=n+s.substring(0,s.length-o.length),s=o),u&&u.startsWith("Heading")&&(i=a);let[c,d]=Ue(s,i),f=s.substring(c,s.length-d),h=i.substring(c,i.length-d);n=n+s.substring(0,c),d&&(r=s.substring(s.length-d)+r),f=he(f,ze),h=he(h,ze);let p;if(!f&&!h){let g=he(s,ze),w=g?`{==${g}==}`:"";p=`${n.substring(0,n.length-s.length)}${w}${r}`;}else {let g=f?`{--${f}--}`:"",w=h?`{++${h}++}`:"";p=`${n}${g}${w}${r}`;}let _=p;return _=_.replace(/\{>>[\s\S]*?<<\}/g,""),_=_.replace(/\{--[\s\S]*?--\}/g,""),_=_.replace(/\{\+\+([\s\S]*?)\+\+\}/g,"$1"),[p,_]}static _report_new_text(e){return e&&e.type==="insert_row"&&Array.isArray(e.cells)?e.cells.join(" | "):e&&e.new_text||""}_build_postapply_previews(e){let n=new Set((e._minted_change_ids||[]).map(w=>String(w))),r=new Set((e._minted_comment_ids||[]).map(w=>String(w)));if(n.size===0&&r.size===0)return null;let s=this.mapper;s.full_text||s._build_map();let i=s.full_text;if(!i)return null;let o=[];for(let w of s.spans)(w.ins_id&&n.has(String(w.ins_id))||w.del_id&&n.has(String(w.del_id))||r.size>0&&w.comment_ids&&w.comment_ids.some(b=>r.has(String(b))))&&o.push([w.start,w.end]);if(o.length===0)return null;let l=/\{>>[\s\S]*?<<\}/g,a=[],u;for(;(u=l.exec(i))!==null;)a.push([u.index,u.index+u[0].length]);let c=i,d=y(w=>w,"to_visible");if(a.length>0){let w=[],k=0;for(let[b,m]of a)w.push(i.substring(k,b)),k=m;w.push(i.substring(k)),c=w.join(""),d=y(b=>{let m=0;for(let[v,N]of a)if(b>=N)m+=N-v;else if(b>v){m+=b-v;break}else break;return b-m},"to_visible");}o.sort((w,k)=>w[0]-k[0]);let f=[];for(let[w,k]of o){let b=d(w),m=d(k),v=Math.max(0,b-ye),N=Math.min(c.length,m+ye),A=f.length>0?f[f.length-1]:null;A&&v<=A[1]?A[1]=Math.max(A[1],N):f.push([v,N]);}let h=[];for(let[w,k]of f){let b=c.substring(w,k);b=V._tidy_preview_context(b,"before"),b=V._tidy_preview_context(b,"after"),h.push(b);}let p=h.join(`
96
96
  \u2026
97
97
  `),_=p;_=_.replace(/\{>>[\s\S]*?<<\}/g,""),_=_.replace(/\{--[\s\S]*?--\}/g,""),_=_.replace(/\{\+\+([\s\S]*?)\+\+\}/g,"$1"),_=_.replace(/\{==([\s\S]*?)==\}/g,"$1");let g=ze*2+4*ye;return [he(p,g),he(_,g)]}_build_edit_context_previews(e){if(e.type!=="modify")return [null,null];let n=this._build_postapply_previews(e);if(n)return n;if(e._preview_span&&e._preview_context)return this._build_full_match_preview(e);e._resolved_proxy_edit&&(e=e._resolved_proxy_edit);let r=e._resolved_start_idx;if(r==null)return [null,null];let s=e.target_text||"",i=e.new_text||"",[o,l]=this._parse_markdown_style(s);if(l&&l.startsWith("Heading")){let b=s.length-o.length;r+=b,s=o;}let[a,u]=this._parse_markdown_style(i);u&&u.startsWith("Heading")&&(i=a);let c=s.length,d,f;if(e._preview_context)[d,f]=e._preview_context;else {let m=(e._active_mapper_ref||this.mapper).full_text;if(!m)return [null,null];d=V._tidy_preview_context(m.substring(Math.max(0,r-ye),r),"before"),f=V._tidy_preview_context(m.substring(r+c,r+c+ye),"after");}let h=he(s,ze),p=he(i,ze),_=h?`{--${h}--}`:"",g=p?`{++${p}++}`:"",w=`${d}${_}${g}${f}`,k=w;return k=k.replace(/\{>>.*?<<\}/gs,""),k=k.replace(/\{--.*?--\}/gs,""),k=k.replace(/\{\+\+(.*?)\+\+\}/gs,"$1"),[w,k]}_scan_existing_ids(){let e=0;for(let n of ["w:ins","w:del","w:pPrChange"]){let r=I(this.doc.element,n);for(let s of r){let i=parseInt(s.getAttribute("w:id")||"0",10);!isNaN(i)&&i>e&&(e=i);}}return e}_get_heading_path_and_page(e,n,r){let s=1;for(let u=0;u<r.length&&e>=r[u];u++)s=u+1;let o=n.substring(0,e).split(`
98
- `),l=[],a=999;for(let u=o.length-1;u>=0;u--){let d=o[u].match(/^(#{1,6})\s+(.*)/);if(d){let f=d[1].length;if(f<a){let h=d[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(h.length>80&&(h=h.substring(0,80)+"..."),l.unshift(h),a=f,f===1)break}}}return [l.join(" > "),s]}accept_all_revisions(){let e=[this.doc.element];for(let a of this.doc.pkg.parts)a!==this.doc.part&&a.contentType.includes("wordprocessingml")&&a.contentType.endsWith("+xml")&&e.push(a._element);let n=0,r=0,s=0;for(let a of e){n+=I(a,"w:ins").length,r+=I(a,"w:del").length;for(let u of ["w:rPrChange","w:pPrChange","w:sectPrChange"])s+=I(a,u).length;}let i=this._existing_comment_ids().length;for(let a of e){let u=I(a,"w:ins");for(let f of u){this._clean_wrapping_comments(f);let h=f.parentNode;if(h){if(h.tagName==="w:trPr"){h.removeChild(f);continue}for(;f.firstChild;)h.insertBefore(f.firstChild,f);h.removeChild(f);}}let c=I(a,"w:p");for(let f of c){let h=M(f,"w:pPr");if(h){let p=M(h,"w:rPr"),_=p?M(p,"w:del"):null;if(p&&_){let g=false;for(let w of ["w:t","w:tab","w:br"]){for(let k of I(f,w)){if(w==="w:t"&&!k.textContent)continue;let b=false,m=k.parentNode;for(;m&&m!==f;){if(m.tagName==="w:del"){b=true;break}m=m.parentNode;}if(!b){g=true;break}}if(g)break}g?p.removeChild(_):(this._clean_wrapping_comments(f),this._delete_comments_in_element(f),f.parentNode&&f.parentNode.removeChild(f));}}}let d=I(a,"w:del");for(let f of d){this._clean_wrapping_comments(f),this._delete_comments_in_element(f);let h=f.parentNode;if(h)if(h.tagName==="w:trPr"){let p=h.parentNode;p&&p.parentNode&&p.parentNode.removeChild(p);}else h.removeChild(f);}for(let f of I(a,"w:pPrChange"))f.parentNode?.removeChild(f);}for(let a of e){for(let c of ["w:commentRangeStart","w:commentRangeEnd"])for(let d of I(a,c))d.parentNode?.removeChild(d);let u=I(a,"w:commentReference");for(let c of u){let d=c.parentNode;d&&((d.tagName==="w:r"||d.tagName.endsWith(":r"))&&Array.from(d.childNodes).filter(h=>h.nodeType===1&&h.tagName!=="w:rPr"&&h.tagName!=="rPr").length<=1?d.parentNode?.removeChild(d):d.removeChild(c));}}let o=this.doc.pkg,l=new Set;for(let a of o.parts)if(a.partname.toLowerCase().includes("comments")){l.add(a.partname);let u=a.partname.startsWith("/")?a.partname:"/"+a.partname,c=a.partname.startsWith("/")?a.partname.substring(1):a.partname;l.add(u),l.add(c);}if(l.size>0){for(let u of o.parts)if(u.partname.endsWith(".rels")){let c=I(u._element,"Relationship"),d=[];for(let f of c)if((f.getAttribute("Target")||"").toLowerCase().includes("comments")){d.push(f);let p=u.partname.replace("/_rels/","/").replace(".rels",""),_=o.getPartByPath(p);if(_){let g=f.getAttribute("Id");g&&_.rels.delete(g);}}for(let f of d)f.parentNode?.removeChild(f);}let a=o.getPartByPath("[Content_Types].xml");if(a){let u=I(a._element,"Override"),c=[];for(let d of u){let f=d.getAttribute("PartName")||"";(l.has(f)||f.toLowerCase().includes("comments"))&&c.push(d);}for(let d of c)d.parentNode?.removeChild(d);}o.parts=o.parts.filter(u=>!u.partname.toLowerCase().includes("comments"));for(let u of Object.keys(o.unzipped))u.toLowerCase().includes("comments")&&delete o.unzipped[u];}return {accepted_insertions:n,accepted_deletions:r,accepted_formatting:s,removed_comments:i}}reject_all_revisions(){let e=[this.doc.element];for(let n of this.doc.pkg.parts)n!==this.doc.part&&n.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml")&&e.push(n._element);for(let n of e){for(let o of I(n,"w:pPrChange"))this._revert_ppr_change(o);let r=I(n,"w:ins");for(let o of r){let l=o.parentNode;if(l)if(this._clean_wrapping_comments(o),this._delete_comments_in_element(o),l.tagName==="w:trPr"){let a=l.parentNode;a&&a.parentNode&&a.parentNode.removeChild(a);}else l.removeChild(o);}let s=I(n,"w:p");for(let o of s){let l=M(o,"w:pPr");if(l){let a=M(l,"w:rPr"),u=a?M(a,"w:del"):null;a&&u&&a.removeChild(u);}}let i=I(n,"w:del");for(let o of i){let l=o.parentNode;if(!l)continue;if(l.tagName==="w:trPr"){l.removeChild(o);continue}let a=Array.from(o.getElementsByTagName("w:delText"));for(let u of a){let c=o.ownerDocument.createElement("w:t");c.textContent=u.textContent,u.hasAttribute("xml:space")&&c.setAttribute("xml:space","preserve"),u.parentNode?.replaceChild(c,u);}for(;o.firstChild;)l.insertBefore(o.firstChild,o);l.removeChild(o);}}}_revert_ppr_change(e){let n=e.parentNode;if(!n||n.tagName!=="w:pPr")return;let r=n.parentNode;if(!r)return;let s=M(e,"w:pPr");if(s){let i=s.cloneNode(true);Array.from(i.childNodes).some(l=>l.nodeType===1)?r.replaceChild(i,n):r.removeChild(n);}else r.removeChild(n);}_revert_props_change(e){let n=e.parentNode;if(!n)return;let r=Array.from(e.childNodes).find(i=>i.nodeType===1);n.removeChild(e);let s=Eo[n.tagName];for(let i of Array.from(n.childNodes)){if(i.nodeType!==1)continue;let o=i;o.tagName==="w:rPr"&&(M(o,"w:ins")||M(o,"w:del"))||s?.has(o.tagName)||n.removeChild(i);}if(r)for(let i of Array.from(r.childNodes))i.nodeType===1&&n.appendChild(i.cloneNode(true));}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(e,n="",r=null){let i=this.doc.part._element.ownerDocument.createElement(e),o=r!==null?r:this._getNextId();return i.setAttribute("w:id",o),i.setAttribute("w:author",n||this.author),i.setAttribute("w:date",this.timestamp),i.setAttribute("w16du:dateUtc",this.timestamp),i}_set_text_content(e,n){e.textContent=n,n.trim()!==n&&e.setAttribute("xml:space","preserve");}_comment_anchor_in_main_story(e){let n=e;for(;n.parentNode&&n.parentNode.nodeType===1;)n=n.parentNode;return n.tagName==="w:document"}_skip_comment_outside_main_story(e,n){if(this._comment_anchor_in_main_story(e))return false;let r=e;for(;r.parentNode&&r.parentNode.nodeType===1;)r=r.parentNode;let s={"w:ftr":"footer","w:hdr":"header","w:footnotes":"footnote","w:endnotes":"endnote"}[r.tagName]||"non-body",i=`- Warning: the comment "${n.substring(0,60)}" was NOT attached: Word does not support comments inside a ${s} part, and writing one produces a document other applications cannot open. The tracked change itself was applied.`;return this.skipped_details.push(i),true}_attach_comment(e,n,r,s){if(!s||!e||!n||!r||this._skip_comment_outside_main_story(e,s))return;let i=this.comments_manager.addComment(this.author,s),o=e.ownerDocument,l=o.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let a=o.createElement("w:commentRangeEnd");a.setAttribute("w:id",i);let u=o.createElement("w:r"),c=o.createElement("w:rPr"),d=o.createElement("w:rStyle");d.setAttribute("w:val","CommentReference"),c.appendChild(d),u.appendChild(c);let f=o.createElement("w:commentReference");f.setAttribute("w:id",i),u.appendChild(f),e.insertBefore(l,n);let h=r.nextSibling;h?(e.insertBefore(a,h),e.insertBefore(u,a.nextSibling)):(e.appendChild(a),e.appendChild(u));}_attach_comment_spanning(e,n,r,s,i){if(!i||!e||!r||this._skip_comment_outside_main_story(e,i)||this._skip_comment_outside_main_story(r,i))return;let o=this.comments_manager.addComment(this.author,i),l=e.ownerDocument,a=r.ownerDocument,u=l.createElement("w:commentRangeStart");u.setAttribute("w:id",o);let c=a.createElement("w:commentRangeEnd");c.setAttribute("w:id",o);let d=a.createElement("w:r"),f=a.createElement("w:rPr"),h=a.createElement("w:rStyle");h.setAttribute("w:val","CommentReference"),f.appendChild(h),d.appendChild(f);let p=a.createElement("w:commentReference");p.setAttribute("w:id",o),d.appendChild(p),e.insertBefore(u,n);let _=s.nextSibling;_?(r.insertBefore(c,_),r.insertBefore(d,c.nextSibling)):(r.appendChild(c),r.appendChild(d));}_clone_pPr_scrubbing_headings(e){let n=e.cloneNode(true),r=M(n,"w:pStyle");if(r){let i=r.getAttribute("w:val");i&&(i.startsWith("Heading")||i==="Title"||i.replace(/\s+/g,"").startsWith("Heading"))&&n.removeChild(r);}let s=M(n,"w:outlineLvl");return s&&n.removeChild(s),n}_track_insert_multiline(e,n,r,s,i=null,o=false,l=false){if(!e)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let a=this.doc.part._element.ownerDocument,u=e.split(/[\r\n]+/),c=null;if(r!==null)c=r._element;else if(n!==null){let P=n._element;for(;P&&P.tagName!=="w:p";)P=P.parentNode;c=P;}let d=[],f=new Set(["w:r","w:ins","w:del"]),h=i&&i.parentNode?i:null,p=n!==null&&n._element.parentNode?n._element:null,_=h??p,g=l&&h===null&&p!==null;if(c!==null&&_!==null){let P=_;for(;P&&P.parentNode!==c;)if(P=P.parentNode,P===c){P=null;break}if(P){let R=g?P:P.nextSibling;for(;R;)R.nodeType===1&&f.has(R.tagName)&&d.push(R),R=R.nextSibling;}}else if(c!==null&&l){let P=c.firstChild;for(;P;)P.nodeType===1&&f.has(P.tagName)&&d.push(P),P=P.nextSibling;}for(;u.length>1&&u[u.length-1]===""&&d.length===0;)u.pop();if(u.length===0)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let[w,k]=this._parse_markdown_style(u[0]),m=k!==null&&c!==null,v=null,N=null;m||(N=this._build_tracked_ins_for_line((w===u[0],u[0]),n,s,a,o),v=N);let A=m?u:u.slice(1);if(A.length===0)return {first_node:v,last_p:null,last_ins:N,used_block_mode:false};if(!c)return {first_node:v,last_p:null,last_ins:N,used_block_mode:false};let C=c.parentNode;if(!C)return {first_node:v,last_p:null,last_ins:N,used_block_mode:false};let x=y((P,R)=>{C.insertBefore(P,R.nextSibling);},"insertAfterEl"),E=null,T=null,D=c;for(let P=0;P<A.length;P++){let R=A[P],[$,S]=this._parse_markdown_style(R),j=a.createElement("w:p");if(S)this._set_paragraph_style(j,S);else {let Y=M(c,"w:pPr");Y&&j.appendChild(this._clone_pPr_scrubbing_headings(Y));}let F=M(j,"w:pPr");F||(F=a.createElement("w:pPr"),j.insertBefore(F,j.firstChild));let B=M(F,"w:rPr");B||(B=a.createElement("w:rPr"),F.appendChild(B));let L=this._create_track_change_tag("w:ins","",s);B.appendChild(L);let U=this._build_tracked_ins_for_line($,n,s,a,o);U&&j.appendChild(U),x(j,D),D=j,E=j,T=U,v||(v=j);}if(!m&&E&&d.length>0)for(let P of d)P.parentNode?.removeChild(P),E.appendChild(P);return {first_node:v,last_p:E,last_ins:T,used_block_mode:m}}_build_tracked_ins_for_line(e,n,r,s,i=false){if(!e&&e!=="")return null;let o=this._create_track_change_tag("w:ins","",r),l=this._parse_inline_markdown(e);if(l.length===0)return null;for(let[a,u]of l){let c=s.createElement("w:r");if(n&&n._element){let f=M(n._element,"w:rPr");if(f){let h=f.cloneNode(true),p=["w:vanish","w:strike","w:dstrike","w:i","w:iCs"];i&&p.push("w:b","w:bCs");for(let _ of p){let g=M(h,_);g&&h.removeChild(g);}c.appendChild(h);}}this._apply_run_props(c,u,false);let d=s.createElement("w:t");this._set_text_content(d,a),c.appendChild(d),o.appendChild(c);}return o}_parse_markdown_style(e){let n=e.trimStart();if(n.startsWith("#")){let s=0,i=n;for(;i.startsWith("#");)s++,i=i.substring(1);if(i.startsWith(" "))return [i.trim(),`Heading ${s}`]}if(n.startsWith("* ")||n.startsWith("- "))return [n.substring(2).trim(),"List Paragraph"];let r=n.match(/^1\.\s+/);return r?[n.substring(r[0].length).trim(),"List Number"]:[e,null]}_edit_declares_emphasis(e){for(let n of [e?.target_text,e?.new_text]){if(!n||!n.includes("**")&&!n.includes("_"))continue;if(this._parse_inline_markdown(n).some(([,s])=>s&&Object.keys(s).length>0))return true}return false}_parse_inline_markdown(e,n={}){if(!e)return [];let r=/(\*\*.*?\*\*)|(_.*?_)/,s=e.match(r);if(!s)return [[e,n]];let i=s.index,o=s[0],l=i+o.length,a=o.startsWith("**"),u=a?o.substring(2,o.length-2):o.substring(1,o.length-1),c=e.substring(0,i),d=e.substring(l),f=[];c&&f.push([c,n]);let h={...n};return a?h.bold=true:h.italic=true,f.push(...this._parse_inline_markdown(u,h)),f.push(...this._parse_inline_markdown(d,n)),f}_apply_run_props(e,n,r=false){if(!n){if(!r)return;n={};}let s=M(e,"w:rPr");if(!s&&(n.bold||n.italic||r)&&(s=e.ownerDocument.createElement("w:rPr"),e.appendChild(s)),s){let i=e.ownerDocument;if(n.bold){let o=M(s,"w:b");o||(o=i.createElement("w:b"),s.appendChild(o)),o.setAttribute("w:val","1");}else if(r){let o=M(s,"w:b");o&&s.removeChild(o);}if(n.italic){let o=M(s,"w:i");o||(o=i.createElement("w:i"),s.appendChild(o)),o.setAttribute("w:val","1");}else if(r){let o=M(s,"w:i");o&&s.removeChild(o);}}}_set_paragraph_style(e,n,r=null){let s=e.ownerDocument,i=M(e,"w:pPr");i&&e.removeChild(i);let o=s.createElement("w:pPr"),l=s.createElement("w:pStyle"),a=n.replace(/\s+/g,"");if(l.setAttribute("w:val",a),o.appendChild(l),a==="ListParagraph"){let u=this._ensure_bullet_num_id();if(u){let c=s.createElement("w:numPr"),d=s.createElement("w:ilvl");d.setAttribute("w:val","0");let f=s.createElement("w:numId");f.setAttribute("w:val",u),c.appendChild(d),c.appendChild(f),o.appendChild(c);}}if(r!==null){let u=this._create_track_change_tag("w:pPrChange","",r),c=i?i.cloneNode(true):s.createElement("w:pPr"),d=M(c,"w:pPrChange");d&&c.removeChild(d),u.appendChild(c),o.appendChild(u);}e.insertBefore(o,e.firstChild);}static _NUMBERING_CT="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";static _NUMBERING_RT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";_ensure_bullet_num_id(){let e=this.doc.pkg,n="http://schemas.openxmlformats.org/wordprocessingml/2006/main",r='<w:lvl w:ilvl="0"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="\uF0B7"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="720" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/></w:rPr></w:lvl>',s=e.parts.find(E=>String(E.partname).replace(/^\//,"")==="word/numbering.xml");if(!s){let E=`<w:numbering xmlns:w="${n}"><w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="singleLevel"/>`+r+'</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num></w:numbering>';try{s=e.addPart("/word/numbering.xml",V._NUMBERING_CT,E),this.doc.relateTo(s,V._NUMBERING_RT);}catch{return null}return delete e._adeu_numbering_cache,"1"}let i=s._element,o=I(i,"w:abstractNum"),l=I(i,"w:num"),a=null;for(let E of o){let T=E.getAttribute("w:abstractNumId");if(T!==null){for(let D of I(E,"w:lvl")){if((D.getAttribute("w:ilvl")||"0")!=="0")continue;let P=M(D,"w:numFmt");P&&P.getAttribute("w:val")==="bullet"&&(a=T);break}if(a!==null)break}}let u=0;for(let E of l){let T=parseInt(E.getAttribute("w:numId")||"0",10);!isNaN(T)&&T>u&&(u=T);}let c=i.ownerDocument;if(a!==null){for(let D of l){let P=M(D,"w:abstractNumId");if(P&&P.getAttribute("w:val")===a){let R=D.getAttribute("w:numId");if(R&&R!=="0")return R}}let E=c.createElement("w:num");E.setAttribute("w:numId",String(u+1));let T=c.createElement("w:abstractNumId");return T.setAttribute("w:val",a),E.appendChild(T),i.appendChild(E),delete e._adeu_numbering_cache,String(u+1)}let d=-1;for(let E of o){let T=parseInt(E.getAttribute("w:abstractNumId")||"-1",10);!isNaN(T)&&T>d&&(d=T);}let f=c.createElement("w:abstractNum");f.setAttribute("w:abstractNumId",String(d+1));let h=c.createElement("w:multiLevelType");h.setAttribute("w:val","singleLevel"),f.appendChild(h);let p=c.createElement("w:lvl");p.setAttribute("w:ilvl","0");let _=c.createElement("w:start");_.setAttribute("w:val","1"),p.appendChild(_);let g=c.createElement("w:numFmt");g.setAttribute("w:val","bullet"),p.appendChild(g);let w=c.createElement("w:lvlText");w.setAttribute("w:val","\uF0B7"),p.appendChild(w);let k=c.createElement("w:lvlJc");k.setAttribute("w:val","left"),p.appendChild(k);let b=c.createElement("w:pPr"),m=c.createElement("w:ind");m.setAttribute("w:left","720"),m.setAttribute("w:hanging","360"),b.appendChild(m),p.appendChild(b);let v=c.createElement("w:rPr"),N=c.createElement("w:rFonts");N.setAttribute("w:ascii","Symbol"),N.setAttribute("w:hAnsi","Symbol"),N.setAttribute("w:hint","default"),v.appendChild(N),p.appendChild(v),f.appendChild(p);let A=l.find(E=>E.parentNode===i)||null;A?i.insertBefore(f,A):i.appendChild(f);let C=c.createElement("w:num");C.setAttribute("w:numId",String(u+1));let x=c.createElement("w:abstractNumId");return x.setAttribute("w:val",String(d+1)),C.appendChild(x),i.appendChild(C),delete e._adeu_numbering_cache,String(u+1)}_anchor_reply_comment(e,n){let r=this.doc.part._element.ownerDocument,s=I(this.doc.element,"w:commentRangeStart").filter(g=>g.getAttribute("w:id")===e);if(s.length===0)return;let i=s[0],o=r.createElement("w:commentRangeStart");o.setAttribute("w:id",n),Le(o,i);let l=I(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===e);if(l.length===0)return;let a=l[0],u=I(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===e),c=a;if(u.length>0){let g=u[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(c=g.parentNode);}let d=r.createElement("w:commentRangeEnd");d.setAttribute("w:id",n),Le(d,c);let f=r.createElement("w:r"),h=r.createElement("w:rPr"),p=r.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),h.appendChild(p),f.appendChild(h);let _=r.createElement("w:commentReference");_.setAttribute("w:id",n),f.appendChild(_),Le(f,d);}_clean_wrapping_comments(e){let n=0,r=e;for(;;){let c=Ee(r);if(c&&(c.tagName==="w:ins"||c.tagName==="w:del"))r=c;else break}let s=e;for(;;){let c=ve(s);if(c&&(c.tagName==="w:ins"||c.tagName==="w:del"))s=c;else break}let i=[],o=Ee(r);for(;o;)if(o.tagName==="w:commentRangeStart")i.push(o),o=Ee(o);else if(o.tagName==="w:rPr"||o.tagName==="w:pPr")o=Ee(o);else break;let l=[],a=ve(s);for(;a;)if(a.tagName==="w:commentRangeEnd")l.push(a),a=ve(a);else if(a.tagName==="w:r"&&I(a,"w:commentReference").length>0)l.push(a),a=ve(a);else if(a.tagName==="w:commentReference")l.push(a),a=ve(a);else break;let u=new Set;for(let c of l)if(c.tagName==="w:commentRangeEnd"){let d=c.getAttribute("w:id");d&&u.add(d);}else {let d=I(c,"w:commentReference")[0];if(!d&&c.tagName==="w:commentReference"&&(d=c),d){let f=d.getAttribute("w:id");f&&u.add(f);}}for(let c of i){let d=c.getAttribute("w:id");if(d&&u.has(d)){this.comments_manager.deleteComment(d),n++,c.parentNode&&c.parentNode.removeChild(c);for(let f of l){let h=null;if(f.tagName==="w:commentRangeEnd")h=f.getAttribute("w:id");else {let p=I(f,"w:commentReference")[0];!p&&f.tagName==="w:commentReference"&&(p=f),p&&(h=p.getAttribute("w:id"));}h===d&&f.parentNode&&f.parentNode.removeChild(f);}}}return n}_delete_comments_in_element(e){let n=0,r=I(e,"w:commentReference");for(let s of r){let i=s.getAttribute("w:id");if(i){this.comments_manager.deleteComment(i),n++;for(let o of ["w:commentRangeStart","w:commentRangeEnd"]){let l=I(this.doc.element,o);for(let a of l)a.getAttribute("w:id")===i&&a.parentNode&&a.parentNode.removeChild(a);}}}return n}validate_edits(e,n=0){let r=[];this.mapper.full_text||this.mapper._build_map(),r.push(...Co(e,n));for(let s=0;s<e.length;s++){let i=e[s];if(typeof i!="object"||i===null){r.push(`- Edit ${s+1+n} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof i}. Do not pass raw strings.`);continue}if(i._match_start_index!==void 0&&i._match_start_index!==null||i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)continue;if(i.target_text===void 0||i.target_text===null||!String(i.target_text).trim()){i.type==="insert_row"?r.push(`- Edit ${s+1+n} Failed: insert_row requires target_text (text inside an existing row to anchor on) and cells (the new row's cell values).`):i.type==="delete_row"?r.push(`- Edit ${s+1+n} Failed: delete_row requires target_text (text inside the row to delete).`):r.push(`- Edit ${s+1+n} Failed: target_text is empty. Pure insertions are expressed as a replacement: put the text immediately around the insertion point in target_text and repeat it (plus the new text) in new_text.`);continue}if(i.type==="modify"&&(i.new_text===void 0||i.new_text===null))if(i.comment&&String(i.comment).trim())i.new_text=i.target_text;else {r.push(`- Edit ${s+1+n} Failed: modify requires new_text (an empty string deletes the target; to attach a comment without changing the text, supply the comment and omit new_text).`);continue}let o=i.regex||false,l=i.match_mode||"strict";if(o)try{new RegExp(i.target_text);}catch(h){r.push(`- Edit ${s+1+n} Failed: target_text is not a valid regular expression (${h?.message??h}). Fix the pattern, or set "regex": false to match the text literally.`);continue}let a=this.mapper.drop_virtual_only_matches(this.mapper.find_all_match_indices(i.target_text,o)),u=this.mapper.full_text,c=this.mapper;a.length===0&&(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),a=this.clean_mapper.drop_virtual_only_matches(this.clean_mapper.find_all_match_indices(i.target_text,o)),a.length>0&&(u=this.clean_mapper.full_text,c=this.clean_mapper)),u===this.mapper.full_text&&a.length>0&&(a=a.filter(([p,_])=>{let g=this.mapper.spans.filter(w=>w.run!==null&&w.end>p&&w.start<p+_);return g.length===0?true:g.some(w=>!w.del_id)}));let d=false,f=new Set;if(a.length===0){this.original_mapper||(this.original_mapper=new ke(this.doc,false,true));let h=this.original_mapper.drop_virtual_only_matches(this.original_mapper.find_all_match_indices(i.target_text,o));if(h.length>0){d=true;for(let[p,_]of h){let g=this.original_mapper.spans.filter(w=>w.end>p&&w.start<p+_);for(let w of g)if(w.run!==null){let k=w.run._element;for(;k;){if(k.nodeType===1&&k.tagName==="w:del"){let b=k.getAttribute("w:author");b&&f.add(b);break}k=k.parentNode;}}}}}if(a.length===0)if(d){let h=f.size>0?`by ${Array.from(f).sort().join(", ")}`:"by an existing revision";r.push(`- Edit ${s+1+n} Failed: Target text matches text inside a tracked deletion ${h}. Reject/accept that change first or target the active replacement text instead.`);}else {let h=this._nearest_match_hint(i.target_text,o);r.push(`- Edit ${s+1+n} Failed: Target text not found in document:
98
+ `),l=[],a=999;for(let u=o.length-1;u>=0;u--){let d=o[u].match(/^(#{1,6})\s+(.*)/);if(d){let f=d[1].length;if(f<a){let h=d[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(h.length>80&&(h=h.substring(0,80)+"..."),l.unshift(h),a=f,f===1)break}}}return [l.join(" > "),s]}accept_all_revisions(){let e=[this.doc.element];for(let a of this.doc.pkg.parts)a!==this.doc.part&&a.contentType.includes("wordprocessingml")&&a.contentType.endsWith("+xml")&&e.push(a._element);let n=0,r=0,s=0;for(let a of e){n+=I(a,"w:ins").length,r+=I(a,"w:del").length;for(let u of ["w:rPrChange","w:pPrChange","w:sectPrChange"])s+=I(a,u).length;}let i=this._existing_comment_ids().length;for(let a of e){let u=I(a,"w:ins");for(let f of u){this._clean_wrapping_comments(f);let h=f.parentNode;if(h){if(h.tagName==="w:trPr"){h.removeChild(f);continue}for(;f.firstChild;)h.insertBefore(f.firstChild,f);h.removeChild(f);}}let c=I(a,"w:p");for(let f of c){let h=M(f,"w:pPr");if(h){let p=M(h,"w:rPr"),_=p?M(p,"w:del"):null;if(p&&_){let g=false;for(let w of ["w:t","w:tab","w:br"]){for(let k of I(f,w)){if(w==="w:t"&&!k.textContent)continue;let b=false,m=k.parentNode;for(;m&&m!==f;){if(m.tagName==="w:del"){b=true;break}m=m.parentNode;}if(!b){g=true;break}}if(g)break}g||this._is_last_paragraph_in_cell(f)?p.removeChild(_):(this._clean_wrapping_comments(f),this._delete_comments_in_element(f),f.parentNode&&f.parentNode.removeChild(f));}}}let d=I(a,"w:del");for(let f of d){this._clean_wrapping_comments(f),this._delete_comments_in_element(f);let h=f.parentNode;if(h)if(h.tagName==="w:trPr"){let p=h.parentNode;p&&p.parentNode&&p.parentNode.removeChild(p);}else h.removeChild(f);}for(let f of I(a,"w:pPrChange"))f.parentNode?.removeChild(f);}for(let a of e){for(let c of ["w:commentRangeStart","w:commentRangeEnd"])for(let d of I(a,c))d.parentNode?.removeChild(d);let u=I(a,"w:commentReference");for(let c of u){let d=c.parentNode;d&&((d.tagName==="w:r"||d.tagName.endsWith(":r"))&&Array.from(d.childNodes).filter(h=>h.nodeType===1&&h.tagName!=="w:rPr"&&h.tagName!=="rPr").length<=1?d.parentNode?.removeChild(d):d.removeChild(c));}}let o=this.doc.pkg,l=new Set;for(let a of o.parts)if(a.partname.toLowerCase().includes("comments")){l.add(a.partname);let u=a.partname.startsWith("/")?a.partname:"/"+a.partname,c=a.partname.startsWith("/")?a.partname.substring(1):a.partname;l.add(u),l.add(c);}if(l.size>0){for(let u of o.parts)if(u.partname.endsWith(".rels")){let c=I(u._element,"Relationship"),d=[];for(let f of c)if((f.getAttribute("Target")||"").toLowerCase().includes("comments")){d.push(f);let p=u.partname.replace("/_rels/","/").replace(".rels",""),_=o.getPartByPath(p);if(_){let g=f.getAttribute("Id");g&&_.rels.delete(g);}}for(let f of d)f.parentNode?.removeChild(f);}let a=o.getPartByPath("[Content_Types].xml");if(a){let u=I(a._element,"Override"),c=[];for(let d of u){let f=d.getAttribute("PartName")||"";(l.has(f)||f.toLowerCase().includes("comments"))&&c.push(d);}for(let d of c)d.parentNode?.removeChild(d);}o.parts=o.parts.filter(u=>!u.partname.toLowerCase().includes("comments"));for(let u of Object.keys(o.unzipped))u.toLowerCase().includes("comments")&&delete o.unzipped[u];}return {accepted_insertions:n,accepted_deletions:r,accepted_formatting:s,removed_comments:i}}reject_all_revisions(){let e=[this.doc.element];for(let n of this.doc.pkg.parts)n!==this.doc.part&&n.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml")&&e.push(n._element);for(let n of e){for(let o of I(n,"w:pPrChange"))this._revert_ppr_change(o);let r=I(n,"w:ins");for(let o of r){let l=o.parentNode;if(l)if(this._clean_wrapping_comments(o),this._delete_comments_in_element(o),l.tagName==="w:trPr"){let a=l.parentNode;a&&a.parentNode&&a.parentNode.removeChild(a);}else l.removeChild(o);}let s=I(n,"w:p");for(let o of s){let l=M(o,"w:pPr");if(l){let a=M(l,"w:rPr"),u=a?M(a,"w:del"):null;a&&u&&a.removeChild(u);}}let i=I(n,"w:del");for(let o of i){let l=o.parentNode;if(!l)continue;if(l.tagName==="w:trPr"){l.removeChild(o);continue}let a=Array.from(o.getElementsByTagName("w:delText"));for(let u of a){let c=o.ownerDocument.createElement("w:t");c.textContent=u.textContent,u.hasAttribute("xml:space")&&c.setAttribute("xml:space","preserve"),u.parentNode?.replaceChild(c,u);}for(;o.firstChild;)l.insertBefore(o.firstChild,o);l.removeChild(o);}}}_revert_ppr_change(e){let n=e.parentNode;if(!n||n.tagName!=="w:pPr")return;let r=n.parentNode;if(!r)return;let s=M(e,"w:pPr");if(s){let i=s.cloneNode(true);Array.from(i.childNodes).some(l=>l.nodeType===1)?r.replaceChild(i,n):r.removeChild(n);}else r.removeChild(n);}_revert_props_change(e){let n=e.parentNode;if(!n)return;let r=Array.from(e.childNodes).find(i=>i.nodeType===1);n.removeChild(e);let s=Eo[n.tagName];for(let i of Array.from(n.childNodes)){if(i.nodeType!==1)continue;let o=i;o.tagName==="w:rPr"&&(M(o,"w:ins")||M(o,"w:del"))||s?.has(o.tagName)||n.removeChild(i);}if(r)for(let i of Array.from(r.childNodes))i.nodeType===1&&n.appendChild(i.cloneNode(true));}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(e,n="",r=null){let i=this.doc.part._element.ownerDocument.createElement(e),o=r!==null?r:this._getNextId();return i.setAttribute("w:id",o),i.setAttribute("w:author",n||this.author),i.setAttribute("w:date",this.timestamp),i.setAttribute("w16du:dateUtc",this.timestamp),i}_set_text_content(e,n){e.textContent=n,n.trim()!==n&&e.setAttribute("xml:space","preserve");}_comment_anchor_in_main_story(e){let n=e;for(;n.parentNode&&n.parentNode.nodeType===1;)n=n.parentNode;return n.tagName==="w:document"}_skip_comment_outside_main_story(e,n){if(this._comment_anchor_in_main_story(e))return false;let r=e;for(;r.parentNode&&r.parentNode.nodeType===1;)r=r.parentNode;let s={"w:ftr":"footer","w:hdr":"header","w:footnotes":"footnote","w:endnotes":"endnote"}[r.tagName]||"non-body",i=`- Warning: the comment "${n.substring(0,60)}" was NOT attached: Word does not support comments inside a ${s} part, and writing one produces a document other applications cannot open. The tracked change itself was applied.`;return this.skipped_details.push(i),true}_attach_comment(e,n,r,s){if(!s||!e||!n||!r||this._skip_comment_outside_main_story(e,s))return;let i=this.comments_manager.addComment(this.author,s),o=e.ownerDocument,l=o.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let a=o.createElement("w:commentRangeEnd");a.setAttribute("w:id",i);let u=o.createElement("w:r"),c=o.createElement("w:rPr"),d=o.createElement("w:rStyle");d.setAttribute("w:val","CommentReference"),c.appendChild(d),u.appendChild(c);let f=o.createElement("w:commentReference");f.setAttribute("w:id",i),u.appendChild(f),e.insertBefore(l,n);let h=r.nextSibling;h?(e.insertBefore(a,h),e.insertBefore(u,a.nextSibling)):(e.appendChild(a),e.appendChild(u));}_attach_comment_spanning(e,n,r,s,i){if(!i||!e||!r||this._skip_comment_outside_main_story(e,i)||this._skip_comment_outside_main_story(r,i))return;let o=this.comments_manager.addComment(this.author,i),l=e.ownerDocument,a=r.ownerDocument,u=l.createElement("w:commentRangeStart");u.setAttribute("w:id",o);let c=a.createElement("w:commentRangeEnd");c.setAttribute("w:id",o);let d=a.createElement("w:r"),f=a.createElement("w:rPr"),h=a.createElement("w:rStyle");h.setAttribute("w:val","CommentReference"),f.appendChild(h),d.appendChild(f);let p=a.createElement("w:commentReference");p.setAttribute("w:id",o),d.appendChild(p),e.insertBefore(u,n);let _=s.nextSibling;_?(r.insertBefore(c,_),r.insertBefore(d,c.nextSibling)):(r.appendChild(c),r.appendChild(d));}_clone_pPr_scrubbing_headings(e){let n=e.cloneNode(true),r=M(n,"w:pStyle");if(r){let i=r.getAttribute("w:val");i&&(i.startsWith("Heading")||i==="Title"||i.replace(/\s+/g,"").startsWith("Heading"))&&n.removeChild(r);}let s=M(n,"w:outlineLvl");return s&&n.removeChild(s),n}_track_insert_multiline(e,n,r,s,i=null,o=false,l=false){if(!e)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let a=this.doc.part._element.ownerDocument,u=e.split(/[\r\n]+/),c=null;if(r!==null)c=r._element;else if(n!==null){let P=n._element;for(;P&&P.tagName!=="w:p";)P=P.parentNode;c=P;}let d=[],f=new Set(["w:r","w:ins","w:del"]),h=i&&i.parentNode?i:null,p=n!==null&&n._element.parentNode?n._element:null,_=h??p,g=l&&h===null&&p!==null;if(c!==null&&_!==null){let P=_;for(;P&&P.parentNode!==c;)if(P=P.parentNode,P===c){P=null;break}if(P){let R=g?P:P.nextSibling;for(;R;)R.nodeType===1&&f.has(R.tagName)&&d.push(R),R=R.nextSibling;}}else if(c!==null&&l){let P=c.firstChild;for(;P;)P.nodeType===1&&f.has(P.tagName)&&d.push(P),P=P.nextSibling;}for(;u.length>1&&u[u.length-1]===""&&d.length===0;)u.pop();if(u.length===0)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let[w,k]=this._parse_markdown_style(u[0]),m=k!==null&&c!==null,v=null,N=null;m||(N=this._build_tracked_ins_for_line((w===u[0],u[0]),n,s,a,o),v=N);let A=m?u:u.slice(1);if(A.length===0)return {first_node:v,last_p:null,last_ins:N,used_block_mode:false};if(!c)return {first_node:v,last_p:null,last_ins:N,used_block_mode:false};let C=c.parentNode;if(!C)return {first_node:v,last_p:null,last_ins:N,used_block_mode:false};let x=y((P,R)=>{C.insertBefore(P,R.nextSibling);},"insertAfterEl"),E=null,T=null,D=c;for(let P=0;P<A.length;P++){let R=A[P],[$,S]=this._parse_markdown_style(R),j=a.createElement("w:p");if(S)this._set_paragraph_style(j,S);else {let Y=M(c,"w:pPr");Y&&j.appendChild(this._clone_pPr_scrubbing_headings(Y));}let F=M(j,"w:pPr");F||(F=a.createElement("w:pPr"),j.insertBefore(F,j.firstChild));let B=M(F,"w:rPr");B||(B=a.createElement("w:rPr"),F.appendChild(B));let L=this._create_track_change_tag("w:ins","",s);B.appendChild(L);let U=this._build_tracked_ins_for_line($,n,s,a,o);U&&j.appendChild(U),x(j,D),D=j,E=j,T=U,v||(v=j);}if(!m&&E&&d.length>0)for(let P of d)P.parentNode?.removeChild(P),E.appendChild(P);return {first_node:v,last_p:E,last_ins:T,used_block_mode:m}}_build_tracked_ins_for_line(e,n,r,s,i=false){if(!e&&e!=="")return null;let o=this._create_track_change_tag("w:ins","",r),l=this._parse_inline_markdown(e);if(l.length===0)return null;for(let[a,u]of l){let c=s.createElement("w:r");if(n&&n._element){let f=M(n._element,"w:rPr");if(f){let h=f.cloneNode(true),p=["w:vanish","w:strike","w:dstrike","w:i","w:iCs"];i&&p.push("w:b","w:bCs");for(let _ of p){let g=M(h,_);g&&h.removeChild(g);}c.appendChild(h);}}this._apply_run_props(c,u,false);let d=s.createElement("w:t");this._set_text_content(d,a),c.appendChild(d),o.appendChild(c);}return o}_parse_markdown_style(e){let n=e.trimStart();if(n.startsWith("#")){let s=0,i=n;for(;i.startsWith("#");)s++,i=i.substring(1);if(i.startsWith(" "))return [i.trim(),`Heading ${s}`]}if(n.startsWith("* ")||n.startsWith("- "))return [n.substring(2).trim(),"List Paragraph"];let r=n.match(/^1\.\s+/);return r?[n.substring(r[0].length).trim(),"List Number"]:[e,null]}_edit_declares_emphasis(e){for(let n of [e?.target_text,e?.new_text]){if(!n||!n.includes("**")&&!n.includes("_"))continue;if(this._parse_inline_markdown(n).some(([,s])=>s&&Object.keys(s).length>0))return true}return false}_parse_inline_markdown(e,n={}){if(!e)return [];let r=/(\*\*.*?\*\*)|(_.*?_)/,s=e.match(r);if(!s)return [[e,n]];let i=s.index,o=s[0],l=i+o.length,a=o.startsWith("**"),u=a?o.substring(2,o.length-2):o.substring(1,o.length-1),c=e.substring(0,i),d=e.substring(l),f=[];c&&f.push([c,n]);let h={...n};return a?h.bold=true:h.italic=true,f.push(...this._parse_inline_markdown(u,h)),f.push(...this._parse_inline_markdown(d,n)),f}_apply_run_props(e,n,r=false){if(!n){if(!r)return;n={};}let s=M(e,"w:rPr");if(!s&&(n.bold||n.italic||r)&&(s=e.ownerDocument.createElement("w:rPr"),e.appendChild(s)),s){let i=e.ownerDocument;if(n.bold){let o=M(s,"w:b");o||(o=i.createElement("w:b"),s.appendChild(o)),o.setAttribute("w:val","1");}else if(r){let o=M(s,"w:b");o&&s.removeChild(o);}if(n.italic){let o=M(s,"w:i");o||(o=i.createElement("w:i"),s.appendChild(o)),o.setAttribute("w:val","1");}else if(r){let o=M(s,"w:i");o&&s.removeChild(o);}}}_set_paragraph_style(e,n,r=null){let s=e.ownerDocument,i=M(e,"w:pPr");i&&e.removeChild(i);let o=s.createElement("w:pPr"),l=s.createElement("w:pStyle"),a=n.replace(/\s+/g,"");if(l.setAttribute("w:val",a),o.appendChild(l),a==="ListParagraph"){let u=this._ensure_bullet_num_id();if(u){let c=s.createElement("w:numPr"),d=s.createElement("w:ilvl");d.setAttribute("w:val","0");let f=s.createElement("w:numId");f.setAttribute("w:val",u),c.appendChild(d),c.appendChild(f),o.appendChild(c);}}if(r!==null){let u=this._create_track_change_tag("w:pPrChange","",r),c=i?i.cloneNode(true):s.createElement("w:pPr"),d=M(c,"w:pPrChange");d&&c.removeChild(d),u.appendChild(c),o.appendChild(u);}e.insertBefore(o,e.firstChild);}static _NUMBERING_CT="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";static _NUMBERING_RT="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";_ensure_bullet_num_id(){let e=this.doc.pkg,n="http://schemas.openxmlformats.org/wordprocessingml/2006/main",r='<w:lvl w:ilvl="0"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="\uF0B7"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="720" w:hanging="360"/></w:pPr><w:rPr><w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/></w:rPr></w:lvl>',s=e.parts.find(E=>String(E.partname).replace(/^\//,"")==="word/numbering.xml");if(!s){let E=`<w:numbering xmlns:w="${n}"><w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="singleLevel"/>`+r+'</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num></w:numbering>';try{s=e.addPart("/word/numbering.xml",V._NUMBERING_CT,E),this.doc.relateTo(s,V._NUMBERING_RT);}catch{return null}return delete e._adeu_numbering_cache,"1"}let i=s._element,o=I(i,"w:abstractNum"),l=I(i,"w:num"),a=null;for(let E of o){let T=E.getAttribute("w:abstractNumId");if(T!==null){for(let D of I(E,"w:lvl")){if((D.getAttribute("w:ilvl")||"0")!=="0")continue;let P=M(D,"w:numFmt");P&&P.getAttribute("w:val")==="bullet"&&(a=T);break}if(a!==null)break}}let u=0;for(let E of l){let T=parseInt(E.getAttribute("w:numId")||"0",10);!isNaN(T)&&T>u&&(u=T);}let c=i.ownerDocument;if(a!==null){for(let D of l){let P=M(D,"w:abstractNumId");if(P&&P.getAttribute("w:val")===a){let R=D.getAttribute("w:numId");if(R&&R!=="0")return R}}let E=c.createElement("w:num");E.setAttribute("w:numId",String(u+1));let T=c.createElement("w:abstractNumId");return T.setAttribute("w:val",a),E.appendChild(T),i.appendChild(E),delete e._adeu_numbering_cache,String(u+1)}let d=-1;for(let E of o){let T=parseInt(E.getAttribute("w:abstractNumId")||"-1",10);!isNaN(T)&&T>d&&(d=T);}let f=c.createElement("w:abstractNum");f.setAttribute("w:abstractNumId",String(d+1));let h=c.createElement("w:multiLevelType");h.setAttribute("w:val","singleLevel"),f.appendChild(h);let p=c.createElement("w:lvl");p.setAttribute("w:ilvl","0");let _=c.createElement("w:start");_.setAttribute("w:val","1"),p.appendChild(_);let g=c.createElement("w:numFmt");g.setAttribute("w:val","bullet"),p.appendChild(g);let w=c.createElement("w:lvlText");w.setAttribute("w:val","\uF0B7"),p.appendChild(w);let k=c.createElement("w:lvlJc");k.setAttribute("w:val","left"),p.appendChild(k);let b=c.createElement("w:pPr"),m=c.createElement("w:ind");m.setAttribute("w:left","720"),m.setAttribute("w:hanging","360"),b.appendChild(m),p.appendChild(b);let v=c.createElement("w:rPr"),N=c.createElement("w:rFonts");N.setAttribute("w:ascii","Symbol"),N.setAttribute("w:hAnsi","Symbol"),N.setAttribute("w:hint","default"),v.appendChild(N),p.appendChild(v),f.appendChild(p);let A=l.find(E=>E.parentNode===i)||null;A?i.insertBefore(f,A):i.appendChild(f);let C=c.createElement("w:num");C.setAttribute("w:numId",String(u+1));let x=c.createElement("w:abstractNumId");return x.setAttribute("w:val",String(d+1)),C.appendChild(x),i.appendChild(C),delete e._adeu_numbering_cache,String(u+1)}_anchor_reply_comment(e,n){let r=this.doc.part._element.ownerDocument,s=I(this.doc.element,"w:commentRangeStart").filter(g=>g.getAttribute("w:id")===e);if(s.length===0)return;let i=s[0],o=r.createElement("w:commentRangeStart");o.setAttribute("w:id",n),Le(o,i);let l=I(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===e);if(l.length===0)return;let a=l[0],u=I(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===e),c=a;if(u.length>0){let g=u[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(c=g.parentNode);}let d=r.createElement("w:commentRangeEnd");d.setAttribute("w:id",n),Le(d,c);let f=r.createElement("w:r"),h=r.createElement("w:rPr"),p=r.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),h.appendChild(p),f.appendChild(h);let _=r.createElement("w:commentReference");_.setAttribute("w:id",n),f.appendChild(_),Le(f,d);}_clean_wrapping_comments(e){let n=0,r=e;for(;;){let c=Ee(r);if(c&&(c.tagName==="w:ins"||c.tagName==="w:del"))r=c;else break}let s=e;for(;;){let c=ve(s);if(c&&(c.tagName==="w:ins"||c.tagName==="w:del"))s=c;else break}let i=[],o=Ee(r);for(;o;)if(o.tagName==="w:commentRangeStart")i.push(o),o=Ee(o);else if(o.tagName==="w:rPr"||o.tagName==="w:pPr")o=Ee(o);else break;let l=[],a=ve(s);for(;a;)if(a.tagName==="w:commentRangeEnd")l.push(a),a=ve(a);else if(a.tagName==="w:r"&&I(a,"w:commentReference").length>0)l.push(a),a=ve(a);else if(a.tagName==="w:commentReference")l.push(a),a=ve(a);else break;let u=new Set;for(let c of l)if(c.tagName==="w:commentRangeEnd"){let d=c.getAttribute("w:id");d&&u.add(d);}else {let d=I(c,"w:commentReference")[0];if(!d&&c.tagName==="w:commentReference"&&(d=c),d){let f=d.getAttribute("w:id");f&&u.add(f);}}for(let c of i){let d=c.getAttribute("w:id");if(d&&u.has(d)){this.comments_manager.deleteComment(d),n++,c.parentNode&&c.parentNode.removeChild(c);for(let f of l){let h=null;if(f.tagName==="w:commentRangeEnd")h=f.getAttribute("w:id");else {let p=I(f,"w:commentReference")[0];!p&&f.tagName==="w:commentReference"&&(p=f),p&&(h=p.getAttribute("w:id"));}h===d&&f.parentNode&&f.parentNode.removeChild(f);}}}return n}_delete_comments_in_element(e){let n=0,r=I(e,"w:commentReference");for(let s of r){let i=s.getAttribute("w:id");if(i){this.comments_manager.deleteComment(i),n++;for(let o of ["w:commentRangeStart","w:commentRangeEnd"]){let l=I(this.doc.element,o);for(let a of l)a.getAttribute("w:id")===i&&a.parentNode&&a.parentNode.removeChild(a);}}}return n}validate_edits(e,n=0){let r=[];this.mapper.full_text||this.mapper._build_map(),r.push(...Co(e,n));for(let s=0;s<e.length;s++){let i=e[s];if(typeof i!="object"||i===null){r.push(`- Edit ${s+1+n} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof i}. Do not pass raw strings.`);continue}if(i._match_start_index!==void 0&&i._match_start_index!==null||i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)continue;if(i.target_text===void 0||i.target_text===null||!String(i.target_text).trim()){i.type==="insert_row"?r.push(`- Edit ${s+1+n} Failed: insert_row requires target_text (text inside an existing row to anchor on) and cells (the new row's cell values).`):i.type==="delete_row"?r.push(`- Edit ${s+1+n} Failed: delete_row requires target_text (text inside the row to delete).`):r.push(`- Edit ${s+1+n} Failed: target_text is empty. Pure insertions are expressed as a replacement: put the text immediately around the insertion point in target_text and repeat it (plus the new text) in new_text.`);continue}if(i.type==="modify"&&(i.new_text===void 0||i.new_text===null))if(i.comment&&String(i.comment).trim())i.new_text=i.target_text;else {r.push(`- Edit ${s+1+n} Failed: modify requires new_text (an empty string deletes the target; to attach a comment without changing the text, supply the comment and omit new_text).`);continue}let o=i.regex||false,l=i.match_mode||"strict";if(o)try{new RegExp(i.target_text);}catch(h){r.push(`- Edit ${s+1+n} Failed: target_text is not a valid regular expression (${h?.message??h}). Fix the pattern, or set "regex": false to match the text literally.`);continue}let a=this.mapper.drop_virtual_only_matches(this.mapper.find_all_match_indices(i.target_text,o)),u=this.mapper.full_text,c=this.mapper;a.length===0&&(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),a=this.clean_mapper.drop_virtual_only_matches(this.clean_mapper.find_all_match_indices(i.target_text,o)),a.length>0&&(u=this.clean_mapper.full_text,c=this.clean_mapper)),u===this.mapper.full_text&&a.length>0&&(a=a.filter(([p,_])=>{let g=this.mapper.spans.filter(w=>w.run!==null&&w.end>p&&w.start<p+_);return g.length===0?true:g.some(w=>!w.del_id)}));let d=false,f=new Set;if(a.length===0){this.original_mapper||(this.original_mapper=new ke(this.doc,false,true));let h=this.original_mapper.drop_virtual_only_matches(this.original_mapper.find_all_match_indices(i.target_text,o));if(h.length>0){d=true;for(let[p,_]of h){let g=this.original_mapper.spans.filter(w=>w.end>p&&w.start<p+_);for(let w of g)if(w.run!==null){let k=w.run._element;for(;k;){if(k.nodeType===1&&k.tagName==="w:del"){let b=k.getAttribute("w:author");b&&f.add(b);break}k=k.parentNode;}}}}}if(a.length===0)if(d){let h=f.size>0?`by ${Array.from(f).sort().join(", ")}`:"by an existing revision";r.push(`- Edit ${s+1+n} Failed: Target text matches text inside a tracked deletion ${h}. Reject/accept that change first or target the active replacement text instead.`);}else {let h=this._nearest_match_hint(i.target_text,o);r.push(`- Edit ${s+1+n} Failed: Target text not found in document:
99
99
  "${he(i.target_text,Lt)}"${h}`);}else if(a.length>1&&l==="strict")if(i.target_text.includes("|"))a=a.slice(0,1);else {let h=a.map(([p,_])=>[p,p+_]);r.push(vo(s+1+n,i.target_text,u,h));}if(a.length===1){let[h,p]=a[0],_=u.substring(h,h+p),[g,w]=Ue(_,i.new_text||""),k=_.length-w,b=_.substring(g,k),m=(i.new_text||"").substring(g,(i.new_text||"").length-w),N=c.part_ranges.filter(x=>x[1]>x[0]).length>1?Array.from(new Set(c.spans.filter(x=>x.run!==null&&x.end>h&&x.start<h+p).map(x=>x.part_index))).sort((x,E)=>x-E):[];if(N.length>1){let x=N.map(E=>c.part_kind_of(E)||"?").join(" \u2192 ");r.push(`- Edit ${s+1+n} Failed: target_text spans a structural document-part boundary (${x}). Headers, body, footers and footnotes are separate Word parts \u2014 an edit cannot cross between them. Anchor the edit on text within a single part (split it into one edit per part if both sides must change).`);}let A=h+g,C=h+p-w;if(C>A&&c.spans.filter(E=>E.end>A&&E.start<C&&(E.run!==null||E.text.trim()!=="")).some(E=>E.is_image_marker)&&r.push(`- Edit ${s+1+n} Failed: the target overlaps a read-only image marker (![alt](docx-image:N)). Images cannot be edited or removed via text replacement \u2014 target the text around the image instead.`),i.comment&&(i.new_text||"")===(i.target_text||"")){let x=c.part_kind_at(h);x!==null&&x!=="body"&&r.push(`- Edit ${s+1+n} Failed: comments cannot be anchored inside a ${x} part \u2014 Word only supports comments in the main document body. Comment on the related body text instead.`);}if(V._introduces_table_row_text(c,h,p,b,m)&&r.push(`- Edit ${s+1+n} Failed: new_text introduces a pipe-delimited row line inside a table. Text replacement cannot create table rows \u2014 use the structured 'insert_row' operation instead (e.g. {"type": "insert_row", "target_text": "<anchor row text>", "cells": ["...", "..."]}).`),b.includes(`
100
100
 
101
101
  `)&&!(_.split(`
@@ -111,7 +111,7 @@ ${u}`,a++;else break}e.push([l,s]),n=a;}return e}y(go,"_merge_footnote_sections"
111
111
  `);E.length>=2&&E[0].trim()!==""&&E[E.length-1].trim()!==""&&r.push(`- Edit ${s+1+n} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}}for(let[h,p]of a){let _=c.spans.filter(b=>b.end>h&&b.start<h+p),g=new Set,w=new Set,k=false;for(let b of _){if(b.run===null)continue;let m=false;if(b.ins_id){let v=I(this.doc.element,"w:ins").filter(N=>N.getAttribute("w:id")===b.ins_id);if(v.length>0){let N=v[0].getAttribute("w:author");N&&N!==this.author&&(g.add(N),m=true);}}m||(k=true);}for(let b of _)if(b.comment_ids)for(let m of b.comment_ids){let v=this.mapper.comments_map[m];v&&v.author&&v.author!==this.author&&w.add(v.author);}if(g.size>0&&!((l==="strict"||l==="first")&&!k)){r.push(`- Edit ${s+1+n} Failed: Modification targets an active insertion from another author (${Array.from(g).join(", ")}). Accept that change first or scope your edit outside of it.`);continue}w.size>0&&l==="all"&&r.push(`- Edit ${s+1+n} Failed: match_mode="all" would sweep through a comment range from another author (${Array.from(w).join(", ")}). Target the commented text deliberately with match_mode "strict" or "first", or scope your edit outside of it.`);}if((i.type==="insert_row"||i.type==="delete_row")&&a.length>0){let[h,p]=a[0],_=V._column_count_at(c,h,p);_===null?r.push(`- Edit ${s+1+n} Failed: ${i.type} target text was found, but it is not inside a table row. Anchor the operation on text that appears within the table.`):i.type==="insert_row"&&Array.isArray(i.cells)&&i.cells.length>_&&r.push(`- Edit ${s+1+n} Failed: insert_row provides ${i.cells.length} cells but the target table has ${_} column(s). The extra cell(s) would be dropped. Provide at most ${_} cells \u2014 rows given fewer cells are padded with empty ones.`);}}return r}static _introduces_table_row_text(e,n,r,s,i){if(!i.includes(`
112
112
  `)||!i.includes(" | "))return false;let o=i.split(`
113
113
  `).filter(a=>a.includes(" | ")).length,l=s.split(`
114
- `).filter(a=>a.includes(" | ")).length;return o<=l?false:V._column_count_at(e,n,Math.max(r,1))!==null}static _column_count_at(e,n,r){for(let s of e.spans){if(s.end<=n||s.start>=n+r)continue;let i=null;for(s.run!==null?i=s.run._element:s.paragraph!==null&&(i=s.paragraph._element);i;){if(i.nodeType===1&&i.tagName==="w:tr")return I(i,"w:tc").filter(o=>o.parentNode===i).length;i=i.parentNode;}}return null}validate_review_actions(e){let n=[],r=new Map,s=new Set;for(let i=0;i<e.length;i++){let o=e[i],l=o.type,a=o.target_id??"";if(l==="reply"){if(!String(o.text??"").trim()){n.push(`- Action ${i+1} Failed: reply text for ${a} is empty or whitespace-only. Word would show a blank comment bubble \u2014 provide the reply content in 'text'.`);continue}let u=a+"\0"+String(o.text).trim();s.has(u)&&n.push(`- Action ${i+1} Failed: duplicate reply \u2014 this batch already replies to ${a} with the same text. Remove the duplicate action.`),s.add(u);}else if(l==="accept"||l==="reject"){let u=r.get(a);if(u!==void 0){let[c,d]=u;d===l?n.push(`- Action ${i+1} Failed: duplicate action \u2014 Action ${c+1} in this batch already applies '${l}' to ${a}. A change can only be resolved once; remove the duplicate action.`):n.push(`- Action ${i+1} Failed: conflicting actions \u2014 Action ${c+1} in this batch applies '${d}' to ${a}, but this action applies '${l}'. Decide the outcome and keep exactly one of them.`);}else r.set(a,[i,l]);}}if(n.length>0)return n;for(let i=0;i<e.length;i++){let o=e[i],l=o.type;if(l==="reply"){let a=o.target_id.replace("Com:",""),u=false,c=this.doc.pkg.parts.find(d=>d.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");c&&(u=I(c._element,"w:comment").some(f=>f.getAttribute("w:id")===a)),u||n.push(this._action_not_found_error(o.target_id,"reply",`- Action ${i+1} Failed:`));}else if(l==="accept"||l==="reject"){let a=o.target_id.replace("Chg:",""),u=I(this.doc.element,"w:ins").filter(f=>f.getAttribute("w:id")===a),c=I(this.doc.element,"w:del").filter(f=>f.getAttribute("w:id")===a),d=I(this.doc.element,"w:pPrChange").filter(f=>f.getAttribute("w:id")===a);u.length===0&&c.length===0&&d.length===0&&n.push(this._action_not_found_error(o.target_id,l,`- Action ${i+1} Failed:`));}}return n}process_batch(e){return Array.isArray(e)&&(e=e.map(n=>{if(typeof n=="string")try{let r=JSON.parse(n);return r!==null&&typeof r=="object"?r:n}catch{return n}return n})),this._process_batch_internal(e)}_process_batch_internal(e){for(let w of e)if(w&&typeof w=="object"&&w.type==="modify"&&w.target_text&&w.new_text){let[k,b]=No(w.target_text,w.new_text);w.target_text=k,w.new_text=b;}this.skipped_details=[];let n=e.filter(w=>w!==null&&typeof w=="object"&&["accept","reject","reply"].includes(w.type)),r=e.filter(w=>w===null||typeof w!="object"||!["accept","reject","reply"].includes(w.type)),s=n.length>0?this.validate_review_actions(n):[];n.length>0&&s.length===0&&(s=this.validate_action_pairing(n));let o=r.length>0&&s.length>0?this.validate_edits(r):[],l=[...s,...o];if(l.length>0)throw new pt(l);let a=0,u=0,c=0;if(n.length>0){let w=this.apply_review_actions(n);if(a=w[0],u=w[1],c=w[2],u>0)throw new pt(this.skipped_details);a>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let[d]=Je(this.mapper.full_text),h=He(d,"").body_page_offsets,p=[],_=0,g=0;if(r.length>0){let w=y(b=>b._resolved_start_idx!==void 0&&b._resolved_start_idx!==null?b._resolved_start_idx:b._match_start_index!==void 0&&b._match_start_index!==null?b._match_start_index:null,"pinned_idx"),k=r.map((b,m)=>({edit:b,i:m})).sort((b,m)=>{let v=w(b.edit),N=w(m.edit);return v===null&&N===null?b.i-m.i:v===null?1:N===null?-1:N-v||b.i-m.i});{let b=bo(this.doc),m=this.current_id;try{let v=[],N=0;for(let{edit:A,i:C}of k){let x;try{x=this.validate_edits([A],C);}catch(E){if(!(E instanceof Ce))throw E;x=[`- Edit ${C+1} Failed: ${E.message}`];}if(x.length>0){if(N>0){let E=tr(N);x=x.map(T=>T+E);}v.push(...x);}else if(this.apply_edits([A],h),A._applied_status&&!A._any_sub_failure)N++,this.mapper=new ke(this.doc),this.clean_mapper=null;else {let E=A._error_msg||`- Edit ${C+1} Failed: Failed to apply edit.`;N>0&&(E+=tr(N)),v.push(E);break}}if(v.length>0)throw new pt(v)}catch(v){throw xo(this.doc,b),this.current_id=m,this.mapper=new ke(this.doc),this.comments_manager=new nt(this.doc),this.clean_mapper=null,v}_=r.filter(v=>v._applied_status&&!v._any_sub_failure).length,g=r.length-_;for(let v of r){let N=v._applied_status||false,A=v._error_msg||null,C=null,x=null,E=v._warning||null;if(N){let T=this._build_edit_context_previews(v);C=T[0],x=T[1];}else E=E||this._check_punctuation_warning(v.target_text||"");p.push({status:N?"applied":"failed",type:v.type||"modify",target_text:he(v.target_text||"",Lt),new_text:he(V._report_new_text(v),Lt),comment:v.comment??null,warning:E,error:A,critic_markup:C,clean_text:x,pages:v._pages||[],heading_path:v._heading_path||"",occurrences_modified:v._occurrences_modified||0,match_mode:v.match_mode||"strict"});}}}return {actions_applied:a,actions_skipped:u,actions_already_resolved:c,edits_applied:_,edits_skipped:g,occurrences_modified:p.reduce((w,k)=>w+(k.occurrences_modified||0),0),skipped_details:this.skipped_details,edits:p,engine:"node",version:"1.18.2"}}static _flag_surviving_python_backreference(e,n){let r=/\\(\d+)|\\g<(\d+)>/.exec(e.new_text||"");if(!r||!n.includes(r[0]))return;let s=0;try{let o=new RegExp(`(?:${e.target_text})|`).exec("");s=o?o.length-1:0;}catch{return}let i=parseInt(r[1]??r[2],10);i>0&&i<=s&&(e._warning=`new_text contains '${r[0]}', which JavaScript's replace does not expand \u2014 the literal text '${r[0]}' was written into the document. For a capture-group backreference use $${i} (\\N and \\g<N> are Python syntax). If you meant literal text, ignore this warning.`);}static _ids_needed(e){let n=e._internal_op;return n==null&&(!e.target_text&&e.new_text?n="INSERTION":e.target_text&&!e.new_text?n="DELETION":n="MODIFICATION"),n==="STYLE_ONLY"?[false,false]:(n==="STYLE_AND_TEXT"&&(e.target_text&&e.new_text?n="MODIFICATION":!e.target_text&&e.new_text?n="INSERTION":e.target_text&&!e.new_text?n="DELETION":n="COMMENT_ONLY"),[n==="DELETION"||n==="MODIFICATION",n==="INSERTION"||n==="MODIFICATION"])}apply_edits(e,n=[]){if(!n||n.length===0){let[c]=Je(this.mapper.full_text);n=He(c,"").body_page_offsets;}let i=[];for(let c of e){if(typeof c!="object"||c===null){continue}c._applied_status=false,c._error_msg=null,c._any_sub_failure=false,c._minted_change_ids=[],c._minted_comment_ids=[],c._reserved_del_id=null,c._reserved_ins_id=null,c._reserved_row_id=null;}for(let c of e)if(!(typeof c!="object"||c===null))if(c._resolved_start_idx!==void 0&&c._resolved_start_idx!==null||c._match_start_index!==void 0&&c._match_start_index!==null)(c._resolved_start_idx===void 0||c._resolved_start_idx===null)&&(c._resolved_start_idx=c._match_start_index),c._active_mapper_ref||(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),c._active_mapper_ref=this.clean_mapper),i.push([c,c.new_text||null]);else if(c.type==="insert_row"||c.type==="delete_row"){let d=this.mapper.drop_virtual_only_matches(this.mapper.find_all_match_indices(c.target_text)),f=this.mapper;if(d.length===0&&(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),d=this.clean_mapper.drop_virtual_only_matches(this.clean_mapper.find_all_match_indices(c.target_text)),f=this.clean_mapper),d.length>0){let h=c.match_mode||"strict",p=[],_=new Set;for(let g of d){let w=g[0],[k,b]=f.get_insertion_anchor(w,false),m=null;k?m=k._element:b&&(m=b._element);let v=m;for(;v&&v.tagName!=="w:tr";)v=v.parentNode;v&&(_.has(v)||(_.add(v),p.push(g)));}if(p.length>0){let g=p;if((h==="strict"||h==="first")&&(g=p.slice(0,1)),h==="all"||g.length>1)for(let w of g){let k={...c,_resolved_start_idx:w[0],_active_mapper_ref:f,_parent_edit_ref:c};i.push([k,null]);}else c._resolved_start_idx=g[0][0],c._active_mapper_ref=f,i.push([c,null]);}else {c._applied_status=false;let w=`- Failed to locate row target: '${(c.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(w),c._error_msg=w;}}else {c._applied_status=false;let p=`- Failed to locate row target: '${(c.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(p),c._error_msg=p;}}else {let d;try{d=this._pre_resolve_heuristic_edit(c);}catch(f){if(!(f instanceof Ce))throw f;c._applied_status=false;let h=`- Failed to apply edit targeting: '${(c.target_text||"").substring(0,40)}...' (${f.message})`;this.skipped_details.push(h),c._error_msg=h;continue}if(d)if(Array.isArray(d))for(let f of d)f._resolved_start_idx=f._match_start_index,f._parent_edit_ref=c,(c._resolved_start_idx===void 0||c._resolved_start_idx===null)&&(c._resolved_start_idx=f._resolved_start_idx),c._resolved_proxy_edit||(c._resolved_proxy_edit=f),i.push([f,f.new_text]);else d._resolved_start_idx=d._match_start_index,d._parent_edit_ref=c,c._resolved_start_idx=d._resolved_start_idx,c._resolved_proxy_edit=d,i.push([d,d.new_text]);else {c._applied_status=false;let p=`- Failed to apply edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),c._error_msg=p;}}i.sort((c,d)=>(d[0]._resolved_start_idx||0)-(c[0]._resolved_start_idx||0));{let c=[...i].sort((d,f)=>(d[0]._resolved_start_idx||0)-(f[0]._resolved_start_idx||0));for(let[d]of c){let f=d._parent_edit_ref||d;if(Array.isArray(f._minted_change_ids)||(f._minted_change_ids=[]),d.type==="insert_row"||d.type==="delete_row"){d._reserved_row_id==null&&(d._reserved_row_id=this._getNextId(),f._minted_change_ids.push(d._reserved_row_id));continue}if(d.type!=="modify")continue;let[h,p]=V._ids_needed(d);h&&d._reserved_del_id==null&&(d._reserved_del_id=this._getNextId(),f._minted_change_ids.push(d._reserved_del_id)),p&&d._reserved_ins_id==null&&(d._reserved_ins_id=this._getNextId(),f._minted_change_ids.push(d._reserved_ins_id));}}for(let[c]of i)this._capture_preview_context(c),c._parent_edit_ref&&this._capture_parent_preview_context(c._parent_edit_ref);let o=[],l=new Set;for(let[c,d]of i){let f=c._resolved_start_idx||0,h=c.type==="insert_row"?f:f+(c.target_text?c.target_text.length:0);if(o.some(([k,b])=>f<b&&h>k)){let m=`- Skipped overlapping edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(m),c._applied_status=false,c._error_msg=m,c._any_sub_failure=true;let v=c._parent_edit_ref;v&&(v._applied_status=false,v._error_msg=m,v._any_sub_failure=true);continue}let _=false,g=this.current_id,w=this.comments_manager.nextId;if(c.type==="modify"?_=this._apply_single_edit_indexed(c,d,false):(c.type==="insert_row"||c.type==="delete_row")&&(_=this._apply_table_edit(c,false)),_){let k=c._parent_edit_ref||c;Array.isArray(k._minted_change_ids)||(k._minted_change_ids=[]);for(let b=g+1;b<=this.current_id;b++)k._minted_change_ids.push(String(b));Array.isArray(k._minted_comment_ids)||(k._minted_comment_ids=[]);for(let b=w;b<this.comments_manager.nextId;b++)k._minted_comment_ids.push(String(b));}if(_){let k=c._split_group_id,b=k==null||!l.has(k);b&&k!==void 0&&k!==null&&l.add(k),o.push([f,h]),c._applied_status=true;let m=c._parent_edit_ref;if(m){m._applied_status=true,b&&(m._occurrences_modified=(m._occurrences_modified||0)+1);let[v,N]=this._get_heading_path_and_page(f,this.mapper.full_text,n),A=m._pages||[];A.includes(N)||A.unshift(N),m._pages=A,m._heading_path=v;}else {b&&(c._occurrences_modified=(c._occurrences_modified||0)+1);let[v,N]=this._get_heading_path_and_page(f,this.mapper.full_text,n),A=c._pages||[];A.includes(N)||A.unshift(N),c._pages=A,c._heading_path=v;}}else {let m=`- Failed to apply edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(m),c._applied_status=false,c._error_msg=m,c._any_sub_failure=true;let v=c._parent_edit_ref;v&&(v._any_sub_failure=true,v._applied_status||(v._applied_status=false,v._error_msg=m));}}let a=0,u=0;for(let c of e){if(typeof c!="object"||c===null){u++;continue}c._applied_status&&!c._any_sub_failure?a++:u++;}return [a,u]}_paragraph_has_visible_content(e){for(let n of ["w:t","w:tab","w:br"]){let r=I(e,n);for(let s of r){let i=false,o=s.parentNode;for(;o&&o!==e.parentNode;){if(o.tagName==="w:del"){i=true;break}o=o.parentNode;}if(!i){if(n==="w:t"&&!s.textContent)continue;return true}}}return false}_get_paired_nodes(e){let n=[],r=e.getAttribute("w:author"),s=new Set(["w:commentRangeStart","w:commentRangeEnd","w:commentReference","w:rPr","w:pPr"]),i=new Set,o=y(d=>{let f=d.getAttribute("w:id");f&&i.add(f);},"add_id");o(e);let l=y(d=>{let f=d;for(;f&&f.tagName!=="w:p";)f=f.parentNode;return f},"paragraph_of"),a=y(d=>{let f=M(d,"w:pPr"),h=f?M(f,"w:rPr"):null;return h?M(h,"w:ins"):null},"mark_of"),u=y(d=>{let f=a(d);if(!f||f.getAttribute("w:author")!==r)return false;let h=f.getAttribute("w:id");return h!==null&&i.has(h)},"boundary_is_ours"),c=y((d,f)=>{let h=l(d),p=f==="next"?d.nextSibling:d.previousSibling;for(;;){if(!p){if(!h)break;if(f==="next"){let g=ve(h);for(;g&&g.tagName!=="w:p";)g=ve(g);if(!g||!u(g))break;h=g,p=g.firstChild;}else {if(!u(h))break;let g=Ee(h);for(;g&&g.tagName!=="w:p";)g=Ee(g);if(!g)break;h=g,p=g.lastChild;}continue}if(p.nodeType!==1){p=f==="next"?p.nextSibling:p.previousSibling;continue}let _=p;if(s.has(_.tagName)){p=f==="next"?p.nextSibling:p.previousSibling;continue}if((_.tagName==="w:ins"||_.tagName==="w:del")&&_.getAttribute("w:author")===r){n.push(_),o(_),p=f==="next"?p.nextSibling:p.previousSibling;continue}break}},"walk");return c(e,"next"),c(e,"prev"),n}_resolution_group_ids(e){let n=[...I(this.doc.element,"w:ins"),...I(this.doc.element,"w:del")].filter(s=>s.getAttribute("w:id")===e),r=new Set;if(n.length===0)return I(this.doc.element,"w:pPrChange").some(i=>i.getAttribute("w:id")===e)&&r.add(e),r;r.add(e);for(let s of n)for(let i of this._get_paired_nodes(s)){let o=i.getAttribute("w:id");o&&r.add(o);}return r}validate_action_pairing(e){let n=[],r=new Map;for(let s=0;s<e.length;s++){let i=e[s];if(i.type!=="accept"&&i.type!=="reject")continue;let o=String(i.target_id??"");if(o.startsWith("Com:"))continue;let l=o.startsWith("Chg:")?o.slice(4):o,a=this._resolution_group_ids(l);if(a.size===0)continue;let u=null;for(let c of a){let d=r.get(c);if(d!==void 0&&d[1]!==i.type){u=d;break}}if(u!==null){let[c,d,f]=u;n.push(`- Action ${s+1} Failed: conflicting actions on one replacement \u2014 Action ${c+1} applies '${d}' to Chg:${f}, and Chg:${l} is part of the same change (a replacement's contiguous del+ins pair resolves as one unit, so '${d}' already decides both sides). Accepting one side and rejecting the other is contradictory \u2014 decide the outcome and submit exactly one action for the pair.`);continue}for(let c of a)r.has(c)||r.set(c,[s,i.type,l]);}return n}_buildRevisionIndex(e,n){let r=new Map;for(let u of nr)r.set(u,[]);let i=[this.doc.element],o=[0],l=[],a=[];for(;i.length;){let u=i.length-1,c=i[u].childNodes;if(!c||o[u]>=c.length){for(i.pop(),o.pop();a.length&&a[a.length-1]>i.length;)a.pop(),l.pop();continue}let d=c[o[u]++];if(d.nodeType!==1)continue;let f=r.get(d.tagName),h=null;f&&(h={el:d,id:d.getAttribute("w:id"),nested:[]},f.push(h));let p=d.tagName==="w:ins"||d.tagName==="w:del";if(h&&p)for(let _ of l)_.nested.push(h);i.push(d),o.push(0),h&&p&&(l.push(h),a.push(i.length));}return {doc:e,inc:n,byTag:r}}_getRevisionIndex(){let e=this.doc.element.ownerDocument,n=typeof e?._inc=="number"?e._inc:null,r=this._revisionIndex;if(r&&r.doc===e&&n!==null&&r.inc===n)return r;let s=this._buildRevisionIndex(e,n);return this._revisionIndex=s,s}_revisionsByTag(e){return this._getRevisionIndex().byTag.get(e)??[]}_existing_change_ids(){let e=new Set;for(let n of nr)for(let r of this._revisionsByTag(n))r.id&&e.add(r.id);return Array.from(e).sort((n,r)=>{let s=/^\d+$/.test(n)?parseInt(n,10):0,i=/^\d+$/.test(r)?parseInt(r,10):0;return s-i||n.localeCompare(r)})}_existing_comment_ids(){let e=[];try{e=Object.keys(Xe(this.doc.pkg));}catch{e=[];}return e.sort((n,r)=>{let s=/^\d+$/.test(n)?parseInt(n,10):0,i=/^\d+$/.test(r)?parseInt(r,10):0;return s-i||n.localeCompare(r)})}static _format_id_list(e,n,r=20){let s=e.slice(0,r),i=s.map(o=>`${n}${o}`).join(", ");return e.length>s.length&&(i+=`, \u2026 (+${e.length-s.length} more)`),i}_action_not_found_error(e,n,r="- Failed to apply action:"){let s=this._existing_change_ids(),i=this._existing_comment_ids(),o=e.startsWith("Chg:")||e.startsWith("Com:"),l=e.replace(/^(Chg:|Com:)/,""),a="Call `read_docx` on the document again to list the current change (Chg:) and comment (Com:) ids \u2014 ids shift between document states.";if(n==="reply"){let d=o?e:`Com:${l}`;if(s.includes(l))return `${r} reply on ${d} \u2014 Chg:${l} is a tracked-change id, not a comment. \`reply\` adds to an existing comment thread (Com:\u2026); to comment on a change instead, apply a modify with a \`comment\`. ${a}`;let f=i.length>0?`Comment ids in this document: ${V._format_id_list(i,"Com:")}. `:"This document has no comments to reply to. ";return `${r} reply on ${d} \u2014 no comment with that id exists. ${f}${a}`}let u=o?e:`Chg:${l}`;if(i.includes(l))return `${r} ${n} on ${u} \u2014 Com:${l} is a comment id, not a tracked change. accept/reject act on tracked changes (Chg:\u2026); to respond to a comment use \`reply\`. ${a}`;let c=s.length>0?`Tracked-change ids in this document: ${V._format_id_list(s,"Chg:")}. `:"This document has no tracked changes. ";return `${r} ${n} on ${u} \u2014 no tracked change with that id exists (it may already have been accepted or rejected, or the id is stale). ${c}${a}`}apply_review_actions(e){let n=0,r=0,s=0,i=new Map,o=e.map((l,a)=>({action:l,pos:a})).sort((l,a)=>{let u=l.action.type==="reply"?0:1,c=a.action.type==="reply"?0:1;return u!==c?u-c:l.pos-a.pos});for(let{action:l,pos:a}of o){let u=l.type;if(u==="reply"){let x=l.target_id.replace("Com:",""),E=this.comments_manager.addComment(this.author,l.text,x);this._anchor_reply_comment(x,E),n++;continue}let c=l.target_id.replace("Chg:",""),d=i.get(c);if(d!==void 0){if(d===u){s++,this.skipped_details.push(`- Note: Action ${a+1} ('${u}' on ${l.target_id}) had no additional effect \u2014 the change was already resolved together with its replacement pair by an earlier action in this batch. Counted as already_resolved, not applied.`);continue}this.skipped_details.push(`- Action ${a+1} Failed: contradictory action \u2014 '${u}' on ${l.target_id}, but the change was already resolved as '${d}' together with its replacement pair by an earlier action in this batch.`),r++;continue}let f=this._revisionsByTag("w:ins").filter(x=>x.id===c).map(x=>x.el),h=this._revisionsByTag("w:del").filter(x=>x.id===c).map(x=>x.el),p=[...f,...h],_=en.flatMap(x=>this._revisionsByTag(x).filter(E=>E.id===c).map(E=>E.el));if(p.length===0&&_.length===0){r++,this.skipped_details.push(this._action_not_found_error(l.target_id,u));continue}let g=Array.from(new Set([...p,..._].map(x=>x.getAttribute("w:author")||"Unknown"))).sort();if(g.length>1){r++,this.skipped_details.push(`- Failed to apply action: ${u} on Chg:${c} is ambiguous. The document contains ${p.length} tracked-change elements sharing w:id=${c} from different authors (${g.join(", ")}) \u2014 duplicate revision IDs produced outside this engine (e.g. by a document merge or copy-paste). Acting on this ID would resolve all of them at once. Resolve these changes individually in Word, or apply the intended outcome as an explicit text edit instead.`);continue}let w=new Set([c]);for(let x of p)for(let E of this._get_paired_nodes(x)){let T=E.getAttribute("w:id");T&&w.add(T);}let k=Kt.flatMap(x=>this._revisionsByTag(x)),b=-1;for(;b!==w.size;){b=w.size;for(let x of k)if(!(!x.id||!w.has(x.id)))for(let E of x.nested)E.id&&w.add(E.id);}let m=[];for(let x of Kt)for(let E of this._revisionsByTag(x))E.id&&w.has(E.id)&&m.push(E.el);let v=en.flatMap(x=>this._revisionsByTag(x).filter(E=>E.id!==null&&w.has(E.id)).map(E=>E.el)),N=new Set;for(let x of [...m,...v]){let E=x.getAttribute("w:id");E&&N.add(E);}let A=new Set(this._existing_comment_ids()),C=[];for(let x of m){let E=x.tagName==="w:ins",T=x.parentNode?x.parentNode.tagName:"",D=T==="w:trPr",P=E&&T==="w:rPr"&&!!x.parentNode?.parentNode&&x.parentNode.parentNode.tagName==="w:pPr";if(u==="accept")if(E)if(D)x.parentNode?.removeChild(x);else {for(;x.firstChild;)x.parentNode?.insertBefore(x.firstChild,x);x.parentNode?.removeChild(x);}else if(this._clean_wrapping_comments(x),this._delete_comments_in_element(x),D){let R=x.parentNode?.parentNode;R?.parentNode?.removeChild(R);}else x.parentNode?.removeChild(x);else if(u==="reject")if(E){if(P){let R=x.parentNode;x.parentNode?.removeChild(x),R=R?.parentNode,R=R?.parentNode,R&&R.tagName==="w:p"&&C.push(R);continue}if(this._clean_wrapping_comments(x),this._delete_comments_in_element(x),D){let R=x.parentNode?.parentNode;R?.parentNode?.removeChild(R);}else x.parentNode?.removeChild(x);}else if(D)x.parentNode?.removeChild(x);else {let R=Array.from(x.getElementsByTagName("w:delText"));for(let $ of R){let S=$.ownerDocument.createElement("w:t");S.textContent=$.textContent,$.hasAttribute("xml:space")&&S.setAttribute("xml:space","preserve"),$.parentNode?.replaceChild(S,$);}for(;x.firstChild;)x.parentNode?.insertBefore(x.firstChild,x);x.parentNode?.removeChild(x);}}for(let x of C.reverse()){if(!x.parentNode)continue;let E=Ee(x);for(;E&&E.tagName!=="w:p";)E=Ee(E);if(E){for(let T of Array.from(x.childNodes))T.nodeType===1&&T.tagName==="w:pPr"||E.appendChild(T);x.parentNode.removeChild(x);}}for(let x of v)u==="accept"?x.parentNode?.removeChild(x):x.tagName==="w:pPrChange"?this._revert_ppr_change(x):this._revert_props_change(x);for(let x of N)i.set(x,u);if(n++,A.size>0){let x=new Set(this._existing_comment_ids()),E=Array.from(A).filter(T=>!x.has(T));if(E.length>0){let T=E.sort((D,P)=>{let R=/^\d+$/.test(D)?parseInt(D,10):0,$=/^\d+$/.test(P)?parseInt(P,10):0;return R-$||D.localeCompare(P)}).map(D=>`Com:${D}`).join(", ");this.skipped_details.push(`- Note: ${u} on ${l.target_id} also removed comment ${T} (including any reply thread) because its anchor was inside the resolved change. This note is informational \u2014 the action itself succeeded.`);}}}return [n,r,s]}_apply_table_edit(e,n){let r=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,s=e._active_mapper_ref||this.mapper,[i,o]=s.get_insertion_anchor(r,n),l=null;if(i?l=i._element:o&&(l=o._element),!l)return false;let a=l;for(;a&&a.tagName!=="w:tr";)a=a.parentNode;if(!a)return false;let u=(e._reserved_row_id??null)!==null?String(e._reserved_row_id):null;if(e.type==="delete_row"){let c=M(a,"w:trPr");return c||(c=a.ownerDocument.createElement("w:trPr"),a.insertBefore(c,a.firstChild)),c.appendChild(this._create_track_change_tag("w:del","",u)),true}else if(e.type==="insert_row"){let c=a.ownerDocument.createElement("w:tr"),d=a.ownerDocument.createElement("w:trPr");c.appendChild(d),d.appendChild(this._create_track_change_tag("w:ins","",u));let f=I(a,"w:tc").filter(p=>p.parentNode===a).length,h=Array.isArray(e.cells)?[...e.cells]:[];if(f>0){for(;h.length<f;)h.push("");h=h.slice(0,f);}for(let p of h){let _=a.ownerDocument.createElement("w:tc"),g=a.ownerDocument.createElement("w:p"),w=a.ownerDocument.createElement("w:r"),k=a.ownerDocument.createElement("w:t");k.textContent=p,p.trim()!==p&&k.setAttribute("xml:space","preserve"),w.appendChild(k),g.appendChild(w),_.appendChild(g),c.appendChild(_);}return e.position==="above"?a.parentNode?.insertBefore(c,a):Le(c,a),true}return false}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let n=e.regex||false,r=e.match_mode||"strict",s=this.mapper.drop_virtual_only_matches(this.mapper.find_all_match_indices(e.target_text,n)),i=false;if(s.length===0)if(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),s=this.clean_mapper.drop_virtual_only_matches(this.clean_mapper.find_all_match_indices(e.target_text,n)),s.length>0)i=true;else return null;let o=i?this.clean_mapper:this.mapper,l=[];for(let[u,c]of s){let d=o.spans.filter(f=>f.run!==null&&f.end>u&&f.start<u+c);(d.length===0||d.some(f=>!f.del_id))&&l.push([u,c]);}if(l.length===0)return null;(r==="strict"||r==="first")&&(l=l.slice(0,1));let a=[];for(let[u,c]of l){let d=o.full_text.substring(u,u+c),f=e.new_text||"";if(/^\{#cell:[^}]+\}$/.test(d.trim())){let E=f;E=E.split(d.trim()).join("");let T=o.spans.find(D=>D.start<=u&&u<D.end&&D.paragraph!==null);if(T&&E){let D=o.spans.filter(P=>P.end<=u&&P.run!==null&&P.paragraph!==null&&P.paragraph._element===T.paragraph._element).map(P=>P.text).join("");if(D){for(let P of [D,D.replace(/\s+$/,"")])if(P&&E.startsWith(P)){E=E.substring(P.length).replace(/^\s+/,"");break}E&&!/\s$/.test(D)&&!/^\s/.test(E)&&(E=" "+E);}}E?a.push({type:"modify",target_text:"",new_text:E,comment:e.comment,_match_start_index:u,_internal_op:"INSERTION",_active_mapper_ref:o}):e.comment&&a.push({type:"modify",target_text:"",new_text:"",comment:e.comment,_match_start_index:u,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}if(n&&f){try{f=d.replace(new RegExp(e.target_text),f);}catch{}V._flag_surviving_python_backreference(e,f);}e._preview_span||(e._preview_span=[u,c],e._preview_matched_text=d,e._preview_new_text=f,e._preview_mapper_ref=o);let[h,p]=this._parse_markdown_style(e.target_text),[_,g]=this._parse_markdown_style(f);if(p!==g){let[E]=this._parse_markdown_style(d),T=E,D=_,P=T===D?"STYLE_ONLY":"STYLE_AND_TEXT",R=d.indexOf(E),$=u+(R!==-1?R:0),S=g!==null?g:"Normal";a.push({type:"modify",target_text:T,new_text:D,comment:e.comment,_match_start_index:$,_internal_op:P,_new_style:S,_active_mapper_ref:o});continue}if(d===f||e.target_text===f){a.push({type:"modify",target_text:d,new_text:d,comment:e.comment,_match_start_index:u,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}let w=false;if(o&&(w=o.spans.some(E=>E.text===" | "&&(E.run===null||E.run===void 0)&&E.start<u+c&&E.end>u)),w){let E=d.split("|"),T=f.split("|");if(E.length!==T.length)throw new pt([`Target text spans ${E.length} table cells, but replacement provides ${T.length}. To modify text without altering table structure (rows or columns), ensure the replacement contains the exact same number of '|' separators (e.g., replace with 'CellC | ' to empty the second cell).`]);if(E.length>1){let D=[],P=0,R=0;for(let $=0;$<E.length;$++)if(E[$].trim()!==T[$].trim()){R=$;break}for(let $=0;$<E.length;$++){let S=E[$],j=T[$],F=S.trim(),B=j.trim(),L=u+P+(F?S.indexOf(F):0),U=e.comment!==null&&e.comment!==void 0&&$===R;if(F!==B||U){let Y=this._word_diff_sub_edits(F,B,L,U?e.comment:null,true,o);for(let X of Y)X._original_target_text=e.target_text,X._split_group_id=u,D.push(X);}P+=S.length+1;}for(let $ of D)a.push($);continue}}let k=false;e.target_text&&(e.target_text.includes("**")||e.target_text.includes("_"))&&(k=true),f&&(f.includes("**")||f.includes("_"))&&(k=true);let b="",m="",v="",N=u;if(f.startsWith(d))b="INSERTION",v=f.substring(d.length),N=u+c;else {let[E,T]=Ue(d,f),D=d.length-T,P=f.length-T;m=d.substring(E,D),v=f.substring(E,P),N=u+E;}if(k){if(!m&&v)b="INSERTION";else if(m&&!v)b="DELETION";else if(m&&v)b="MODIFICATION";else {a.push({type:"modify",target_text:m,new_text:v,comment:e.comment,_match_start_index:N,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}a.push({type:"modify",target_text:m,new_text:v,comment:e.comment,_resolved_start_idx:N,_match_start_index:N,_internal_op:b,_active_mapper_ref:o});continue}let A=d.split(`
114
+ `).filter(a=>a.includes(" | ")).length;return o<=l?false:V._column_count_at(e,n,Math.max(r,1))!==null}static _column_count_at(e,n,r){for(let s of e.spans){if(s.end<=n||s.start>=n+r)continue;let i=null;for(s.run!==null?i=s.run._element:s.paragraph!==null&&(i=s.paragraph._element);i;){if(i.nodeType===1&&i.tagName==="w:tr")return I(i,"w:tc").filter(o=>o.parentNode===i).length;i=i.parentNode;}}return null}validate_review_actions(e){let n=[],r=new Map,s=new Set;for(let i=0;i<e.length;i++){let o=e[i],l=o.type,a=o.target_id??"";if(l==="reply"){if(!String(o.text??"").trim()){n.push(`- Action ${i+1} Failed: reply text for ${a} is empty or whitespace-only. Word would show a blank comment bubble \u2014 provide the reply content in 'text'.`);continue}let u=a+"\0"+String(o.text).trim();s.has(u)&&n.push(`- Action ${i+1} Failed: duplicate reply \u2014 this batch already replies to ${a} with the same text. Remove the duplicate action.`),s.add(u);}else if(l==="accept"||l==="reject"){let u=r.get(a);if(u!==void 0){let[c,d]=u;d===l?n.push(`- Action ${i+1} Failed: duplicate action \u2014 Action ${c+1} in this batch already applies '${l}' to ${a}. A change can only be resolved once; remove the duplicate action.`):n.push(`- Action ${i+1} Failed: conflicting actions \u2014 Action ${c+1} in this batch applies '${d}' to ${a}, but this action applies '${l}'. Decide the outcome and keep exactly one of them.`);}else r.set(a,[i,l]);}}if(n.length>0)return n;for(let i=0;i<e.length;i++){let o=e[i],l=o.type;if(l==="reply"){let a=o.target_id.replace("Com:",""),u=false,c=this.doc.pkg.parts.find(d=>d.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");c&&(u=I(c._element,"w:comment").some(f=>f.getAttribute("w:id")===a)),u||n.push(this._action_not_found_error(o.target_id,"reply",`- Action ${i+1} Failed:`));}else if(l==="accept"||l==="reject"){let a=o.target_id.replace("Chg:",""),u=I(this.doc.element,"w:ins").filter(f=>f.getAttribute("w:id")===a),c=I(this.doc.element,"w:del").filter(f=>f.getAttribute("w:id")===a),d=I(this.doc.element,"w:pPrChange").filter(f=>f.getAttribute("w:id")===a);u.length===0&&c.length===0&&d.length===0&&n.push(this._action_not_found_error(o.target_id,l,`- Action ${i+1} Failed:`));}}return n}process_batch(e){return Array.isArray(e)&&(e=e.map(n=>{if(typeof n=="string")try{let r=JSON.parse(n);return r!==null&&typeof r=="object"?r:n}catch{return n}return n})),this._process_batch_internal(e)}_process_batch_internal(e){for(let w of e)if(w&&typeof w=="object"&&w.type==="modify"&&w.target_text&&w.new_text){let[k,b]=No(w.target_text,w.new_text);w.target_text=k,w.new_text=b;}this.skipped_details=[];let n=e.filter(w=>w!==null&&typeof w=="object"&&["accept","reject","reply"].includes(w.type)),r=e.filter(w=>w===null||typeof w!="object"||!["accept","reject","reply"].includes(w.type)),s=n.length>0?this.validate_review_actions(n):[];n.length>0&&s.length===0&&(s=this.validate_action_pairing(n));let o=r.length>0&&s.length>0?this.validate_edits(r):[],l=[...s,...o];if(l.length>0)throw new pt(l);let a=0,u=0,c=0;if(n.length>0){let w=this.apply_review_actions(n);if(a=w[0],u=w[1],c=w[2],u>0)throw new pt(this.skipped_details);a>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let[d]=Je(this.mapper.full_text),h=He(d,"").body_page_offsets,p=[],_=0,g=0;if(r.length>0){let w=y(b=>b._resolved_start_idx!==void 0&&b._resolved_start_idx!==null?b._resolved_start_idx:b._match_start_index!==void 0&&b._match_start_index!==null?b._match_start_index:null,"pinned_idx"),k=r.map((b,m)=>({edit:b,i:m})).sort((b,m)=>{let v=w(b.edit),N=w(m.edit);return v===null&&N===null?b.i-m.i:v===null?1:N===null?-1:N-v||b.i-m.i});{let b=bo(this.doc),m=this.current_id;try{let v=[],N=0;for(let{edit:A,i:C}of k){let x;try{x=this.validate_edits([A],C);}catch(E){if(!(E instanceof Ce))throw E;x=[`- Edit ${C+1} Failed: ${E.message}`];}if(x.length>0){if(N>0){let E=tr(N);x=x.map(T=>T+E);}v.push(...x);}else if(this.apply_edits([A],h),A._applied_status&&!A._any_sub_failure)N++,this.mapper=new ke(this.doc),this.clean_mapper=null;else {let E=A._error_msg||`- Edit ${C+1} Failed: Failed to apply edit.`;N>0&&(E+=tr(N)),v.push(E);break}}if(v.length>0)throw new pt(v)}catch(v){throw xo(this.doc,b),this.current_id=m,this.mapper=new ke(this.doc),this.comments_manager=new nt(this.doc),this.clean_mapper=null,v}_=r.filter(v=>v._applied_status&&!v._any_sub_failure).length,g=r.length-_;for(let v of r){let N=v._applied_status||false,A=v._error_msg||null,C=null,x=null,E=v._warning||null;if(N){let T=this._build_edit_context_previews(v);C=T[0],x=T[1];}else E=E||this._check_punctuation_warning(v.target_text||"");p.push({status:N?"applied":"failed",type:v.type||"modify",target_text:he(v.target_text||"",Lt),new_text:he(V._report_new_text(v),Lt),comment:v.comment??null,warning:E,error:A,critic_markup:C,clean_text:x,pages:v._pages||[],heading_path:v._heading_path||"",occurrences_modified:v._occurrences_modified||0,match_mode:v.match_mode||"strict"});}}}return {actions_applied:a,actions_skipped:u,actions_already_resolved:c,edits_applied:_,edits_skipped:g,occurrences_modified:p.reduce((w,k)=>w+(k.occurrences_modified||0),0),skipped_details:this.skipped_details,edits:p,engine:"node",version:"1.18.2"}}static _flag_surviving_python_backreference(e,n){let r=/\\(\d+)|\\g<(\d+)>/.exec(e.new_text||"");if(!r||!n.includes(r[0]))return;let s=0;try{let o=new RegExp(`(?:${e.target_text})|`).exec("");s=o?o.length-1:0;}catch{return}let i=parseInt(r[1]??r[2],10);i>0&&i<=s&&(e._warning=`new_text contains '${r[0]}', which JavaScript's replace does not expand \u2014 the literal text '${r[0]}' was written into the document. For a capture-group backreference use $${i} (\\N and \\g<N> are Python syntax). If you meant literal text, ignore this warning.`);}static _ids_needed(e){let n=e._internal_op;return n==null&&(!e.target_text&&e.new_text?n="INSERTION":e.target_text&&!e.new_text?n="DELETION":n="MODIFICATION"),n==="STYLE_ONLY"?[false,false]:(n==="STYLE_AND_TEXT"&&(e.target_text&&e.new_text?n="MODIFICATION":!e.target_text&&e.new_text?n="INSERTION":e.target_text&&!e.new_text?n="DELETION":n="COMMENT_ONLY"),[n==="DELETION"||n==="MODIFICATION",n==="INSERTION"||n==="MODIFICATION"])}apply_edits(e,n=[]){if(!n||n.length===0){let[c]=Je(this.mapper.full_text);n=He(c,"").body_page_offsets;}let i=[];for(let c of e){if(typeof c!="object"||c===null){continue}c._applied_status=false,c._error_msg=null,c._any_sub_failure=false,c._minted_change_ids=[],c._minted_comment_ids=[],c._reserved_del_id=null,c._reserved_ins_id=null,c._reserved_row_id=null;}for(let c of e)if(!(typeof c!="object"||c===null))if(c._resolved_start_idx!==void 0&&c._resolved_start_idx!==null||c._match_start_index!==void 0&&c._match_start_index!==null)(c._resolved_start_idx===void 0||c._resolved_start_idx===null)&&(c._resolved_start_idx=c._match_start_index),c._active_mapper_ref||(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),c._active_mapper_ref=this.clean_mapper),i.push([c,c.new_text||null]);else if(c.type==="insert_row"||c.type==="delete_row"){let d=this.mapper.drop_virtual_only_matches(this.mapper.find_all_match_indices(c.target_text)),f=this.mapper;if(d.length===0&&(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),d=this.clean_mapper.drop_virtual_only_matches(this.clean_mapper.find_all_match_indices(c.target_text)),f=this.clean_mapper),d.length>0){let h=c.match_mode||"strict",p=[],_=new Set;for(let g of d){let w=g[0],[k,b]=f.get_insertion_anchor(w,false),m=null;k?m=k._element:b&&(m=b._element);let v=m;for(;v&&v.tagName!=="w:tr";)v=v.parentNode;v&&(_.has(v)||(_.add(v),p.push(g)));}if(p.length>0){let g=p;if((h==="strict"||h==="first")&&(g=p.slice(0,1)),h==="all"||g.length>1)for(let w of g){let k={...c,_resolved_start_idx:w[0],_active_mapper_ref:f,_parent_edit_ref:c};i.push([k,null]);}else c._resolved_start_idx=g[0][0],c._active_mapper_ref=f,i.push([c,null]);}else {c._applied_status=false;let w=`- Failed to locate row target: '${(c.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(w),c._error_msg=w;}}else {c._applied_status=false;let p=`- Failed to locate row target: '${(c.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(p),c._error_msg=p;}}else {let d;try{d=this._pre_resolve_heuristic_edit(c);}catch(f){if(!(f instanceof Ce))throw f;c._applied_status=false;let h=`- Failed to apply edit targeting: '${(c.target_text||"").substring(0,40)}...' (${f.message})`;this.skipped_details.push(h),c._error_msg=h;continue}if(d)if(Array.isArray(d))for(let f of d)f._resolved_start_idx=f._match_start_index,f._parent_edit_ref=c,(c._resolved_start_idx===void 0||c._resolved_start_idx===null)&&(c._resolved_start_idx=f._resolved_start_idx),c._resolved_proxy_edit||(c._resolved_proxy_edit=f),i.push([f,f.new_text]);else d._resolved_start_idx=d._match_start_index,d._parent_edit_ref=c,c._resolved_start_idx=d._resolved_start_idx,c._resolved_proxy_edit=d,i.push([d,d.new_text]);else {c._applied_status=false;let p=`- Failed to apply edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),c._error_msg=p;}}i.sort((c,d)=>(d[0]._resolved_start_idx||0)-(c[0]._resolved_start_idx||0));{let c=[...i].sort((d,f)=>(d[0]._resolved_start_idx||0)-(f[0]._resolved_start_idx||0));for(let[d]of c){let f=d._parent_edit_ref||d;if(Array.isArray(f._minted_change_ids)||(f._minted_change_ids=[]),d.type==="insert_row"||d.type==="delete_row"){d._reserved_row_id==null&&(d._reserved_row_id=this._getNextId(),f._minted_change_ids.push(d._reserved_row_id));continue}if(d.type!=="modify")continue;let[h,p]=V._ids_needed(d);h&&d._reserved_del_id==null&&(d._reserved_del_id=this._getNextId(),f._minted_change_ids.push(d._reserved_del_id)),p&&d._reserved_ins_id==null&&(d._reserved_ins_id=this._getNextId(),f._minted_change_ids.push(d._reserved_ins_id));}}for(let[c]of i)this._capture_preview_context(c),c._parent_edit_ref&&this._capture_parent_preview_context(c._parent_edit_ref);let o=[],l=new Set;for(let[c,d]of i){let f=c._resolved_start_idx||0,h=c.type==="insert_row"?f:f+(c.target_text?c.target_text.length:0);if(o.some(([k,b])=>f<b&&h>k)){let m=`- Skipped overlapping edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(m),c._applied_status=false,c._error_msg=m,c._any_sub_failure=true;let v=c._parent_edit_ref;v&&(v._applied_status=false,v._error_msg=m,v._any_sub_failure=true);continue}let _=false,g=this.current_id,w=this.comments_manager.nextId;if(c.type==="modify"?_=this._apply_single_edit_indexed(c,d,false):(c.type==="insert_row"||c.type==="delete_row")&&(_=this._apply_table_edit(c,false)),_){let k=c._parent_edit_ref||c;Array.isArray(k._minted_change_ids)||(k._minted_change_ids=[]);for(let b=g+1;b<=this.current_id;b++)k._minted_change_ids.push(String(b));Array.isArray(k._minted_comment_ids)||(k._minted_comment_ids=[]);for(let b=w;b<this.comments_manager.nextId;b++)k._minted_comment_ids.push(String(b));}if(_){let k=c._split_group_id,b=k==null||!l.has(k);b&&k!==void 0&&k!==null&&l.add(k),o.push([f,h]),c._applied_status=true;let m=c._parent_edit_ref;if(m){m._applied_status=true,b&&(m._occurrences_modified=(m._occurrences_modified||0)+1);let[v,N]=this._get_heading_path_and_page(f,this.mapper.full_text,n),A=m._pages||[];A.includes(N)||A.unshift(N),m._pages=A,m._heading_path=v;}else {b&&(c._occurrences_modified=(c._occurrences_modified||0)+1);let[v,N]=this._get_heading_path_and_page(f,this.mapper.full_text,n),A=c._pages||[];A.includes(N)||A.unshift(N),c._pages=A,c._heading_path=v;}}else {let m=`- Failed to apply edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(m),c._applied_status=false,c._error_msg=m,c._any_sub_failure=true;let v=c._parent_edit_ref;v&&(v._any_sub_failure=true,v._applied_status||(v._applied_status=false,v._error_msg=m));}}let a=0,u=0;for(let c of e){if(typeof c!="object"||c===null){u++;continue}c._applied_status&&!c._any_sub_failure?a++:u++;}return [a,u]}_paragraph_has_visible_content(e){for(let n of ["w:t","w:tab","w:br"]){let r=I(e,n);for(let s of r){let i=false,o=s.parentNode;for(;o&&o!==e.parentNode;){if(o.tagName==="w:del"){i=true;break}o=o.parentNode;}if(!i){if(n==="w:t"&&!s.textContent)continue;return true}}}return false}_is_last_paragraph_in_cell(e){let n=e.parentNode;for(;n&&n.tagName!=="w:tc";)n=n.parentNode;return n?I(n,"w:p").length<=1:false}_get_paired_nodes(e){let n=[],r=e.getAttribute("w:author"),s=new Set(["w:commentRangeStart","w:commentRangeEnd","w:commentReference","w:rPr","w:pPr"]),i=new Set,o=y(d=>{let f=d.getAttribute("w:id");f&&i.add(f);},"add_id");o(e);let l=y(d=>{let f=d;for(;f&&f.tagName!=="w:p";)f=f.parentNode;return f},"paragraph_of"),a=y(d=>{let f=M(d,"w:pPr"),h=f?M(f,"w:rPr"):null;return h?M(h,"w:ins"):null},"mark_of"),u=y(d=>{let f=a(d);if(!f||f.getAttribute("w:author")!==r)return false;let h=f.getAttribute("w:id");return h!==null&&i.has(h)},"boundary_is_ours"),c=y((d,f)=>{let h=l(d),p=f==="next"?d.nextSibling:d.previousSibling;for(;;){if(!p){if(!h)break;if(f==="next"){let g=ve(h);for(;g&&g.tagName!=="w:p";)g=ve(g);if(!g||!u(g))break;h=g,p=g.firstChild;}else {if(!u(h))break;let g=Ee(h);for(;g&&g.tagName!=="w:p";)g=Ee(g);if(!g)break;h=g,p=g.lastChild;}continue}if(p.nodeType!==1){p=f==="next"?p.nextSibling:p.previousSibling;continue}let _=p;if(s.has(_.tagName)){p=f==="next"?p.nextSibling:p.previousSibling;continue}if((_.tagName==="w:ins"||_.tagName==="w:del")&&_.getAttribute("w:author")===r){n.push(_),o(_),p=f==="next"?p.nextSibling:p.previousSibling;continue}break}},"walk");return c(e,"next"),c(e,"prev"),n}_resolution_group_ids(e){let n=[...I(this.doc.element,"w:ins"),...I(this.doc.element,"w:del")].filter(s=>s.getAttribute("w:id")===e),r=new Set;if(n.length===0)return I(this.doc.element,"w:pPrChange").some(i=>i.getAttribute("w:id")===e)&&r.add(e),r;r.add(e);for(let s of n)for(let i of this._get_paired_nodes(s)){let o=i.getAttribute("w:id");o&&r.add(o);}return r}validate_action_pairing(e){let n=[],r=new Map;for(let s=0;s<e.length;s++){let i=e[s];if(i.type!=="accept"&&i.type!=="reject")continue;let o=String(i.target_id??"");if(o.startsWith("Com:"))continue;let l=o.startsWith("Chg:")?o.slice(4):o,a=this._resolution_group_ids(l);if(a.size===0)continue;let u=null;for(let c of a){let d=r.get(c);if(d!==void 0&&d[1]!==i.type){u=d;break}}if(u!==null){let[c,d,f]=u;n.push(`- Action ${s+1} Failed: conflicting actions on one replacement \u2014 Action ${c+1} applies '${d}' to Chg:${f}, and Chg:${l} is part of the same change (a replacement's contiguous del+ins pair resolves as one unit, so '${d}' already decides both sides). Accepting one side and rejecting the other is contradictory \u2014 decide the outcome and submit exactly one action for the pair.`);continue}for(let c of a)r.has(c)||r.set(c,[s,i.type,l]);}return n}_buildRevisionIndex(e,n){let r=new Map;for(let u of nr)r.set(u,[]);let i=[this.doc.element],o=[0],l=[],a=[];for(;i.length;){let u=i.length-1,c=i[u].childNodes;if(!c||o[u]>=c.length){for(i.pop(),o.pop();a.length&&a[a.length-1]>i.length;)a.pop(),l.pop();continue}let d=c[o[u]++];if(d.nodeType!==1)continue;let f=r.get(d.tagName),h=null;f&&(h={el:d,id:d.getAttribute("w:id"),nested:[]},f.push(h));let p=d.tagName==="w:ins"||d.tagName==="w:del";if(h&&p)for(let _ of l)_.nested.push(h);i.push(d),o.push(0),h&&p&&(l.push(h),a.push(i.length));}return {doc:e,inc:n,byTag:r}}_getRevisionIndex(){let e=this.doc.element.ownerDocument,n=typeof e?._inc=="number"?e._inc:null,r=this._revisionIndex;if(r&&r.doc===e&&n!==null&&r.inc===n)return r;let s=this._buildRevisionIndex(e,n);return this._revisionIndex=s,s}_revisionsByTag(e){return this._getRevisionIndex().byTag.get(e)??[]}_existing_change_ids(){let e=new Set;for(let n of nr)for(let r of this._revisionsByTag(n))r.id&&e.add(r.id);return Array.from(e).sort((n,r)=>{let s=/^\d+$/.test(n)?parseInt(n,10):0,i=/^\d+$/.test(r)?parseInt(r,10):0;return s-i||n.localeCompare(r)})}_existing_comment_ids(){let e=[];try{e=Object.keys(Xe(this.doc.pkg));}catch{e=[];}return e.sort((n,r)=>{let s=/^\d+$/.test(n)?parseInt(n,10):0,i=/^\d+$/.test(r)?parseInt(r,10):0;return s-i||n.localeCompare(r)})}static _format_id_list(e,n,r=20){let s=e.slice(0,r),i=s.map(o=>`${n}${o}`).join(", ");return e.length>s.length&&(i+=`, \u2026 (+${e.length-s.length} more)`),i}_action_not_found_error(e,n,r="- Failed to apply action:"){let s=this._existing_change_ids(),i=this._existing_comment_ids(),o=e.startsWith("Chg:")||e.startsWith("Com:"),l=e.replace(/^(Chg:|Com:)/,""),a="Call `read_docx` on the document again to list the current change (Chg:) and comment (Com:) ids \u2014 ids shift between document states.";if(n==="reply"){let d=o?e:`Com:${l}`;if(s.includes(l))return `${r} reply on ${d} \u2014 Chg:${l} is a tracked-change id, not a comment. \`reply\` adds to an existing comment thread (Com:\u2026); to comment on a change instead, apply a modify with a \`comment\`. ${a}`;let f=i.length>0?`Comment ids in this document: ${V._format_id_list(i,"Com:")}. `:"This document has no comments to reply to. ";return `${r} reply on ${d} \u2014 no comment with that id exists. ${f}${a}`}let u=o?e:`Chg:${l}`;if(i.includes(l))return `${r} ${n} on ${u} \u2014 Com:${l} is a comment id, not a tracked change. accept/reject act on tracked changes (Chg:\u2026); to respond to a comment use \`reply\`. ${a}`;let c=s.length>0?`Tracked-change ids in this document: ${V._format_id_list(s,"Chg:")}. `:"This document has no tracked changes. ";return `${r} ${n} on ${u} \u2014 no tracked change with that id exists (it may already have been accepted or rejected, or the id is stale). ${c}${a}`}apply_review_actions(e){let n=0,r=0,s=0,i=new Map,o=e.map((l,a)=>({action:l,pos:a})).sort((l,a)=>{let u=l.action.type==="reply"?0:1,c=a.action.type==="reply"?0:1;return u!==c?u-c:l.pos-a.pos});for(let{action:l,pos:a}of o){let u=l.type;if(u==="reply"){let x=l.target_id.replace("Com:",""),E=this.comments_manager.addComment(this.author,l.text,x);this._anchor_reply_comment(x,E),n++;continue}let c=l.target_id.replace("Chg:",""),d=i.get(c);if(d!==void 0){if(d===u){s++,this.skipped_details.push(`- Note: Action ${a+1} ('${u}' on ${l.target_id}) had no additional effect \u2014 the change was already resolved together with its replacement pair by an earlier action in this batch. Counted as already_resolved, not applied.`);continue}this.skipped_details.push(`- Action ${a+1} Failed: contradictory action \u2014 '${u}' on ${l.target_id}, but the change was already resolved as '${d}' together with its replacement pair by an earlier action in this batch.`),r++;continue}let f=this._revisionsByTag("w:ins").filter(x=>x.id===c).map(x=>x.el),h=this._revisionsByTag("w:del").filter(x=>x.id===c).map(x=>x.el),p=[...f,...h],_=en.flatMap(x=>this._revisionsByTag(x).filter(E=>E.id===c).map(E=>E.el));if(p.length===0&&_.length===0){r++,this.skipped_details.push(this._action_not_found_error(l.target_id,u));continue}let g=Array.from(new Set([...p,..._].map(x=>x.getAttribute("w:author")||"Unknown"))).sort();if(g.length>1){r++,this.skipped_details.push(`- Failed to apply action: ${u} on Chg:${c} is ambiguous. The document contains ${p.length} tracked-change elements sharing w:id=${c} from different authors (${g.join(", ")}) \u2014 duplicate revision IDs produced outside this engine (e.g. by a document merge or copy-paste). Acting on this ID would resolve all of them at once. Resolve these changes individually in Word, or apply the intended outcome as an explicit text edit instead.`);continue}let w=new Set([c]);for(let x of p)for(let E of this._get_paired_nodes(x)){let T=E.getAttribute("w:id");T&&w.add(T);}let k=Kt.flatMap(x=>this._revisionsByTag(x)),b=-1;for(;b!==w.size;){b=w.size;for(let x of k)if(!(!x.id||!w.has(x.id)))for(let E of x.nested)E.id&&w.add(E.id);}let m=[];for(let x of Kt)for(let E of this._revisionsByTag(x))E.id&&w.has(E.id)&&m.push(E.el);let v=en.flatMap(x=>this._revisionsByTag(x).filter(E=>E.id!==null&&w.has(E.id)).map(E=>E.el)),N=new Set;for(let x of [...m,...v]){let E=x.getAttribute("w:id");E&&N.add(E);}let A=new Set(this._existing_comment_ids()),C=[];for(let x of m){let E=x.tagName==="w:ins",T=x.parentNode?x.parentNode.tagName:"",D=T==="w:trPr",P=E&&T==="w:rPr"&&!!x.parentNode?.parentNode&&x.parentNode.parentNode.tagName==="w:pPr";if(u==="accept")if(E)if(D)x.parentNode?.removeChild(x);else {for(;x.firstChild;)x.parentNode?.insertBefore(x.firstChild,x);x.parentNode?.removeChild(x);}else if(this._clean_wrapping_comments(x),this._delete_comments_in_element(x),D){let R=x.parentNode?.parentNode;R?.parentNode?.removeChild(R);}else x.parentNode?.removeChild(x);else if(u==="reject")if(E){if(P){let R=x.parentNode;x.parentNode?.removeChild(x),R=R?.parentNode,R=R?.parentNode,R&&R.tagName==="w:p"&&C.push(R);continue}if(this._clean_wrapping_comments(x),this._delete_comments_in_element(x),D){let R=x.parentNode?.parentNode;R?.parentNode?.removeChild(R);}else x.parentNode?.removeChild(x);}else if(D)x.parentNode?.removeChild(x);else {let R=Array.from(x.getElementsByTagName("w:delText"));for(let $ of R){let S=$.ownerDocument.createElement("w:t");S.textContent=$.textContent,$.hasAttribute("xml:space")&&S.setAttribute("xml:space","preserve"),$.parentNode?.replaceChild(S,$);}for(;x.firstChild;)x.parentNode?.insertBefore(x.firstChild,x);x.parentNode?.removeChild(x);}}for(let x of C.reverse()){if(!x.parentNode)continue;let E=Ee(x);for(;E&&E.tagName!=="w:p";)E=Ee(E);if(E){for(let T of Array.from(x.childNodes))T.nodeType===1&&T.tagName==="w:pPr"||E.appendChild(T);x.parentNode.removeChild(x);}}for(let x of v)u==="accept"?x.parentNode?.removeChild(x):x.tagName==="w:pPrChange"?this._revert_ppr_change(x):this._revert_props_change(x);for(let x of N)i.set(x,u);if(n++,A.size>0){let x=new Set(this._existing_comment_ids()),E=Array.from(A).filter(T=>!x.has(T));if(E.length>0){let T=E.sort((D,P)=>{let R=/^\d+$/.test(D)?parseInt(D,10):0,$=/^\d+$/.test(P)?parseInt(P,10):0;return R-$||D.localeCompare(P)}).map(D=>`Com:${D}`).join(", ");this.skipped_details.push(`- Note: ${u} on ${l.target_id} also removed comment ${T} (including any reply thread) because its anchor was inside the resolved change. This note is informational \u2014 the action itself succeeded.`);}}}return [n,r,s]}_apply_table_edit(e,n){let r=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,s=e._active_mapper_ref||this.mapper,[i,o]=s.get_insertion_anchor(r,n),l=null;if(i?l=i._element:o&&(l=o._element),!l)return false;let a=l;for(;a&&a.tagName!=="w:tr";)a=a.parentNode;if(!a)return false;let u=(e._reserved_row_id??null)!==null?String(e._reserved_row_id):null;if(e.type==="delete_row"){let c=M(a,"w:trPr");return c||(c=a.ownerDocument.createElement("w:trPr"),a.insertBefore(c,a.firstChild)),c.appendChild(this._create_track_change_tag("w:del","",u)),true}else if(e.type==="insert_row"){let c=a.ownerDocument.createElement("w:tr"),d=a.ownerDocument.createElement("w:trPr");c.appendChild(d),d.appendChild(this._create_track_change_tag("w:ins","",u));let f=I(a,"w:tc").filter(p=>p.parentNode===a).length,h=Array.isArray(e.cells)?[...e.cells]:[];if(f>0){for(;h.length<f;)h.push("");h=h.slice(0,f);}for(let p of h){let _=a.ownerDocument.createElement("w:tc"),g=a.ownerDocument.createElement("w:p"),w=a.ownerDocument.createElement("w:r"),k=a.ownerDocument.createElement("w:t");k.textContent=p,p.trim()!==p&&k.setAttribute("xml:space","preserve"),w.appendChild(k),g.appendChild(w),_.appendChild(g),c.appendChild(_);}return e.position==="above"?a.parentNode?.insertBefore(c,a):Le(c,a),true}return false}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let n=e.regex||false,r=e.match_mode||"strict",s=this.mapper.drop_virtual_only_matches(this.mapper.find_all_match_indices(e.target_text,n)),i=false;if(s.length===0)if(this.clean_mapper||(this.clean_mapper=new ke(this.doc,true)),s=this.clean_mapper.drop_virtual_only_matches(this.clean_mapper.find_all_match_indices(e.target_text,n)),s.length>0)i=true;else return null;let o=i?this.clean_mapper:this.mapper,l=[];for(let[u,c]of s){let d=o.spans.filter(f=>f.run!==null&&f.end>u&&f.start<u+c);(d.length===0||d.some(f=>!f.del_id))&&l.push([u,c]);}if(l.length===0)return null;(r==="strict"||r==="first")&&(l=l.slice(0,1));let a=[];for(let[u,c]of l){let d=o.full_text.substring(u,u+c),f=e.new_text||"";if(/^\{#cell:[^}]+\}$/.test(d.trim())){let E=f;E=E.split(d.trim()).join("");let T=o.spans.find(D=>D.start<=u&&u<D.end&&D.paragraph!==null);if(T&&E){let D=o.spans.filter(P=>P.end<=u&&P.run!==null&&P.paragraph!==null&&P.paragraph._element===T.paragraph._element).map(P=>P.text).join("");if(D){for(let P of [D,D.replace(/\s+$/,"")])if(P&&E.startsWith(P)){E=E.substring(P.length).replace(/^\s+/,"");break}E&&!/\s$/.test(D)&&!/^\s/.test(E)&&(E=" "+E);}}E?a.push({type:"modify",target_text:"",new_text:E,comment:e.comment,_match_start_index:u,_internal_op:"INSERTION",_active_mapper_ref:o}):e.comment&&a.push({type:"modify",target_text:"",new_text:"",comment:e.comment,_match_start_index:u,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}if(n&&f){try{f=d.replace(new RegExp(e.target_text),f);}catch{}V._flag_surviving_python_backreference(e,f);}e._preview_span||(e._preview_span=[u,c],e._preview_matched_text=d,e._preview_new_text=f,e._preview_mapper_ref=o);let[h,p]=this._parse_markdown_style(e.target_text),[_,g]=this._parse_markdown_style(f);if(p!==g){let[E]=this._parse_markdown_style(d),T=E,D=_,P=T===D?"STYLE_ONLY":"STYLE_AND_TEXT",R=d.indexOf(E),$=u+(R!==-1?R:0),S=g!==null?g:"Normal";a.push({type:"modify",target_text:T,new_text:D,comment:e.comment,_match_start_index:$,_internal_op:P,_new_style:S,_active_mapper_ref:o});continue}if(d===f||e.target_text===f){a.push({type:"modify",target_text:d,new_text:d,comment:e.comment,_match_start_index:u,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}let w=false;if(o&&(w=o.spans.some(E=>E.text===" | "&&(E.run===null||E.run===void 0)&&E.start<u+c&&E.end>u)),w){let E=d.split("|"),T=f.split("|");if(E.length!==T.length)throw new pt([`Target text spans ${E.length} table cells, but replacement provides ${T.length}. To modify text without altering table structure (rows or columns), ensure the replacement contains the exact same number of '|' separators (e.g., replace with 'CellC | ' to empty the second cell).`]);if(E.length>1){let D=[],P=0,R=0;for(let $=0;$<E.length;$++)if(E[$].trim()!==T[$].trim()){R=$;break}for(let $=0;$<E.length;$++){let S=E[$],j=T[$],F=S.trim(),B=j.trim(),L=u+P+(F?S.indexOf(F):0),U=e.comment!==null&&e.comment!==void 0&&$===R;if(F!==B||U){let Y=this._word_diff_sub_edits(F,B,L,U?e.comment:null,true,o);for(let X of Y)X._original_target_text=e.target_text,X._split_group_id=u,D.push(X);}P+=S.length+1;}for(let $ of D)a.push($);continue}}let k=false;e.target_text&&(e.target_text.includes("**")||e.target_text.includes("_"))&&(k=true),f&&(f.includes("**")||f.includes("_"))&&(k=true);let b="",m="",v="",N=u;if(f.startsWith(d))b="INSERTION",v=f.substring(d.length),N=u+c;else {let[E,T]=Ue(d,f),D=d.length-T,P=f.length-T;m=d.substring(E,D),v=f.substring(E,P),N=u+E;}if(k){if(!m&&v)b="INSERTION";else if(m&&!v)b="DELETION";else if(m&&v)b="MODIFICATION";else {a.push({type:"modify",target_text:m,new_text:v,comment:e.comment,_match_start_index:N,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}a.push({type:"modify",target_text:m,new_text:v,comment:e.comment,_resolved_start_idx:N,_match_start_index:N,_internal_op:b,_active_mapper_ref:o});continue}let A=d.split(`
115
115
 
116
116
  `),C=f.split(`
117
117
 
@@ -1 +1 @@
1
- {"inputs":{"nodes/Adeu/GenericFunctions.ts":{"bytes":17199,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytes":8420,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"shims/module.js":{"bytes":224,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/fflate/esm/index.mjs":{"bytes":91765,"imports":[{"path":"shims/module.js","kind":"import-statement","original":"module"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"../../node_modules/diff-match-patch/index.js":{"bytes":78052,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../core/dist/index.js":{"bytes":435170,"imports":[{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"../../node_modules/diff-match-patch/index.js","kind":"import-statement","original":"diff-match-patch"},{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytes":5728,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/extractOutline.operation.ts":{"bytes":3053,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytes":12374,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytes":10363,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytes":8501,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/index.ts":{"bytes":7045,"imports":[{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/extractOutline.operation.ts","kind":"import-statement","original":"./extractOutline.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./finalizeDocument.operation"},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./hydrateToolOutput.operation"}],"format":"esm"},"nodes/Adeu/Adeu.node.ts":{"bytes":6827,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./descriptions/hydrateToolOutput.operation"},{"path":"nodes/Adeu/descriptions/index.ts","kind":"import-statement","original":"./descriptions"},{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./descriptions/extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/extractOutline.operation.ts","kind":"import-statement","original":"./descriptions/extractOutline.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./descriptions/applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./descriptions/generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./descriptions/finalizeDocument.operation"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"./GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/nodes/Adeu/Adeu.node.js":{"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true}],"exports":["Adeu"],"entryPoint":"nodes/Adeu/Adeu.node.ts","inputs":{"shims/module.js":{"bytesInOutput":121},"../../node_modules/diff-match-patch/index.js":{"bytesInOutput":19270},"nodes/Adeu/Adeu.node.ts":{"bytesInOutput":4265},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytesInOutput":5292},"nodes/Adeu/GenericFunctions.ts":{"bytesInOutput":7586},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytesInOutput":3371},"../../node_modules/fflate/esm/index.mjs":{"bytesInOutput":13273},"../core/dist/index.js":{"bytesInOutput":194212},"nodes/Adeu/descriptions/extractOutline.operation.ts":{"bytesInOutput":1224},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytesInOutput":7871},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytesInOutput":5668},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytesInOutput":5496},"nodes/Adeu/descriptions/index.ts":{"bytesInOutput":5190}},"bytes":273449}}}
1
+ {"inputs":{"nodes/Adeu/GenericFunctions.ts":{"bytes":17199,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytes":8420,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"shims/module.js":{"bytes":224,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/fflate/esm/index.mjs":{"bytes":91765,"imports":[{"path":"shims/module.js","kind":"import-statement","original":"module"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"../../node_modules/diff-match-patch/index.js":{"bytes":78052,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../core/dist/index.js":{"bytes":436034,"imports":[{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"../../node_modules/diff-match-patch/index.js","kind":"import-statement","original":"diff-match-patch"},{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytes":5728,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/extractOutline.operation.ts":{"bytes":3053,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytes":12374,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytes":10363,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytes":8501,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/index.ts":{"bytes":7045,"imports":[{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/extractOutline.operation.ts","kind":"import-statement","original":"./extractOutline.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./finalizeDocument.operation"},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./hydrateToolOutput.operation"}],"format":"esm"},"nodes/Adeu/Adeu.node.ts":{"bytes":6827,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./descriptions/hydrateToolOutput.operation"},{"path":"nodes/Adeu/descriptions/index.ts","kind":"import-statement","original":"./descriptions"},{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./descriptions/extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/extractOutline.operation.ts","kind":"import-statement","original":"./descriptions/extractOutline.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./descriptions/applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./descriptions/generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./descriptions/finalizeDocument.operation"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"./GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/nodes/Adeu/Adeu.node.js":{"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true}],"exports":["Adeu"],"entryPoint":"nodes/Adeu/Adeu.node.ts","inputs":{"shims/module.js":{"bytesInOutput":121},"../../node_modules/diff-match-patch/index.js":{"bytesInOutput":19270},"nodes/Adeu/Adeu.node.ts":{"bytesInOutput":4265},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytesInOutput":5292},"nodes/Adeu/GenericFunctions.ts":{"bytesInOutput":7586},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytesInOutput":3371},"../../node_modules/fflate/esm/index.mjs":{"bytesInOutput":13273},"../core/dist/index.js":{"bytesInOutput":194373},"nodes/Adeu/descriptions/extractOutline.operation.ts":{"bytesInOutput":1224},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytesInOutput":7871},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytesInOutput":5668},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytesInOutput":5496},"nodes/Adeu/descriptions/index.ts":{"bytesInOutput":5190}},"bytes":273610}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-adeu",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "n8n community node for Adeu — apply AI-driven tracked changes, generate diffs, and sanitize Microsoft Word (.docx) documents.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -49,13 +49,13 @@
49
49
  "n8n-workflow": "*"
50
50
  },
51
51
  "devDependencies": {
52
- "@adeu/core": "^2.0.0",
53
- "@n8n/eslint-plugin-community-nodes": "^0.27.0",
52
+ "@adeu/core": "^2.1.0",
53
+ "@n8n/eslint-plugin-community-nodes": "^0.28.0",
54
54
  "@types/node": "^26.1.2",
55
- "@typescript-eslint/parser": "^8.65.0",
55
+ "@typescript-eslint/parser": "^8.66.0",
56
56
  "copyfiles": "^2.4.1",
57
57
  "eslint": "^10.8.0",
58
- "n8n-workflow": "^2.33.0",
58
+ "n8n-workflow": "^2.34.1",
59
59
  "tsup": "^8.5.1",
60
60
  "typescript": "^7.0.2",
61
61
  "vitest": "^4.1.10"