@eigenpal/docx-js-editor 0.0.11 → 0.0.13
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/DocumentAgent-Ci6_T-XM.d.ts +412 -0
- package/dist/DocumentAgent-DEGFgYEN.d.cts +412 -0
- package/dist/FindReplaceDialog-BAACAU67.cjs +1 -0
- package/dist/FindReplaceDialog-RWYDRWHF.js +1 -0
- package/dist/FootnotePropertiesDialog-BC6JIPDA.cjs +1 -0
- package/dist/FootnotePropertiesDialog-CWQF5EBK.js +1 -0
- package/dist/HyperlinkDialog-EG2BSLPD.cjs +1 -0
- package/dist/HyperlinkDialog-YAVK64F4.js +1 -0
- package/dist/ImagePositionDialog-IGYS5KMK.cjs +1 -0
- package/dist/ImagePositionDialog-S6SMH7XH.js +1 -0
- package/dist/ImagePropertiesDialog-UO5QUIBS.js +1 -0
- package/dist/ImagePropertiesDialog-VGV4E4SN.cjs +1 -0
- package/dist/TablePropertiesDialog-VBOU4DID.js +1 -0
- package/dist/TablePropertiesDialog-WRM47JI6.cjs +1 -0
- package/dist/{types-BALm1KBi.d.cts → agentApi-CbVUCZRu.d.cts} +1 -308
- package/dist/{types-BALm1KBi.d.ts → agentApi-CbVUCZRu.d.ts} +1 -308
- package/dist/chunk-2ASOEN3V.js +1 -0
- package/dist/chunk-6MBDPZVD.js +111 -0
- package/dist/chunk-6YLNNCRZ.cjs +10 -0
- package/dist/chunk-BVQ2QRHA.cjs +4 -0
- package/dist/chunk-COP5BIBZ.js +10 -0
- package/dist/chunk-CZ7W7MCM.cjs +2 -0
- package/dist/chunk-E6XDMUAM.js +4 -0
- package/dist/chunk-EMKABJPH.js +1 -0
- package/dist/{chunk-TRAQI6RX.cjs → chunk-EPCZ24TY.cjs} +5 -5
- package/dist/chunk-ESI4BSBF.js +1 -0
- package/dist/chunk-FLECKDK4.cjs +58 -0
- package/dist/chunk-ITWEFKGQ.cjs +1 -0
- package/dist/chunk-KESNGXGO.js +1 -0
- package/dist/chunk-KVAT5SVD.js +2 -0
- package/dist/chunk-L34XFLQZ.cjs +1 -0
- package/dist/chunk-M7F2CUUD.js +2 -0
- package/dist/chunk-MDPDH7KS.js +58 -0
- package/dist/chunk-MTX3EEBJ.js +258 -0
- package/dist/chunk-NT2REEAA.cjs +1 -0
- package/dist/{chunk-PM4Y7OFN.js → chunk-OTG4NABM.js} +5 -5
- package/dist/chunk-OW5H5DNE.cjs +1 -0
- package/dist/chunk-PJVI53AH.js +2 -0
- package/dist/chunk-PNMZPPPI.cjs +2 -0
- package/dist/chunk-SF53KLDZ.cjs +1 -0
- package/dist/chunk-TOI5W3HK.js +8 -0
- package/dist/chunk-UAVOWAIF.cjs +8 -0
- package/dist/chunk-VN7XH644.cjs +258 -0
- package/dist/chunk-W4DUKACP.cjs +111 -0
- package/dist/chunk-XS2AQFMF.cjs +2 -0
- package/dist/chunk-ZDYHAYN6.js +1 -0
- package/dist/clipboard-BOocwmAM.d.ts +539 -0
- package/dist/clipboard-Cx7cb3kX.d.cts +539 -0
- package/dist/{colorResolver-BNj-uZ58.d.ts → colorResolver-CIDiSPWd.d.cts} +3 -411
- package/dist/{colorResolver-DiMquGWR.d.cts → colorResolver-KXbUgzWC.d.ts} +3 -411
- package/dist/core-plugins.cjs +1 -1
- package/dist/core-plugins.d.cts +4 -3
- package/dist/core-plugins.d.ts +4 -3
- package/dist/core-plugins.js +1 -1
- package/dist/core.cjs +1 -0
- package/dist/core.d.cts +23 -0
- package/dist/core.d.ts +23 -0
- package/dist/core.js +1 -0
- package/dist/headless.cjs +2 -2
- package/dist/headless.d.cts +8 -175
- package/dist/headless.d.ts +8 -175
- package/dist/headless.js +1 -1
- package/dist/index.cjs +9 -378
- package/dist/index.d.cts +17 -4161
- package/dist/index.d.ts +17 -4161
- package/dist/index.js +9 -378
- package/dist/insertOperations-CzB5b-Of.d.ts +176 -0
- package/dist/insertOperations-DKVmCV32.d.cts +176 -0
- package/dist/mcp-cli.js +21 -21
- package/dist/mcp.cjs +10 -10
- package/dist/mcp.d.cts +2 -1
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +9 -9
- package/dist/processTemplate-BHBTDAIC.js +1 -0
- package/dist/processTemplate-QOEAXCKA.cjs +1 -0
- package/dist/react-Be1YOl4z.d.ts +1356 -0
- package/dist/react-DPuSVbgY.d.cts +1356 -0
- package/dist/react.cjs +1 -0
- package/dist/react.css +1 -0
- package/dist/react.d.cts +9 -0
- package/dist/react.d.ts +9 -0
- package/dist/react.js +1 -0
- package/dist/{registry-CzqAPdui.d.ts → registry-D4tvj9f3.d.ts} +1 -1
- package/dist/{registry-BUTMLqSj.d.cts → registry-ngv6Bumt.d.cts} +1 -1
- package/dist/types-D96elyJF.d.cts +310 -0
- package/dist/types-xMzSPT4i.d.ts +310 -0
- package/dist/ui.cjs +1 -0
- package/dist/ui.d.cts +2103 -0
- package/dist/ui.d.ts +2103 -0
- package/dist/ui.js +1 -0
- package/dist/variableDetector-CPxKo9jP.d.cts +173 -0
- package/dist/variableDetector-DeM1N-_L.d.ts +173 -0
- package/package.json +85 -10
- package/dist/chunk-GQ4JYQWC.js +0 -58
- package/dist/chunk-H3JNHCD7.cjs +0 -10
- package/dist/chunk-L2UUZRZI.js +0 -10
- package/dist/chunk-QOIY4Y6N.cjs +0 -9
- package/dist/chunk-QYKJKSKZ.cjs +0 -58
- package/dist/chunk-TPUJJJWA.js +0 -9
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
'use strict';var chunkSF53KLDZ_cjs=require('./chunk-SF53KLDZ.cjs'),chunkRTESADL3_cjs=require('./chunk-RTESADL3.cjs'),oe=require('react'),F=require('@radix-ui/react-select'),clsx=require('clsx'),jsxRuntime=require('react/jsx-runtime');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var oe__namespace=/*#__PURE__*/_interopNamespace(oe);var F__namespace=/*#__PURE__*/_interopNamespace(F);var Xl={};chunkRTESADL3_cjs.c(Xl,{CLIPBOARD_TYPES:()=>exports.ca,INTERNAL_CLIPBOARD_TYPE:()=>exports.ba,cleanWordHtml:()=>lo,copyParagraphs:()=>Ln,copyRuns:()=>Zt,createClipboardHandlers:()=>En,default:()=>jl,handlePasteEvent:()=>no,htmlToRuns:()=>so,isEditorHtml:()=>io,isWordHtml:()=>ao,paragraphsToClipboardContent:()=>Rn,parseClipboardHtml:()=>ro,readFromClipboard:()=>Mn,runsToClipboardContent:()=>Et,writeToClipboard:()=>at});async function Zt(e,t={}){let{includeFormatting:o=true,onError:n}=t;try{let a=Et(e,o);return await at(a)}catch(a){return n?.(a),false}}async function Ln(e,t={}){let{includeFormatting:o=true,onError:n}=t;try{let a=Rn(e,o);return await at(a)}catch(a){return n?.(a),false}}function Et(e,t=true){let o=e.map(co).join(""),n=t?Zn(e):po(o),a=JSON.stringify(e);return {plainText:o,html:n,internal:a}}function Rn(e,t=true){let o=e.map(Ul).join(`
|
|
2
|
+
`),n=t?Yl(e):po(o),a=JSON.stringify(e);return {plainText:o,html:n,internal:a}}async function at(e){try{if(navigator.clipboard&&navigator.clipboard.write){let t=[new ClipboardItem({[exports.ca.PLAIN]:new Blob([e.plainText],{type:exports.ca.PLAIN}),[exports.ca.HTML]:new Blob([e.html],{type:exports.ca.HTML})})];return await navigator.clipboard.write(t),!0}return In(e)}catch{return In(e)}}function In(e){let t=document.createElement("div");t.innerHTML=e.html,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t);try{let o=window.getSelection();if(!o)return !1;let n=document.createRange();n.selectNodeContents(t),o.removeAllRanges(),o.addRange(n);let a=document.execCommand("copy");return o.removeAllRanges(),a}finally{document.body.removeChild(t);}}async function Mn(e={}){let{cleanWordFormatting:t=true,onError:o}=e;try{if(navigator.clipboard&&navigator.clipboard.read){let n=await navigator.clipboard.read();return await $l(n,t)}return null}catch(n){return o?.(n),null}}async function $l(e,t){let o="",n="";for(let a of e)a.types.includes(exports.ca.HTML)&&(o=await(await a.getType(exports.ca.HTML)).text()),a.types.includes(exports.ca.PLAIN)&&(n=await(await a.getType(exports.ca.PLAIN)).text());return ro(o,n,t)}function no(e,t={}){let{cleanWordFormatting:o=true}=t,n=e.clipboardData;if(!n)return null;let a=n.getData(exports.ca.HTML),i=n.getData(exports.ca.PLAIN);return ro(a,i,o)}function ro(e,t,o=true){let n=ao(e),a=io(e);if(a){let u=e.match(/data-docx-editor-content="([^"]+)"/);if(u)try{return {runs:JSON.parse(decodeURIComponent(u[1])),fromWord:!1,fromEditor:!0,plainText:t}}catch{}}let i=e;return n&&o&&(i=lo(e)),{runs:so(i,t),fromWord:n,fromEditor:a,plainText:t}}function ao(e){return e.includes("urn:schemas-microsoft-com:office")||e.includes("mso-")||e.includes("MsoNormal")||e.includes('class="Mso')||e.includes("<!--[if gte mso")}function io(e){return e.includes("data-docx-editor")||e.includes("docx-run")||e.includes("docx-paragraph")}function lo(e){let t=e;return t=t.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,""),t=t.replace(/<!--[\s\S]*?-->/g,""),t=t.replace(/<\?xml[^>]*>/gi,""),t=t.replace(/<o:[^>]*>[\s\S]*?<\/o:[^>]*>/gi,""),t=t.replace(/<o:[^>]*\/>/gi,""),t=t.replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,""),t=t.replace(/<w:[^>]*\/>/gi,""),t=t.replace(/\s*mso-[^:;]+:[^;]+;?/gi,""),t=t.replace(/\s*style="\s*"/gi,""),t=t.replace(/\s*class="[^"]*Mso[^"]*"/gi,""),t=t.replace(/<span[^>]*>\s*<\/span>/gi,""),t=t.replace(/<\/?font[^>]*>/gi,""),t=t.replace(/\s+/g," ").trim(),t}function so(e,t){if(!e||e.trim()==="")return t?[oo(t)]:[];let o=document.createElement("div");o.innerHTML=e;let n=[];return to(o,n,{}),n.length===0&&t?[oo(t)]:n}function to(e,t,o){if(e.nodeType===Node.TEXT_NODE){let r=e.textContent||"";(r.trim()||r.includes(" "))&&t.push(oo(r,o));return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e,a=n.tagName.toLowerCase(),i={...o,...Gl(n)};switch(a){case "br":t.push(kn(i));return;case "p":case "div":for(let r of n.childNodes)to(r,t,i);n.nextSibling&&t.push(kn(i));return;case "b":case "strong":i.bold=true;break;case "i":case "em":i.italic=true;break;case "u":i.underline={style:"single"};break;case "s":case "strike":case "del":i.strike=true;break;case "sup":i.vertAlign="superscript";break;case "sub":i.vertAlign="subscript";break;case "code":case "pre":i.fontFamily={ascii:"Courier New"};break}for(let r of n.childNodes)to(r,t,i);}function Gl(e){let t={},o=e.style;(o.fontWeight==="bold"||parseInt(o.fontWeight)>=700)&&(t.bold=true),o.fontStyle==="italic"&&(t.italic=true);let n=o.textDecoration||o.textDecorationLine;if(n&&(n.includes("underline")&&(t.underline={style:"single"}),n.includes("line-through")&&(t.strike=true)),o.fontSize){let a=parseFloat(o.fontSize);isNaN(a)||(t.fontSize=Math.round(a/1.333*2));}if(o.fontFamily){let a=o.fontFamily.replace(/["']/g,"").split(",")[0].trim();a&&(t.fontFamily={ascii:a});}if(o.color){let a=Pn(o.color);a&&(t.color={rgb:a});}if(o.backgroundColor&&o.backgroundColor!=="transparent"){let a=Pn(o.backgroundColor);a&&(t.shading={fill:{rgb:a}});}return t}function Pn(e){if(!e||e==="transparent"||e==="inherit")return null;if(e.startsWith("#"))return e.slice(1).toUpperCase();let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){let o=parseInt(t[1]).toString(16).padStart(2,"0"),n=parseInt(t[2]).toString(16).padStart(2,"0"),a=parseInt(t[3]).toString(16).padStart(2,"0");return (o+n+a).toUpperCase()}return null}function co(e){return e.content.map(t=>t.type==="text"?t.text:t.type==="tab"?" ":t.type==="break"&&t.breakType==="textWrapping"?`
|
|
3
|
+
`:"").join("")}function Ul(e){return (e.content||[]).map(t=>t.type==="run"?co(t):"").join("")}function Zn(e){return e.map(Kl).join("")}function Yl(e){return e.map(t=>`<p>${Zn(t.content?.filter(o=>o.type==="run")||[])}</p>`).join("")}function Kl(e){let t=co(e);if(!t)return "";let o=po(t),n=e.formatting;if(!n)return o;n.bold&&(o=`<strong>${o}</strong>`),n.italic&&(o=`<em>${o}</em>`),n.underline&&(o=`<u>${o}</u>`),n.strike&&(o=`<s>${o}</s>`),n.vertAlign==="superscript"&&(o=`<sup>${o}</sup>`),n.vertAlign==="subscript"&&(o=`<sub>${o}</sub>`);let a=[];if(n.fontSize){let i=n.fontSize/2;a.push(`font-size: ${i}pt`);}return n.fontFamily?.ascii&&a.push(`font-family: "${n.fontFamily.ascii}"`),n.color?.rgb&&a.push(`color: #${n.color.rgb}`),n.shading?.fill?.rgb&&a.push(`background-color: #${n.shading.fill.rgb}`),a.length>0&&(o=`<span style="${a.join("; ")}">${o}</span>`),o}function po(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function oo(e,t){return {type:"run",formatting:t,content:[{type:"text",text:e}]}}function kn(e){return {type:"run",formatting:e,content:[{type:"break",breakType:"textWrapping"}]}}function En(e){let{onCopy:t,onCut:o,onPaste:n,clipboardOptions:a={}}=e;return {handleCopy:async l=>{if(!t)return;let c=t();if(!c)return;l.preventDefault();let p=Et(c.runs);l.clipboardData?(l.clipboardData.setData(exports.ca.PLAIN,p.plainText),l.clipboardData.setData(exports.ca.HTML,p.html)):await at(p);},handleCut:async l=>{if(!o)return;let c=o();if(!c)return;l.preventDefault();let p=Et(c.runs);l.clipboardData?(l.clipboardData.setData(exports.ca.PLAIN,p.plainText),l.clipboardData.setData(exports.ca.HTML,p.html)):await at(p);},handlePaste:l=>{if(!n)return;l.preventDefault();let c=no(l,a);c&&n(c);},handleKeyDown:async l=>{let c=l.ctrlKey||l.metaKey;if(c&&l.key==="c"&&!l.shiftKey&&t){let p=t();p&&await Zt(p.runs,a);}if(c&&l.key==="x"&&!l.shiftKey&&o){let p=o();p&&await Zt(p.runs,a);}}}}exports.ba=void 0;exports.ca=void 0;var jl,Ql=chunkRTESADL3_cjs.b(()=>{exports.ba="application/x-docx-editor",exports.ca={HTML:"text/html",PLAIN:"text/plain"};jl={copyRuns:Zt,copyParagraphs:Ln,readFromClipboard:Mn,handlePasteEvent:no,htmlToRuns:so,cleanWordHtml:lo,isWordHtml:ao,isEditorHtml:io,createClipboardHandlers:En};});function w(...e){return clsx.clsx(e)}var Te=F__namespace.Root,Ve=F__namespace.Group,pt=F__namespace.Value;function we({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(F__namespace.Trigger,{className:w("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-slate-700 bg-transparent","hover:bg-slate-100/80 focus:outline-none focus:bg-slate-100/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:a=>{a.preventDefault(),o?.(a);},...n,children:[t,jsxRuntime.jsx(F__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(Vn,{className:"h-4 w-4 text-slate-400 shrink-0"})})]})}function Ie({className:e,children:t,position:o="popper",onCloseAutoFocus:n,...a}){return jsxRuntime.jsx(F__namespace.Portal,{children:jsxRuntime.jsx("div",{className:"ep-root",children:jsxRuntime.jsx(F__namespace.Content,{className:w("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-slate-200 bg-white shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:i=>{i.preventDefault(),n?.(i);},...a,children:jsxRuntime.jsx(F__namespace.Viewport,{className:w("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:i=>i.preventDefault(),children:t})})})})}function We({className:e,...t}){return jsxRuntime.jsx(F__namespace.Label,{className:w("px-2 py-1.5 text-xs font-medium text-slate-500",e),...t})}function de({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(F__namespace.Item,{className:w("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-slate-700 outline-none","hover:bg-slate-100 focus:bg-slate-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:a=>{a.preventDefault(),o?.(a);},...n,children:[jsxRuntime.jsx(F__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(F__namespace.ItemIndicator,{children:jsxRuntime.jsx(Wn,{className:"h-4 w-4"})})})]})}function tt({className:e,...t}){return jsxRuntime.jsx(F__namespace.Separator,{className:w("-mx-1 my-1 h-px bg-slate-100",e),...t})}function Vn({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function Wn({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}var $n=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function ho({value:e,onChange:t,fonts:o=$n,disabled:n=false,className:a,placeholder:i="Arial",width:r=120,showPreview:u=true}){let d=oe__namespace.useMemo(()=>e?o.find(g=>g.fontFamily===e||g.name.toLowerCase()===e.toLowerCase())?.name||e:i,[e,o,i]),l=oe__namespace.useCallback(p=>{let g=o.find(m=>m.name===p);g&&t?.(g.fontFamily);},[t,o]),c=oe__namespace.useMemo(()=>{let p={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(g=>{let m=g.category||"other";p[m].push(g);}),p},[o]);return jsxRuntime.jsxs(Te,{value:d,onValueChange:l,disabled:n,children:[jsxRuntime.jsx(we,{className:w("h-8 text-sm",a),style:{minWidth:typeof r=="number"?`${r}px`:r},"aria-label":"Select font family",children:jsxRuntime.jsx(pt,{placeholder:i,children:d})}),jsxRuntime.jsxs(Ie,{className:"max-h-[300px]",children:[c["sans-serif"].length>0&&jsxRuntime.jsxs(Ve,{children:[jsxRuntime.jsx(We,{children:"Sans Serif"}),c["sans-serif"].map(p=>jsxRuntime.jsx(de,{value:p.name,style:u?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]}),c.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(tt,{}),jsxRuntime.jsxs(Ve,{children:[jsxRuntime.jsx(We,{children:"Serif"}),c.serif.map(p=>jsxRuntime.jsx(de,{value:p.name,style:u?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),c.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(tt,{}),jsxRuntime.jsxs(Ve,{children:[jsxRuntime.jsx(We,{children:"Monospace"}),c.monospace.map(p=>jsxRuntime.jsx(de,{value:p.name,style:u?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]})]})]})}var vo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,bo=clsx.clsx,xo=(e,t)=>o=>{var n;if(t?.variants==null)return bo(e,o?.class,o?.className);let{variants:a,defaultVariants:i}=t,r=Object.keys(a).map(l=>{let c=o?.[l],p=i?.[l];if(c===null)return null;let g=vo(c)||vo(p);return a[l][g]}),u=o&&Object.entries(o).reduce((l,c)=>{let[p,g]=c;return g===void 0||(l[p]=g),l},{}),d=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:p,className:g,...m}=c;return Object.entries(m).every(f=>{let[v,y]=f;return Array.isArray(y)?y.includes({...i,...u}[v]):{...i,...u}[v]===y})?[...l,p,g]:l},[]);return bo(e,r,d,o?.class,o?.className)};var Un=xo("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),z=oe__namespace.forwardRef(({className:e,variant:t,size:o,...n},a)=>jsxRuntime.jsx("button",{className:w(Un({variant:t,size:o,className:e})),ref:a,...n}));z.displayName="Button";function h({size:e=20,className:t="",style:o,children:n}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...o},"aria-hidden":"true",children:n})}function Kn(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function jn(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function Xn(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function Qn(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function Jn(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function er(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function tr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function or(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function nr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function rr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function ar(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function ir(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function lr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function sr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function cr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function _t(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function pr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function ur(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function dr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function mr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function fr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function gr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function hr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function vr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function br(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function xr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function yr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function Sr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function Cr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function Tr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function wr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function Ir(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function Pr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function kr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function Lr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function Rr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function Mr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function Zr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function Er(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function Hr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function _r(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function Dr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function Nr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function Fr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function qr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Ar(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function Br(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function Or(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function zr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function Vr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function Wr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function $r(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function Gr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function Ur(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function Yr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function Kr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function jr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Xr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Qr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Jr(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function ea(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function ta(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function oa(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function na(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function ra(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function aa(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function ia(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function la(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function sa(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function ca(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function pa(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function ua(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function da(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function ma(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function fa(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function ga(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function ha(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function va(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function ba(e){return jsxRuntime.jsx(h,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}var xa={undo:Kn,redo:jn,print:Xn,format_bold:Qn,format_italic:Jn,format_underlined:er,strikethrough_s:tr,superscript:or,subscript:nr,link:rr,format_clear:ar,format_align_left:ir,format_align_center:lr,format_align_right:sr,format_align_justify:cr,format_line_spacing:_t,format_list_bulleted:pr,format_list_numbered:ur,format_indent_increase:dr,format_indent_decrease:mr,format_color_text:fr,ink_highlighter:gr,format_color_reset:hr,arrow_drop_down:vr,table:br,table_chart:xr,grid_on:yr,table_rows:Sr,view_column:Cr,border_all:Tr,border_outer:wr,border_inner:Ir,border_clear:Pr,add:kr,remove:Lr,delete:Rr,delete_sweep:Mr,call_merge:Zr,call_split:Er,drag_indicator:Hr,image:_r,format_image_left:Dr,format_image_right:Nr,horizontal_rule:Fr,flip_to_back:qr,flip_to_front:Ar,open_with:Br,tune:Or,rotate_right:zr,rotate_left:Vr,swap_horiz:Wr,swap_vert:$r,shapes:Gr,format_paint:Ur,expand_more:Yr,expand_less:Kr,border_top:jr,border_bottom:Xr,border_left:Qr,border_right:Jr,padding:ea,text_rotation_none:ta,wrap_text:oa,height:na,fit_width:ra,settings:aa,border_color:ia,format_color_fill:la,vertical_align_top:sa,vertical_align_center:ca,vertical_align_bottom:pa,line_weight:ua,keyboard_arrow_up:da,keyboard_arrow_down:ma,keyboard_arrow_left:fa,keyboard_arrow_right:ga,more_vert:ha,page_break:va,arrow_back:ba};function x({name:e,size:t=20,className:o="",style:n}){let a=xa[e];return a?jsxRuntime.jsx(a,{size:t,className:o,style:n}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:o,style:{fontSize:t,width:t,height:t,...n},children:e}))}var Sa=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Ca=1,Ta=400;function wo(e){return e/2}function Ts(e){return e*2}function So(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function Co(e,t,o){for(let n=t.length-1;n>=0;n--)if(t[n]<e)return t[n];return Math.max(e-1,o)}function Io({value:e,onChange:t,sizes:o=Sa,disabled:n=false,className:a,placeholder:i="11",minSize:r=Ca,maxSize:u=Ta}){let[d,l]=oe.useState(false),[c,p]=oe.useState(""),[g,m]=oe.useState(false),f=oe.useRef(null),v=oe.useRef(null),y=oe.useRef(null),I=e??(parseInt(i,10)||11),S=e!==void 0?e.toString():i;oe.useEffect(()=>{if(!g)return;let b=V=>{v.current&&!v.current.contains(V.target)&&y.current&&!y.current.contains(V.target)&&m(false);},C=V=>{V.key==="Escape"&&(m(false),l(false));};return document.addEventListener("mousedown",b),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",C);}},[g]);let R=oe.useCallback(b=>{if(b.preventDefault(),n)return;let C=Co(I,o,r);t?.(C);},[I,o,r,n,t]),_=oe.useCallback(b=>{if(b.preventDefault(),n)return;let C=So(I,o,u);t?.(C);},[I,o,u,n,t]),H=oe.useCallback(b=>{b.preventDefault(),!n&&(l(true),p(S),m(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[n,S]),O=oe.useCallback(b=>{p(b.target.value);},[]),P=oe.useCallback(()=>{l(false);let b=parseInt(c,10);!isNaN(b)&&b>=r&&b<=u&&t?.(b);},[c,r,u,t]),Z=oe.useCallback(b=>{if(b.key==="Enter")b.preventDefault(),P(),m(false);else if(b.key==="Escape")l(false),m(false);else if(b.key==="ArrowUp"){b.preventDefault();let C=So(I,o,u);p(C.toString()),t?.(C);}else if(b.key==="ArrowDown"){b.preventDefault();let C=Co(I,o,r);p(C.toString()),t?.(C);}},[P,I,o,u,r,t]),Q=oe.useCallback(b=>{t?.(b),m(false),l(false);},[t]),ee=oe.useCallback(b=>{b.target.tagName!=="INPUT"&&b.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:v,className:w("flex items-center",a),onMouseDown:ee,children:[jsxRuntime.jsx(z,{variant:"ghost",size:"icon-sm",className:w("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-r-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:R,disabled:n||I<=r,"aria-label":"Decrease font size","data-testid":"font-size-decrease",children:jsxRuntime.jsx(x,{name:"remove",size:18})}),jsxRuntime.jsxs("div",{className:"relative",children:[d?jsxRuntime.jsx("input",{ref:f,type:"text",value:c,onChange:O,onBlur:P,onKeyDown:Z,className:w("h-7 w-10 text-center text-sm border border-slate-300 bg-white","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none"),"aria-label":"Font size","data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:H,className:w("h-7 w-10 text-center text-sm border border-slate-200 bg-white","hover:border-slate-300 hover:bg-slate-50","focus:outline-none focus:ring-1 focus:ring-slate-400","rounded-none",n&&"opacity-50 cursor-not-allowed"),disabled:n,"aria-label":"Font size","aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:S}),g&&jsxRuntime.jsx("div",{ref:y,className:w("absolute top-full left-1/2 -translate-x-1/2 mt-1 z-50","bg-white border border-slate-200 rounded-md shadow-lg","max-h-60 overflow-y-auto min-w-[60px]"),role:"listbox","aria-label":"Font sizes",children:o.map(b=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Q(b),className:w("w-full px-3 py-1.5 text-sm text-left","hover:bg-slate-100",b===I&&"bg-slate-100 font-medium"),role:"option","aria-selected":b===I,children:b},b))})]}),jsxRuntime.jsx(z,{variant:"ghost",size:"icon-sm",className:w("h-7 w-7 text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 rounded-l-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:_,disabled:n||I>=u,"aria-label":"Increase font size","data-testid":"font-size-increase",children:jsxRuntime.jsx(x,{name:"add",size:18})})]})}var Pa=[{name:"Black",hex:"000000"},{name:"Dark Red",hex:"7F0000"},{name:"Dark Orange",hex:"FF6600"},{name:"Dark Yellow",hex:"808000"},{name:"Dark Green",hex:"006400"},{name:"Dark Teal",hex:"008080"},{name:"Dark Blue",hex:"000080"},{name:"Dark Purple",hex:"4B0082"},{name:"Dark Gray",hex:"404040"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FF9900"},{name:"Yellow",hex:"FFFF00"},{name:"Light Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Light Blue",hex:"0066FF"},{name:"Blue",hex:"0000FF"},{name:"Purple",hex:"9900FF"},{name:"Magenta",hex:"FF00FF"},{name:"Pink",hex:"FF66FF"},{name:"Light Red",hex:"FFCCCC"},{name:"Light Orange",hex:"FFE5CC"},{name:"Light Yellow",hex:"FFFFCC"},{name:"Pale Green",hex:"CCFFCC"},{name:"Light Cyan",hex:"CCFFFF"},{name:"Sky Blue",hex:"CCE5FF"},{name:"Light Blue 2",hex:"CCCCFF"},{name:"Lavender",hex:"E5CCFF"},{name:"Light Magenta",hex:"FFCCFF"},{name:"White",hex:"FFFFFF"}],ka=[{name:"No Color",hex:""},{name:"Yellow",hex:"FFFF00"},{name:"Bright Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Blue",hex:"0000FF"},{name:"Red",hex:"FF0000"},{name:"Dark Blue",hex:"00008B"},{name:"Teal",hex:"008080"},{name:"Green",hex:"008000"},{name:"Violet",hex:"800080"},{name:"Dark Red",hex:"8B0000"},{name:"Dark Yellow",hex:"808000"},{name:"Gray 50%",hex:"808080"},{name:"Gray 25%",hex:"C0C0C0"},{name:"Black",hex:"000000"}],La={position:"relative",display:"inline-block"},dt={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},Ra={...dt,backgroundColor:"var(--doc-bg-hover)"},Ma={...dt,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Za={...dt,cursor:"default",opacity:.38},Ea={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},Ha={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},_a={position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:"2px",padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"},Da={display:"grid",gap:"2px"},mt={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},Na={...mt,transform:"scale(1.1)",borderColor:"#333",zIndex:1},Fa={...mt,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},qa={...mt,position:"relative",backgroundColor:"#fff"},Aa={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},ko={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},Ba={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Oa={display:"flex",alignItems:"center",gap:"8px"},za={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Va={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Wa=()=>jsxRuntime.jsx(x,{name:"format_color_text",size:18}),$a=()=>jsxRuntime.jsx(x,{name:"ink_highlighter",size:18}),Ga=()=>jsxRuntime.jsx(x,{name:"arrow_drop_down",size:14});function Ua({colors:e,selectedColor:t,onSelect:o,columns:n=10,cellSize:a=20}){let[i,r]=oe.useState(null),u={...Da,gridTemplateColumns:`repeat(${n}, ${a}px)`};return jsxRuntime.jsx("div",{style:u,className:"docx-color-grid",role:"grid",children:e.map((d,l)=>{let c=t?.toUpperCase()===d.hex.toUpperCase(),p=i===l,g=d.hex==="",m={...c?Fa:p?Na:mt,width:`${a}px`,height:`${a}px`};return g||(m.backgroundColor=`#${d.hex}`),jsxRuntime.jsx("button",{type:"button",style:g?{...qa,...m}:m,onClick:()=>o(d),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null),title:d.name,role:"gridcell","aria-label":d.name,"aria-selected":c,children:g&&jsxRuntime.jsx("span",{style:Aa})},`${d.hex}-${l}`)})})}function Lo({value:e,onChange:t,type:o="text",theme:n,colors:a,disabled:i=false,className:r,style:u,title:d,children:l,dropdownWidth:c=230,showNoColor:p=true,showMoreColors:g=true}){let[m,f]=oe.useState(false),[v,y]=oe.useState(false),[I,S]=oe.useState(""),R=oe.useRef(null),_=oe.useMemo(()=>{if(o==="highlight")return ka;let C=[...Pa];return p&&C.unshift({name:"Automatic",hex:"000000"}),C},[o,p]),H=a||_,O=oe.useMemo(()=>e?e.startsWith("#")?e:o==="highlight"?chunkSF53KLDZ_cjs.b(e)||"transparent":`#${e}`:o==="text"?"#000000":"transparent",[e,o]);oe.useEffect(()=>{let C=V=>{let J=V;R.current&&!R.current.contains(J.target)&&f(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]);let P=oe.useCallback(C=>{t?.(C.hex),f(false);},[t]),Z=oe.useCallback(()=>{let C=I.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(C)&&(t?.(C),f(false),S(""));},[I,t]),Q=oe.useCallback(()=>{i||f(C=>!C);},[i]),ee=i?Za:m?Ma:v?Ra:dt,b=o==="text"?"Font Color":"Text Highlight Color";return jsxRuntime.jsxs("div",{ref:R,className:`docx-color-picker docx-color-picker-${o} ${r||""}`,style:{...La,...u},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:ee,onClick:Q,onMouseDown:C=>C.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:i,title:d||b,"aria-label":d||b,"aria-haspopup":"true","aria-expanded":m,children:[l||jsxRuntime.jsxs("div",{style:Ea,children:[o==="text"?jsxRuntime.jsx(Wa,{}):jsxRuntime.jsx($a,{}),jsxRuntime.jsx("div",{style:{...Ha,backgroundColor:O==="transparent"?"#fff":O,border:O==="transparent"?"1px solid #ccc":"none"}})]}),jsxRuntime.jsx(Ga,{})]}),m&&jsxRuntime.jsxs("div",{className:"docx-color-picker-dropdown",style:{..._a,width:c},role:"dialog","aria-label":`${o==="text"?"Font":"Highlight"} color picker`,onMouseDown:C=>C.preventDefault(),children:[o==="highlight"&&jsxRuntime.jsx("div",{style:ko,children:"Highlight Colors"}),jsxRuntime.jsx(Ua,{colors:H,selectedColor:e,onSelect:P,columns:o==="highlight"?8:10}),g&&o==="text"&&jsxRuntime.jsxs("div",{style:Ba,children:[jsxRuntime.jsx("div",{style:ko,children:"Custom Color"}),jsxRuntime.jsxs("div",{style:Oa,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:za,value:I,onChange:C=>S(C.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:C=>{C.key==="Enter"&&Z();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:Va,onClick:Z,disabled:!/^[0-9A-Fa-f]{6}$/.test(I),children:"Apply"})]})]})]})]})}function Ro(e){return jsxRuntime.jsx(Lo,{...e,type:"text"})}function Mo(e){return jsxRuntime.jsx(Lo,{...e,type:"highlight",showMoreColors:false})}function K({content:e,children:t,side:o="bottom",delayMs:n=400}){let[a,i]=oe__namespace.useState(false),[r,u]=oe__namespace.useState({x:0,y:0}),d=oe__namespace.useRef(null),l=oe__namespace.useRef(null),c=oe__namespace.useCallback(()=>{l.current=setTimeout(()=>{if(d.current){let f=d.current.getBoundingClientRect(),v=f.left+f.width/2,y=o==="top"?f.top-8:f.bottom+8;u({x:v,y});}i(true);},n);},[n,o]),p=oe__namespace.useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null),i(false);},[]);oe__namespace.useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]);let g=t.props,m=oe__namespace.cloneElement(t,{ref:d,onMouseEnter:f=>{c(),g.onMouseEnter?.(f);},onMouseLeave:f=>{p(),g.onMouseLeave?.(f);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m,a&&jsxRuntime.jsx("div",{className:w("fixed z-50 px-2 py-1 text-xs font-medium text-white bg-slate-900 rounded-md shadow-lg","animate-in fade-in-0 zoom-in-95 duration-150",o==="top"&&"-translate-x-1/2 -translate-y-full",o==="bottom"&&"-translate-x-1/2"),style:{left:r.x,top:r.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var nt=20,qt=[{value:"left",label:"Align Left",icon:jsxRuntime.jsx(x,{name:"format_align_left",size:nt}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",icon:jsxRuntime.jsx(x,{name:"format_align_center",size:nt}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",icon:jsxRuntime.jsx(x,{name:"format_align_right",size:nt}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",icon:jsxRuntime.jsx(x,{name:"format_align_justify",size:nt}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function Ho({value:e="left",onChange:t,disabled:o=false}){let[n,a]=oe.useState(false),i=oe.useRef(null);oe.useEffect(()=>{if(!n)return;let c=g=>{i.current&&!i.current.contains(g.target)&&a(false);},p=g=>{g.key==="Escape"&&a(false);};return document.addEventListener("mousedown",c),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p);}},[n]);let r=oe.useCallback(c=>{c.preventDefault(),c.stopPropagation();},[]),u=oe.useCallback(c=>{o||t?.(c),a(false);},[o,t]),d=qt.find(c=>c.value===e)||qt[0],l=jsxRuntime.jsxs(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",o&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:()=>!o&&a(c=>!c),disabled:o,"aria-label":`${d.label}${d.shortcut?` (${d.shortcut})`:""}`,"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(x,{name:d.iconName,size:nt}),jsxRuntime.jsx(x,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[n?l:jsxRuntime.jsx(K,{content:`${d.label}${d.shortcut?` (${d.shortcut})`:""}`,children:l}),n&&!o&&jsxRuntime.jsx("div",{style:{position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6,zIndex:1e3},onMouseDown:c=>c.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:qt.map(c=>{let p=e===c.value;return jsxRuntime.jsx("button",{type:"button",title:`${c.label}${c.shortcut?` (${c.shortcut})`:""}`,"data-testid":`alignment-${c.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:p?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:p?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:g=>g.preventDefault(),onMouseEnter:g=>{p||(g.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:g=>{g.currentTarget.style.backgroundColor=p?"var(--doc-primary-light)":"transparent";},onClick:()=>u(c.value),children:jsxRuntime.jsx(x,{name:c.iconName,size:18})},c.value)})})})]})}var oi={display:"inline-flex",alignItems:"center",gap:"4px"},_o={display:"inline-flex",alignItems:"center",gap:"4px"},vt={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},ni={...vt,backgroundColor:"var(--doc-bg-hover)"},ri={...vt,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},ai={...vt,cursor:"default",opacity:.38},ii={width:"28px",height:"28px",padding:"2px"},li={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},ft=20;function gt({active:e=false,disabled:t=false,title:o,onClick:n,children:a,className:i,style:r}){let[u,d]=oe.useState(false),l={...t?ai:e?ri:u?ni:vt,...r},c=p=>{p.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:l,onMouseDown:c,onClick:t?void 0:n,onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),disabled:t,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:a})}function Do({listState:e,onBulletList:t,onNumberedList:o,onIndent:n,onOutdent:a,disabled:i=false,className:r,style:u,showIndentButtons:d=true,compact:l=false,hasIndent:c=false}){let p=oe.useCallback(()=>l?{...ii}:{},[l]),g=e?.type==="bullet",m=e?.type==="numbered",v=(e?.isInList||g||m)&&(e?.level??0)>0||c;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${r||""}`,style:{...oi,...u},role:"group","aria-label":"List formatting",children:[jsxRuntime.jsxs("div",{style:_o,role:"group","aria-label":"List type",children:[jsxRuntime.jsx(gt,{active:g,disabled:i,title:"Bullet List",onClick:t,style:p(),children:jsxRuntime.jsx(x,{name:"format_list_bulleted",size:ft})}),jsxRuntime.jsx(gt,{active:m,disabled:i,title:"Numbered List",onClick:o,style:p(),children:jsxRuntime.jsx(x,{name:"format_list_numbered",size:ft})})]}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:li,role:"separator"}),jsxRuntime.jsxs("div",{style:_o,role:"group","aria-label":"List indentation",children:[jsxRuntime.jsx(gt,{active:false,disabled:i||!v,title:"Decrease Indent",onClick:a,style:p(),children:jsxRuntime.jsx(x,{name:"format_indent_decrease",size:ft})}),jsxRuntime.jsx(gt,{active:false,disabled:i,title:"Increase Indent",onClick:n,style:p(),children:jsxRuntime.jsx(x,{name:"format_indent_increase",size:ft})})]})]})]})}function No(){return {type:"none",level:0,isInList:false}}var ci=[{label:"Single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",value:2,twipsValue:480}];function qo({value:e,onChange:t,options:o=ci,disabled:n=false,className:a}){let i=oe__namespace.useMemo(()=>e===void 0?o[0]:o.find(u=>u.twipsValue===e)||o[0],[e,o]),r=oe__namespace.useCallback(u=>{let d=parseInt(u,10);isNaN(d)||t?.(d);},[t]);return jsxRuntime.jsxs(Te,{value:i.twipsValue.toString(),onValueChange:r,disabled:n,children:[jsxRuntime.jsx(we,{className:w("h-8 text-sm gap-0.5 px-2",a),style:{width:"auto"},title:`Line spacing: ${i.label}`,children:jsxRuntime.jsx(_t,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Ie,{children:[o.map(u=>jsxRuntime.jsx(de,{value:u.twipsValue.toString(),children:u.label},u.twipsValue)),jsxRuntime.jsx(tt,{}),jsxRuntime.jsx(Ve,{children:jsxRuntime.jsx(We,{children:"Paragraph spacing"})})]})]})}var Ao=[{styleId:"Normal",name:"Normal text",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}],pi="#4a6c8c",ui={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14};function di(e){let t={};return t.fontSize=`${ui[e.styleId]??14}px`,t.lineHeight="1.3",e.bold&&(t.fontWeight="bold"),e.italic&&(t.fontStyle="italic"),e.color?t.color=`#${e.color}`:e.styleId.startsWith("Heading")&&(t.color=pi),t}function Bo({value:e,onChange:t,styles:o,disabled:n=false,className:a,width:i=120}){let r=oe__namespace.useMemo(()=>{if(!o||o.length===0)return Ao;let c=new Set(["Normal","Title","Subtitle","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6"]);return o.filter(m=>m.type==="paragraph").filter(m=>c.has(m.styleId)).map(m=>({styleId:m.styleId,name:m.name||m.styleId,type:m.type,isDefault:m.default,qFormat:m.qFormat,priority:m.uiPriority??99,fontSize:m.rPr?.fontSize,bold:m.rPr?.bold,italic:m.rPr?.italic,color:m.rPr?.color?.rgb})).map(m=>{let f=Ao.find(v=>v.styleId===m.styleId);return {...f,...m,fontSize:m.fontSize??f?.fontSize,bold:m.bold??f?.bold,italic:m.italic??f?.italic,color:m.color??f?.color}}).sort((m,f)=>(m.priority??99)-(f.priority??99))},[o]),u=oe__namespace.useCallback(c=>{t?.(c);},[t]),d=e||"Normal",l=r.find(c=>c.styleId===d)?.name||d;return jsxRuntime.jsxs(Te,{value:d,onValueChange:u,disabled:n,children:[jsxRuntime.jsx(we,{className:w("h-8 text-sm",a),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":"Select paragraph style",children:jsxRuntime.jsx("span",{className:"truncate",children:l})}),jsxRuntime.jsx(Ie,{className:"min-w-[260px] max-h-[400px]",children:r.map(c=>jsxRuntime.jsx(de,{value:c.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:di(c),children:c.name})},c.styleId))})]})}var fi=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function Oo({value:e=1,onChange:t,levels:o=fi,disabled:n=false,className:a,compact:i=false}){let r=oe__namespace.useMemo(()=>{let d=o.find(l=>Math.abs(l.value-e)<.001);return d?d.label:`${Math.round(e*100)}%`},[o,e]),u=oe__namespace.useCallback(d=>{let l=parseFloat(d);isNaN(l)||t?.(l);},[t]);return jsxRuntime.jsxs(Te,{value:e.toString(),onValueChange:u,disabled:n,children:[jsxRuntime.jsx(we,{className:w(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[70px] text-sm",a),"aria-label":`Zoom: ${r}`,children:jsxRuntime.jsx(pt,{placeholder:"100%",children:r})}),jsxRuntime.jsx(Ie,{children:o.map(d=>jsxRuntime.jsx(de,{value:d.value.toString(),children:d.label},d.value))})]})}function ge({isOpen:e,onClose:t,align:o="left"}){let n=oe.useRef(null),a=oe.useRef(null),[i,r]=oe.useState({top:0,left:0});oe.useEffect(()=>{if(!e||!n.current)return;let l=n.current.getBoundingClientRect();o==="right"?requestAnimationFrame(()=>{if(a.current){let c=a.current.getBoundingClientRect();r({top:l.bottom+4,left:l.right-c.width});}else r({top:l.bottom+4,left:l.left});}):r({top:l.bottom+4,left:l.left});},[e,o]),oe.useEffect(()=>{if(!e)return;let l=g=>{let m=g.target;n.current&&!n.current.contains(m)&&a.current&&!a.current.contains(m)&&t();},c=g=>{g.key==="Escape"&&t();},p=()=>t();return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),window.addEventListener("scroll",p,true),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c),window.removeEventListener("scroll",p,true);}},[e,t]);let u=oe.useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),d={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:n,dropdownRef:a,dropdownStyle:d,handleMouseDown:u}}var xi=[{action:"borderAll",icon:"border_all",label:"All borders"},{action:"borderOutside",icon:"border_outer",label:"Outside borders"},{action:"borderInside",icon:"border_inner",label:"Inside borders"},{action:"borderTop",icon:"border_top",label:"Top border"},{action:"borderBottom",icon:"border_bottom",label:"Bottom border"},{action:"borderLeft",icon:"border_left",label:"Left border"},{action:"borderRight",icon:"border_right",label:"Right border"},{action:"borderNone",icon:"border_clear",label:"No borders"}];function Go({onAction:e,disabled:t=false}){let[o,n]=oe.useState(false),a=oe.useCallback(()=>n(false),[]),{containerRef:i,dropdownRef:r,dropdownStyle:u,handleMouseDown:d}=ge({isOpen:o,onClose:a}),l=oe.useCallback(p=>{e(p),n(false);},[e]),c=jsxRuntime.jsxs(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!t&&n(p=>!p),disabled:t,"aria-label":"Border style","aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(x,{name:"border_all",size:20}),jsxRuntime.jsx(x,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?c:jsxRuntime.jsx(K,{content:"Borders",children:c}),o&&!t&&jsxRuntime.jsx("div",{ref:r,style:{...u,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6},onMouseDown:p=>p.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:xi.map(({action:p,icon:g,label:m})=>jsxRuntime.jsx("button",{type:"button",title:m,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>l(p),children:jsxRuntime.jsx(x,{name:g,size:18})},typeof p=="string"?p:p.type))})})]})}var yi=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],Si={width:18,height:18,borderRadius:2,border:"1px solid var(--doc-border)",cursor:"pointer",padding:0,backgroundColor:"transparent"};function jo({onAction:e,disabled:t=false}){let[o,n]=oe.useState(false),[a,i]=oe.useState("#000000"),r=oe.useCallback(()=>n(false),[]),{containerRef:u,dropdownRef:d,dropdownStyle:l,handleMouseDown:c}=ge({isOpen:o,onClose:r}),p=oe.useCallback(m=>{i(m),e({type:"borderColor",color:m.replace(/^#/,"")}),n(false);},[e]),g=jsxRuntime.jsxs(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 flex-col gap-0 !p-0.5",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&n(m=>!m),disabled:t,"aria-label":"Border color","aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-color",children:[jsxRuntime.jsx(x,{name:"border_color",size:18}),jsxRuntime.jsx("div",{style:{width:16,height:3,backgroundColor:a,borderRadius:0,marginTop:-2}})]});return jsxRuntime.jsxs("div",{ref:u,style:{position:"relative",display:"inline-block"},children:[o?g:jsxRuntime.jsx(K,{content:"Border color",children:g}),o&&!t&&jsxRuntime.jsx("div",{ref:d,style:{...l,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:8},onMouseDown:m=>m.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:2},children:yi.map(m=>jsxRuntime.jsx("button",{type:"button",style:{...Si,backgroundColor:m,outline:a===m?"2px solid var(--doc-primary)":"none",outlineOffset:1},title:m,onMouseDown:f=>f.preventDefault(),onClick:()=>p(m)},m))})})]})}var Ti=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function Qo({onAction:e,disabled:t=false}){let[o,n]=oe.useState(false),a=oe.useCallback(()=>n(false),[]),{containerRef:i,dropdownRef:r,dropdownStyle:u,handleMouseDown:d}=ge({isOpen:o,onClose:a}),l=oe.useCallback(p=>{e({type:"borderWidth",size:p}),n(false);},[e]),c=jsxRuntime.jsxs(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!t&&n(p=>!p),disabled:t,"aria-label":"Border width","aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(x,{name:"line_weight",size:20}),jsxRuntime.jsx(x,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?c:jsxRuntime.jsx(K,{content:"Border width",children:c}),o&&!t&&jsxRuntime.jsx("div",{ref:r,style:{...u,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:120},onMouseDown:p=>p.stopPropagation(),children:Ti.map(({size:p,label:g,thickness:m})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>l(p),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(m,1),backgroundColor:"#000",borderRadius:m>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},p))})]})}var wi=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],Ii={width:18,height:18,borderRadius:2,border:"1px solid var(--doc-border)",cursor:"pointer",padding:0,backgroundColor:"transparent"};function en({onAction:e,disabled:t=false}){let[o,n]=oe.useState(false),[a,i]=oe.useState(null),r=oe.useCallback(()=>n(false),[]),{containerRef:u,dropdownRef:d,dropdownStyle:l,handleMouseDown:c}=ge({isOpen:o,onClose:r}),p=oe.useCallback(f=>{i(f),e({type:"cellFillColor",color:f}),n(false);},[e]),g=oe.useCallback(()=>{i(null),e({type:"cellFillColor",color:null}),n(false);},[e]),m=jsxRuntime.jsxs(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80 flex-col gap-0 !p-0.5",o&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&n(f=>!f),disabled:t,"aria-label":"Cell fill color","aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-cell-fill",children:[jsxRuntime.jsx(x,{name:"format_color_fill",size:18}),jsxRuntime.jsx("div",{style:{width:16,height:3,backgroundColor:a||"transparent",borderRadius:0,marginTop:-2,border:a?"none":"1px solid var(--doc-border)"}})]});return jsxRuntime.jsxs("div",{ref:u,style:{position:"relative",display:"inline-block"},children:[o?m:jsxRuntime.jsx(K,{content:"Cell fill color",children:m}),o&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...l,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:8},onMouseDown:f=>f.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:2},children:wi.map(f=>jsxRuntime.jsx("button",{type:"button",style:{...Ii,backgroundColor:f,outline:a===f?"2px solid var(--doc-primary)":"none",outlineOffset:1},title:f,onMouseDown:v=>v.preventDefault(),onClick:()=>p(f)},f))}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,marginTop:6,padding:"4px 8px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text-muted)",borderRadius:4},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:g,children:[jsxRuntime.jsx(x,{name:"format_color_reset",size:14}),jsxRuntime.jsx("span",{children:"No fill"})]})]})]})}var Pi={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Ke={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},nn={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function rn({onAction:e,disabled:t=false,tableContext:o}){let[n,a]=oe.useState(false),[i,r]=oe.useState(null),u=oe.useCallback(()=>a(false),[]),{containerRef:d,dropdownRef:l,dropdownStyle:c,handleMouseDown:p}=ge({isOpen:n,onClose:u,align:"right"}),g=o?.table?.attrs?.justification??"left",m=oe.useCallback(y=>{e(y),a(false);},[e]),f=(y,I,S,R,_)=>{let H=t||_?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...Pi,backgroundColor:i===y&&!H?"var(--doc-bg-hover)":"transparent",color:H?"var(--doc-text-muted)":_?.danger?"var(--doc-error)":"var(--doc-text)",cursor:H?"not-allowed":"pointer"},onClick:()=>!H&&m(R),onMouseEnter:()=>r(y),onMouseLeave:()=>r(null),disabled:H,children:[jsxRuntime.jsx(x,{name:I,size:16,className:_?.danger&&!H?"text-red-600":""}),jsxRuntime.jsx("span",{style:{flex:1},children:S})]},y)},v=jsxRuntime.jsx(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",n&&"bg-slate-100",t&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!t&&a(y=>!y),disabled:t,"aria-label":"More table options","aria-expanded":n,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(x,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:d,style:{position:"relative",display:"inline-block"},children:[n?v:jsxRuntime.jsx(K,{content:"More table options",children:v}),n&&!t&&jsxRuntime.jsxs("div",{ref:l,style:{...c,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:y=>y.stopPropagation(),children:[f("addRowAbove","add","Insert row above","addRowAbove"),f("addRowBelow","add","Insert row below","addRowBelow"),f("addColumnLeft","add","Insert column left","addColumnLeft"),f("addColumnRight","add","Insert column right","addColumnRight"),jsxRuntime.jsx("div",{style:Ke,role:"separator"}),f("mergeCells","call_merge","Merge cells","mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),f("splitCell","call_split","Split cell","splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Ke,role:"separator"}),f("deleteRow","delete","Delete row","deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),f("deleteColumn","delete","Delete column","deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),f("deleteTable","delete","Delete table","deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Ke,role:"separator"}),jsxRuntime.jsx("div",{style:nn,children:"Vertical alignment"}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let I={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:{top:"Top",center:"Middle",bottom:"Bottom"}[y],style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:R=>R.preventDefault(),onMouseEnter:R=>{R.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:R=>{R.currentTarget.style.backgroundColor="transparent";},onClick:()=>m({type:"cellVerticalAlign",align:y}),children:jsxRuntime.jsx(x,{name:I[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Ke,role:"separator"}),jsxRuntime.jsx("div",{style:nn,children:"Table alignment"}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let I={left:"format_align_left",center:"format_align_center",right:"format_align_right"},S=g===y;return jsxRuntime.jsx("button",{type:"button",title:`Align table ${y}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:S?"var(--doc-primary-light)":"transparent",borderColor:S?"var(--doc-primary)":"var(--doc-border)",color:S?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:R=>R.preventDefault(),onClick:()=>m({type:"tableProperties",props:{justification:y}}),children:jsxRuntime.jsx(x,{name:I[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Ke,role:"separator"}),f("headerRow","table_rows","Toggle header row",{type:"toggleHeaderRow"}),f("distribute","view_column","Distribute columns evenly",{type:"distributeColumns"}),f("autoFit","fit_width","Auto-fit to contents",{type:"autoFitContents"}),f("noWrap","wrap_text","Toggle no-wrap",{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Ke,role:"separator"}),f("properties","settings","Table properties...",{type:"openTableProperties"})]})]})}var Vt=18,Li=2,ln={width:Vt,height:Vt,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},Ri={...ln,backgroundColor:"var(--doc-primary, #3b82f6)",border:"1px solid var(--doc-primary, #3b82f6)"},Mi={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text, #374151)",textAlign:"center"};function sn({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[n,a]=oe.useState(0),[i,r]=oe.useState(0),u=oe.useCallback(()=>{n>0&&i>0&&e(n,i);},[n,i,e]),d=[];for(let c=1;c<=t;c++)for(let p=1;p<=o;p++){let g=c<=n&&p<=i;d.push(jsxRuntime.jsx("div",{style:g?Ri:ln,onMouseEnter:()=>{a(c),r(p);},onClick:u,role:"gridcell","aria-selected":g},`${c}-${p}`));}let l=n>0&&i>0?`${i} \xD7 ${n}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:Li,gridTemplateColumns:`repeat(${o}, ${Vt}px)`},onMouseLeave:()=>{a(0),r(0);},role:"grid","aria-label":"Table size selector",children:d}),jsxRuntime.jsx("div",{style:Mi,children:l})]})}function Hi(e){return "type"in e&&e.type==="separator"}var un={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text, #374151)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},_i={...un,background:"var(--doc-hover, #f3f4f6)"},dn={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text, #374151)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},Di={...dn,opacity:.4,cursor:"default"},Ni={height:1,backgroundColor:"var(--doc-border, #e5e7eb)",margin:"4px 0"},Fi={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted, #9ca3af)"},qi={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:8,zIndex:1001};function $t({label:e,items:t,disabled:o}){let[n,a]=oe.useState(false),[i,r]=oe.useState(null),u=oe.useRef(null),d=oe.useRef(null),[l,c]=oe.useState({top:0,left:0}),p=oe.useCallback(()=>{a(false),r(null);},[]);oe.useEffect(()=>{if(!n||!u.current)return;let m=u.current.getBoundingClientRect();c({top:m.bottom+2,left:m.left});},[n]),oe.useEffect(()=>{if(!n)return;function m(y){let I=y.target;u.current&&!u.current.contains(I)&&d.current&&!d.current.contains(I)&&p();}function f(y){y.key==="Escape"&&p();}function v(){p();}return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),window.addEventListener("scroll",v,true),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f),window.removeEventListener("scroll",v,true);}},[n,p]);let g=m=>{m.disabled||m.submenuContent||m.onClick&&(m.onClick(),p());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:u,type:"button",onClick:()=>!o&&a(!n),onMouseDown:m=>m.preventDefault(),disabled:o,style:n?_i:un,children:[e,jsxRuntime.jsx(x,{name:"arrow_drop_down",size:16})]}),n&&jsxRuntime.jsx("div",{ref:d,style:{position:"fixed",top:l.top,left:l.left,backgroundColor:"white",border:"1px solid var(--doc-border, #d1d5db)",borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.12)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:m=>m.preventDefault(),children:t.map((m,f)=>{if(Hi(m))return jsxRuntime.jsx("div",{style:Ni},`sep-${f}`);let v=m;if(v.customContent)return jsxRuntime.jsx("div",{onMouseDown:S=>S.preventDefault(),children:v.customContent},v.label);let y=!!v.submenuContent,I=i===v.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>y&&r(v.label),onMouseLeave:()=>y&&r(null),children:[jsxRuntime.jsxs("button",{type:"button",style:v.disabled?Di:dn,onClick:()=>g(v),onMouseDown:S=>S.preventDefault(),onMouseOver:S=>{v.disabled||(S.currentTarget.style.backgroundColor="var(--doc-hover, #f3f4f6)");},onMouseOut:S=>{S.currentTarget.style.backgroundColor="transparent";},disabled:v.disabled,children:[v.icon&&jsxRuntime.jsx(x,{name:v.icon,size:18}),jsxRuntime.jsx("span",{children:v.label}),v.shortcut&&jsxRuntime.jsx("span",{style:Fi,children:v.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(x,{name:"keyboard_arrow_right",size:16})})]}),y&&I&&jsxRuntime.jsx("div",{style:qi,onMouseDown:S=>S.preventDefault(),children:v.submenuContent(p)})]},v.label)})})]})}var zi=20;function wt({options:e,activeValue:t,triggerIcon:o,tooltipContent:n,onSelect:a,disabled:i=false,ariaLabel:r,testId:u}){let[d,l]=oe.useState(false),c=oe.useRef(null);oe.useEffect(()=>{if(!d)return;let f=y=>{c.current&&!c.current.contains(y.target)&&l(false);},v=y=>{y.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[d]);let p=oe.useCallback(f=>{f.preventDefault(),f.stopPropagation();},[]),g=oe.useCallback(f=>{i||a(f),l(false);},[i,a]),m=jsxRuntime.jsxs(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",d&&"bg-slate-100",i&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!i&&l(f=>!f),disabled:i,"aria-label":r??n,"aria-expanded":d,"aria-haspopup":"true","data-testid":u,children:[jsxRuntime.jsx(x,{name:o,size:zi}),jsxRuntime.jsx(x,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[d?m:jsxRuntime.jsx(K,{content:n,children:m}),d&&!i&&jsxRuntime.jsx("div",{style:{position:"absolute",top:"100%",left:0,marginTop:4,backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12)",padding:6,zIndex:1e3},onMouseDown:f=>f.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:e.map(f=>{let v=t===f.value;return jsxRuntime.jsx("button",{type:"button",title:f.label,"data-testid":u?`${u}-${f.value}`:void 0,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:v?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:v?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:y=>y.preventDefault(),onMouseEnter:y=>{v||(y.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=v?"var(--doc-primary-light)":"transparent";},onClick:()=>g(f.value),children:jsxRuntime.jsx(x,{name:f.iconName,size:18})},f.value)})})})]})}var Gt=[{value:"inline",label:"Inline with text",iconName:"format_image_left"},{value:"wrapRight",label:"Float left (wrap right)",iconName:"format_image_right"},{value:"wrapLeft",label:"Float right (wrap left)",iconName:"format_image_left"},{value:"topAndBottom",label:"Top and bottom",iconName:"horizontal_rule"},{value:"behind",label:"Behind text",iconName:"flip_to_back"},{value:"inFront",label:"In front of text",iconName:"flip_to_front"}];function Vi(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function gn({imageContext:e,onChange:t,disabled:o=false}){let n=Vi(e),a=Gt.find(i=>i.value===n)||Gt[0];return jsxRuntime.jsx(wt,{options:Gt,activeValue:n,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap"})}var $i=[{value:"rotateCW",label:"Rotate clockwise",iconName:"rotate_right"},{value:"rotateCCW",label:"Rotate counter-clockwise",iconName:"rotate_left"},{value:"flipH",label:"Flip horizontal",iconName:"swap_horiz"},{value:"flipV",label:"Flip vertical",iconName:"swap_vert"}];function hn({onTransform:e,disabled:t=false}){return jsxRuntime.jsx(wt,{options:$i,triggerIcon:"rotate_right",tooltipContent:"Transform",onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var Ui={FFFF00:"yellow","00FF00":"green","00FFFF":"cyan",FF00FF:"magenta","0000FF":"blue",FF0000:"red","00008B":"darkBlue","008080":"darkCyan","008000":"darkGreen",800080:"darkMagenta","8B0000":"darkRed",808e3:"darkYellow",808080:"darkGray",C0C0C0:"lightGray","000000":"black",FFFFFF:"white"};function gc(e){let t=e.replace(/^#/,"").toUpperCase();return Ui[t]||null}function se({active:e=false,disabled:t=false,title:o,onClick:n,children:a,className:i,ariaLabel:r}){let u=r?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^)]*\)/g,"").trim(),d=c=>{c.preventDefault();},l=jsxRuntime.jsx(z,{variant:"ghost",size:"icon-sm",className:w("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",e&&"bg-slate-900 text-white hover:bg-slate-800 hover:text-white",t&&"opacity-30 cursor-not-allowed",i),onMouseDown:d,onClick:t?void 0:n,disabled:t,"aria-pressed":e,"aria-label":r||o,"data-testid":u?`toolbar-${u}`:void 0,children:a});return o?jsxRuntime.jsx(K,{content:o,children:l}):l}function xe({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:w("flex items-center gap-0.5 px-1 border-r border-slate-200/50 last:border-r-0",o),role:"group","aria-label":e,children:t})}function Bc(){return jsxRuntime.jsx("div",{className:"w-px h-6 bg-slate-200 mx-1.5",role:"separator"})}var ce=20;function Oc({currentFormatting:e={},onFormat:t,onUndo:o,onRedo:n,canUndo:a=false,canRedo:i=false,disabled:r=false,className:u,style:d,enableShortcuts:l=true,editorRef:c,children:p,showFontPicker:g=true,showFontSizePicker:m=true,showTextColorPicker:f=true,showHighlightColorPicker:v=true,showAlignmentButtons:y=true,showListButtons:I=true,showLineSpacingPicker:S=true,showStylePicker:R=true,documentStyles:_,theme:H,onPrint:O,showPrintButton:P=true,showZoomControl:Z=true,zoom:Q,onZoomChange:ee,onRefocusEditor:b,onInsertTable:C,showTableInsert:V=true,onInsertImage:J,onInsertPageBreak:D,onInsertTOC:ve,imageContext:N,onImageWrapType:re,onImageTransform:Me,onOpenImageProperties:it,tableContext:lt,onTableAction:ze}){let st=oe.useRef(null),U=oe.useCallback(M=>{!r&&t&&t(M);},[r,t]),Ze=oe.useCallback(()=>{!r&&a&&o&&o();},[r,a,o]),Qe=oe.useCallback(()=>{!r&&i&&n&&n();},[r,i,n]),Je=oe.useCallback(M=>{!r&&t&&(t({type:"fontFamily",value:M}),requestAnimationFrame(()=>b?.()));},[r,t,b]),Ht=oe.useCallback(M=>{!r&&t&&(t({type:"fontSize",value:M}),requestAnimationFrame(()=>b?.()));},[r,t,b]),A=oe.useCallback(M=>{!r&&t&&(t({type:"textColor",value:M}),requestAnimationFrame(()=>b?.()));},[r,t,b]),Ee=oe.useCallback(M=>{!r&&t&&(t({type:"highlightColor",value:M}),requestAnimationFrame(()=>b?.()));},[r,t,b]),Ce=oe.useCallback(M=>{!r&&t&&t({type:"alignment",value:M});},[r,t]),He=oe.useCallback(()=>{!r&&t&&t("bulletList");},[r,t]),ue=oe.useCallback(()=>{!r&&t&&t("numberedList");},[r,t]),ae=oe.useCallback(()=>{!r&&t&&t("indent");},[r,t]),ie=oe.useCallback(()=>{!r&&t&&t("outdent");},[r,t]),_e=oe.useCallback(M=>{!r&&t&&(t({type:"lineSpacing",value:M}),requestAnimationFrame(()=>b?.()));},[r,t,b]),Hn=oe.useCallback(M=>{!r&&t&&(t({type:"applyStyle",value:M}),requestAnimationFrame(()=>b?.()));},[r,t,b]),_n=oe.useCallback((M,E)=>{!r&&C&&(C(M,E),requestAnimationFrame(()=>b?.()));},[r,C,b]),et=oe.useCallback(M=>{!r&&ze&&(ze(M),requestAnimationFrame(()=>b?.()));},[r,ze,b]);oe.useEffect(()=>{if(!l)return;let M=E=>{let De=E.target,uo=c?.current,Fn=st.current,qn=uo?.contains(De),An=Fn?.contains(De);if(!qn&&!An)return;if((E.ctrlKey||E.metaKey)&&!E.altKey)switch(E.key.toLowerCase()){case "b":E.preventDefault(),U("bold");break;case "i":E.preventDefault(),U("italic");break;case "u":E.preventDefault(),U("underline");break;case "=":E.shiftKey?(E.preventDefault(),U("superscript")):(E.preventDefault(),U("subscript"));break;case "l":E.preventDefault(),Ce("left");break;case "e":E.preventDefault(),Ce("center");break;case "r":E.preventDefault(),Ce("right");break;case "j":E.preventDefault(),Ce("both");break;case "k":E.preventDefault(),U("insertLink");break}};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M);}},[l,U,c]);let Dn=oe.useCallback(M=>{let E=M.target;E.tagName==="INPUT"||E.tagName==="TEXTAREA"||E.tagName==="SELECT"||E.tagName==="OPTION"||M.preventDefault();},[]),Nn=oe.useCallback(M=>{let E=M.target,De=document.activeElement;E.tagName==="SELECT"||E.tagName==="OPTION"||De?.tagName==="SELECT"||requestAnimationFrame(()=>{b?.();});},[b]);return jsxRuntime.jsxs("div",{ref:st,className:w("flex items-center gap-0 px-2 py-2 bg-white border-b border-slate-100 min-h-[44px] overflow-x-auto",u),style:d,role:"toolbar","aria-label":"Formatting toolbar","data-testid":"toolbar",onMouseDown:Dn,onMouseUp:Nn,children:[P&&O&&jsxRuntime.jsx($t,{label:"File",disabled:r,items:[{icon:"print",label:"Print",shortcut:"Ctrl+P",onClick:O}]}),jsxRuntime.jsx($t,{label:"Insert",disabled:r,items:[...J?[{icon:"image",label:"Image",onClick:J}]:[],...V&&C?[{icon:"grid_on",label:"Table",submenuContent:M=>jsxRuntime.jsx(sn,{onInsert:(E,De)=>{_n(E,De),M();}})}]:[],...J||V&&C?[{type:"separator"}]:[],{icon:"page_break",label:"Page break",onClick:D,disabled:!D},{icon:"format_list_numbered",label:"Table of contents",onClick:ve,disabled:!ve}]}),jsxRuntime.jsxs(xe,{label:"History",children:[jsxRuntime.jsx(se,{onClick:Ze,disabled:r||!a,title:"Undo (Ctrl+Z)",ariaLabel:"Undo",children:jsxRuntime.jsx(x,{name:"undo",size:ce})}),jsxRuntime.jsx(se,{onClick:Qe,disabled:r||!i,title:"Redo (Ctrl+Y)",ariaLabel:"Redo",children:jsxRuntime.jsx(x,{name:"redo",size:ce})})]}),Z&&jsxRuntime.jsx(xe,{label:"Zoom",children:jsxRuntime.jsx(Oo,{value:Q,onChange:ee,minZoom:.5,maxZoom:2,disabled:r,compact:true,showButtons:false})}),R&&jsxRuntime.jsx(xe,{label:"Styles",children:jsxRuntime.jsx(Bo,{value:e.styleId||"Normal",onChange:Hn,styles:_,theme:H,disabled:r,width:150})}),(g||m)&&jsxRuntime.jsxs(xe,{label:"Font",children:[g&&jsxRuntime.jsx(ho,{value:e.fontFamily||"Arial",onChange:Je,disabled:r,width:70,placeholder:"Arial"}),m&&jsxRuntime.jsx(Io,{value:e.fontSize!==void 0?wo(e.fontSize):11,onChange:Ht,disabled:r,width:50,placeholder:"11"})]}),jsxRuntime.jsxs(xe,{label:"Text formatting",children:[jsxRuntime.jsx(se,{onClick:()=>U("bold"),active:e.bold,disabled:r,title:"Bold (Ctrl+B)",ariaLabel:"Bold",children:jsxRuntime.jsx(x,{name:"format_bold",size:ce})}),jsxRuntime.jsx(se,{onClick:()=>U("italic"),active:e.italic,disabled:r,title:"Italic (Ctrl+I)",ariaLabel:"Italic",children:jsxRuntime.jsx(x,{name:"format_italic",size:ce})}),jsxRuntime.jsx(se,{onClick:()=>U("underline"),active:e.underline,disabled:r,title:"Underline (Ctrl+U)",ariaLabel:"Underline",children:jsxRuntime.jsx(x,{name:"format_underlined",size:ce})}),jsxRuntime.jsx(se,{onClick:()=>U("strikethrough"),active:e.strike,disabled:r,title:"Strikethrough",ariaLabel:"Strikethrough",children:jsxRuntime.jsx(x,{name:"strikethrough_s",size:ce})}),f&&jsxRuntime.jsx(Ro,{value:e.color?.replace(/^#/,""),onChange:A,disabled:r,title:"Font Color"}),v&&jsxRuntime.jsx(Mo,{value:e.highlight,onChange:Ee,disabled:r,title:"Text Highlight Color"}),jsxRuntime.jsx(se,{onClick:()=>U("insertLink"),disabled:r,title:"Insert link (Ctrl+K)",ariaLabel:"Insert link",children:jsxRuntime.jsx(x,{name:"link",size:ce})})]}),jsxRuntime.jsxs(xe,{label:"Script",children:[jsxRuntime.jsx(se,{onClick:()=>U("superscript"),active:e.superscript,disabled:r,title:"Superscript (Ctrl+Shift+=)",ariaLabel:"Superscript",children:jsxRuntime.jsx(x,{name:"superscript",size:ce})}),jsxRuntime.jsx(se,{onClick:()=>U("subscript"),active:e.subscript,disabled:r,title:"Subscript (Ctrl+=)",ariaLabel:"Subscript",children:jsxRuntime.jsx(x,{name:"subscript",size:ce})})]}),y&&jsxRuntime.jsx(Ho,{value:e.alignment||"left",onChange:Ce,disabled:r}),(I||S)&&jsxRuntime.jsxs(xe,{label:"List formatting",children:[I&&jsxRuntime.jsx(Do,{listState:e.listState||No(),onBulletList:He,onNumberedList:ue,onIndent:ae,onOutdent:ie,disabled:r,showIndentButtons:true,compact:true,hasIndent:(e.indentLeft??0)>0}),S&&jsxRuntime.jsx(qo,{value:e.lineSpacing,onChange:_e,disabled:r})]}),N&&re&&jsxRuntime.jsxs(xe,{label:"Image",children:[jsxRuntime.jsx(gn,{imageContext:N,onChange:re,disabled:r}),Me&&jsxRuntime.jsx(hn,{onTransform:Me,disabled:r}),it&&jsxRuntime.jsx(se,{onClick:it,disabled:r,title:"Image properties (alt text, border)...",ariaLabel:"Image properties",children:jsxRuntime.jsx(x,{name:"tune",size:ce})})]}),lt?.isInTable&&ze&&jsxRuntime.jsxs(xe,{label:"Table",children:[jsxRuntime.jsx(Go,{onAction:et,disabled:r}),jsxRuntime.jsx(jo,{onAction:et,disabled:r}),jsxRuntime.jsx(Qo,{onAction:et,disabled:r}),jsxRuntime.jsx(en,{onAction:et,disabled:r}),jsxRuntime.jsx(rn,{onAction:et,disabled:r,tableContext:lt})]}),jsxRuntime.jsx(se,{onClick:()=>U("clearFormatting"),disabled:r,title:"Clear formatting",ariaLabel:"Clear formatting",children:jsxRuntime.jsx(x,{name:"format_clear",size:ce})}),p]})}var k={panel:{backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"13px"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:"var(--doc-bg-subtle)",borderBottom:"1px solid var(--doc-border)"},headerTitle:{display:"flex",alignItems:"center",gap:"8px",fontWeight:600,color:"var(--doc-text)"},headerCount:{fontSize:"11px",color:"var(--doc-text-muted)",backgroundColor:"var(--doc-border)",padding:"2px 6px",borderRadius:"10px"},collapseButton:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",padding:0,border:"none",backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text-muted)",borderRadius:"4px",transition:"background-color 0.15s"},body:{padding:"16px"},bodyCollapsed:{display:"none"},searchBox:{marginBottom:"12px"},searchInput:{width:"100%",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"13px",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"},variableList:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"400px",overflowY:"auto"},variableItem:{display:"flex",flexDirection:"column",gap:"4px"},variableLabel:{display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},variableName:{fontFamily:"monospace",fontSize:"12px",color:"var(--doc-warning)",backgroundColor:"var(--doc-warning-bg)",padding:"2px 6px",borderRadius:"3px",border:"1px solid var(--doc-warning)"},variableDescription:{fontSize:"11px",color:"var(--doc-text-subtle)",fontStyle:"italic"},variableInput:{padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"13px",outline:"none",transition:"border-color 0.15s, box-shadow 0.15s"},variableInputFocused:{borderColor:"var(--doc-primary)",boxShadow:"0 0 0 2px rgba(26, 115, 232, 0.2)"},variableInputFilled:{borderColor:"var(--doc-success)",backgroundColor:"var(--doc-success-bg)"},footer:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"12px 16px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-input)"},footerStats:{fontSize:"11px",color:"var(--doc-text-subtle)"},footerButtons:{display:"flex",gap:"8px"},button:{padding:"8px 16px",border:"none",borderRadius:"4px",fontSize:"13px",fontWeight:500,cursor:"pointer",transition:"background-color 0.15s, opacity 0.15s"},buttonPrimary:{backgroundColor:"var(--doc-primary)",color:"white"},buttonSecondary:{backgroundColor:"var(--doc-border)",color:"var(--doc-text)"},buttonDisabled:{opacity:.6,cursor:"not-allowed"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",color:"var(--doc-text-subtle)"},emptyIcon:{marginBottom:"12px",opacity:.5},emptyTitle:{fontSize:"14px",fontWeight:500,color:"var(--doc-text-muted)",marginBottom:"4px"},emptyMessage:{fontSize:"12px",color:"var(--doc-text-placeholder)"}};function Gc({variables:e,values:t={},onValuesChange:o,onApply:n,onReset:a,isApplying:i=false,disabled:r=false,className:u,style:d,title:l="Template Variables",emptyMessage:c="No template variables found in the document.",showCount:p=true,collapsible:g=true,defaultCollapsed:m=false,showSearch:f=false,descriptions:v={}}){let[y,I]=oe.useState({}),[S,R]=oe.useState(m),[_,H]=oe.useState(""),[O,P]=oe.useState(null),Z=oe.useMemo(()=>({...y,...t}),[y,t]),Q=oe.useMemo(()=>{if(!_)return e;let N=_.toLowerCase();return e.filter(re=>re.toLowerCase().includes(N)||(v[re]||"").toLowerCase().includes(N))},[e,_,v]),ee=oe.useMemo(()=>e.filter(N=>Z[N]?.trim()).length,[e,Z]),b=oe.useCallback((N,re)=>{let Me={...Z,[N]:re};I(Me),o&&o(Me);},[Z,o]),C=oe.useCallback(N=>{N.preventDefault(),n&&!r&&!i&&n(Z);},[Z,n,r,i]),V=oe.useCallback(()=>{I({}),a&&a(),o&&o({});},[a,o]),J=oe.useCallback(()=>{R(N=>!N);},[]),D=["docx-variable-panel"];u&&D.push(u),r&&D.push("docx-variable-panel-disabled"),S&&D.push("docx-variable-panel-collapsed");let ve={...k.panel,...d};return e.length===0?jsxRuntime.jsxs("div",{className:D.join(" "),style:ve,children:[jsxRuntime.jsx("div",{style:k.header,children:jsxRuntime.jsxs("span",{style:k.headerTitle,children:[jsxRuntime.jsx(vn,{}),l]})}),jsxRuntime.jsxs("div",{style:k.emptyState,children:[jsxRuntime.jsx("div",{style:k.emptyIcon,children:jsxRuntime.jsx(Xi,{})}),jsxRuntime.jsx("div",{style:k.emptyTitle,children:"No Variables"}),jsxRuntime.jsx("div",{style:k.emptyMessage,children:c})]})]}):jsxRuntime.jsxs("form",{className:D.join(" "),style:ve,onSubmit:C,children:[jsxRuntime.jsxs("div",{style:k.header,children:[jsxRuntime.jsxs("span",{style:k.headerTitle,children:[jsxRuntime.jsx(vn,{}),l,p&&jsxRuntime.jsx("span",{style:k.headerCount,children:e.length})]}),g&&jsxRuntime.jsx("button",{type:"button",onClick:J,style:k.collapseButton,"aria-label":S?"Expand":"Collapse","aria-expanded":!S,children:jsxRuntime.jsx(Qi,{collapsed:S})})]}),jsxRuntime.jsxs("div",{style:{...k.body,...S?k.bodyCollapsed:{}},children:[f&&jsxRuntime.jsx("div",{style:k.searchBox,children:jsxRuntime.jsx("input",{type:"text",value:_,onChange:N=>H(N.target.value),placeholder:"Search variables...",style:k.searchInput,disabled:r})}),jsxRuntime.jsx("div",{style:k.variableList,children:Q.map(N=>jsxRuntime.jsx(ji,{name:N,value:Z[N]||"",description:v[N],onChange:re=>b(N,re),disabled:r||i,isFocused:O===N,onFocus:()=>P(N),onBlur:()=>P(null)},N))})]}),!S&&jsxRuntime.jsxs("div",{style:k.footer,children:[jsxRuntime.jsxs("span",{style:k.footerStats,children:[ee," of ",e.length," filled"]}),jsxRuntime.jsxs("div",{style:k.footerButtons,children:[jsxRuntime.jsx("button",{type:"button",onClick:V,disabled:r||i,style:{...k.button,...k.buttonSecondary,...r||i?k.buttonDisabled:{}},children:"Reset"}),jsxRuntime.jsx("button",{type:"submit",disabled:r||i,style:{...k.button,...k.buttonPrimary,...r||i?k.buttonDisabled:{}},children:i?"Applying...":"Apply"})]})]})]})}function ji({name:e,value:t,description:o,onChange:n,disabled:a,isFocused:i,onFocus:r,onBlur:u}){let d={...k.variableInput,...i?k.variableInputFocused:{},...t.trim()?k.variableInputFilled:{}};return jsxRuntime.jsxs("div",{style:k.variableItem,className:"docx-variable-item",children:[jsxRuntime.jsx("label",{style:k.variableLabel,children:jsxRuntime.jsx("span",{style:k.variableName,children:`{{${e}}}`})}),o&&jsxRuntime.jsx("span",{style:k.variableDescription,children:o}),jsxRuntime.jsx("input",{type:"text",value:t,onChange:l=>n(l.target.value),disabled:a,placeholder:`Enter value for ${e}`,style:d,onFocus:r,onBlur:u,className:"docx-variable-input","aria-label":`Value for ${e}`})]})}function vn(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 3C2.5 3 2 4 2 5.5V6.5C2 7 1.5 7.5 1 7.5V8.5C1.5 8.5 2 9 2 9.5V10.5C2 12 2.5 13 4 13",stroke:"#e4b416",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("path",{d:"M12 3C13.5 3 14 4 14 5.5V6.5C14 7 14.5 7.5 15 7.5V8.5C14.5 8.5 14 9 14 9.5V10.5C14 12 13.5 13 12 13",stroke:"#e4b416",strokeWidth:"1.5",strokeLinecap:"round",fill:"none"})]})}function Xi(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"8",y:"12",width:"32",height:"24",rx:"2",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M14 20H34M14 26H28",stroke:"var(--doc-border)",strokeWidth:"2",strokeLinecap:"round"})]})}function Qi({collapsed:e}){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:e?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s"},children:jsxRuntime.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var el={display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"13px",userSelect:"none",transition:"opacity 0.2s, transform 0.2s"},tl={position:"absolute",zIndex:100,pointerEvents:"auto"},ol={default:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"6px 12px",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",border:"1px solid rgba(0, 0, 0, 0.1)"},minimal:{backgroundColor:"transparent",color:"var(--doc-text-muted)",padding:"4px 8px"},badge:{backgroundColor:"var(--doc-primary)",color:"white",padding:"4px 10px",borderRadius:"4px",fontWeight:500,fontSize:"12px"},pill:{backgroundColor:"rgba(0, 0, 0, 0.7)",color:"white",padding:"6px 14px",borderRadius:"16px",fontSize:"12px",fontWeight:500}},nl={"bottom-left":{bottom:"16px",left:"16px"},"bottom-center":{bottom:"16px",left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:"16px",right:"16px"},"top-left":{top:"16px",left:"16px"},"top-center":{top:"16px",left:"50%",transform:"translateX(-50%)"},"top-right":{top:"16px",right:"16px"}};function Xc({currentPage:e,totalPages:t,position:o="bottom-center",variant:n="default",floating:a=true,showPrefix:i=true,formatText:r,onClick:u,disabled:d=false,className:l="",style:c,children:p}){let g=oe.useMemo(()=>r?r(e,t):i?`Page ${e} of ${t}`:`${e} / ${t}`,[e,t,r,i]),m={...el,...ol[n],...a?tl:{},...a?nl[o]:{},...u&&!d?{cursor:"pointer"}:{},...d?{opacity:.5,pointerEvents:"none"}:{},...c},f=()=>{!d&&u&&u();};return jsxRuntime.jsx("div",{className:`docx-page-indicator docx-page-indicator-${n} ${l}`,style:m,onClick:f,role:u?"button":"status","aria-label":`Page ${e} of ${t}`,"aria-live":"polite",tabIndex:u&&!d?0:void 0,onKeyDown:v=>{u&&!d&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),u());},children:p||g})}function rl(e){let t=["th","st","nd","rd"],o=e%100;return e+(t[(o-20)%10]||t[o]||t[0])}function Qc(e){return (t,o)=>e.replace("{current}",String(t)).replace("{total}",String(o)).replace("{ordinal}",rl(t))}function Jc(e,t){return t<=1?100:Math.round((e-1)/(t-1)*100)}function ep(e){return e===1}function tp(e,t){return e===t}function op(e,t,o=20){let n=0;for(let a=0;a<t.length;a++){let i=n,r=n+t[a],u=(i+r)/2;if(e<u)return a+1;n=r+o;}return t.length}function np(e,t,o,n=20){if(e<1||e>t.length)return 0;let a=0;for(let u=0;u<e-1;u++)a+=t[u]+n;let i=t[e-1],r=Math.max(0,(o-i)/2);return Math.max(0,a-r)}function il(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"15 18 9 12 15 6"})})}function ll(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"9 18 15 12 9 6"})})}function sl(){return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})})}function cl(){return jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}var pl={display:"inline-flex",alignItems:"center",gap:"4px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"13px",userSelect:"none",transition:"opacity 0.2s"},ul={position:"absolute",zIndex:100,pointerEvents:"auto"},dl={default:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"4px 8px",borderRadius:"6px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",border:"1px solid rgba(0, 0, 0, 0.1)"},compact:{backgroundColor:"rgba(255, 255, 255, 0.95)",color:"var(--doc-text)",padding:"2px 4px",borderRadius:"4px",boxShadow:"0 1px 4px rgba(0, 0, 0, 0.1)",border:"1px solid rgba(0, 0, 0, 0.08)",fontSize:"12px"},minimal:{backgroundColor:"transparent",color:"var(--doc-text-muted)",padding:"4px"}},ml={"bottom-left":{bottom:"16px",left:"16px"},"bottom-center":{bottom:"16px",left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:"16px",right:"16px"},"top-left":{top:"16px",left:"16px"},"top-center":{top:"16px",left:"50%",transform:"translateX(-50%)"},"top-right":{top:"16px",right:"16px"}},bn={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s, color 0.15s"},xn={backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)"},yn={opacity:.4,cursor:"not-allowed"},fl={display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.15s",minWidth:"80px",justifyContent:"center"},gl={backgroundColor:"rgba(0, 0, 0, 0.04)"};function hl({currentPage:e,totalPages:t,onNavigate:o,onClose:n,anchorRef:a}){let[i,r]=oe.useState(String(e)),[u,d]=oe.useState(null),l=oe.useRef(null),c=oe.useRef(null);oe.useEffect(()=>{l.current?.focus(),l.current?.select();},[]),oe.useEffect(()=>{let P=Z=>{c.current&&!c.current.contains(Z.target)&&a.current&&!a.current.contains(Z.target)&&n();};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[n,a]),oe.useEffect(()=>{let P=Z=>{Z.key==="Escape"&&n();};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[n]);let p=oe.useCallback(()=>{let P=parseInt(i,10);if(isNaN(P)){d("Please enter a number");return}if(P<1||P>t){d(`Page must be 1-${t}`);return}o(P),n();},[i,t,o,n]),g=P=>{r(P.target.value),d(null);},m=P=>{if(P.key==="Enter")P.preventDefault(),p();else if(P.key==="ArrowUp"){P.preventDefault();let Z=Math.min(parseInt(i,10)+1||1,t);r(String(Z)),d(null);}else if(P.key==="ArrowDown"){P.preventDefault();let Z=Math.max(parseInt(i,10)-1||1,1);r(String(Z)),d(null);}},f=()=>{o(1),n();},v=()=>{o(t),n();},y={position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)",border:"1px solid rgba(0, 0, 0, 0.1)",padding:"12px",minWidth:"200px",zIndex:1e3},I={display:"flex",alignItems:"center",gap:"8px",marginBottom:u?"4px":"12px"},S={flex:1,padding:"8px 12px",fontSize:"14px",border:u?"1px solid var(--doc-error)":"1px solid var(--doc-border)",borderRadius:"4px",outline:"none",textAlign:"center",fontFamily:"inherit"},R={padding:"8px 16px",fontSize:"14px",fontWeight:500,backgroundColor:"var(--doc-primary)",color:"white",border:"none",borderRadius:"4px",cursor:"pointer"},_={color:"var(--doc-error)",fontSize:"12px",marginBottom:"8px"},H={display:"flex",justifyContent:"space-between",gap:"8px"},O={flex:1,padding:"6px 12px",fontSize:"12px",backgroundColor:"var(--doc-bg-muted)",color:"var(--doc-text)",border:"1px solid var(--doc-border-light)",borderRadius:"4px",cursor:"pointer"};return jsxRuntime.jsxs("div",{ref:c,style:y,role:"dialog","aria-label":"Go to page",children:[jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px",textAlign:"center"},children:["Go to page (1-",t,")"]}),jsxRuntime.jsxs("div",{style:I,children:[jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:g,onKeyDown:m,style:S,"aria-label":"Page number","aria-invalid":!!u}),jsxRuntime.jsx("button",{onClick:p,style:R,type:"button",children:"Go"})]}),u&&jsxRuntime.jsx("div",{style:_,children:u}),jsxRuntime.jsxs("div",{style:H,children:[jsxRuntime.jsx("button",{onClick:f,style:O,disabled:e===1,type:"button",children:"First"}),jsxRuntime.jsx("button",{onClick:v,style:O,disabled:e===t,type:"button",children:"Last"})]})]})}function sp({currentPage:e,totalPages:t,onNavigate:o,position:n="bottom-center",variant:a="default",floating:i=true,showButtons:r=true,disabled:u=false,className:d="",style:l}){let[c,p]=oe.useState(false),[g,m]=oe.useState(false),[f,v]=oe.useState(false),[y,I]=oe.useState(false),S=oe.useRef(null),R=e>1,_=e<t,H=oe.useCallback(()=>{R&&!u&&o(e-1);},[R,u,e,o]),O=oe.useCallback(()=>{_&&!u&&o(e+1);},[_,u,e,o]),P=oe.useCallback(D=>{u||(D.key==="ArrowLeft"||D.key==="PageUp"?(D.preventDefault(),H()):D.key==="ArrowRight"||D.key==="PageDown"?(D.preventDefault(),O()):D.key==="Home"?(D.preventDefault(),o(1)):D.key==="End"&&(D.preventDefault(),o(t)));},[u,H,O,o,t]),Z=oe.useCallback(()=>{u||p(D=>!D);},[u]),Q=oe.useCallback(()=>{p(false);},[]),ee=oe.useCallback(D=>{o(D),Q();},[o,Q]),b={...pl,...dl[a],...i?ul:{},...i?ml[n]:{},...u?{opacity:.5,pointerEvents:"none"}:{},...l},C={...bn,...a==="compact"?{width:"24px",height:"24px"}:{},...g&&R?xn:{},...R?{}:yn},V={...bn,...a==="compact"?{width:"24px",height:"24px"}:{},...f&&_?xn:{},..._?{}:yn},J={...fl,...a==="compact"?{padding:"2px 6px",minWidth:"60px"}:{},...y&&!u?gl:{},...u?{cursor:"not-allowed"}:{}};return jsxRuntime.jsxs("div",{className:`docx-page-navigator docx-page-navigator-${a} ${d}`,style:b,role:"navigation","aria-label":"Page navigation",onKeyDown:P,tabIndex:0,children:[r&&jsxRuntime.jsx("button",{onClick:H,disabled:!R||u,style:C,onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),"aria-label":"Previous page",title:"Previous page (\u2190)",type:"button",children:jsxRuntime.jsx(il,{})}),jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:S,onClick:Z,style:J,onMouseEnter:()=>I(true),onMouseLeave:()=>I(false),"aria-haspopup":"dialog","aria-expanded":c,"aria-label":`Page ${e} of ${t}. Click to go to a specific page.`,title:"Click to go to a specific page",disabled:u,type:"button",children:[jsxRuntime.jsxs("span",{children:["Page ",jsxRuntime.jsx("strong",{children:e})," of ",t]}),c?jsxRuntime.jsx(sl,{}):jsxRuntime.jsx(cl,{})]}),c&&jsxRuntime.jsx(hl,{currentPage:e,totalPages:t,onNavigate:ee,onClose:Q,anchorRef:S})]}),r&&jsxRuntime.jsx("button",{onClick:O,disabled:!_||u,style:V,onMouseEnter:()=>v(true),onMouseLeave:()=>v(false),"aria-label":"Next page",title:"Next page (\u2192)",type:"button",children:jsxRuntime.jsx(ll,{})})]})}function cp(e){let t=e.trim(),o=parseInt(t,10);return isNaN(o)?null:o}function pp(e,t){return Number.isInteger(e)&&e>=1&&e<=t}function up(e,t){return Math.min(Math.max(1,Math.round(e)),t)}function dp(){return [{key:"\u2190 or PageUp",description:"Previous page"},{key:"\u2192 or PageDown",description:"Next page"},{key:"Home",description:"First page"},{key:"End",description:"Last page"},{key:"Enter (in input)",description:"Go to page"}]}function mp(e,t,o){return e===t?`Page ${e} of ${o}`:`Pages ${e}-${t} of ${o}`}function fp(e,t){return t<=1?100:Math.round((e-1)/(t-1)*100)}var Cn=12240,Lt=1440,Rt=1440,Mt=567,Xt=22,xl="var(--doc-text-muted)",yl="var(--doc-text-subtle)",Sn="rgba(0, 0, 0, 0.06)",Sl="#4285f4",Cl="#3367d6",Tl="#2a56c6",Oe=5;function wl(e,t){return t==="inch"?(e/Rt).toFixed(2)+'"':(e/Mt).toFixed(1)+" cm"}function yp({sectionProps:e,zoom:t=1,editable:o=false,onLeftMarginChange:n,onRightMarginChange:a,onFirstLineIndentChange:i,showFirstLineIndent:r=false,firstLineIndent:u=0,hangingIndent:d=false,indentLeft:l=0,indentRight:c=0,onIndentLeftChange:p,onIndentRightChange:g,unit:m="inch",className:f="",style:v,tabStops:y,onTabStopRemove:I}){let[S,R]=oe.useState(null),[_,H]=oe.useState(null),[O,P]=oe.useState(null),[Z,Q]=oe.useState(null),ee=oe.useRef(null),b=e?.pageWidth??Cn,C=e?.marginLeft??Lt,V=e?.marginRight??Lt,J=b-C-V,D=chunkSF53KLDZ_cjs.n(b)*t,ve=chunkSF53KLDZ_cjs.n(C)*t,N=chunkSF53KLDZ_cjs.n(V)*t,re=chunkSF53KLDZ_cjs.n(l)*t,Me=chunkSF53KLDZ_cjs.n(c)*t,it=d?-u:u,lt=chunkSF53KLDZ_cjs.n(it)*t,ze=ve+re,st=D-N-Me,U=ve+re+lt,Ze=oe.useCallback((A,Ee)=>{o&&(A.preventDefault(),A.stopPropagation(),R(Ee));},[o]),Qe=oe.useCallback(A=>{if(!S||!ee.current)return;let Ee=ee.current.getBoundingClientRect(),Ce=A.clientX-Ee.left;Q(Ce);let He=chunkSF53KLDZ_cjs.o(Ce/t);if(S==="leftMargin"){let ue=b-V-720,ae=Math.round(Math.max(0,Math.min(He,ue)));P(ae),n?.(ae);}else if(S==="rightMargin"){let ue=b-He,ae=b-C-720,ie=Math.round(Math.max(0,Math.min(ue,ae)));P(ie),a?.(ie);}else if(S==="firstLineIndent"){let ue=C+l,ae=He-ue,ie=J-l-c-720,_e=Math.round(Math.max(-l,Math.min(ae,ie)));P(_e),i?.(_e);}else if(S==="leftIndent"){let ue=He-C,ae=J-c-720,ie=Math.round(Math.max(0,Math.min(ue,ae)));P(ie),p?.(ie);}else if(S==="rightIndent"){let ae=b-V-He,ie=J-l-720,_e=Math.round(Math.max(0,Math.min(ae,ie)));P(_e),g?.(_e);}},[S,t,b,C,V,J,l,c,n,a,i,p,g]),Je=oe.useCallback(()=>{R(null),P(null),Q(null);},[]);oe.useEffect(()=>{if(S)return document.addEventListener("mousemove",Qe),document.addEventListener("mouseup",Je),()=>{document.removeEventListener("mousemove",Qe),document.removeEventListener("mouseup",Je);}},[S,Qe,Je]);let Ht=Rl(b,t,m);return jsxRuntime.jsxs("div",{ref:ee,className:`docx-horizontal-ruler ${f}`,style:{position:"relative",width:chunkSF53KLDZ_cjs.x(D),height:Xt,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:S?"ew-resize":"default",...v},role:"slider","aria-label":"Horizontal ruler","aria-valuemin":0,"aria-valuemax":b,children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:chunkSF53KLDZ_cjs.x(ve),height:Xt,backgroundColor:Sn,borderRight:"1px solid rgba(0,0,0,0.12)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&n?A=>Ze(A,"leftMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:chunkSF53KLDZ_cjs.x(N),height:Xt,backgroundColor:Sn,borderLeft:"1px solid rgba(0,0,0,0.12)",cursor:o?"ew-resize":"default",zIndex:1},onMouseDown:o&&a?A=>Ze(A,"rightMargin"):void 0}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:Ht.map((A,Ee)=>jsxRuntime.jsx(Il,{tick:A},Ee))}),r&&jsxRuntime.jsx(Qt,{direction:"down",positionPx:U,editable:o,isDragging:S==="firstLineIndent",isHovered:_==="firstLineIndent",onMouseEnter:()=>H("firstLineIndent"),onMouseLeave:()=>H(null),onMouseDown:A=>Ze(A,"firstLineIndent"),label:"First line indent"}),o&&p&&jsxRuntime.jsx(Qt,{direction:"up",positionPx:ze,editable:o,isDragging:S==="leftIndent",isHovered:_==="leftIndent",onMouseEnter:()=>H("leftIndent"),onMouseLeave:()=>H(null),onMouseDown:A=>Ze(A,"leftIndent"),label:"Left indent"}),o&&g&&jsxRuntime.jsx(Qt,{direction:"down",positionPx:st,editable:o,isDragging:S==="rightIndent",isHovered:_==="rightIndent",onMouseEnter:()=>H("rightIndent"),onMouseLeave:()=>H(null),onMouseDown:A=>Ze(A,"rightIndent"),label:"Right indent"}),y?.map(A=>jsxRuntime.jsx(Ll,{tabStop:A,positionPx:chunkSF53KLDZ_cjs.n(A.position)*t,onDoubleClick:()=>I?.(A.position)},A.position)),S&&O!==null&&Z!==null&&jsxRuntime.jsx(Pl,{value:wl(O,m),positionPx:Z})]})}function Il({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkSF53KLDZ_cjs.x(e.position),bottom:0,width:1,height:e.height,backgroundColor:yl}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkSF53KLDZ_cjs.x(e.position),top:3,transform:"translateX(-50%)",fontSize:"9px",color:xl,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Qt({direction:e,positionPx:t,editable:o,isDragging:n,isHovered:a,onMouseEnter:i,onMouseLeave:r,onMouseDown:u,label:d}){let l=n?Tl:a?Cl:Sl,c=Math.round(Oe*1.6),p={position:"absolute",left:chunkSF53KLDZ_cjs.x(t-Oe),width:Oe*2,height:c+2,cursor:o?"ew-resize":"default",zIndex:n?10:4,...e==="down"?{top:0}:{bottom:0}},g=e==="down"?{position:"absolute",top:1,left:0,width:0,height:0,borderLeft:`${Oe}px solid transparent`,borderRight:`${Oe}px solid transparent`,borderTop:`${c}px solid ${l}`,transition:"border-top-color 0.1s"}:{position:"absolute",bottom:1,left:0,width:0,height:0,borderLeft:`${Oe}px solid transparent`,borderRight:`${Oe}px solid transparent`,borderBottom:`${c}px solid ${l}`,transition:"border-bottom-color 0.1s"};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:p,onMouseEnter:i,onMouseLeave:r,onMouseDown:u,role:"slider","aria-label":d,"aria-orientation":"horizontal",tabIndex:o?0:-1,children:jsxRuntime.jsx("div",{style:g})})}function Pl({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkSF53KLDZ_cjs.x(t),top:-22,transform:"translateX(-50%)",backgroundColor:"#333",color:"#fff",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var kl={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function Ll({tabStop:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:chunkSF53KLDZ_cjs.x(t-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"#555",cursor:"pointer",userSelect:"none"},onDoubleClick:n=>{n.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:kl[e.alignment]||"L"})}function Rl(e,t,o){let n=[];if(o==="inch"){let a=Rt/8,i=Math.ceil(e/a);for(let r=0;r<=i;r++){let u=r*a;if(u>e)break;let d=chunkSF53KLDZ_cjs.n(u)*t;r%8===0?n.push({position:d,height:10,label:r/8>0?String(r/8):void 0}):r%4===0?n.push({position:d,height:6}):r%2===0?n.push({position:d,height:4}):n.push({position:d,height:2});}}else {let a=Mt/10,i=Math.ceil(e/a);for(let r=0;r<=i;r++){let u=r*a;if(u>e)break;let d=chunkSF53KLDZ_cjs.n(u)*t;r%10===0?n.push({position:d,height:10,label:r/10>0?String(r/10):void 0}):r%5===0?n.push({position:d,height:6}):n.push({position:d,height:3});}}return n}function Sp(e,t,o,n){let a=chunkSF53KLDZ_cjs.o(e/n);return t==="left"?Math.max(0,a):Math.max(0,chunkSF53KLDZ_cjs.o(o/n)-a)}function Cp(e,t=1){let o=e?.pageWidth??Cn,n=e?.marginLeft??Lt,a=e?.marginRight??Lt,i=chunkSF53KLDZ_cjs.n(o)*t,r=chunkSF53KLDZ_cjs.n(n)*t,u=chunkSF53KLDZ_cjs.n(a)*t;return {width:i,leftMargin:r,rightMargin:u,contentWidth:i-r-u}}function Tp(e,t){return t==="inch"?(e/Rt).toFixed(2)+'"':(e/Mt).toFixed(1)+" cm"}function wp(e,t){let o=parseFloat(e.replace(/[^\d.]/g,""));return isNaN(o)?null:Math.round(o*(t==="inch"?Rt:Mt))}var Se=16;function El(){return jsxRuntime.jsx(x,{name:"table_rows",size:Se,style:{transform:"scaleY(-1)"}})}function Hl(){return jsxRuntime.jsx(x,{name:"table_rows",size:Se})}function _l(){return jsxRuntime.jsx(x,{name:"view_column",size:Se,style:{transform:"scaleX(-1)"}})}function Dl(){return jsxRuntime.jsx(x,{name:"view_column",size:Se})}function Nl(){return jsxRuntime.jsx(x,{name:"delete_sweep",size:Se})}function Fl(){return jsxRuntime.jsx(x,{name:"delete_sweep",size:Se,style:{transform:"rotate(90deg)"}})}function ql(){return jsxRuntime.jsx(x,{name:"call_merge",size:Se})}function Al(){return jsxRuntime.jsx(x,{name:"call_split",size:Se})}function Bl(){return jsxRuntime.jsx(x,{name:"delete",size:Se,className:"text-red-600"})}var pe={container:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",border:"1px solid var(--doc-border)",fontSize:"12px"},containerCompact:{padding:"2px 4px",gap:"2px"},containerFloating:{position:"absolute",zIndex:1e3,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},group:{display:"flex",alignItems:"center",gap:"2px"},separator:{width:"1px",height:"20px",backgroundColor:"var(--doc-border-dark)",margin:"0 4px"},button:{display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 8px",border:"none",borderRadius:"3px",backgroundColor:"transparent",color:"var(--doc-text)",cursor:"pointer",fontSize:"12px",lineHeight:"1",transition:"background-color 0.15s, color 0.15s"},buttonCompact:{padding:"3px 5px"},buttonHover:{backgroundColor:"var(--doc-border)"},buttonDisabled:{color:"var(--doc-text-subtle)",cursor:"not-allowed"},buttonDelete:{color:"var(--doc-error)"},label:{fontSize:"11px",fontWeight:500,color:"var(--doc-text-muted)",marginRight:"8px",whiteSpace:"nowrap"}};function ye({action:e,label:t,icon:o,disabled:n=false,onClick:a,showLabel:i=false,compact:r=false,shortcut:u}){let[d,l]=oe__namespace.default.useState(false),c=typeof e=="string"&&e.startsWith("delete"),p={...pe.button,...r?pe.buttonCompact:{},...d&&!n?pe.buttonHover:{},...n?pe.buttonDisabled:{},...c&&!n?pe.buttonDelete:{}},g=u?`${t} (${u})`:t;return jsxRuntime.jsxs("button",{type:"button",className:`docx-table-toolbar-button docx-table-toolbar-${typeof e=="string"?e:e.type}`,style:p,disabled:n,onClick:a,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),title:g,"aria-label":t,children:[o,i&&jsxRuntime.jsx("span",{children:t})]})}function Jt({children:e,showSeparator:t=true}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:pe.group,children:e}),t&&jsxRuntime.jsx("div",{style:pe.separator})]})}function Rp({context:e,onAction:t,disabled:o=false,className:n,style:a,showLabels:i=false,compact:r=false,position:u="top",children:d}){if(!e)return null;let l=y=>{!o&&t&&e&&t(y,e);},c=e.rowCount>1,p=e.columnCount>1,g=e.hasMultiCellSelection,m=e.canSplitCell,f={...pe.container,...r?pe.containerCompact:{},...u==="floating"?pe.containerFloating:{},...a},v=["docx-table-toolbar"];return n&&v.push(n),r&&v.push("docx-table-toolbar-compact"),u==="floating"&&v.push("docx-table-toolbar-floating"),jsxRuntime.jsxs("div",{className:v.join(" "),style:f,role:"toolbar","aria-label":"Table editing tools",children:[jsxRuntime.jsx("span",{style:pe.label,children:"Table:"}),jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx(ye,{action:"addRowAbove",label:"Insert Row Above",icon:jsxRuntime.jsx(El,{}),disabled:o,onClick:()=>l("addRowAbove"),showLabel:i,compact:r}),jsxRuntime.jsx(ye,{action:"addRowBelow",label:"Insert Row Below",icon:jsxRuntime.jsx(Hl,{}),disabled:o,onClick:()=>l("addRowBelow"),showLabel:i,compact:r}),jsxRuntime.jsx(ye,{action:"deleteRow",label:"Delete Row",icon:jsxRuntime.jsx(Nl,{}),disabled:o||!c,onClick:()=>l("deleteRow"),showLabel:i,compact:r})]}),jsxRuntime.jsxs(Jt,{children:[jsxRuntime.jsx(ye,{action:"addColumnLeft",label:"Insert Column Left",icon:jsxRuntime.jsx(_l,{}),disabled:o,onClick:()=>l("addColumnLeft"),showLabel:i,compact:r}),jsxRuntime.jsx(ye,{action:"addColumnRight",label:"Insert Column Right",icon:jsxRuntime.jsx(Dl,{}),disabled:o,onClick:()=>l("addColumnRight"),showLabel:i,compact:r}),jsxRuntime.jsx(ye,{action:"deleteColumn",label:"Delete Column",icon:jsxRuntime.jsx(Fl,{}),disabled:o||!p,onClick:()=>l("deleteColumn"),showLabel:i,compact:r})]}),jsxRuntime.jsxs(Jt,{showSeparator:false,children:[jsxRuntime.jsx(ye,{action:"mergeCells",label:"Merge Cells",icon:jsxRuntime.jsx(ql,{}),disabled:o||!g,onClick:()=>l("mergeCells"),showLabel:i,compact:r}),jsxRuntime.jsx(ye,{action:"splitCell",label:"Split Cell",icon:jsxRuntime.jsx(Al,{}),disabled:o||!m,onClick:()=>l("splitCell"),showLabel:i,compact:r}),jsxRuntime.jsx(ye,{action:"deleteTable",label:"Delete Table",icon:jsxRuntime.jsx(Bl,{}),disabled:o,onClick:()=>l("deleteTable"),showLabel:i,compact:r})]}),d]})}function Mp(e,t){let o=e.rows.length,n=eo(e),a=!!(t.selectedCells&&(t.selectedCells.startRow!==t.selectedCells.endRow||t.selectedCells.startCol!==t.selectedCells.endCol)),i=wn(e,t.rowIndex,t.columnIndex),r=!!(i&&((i.formatting?.gridSpan??1)>1||i.formatting?.vMerge==="restart"));return {table:e,selection:t,hasMultiCellSelection:a,canSplitCell:r,rowCount:o,columnCount:n}}function eo(e){if(!e.rows.length)return 0;let t=0;for(let o of e.rows){let n=0;for(let a of o.cells)n+=a.formatting?.gridSpan??1;t=Math.max(t,n);}return t}function wn(e,t,o){let n=e.rows[t];if(!n)return null;let a=0;for(let i of n.cells){let r=i.formatting?.gridSpan??1;if(o>=a&&o<a+r)return i;a+=r;}return null}function Ol(e,t){let o=[],n=0;for(let a of e.cells){let i=a.formatting?.gridSpan??1;o.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...a.formatting,vMerge:void 0}}),n+=i;}for(;n<t;)o.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}),n++;return {type:"tableRow",cells:o,formatting:{...e.formatting,header:false}}}function zl(){return {type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}}function Zp(e,t,o="after"){let n=[...e.rows],a=o==="before"?t:t+1,i=e.rows[t]||e.rows[0],r=eo(e),u=Ol(i,r);return n.splice(a,0,u),{...e,rows:n}}function Ep(e,t){if(e.rows.length<=1)return e;let o=e.rows.filter((n,a)=>a!==t);return {...e,rows:o}}function Hp(e,t,o="after"){let n=o==="before"?t:t+1,a=e.rows.map(r=>{let u=[...r.cells],d=0,l=0;for(let c=0;c<r.cells.length;c++){let g=r.cells[c].formatting?.gridSpan??1;if(n<=d+g){l=o==="before"?c:c+1;break}d+=g,l=c+1;}return u.splice(l,0,zl()),{...r,cells:u}}),i=e.columnWidths;if(e.columnWidths&&e.columnWidths.length>0){i=[...e.columnWidths];let r=e.columnWidths[t]||e.columnWidths[0]||1440;i.splice(n,0,r);}return {...e,rows:a,columnWidths:i}}function _p(e,t){if(eo(e)<=1)return e;let n=e.rows.map(i=>{let r=0,u=[];for(let d of i.cells){let l=d.formatting?.gridSpan??1;t>=r&&t<r+l?l>1&&u.push({...d,formatting:{...d.formatting,gridSpan:l-1}}):u.push(d),r+=l;}return {...i,cells:u}}),a=e.columnWidths;return e.columnWidths&&e.columnWidths.length>t&&(a=e.columnWidths.filter((i,r)=>r!==t)),{...e,rows:n,columnWidths:a}}function Dp(e,t){if(!t.selectedCells)return e;let{startRow:o,startCol:n,endRow:a,endCol:i}=t.selectedCells,r=a-o+1,u=i-n+1,d=e.rows.map((l,c)=>{if(c<o||c>a)return l;let p=[],g=0;for(let m of l.cells){let f=m.formatting?.gridSpan??1,v=g+f-1;g<=i&&v>=n?c===o&&g===n?p.push({...m,formatting:{...m.formatting,gridSpan:u,vMerge:r>1?"restart":void 0}}):c>o&&g===n&&p.push({...m,formatting:{...m.formatting,gridSpan:u,vMerge:"continue"}}):p.push(m),g+=f;}return {...l,cells:p}});return {...e,rows:d}}function Np(e,t,o){let n=wn(e,t,o);if(!n)return e;let a=n.formatting?.gridSpan??1,i=n.formatting?.vMerge==="restart";if(a<=1&&!i)return e;let r=e.rows.map((u,d)=>{if(d!==t&&!i)return u;let l=[],c=0;for(let p of u.cells){let g=p.formatting?.gridSpan??1;if(c===o||c<=o&&o<c+g)if(a>1)for(let m=0;m<a;m++)l.push({type:"tableCell",content:m===0?p.content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...p.formatting,gridSpan:void 0,vMerge:void 0}});else i&&d===t?l.push({...p,formatting:{...p.formatting,vMerge:void 0}}):p.formatting?.vMerge==="continue"?l.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...p.formatting,vMerge:void 0}}):l.push(p);else l.push(p);c+=g;}return {...u,cells:l}});return {...e,rows:r}}
|
|
4
|
+
exports.$=Dp;exports.A=rl;exports.B=Qc;exports.C=Jc;exports.D=ep;exports.E=tp;exports.F=op;exports.G=np;exports.H=sp;exports.I=cp;exports.J=pp;exports.K=up;exports.L=dp;exports.M=mp;exports.N=fp;exports.O=yp;exports.P=Sp;exports.Q=Cp;exports.R=Tp;exports.S=wp;exports.T=Rp;exports.U=Mp;exports.V=eo;exports.W=wn;exports.X=Zp;exports.Y=Ep;exports.Z=Hp;exports._=_p;exports.a=w;exports.aa=Np;exports.b=ho;exports.c=z;exports.d=x;exports.da=Zt;exports.e=Ts;exports.ea=Ln;exports.f=Io;exports.fa=Et;exports.g=Lo;exports.ga=Rn;exports.h=K;exports.ha=at;exports.i=Ho;exports.ia=Mn;exports.j=Do;exports.ja=no;exports.k=No;exports.ka=ro;exports.l=qo;exports.la=ao;exports.m=Bo;exports.ma=io;exports.n=Oo;exports.na=lo;exports.o=Go;exports.oa=so;exports.p=jo;exports.pa=En;exports.q=Qo;exports.qa=Xl;exports.r=en;exports.ra=Ql;exports.s=rn;exports.t=gc;exports.u=se;exports.v=xe;exports.w=Bc;exports.x=Oc;exports.y=Gc;exports.z=Xc;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {b as b$1,f}from'./chunk-ESI4BSBF.js';import {b}from'./chunk-2ASOEN3V.js';import {p}from'./chunk-OTG4NABM.js';import {a}from'./chunk-3IYNTJO5.js';function I(o){return typeof o=="object"&&o!==null&&("_def"in o||"parse"in o||"safeParse"in o)}function w(o,i){let s=i,{position:n,variableName:t}=s,e=JSON.parse(JSON.stringify(o)),a=e.package.document.content.filter(m=>m.type==="paragraph");if(n.paragraphIndex>=a.length)throw new Error(`Paragraph index ${n.paragraphIndex} out of bounds`);let l=a[n.paragraphIndex],p=`{{${t}}}`;return P(l,n.offset,p),e.templateVariables||(e.templateVariables=[]),e.templateVariables.includes(t)||e.templateVariables.push(t),e}function C(o,i){let s=i,{range:n,variableName:t}=s,e=JSON.parse(JSON.stringify(o)),a=e.package.document.content.filter(m=>m.type==="paragraph");if(n.start.paragraphIndex!==n.end.paragraphIndex)throw new Error("Template variable replacement cannot span multiple paragraphs");if(n.start.paragraphIndex>=a.length)throw new Error(`Paragraph index ${n.start.paragraphIndex} out of bounds`);let l=a[n.start.paragraphIndex];D(l,n.start.offset,n.end.offset);let p=`{{${t}}}`;return P(l,n.start.offset,p),e.templateVariables||(e.templateVariables=[]),e.templateVariables.includes(t)||e.templateVariables.push(t),e}function P(o,i,s){let n=0,t=false;for(let e=0;e<o.content.length;e++){let r=o.content[e];if(r.type==="run"){let a=g(r),l=n,p=n+a.length;if(!t&&i>=l&&i<=p){let m=i-l,f=a.slice(0,m),x=a.slice(m),d=[];for(let c=0;c<e;c++)d.push(o.content[c]);f&&d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:f}]}),d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:s}]}),x&&d.push({type:"run",formatting:r.formatting,content:[{type:"text",text:x}]});for(let c=e+1;c<o.content.length;c++)d.push(o.content[c]);o.content=d,t=true;break}n=p;}else if(r.type==="hyperlink")for(let a of r.children)a.type==="run"&&(n+=g(a).length);}t||o.content.push({type:"run",content:[{type:"text",text:s}]});}function D(o,i,s){let n=[],t=0;for(let e of o.content)if(e.type==="run"){let r=g(e),a=t,l=t+r.length;if(l<=i||a>=s)n.push(e);else {let p="";a<i&&(p+=r.slice(0,i-a)),l>s&&(p+=r.slice(s-a)),p.length>0&&n.push({type:"run",formatting:e.formatting,content:[{type:"text",text:p}]});}t=l;}else n.push(e);o.content=n;}function g(o){return o.content.filter(i=>i.type==="text").map(i=>i.text).join("")}var u={type:"string",description:"Document ID from a previous docx_load call"},V={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)"},offset:{type:"number",description:"Character offset within the paragraph"}},required:["paragraphIndex","offset"]},R={name:"docx_get_variables",description:`List all template variables ({{name}} format) found in the document.
|
|
2
|
+
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
|
+
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(o,i)=>{let{documentId:s}=o,n=i.session.documents.get(s);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};try{let t=b(n.document);return {content:[{type:"text",text:JSON.stringify({variables:t.variables,count:t.variables.length,totalOccurrences:t.totalOccurrences,byLocation:t.byLocation},null,2)}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to detect variables: ${t.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low",examples:[{description:"Get all variables from a loaded document",input:{documentId:"doc_123"},output:'{"variables": ["customer_name", "invoice_date"], "count": 2}'}]}},S={name:"docx_insert_variable",description:`Insert a template variable placeholder ({{name}}) at a specific position in the document.
|
|
4
|
+
The variable can later be substituted with actual values using docx_apply_template.
|
|
5
|
+
Variable names should follow the pattern: letters, numbers, underscores, starting with a letter.`,inputSchema:{type:"object",properties:{documentId:u,position:V,variableName:{type:"string",description:'Variable name without braces (e.g., "customer_name"). Will be inserted as {{customer_name}}',pattern:"^[a-zA-Z_][a-zA-Z0-9_]*$"}},required:["documentId","position","variableName"]},handler:async(o,i)=>{let{documentId:s,position:n,variableName:t}=o,e=i.session.documents.get(s);if(!e)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};if(!/^[a-zA-Z_][a-zA-Z0-9_\-.]*$/.test(t))return {isError:true,content:[{type:"text",text:`Invalid variable name: ${t}. Must start with letter/underscore and contain only alphanumeric, underscore, hyphen, or dot.`}]};try{let{executeCommand:r}=await import('./executor-44OB3DFD.js'),a=r(e.document,{type:"insertText",position:n,text:`{{${t}}}`});return e.document=a,e.lastModified=Date.now(),a.templateVariables||(a.templateVariables=[]),a.templateVariables.includes(t)||a.templateVariables.push(t),{content:[{type:"text",text:JSON.stringify({success:!0,variable:t,insertedAs:`{{${t}}}`,position:n})}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to insert variable: ${r.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"low",examples:[{description:"Insert customer name variable at start of first paragraph",input:{documentId:"doc_123",position:{paragraphIndex:0,offset:0},variableName:"customer_name"}}]}},k={name:"docx_apply_template",description:`Substitute template variables with actual values in the document.
|
|
6
|
+
Replaces all {variable} placeholders with the corresponding values provided.
|
|
7
|
+
Preserves all formatting (fonts, styles, colors, tables).
|
|
8
|
+
Use docx_get_variables first to discover what variables exist in the document.`,inputSchema:{type:"object",properties:{documentId:u,variables:{type:"object",description:'Map of variable names to values (e.g., {"customer_name": "John Doe", "date": "2024-01-15"})',additionalProperties:{type:"string"}},keepUnmatchedVariables:{type:"boolean",description:"If true, keep {variable} placeholders for variables not in the map. If false, replace with empty string. Default: true",default:true}},required:["documentId","variables"]},handler:async(o,i)=>{let{documentId:s,variables:n,keepUnmatchedVariables:t=true}=o,e=i.session.documents.get(s);if(!e)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};if(!e.buffer)return {isError:true,content:[{type:"text",text:"Cannot apply template: document was not loaded from a DOCX buffer"}]};try{let r=b$1(e.buffer,n,{nullGetter:t?"keep":"empty"}),a=await p(r.buffer);return e.document=a,e.buffer=r.buffer,e.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedVariables:r.replacedVariables,unreplacedVariables:r.unreplacedVariables,warnings:r.warnings})}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to apply template: ${r.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"medium",examples:[{description:"Fill in customer and date values",input:{documentId:"doc_123",variables:{customer_name:"Jane Smith",invoice_date:"2024-02-15",amount:"$1,234.56"}}}]}},E={name:"docx_validate_template",description:`Validate that a document is a valid docxtemplater template.
|
|
9
|
+
Checks for syntax errors like unclosed braces, invalid tag names, etc.
|
|
10
|
+
Returns validation result with any errors found and list of valid tags.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(o,i)=>{let{documentId:s}=o,n=i.session.documents.get(s);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${s}`}]};if(!n.buffer)return {isError:true,content:[{type:"text",text:"Cannot validate template: document was not loaded from a DOCX buffer"}]};try{let t=f(n.buffer);return {content:[{type:"text",text:JSON.stringify({valid:t.valid,tags:t.tags,errors:t.errors.map(e=>({message:e.message,variable:e.variable,type:e.type}))},null,2)}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to validate template: ${t.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low"}},M=[R,S,k,E];var _={id:"docxtemplater",name:"Docxtemplater",version:"1.0.0",description:"Template variable support using standard docxtemplater syntax ({variable})",commandHandlers:{insertTemplateVariable:w,replaceWithTemplateVariable:C},mcpTools:M,initialize:()=>{try{a("docxtemplater"),a("pizzip");}catch{console.warn("[docxtemplater-plugin] Warning: docxtemplater or pizzip not installed. Template features may not work. Install with: npm install docxtemplater pizzip");}}};export{I as a,_ as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');function _(){return {matchCase:false,matchWholeWord:false,useRegex:false}}function H(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X(e,n){if(!e)return null;try{let t;n.useRegex?t=e:t=H(e),n.matchWholeWord&&(t=`\\b${t}\\b`);let c=n.matchCase?"g":"gi";return new RegExp(t,c)}catch{return null}}function D(e,n,t){if(!e||!n)return [];let c=[],i=n;t.matchCase||(i=n.toLowerCase());let f=v=>v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d;t.matchWholeWord?d=`\\b${f(i)}\\b`:d=f(i);let s=t.matchCase?"g":"gi",p=new RegExp(d,s),h;for(;(h=p.exec(e))!==null;)c.push({start:h.index,end:h.index+h[0].length}),h[0].length===0&&p.lastIndex++;return c}function me(e,n,t,c){let i=X(n,c);return i?e.replace(i,t):e}function be(e,n,t,c,i=0){let f=D(e,n,c),d=f.find(p=>p.start>=i)||f[0];return d?{content:e.substring(0,d.start)+t+e.substring(d.end),replaced:true,matchStart:d.start,matchEnd:d.start+t.length}:{content:e,replaced:false,matchStart:-1,matchEnd:-1}}function Se(e){return e?e.totalCount===0?"No results":e.totalCount===1?"1 match":`${e.currentIndex+1} of ${e.totalCount} matches`:""}function ye(e){return !e||e.trim()===""}function Ce(){return {currentMatchColor:"#FFFF00",otherMatchColor:"#FFFFAA"}}function k(e){if(!e||!e.content)return "";let n="";for(let t of e.content)t.type==="text"?n+=t.text||"":t.type==="tab"?n+=" ":t.type==="break"&&t.breakType==="textWrapping"&&(n+=`
|
|
2
|
+
`);return n}function Fe(e){if(!e||!e.content)return "";let n="";for(let t of e.content)if(t.type==="run")n+=k(t);else if(t.type==="hyperlink")for(let c of t.children||[])c.type==="run"&&(n+=k(c));return n}function Re(e,n,t){if(!e||!n)return [];let c=[],i=e.package?.document||e.package?.document;if(!i||!i.content)return c;let f=0;for(let d of i.content)if(d.type==="paragraph"){let s=q(d,n,t,f);c.push(...s),f++;}else if(d.type==="table")for(let s of d.rows||[])for(let p of s.cells||[])for(let h of p.content||[])h.type;return c}function q(e,n,t,c){let i=[],f=Fe(e);if(!f)return i;let d=D(f,n,t);for(let s of d){let p=Te(e,s.start);i.push({paragraphIndex:c,contentIndex:p.contentIndex,startOffset:p.offsetInContent,endOffset:p.offsetInContent+(s.end-s.start),text:f.substring(s.start,s.end)});}return i}function Te(e,n){if(!e||!e.content)return {contentIndex:0,runIndex:0,offsetInContent:n};let t=0,c=0;for(let i of e.content){let f="";if(i.type==="run")f=k(i);else if(i.type==="hyperlink")for(let s of i.children||[])s.type==="run"&&(f+=k(s));let d=f.length;if(t+d>n)return {contentIndex:c,runIndex:c,offsetInContent:n-t};t+=d,c++;}return {contentIndex:Math.max(0,e.content.length-1),runIndex:Math.max(0,e.content.length-1),offsetInContent:0}}function Ie(e,n){if(!e||!n)return;let t=e.querySelector(`[data-paragraph-index="${n.paragraphIndex}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"});}function Ee(e){let[n,t]=react.useState({isOpen:false,searchText:"",replaceText:"",options:_(),matches:[],currentIndex:0,replaceMode:e?.initialReplaceMode??false}),c=react.useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:false,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),i=react.useCallback(o=>{t(r=>({...r,isOpen:true,replaceMode:true,searchText:o||r.searchText,matches:[],currentIndex:0}));},[]),f=react.useCallback(()=>{t(o=>({...o,isOpen:false}));},[]),d=react.useCallback(()=>{t(o=>({...o,isOpen:!o.isOpen}));},[]),s=react.useCallback(o=>{t(r=>({...r,searchText:o}));},[]),p=react.useCallback(o=>{t(r=>({...r,replaceText:o}));},[]),h=react.useCallback(o=>{t(r=>({...r,options:{...r.options,...o}}));},[]),v=react.useCallback((o,r=0)=>{let E=Math.max(0,Math.min(r,o.length-1));t(L=>({...L,matches:o,currentIndex:o.length>0?E:0})),e?.onMatchesChange?.(o),o.length>0?e?.onCurrentMatchChange?.(o[E],E):e?.onCurrentMatchChange?.(null,-1);},[e]),M=react.useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=(r.currentIndex+1)%r.matches.length,{...r,currentIndex:o})),o},[]),N=react.useCallback(()=>{let o=0;return t(r=>r.matches.length===0?r:(o=r.currentIndex===0?r.matches.length-1:r.currentIndex-1,{...r,currentIndex:o})),o},[]),w=react.useCallback(o=>{t(r=>r.matches.length===0||o<0||o>=r.matches.length?r:{...r,currentIndex:o});},[]),x=react.useCallback(()=>n.matches.length===0?null:n.matches[n.currentIndex]||null,[n.matches,n.currentIndex]),O=react.useCallback(()=>n.matches.length>0,[n.matches.length]);return {state:n,openFind:c,openReplace:i,close:f,toggle:d,setSearchText:s,setReplaceText:p,setOptions:h,setMatches:v,goToNextMatch:M,goToPreviousMatch:N,goToMatch:w,getCurrentMatch:x,hasMatches:O}}var Me={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"transparent",display:"flex",alignItems:"flex-start",justifyContent:"flex-end",zIndex:1e4,pointerEvents:"none"},Oe={backgroundColor:"white",borderRadius:"4px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.2)",minWidth:"360px",maxWidth:"440px",width:"100%",margin:"60px 20px 20px 20px",pointerEvents:"auto"},Le={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg-subtle)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},ke={margin:0,fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},Ne={background:"none",border:"none",fontSize:"18px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"2px 6px",lineHeight:1},we={padding:"16px"},Q={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},Z={width:"60px",fontSize:"13px",color:"var(--doc-text)",flexShrink:0},Y={flex:1,padding:"8px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"13px",boxSizing:"border-box",outline:"none"},ee={...Y,borderColor:"var(--doc-link)",boxShadow:"0 0 0 2px rgba(5, 99, 193, 0.1)"},Pe={display:"flex",flexDirection:"column",gap:"6px",marginLeft:"8px"},B={padding:"6px 12px",borderRadius:"3px",fontSize:"12px",fontWeight:500,cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)",minWidth:"80px",textAlign:"center"},te={...B,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text-placeholder)",cursor:"not-allowed"},U={padding:"6px 10px",borderRadius:"3px",fontSize:"14px",cursor:"pointer",border:"1px solid var(--doc-border-input)",backgroundColor:"var(--doc-bg-input)",color:"var(--doc-text)"},ne={...U,color:"var(--doc-border-input)",cursor:"not-allowed"},_e={display:"flex",gap:"16px",marginTop:"4px",marginLeft:"68px"},W={display:"flex",alignItems:"center",gap:"6px",fontSize:"12px",color:"var(--doc-text-muted)",cursor:"pointer"},oe={width:"14px",height:"14px",cursor:"pointer"},re={marginLeft:"68px",fontSize:"12px",color:"var(--doc-text-muted)",marginBottom:"8px"},De={...re,color:"var(--doc-error)"},Ae=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"18 15 12 9 6 15"})}),We=({style:e})=>jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:e,children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})});function Ye({isOpen:e,onClose:n,onFind:t,onFindNext:c,onFindPrevious:i,onReplace:f,onReplaceAll:d,onHighlightMatches:s,onClearHighlights:p,initialSearchText:h="",replaceMode:v=false,currentResult:M,className:N,style:w}){let[x,O]=react.useState(""),[o,r]=react.useState(""),[E,L]=react.useState(v),[C,ae]=react.useState(false),[F,ce]=react.useState(false),[l,R]=react.useState(null),[ie,K]=react.useState(false),[se,z]=react.useState(false),P=react.useRef(null),$=react.useRef(null);react.useEffect(()=>{M!==void 0&&R(M);},[M]),react.useEffect(()=>{if(e){if(O(h),r(""),L(v),R(null),setTimeout(()=>{P.current?.focus(),P.current?.select();},100),h){let a=t(h,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s&&s(a.matches);}}else p&&p();},[e,h,v]);let S=react.useCallback(()=>{if(!x.trim()){R(null),p&&p();return}let a=t(x,{matchCase:C,matchWholeWord:F});R(a),a?.matches&&s?s(a.matches):p&&p();},[x,C,F,t,s,p]);react.useEffect(()=>{e&&x.trim()&&S();},[C,F]);let le=react.useCallback(a=>{O(a.target.value);},[]),de=react.useCallback(a=>{a.key==="Enter"?(a.preventDefault(),a.shiftKey?V():l?G():S()):a.key==="Escape"&&n();},[l,S,n]),pe=react.useCallback(a=>{a.key==="Enter"?(a.preventDefault(),j()):a.key==="Escape"&&n();},[n]),G=react.useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(c()&&l){let y=(l.currentIndex+1)%l.totalCount;R({...l,currentIndex:y});}},[x,l,S,c]),V=react.useCallback(()=>{if(!x.trim()){S();return}if(!l){S();return}if(i()&&l){let y=l.currentIndex===0?l.totalCount-1:l.currentIndex-1;R({...l,currentIndex:y});}},[x,l,S,i]),j=react.useCallback(()=>{if(!l||l.totalCount===0)return;if(f(o)){let y=t(x,{matchCase:C,matchWholeWord:F});R(y),y?.matches&&s&&s(y.matches);}},[l,o,x,C,F,f,t,s]),ue=react.useCallback(()=>{if(!x.trim())return;d(x,o,{matchCase:C,matchWholeWord:F})>0&&(R({matches:[],totalCount:0,currentIndex:-1}),p&&p());},[x,o,C,F,d,p]),fe=react.useCallback(()=>{L(a=>{let y=!a;return y&&setTimeout(()=>$.current?.focus(),100),y});},[]),xe=react.useCallback(a=>{a.target,a.currentTarget;},[]),he=react.useCallback(a=>{a.key==="Escape"&&n();},[n]);if(!e)return null;let T=l&&l.totalCount>0,ge=l&&l.totalCount===0&&x.trim();return jsxRuntime.jsx("div",{className:`docx-find-replace-dialog-overlay ${N||""}`,style:{...Me,...w},onClick:xe,onKeyDown:he,children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog",style:Oe,role:"dialog","aria-modal":"false","aria-labelledby":"find-replace-dialog-title",children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-header",style:Le,children:[jsxRuntime.jsx("h2",{id:"find-replace-dialog-title",style:ke,children:E?"Find and Replace":"Find"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-close",style:Ne,onClick:n,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-body",style:we,children:[jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsxRuntime.jsx("label",{htmlFor:"find-text",style:Z,children:"Find:"}),jsxRuntime.jsx("input",{ref:P,id:"find-text",type:"text",className:"docx-find-replace-dialog-input",style:ie?ee:Y,value:x,onChange:le,onKeyDown:de,onFocus:()=>K(true),onBlur:()=>{K(false),x.trim()&&!l&&S();},placeholder:"Enter text to find...","aria-label":"Find text"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:V,disabled:!T,"aria-label":"Find previous",title:"Find Previous (Shift+Enter)",children:jsxRuntime.jsx(Ae,{})}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-nav",style:T?U:ne,onClick:G,disabled:!T,"aria-label":"Find next",title:"Find Next (Enter)",children:jsxRuntime.jsx(We,{})})]})]}),T&&jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-status",style:re,children:[l.currentIndex+1," of ",l.totalCount," matches"]}),ge&&jsxRuntime.jsx("div",{className:"docx-find-replace-dialog-status",style:De,children:"No results found"}),E&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-row",style:Q,children:[jsxRuntime.jsx("label",{htmlFor:"replace-text",style:Z,children:"Replace:"}),jsxRuntime.jsx("input",{ref:$,id:"replace-text",type:"text",className:"docx-find-replace-dialog-input",style:se?ee:Y,value:o,onChange:a=>r(a.target.value),onKeyDown:pe,onFocus:()=>z(true),onBlur:()=>z(false),placeholder:"Enter replacement text...","aria-label":"Replace text"}),jsxRuntime.jsxs("div",{style:Pe,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:j,disabled:!T,title:"Replace current match",children:"Replace"}),jsxRuntime.jsx("button",{type:"button",className:"docx-find-replace-dialog-button",style:T?B:te,onClick:ue,disabled:!T,title:"Replace all matches",children:"Replace All"})]})]})}),jsxRuntime.jsxs("div",{className:"docx-find-replace-dialog-options",style:_e,children:[jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsxRuntime.jsx("input",{type:"checkbox",style:oe,checked:C,onChange:a=>ae(a.target.checked)}),"Match case"]}),jsxRuntime.jsxs("label",{className:"docx-find-replace-dialog-option",style:W,children:[jsxRuntime.jsx("input",{type:"checkbox",style:oe,checked:F,onChange:a=>ce(a.target.checked)}),"Whole words"]}),!E&&jsxRuntime.jsx("button",{type:"button",style:{...W,background:"none",border:"none",cursor:"pointer",color:"var(--doc-link)",padding:0},onClick:fe,children:"+ Replace"})]})]})]})})}var je=Ye;exports.a=_;exports.b=H;exports.c=X;exports.d=D;exports.e=me;exports.f=be;exports.g=Se;exports.h=ye;exports.i=Ce;exports.j=Re;exports.k=q;exports.l=Ie;exports.m=Ee;exports.n=Ye;exports.o=je;
|