@eigenpal/docx-editor-agents 0.4.2 → 0.4.3

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.
@@ -1,5 +1,5 @@
1
- 'use strict';var chunkYGNXQ76O_js=require('./chunk-YGNXQ76O.js');function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(chunkYGNXQ76O_js.Q(o)):o.type==="hyperlink"&&n.push(chunkYGNXQ76O_js.R(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return chunkYGNXQ76O_js.ba(e)?{type:"heading",index:n,paraId:a,level:chunkYGNXQ76O_js.ca(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
1
+ 'use strict';var chunkOVPN5UGH_js=require('./chunk-OVPN5UGH.js');function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(chunkOVPN5UGH_js.Q(o)):o.type==="hyperlink"&&n.push(chunkOVPN5UGH_js.R(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return chunkOVPN5UGH_js.ba(e)?{type:"heading",index:n,paraId:a,level:chunkOVPN5UGH_js.ca(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
2
2
  `)),c.push(p);}r.push(i),e.push(c);}return {type:"table",index:n,rows:r,cellParaIds:e}}function Y(s){let n=[],o=t=>t.paraId?t.paraId:String(t.index);for(let t of s)switch(t.type){case "heading":n.push(`[${o(t)}] (h${t.level}) ${t.text}`);break;case "paragraph":n.push(`[${o(t)}] ${t.text}`);break;case "list-item":{let r=" ".repeat(t.listLevel),e=t.listType==="bullet"?"\u2022":"-";n.push(`[${o(t)}] ${r}${e} ${t.text}`);break}case "table":{let r=t.index;for(let e=0;e<t.rows.length;e++)for(let a=0;a<t.rows[e].length;a++){let c=t.rows[e][a].split(`
3
3
  `),l=t.cellParaIds?.[e]?.[a];for(let u=0;u<c.length;u++){let p=u===0&&l?l:String(r);n.push(`[${p}] (table, row ${e+1}, col ${a+1}) ${c[u]}`),r++;}}break}}return n.join(`
4
- `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(chunkYGNXQ76O_js.Q(e));else if(e.type==="hyperlink")t.push(chunkYGNXQ76O_js.R(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=chunkYGNXQ76O_js.Q(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=chunkYGNXQ76O_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=chunkYGNXQ76O_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=chunkYGNXQ76O_js.Q(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=chunkYGNXQ76O_js.Q(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=chunkYGNXQ76O_js.Q(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
5
- `)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=chunkYGNXQ76O_js.Q(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(chunkYGNXQ76O_js.Q).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=h;exports.b=K;exports.c=R;exports.d=V;exports.e=Y;exports.f=y;exports.g=M;exports.h=F;exports.i=G;exports.j=te;exports.k=se;exports.l=ae;exports.m=ce;
4
+ `)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(chunkOVPN5UGH_js.Q(e));else if(e.type==="hyperlink")t.push(chunkOVPN5UGH_js.R(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=chunkOVPN5UGH_js.Q(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=chunkOVPN5UGH_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=chunkOVPN5UGH_js.Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=chunkOVPN5UGH_js.Q(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=chunkOVPN5UGH_js.Q(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=chunkOVPN5UGH_js.Q(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
5
+ `)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=chunkOVPN5UGH_js.Q(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(chunkOVPN5UGH_js.Q).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=h;exports.b=K;exports.c=R;exports.d=V;exports.e=Y;exports.f=y;exports.g=M;exports.h=F;exports.i=G;exports.j=te;exports.k=se;exports.l=ae;exports.m=ce;
@@ -1 +1 @@
1
- export{Fa as DEFAULT_AI_ACTIONS,G as DocumentAgent,Ha as VERSION,i as attemptSelectiveSave,wa as blendColors,N as buildExtendedSelectionContext,h as buildPatchedDocumentXml,M as buildSelectionContext,K as buildSelectionContextFromContext,xa as colorsEqual,Ca as comparePositions,V as countCharacters,U as countWords,H as createAgent,I as createAgentFromDocument,za as createCollapsedRange,Ga as createCommand,ka as createDocumentWithText,f as createDocx,ja as createEmptyDocument,Aa as createRange,ta as createRgbColor,sa as createThemeColor,ua as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,y as emuToPixels,A as emuToTwips,n as extractVariablesFromText,E as formatPx,r as formatVariable,Ea as getActionDescription,Da as getActionLabel,J as getAgentContext,ia as getBlockIndexForParagraph,X as getBodyCharacterCount,T as getBodyText,W as getBodyWordCount,qa as getContrastingColor,L as getDocumentSummary,_ as getFormattingAtPosition,aa as getHyperlinkAtPosition,R as getHyperlinkText,ha as getParagraphAtIndex,P as getParagraphText,ga as getParagraphs,Q as getRunText,O as getSelectionFormattingSummary,S as getTableText,Z as getTextAfter,Y as getTextBefore,D as halfPointsToPixels,ea as hasHyperlinks,da as hasImages,fa as hasTables,o as hasTemplateVariables,oa as isBlack,ba as isHeadingStyle,$ as isPositionInHyperlink,Ba as isPositionInRange,p as isValidVariableName,pa as isWhite,ya as isZodSchema,va as lightenColor,ra as parseColorString,F as parseDocx,ca as parseHeadingLevel,s as parseVariable,z as pixelsToEmu,x as pixelsToTwips,C as pointsToPixels,u as removeVariables,d as repackDocx,t as replaceVariables,la as resolveColor,ma as resolveHighlightColor,na as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,B as twipsToEmu,w as twipsToPixels,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-N2D5VYS3.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-UILTIEBD.mjs';export{a as PluginRegistry,d as createPluginRegistrar,e as executeCommand,f as executeCommands,b as pluginRegistry,c as registerPlugins}from'./chunk-X57U3ESM.mjs';
1
+ export{Fa as DEFAULT_AI_ACTIONS,G as DocumentAgent,Ha as VERSION,i as attemptSelectiveSave,wa as blendColors,N as buildExtendedSelectionContext,h as buildPatchedDocumentXml,M as buildSelectionContext,K as buildSelectionContextFromContext,xa as colorsEqual,Ca as comparePositions,V as countCharacters,U as countWords,H as createAgent,I as createAgentFromDocument,za as createCollapsedRange,Ga as createCommand,ka as createDocumentWithText,f as createDocx,ja as createEmptyDocument,Aa as createRange,ta as createRgbColor,sa as createThemeColor,ua as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,y as emuToPixels,A as emuToTwips,n as extractVariablesFromText,E as formatPx,r as formatVariable,Ea as getActionDescription,Da as getActionLabel,J as getAgentContext,ia as getBlockIndexForParagraph,X as getBodyCharacterCount,T as getBodyText,W as getBodyWordCount,qa as getContrastingColor,L as getDocumentSummary,_ as getFormattingAtPosition,aa as getHyperlinkAtPosition,R as getHyperlinkText,ha as getParagraphAtIndex,P as getParagraphText,ga as getParagraphs,Q as getRunText,O as getSelectionFormattingSummary,S as getTableText,Z as getTextAfter,Y as getTextBefore,D as halfPointsToPixels,ea as hasHyperlinks,da as hasImages,fa as hasTables,o as hasTemplateVariables,oa as isBlack,ba as isHeadingStyle,$ as isPositionInHyperlink,Ba as isPositionInRange,p as isValidVariableName,pa as isWhite,ya as isZodSchema,va as lightenColor,ra as parseColorString,F as parseDocx,ca as parseHeadingLevel,s as parseVariable,z as pixelsToEmu,x as pixelsToTwips,C as pointsToPixels,u as removeVariables,d as repackDocx,t as replaceVariables,la as resolveColor,ma as resolveHighlightColor,na as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,B as twipsToEmu,w as twipsToPixels,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-PNONETA3.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-UILTIEBD.mjs';export{a as PluginRegistry,d as createPluginRegistrar,e as executeCommand,f as executeCommands,b as pluginRegistry,c as registerPlugins}from'./chunk-X57U3ESM.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkOVPN5UGH_js=require('./chunk-OVPN5UGH.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunk2AF2FRMM_js=require('./chunk-2AF2FRMM.js');Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Fa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkOVPN5UGH_js.G}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ha}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkOVPN5UGH_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkOVPN5UGH_js.wa}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.N}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkOVPN5UGH_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.M}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.K}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkOVPN5UGH_js.xa}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ca}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkOVPN5UGH_js.V}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkOVPN5UGH_js.U}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkOVPN5UGH_js.H}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkOVPN5UGH_js.I}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkOVPN5UGH_js.za}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ga}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ka}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ja}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Aa}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ta}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.sa}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ua}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkOVPN5UGH_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkOVPN5UGH_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkOVPN5UGH_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.v}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.y}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkOVPN5UGH_js.A}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.n}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.E}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkOVPN5UGH_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ea}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Da}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkOVPN5UGH_js.J}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ia}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkOVPN5UGH_js.X}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.T}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkOVPN5UGH_js.W}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.qa}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkOVPN5UGH_js.L}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkOVPN5UGH_js._}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkOVPN5UGH_js.aa}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.R}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ha}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.P}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ga}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Q}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkOVPN5UGH_js.O}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkOVPN5UGH_js.S}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Z}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Y}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.D}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ea}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkOVPN5UGH_js.da}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.fa}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkOVPN5UGH_js.oa}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ba}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkOVPN5UGH_js.$}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkOVPN5UGH_js.Ba}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkOVPN5UGH_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkOVPN5UGH_js.pa}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ya}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.va}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ra}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.F}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ca}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkOVPN5UGH_js.s}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkOVPN5UGH_js.z}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkOVPN5UGH_js.x}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.C}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkOVPN5UGH_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.la}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.ma}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkOVPN5UGH_js.na}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkOVPN5UGH_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkOVPN5UGH_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkOVPN5UGH_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkOVPN5UGH_js.a}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkOVPN5UGH_js.B}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkOVPN5UGH_js.w}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkOVPN5UGH_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkOVPN5UGH_js.g}});Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunk4QRVKNI4_js.j}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunk4QRVKNI4_js.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunk4QRVKNI4_js.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunk4QRVKNI4_js.i}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunk4QRVKNI4_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunk4QRVKNI4_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.f}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunk2AF2FRMM_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunk2AF2FRMM_js.d}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunk2AF2FRMM_js.e}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunk2AF2FRMM_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk2AF2FRMM_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk2AF2FRMM_js.c}});
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-BSfB_XXk.mjs';
2
- export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-BSfB_XXk.mjs';
1
+ import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-CLaXsEC8.mjs';
2
+ export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-CLaXsEC8.mjs';
3
3
 
4
4
  /**
5
5
  * Error classes for @eigenpal/docx-editor-agents
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-BSfB_XXk.js';
2
- export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-BSfB_XXk.js';
1
+ import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-CLaXsEC8.js';
2
+ export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-CLaXsEC8.js';
3
3
 
4
4
  /**
5
5
  * Error classes for @eigenpal/docx-editor-agents
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunk6QGKIBSG_js=require('./chunk-6QGKIBSG.js'),chunk7SW3TY3Y_js=require('./chunk-7SW3TY3Y.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunk6QGKIBSG_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunk7SW3TY3Y_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunk7SW3TY3Y_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunk7SW3TY3Y_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunk7SW3TY3Y_js.m}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
1
+ 'use strict';var chunkMREPAMXX_js=require('./chunk-MREPAMXX.js'),chunkYCUXBRD7_js=require('./chunk-YCUXBRD7.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkMREPAMXX_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkYCUXBRD7_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkYCUXBRD7_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkYCUXBRD7_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkYCUXBRD7_js.m}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{a as DocxReviewer}from'./chunk-JS757ZB5.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-G32OWQRD.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
1
+ export{a as DocxReviewer}from'./chunk-H7HNGCMH.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-HSAYNLBS.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { v as EditorBridge } from './server-BSfB_XXk.mjs';
1
+ import { v as EditorBridge } from './server-CLaXsEC8.mjs';
2
2
 
3
3
  /**
4
4
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { v as EditorBridge } from './server-BSfB_XXk.js';
1
+ import { v as EditorBridge } from './server-CLaXsEC8.js';
2
2
 
3
3
  /**
4
4
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-BSfB_XXk.mjs';
2
- export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-BSfB_XXk.mjs';
1
+ import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-CLaXsEC8.mjs';
2
+ export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-CLaXsEC8.mjs';
3
3
 
4
4
  /**
5
5
  * useDocxAgentTools — wires the toolkit to a live DocxEditor for BYO chat
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-BSfB_XXk.js';
2
- export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-BSfB_XXk.js';
1
+ import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-CLaXsEC8.js';
2
+ export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-CLaXsEC8.js';
3
3
 
4
4
  /**
5
5
  * useDocxAgentTools — wires the toolkit to a live DocxEditor for BYO chat
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkP6EQWTU6_js=require('./chunk-P6EQWTU6.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react');function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=react.useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=react.useMemo(()=>{let t=r||s?chunkRI5S75JY_js.a.filter(e=>c(e.name)):chunkRI5S75JY_js.a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=react.useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=chunkP6EQWTU6_js.b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?chunkRI5S75JY_js.b(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=react.useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=chunkP6EQWTU6_js.b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}Object.defineProperty(exports,"useAgentChat",{enumerable:true,get:function(){return chunkP6EQWTU6_js.a}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});exports.useDocxAgentTools=S;
1
+ 'use strict';var chunkNLYXACTI_js=require('./chunk-NLYXACTI.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react');function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=react.useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=react.useMemo(()=>{let t=r||s?chunkRI5S75JY_js.a.filter(e=>c(e.name)):chunkRI5S75JY_js.a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=react.useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=chunkNLYXACTI_js.b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?chunkRI5S75JY_js.b(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=react.useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=chunkNLYXACTI_js.b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}Object.defineProperty(exports,"useAgentChat",{enumerable:true,get:function(){return chunkNLYXACTI_js.a}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});exports.useDocxAgentTools=S;
package/dist/react.mjs CHANGED
@@ -1 +1 @@
1
- import {b}from'./chunk-VN4NZFMM.mjs';export{a as useAgentChat}from'./chunk-VN4NZFMM.mjs';import {a,b as b$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useCallback,useMemo}from'react';function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=useMemo(()=>{let t=r||s?a.filter(e=>c(e.name)):a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?b$1(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}export{S as useDocxAgentTools};
1
+ import {b}from'./chunk-74RQEWM7.mjs';export{a as useAgentChat}from'./chunk-74RQEWM7.mjs';import {a,b as b$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useCallback,useMemo}from'react';function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=useMemo(()=>{let t=r||s?a.filter(e=>c(e.name)):a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?b$1(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}export{S as useDocxAgentTools};
@@ -1352,8 +1352,14 @@ interface Footnote {
1352
1352
  id: number;
1353
1353
  /** Special footnote type */
1354
1354
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1355
- /** Content */
1356
- content: Paragraph[];
1355
+ /**
1356
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
1357
+ * the body — paragraphs and tables. The parser previously only collected
1358
+ * <w:p> children which silently dropped any <w:tbl> inside a footnote;
1359
+ * widened to match HeaderFooter / TableCell shape so the body pipeline
1360
+ * (toProseDoc → toFlowBlocks) can render them uniformly.
1361
+ */
1362
+ content: (Paragraph | Table)[];
1357
1363
  }
1358
1364
  /**
1359
1365
  * Endnote (w:endnote)
@@ -1364,8 +1370,11 @@ interface Endnote {
1364
1370
  id: number;
1365
1371
  /** Special endnote type */
1366
1372
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1367
- /** Content */
1368
- content: Paragraph[];
1373
+ /**
1374
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
1375
+ * the body — paragraphs and tables. See note on `Footnote.content`.
1376
+ */
1377
+ content: (Paragraph | Table)[];
1369
1378
  }
1370
1379
  /**
1371
1380
  * Page orientation
@@ -1352,8 +1352,14 @@ interface Footnote {
1352
1352
  id: number;
1353
1353
  /** Special footnote type */
1354
1354
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1355
- /** Content */
1356
- content: Paragraph[];
1355
+ /**
1356
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
1357
+ * the body — paragraphs and tables. The parser previously only collected
1358
+ * <w:p> children which silently dropped any <w:tbl> inside a footnote;
1359
+ * widened to match HeaderFooter / TableCell shape so the body pipeline
1360
+ * (toProseDoc → toFlowBlocks) can render them uniformly.
1361
+ */
1362
+ content: (Paragraph | Table)[];
1357
1363
  }
1358
1364
  /**
1359
1365
  * Endnote (w:endnote)
@@ -1364,8 +1370,11 @@ interface Endnote {
1364
1370
  id: number;
1365
1371
  /** Special endnote type */
1366
1372
  noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1367
- /** Content */
1368
- content: Paragraph[];
1373
+ /**
1374
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
1375
+ * the body — paragraphs and tables. See note on `Footnote.content`.
1376
+ */
1377
+ content: (Paragraph | Table)[];
1369
1378
  }
1370
1379
  /**
1371
1380
  * Page orientation
package/dist/server.d.mts CHANGED
@@ -1 +1 @@
1
- export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-BSfB_XXk.mjs';
1
+ export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-CLaXsEC8.mjs';
package/dist/server.d.ts CHANGED
@@ -1 +1 @@
1
- export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-BSfB_XXk.js';
1
+ export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-CLaXsEC8.js';
package/dist/server.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunk6QGKIBSG_js=require('./chunk-6QGKIBSG.js'),chunk7SW3TY3Y_js=require('./chunk-7SW3TY3Y.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunk6QGKIBSG_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunk7SW3TY3Y_js.m}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
1
+ 'use strict';var chunkMREPAMXX_js=require('./chunk-MREPAMXX.js'),chunkYCUXBRD7_js=require('./chunk-YCUXBRD7.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkMREPAMXX_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkYCUXBRD7_js.m}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
package/dist/server.mjs CHANGED
@@ -1 +1 @@
1
- export{a as DocxReviewer}from'./chunk-JS757ZB5.mjs';export{m as createReviewerBridge}from'./chunk-G32OWQRD.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
1
+ export{a as DocxReviewer}from'./chunk-H7HNGCMH.mjs';export{m as createReviewerBridge}from'./chunk-HSAYNLBS.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/docx-editor-agents",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Agent-friendly API for DOCX document review — read, comment, propose changes, accept/reject tracked changes",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -101,6 +101,7 @@
101
101
  ],
102
102
  "author": "EigenPal",
103
103
  "license": "AGPL-3.0-or-later",
104
+ "homepage": "https://docx-editor.dev/",
104
105
  "repository": {
105
106
  "type": "git",
106
107
  "url": "https://github.com/eigenpal/docx-editor.git",