@eigenpal/docx-editor-agents 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/{chunk-WDPSOX2B.mjs → chunk-3RLSV2EA.mjs} +1 -1
- package/dist/chunk-5THPDZLF.mjs +5 -0
- package/dist/chunk-EX4NO3JP.js +5 -0
- package/dist/{chunk-VAQTAQZG.js → chunk-JMEIIPEL.js} +1 -1
- package/dist/chunk-RTU2ZS7R.js +75 -0
- package/dist/chunk-X5FXVERG.mjs +75 -0
- package/dist/{chunk-CGBO6ID5.mjs → chunk-YAKNDLQA.mjs} +1 -1
- package/dist/{chunk-B56JZP3K.js → chunk-YIZV6SSD.js} +2 -2
- package/dist/headless-6GD55ATM.js +1 -0
- package/dist/{headless-GFPWSIA3.mjs → headless-ESEZ6OHS.mjs} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-4C2IJ7OV.js +0 -75
- package/dist/chunk-ICDWMZPG.mjs +0 -75
- package/dist/chunk-J773ZJGL.mjs +0 -5
- package/dist/chunk-YU3OJ2DE.js +0 -5
- package/dist/headless-BS5JJGVC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {e,f,l as l$1,m,b,j,i,c,k,h,a,d}from'./chunk-
|
|
1
|
+
import {e,f,l as l$1,m,b,j,i,c,k,h,a,d}from'./chunk-5THPDZLF.mjs';import {w}from'./chunk-X5FXVERG.mjs';function y(n,e){let{paragraphIndex:t,author:o="AI",text:s,search:a}=e,r=b(n,t),c=(n.comments??[]).map(m=>m.id),p=c.length>0?Math.max(...c)+1:1,i={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(i),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 C(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,c={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(c),r}function N(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 c=r.content.length-1;c>=0;c--){let p=r.content[c];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(c,1);}});}function I(n,e,t){if(!W(n,e,"accept",t))throw new h(typeof e=="number"?e:e.id)}function R(n,e,t){if(!W(n,e,"reject",t))throw new h(typeof e=="number"?e:e.id)}function F(n,e,t){return G(n,"accept",e,t)}function M(n,e,t){return G(n,"reject",e,t)}function l(n,e,t){let o=0;for(let s=n.content.length-1;s>=0;s--){let a$1=n.content[s];a(a$1)&&t(a$1)&&(J(n,s,a$1,e),o++);}return o}function W(n,e,t,o){if(typeof e!="number"&&e.noteType){let a=e.noteType==="footnote"?o?.footnotes:o?.endnotes,r=e.noteId!==void 0?a?.find(c=>c.id===e.noteId):void 0;return r?z(r,e.id,t):false}let s=typeof e=="number"?e:e.id;return q(n,s,t)}function G(n,e,t,o){let s=0;if(c(n,a=>{s+=l(a,e,()=>true);}),t?.includeFootnotes&&o?.footnotes)for(let a of o.footnotes)d(a,r=>{s+=l(r,e,()=>true);});if(t?.includeEndnotes&&o?.endnotes)for(let a of o.endnotes)d(a,r=>{s+=l(r,e,()=>true);});return s}function q(n,e,t){let o=false;return c(n,s=>{if(l(s,t,a=>a.info.id===e)>0&&(o=true),o)return false}),o}function z(n,e,t){let o=false;return d(n,s=>{l(s,t,a=>a.info.id===e)>0&&(o=true);}),o}function J(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:c,endIndex:p}=k(r,o,t),i=new Date().toISOString(),m=P(n),d=r.content.slice(c,p+1),v={type:"deletion",info:{id:m,author:s,date:i},content:d},b$1={type:"insertion",info:{id:m+1,author:s,date:i},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(c,p-c+1,v,b$1);}function H(n,e){let{paragraphIndex:t,author:o="AI",insertText:s,position:a="after",search:r}=e,c=b(n,t),p=new Date().toISOString(),m={type:"insertion",info:{id:P(n),author:o,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:d,endIndex:v}=k(c,r,t),b=a==="after"?v+1:d;c.content.splice(b,0,m);}else a==="before"?c.content.unshift(m):c.content.push(m);}function L(n,e){let{paragraphIndex:t,search:o,author:s="AI"}=e,a=b(n,t),{startIndex:r,endIndex:c}=k(a,o,t),p=new Date().toISOString(),i=P(n),m=a.content.slice(r,c+1),d={type:"deletion",info:{id:i,author:s,date:p},content:m};a.content.splice(r,c-r+1,d);}var S=new WeakMap;function P(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,c=0,p=0;for(let i of e.accept??[])try{I(n,i),s++;}catch(m){o.push({operation:"accept",id:i,error:m.message});}for(let i of e.reject??[])try{R(n,i),a++;}catch(m){o.push({operation:"reject",id:i,error:m.message});}for(let i of e.comments??[])try{y(n,{...i,author:i.author??t}),r++;}catch(m){o.push({operation:"comment",search:i.search,error:m.message});}for(let i of e.replies??[])try{C(n,i.commentId,{author:i.author??t,text:i.text}),c++;}catch(m){o.push({operation:"reply",id:i.commentId,error:m.message});}for(let i of e.proposals??[])try{x(n,{...i,author:i.author??t}),p++;}catch(m){o.push({operation:"proposal",search:i.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:c,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(e,{preloadFonts:false});return new n(o,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e$1){return e(this.body,e$1)}getContentAsText(e$1){return f(e(this.body,e$1))}getChanges(e){return l$1(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 y(this.body,o)}replyTo(e,t){let o=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return C(this.body,e,o)}removeComment(e){N(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){H(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}acceptChange(e){I(this.body,e,this.changeNotes());}rejectChange(e){R(this.body,e,this.changeNotes());}acceptAll(e){return F(this.body,e,this.changeNotes())}rejectAll(e){return M(this.body,e,this.changeNotes())}changeNotes(){return {footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes}}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-ESEZ6OHS.mjs');return e(this.doc)}};export{X as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
`)}function u(n){let l=n.getEditorRef();if(l){let e=l.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function k(n,l="AI"){function s(e){return e??l}return {getContentAsText(e){let t=u(n);return t?
|
|
1
|
+
'use strict';var chunkEX4NO3JP_js=require('./chunk-EX4NO3JP.js');function y(n){return !n||n.length===0?"":n.map(l=>{let s=l;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
|
|
2
|
+
`)}function u(n){let l=n.getEditorRef();if(l){let e=l.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function k(n,l="AI"){function s(e){return e??l}return {getContentAsText(e){let t=u(n);return t?chunkEX4NO3JP_js.f(chunkEX4NO3JP_js.e(t,e)):""},getContent(e){let t=u(n);return t?chunkEX4NO3JP_js.e(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=chunkEX4NO3JP_js.m(t,e);if(r.length>0)return r;let i=n.getComments();if(i.length===0)return [];let a=new Map,g=[];for(let o of i)if(o.parentId){let p=a.get(o.parentId);p?p.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 p=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:p.map(c=>({id:c.id,author:c.author,date:c.date??null,text:y(c.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?chunkEX4NO3JP_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})},insertBreak(e){return n.insertBreak({paraId:e.paraId,type:e.type})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),i=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=i;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?chunkEX4NO3JP_js.m(t):[],i=t?chunkEX4NO3JP_js.l(t):[];try{e({commentCount:r.length,changeCount:i.length,comments:r,changes:i});}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=k;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkRTU2ZS7R_js=require('./chunk-RTU2ZS7R.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunkMMJQ47Q7_js=require('./chunk-MMJQ47Q7.js');Object.defineProperty(exports,"ContentControlBoundError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ga}});Object.defineProperty(exports,"ContentControlLockedError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ea}});Object.defineProperty(exports,"ContentControlNotFoundError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.da}});Object.defineProperty(exports,"ContentControlTypeError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.fa}});Object.defineProperty(exports,"ContentControlValueError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ja}});Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Qa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.x}});Object.defineProperty(exports,"RepeatingSectionError",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.oa}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Sa}});Object.defineProperty(exports,"addRepeatingSectionItem",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.pa}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ha}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.E}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.D}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.B}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ia}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Na}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.M}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.L}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.y}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.z}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ka}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ra}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ua}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ta}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.La}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ea}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Da}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Fa}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.v}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.n}});Object.defineProperty(exports,"findContentControl",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ca}});Object.defineProperty(exports,"findContentControls",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ba}});Object.defineProperty(exports,"formatSdtDate",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ka}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Pa}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Oa}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.A}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.$}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.O}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.K}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.N}});Object.defineProperty(exports,"getContentControlText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.aa}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ba}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.C}});Object.defineProperty(exports,"getDocumentWatermark",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ra}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.R}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.T}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.I}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkRTU2ZS7R_js._}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.G}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Z}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.H}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.F}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.J}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Q}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.P}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.X}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.W}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Y}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.za}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.U}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.S}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ma}});Object.defineProperty(exports,"isRepeatingSection",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ma}});Object.defineProperty(exports,"isRepeatingSectionItem",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.na}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Aa}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ja}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ga}});Object.defineProperty(exports,"mapHexToHighlightName",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.va}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.Ca}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.w}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.V}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.s}});Object.defineProperty(exports,"removeContentControl",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ia}});Object.defineProperty(exports,"removeRepeatingSectionItem",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.qa}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.wa}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.xa}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ya}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.a}});Object.defineProperty(exports,"setContentControlContent",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.ha}});Object.defineProperty(exports,"setContentControlValue",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.la}});Object.defineProperty(exports,"setDocumentWatermark",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.sa}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkRTU2ZS7R_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkRTU2ZS7R_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 chunkMMJQ47Q7_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.g}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.o}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.p}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.n}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.l}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.h}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.b}});Object.defineProperty(exports,"pointsToHalfPoints",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.m}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.k}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.j}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkMMJQ47Q7_js.e}});
|
|
@@ -1 +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-
|
|
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-X5FXVERG.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-6RMDMHUK.mjs';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJMEIIPEL_js=require('./chunk-JMEIIPEL.js'),chunkEX4NO3JP_js=require('./chunk-EX4NO3JP.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkJMEIIPEL_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkEX4NO3JP_js.h}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkEX4NO3JP_js.i}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkEX4NO3JP_js.g}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkEX4NO3JP_js.n}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.d}});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-YAKNDLQA.mjs';export{h as ChangeNotFoundError,i as CommentNotFoundError,g as TextNotFoundError,n as createReviewerBridge}from'./chunk-5THPDZLF.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-MSKW7E36.mjs';
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkYIZV6SSD_js=require('./chunk-YIZV6SSD.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkAO5SO6ZS_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunkYIZV6SSD_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkAO5SO6ZS_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?chunkAO5SO6ZS_js.a.filter(n=>r(n.name)):chunkAO5SO6ZS_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=chunkYIZV6SSD_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)?chunkAO5SO6ZS_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=chunkYIZV6SSD_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-
|
|
1
|
+
import {a}from'./chunk-3RLSV2EA.mjs';import {d,b,a as a$1}from'./chunk-MSKW7E36.mjs';export{c as getToolDisplayName}from'./chunk-MSKW7E36.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; }
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJMEIIPEL_js=require('./chunk-JMEIIPEL.js'),chunkEX4NO3JP_js=require('./chunk-EX4NO3JP.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkJMEIIPEL_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkEX4NO3JP_js.n}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.d}});
|
package/dist/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-YAKNDLQA.mjs';export{n as createReviewerBridge}from'./chunk-5THPDZLF.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-MSKW7E36.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eigenpal/docx-editor-agents",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Agent SDK and chat UI for the DOCX editor — framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI (and Vue UI in 1.x)",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css"
|