@eigenpal/docx-editor-agents 1.2.0 → 1.3.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.
Files changed (41) hide show
  1. package/dist/bridge.d.mts +1 -1
  2. package/dist/bridge.d.ts +1 -1
  3. package/dist/bridge.js +1 -1
  4. package/dist/bridge.mjs +1 -1
  5. package/dist/chunk-2OIX7TUX.mjs +75 -0
  6. package/dist/chunk-4W7OEW2I.js +75 -0
  7. package/dist/{chunk-DIXFGAF5.js → chunk-7PTBNHAH.js} +2 -2
  8. package/dist/chunk-LX3NJWKV.js +1 -0
  9. package/dist/chunk-NFAEIOLC.mjs +1 -0
  10. package/dist/chunk-P4DRISTP.mjs +5 -0
  11. package/dist/chunk-XUAUDUJU.js +5 -0
  12. package/dist/{chunk-HTU7NUTJ.mjs → chunk-YQIAKHOL.mjs} +2 -2
  13. package/dist/headless-ES4B5CTK.js +1 -0
  14. package/dist/headless-OEZEYHNL.mjs +1 -0
  15. package/dist/index.d.mts +14 -3
  16. package/dist/index.d.ts +14 -3
  17. package/dist/index.js +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/mcp.d.mts +1 -1
  20. package/dist/mcp.d.ts +1 -1
  21. package/dist/react.d.mts +2 -2
  22. package/dist/react.d.ts +2 -2
  23. package/dist/react.js +1 -1
  24. package/dist/react.mjs +1 -1
  25. package/dist/{server-uM9UUIhk.d.mts → server-BaVhdHCd.d.mts} +192 -11
  26. package/dist/{server-uM9UUIhk.d.ts → server-BaVhdHCd.d.ts} +192 -11
  27. package/dist/server.d.mts +1 -1
  28. package/dist/server.d.ts +1 -1
  29. package/dist/server.js +1 -1
  30. package/dist/server.mjs +1 -1
  31. package/dist/vue.js +6 -6
  32. package/dist/vue.mjs +72 -56
  33. package/package.json +1 -1
  34. package/dist/chunk-6KT5LOQB.mjs +0 -1
  35. package/dist/chunk-B3LQVYMR.js +0 -74
  36. package/dist/chunk-L7LXQOTH.mjs +0 -74
  37. package/dist/chunk-MHUG23P6.js +0 -5
  38. package/dist/chunk-MK47WH2X.mjs +0 -5
  39. package/dist/chunk-NSFRE2VK.js +0 -1
  40. package/dist/headless-6C4JSKYY.mjs +0 -1
  41. package/dist/headless-VGNLVFAJ.js +0 -1
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkMHUG23P6_js=require('./chunk-MHUG23P6.js');function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
- `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e){let t=u(n);return t?chunkMHUG23P6_js.e(chunkMHUG23P6_js.d(t,e)):""},getContent(e){let t=u(n);return t?chunkMHUG23P6_js.d(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=chunkMHUG23P6_js.l(t,e);if(r.length>0)return r;let l=n.getComments();if(l.length===0)return [];let a=new Map,g=[];for(let o of l)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?chunkMHUG23P6_js.k(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?chunkMHUG23P6_js.l(t):[],l=t?chunkMHUG23P6_js.k(t):[];try{e({commentCount:r.length,changeCount:l.length,comments:r,changes:l});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}exports.a=T;
1
+ 'use strict';var chunkXUAUDUJU_js=require('./chunk-XUAUDUJU.js');function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
+ `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e){let t=u(n);return t?chunkXUAUDUJU_js.e(chunkXUAUDUJU_js.d(t,e)):""},getContent(e){let t=u(n);return t?chunkXUAUDUJU_js.d(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=chunkXUAUDUJU_js.m(t,e);if(r.length>0)return r;let l=n.getComments();if(l.length===0)return [];let a=new Map,g=[];for(let o of l)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?chunkXUAUDUJU_js.l(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?chunkXUAUDUJU_js.m(t):[],l=t?chunkXUAUDUJU_js.l(t):[];try{e({commentCount:r.length,changeCount:l.length,comments:r,changes:l});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}exports.a=T;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkXUAUDUJU_js=require('./chunk-XUAUDUJU.js'),chunk4W7OEW2I_js=require('./chunk-4W7OEW2I.js');function g(n,e){let{paragraphIndex:t,author:o="AI",text:s,search:a}=e,r=chunkXUAUDUJU_js.b(n,t),i=(n.comments??[]).map(m=>m.id),p=i.length>0?Math.max(...i)+1:1,c={id:p,author:o,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(n.comments||(n.comments=[]),n.comments.push(c),a){let m=chunkXUAUDUJU_js.j(r,a,t);r.content.splice(m.endRunIndex+1,0,{type:"commentRangeEnd",id:p}),r.content.splice(m.startRunIndex,0,{type:"commentRangeStart",id:p});}else r.content.unshift({type:"commentRangeStart",id:p}),r.content.push({type:"commentRangeEnd",id:p});return p}function y(n,e,t){let o=n.comments??[];if(!o.find(p=>p.id===e))throw new chunkXUAUDUJU_js.i(e);let a=o.map(p=>p.id),r=Math.max(...a)+1,i={id:r,author:t.author??"AI",date:new Date().toISOString(),parentId:e,content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t.text}]}],formatting:{}}]};return o.push(i),r}function k(n,e){let t=n.comments??[],o=t.find(r=>r.id===e);if(!o)throw new chunkXUAUDUJU_js.i(e);let s=o.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);n.comments=t.filter(r=>!a.has(r.id)),!s&&chunkXUAUDUJU_js.c(n,r=>{for(let i=r.content.length-1;i>=0;i--){let p=r.content[i];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(i,1);}});}function C(n,e){if(!H(n,e,"accept"))throw new chunkXUAUDUJU_js.g(e)}function I(n,e){if(!H(n,e,"reject"))throw new chunkXUAUDUJU_js.g(e)}function F(n){return M(n,"accept")}function N(n){return M(n,"reject")}function M(n,e){let t=0;return chunkXUAUDUJU_js.c(n,o=>{for(let s=o.content.length-1;s>=0;s--){let a=o.content[s];chunkXUAUDUJU_js.a(a)&&(W(o,s,a,e),t++);}}),t}function H(n,e,t){let o=false;return chunkXUAUDUJU_js.c(n,s=>{for(let a=s.content.length-1;a>=0;a--){let r=s.content[a];chunkXUAUDUJU_js.a(r)&&r.info.id===e&&(W(s,a,r,t),o=true);}if(o)return false}),o}function W(n,e,t,o){if(t.type==="insertion"&&o==="accept"||t.type==="deletion"&&o==="reject"||t.type==="moveTo"&&o==="accept"||t.type==="moveFrom"&&o==="reject"){let a=t.content;n.content.splice(e,1,...a);}else n.content.splice(e,1);}function x(n,e){let{paragraphIndex:t,search:o,author:s="AI",replaceWith:a}=e,r=chunkXUAUDUJU_js.b(n,t),{startIndex:i,endIndex:p}=chunkXUAUDUJU_js.k(r,o,t),c=new Date().toISOString(),m=w(n),h=r.content.slice(i,p+1),R={type:"deletion",info:{id:m,author:s,date:c},content:h},v={type:"insertion",info:{id:m+1,author:s,date:c},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(i,p-i+1,R,v);}function G(n,e){let{paragraphIndex:t,author:o="AI",insertText:s,position:a="after",search:r}=e,i=chunkXUAUDUJU_js.b(n,t),p=new Date().toISOString(),m={type:"insertion",info:{id:w(n),author:o,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:h,endIndex:R}=chunkXUAUDUJU_js.k(i,r,t),v=a==="after"?R+1:h;i.content.splice(v,0,m);}else a==="before"?i.content.unshift(m):i.content.push(m);}function L(n,e){let{paragraphIndex:t,search:o,author:s="AI"}=e,a=chunkXUAUDUJU_js.b(n,t),{startIndex:r,endIndex:i}=chunkXUAUDUJU_js.k(a,o,t),p=new Date().toISOString(),c=w(n),m=a.content.slice(r,i+1),h={type:"deletion",info:{id:c,author:s,date:p},content:m};a.content.splice(r,i-r+1,h);}var S=new WeakMap;function w(n){let e=S.get(n);e===void 0&&(e=0,chunkXUAUDUJU_js.c(n,o=>{for(let s of o.content)chunkXUAUDUJU_js.a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(n,t+1),t}function U(n,e,t="AI"){let o=[],s=0,a=0,r=0,i=0,p=0;for(let c of e.accept??[])try{C(n,c),s++;}catch(m){o.push({operation:"accept",id:c,error:m.message});}for(let c of e.reject??[])try{I(n,c),a++;}catch(m){o.push({operation:"reject",id:c,error:m.message});}for(let c of e.comments??[])try{g(n,{...c,author:c.author??t}),r++;}catch(m){o.push({operation:"comment",search:c.search,error:m.message});}for(let c of e.replies??[])try{y(n,c.commentId,{author:c.author??t,text:c.text}),i++;}catch(m){o.push({operation:"reply",id:c.commentId,error:m.message});}for(let c of e.proposals??[])try{x(n,{...c,author:c.author??t}),p++;}catch(m){o.push({operation:"proposal",search:c.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:i,proposalsAdded:p,errors:o}}var X=class n{constructor(e,t="AI",o){let s=o??e.originalBuffer,{originalBuffer:a,...r}=e;this.doc=structuredClone(r),s&&(this.doc.originalBuffer=s),this.author=t;}static async fromBuffer(e,t="AI"){let o=await chunk4W7OEW2I_js.w(e,{preloadFonts:false});return new n(o,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return chunkXUAUDUJU_js.d(this.body,e)}getContentAsText(e){return chunkXUAUDUJU_js.e(chunkXUAUDUJU_js.d(this.body,e))}getChanges(e){return chunkXUAUDUJU_js.l(this.body,e,{footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes})}getComments(e){return chunkXUAUDUJU_js.m(this.body,e)}addComment(e,t){let o=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return g(this.body,o)}replyTo(e,t){let o=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return y(this.body,e,o)}removeComment(e){k(this.body,e);}replace(e,t,o){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:o,author:this.author}:{...e,author:this.resolveAuthor(e.author)};x(this.body,s);}proposeReplacement(e){this.replace(e);}proposeInsertion(e){G(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}assertNotNoteOnly(e){if(this.getChanges().some(s=>s.id===e))return;let o=this.getChanges({includeFootnotes:true,includeEndnotes:true}).find(s=>s.id===e&&s.noteType!==void 0);if(o)throw new chunkXUAUDUJU_js.h(e,o.noteType,o.noteId)}acceptChange(e){this.assertNotNoteOnly(e),C(this.body,e);}rejectChange(e){this.assertNotNoteOnly(e),I(this.body,e);}acceptAll(){return F(this.body)}rejectAll(){return N(this.body)}applyReview(e){return U(this.body,e,this.author)}toDocument(){return this.doc}async toBuffer(){if(!this.doc.originalBuffer)throw new Error("Cannot create buffer: no original DOCX buffer was provided. Use DocxReviewer.fromBuffer() or pass originalBuffer to the constructor.");let{repackDocx:e}=await import('./headless-ES4B5CTK.js');return e(this.doc)}};exports.a=X;
@@ -0,0 +1 @@
1
+ import {d,e,l,m,h,b,j,i,c,k as k$1,g as g$1,a}from'./chunk-P4DRISTP.mjs';import {w as w$1}from'./chunk-2OIX7TUX.mjs';function g(n,e){let{paragraphIndex:t,author:o="AI",text:s,search:a}=e,r=b(n,t),i=(n.comments??[]).map(m=>m.id),p=i.length>0?Math.max(...i)+1:1,c={id:p,author:o,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(n.comments||(n.comments=[]),n.comments.push(c),a){let m=j(r,a,t);r.content.splice(m.endRunIndex+1,0,{type:"commentRangeEnd",id:p}),r.content.splice(m.startRunIndex,0,{type:"commentRangeStart",id:p});}else r.content.unshift({type:"commentRangeStart",id:p}),r.content.push({type:"commentRangeEnd",id:p});return p}function y(n,e,t){let o=n.comments??[];if(!o.find(p=>p.id===e))throw new i(e);let a=o.map(p=>p.id),r=Math.max(...a)+1,i$1={id:r,author:t.author??"AI",date:new Date().toISOString(),parentId:e,content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t.text}]}],formatting:{}}]};return o.push(i$1),r}function k(n,e){let t=n.comments??[],o=t.find(r=>r.id===e);if(!o)throw new i(e);let s=o.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);n.comments=t.filter(r=>!a.has(r.id)),!s&&c(n,r=>{for(let i=r.content.length-1;i>=0;i--){let p=r.content[i];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(i,1);}});}function C(n,e){if(!H(n,e,"accept"))throw new g$1(e)}function I(n,e){if(!H(n,e,"reject"))throw new g$1(e)}function F(n){return M(n,"accept")}function N(n){return M(n,"reject")}function M(n,e){let t=0;return c(n,o=>{for(let s=o.content.length-1;s>=0;s--){let a$1=o.content[s];a(a$1)&&(W(o,s,a$1,e),t++);}}),t}function H(n,e,t){let o=false;return c(n,s=>{for(let a$1=s.content.length-1;a$1>=0;a$1--){let r=s.content[a$1];a(r)&&r.info.id===e&&(W(s,a$1,r,t),o=true);}if(o)return false}),o}function W(n,e,t,o){if(t.type==="insertion"&&o==="accept"||t.type==="deletion"&&o==="reject"||t.type==="moveTo"&&o==="accept"||t.type==="moveFrom"&&o==="reject"){let a=t.content;n.content.splice(e,1,...a);}else n.content.splice(e,1);}function x(n,e){let{paragraphIndex:t,search:o,author:s="AI",replaceWith:a}=e,r=b(n,t),{startIndex:i,endIndex:p}=k$1(r,o,t),c=new Date().toISOString(),m=w(n),h=r.content.slice(i,p+1),R={type:"deletion",info:{id:m,author:s,date:c},content:h},v={type:"insertion",info:{id:m+1,author:s,date:c},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(i,p-i+1,R,v);}function G(n,e){let{paragraphIndex:t,author:o="AI",insertText:s,position:a="after",search:r}=e,i=b(n,t),p=new Date().toISOString(),m={type:"insertion",info:{id:w(n),author:o,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:h,endIndex:R}=k$1(i,r,t),v=a==="after"?R+1:h;i.content.splice(v,0,m);}else a==="before"?i.content.unshift(m):i.content.push(m);}function L(n,e){let{paragraphIndex:t,search:o,author:s="AI"}=e,a=b(n,t),{startIndex:r,endIndex:i}=k$1(a,o,t),p=new Date().toISOString(),c=w(n),m=a.content.slice(r,i+1),h={type:"deletion",info:{id:c,author:s,date:p},content:m};a.content.splice(r,i-r+1,h);}var S=new WeakMap;function w(n){let e=S.get(n);e===void 0&&(e=0,c(n,o=>{for(let s of o.content)a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(n,t+1),t}function U(n,e,t="AI"){let o=[],s=0,a=0,r=0,i=0,p=0;for(let c of e.accept??[])try{C(n,c),s++;}catch(m){o.push({operation:"accept",id:c,error:m.message});}for(let c of e.reject??[])try{I(n,c),a++;}catch(m){o.push({operation:"reject",id:c,error:m.message});}for(let c of e.comments??[])try{g(n,{...c,author:c.author??t}),r++;}catch(m){o.push({operation:"comment",search:c.search,error:m.message});}for(let c of e.replies??[])try{y(n,c.commentId,{author:c.author??t,text:c.text}),i++;}catch(m){o.push({operation:"reply",id:c.commentId,error:m.message});}for(let c of e.proposals??[])try{x(n,{...c,author:c.author??t}),p++;}catch(m){o.push({operation:"proposal",search:c.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:i,proposalsAdded:p,errors:o}}var X=class n{constructor(e,t="AI",o){let s=o??e.originalBuffer,{originalBuffer:a,...r}=e;this.doc=structuredClone(r),s&&(this.doc.originalBuffer=s),this.author=t;}static async fromBuffer(e,t="AI"){let o=await w$1(e,{preloadFonts:false});return new n(o,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return d(this.body,e)}getContentAsText(e$1){return e(d(this.body,e$1))}getChanges(e){return l(this.body,e,{footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes})}getComments(e){return m(this.body,e)}addComment(e,t){let o=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return g(this.body,o)}replyTo(e,t){let o=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return y(this.body,e,o)}removeComment(e){k(this.body,e);}replace(e,t,o){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:o,author:this.author}:{...e,author:this.resolveAuthor(e.author)};x(this.body,s);}proposeReplacement(e){this.replace(e);}proposeInsertion(e){G(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}assertNotNoteOnly(e){if(this.getChanges().some(s=>s.id===e))return;let o=this.getChanges({includeFootnotes:true,includeEndnotes:true}).find(s=>s.id===e&&s.noteType!==void 0);if(o)throw new h(e,o.noteType,o.noteId)}acceptChange(e){this.assertNotNoteOnly(e),C(this.body,e);}rejectChange(e){this.assertNotNoteOnly(e),I(this.body,e);}acceptAll(){return F(this.body)}rejectAll(){return N(this.body)}applyReview(e){return U(this.body,e,this.author)}toDocument(){return this.doc}async toBuffer(){if(!this.doc.originalBuffer)throw new Error("Cannot create buffer: no original DOCX buffer was provided. Use DocxReviewer.fromBuffer() or pass originalBuffer to the constructor.");let{repackDocx:e}=await import('./headless-OEZEYHNL.mjs');return e(this.doc)}};export{X as a};
@@ -0,0 +1,5 @@
1
+ import {U as U$1,V,H as H$1,I,va}from'./chunk-2OIX7TUX.mjs';import {m as m$1}from'./chunk-XDZHYYU6.mjs';function m(o){return o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo"}function b(o){let t=[];for(let r of o)r.type==="run"?t.push(H$1(r)):r.type==="hyperlink"&&t.push(I(r));return t.join("")}function v(o,t){let r=0;for(let n of o.content)if(n.type==="paragraph"){if(r===t)return n;r++;}else if(n.type==="table"){for(let a of n.rows)for(let e of a.cells)for(let i of e.content)if(i.type==="paragraph"){if(r===t)return i;r++;}}else r++;throw new Error(`Paragraph index ${t} out of bounds (max: ${r-1})`)}function L(o,t,r){let n=0;for(let a of o)if(a.type==="paragraph"){if(r(a,n)===false)return;n++;}else if(a.type==="table"){for(let e of a.rows)for(let i of e.cells)for(let s of i.content)if(s.type==="paragraph"){if(r(s,n)===false)return;n++;}}else t&&n++;}function F(o,t){L(o.content,true,t);}function k(o,t){L(o.content,false,t);}function xe(o,t={}){let{fromIndex:r,toIndex:n,includeTrackedChanges:a=true,includeCommentAnchors:e=true}=t,i=[],s=0;for(let c of o.content)if(c.type==="paragraph")j(s,r,n)&&i.push(ee(c,s,a,e)),s++;else if(c.type==="table"){j(s,r,n)&&i.push(te(c,s,a,e));for(let l of c.rows)for(let u of l.cells)for(let f of u.content)f.type==="paragraph"&&s++;}else s++;return i}function j(o,t,r){return (t===void 0||o>=t)&&(r===void 0||o<=r)}function ee(o,t,r,n){let a=H(o,r,n),e=o.formatting?.styleId,i=o.paraId;return U$1(e)?{type:"heading",index:t,paraId:i,level:V(e)??1,text:a}:o.listRendering?{type:"list-item",index:t,paraId:i,text:a,listLevel:o.listRendering.level??0,listType:o.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:t,paraId:i,text:a}}function te(o,t,r,n){let a=[],e=[];for(let i of o.rows){let s=[],c=[];for(let l of i.cells){let u=[],f;for(let d of l.content)d.type==="paragraph"&&(f===void 0&&(f=d.paraId),u.push(H(d,r,n)));s.push(u.join(`
2
+ `)),c.push(f);}a.push(s),e.push(c);}return {type:"table",index:t,rows:a,cellParaIds:e}}function ye(o){let t=[],r=n=>n.paraId?n.paraId:String(n.index);for(let n of o)switch(n.type){case "heading":t.push(`[${r(n)}] (h${n.level}) ${n.text}`);break;case "paragraph":t.push(`[${r(n)}] ${n.text}`);break;case "list-item":{let a=" ".repeat(n.listLevel),e=n.listType==="bullet"?"\u2022":"-";t.push(`[${r(n)}] ${a}${e} ${n.text}`);break}case "table":{let a=n.index;for(let e=0;e<n.rows.length;e++)for(let i=0;i<n.rows[e].length;i++){let c=n.rows[e][i].split(`
3
+ `),l=n.cellParaIds?.[e]?.[i];for(let u=0;u<c.length;u++){let f=u===0&&l?l:String(a);t.push(`[${f}] (table, row ${e+1}, col ${i+1}) ${c[u]}`),a++;}}break}}return t.join(`
4
+ `)}function H(o,t,r){let n=[],a=new Set;for(let e of o.content){if(e.type==="commentRangeStart"&&r){a.add(e.id),n.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&r){a.has(e.id)&&(a.delete(e.id),n.push("[/comment]"));continue}if(e.type==="run")n.push(H$1(e));else if(e.type==="hyperlink")n.push(I(e));else if(m(e)){let i=b(e.content);e.type==="insertion"||e.type==="moveTo"?t&&n.push(`[+${i}+]{by:${e.info.author}}`):t?n.push(`[-${i}-]{by:${e.info.author}}`):n.push(i);}}return n.join("")}var C=class extends Error{constructor(t,r){let n=r!==void 0?` in paragraph ${r}`:" in document";super(`Text not found${n}: "${t}"`),this.name="TextNotFoundError";}},N=class extends Error{constructor(t){super(`Tracked change not found: id=${t}`),this.name="ChangeNotFoundError";}},z=class extends Error{constructor(t,r,n){super(`Tracked change id=${t} lives inside a ${r} (noteId=${n}); accept/reject operate on the document body only and cannot yet mutate ${r} changes. Surfaced for discovery via getChanges({ include${r==="footnote"?"Footnotes":"Endnotes"}: true }).`),this.name="NoteChangeNotEditableError";}},R=class extends Error{constructor(t){super(`Comment not found: id=${t}`),this.name="CommentNotFoundError";}};function J(o){let t=[],r=0;for(let n=0;n<o.content.length;n++){let a=o.content[n];if(a.type==="run"){let e=H$1(a);t.push({contentIndex:n,run:a,text:e,startPos:r}),r+=e.length;}else if(a.type==="hyperlink")for(let e=0;e<a.children.length;e++){let i=a.children[e];if(i.type==="run"){let s=H$1(i);t.push({contentIndex:n,run:i,text:s,startPos:r}),r+=s.length;}}else if(m(a)){if(a.type==="insertion"||a.type==="moveTo")continue;for(let e=0;e<a.content.length;e++){let i=a.content[e];if(i.type==="run"){let s=H$1(i);t.push({contentIndex:n,run:i,text:s,startPos:r}),r+=s.length;}else if(i.type==="hyperlink"){for(let s of i.children)if(s.type==="run"){let c=H$1(s);t.push({contentIndex:n,run:s,text:c,startPos:r}),r+=c.length;}}}}}return t}function w(o){return J(o).map(t=>t.text).join("")}function ne(o,t,r){let n=J(o),a=n.map(u=>u.text).join(""),e=oe(a,t);if(!e)throw new C(t,r);let i=-1,s=0;for(let u=0;u<n.length;u++)if(e.start<n[u].startPos+n[u].text.length){i=u,s=e.start-n[u].startPos;break}let c=-1,l=0;for(let u=n.length-1;u>=0;u--)if(e.end>n[u].startPos){c=u,l=e.end-n[u].startPos;break}if(i===-1||c===-1)throw new C(t,r);return {startRunIndex:n[i].contentIndex,startOffset:s,endRunIndex:n[c].contentIndex,endOffset:l}}function Ie(o,t,r){let n=ne(o,t,r),{startRunIndex:a,endRunIndex:e}=n,{startOffset:i,endOffset:s}=n,c=o.content[e];if(c.type==="run"){let u=H$1(c);if(s<u.length){let f=W(u.slice(s),c);G(c,u.slice(0,s)),o.content.splice(e+1,0,f);}}let l=o.content[a];if(l.type==="run"&&i>0){let u=H$1(l),f=W(u.slice(0,i),l);G(l,u.slice(i)),o.content.splice(a,0,f),a++,e++;}return {startIndex:a,endIndex:e}}function W(o,t){return {type:"run",content:[{type:"text",text:o}],formatting:t.formatting?{...t.formatting}:void 0}}function G(o,t){let r=o.content.find(n=>n.type==="text");r&&(r.text=t);}function U(o){let t=[],r=[],n=true;for(let a=0;a<o.length;a++){let e=o[a];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"){t.push(".",".","."),r.push(a,a,a),n=false;continue}if(/\s/.test(e)||e==="\xA0"){n||(t.push(" "),r.push(a),n=true);continue}t.push(e.toLowerCase()),r.push(a),n=false;}}return t.length>0&&t[t.length-1]===" "&&(t.pop(),r.pop()),{text:t.join(""),posMap:r}}function X(o,t,r,n){let a=o.posMap[t],e=o.posMap[t+r-1]+1;for(;e<n.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(n[e]);)e++;return {start:a,end:e}}function oe(o,t){if(!t||!o)return null;let r=o.indexOf(t);if(r!==-1)return {start:r,end:r+t.length};let n=U(o),a=U(t);if(!a.text)return null;let e=n.text.indexOf(a.text);if(e!==-1)return X(n,e,a.text.length,o);let i=a.text.split(" ");if(i.length>=3)for(let s=1;s<=Math.min(2,i.length-2);s++){let c=i.slice(0,-s).join(" "),l=n.text.indexOf(c);if(l!==-1)return X(n,l,c.length,o)}return null}function ke(o,t,r){let n=new Map,a=(i,s,c)=>{let l=null;for(let u of i.content)if(m(u)){l===null&&(l=w(i));let f=b(u.content),d=u.info.id,x=`${c.noteType??"body"}:${c.noteId??""}:${d}`,h=n.get(x);h&&h.paragraphIndex===s?h.text+=f:n.set(x,{id:d,type:u.type,author:u.info.author,date:u.info.date??null,text:f,context:l,paragraphIndex:s,...c.noteId!==void 0?{noteId:c.noteId}:{},...c.noteType!==void 0?{noteType:c.noteType}:{}});}};if(F(o,(i,s)=>a(i,s,{})),t?.includeFootnotes&&r?.footnotes)for(let i of r.footnotes)k(i,(s,c)=>a(s,c,{noteId:i.id,noteType:"footnote"}));if(t?.includeEndnotes&&r?.endnotes)for(let i of r.endnotes)k(i,(s,c)=>a(s,c,{noteId:i.id,noteType:"endnote"}));return Array.from(n.values()).filter(i=>!(t?.author&&i.author!==t.author||t?.type&&i.type!==t.type))}function we(o,t){let r=o.comments??[];if(r.length===0)return [];let n=re(o),a=[],e=new Map;for(let s of r)if(s.parentId!==void 0){let c=e.get(s.parentId)??[];c.push(s),e.set(s.parentId,c);}else a.push(s);return a.map(s=>{let c=n.get(s.id),l=(e.get(s.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:K(u)}));return {id:s.id,author:s.author,date:s.date??null,text:K(s),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:s.done??false}}).filter(s=>!(t?.author&&s.author!==t.author||t?.done!==void 0&&s.done!==t.done))}function K(o){return o.content.map(t=>w(t)).join(`
5
+ `)}function re(o){let t=new Map,r=new Map;return F(o,(n,a)=>{for(let e of n.content)if(e.type==="commentRangeStart")r.set(e.id,{paragraphIndex:a,parts:[]});else if(e.type==="commentRangeEnd"){let i=r.get(e.id);i&&(t.set(e.id,{text:i.parts.join(""),paragraphIndex:i.paragraphIndex}),r.delete(e.id));}else if(e.type==="run"){let i=H$1(e);for(let s of r.values())s.parts.push(i);}else if(e.type==="hyperlink"){let i=e.children.filter(s=>s.type==="run").map(H$1).join("");for(let s of r.values())s.parts.push(i);}else if(m(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let i=b(e.content);for(let s of r.values())s.parts.push(i);}}),t}function ae(o){let t=o.toDocument().package?.document;if(!t)return new Map;let r=new Map,n=0;for(let a of t.content)if(a.type==="paragraph"){let e=a.paraId;r.set(e??String(n),n),n++;}else if(a.type==="table")for(let e of a.rows)for(let i of e.cells)for(let s of i.content)s.type==="paragraph"&&n++;else n++;return r}function ie(o){let t=[],r=n=>{for(let a of n.content)a.type==="text"&&t.push(a.text??"");};for(let n of o.content)if(n.type==="run")r(n);else if(n.type==="hyperlink")for(let a of n.children)a.type==="run"&&r(a);else if(n.type==="deletion"||n.type==="moveFrom"){for(let a of n.content)if(a.type==="run")r(a);else if(a.type==="hyperlink")for(let e of a.children)e.type==="run"&&r(e);}return t.join("")}function B(o,t){let n={type:"run",content:[{type:"text",text:t,preserveSpace:/^\s|\s$/.test(t)}]};return o.formatting&&(n.formatting={...o.formatting}),o.propertyChanges&&(n.propertyChanges=[...o.propertyChanges]),n}function se(o){return o.content.map(t=>t.type==="text"?t.text:"").join("")}function M(o,t,r,n,a){let e=se(o);if(!e)return;let i=a.value,s=i+e.length;n.push({run:o,parent:t,index:r,text:e,start:i,end:s}),a.value=s;}function Q(o,t,r){o.children.forEach((n,a)=>{n.type==="run"&&M(n,o.children,a,t,r);});}function S(o,t){let r=[],n={value:0};return o.content.forEach((a,e)=>{a.type==="run"?M(a,o.content,e,r,n):a.type==="hyperlink"?Q(a,r,n):(a.type==="deletion"||a.type==="moveFrom"||t&&(a.type==="insertion"||a.type==="moveTo"))&&a.content.forEach((i,s)=>{i.type==="run"?M(i,a.content,s,r,n):i.type==="hyperlink"&&Q(i,r,n);});}),r}function ce(o,t){let r={...o??{}};t.bold!==void 0&&(r.bold=t.bold||void 0),t.italic!==void 0&&(r.italic=t.italic||void 0),t.underline!==void 0&&(t.underline?r.underline={style:typeof t.underline=="object"&&t.underline.style?t.underline.style:"single"}:delete r.underline),t.strike!==void 0&&(r.strike=t.strike||void 0),t.color!==void 0&&(t.color&&(t.color.rgb||t.color.themeColor)?r.color={rgb:t.color.rgb,themeColor:t.color.themeColor}:delete r.color),t.highlight!==void 0&&(t.highlight?r.highlight=va(t.highlight)||t.highlight:delete r.highlight),t.fontSize!==void 0&&(t.fontSize>0?r.fontSize=m$1(t.fontSize):delete r.fontSize),t.fontFamily!==void 0&&(t.fontFamily&&(t.fontFamily.ascii||t.fontFamily.hAnsi)?r.fontFamily={ascii:t.fontFamily.ascii,hAnsi:t.fontFamily.hAnsi??t.fontFamily.ascii}:delete r.fontFamily);for(let n of Object.keys(r))r[n]===void 0&&delete r[n];return Object.keys(r).length>0?r:void 0}function $(o,t){o.formatting=ce(o.formatting,t);}function ue(o,t,r,n){let a=o.run.content.every(s=>s.type==="text");if(t<=0&&r>=o.text.length||!a){$(o.run,n);return}let e=[];t>0&&e.push(B(o.run,o.text.slice(0,t)));let i=B(o.run,o.text.slice(t,r));$(i,n),e.push(i),r<o.text.length&&e.push(B(o.run,o.text.slice(r))),o.parent.splice(o.index,1,...e);}function le(o,t,r,n){let e=S(o,false).filter(i=>i.start<r&&i.end>t);if(e.length===0)return true;for(let i=e.length-1;i>=0;i--){let s=e[i];ue(s,Math.max(0,t-s.start),Math.min(s.text.length,r-s.start),n);}return true}function fe(o,t){let r=S(o,true);for(let n of r)$(n.run,t);return true}function pe(o,t){if(!t)return null;let n=S(o,false).map(e=>e.text).join(""),a=n.indexOf(t);return a===-1||n.indexOf(t,a+1)!==-1?null:{from:a,to:a+t.length}}function de(o,t){return o?!!o.styles?.some(r=>r.styleId===t&&r.type==="paragraph"):true}function Ee(o){let t=new Set,r=null;function n(){return r===null&&(r=ae(o)),r}function a(){if(t.size===0)return;let e=o.getComments(),i=o.getChanges(),s={commentCount:e.length,changeCount:i.length,comments:e,changes:i};for(let c of t)try{c(s);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return o.getContentAsText(e)},getContent(e){return o.getContent(e)},getComments(e){return o.getComments(e)},getChanges(e){return o.getChanges(e)},findText(e,i){if(!e)return [];let s=i?.caseSensitive??false,c=i?.limit??20,l=s?e:e.toLowerCase(),u=o.toDocument().package?.document;if(!u)return [];let f=[],d=40,x=0;for(let h of u.content){if(f.length>=c)break;if(h.type==="table"){for(let Z of h.rows)for(let _ of Z.cells)for(let q of _.content)q.type==="paragraph"&&x++;continue}if(h.type!=="paragraph"){x++;continue}let E=h,V=x++,y=ie(E),D=s?y:y.toLowerCase(),g=D.indexOf(l);if(g===-1||D.indexOf(l,g+1)!==-1)continue;let Y=y.slice(g,g+e.length);f.push({paraId:E.paraId??String(V),match:Y,before:y.slice(Math.max(0,g-d),g),after:y.slice(g+e.length,g+e.length+d)});}return f},getSelection(){return null},addComment(e){let i=n().get(e.paraId);if(i===void 0)return null;try{let s=o.addComment({paragraphIndex:i,text:e.text,author:e.author,search:e.search});return a(),s}catch{return null}},replyTo(e,i){try{let s=o.replyTo(e,i);return a(),s}catch{return null}},resolveComment(e){let s=o.toDocument().package?.document?.comments?.find(c=>c.id===e);if(!s)throw new R(e);s.done=true,a();},proposeChange(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=e.search==="",c=e.replaceWith==="";if(s&&c)return false;try{return s?o.proposeInsertion({paragraphIndex:i,insertText:e.replaceWith,author:e.author}):c?o.proposeDeletion({paragraphIndex:i,search:e.search,author:e.author}):o.replace({paragraphIndex:i,search:e.search,replaceWith:e.replaceWith,author:e.author}),a(),true}catch{return false}},scrollTo(e){return n().has(e)},applyFormatting(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=o.toDocument().package?.document;if(!s)return false;try{let c=s?v(s,i):null;if(!c)return false;if(e.search){let l=pe(c,e.search);if(!l)return false;le(c,l.from,l.to,e.marks);}else fe(c,e.marks);return a(),true}catch{return false}},setParagraphStyle(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=o.toDocument(),c=s.package?.document;if(!c||!de(s.package?.styles,e.styleId))return false;try{let l=v(c,i);return l.formatting={...l.formatting??{},styleId:e.styleId},a(),true}catch{return false}},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return t.add(e),()=>{t.delete(e);}},onSelectionChange(){return ()=>{}}}}export{m as a,v as b,F as c,xe as d,ye as e,C as f,N as g,z as h,R as i,ne as j,Ie as k,ke as l,we as m,Ee as n};
@@ -0,0 +1,5 @@
1
+ 'use strict';var chunk4W7OEW2I_js=require('./chunk-4W7OEW2I.js'),chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');function m(o){return o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo"}function b(o){let t=[];for(let r of o)r.type==="run"?t.push(chunk4W7OEW2I_js.H(r)):r.type==="hyperlink"&&t.push(chunk4W7OEW2I_js.I(r));return t.join("")}function v(o,t){let r=0;for(let n of o.content)if(n.type==="paragraph"){if(r===t)return n;r++;}else if(n.type==="table"){for(let a of n.rows)for(let e of a.cells)for(let i of e.content)if(i.type==="paragraph"){if(r===t)return i;r++;}}else r++;throw new Error(`Paragraph index ${t} out of bounds (max: ${r-1})`)}function L(o,t,r){let n=0;for(let a of o)if(a.type==="paragraph"){if(r(a,n)===false)return;n++;}else if(a.type==="table"){for(let e of a.rows)for(let i of e.cells)for(let s of i.content)if(s.type==="paragraph"){if(r(s,n)===false)return;n++;}}else t&&n++;}function F(o,t){L(o.content,true,t);}function k(o,t){L(o.content,false,t);}function xe(o,t={}){let{fromIndex:r,toIndex:n,includeTrackedChanges:a=true,includeCommentAnchors:e=true}=t,i=[],s=0;for(let c of o.content)if(c.type==="paragraph")j(s,r,n)&&i.push(ee(c,s,a,e)),s++;else if(c.type==="table"){j(s,r,n)&&i.push(te(c,s,a,e));for(let l of c.rows)for(let u of l.cells)for(let f of u.content)f.type==="paragraph"&&s++;}else s++;return i}function j(o,t,r){return (t===void 0||o>=t)&&(r===void 0||o<=r)}function ee(o,t,r,n){let a=H(o,r,n),e=o.formatting?.styleId,i=o.paraId;return chunk4W7OEW2I_js.U(e)?{type:"heading",index:t,paraId:i,level:chunk4W7OEW2I_js.V(e)??1,text:a}:o.listRendering?{type:"list-item",index:t,paraId:i,text:a,listLevel:o.listRendering.level??0,listType:o.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:t,paraId:i,text:a}}function te(o,t,r,n){let a=[],e=[];for(let i of o.rows){let s=[],c=[];for(let l of i.cells){let u=[],f;for(let d of l.content)d.type==="paragraph"&&(f===void 0&&(f=d.paraId),u.push(H(d,r,n)));s.push(u.join(`
2
+ `)),c.push(f);}a.push(s),e.push(c);}return {type:"table",index:t,rows:a,cellParaIds:e}}function ye(o){let t=[],r=n=>n.paraId?n.paraId:String(n.index);for(let n of o)switch(n.type){case "heading":t.push(`[${r(n)}] (h${n.level}) ${n.text}`);break;case "paragraph":t.push(`[${r(n)}] ${n.text}`);break;case "list-item":{let a=" ".repeat(n.listLevel),e=n.listType==="bullet"?"\u2022":"-";t.push(`[${r(n)}] ${a}${e} ${n.text}`);break}case "table":{let a=n.index;for(let e=0;e<n.rows.length;e++)for(let i=0;i<n.rows[e].length;i++){let c=n.rows[e][i].split(`
3
+ `),l=n.cellParaIds?.[e]?.[i];for(let u=0;u<c.length;u++){let f=u===0&&l?l:String(a);t.push(`[${f}] (table, row ${e+1}, col ${i+1}) ${c[u]}`),a++;}}break}}return t.join(`
4
+ `)}function H(o,t,r){let n=[],a=new Set;for(let e of o.content){if(e.type==="commentRangeStart"&&r){a.add(e.id),n.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&r){a.has(e.id)&&(a.delete(e.id),n.push("[/comment]"));continue}if(e.type==="run")n.push(chunk4W7OEW2I_js.H(e));else if(e.type==="hyperlink")n.push(chunk4W7OEW2I_js.I(e));else if(m(e)){let i=b(e.content);e.type==="insertion"||e.type==="moveTo"?t&&n.push(`[+${i}+]{by:${e.info.author}}`):t?n.push(`[-${i}-]{by:${e.info.author}}`):n.push(i);}}return n.join("")}var C=class extends Error{constructor(t,r){let n=r!==void 0?` in paragraph ${r}`:" in document";super(`Text not found${n}: "${t}"`),this.name="TextNotFoundError";}},N=class extends Error{constructor(t){super(`Tracked change not found: id=${t}`),this.name="ChangeNotFoundError";}},z=class extends Error{constructor(t,r,n){super(`Tracked change id=${t} lives inside a ${r} (noteId=${n}); accept/reject operate on the document body only and cannot yet mutate ${r} changes. Surfaced for discovery via getChanges({ include${r==="footnote"?"Footnotes":"Endnotes"}: true }).`),this.name="NoteChangeNotEditableError";}},R=class extends Error{constructor(t){super(`Comment not found: id=${t}`),this.name="CommentNotFoundError";}};function J(o){let t=[],r=0;for(let n=0;n<o.content.length;n++){let a=o.content[n];if(a.type==="run"){let e=chunk4W7OEW2I_js.H(a);t.push({contentIndex:n,run:a,text:e,startPos:r}),r+=e.length;}else if(a.type==="hyperlink")for(let e=0;e<a.children.length;e++){let i=a.children[e];if(i.type==="run"){let s=chunk4W7OEW2I_js.H(i);t.push({contentIndex:n,run:i,text:s,startPos:r}),r+=s.length;}}else if(m(a)){if(a.type==="insertion"||a.type==="moveTo")continue;for(let e=0;e<a.content.length;e++){let i=a.content[e];if(i.type==="run"){let s=chunk4W7OEW2I_js.H(i);t.push({contentIndex:n,run:i,text:s,startPos:r}),r+=s.length;}else if(i.type==="hyperlink"){for(let s of i.children)if(s.type==="run"){let c=chunk4W7OEW2I_js.H(s);t.push({contentIndex:n,run:s,text:c,startPos:r}),r+=c.length;}}}}}return t}function w(o){return J(o).map(t=>t.text).join("")}function ne(o,t,r){let n=J(o),a=n.map(u=>u.text).join(""),e=oe(a,t);if(!e)throw new C(t,r);let i=-1,s=0;for(let u=0;u<n.length;u++)if(e.start<n[u].startPos+n[u].text.length){i=u,s=e.start-n[u].startPos;break}let c=-1,l=0;for(let u=n.length-1;u>=0;u--)if(e.end>n[u].startPos){c=u,l=e.end-n[u].startPos;break}if(i===-1||c===-1)throw new C(t,r);return {startRunIndex:n[i].contentIndex,startOffset:s,endRunIndex:n[c].contentIndex,endOffset:l}}function Ie(o,t,r){let n=ne(o,t,r),{startRunIndex:a,endRunIndex:e}=n,{startOffset:i,endOffset:s}=n,c=o.content[e];if(c.type==="run"){let u=chunk4W7OEW2I_js.H(c);if(s<u.length){let f=W(u.slice(s),c);G(c,u.slice(0,s)),o.content.splice(e+1,0,f);}}let l=o.content[a];if(l.type==="run"&&i>0){let u=chunk4W7OEW2I_js.H(l),f=W(u.slice(0,i),l);G(l,u.slice(i)),o.content.splice(a,0,f),a++,e++;}return {startIndex:a,endIndex:e}}function W(o,t){return {type:"run",content:[{type:"text",text:o}],formatting:t.formatting?{...t.formatting}:void 0}}function G(o,t){let r=o.content.find(n=>n.type==="text");r&&(r.text=t);}function U(o){let t=[],r=[],n=true;for(let a=0;a<o.length;a++){let e=o[a];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"){t.push(".",".","."),r.push(a,a,a),n=false;continue}if(/\s/.test(e)||e==="\xA0"){n||(t.push(" "),r.push(a),n=true);continue}t.push(e.toLowerCase()),r.push(a),n=false;}}return t.length>0&&t[t.length-1]===" "&&(t.pop(),r.pop()),{text:t.join(""),posMap:r}}function X(o,t,r,n){let a=o.posMap[t],e=o.posMap[t+r-1]+1;for(;e<n.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(n[e]);)e++;return {start:a,end:e}}function oe(o,t){if(!t||!o)return null;let r=o.indexOf(t);if(r!==-1)return {start:r,end:r+t.length};let n=U(o),a=U(t);if(!a.text)return null;let e=n.text.indexOf(a.text);if(e!==-1)return X(n,e,a.text.length,o);let i=a.text.split(" ");if(i.length>=3)for(let s=1;s<=Math.min(2,i.length-2);s++){let c=i.slice(0,-s).join(" "),l=n.text.indexOf(c);if(l!==-1)return X(n,l,c.length,o)}return null}function ke(o,t,r){let n=new Map,a=(i,s,c)=>{let l=null;for(let u of i.content)if(m(u)){l===null&&(l=w(i));let f=b(u.content),d=u.info.id,x=`${c.noteType??"body"}:${c.noteId??""}:${d}`,h=n.get(x);h&&h.paragraphIndex===s?h.text+=f:n.set(x,{id:d,type:u.type,author:u.info.author,date:u.info.date??null,text:f,context:l,paragraphIndex:s,...c.noteId!==void 0?{noteId:c.noteId}:{},...c.noteType!==void 0?{noteType:c.noteType}:{}});}};if(F(o,(i,s)=>a(i,s,{})),t?.includeFootnotes&&r?.footnotes)for(let i of r.footnotes)k(i,(s,c)=>a(s,c,{noteId:i.id,noteType:"footnote"}));if(t?.includeEndnotes&&r?.endnotes)for(let i of r.endnotes)k(i,(s,c)=>a(s,c,{noteId:i.id,noteType:"endnote"}));return Array.from(n.values()).filter(i=>!(t?.author&&i.author!==t.author||t?.type&&i.type!==t.type))}function we(o,t){let r=o.comments??[];if(r.length===0)return [];let n=re(o),a=[],e=new Map;for(let s of r)if(s.parentId!==void 0){let c=e.get(s.parentId)??[];c.push(s),e.set(s.parentId,c);}else a.push(s);return a.map(s=>{let c=n.get(s.id),l=(e.get(s.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:K(u)}));return {id:s.id,author:s.author,date:s.date??null,text:K(s),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:s.done??false}}).filter(s=>!(t?.author&&s.author!==t.author||t?.done!==void 0&&s.done!==t.done))}function K(o){return o.content.map(t=>w(t)).join(`
5
+ `)}function re(o){let t=new Map,r=new Map;return F(o,(n,a)=>{for(let e of n.content)if(e.type==="commentRangeStart")r.set(e.id,{paragraphIndex:a,parts:[]});else if(e.type==="commentRangeEnd"){let i=r.get(e.id);i&&(t.set(e.id,{text:i.parts.join(""),paragraphIndex:i.paragraphIndex}),r.delete(e.id));}else if(e.type==="run"){let i=chunk4W7OEW2I_js.H(e);for(let s of r.values())s.parts.push(i);}else if(e.type==="hyperlink"){let i=e.children.filter(s=>s.type==="run").map(chunk4W7OEW2I_js.H).join("");for(let s of r.values())s.parts.push(i);}else if(m(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let i=b(e.content);for(let s of r.values())s.parts.push(i);}}),t}function ae(o){let t=o.toDocument().package?.document;if(!t)return new Map;let r=new Map,n=0;for(let a of t.content)if(a.type==="paragraph"){let e=a.paraId;r.set(e??String(n),n),n++;}else if(a.type==="table")for(let e of a.rows)for(let i of e.cells)for(let s of i.content)s.type==="paragraph"&&n++;else n++;return r}function ie(o){let t=[],r=n=>{for(let a of n.content)a.type==="text"&&t.push(a.text??"");};for(let n of o.content)if(n.type==="run")r(n);else if(n.type==="hyperlink")for(let a of n.children)a.type==="run"&&r(a);else if(n.type==="deletion"||n.type==="moveFrom"){for(let a of n.content)if(a.type==="run")r(a);else if(a.type==="hyperlink")for(let e of a.children)e.type==="run"&&r(e);}return t.join("")}function B(o,t){let n={type:"run",content:[{type:"text",text:t,preserveSpace:/^\s|\s$/.test(t)}]};return o.formatting&&(n.formatting={...o.formatting}),o.propertyChanges&&(n.propertyChanges=[...o.propertyChanges]),n}function se(o){return o.content.map(t=>t.type==="text"?t.text:"").join("")}function M(o,t,r,n,a){let e=se(o);if(!e)return;let i=a.value,s=i+e.length;n.push({run:o,parent:t,index:r,text:e,start:i,end:s}),a.value=s;}function Q(o,t,r){o.children.forEach((n,a)=>{n.type==="run"&&M(n,o.children,a,t,r);});}function S(o,t){let r=[],n={value:0};return o.content.forEach((a,e)=>{a.type==="run"?M(a,o.content,e,r,n):a.type==="hyperlink"?Q(a,r,n):(a.type==="deletion"||a.type==="moveFrom"||t&&(a.type==="insertion"||a.type==="moveTo"))&&a.content.forEach((i,s)=>{i.type==="run"?M(i,a.content,s,r,n):i.type==="hyperlink"&&Q(i,r,n);});}),r}function ce(o,t){let r={...o??{}};t.bold!==void 0&&(r.bold=t.bold||void 0),t.italic!==void 0&&(r.italic=t.italic||void 0),t.underline!==void 0&&(t.underline?r.underline={style:typeof t.underline=="object"&&t.underline.style?t.underline.style:"single"}:delete r.underline),t.strike!==void 0&&(r.strike=t.strike||void 0),t.color!==void 0&&(t.color&&(t.color.rgb||t.color.themeColor)?r.color={rgb:t.color.rgb,themeColor:t.color.themeColor}:delete r.color),t.highlight!==void 0&&(t.highlight?r.highlight=chunk4W7OEW2I_js.va(t.highlight)||t.highlight:delete r.highlight),t.fontSize!==void 0&&(t.fontSize>0?r.fontSize=chunkEPRXZTIE_js.m(t.fontSize):delete r.fontSize),t.fontFamily!==void 0&&(t.fontFamily&&(t.fontFamily.ascii||t.fontFamily.hAnsi)?r.fontFamily={ascii:t.fontFamily.ascii,hAnsi:t.fontFamily.hAnsi??t.fontFamily.ascii}:delete r.fontFamily);for(let n of Object.keys(r))r[n]===void 0&&delete r[n];return Object.keys(r).length>0?r:void 0}function $(o,t){o.formatting=ce(o.formatting,t);}function ue(o,t,r,n){let a=o.run.content.every(s=>s.type==="text");if(t<=0&&r>=o.text.length||!a){$(o.run,n);return}let e=[];t>0&&e.push(B(o.run,o.text.slice(0,t)));let i=B(o.run,o.text.slice(t,r));$(i,n),e.push(i),r<o.text.length&&e.push(B(o.run,o.text.slice(r))),o.parent.splice(o.index,1,...e);}function le(o,t,r,n){let e=S(o,false).filter(i=>i.start<r&&i.end>t);if(e.length===0)return true;for(let i=e.length-1;i>=0;i--){let s=e[i];ue(s,Math.max(0,t-s.start),Math.min(s.text.length,r-s.start),n);}return true}function fe(o,t){let r=S(o,true);for(let n of r)$(n.run,t);return true}function pe(o,t){if(!t)return null;let n=S(o,false).map(e=>e.text).join(""),a=n.indexOf(t);return a===-1||n.indexOf(t,a+1)!==-1?null:{from:a,to:a+t.length}}function de(o,t){return o?!!o.styles?.some(r=>r.styleId===t&&r.type==="paragraph"):true}function Ee(o){let t=new Set,r=null;function n(){return r===null&&(r=ae(o)),r}function a(){if(t.size===0)return;let e=o.getComments(),i=o.getChanges(),s={commentCount:e.length,changeCount:i.length,comments:e,changes:i};for(let c of t)try{c(s);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return o.getContentAsText(e)},getContent(e){return o.getContent(e)},getComments(e){return o.getComments(e)},getChanges(e){return o.getChanges(e)},findText(e,i){if(!e)return [];let s=i?.caseSensitive??false,c=i?.limit??20,l=s?e:e.toLowerCase(),u=o.toDocument().package?.document;if(!u)return [];let f=[],d=40,x=0;for(let h of u.content){if(f.length>=c)break;if(h.type==="table"){for(let Z of h.rows)for(let _ of Z.cells)for(let q of _.content)q.type==="paragraph"&&x++;continue}if(h.type!=="paragraph"){x++;continue}let E=h,V=x++,y=ie(E),D=s?y:y.toLowerCase(),g=D.indexOf(l);if(g===-1||D.indexOf(l,g+1)!==-1)continue;let Y=y.slice(g,g+e.length);f.push({paraId:E.paraId??String(V),match:Y,before:y.slice(Math.max(0,g-d),g),after:y.slice(g+e.length,g+e.length+d)});}return f},getSelection(){return null},addComment(e){let i=n().get(e.paraId);if(i===void 0)return null;try{let s=o.addComment({paragraphIndex:i,text:e.text,author:e.author,search:e.search});return a(),s}catch{return null}},replyTo(e,i){try{let s=o.replyTo(e,i);return a(),s}catch{return null}},resolveComment(e){let s=o.toDocument().package?.document?.comments?.find(c=>c.id===e);if(!s)throw new R(e);s.done=true,a();},proposeChange(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=e.search==="",c=e.replaceWith==="";if(s&&c)return false;try{return s?o.proposeInsertion({paragraphIndex:i,insertText:e.replaceWith,author:e.author}):c?o.proposeDeletion({paragraphIndex:i,search:e.search,author:e.author}):o.replace({paragraphIndex:i,search:e.search,replaceWith:e.replaceWith,author:e.author}),a(),true}catch{return false}},scrollTo(e){return n().has(e)},applyFormatting(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=o.toDocument().package?.document;if(!s)return false;try{let c=s?v(s,i):null;if(!c)return false;if(e.search){let l=pe(c,e.search);if(!l)return false;le(c,l.from,l.to,e.marks);}else fe(c,e.marks);return a(),true}catch{return false}},setParagraphStyle(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=o.toDocument(),c=s.package?.document;if(!c||!de(s.package?.styles,e.styleId))return false;try{let l=v(c,i);return l.formatting={...l.formatting??{},styleId:e.styleId},a(),true}catch{return false}},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return t.add(e),()=>{t.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=m;exports.b=v;exports.c=F;exports.d=xe;exports.e=ye;exports.f=C;exports.g=N;exports.h=z;exports.i=R;exports.j=ne;exports.k=Ie;exports.l=ke;exports.m=we;exports.n=Ee;
@@ -1,2 +1,2 @@
1
- import {l,k,d,e}from'./chunk-MK47WH2X.mjs';function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
- `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e$1){let t=u(n);return t?e(d(t,e$1)):""},getContent(e){let t=u(n);return t?d(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=l(t,e);if(r.length>0)return r;let l$1=n.getComments();if(l$1.length===0)return [];let a=new Map,g=[];for(let o of l$1)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?k(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?l(t):[],l$1=t?k(t):[];try{e({commentCount:r.length,changeCount:l$1.length,comments:r,changes:l$1});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}export{T as a};
1
+ import {m,l,d,e}from'./chunk-P4DRISTP.mjs';function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
+ `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e$1){let t=u(n);return t?e(d(t,e$1)):""},getContent(e){let t=u(n);return t?d(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=m(t,e);if(r.length>0)return r;let l=n.getComments();if(l.length===0)return [];let a=new Map,g=[];for(let o of l)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m$1=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m$1.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m$1},getChanges(e){let t=u(n);return t?l(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?m(t):[],l$1=t?l(t):[];try{e({commentCount:r.length,changeCount:l$1.length,comments:r,changes:l$1});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}export{T as a};
@@ -0,0 +1 @@
1
+ 'use strict';var chunk4W7OEW2I_js=require('./chunk-4W7OEW2I.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');Object.defineProperty(exports,"ContentControlBoundError",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ga}});Object.defineProperty(exports,"ContentControlLockedError",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ea}});Object.defineProperty(exports,"ContentControlNotFoundError",{enumerable:true,get:function(){return chunk4W7OEW2I_js.da}});Object.defineProperty(exports,"ContentControlTypeError",{enumerable:true,get:function(){return chunk4W7OEW2I_js.fa}});Object.defineProperty(exports,"ContentControlValueError",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ja}});Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Qa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunk4W7OEW2I_js.x}});Object.defineProperty(exports,"RepeatingSectionError",{enumerable:true,get:function(){return chunk4W7OEW2I_js.oa}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Sa}});Object.defineProperty(exports,"addRepeatingSectionItem",{enumerable:true,get:function(){return chunk4W7OEW2I_js.pa}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunk4W7OEW2I_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ha}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunk4W7OEW2I_js.E}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunk4W7OEW2I_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunk4W7OEW2I_js.D}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunk4W7OEW2I_js.B}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ia}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Na}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunk4W7OEW2I_js.M}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunk4W7OEW2I_js.L}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunk4W7OEW2I_js.y}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunk4W7OEW2I_js.z}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ka}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ra}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ua}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunk4W7OEW2I_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ta}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunk4W7OEW2I_js.La}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ea}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Da}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Fa}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunk4W7OEW2I_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunk4W7OEW2I_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunk4W7OEW2I_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunk4W7OEW2I_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunk4W7OEW2I_js.v}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.n}});Object.defineProperty(exports,"findContentControl",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ca}});Object.defineProperty(exports,"findContentControls",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ba}});Object.defineProperty(exports,"formatSdtDate",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ka}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunk4W7OEW2I_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Pa}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Oa}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunk4W7OEW2I_js.A}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunk4W7OEW2I_js.$}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunk4W7OEW2I_js.O}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.K}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunk4W7OEW2I_js.N}});Object.defineProperty(exports,"getContentControlText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.aa}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ba}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunk4W7OEW2I_js.C}});Object.defineProperty(exports,"getDocumentWatermark",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ra}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunk4W7OEW2I_js.R}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunk4W7OEW2I_js.T}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.I}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunk4W7OEW2I_js._}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.G}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Z}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.H}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunk4W7OEW2I_js.F}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunk4W7OEW2I_js.J}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Q}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunk4W7OEW2I_js.P}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunk4W7OEW2I_js.X}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunk4W7OEW2I_js.W}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Y}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunk4W7OEW2I_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunk4W7OEW2I_js.za}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunk4W7OEW2I_js.U}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunk4W7OEW2I_js.S}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ma}});Object.defineProperty(exports,"isRepeatingSection",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ma}});Object.defineProperty(exports,"isRepeatingSectionItem",{enumerable:true,get:function(){return chunk4W7OEW2I_js.na}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunk4W7OEW2I_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Aa}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ja}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ga}});Object.defineProperty(exports,"mapHexToHighlightName",{enumerable:true,get:function(){return chunk4W7OEW2I_js.va}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunk4W7OEW2I_js.Ca}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunk4W7OEW2I_js.w}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunk4W7OEW2I_js.V}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunk4W7OEW2I_js.s}});Object.defineProperty(exports,"removeContentControl",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ia}});Object.defineProperty(exports,"removeRepeatingSectionItem",{enumerable:true,get:function(){return chunk4W7OEW2I_js.qa}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunk4W7OEW2I_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunk4W7OEW2I_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunk4W7OEW2I_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.wa}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.xa}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ya}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunk4W7OEW2I_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunk4W7OEW2I_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunk4W7OEW2I_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunk4W7OEW2I_js.a}});Object.defineProperty(exports,"setContentControlContent",{enumerable:true,get:function(){return chunk4W7OEW2I_js.ha}});Object.defineProperty(exports,"setContentControlValue",{enumerable:true,get:function(){return chunk4W7OEW2I_js.la}});Object.defineProperty(exports,"setDocumentWatermark",{enumerable:true,get:function(){return chunk4W7OEW2I_js.sa}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunk4W7OEW2I_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunk4W7OEW2I_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 chunkEPRXZTIE_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkEPRXZTIE_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.g}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkEPRXZTIE_js.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkEPRXZTIE_js.o}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkEPRXZTIE_js.p}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkEPRXZTIE_js.n}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.l}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkEPRXZTIE_js.h}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkEPRXZTIE_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkEPRXZTIE_js.b}});Object.defineProperty(exports,"pointsToHalfPoints",{enumerable:true,get:function(){return chunkEPRXZTIE_js.m}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.k}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkEPRXZTIE_js.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkEPRXZTIE_js.j}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.e}});
@@ -0,0 +1 @@
1
+ export{ga as ContentControlBoundError,ea as ContentControlLockedError,da as ContentControlNotFoundError,fa as ContentControlTypeError,ja as ContentControlValueError,Qa as DEFAULT_AI_ACTIONS,x as DocumentAgent,oa as RepeatingSectionError,Sa as VERSION,pa as addRepeatingSectionItem,i as attemptSelectiveSave,Ha as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,Ia as colorsEqual,Na as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,Ka as createCollapsedRange,Ra as createCommand,ua as createDocumentWithText,f as createDocx,ta as createEmptyDocument,La as createRange,Ea as createRgbColor,Da as createThemeColor,Fa as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,n as extractVariablesFromText,ca as findContentControl,ba as findContentControls,ka as formatSdtDate,r as formatVariable,Pa as getActionDescription,Oa as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,aa as getContentControlText,Ba as getContrastingColor,C as getDocumentSummary,ra as getDocumentWatermark,R as getFormattingAtPosition,T as getHyperlinkAtPosition,I as getHyperlinkText,_ as getParagraphAtIndex,G as getParagraphText,Z as getParagraphs,H as getRunText,F as getSelectionFormattingSummary,J as getTableText,Q as getTextAfter,P as getTextBefore,X as hasHyperlinks,W as hasImages,Y as hasTables,o as hasTemplateVariables,za as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,Ma as isPositionInRange,ma as isRepeatingSection,na as isRepeatingSectionItem,p as isValidVariableName,Aa as isWhite,Ja as isZodSchema,Ga as lightenColor,va as mapHexToHighlightName,Ca as parseColorString,w as parseDocx,V as parseHeadingLevel,s as parseVariable,ia as removeContentControl,qa as removeRepeatingSectionItem,u as removeVariables,d as repackDocx,t as replaceVariables,wa as resolveColor,xa as resolveHighlightColor,ya as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,ha as setContentControlContent,la as setContentControlValue,sa as setDocumentWatermark,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-2OIX7TUX.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,g as emuToPixels,i as emuToTwips,o as executeCommand,p as executeCommands,n as formatPx,l as halfPointsToPixels,h as pixelsToEmu,f as pixelsToTwips,b as pluginRegistry,m as pointsToHalfPoints,k as pointsToPixels,c as registerPlugins,j as twipsToEmu,e as twipsToPixels}from'./chunk-XDZHYYU6.mjs';
package/dist/index.d.mts CHANGED
@@ -28,8 +28,8 @@
28
28
  * @packageDocumentation
29
29
  * @public
30
30
  */
31
- import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-uM9UUIhk.mjs';
32
- export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-uM9UUIhk.mjs';
31
+ import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-BaVhdHCd.mjs';
32
+ export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-BaVhdHCd.mjs';
33
33
 
34
34
  /**
35
35
  * Error classes for @eigenpal/docx-editor-agents
@@ -40,6 +40,17 @@ declare class TextNotFoundError extends Error {
40
40
  declare class ChangeNotFoundError extends Error {
41
41
  constructor(id: number);
42
42
  }
43
+ /**
44
+ * Thrown when accept/reject resolves a tracked change to a footnote or endnote
45
+ * body. accept/reject operate on the document body only, and a tracked-change
46
+ * `w:id` is unique only within its part (document.xml / footnotes.xml /
47
+ * endnotes.xml), so a note change cannot be mutated through this reviewer yet.
48
+ * Fails closed rather than silently no-op'ing or mis-reporting the change as
49
+ * not-found.
50
+ */
51
+ declare class NoteChangeNotEditableError extends Error {
52
+ constructor(id: number, noteType: 'footnote' | 'endnote', noteId: number);
53
+ }
43
54
  declare class CommentNotFoundError extends Error {
44
55
  constructor(id: number);
45
56
  }
@@ -174,4 +185,4 @@ interface WordCompatBridge {
174
185
  onSelectionChange(listener: (event: SelectionChangeEvent) => void): () => void;
175
186
  }
176
187
 
177
- export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
188
+ export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, NoteChangeNotEditableError, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
package/dist/index.d.ts CHANGED
@@ -28,8 +28,8 @@
28
28
  * @packageDocumentation
29
29
  * @public
30
30
  */
31
- import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-uM9UUIhk.js';
32
- export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-uM9UUIhk.js';
31
+ import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-BaVhdHCd.js';
32
+ export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-BaVhdHCd.js';
33
33
 
34
34
  /**
35
35
  * Error classes for @eigenpal/docx-editor-agents
@@ -40,6 +40,17 @@ declare class TextNotFoundError extends Error {
40
40
  declare class ChangeNotFoundError extends Error {
41
41
  constructor(id: number);
42
42
  }
43
+ /**
44
+ * Thrown when accept/reject resolves a tracked change to a footnote or endnote
45
+ * body. accept/reject operate on the document body only, and a tracked-change
46
+ * `w:id` is unique only within its part (document.xml / footnotes.xml /
47
+ * endnotes.xml), so a note change cannot be mutated through this reviewer yet.
48
+ * Fails closed rather than silently no-op'ing or mis-reporting the change as
49
+ * not-found.
50
+ */
51
+ declare class NoteChangeNotEditableError extends Error {
52
+ constructor(id: number, noteType: 'footnote' | 'endnote', noteId: number);
53
+ }
43
54
  declare class CommentNotFoundError extends Error {
44
55
  constructor(id: number);
45
56
  }
@@ -174,4 +185,4 @@ interface WordCompatBridge {
174
185
  onSelectionChange(listener: (event: SelectionChangeEvent) => void): () => void;
175
186
  }
176
187
 
177
- export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
188
+ export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, NoteChangeNotEditableError, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkNSFRE2VK_js=require('./chunk-NSFRE2VK.js'),chunkMHUG23P6_js=require('./chunk-MHUG23P6.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkNSFRE2VK_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkMHUG23P6_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkMHUG23P6_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkMHUG23P6_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkMHUG23P6_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 chunkLX3NJWKV_js=require('./chunk-LX3NJWKV.js'),chunkXUAUDUJU_js=require('./chunk-XUAUDUJU.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkLX3NJWKV_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.i}});Object.defineProperty(exports,"NoteChangeNotEditableError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkXUAUDUJU_js.n}});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-6KT5LOQB.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-MK47WH2X.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
1
+ export{a as DocxReviewer}from'./chunk-NFAEIOLC.mjs';export{g as ChangeNotFoundError,i as CommentNotFoundError,h as NoteChangeNotEditableError,f as TextNotFoundError,n as createReviewerBridge}from'./chunk-P4DRISTP.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
package/dist/mcp.d.mts CHANGED
@@ -17,7 +17,7 @@
17
17
  * @packageDocumentation
18
18
  * @public
19
19
  */
20
- import { E as EditorBridge } from './server-uM9UUIhk.mjs';
20
+ import { E as EditorBridge } from './server-BaVhdHCd.mjs';
21
21
 
22
22
  /**
23
23
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/mcp.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * @packageDocumentation
18
18
  * @public
19
19
  */
20
- import { E as EditorBridge } from './server-uM9UUIhk.js';
20
+ import { E as EditorBridge } from './server-BaVhdHCd.js';
21
21
 
22
22
  /**
23
23
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/react.d.mts CHANGED
@@ -18,8 +18,8 @@
18
18
  * @packageDocumentation
19
19
  * @public
20
20
  */
21
- import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-uM9UUIhk.mjs';
22
- export { t as getToolDisplayName } from './server-uM9UUIhk.mjs';
21
+ import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-BaVhdHCd.mjs';
22
+ export { t as getToolDisplayName } from './server-BaVhdHCd.mjs';
23
23
  import * as react_jsx_runtime from 'react/jsx-runtime';
24
24
  import { ReactNode, CSSProperties } from 'react';
25
25
  import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.mjs';
package/dist/react.d.ts CHANGED
@@ -18,8 +18,8 @@
18
18
  * @packageDocumentation
19
19
  * @public
20
20
  */
21
- import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-uM9UUIhk.js';
22
- export { t as getToolDisplayName } from './server-uM9UUIhk.js';
21
+ import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-BaVhdHCd.js';
22
+ export { t as getToolDisplayName } from './server-BaVhdHCd.js';
23
23
  import * as react_jsx_runtime from 'react/jsx-runtime';
24
24
  import { ReactNode, CSSProperties } from 'react';
25
25
  import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.js';
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkDIXFGAF5_js=require('./chunk-DIXFGAF5.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkRI5S75JY_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunkDIXFGAF5_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkRI5S75JY_js.b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=react.useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=react.useMemo(()=>{let i=u||d?chunkRI5S75JY_js.a.filter(n=>r(n.name)):chunkRI5S75JY_js.a;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=react.useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=chunkDIXFGAF5_js.a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?chunkRI5S75JY_js.b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=react.useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=chunkDIXFGAF5_js.a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=react.useState(false),T=react.useRef(o);react.useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=react.useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=react.useRef(null),B=react.useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=react.useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=react.useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return react.useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxRuntime.jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsxRuntime.jsx(ae,{size:22})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsxRuntime.jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsxRuntime.jsx(le,{size:18})})]}),jsxRuntime.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
1
+ 'use strict';var chunk7PTBNHAH_js=require('./chunk-7PTBNHAH.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkRI5S75JY_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunk7PTBNHAH_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkRI5S75JY_js.b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=react.useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=react.useMemo(()=>{let i=u||d?chunkRI5S75JY_js.a.filter(n=>r(n.name)):chunkRI5S75JY_js.a;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=react.useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=chunk7PTBNHAH_js.a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?chunkRI5S75JY_js.b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=react.useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=chunk7PTBNHAH_js.a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=react.useState(false),T=react.useRef(o);react.useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=react.useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=react.useRef(null),B=react.useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=react.useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=react.useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return react.useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxRuntime.jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsxRuntime.jsx(ae,{size:22})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsxRuntime.jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsxRuntime.jsx(le,{size:18})})]}),jsxRuntime.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
2
2
  @keyframes epAgentDot {
3
3
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
4
4
  40% { transform: scale(1); opacity: 1; }
package/dist/react.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-HTU7NUTJ.mjs';import {d,b,a as a$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useMemo,useCallback,useState,useRef,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var te=d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=useMemo(()=>({get:()=>t.current?a(t.current,l):null}),[t,l]);return {executeToolCall:useCallback((d,p)=>{let r=c.get();return r?b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=useMemo(()=>{let i=u||d?a$1.filter(n=>r(n.name)):a$1;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=useState(false),T=useRef(o);useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=useRef(null),B=useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsx(ae,{size:22})}),jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsx(le,{size:18})})]}),jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
1
+ import {a}from'./chunk-YQIAKHOL.mjs';import {d,b,a as a$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useMemo,useCallback,useState,useRef,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var te=d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=useMemo(()=>({get:()=>t.current?a(t.current,l):null}),[t,l]);return {executeToolCall:useCallback((d,p)=>{let r=c.get();return r?b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=useMemo(()=>{let i=u||d?a$1.filter(n=>r(n.name)):a$1;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=useState(false),T=useRef(o);useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=useRef(null),B=useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsx(ae,{size:22})}),jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsx(le,{size:18})})]}),jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
2
2
  @keyframes epAgentDot {
3
3
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
4
4
  40% { transform: scale(1); opacity: 1; }