@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.
Files changed (99) hide show
  1. package/dist/DocumentAgent-Ci6_T-XM.d.ts +412 -0
  2. package/dist/DocumentAgent-DEGFgYEN.d.cts +412 -0
  3. package/dist/FindReplaceDialog-BAACAU67.cjs +1 -0
  4. package/dist/FindReplaceDialog-RWYDRWHF.js +1 -0
  5. package/dist/FootnotePropertiesDialog-BC6JIPDA.cjs +1 -0
  6. package/dist/FootnotePropertiesDialog-CWQF5EBK.js +1 -0
  7. package/dist/HyperlinkDialog-EG2BSLPD.cjs +1 -0
  8. package/dist/HyperlinkDialog-YAVK64F4.js +1 -0
  9. package/dist/ImagePositionDialog-IGYS5KMK.cjs +1 -0
  10. package/dist/ImagePositionDialog-S6SMH7XH.js +1 -0
  11. package/dist/ImagePropertiesDialog-UO5QUIBS.js +1 -0
  12. package/dist/ImagePropertiesDialog-VGV4E4SN.cjs +1 -0
  13. package/dist/TablePropertiesDialog-VBOU4DID.js +1 -0
  14. package/dist/TablePropertiesDialog-WRM47JI6.cjs +1 -0
  15. package/dist/{types-BALm1KBi.d.cts → agentApi-CbVUCZRu.d.cts} +1 -308
  16. package/dist/{types-BALm1KBi.d.ts → agentApi-CbVUCZRu.d.ts} +1 -308
  17. package/dist/chunk-2ASOEN3V.js +1 -0
  18. package/dist/chunk-6MBDPZVD.js +111 -0
  19. package/dist/chunk-6YLNNCRZ.cjs +10 -0
  20. package/dist/chunk-BVQ2QRHA.cjs +4 -0
  21. package/dist/chunk-COP5BIBZ.js +10 -0
  22. package/dist/chunk-CZ7W7MCM.cjs +2 -0
  23. package/dist/chunk-E6XDMUAM.js +4 -0
  24. package/dist/chunk-EMKABJPH.js +1 -0
  25. package/dist/{chunk-TRAQI6RX.cjs → chunk-EPCZ24TY.cjs} +5 -5
  26. package/dist/chunk-ESI4BSBF.js +1 -0
  27. package/dist/chunk-FLECKDK4.cjs +58 -0
  28. package/dist/chunk-ITWEFKGQ.cjs +1 -0
  29. package/dist/chunk-KESNGXGO.js +1 -0
  30. package/dist/chunk-KVAT5SVD.js +2 -0
  31. package/dist/chunk-L34XFLQZ.cjs +1 -0
  32. package/dist/chunk-M7F2CUUD.js +2 -0
  33. package/dist/chunk-MDPDH7KS.js +58 -0
  34. package/dist/chunk-MTX3EEBJ.js +258 -0
  35. package/dist/chunk-NT2REEAA.cjs +1 -0
  36. package/dist/{chunk-PM4Y7OFN.js → chunk-OTG4NABM.js} +5 -5
  37. package/dist/chunk-OW5H5DNE.cjs +1 -0
  38. package/dist/chunk-PJVI53AH.js +2 -0
  39. package/dist/chunk-PNMZPPPI.cjs +2 -0
  40. package/dist/chunk-SF53KLDZ.cjs +1 -0
  41. package/dist/chunk-TOI5W3HK.js +8 -0
  42. package/dist/chunk-UAVOWAIF.cjs +8 -0
  43. package/dist/chunk-VN7XH644.cjs +258 -0
  44. package/dist/chunk-W4DUKACP.cjs +111 -0
  45. package/dist/chunk-XS2AQFMF.cjs +2 -0
  46. package/dist/chunk-ZDYHAYN6.js +1 -0
  47. package/dist/clipboard-BOocwmAM.d.ts +539 -0
  48. package/dist/clipboard-Cx7cb3kX.d.cts +539 -0
  49. package/dist/{colorResolver-BNj-uZ58.d.ts → colorResolver-CIDiSPWd.d.cts} +3 -411
  50. package/dist/{colorResolver-DiMquGWR.d.cts → colorResolver-KXbUgzWC.d.ts} +3 -411
  51. package/dist/core-plugins.cjs +1 -1
  52. package/dist/core-plugins.d.cts +4 -3
  53. package/dist/core-plugins.d.ts +4 -3
  54. package/dist/core-plugins.js +1 -1
  55. package/dist/core.cjs +1 -0
  56. package/dist/core.d.cts +23 -0
  57. package/dist/core.d.ts +23 -0
  58. package/dist/core.js +1 -0
  59. package/dist/headless.cjs +2 -2
  60. package/dist/headless.d.cts +8 -175
  61. package/dist/headless.d.ts +8 -175
  62. package/dist/headless.js +1 -1
  63. package/dist/index.cjs +9 -378
  64. package/dist/index.d.cts +17 -4161
  65. package/dist/index.d.ts +17 -4161
  66. package/dist/index.js +9 -378
  67. package/dist/insertOperations-CzB5b-Of.d.ts +176 -0
  68. package/dist/insertOperations-DKVmCV32.d.cts +176 -0
  69. package/dist/mcp-cli.js +21 -21
  70. package/dist/mcp.cjs +10 -10
  71. package/dist/mcp.d.cts +2 -1
  72. package/dist/mcp.d.ts +2 -1
  73. package/dist/mcp.js +9 -9
  74. package/dist/processTemplate-BHBTDAIC.js +1 -0
  75. package/dist/processTemplate-QOEAXCKA.cjs +1 -0
  76. package/dist/react-Be1YOl4z.d.ts +1356 -0
  77. package/dist/react-DPuSVbgY.d.cts +1356 -0
  78. package/dist/react.cjs +1 -0
  79. package/dist/react.css +1 -0
  80. package/dist/react.d.cts +9 -0
  81. package/dist/react.d.ts +9 -0
  82. package/dist/react.js +1 -0
  83. package/dist/{registry-CzqAPdui.d.ts → registry-D4tvj9f3.d.ts} +1 -1
  84. package/dist/{registry-BUTMLqSj.d.cts → registry-ngv6Bumt.d.cts} +1 -1
  85. package/dist/types-D96elyJF.d.cts +310 -0
  86. package/dist/types-xMzSPT4i.d.ts +310 -0
  87. package/dist/ui.cjs +1 -0
  88. package/dist/ui.d.cts +2103 -0
  89. package/dist/ui.d.ts +2103 -0
  90. package/dist/ui.js +1 -0
  91. package/dist/variableDetector-CPxKo9jP.d.cts +173 -0
  92. package/dist/variableDetector-DeM1N-_L.d.ts +173 -0
  93. package/package.json +85 -10
  94. package/dist/chunk-GQ4JYQWC.js +0 -58
  95. package/dist/chunk-H3JNHCD7.cjs +0 -10
  96. package/dist/chunk-L2UUZRZI.js +0 -10
  97. package/dist/chunk-QOIY4Y6N.cjs +0 -9
  98. package/dist/chunk-QYKJKSKZ.cjs +0 -58
  99. package/dist/chunk-TPUJJJWA.js +0 -9
@@ -0,0 +1,111 @@
1
+ 'use strict';var chunkL34XFLQZ_cjs=require('./chunk-L34XFLQZ.cjs'),chunkBVQ2QRHA_cjs=require('./chunk-BVQ2QRHA.cjs'),qo=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var qo__default=/*#__PURE__*/_interopDefault(qo);var Xt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Jt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Qt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),qt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),eo=()=>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:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),to=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),oo=()=>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 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ro=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),no=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),io=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function ao(e){switch(e){case "askAI":return jsxRuntime.jsx(Xt,{});case "rewrite":return jsxRuntime.jsx(Jt,{});case "expand":return jsxRuntime.jsx(Qt,{});case "summarize":return jsxRuntime.jsx(qt,{});case "translate":return jsxRuntime.jsx(eo,{});case "explain":return jsxRuntime.jsx(to,{});case "fixGrammar":return jsxRuntime.jsx(oo,{});case "makeFormal":return jsxRuntime.jsx(ro,{});case "makeCasual":return jsxRuntime.jsx(no,{});case "custom":return jsxRuntime.jsx(io,{});default:return null}}var so=({action:e,onClick:t,isHighlighted:o,onMouseEnter:r})=>{let n=chunkL34XFLQZ_cjs.e(e),i=chunkL34XFLQZ_cjs.f(e),a=ao(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:r,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:n})]})},lo=({isOpen:e,onSubmit:t,onClose:o,selectedText:r})=>{let[n,i]=qo.useState(""),a=qo.useRef(null);qo.useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let c=s=>{s.preventDefault(),n.trim()&&(t(n.trim()),i(""));},d=s=>{s.key==="Escape"&&o();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:c,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',r.slice(0,50),r.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:a,type:"text",value:n,onChange:s=>i(s.target.value),onKeyDown:d,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",disabled:!n.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:n.trim()?"var(--doc-primary)":"var(--doc-border)",color:n.trim()?"white":"var(--doc-text-placeholder)",cursor:n.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},In=({isOpen:e,position:t,selectedText:o,selectionContext:r,onAction:n,onClose:i,actions:a=chunkL34XFLQZ_cjs.g,showCustomPrompt:c=true,className:d=""})=>{let s=qo.useRef(null),[x,m]=qo.useState(0),[p,g]=qo.useState(false),b=c?[...a,"custom"]:a;qo.useEffect(()=>{if(!e)return;let l=h=>{s.current&&!s.current.contains(h.target)&&i();};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[e,i]),qo.useEffect(()=>{if(!e)return;let l=h=>{switch(h.key){case "Escape":p?g(false):i();break;case "ArrowDown":h.preventDefault(),m(P=>(P+1)%b.length);break;case "ArrowUp":h.preventDefault(),m(P=>(P-1+b.length)%b.length);break;case "Enter":h.preventDefault();let C=b[x];C==="custom"?g(true):(n(C),i());break}};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,x,b,n,i,p]),qo.useEffect(()=>{e&&(m(0),g(false));},[e]);let v=qo.useCallback(()=>{let h=b.length*36+16,C=t.x,P=t.y;return typeof window<"u"&&(C+200>window.innerWidth&&(C=window.innerWidth-200-10),P+h>window.innerHeight&&(P=window.innerHeight-h-10),C<10&&(C=10),P<10&&(P=10)),{position:"fixed",top:P,left:C,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,b.length]),u=l=>{l==="custom"?g(true):(n(l),i());},f=l=>{n("custom",l),i();};return !e||!o?null:jsxRuntime.jsxs("div",{ref:s,className:`docx-context-menu ${d}`,style:v(),role:"menu","aria-label":"AI actions menu",children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:b.map((l,h)=>jsxRuntime.jsx(so,{action:l,onClick:()=>u(l),isHighlighted:h===x,onMouseEnter:()=>m(h)},l))}),c&&jsxRuntime.jsx(lo,{isOpen:p,onSubmit:f,onClose:()=>g(false),selectedText:o})]})};function Rn(){let[e,t]=qo.useState(false),[o,r]=qo.useState({x:0,y:0}),[n,i]=qo.useState(""),[a,c]=qo.useState(),d=qo.useCallback((x,m,p)=>{x.preventDefault(),r({x:x.clientX,y:x.clientY}),i(m),c(p),t(true);},[]),s=qo.useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:n,selectionContext:a,openMenu:d,closeMenu:s}}function Pn(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function Ln(e,t,o){return !(!t||t.trim().length===0)}function Dn(){return [...chunkL34XFLQZ_cjs.g]}function Mn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var co=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),ct=()=>jsxRuntime.jsx("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 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),po=()=>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:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),uo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),go=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
2
+ @keyframes spin {
3
+ from { transform: rotate(0deg); }
4
+ to { transform: rotate(360deg); }
5
+ }
6
+ `})]});function mo(e,t){let o=[],r=e.split(/(\s+)/),n=t.split(/(\s+)/),i=0,a=0;for(;i<r.length||a<n.length;){if(i>=r.length){o.push({type:"added",text:n.slice(a).join("")});break}if(a>=n.length){o.push({type:"removed",text:r.slice(i).join("")});break}if(r[i]===n[a])o.push({type:"same",text:r[i]}),i++,a++;else {let d=n.indexOf(r[i],a),s=r.indexOf(n[a],i);d===-1&&s===-1?(o.push({type:"removed",text:r[i]}),o.push({type:"added",text:n[a]}),i++,a++):s!==-1&&(d===-1||s-i<=d-a)?(o.push({type:"added",text:n[a]}),a++):(o.push({type:"removed",text:r[i]}),i++);}}let c=[];for(let d of o)c.length>0&&c[c.length-1].type===d.type?c[c.length-1].text+=d.text:c.push(d);return c}var xo=({original:e,modified:t})=>{let o=mo(e,t);return jsxRuntime.jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:o.map((r,n)=>{let i={};switch(r.type){case "removed":i={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":i={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsxRuntime.jsx("span",{style:i,children:r.text},n)})})},Fn=({originalText:e,response:t,action:o,isLoading:r,error:n,onAccept:i,onReject:a,onRetry:c,allowEdit:d=true,showDiff:s=true,className:x="",position:m})=>{let[p,g]=qo.useState(false),[b,v]=qo.useState(""),u=qo.useRef(null),f=qo.useRef(null),l=t?.newText||"";qo.useEffect(()=>{l&&v(l);},[l]),qo.useEffect(()=>{p&&u.current&&(u.current.focus(),u.current.select());},[p]),qo.useEffect(()=>{let R=D=>{D.key==="Escape"?p?(g(false),v(l)):a():D.key==="Enter"&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),h());};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[p,l,a]);let h=qo.useCallback(()=>{i(p?b:l);},[p,b,l,i]),C=qo.useCallback(()=>{g(true);},[]),P=qo.useCallback(()=>{g(false),v(l);},[l]),H={position:m?"fixed":"relative",...m&&{left:m.x,top:m.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return r?jsxRuntime.jsx("div",{ref:f,className:`docx-response-preview docx-response-preview-loading ${x}`,style:H,children:jsxRuntime.jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsxRuntime.jsx(go,{}),jsxRuntime.jsxs("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[chunkL34XFLQZ_cjs.e(o),"..."]})]})}):n?jsxRuntime.jsx("div",{ref:f,className:`docx-response-preview docx-response-preview-error ${x}`,style:H,children:jsxRuntime.jsxs("div",{style:{padding:"16px"},children:[jsxRuntime.jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:n}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[c&&jsxRuntime.jsxs("button",{type:"button",onClick:c,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsxRuntime.jsx(po,{}),"Retry"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:"Close"})]})]})}):!t||!l?null:jsxRuntime.jsxs("div",{ref:f,className:`docx-response-preview ${x}`,style:H,children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:[chunkL34XFLQZ_cjs.e(o)," Result"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:"Close (Esc)",children:jsxRuntime.jsx(ct,{})})]}),jsxRuntime.jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[p?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Edit the result before accepting:"}),jsxRuntime.jsx("textarea",{ref:u,value:b,onChange:R=>v(R.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):s?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Changes:"}),jsxRuntime.jsx(xo,{original:e,modified:l})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Original:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e}),jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"New:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:l})]}),t.warnings&&t.warnings.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((R,D)=>jsxRuntime.jsx("div",{children:R},D))})]}),jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[d&&!p&&jsxRuntime.jsxs("button",{type:"button",onClick:C,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(uo,{}),"Edit"]}),p&&jsxRuntime.jsx("button",{type:"button",onClick:P,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Cancel Edit"})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsxs("button",{type:"button",onClick:a,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(ct,{}),"Reject"]}),jsxRuntime.jsxs("button",{type:"button",onClick:h,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsxRuntime.jsx(co,{}),"Accept"]})]})]})]})};function zn(){let[e,t]=qo.useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),o=qo.useCallback((a,c,d)=>{t({isVisible:true,originalText:a,response:null,action:c,isLoading:true,position:d});},[]),r=qo.useCallback(a=>{t(c=>({...c,response:a,isLoading:false}));},[]),n=qo.useCallback(a=>{t(c=>({...c,error:a,isLoading:false}));},[]),i=qo.useCallback(()=>{t(a=>({...a,isVisible:false}));},[]);return {state:e,showPreview:o,setResponse:r,setError:n,hidePreview:i}}function Wn(e,t){return {success:true,newText:e,warnings:t}}function Hn(e){return {success:false,error:e}}var pt=[{action:"cut",label:"Cut",shortcut:"Ctrl+X"},{action:"copy",label:"Copy",shortcut:"Ctrl+C"},{action:"paste",label:"Paste",shortcut:"Ctrl+V"},{action:"pasteAsPlainText",label:"Paste as Plain Text",shortcut:"Ctrl+Shift+V",dividerAfter:true},{action:"delete",label:"Delete",shortcut:"Del",dividerAfter:true},{action:"selectAll",label:"Select All",shortcut:"Ctrl+A"}],bo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"4",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5.5 10.5L10.5 3M10.5 10.5L5.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),ho=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M11 5V3a1 1 0 00-1-1H4a1 1 0 00-1 1v8a1 1 0 001 1h2",stroke:"currentColor",strokeWidth:"1.5"})]}),vo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"11",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 3V2a1 1 0 011-1h2a1 1 0 011 1v1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 8h4M6 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),yo=()=>jsxRuntime.jsx("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 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Co=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),jsxRuntime.jsx("rect",{x:"4",y:"4",width:"8",height:"8",fill:"currentColor",opacity:"0.3"})]});function wo(e){switch(e){case "cut":return jsxRuntime.jsx(bo,{});case "copy":return jsxRuntime.jsx(ho,{});case "paste":case "pasteAsPlainText":return jsxRuntime.jsx(vo,{});case "delete":return jsxRuntime.jsx(yo,{});case "selectAll":return jsxRuntime.jsx(Co,{});default:return null}}var So=({item:e,onClick:t,isHighlighted:o,onMouseEnter:r})=>e.action==="separator"?jsxRuntime.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-text-context-menu-item ${o?"docx-text-context-menu-item-highlighted":""} ${e.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:t,onMouseEnter:r,disabled:e.disabled,role:"menuitem","aria-disabled":e.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:o&&!e.disabled?"var(--doc-primary-light)":"transparent",cursor:e.disabled?"not-allowed":"pointer",fontSize:"13px",color:e.disabled?"var(--doc-text-subtle)":"var(--doc-text)",textAlign:"left",opacity:e.disabled?.6:1},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:e.disabled?"var(--doc-border)":"var(--doc-text-muted)"},children:wo(e.action)}),jsxRuntime.jsx("span",{style:{flex:1},children:e.label}),e.shortcut&&jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),e.dividerAfter&&jsxRuntime.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}})]}),$n=({isOpen:e,position:t,hasSelection:o,isEditable:r,hasClipboardContent:n=true,onAction:i,onClose:a,items:c,className:d=""})=>{let s=qo.useRef(null),[x,m]=qo.useState(0),p=(c||pt).map(u=>{let f=(()=>{if(u.disabled!==void 0)return u.disabled;switch(u.action){case "cut":case "copy":case "delete":return !o;case "paste":case "pasteAsPlainText":return !r||!n;default:return false}})();return {...u,disabled:f}}),g=p.filter(u=>u.action!=="separator");qo.useEffect(()=>{if(!e)return;let u=l=>{s.current&&!s.current.contains(l.target)&&a();},f=setTimeout(()=>{document.addEventListener("mousedown",u);},0);return ()=>{clearTimeout(f),document.removeEventListener("mousedown",u);}},[e,a]),qo.useEffect(()=>{if(!e)return;let u=f=>{switch(f.key){case "Escape":f.preventDefault(),a();break;case "ArrowDown":f.preventDefault(),m(h=>{let C=(h+1)%g.length;for(;g[C]?.disabled&&C!==h;)C=(C+1)%g.length;return C});break;case "ArrowUp":f.preventDefault(),m(h=>{let C=(h-1+g.length)%g.length;for(;g[C]?.disabled&&C!==h;)C=(C-1+g.length)%g.length;return C});break;case "Enter":f.preventDefault();let l=g[x];l&&!l.disabled&&(i(l.action),a());break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,x,g,i,a]),qo.useEffect(()=>{e&&m(0);},[e]);let b=qo.useCallback(()=>{let f=p.length*36+16,l=t.x,h=t.y;return typeof window<"u"&&(l+220>window.innerWidth&&(l=window.innerWidth-220-10),h+f>window.innerHeight&&(h=window.innerHeight-f-10),l<10&&(l=10),h<10&&(h=10)),{position:"fixed",top:h,left:l,minWidth:220,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,p.length]),v=u=>{u.disabled||(i(u.action),a());};return e?jsxRuntime.jsx("div",{ref:s,className:`docx-text-context-menu ${d}`,style:b(),role:"menu","aria-label":"Text editing menu",children:p.map((u,f)=>{let l=g.findIndex(h=>h===u);return jsxRuntime.jsx(So,{item:u,onClick:()=>v(u),isHighlighted:l===x,onMouseEnter:()=>{l>=0&&!u.disabled&&m(l);}},`${u.action}-${f}`)})}):null};function Gn(e={}){let{enabled:t=true,isEditable:o=true,containerRef:r,onAction:n}=e,[i,a]=qo.useState(false),[c,d]=qo.useState({x:0,y:0}),[s,x]=qo.useState(false),m=qo.useCallback(()=>{let u=window.getSelection(),f=u&&!u.isCollapsed&&u.toString().length>0;return x(!!f),!!f},[]),p=qo.useCallback(u=>{t&&(u.preventDefault(),u.stopPropagation(),m(),d({x:u.clientX,y:u.clientY}),a(true));},[t,m]),g=qo.useCallback(()=>{a(false);},[]),b=qo.useCallback(u=>{switch(g(),u){case "cut":document.execCommand("cut");break;case "copy":document.execCommand("copy");break;case "paste":document.execCommand("paste");break;case "pasteAsPlainText":navigator.clipboard.readText?.().then(f=>{document.execCommand("insertText",false,f);}).catch(()=>{document.execCommand("paste");});break;case "delete":document.execCommand("delete");break;case "selectAll":document.execCommand("selectAll");break}n?.(u);},[g,n]),v=qo.useCallback(u=>{p(u);},[p]);return qo.useEffect(()=>{if(!i)return;let u=f=>{f.key==="Escape"&&g();};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[i,g]),{isOpen:i,position:c,hasSelection:s,openMenu:p,closeMenu:g,handleAction:b,onContextMenu:v}}function jn(e){return {cut:"Cut",copy:"Copy",paste:"Paste",pasteAsPlainText:"Paste as Plain Text",selectAll:"Select All",delete:"Delete",separator:""}[e]}function Zn(e){return {cut:"Ctrl+X",copy:"Ctrl+C",paste:"Ctrl+V",pasteAsPlainText:"Ctrl+Shift+V",selectAll:"Ctrl+A",delete:"Del",separator:""}[e]}function Xn(){return [...pt]}function Jn(e,t,o){switch(e){case "cut":case "copy":case "delete":return t;case "paste":case "pasteAsPlainText":return o;case "selectAll":return true;default:return true}}var To={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function ei({onPrint:e,disabled:t=false,label:o="Print",className:r="",style:n,showIcon:i=true,compact:a=false}){let c={display:"flex",alignItems:"center",gap:a?"4px":"6px",padding:a?"4px 8px":"6px 12px",fontSize:a?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...n};return jsxRuntime.jsxs("button",{className:`docx-print-button ${r}`.trim(),style:c,onClick:e,disabled:t,"aria-label":o,title:o,children:[i&&jsxRuntime.jsx(Eo,{size:a?14:16}),!a&&jsxRuntime.jsx("span",{children:o})]})}function ti(){return jsxRuntime.jsx("style",{children:`
7
+ @media print {
8
+ /* Hide everything except print content */
9
+ body * {
10
+ visibility: hidden;
11
+ }
12
+
13
+ .docx-print-pages,
14
+ .docx-print-pages * {
15
+ visibility: visible;
16
+ }
17
+
18
+ .docx-print-pages {
19
+ position: absolute;
20
+ left: 0;
21
+ top: 0;
22
+ }
23
+
24
+ /* Remove shadows and margins in print */
25
+ .docx-print-page {
26
+ box-shadow: none !important;
27
+ margin: 0 !important;
28
+ page-break-after: always;
29
+ page-break-inside: avoid;
30
+ }
31
+
32
+ /* Ensure images print */
33
+ img {
34
+ max-width: 100%;
35
+ page-break-inside: avoid;
36
+ }
37
+
38
+ /* Ensure tables don't break badly */
39
+ table {
40
+ page-break-inside: avoid;
41
+ }
42
+
43
+ tr {
44
+ page-break-inside: avoid;
45
+ }
46
+
47
+ /* Keep headings with content */
48
+ h1, h2, h3, h4, h5, h6 {
49
+ page-break-after: avoid;
50
+ }
51
+
52
+ /* Avoid orphan lines */
53
+ p {
54
+ orphans: 3;
55
+ widows: 3;
56
+ }
57
+ }
58
+
59
+ @page {
60
+ margin: 0;
61
+ size: auto;
62
+ }
63
+ `})}function Eo({size:e=18}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),jsxRuntime.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),jsxRuntime.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function oi(){window.print();}function ri(e="Document",t){let o=window.open("","_blank");return o?(o.document.write(`
64
+ <!DOCTYPE html>
65
+ <html>
66
+ <head>
67
+ <title>${e}</title>
68
+ <style>
69
+ @media print {
70
+ body {
71
+ margin: 0;
72
+ padding: 0;
73
+ }
74
+ @page {
75
+ margin: 0;
76
+ }
77
+ }
78
+ </style>
79
+ </head>
80
+ <body>
81
+ ${t}
82
+ </body>
83
+ </html>
84
+ `),o.document.close(),o):null}function ni(){return {...To}}function ii(e,t){if(!e||!e.trim())return null;let o=e.trim();if(/^\d+$/.test(o)){let n=parseInt(o,10);return n>=1&&n<=t?{start:n,end:n}:null}let r=o.match(/^(\d+)-(\d+)$/);if(r){let n=parseInt(r[1],10),i=parseInt(r[2],10);return n>=1&&i<=t&&n<=i?{start:n,end:i}:null}return null}function ai(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function si(){return typeof window<"u"&&typeof window.print=="function"}function fi({onAction:e,disabled:t=false,canMerge:o=false,canSplit:r=false}){let n=qo.useCallback(s=>{s.preventDefault(),s.stopPropagation();},[]),i=qo.useCallback(()=>{o&&e("mergeCells");},[e,o]),a=qo.useCallback(()=>{r&&e("splitCell");},[e,r]),c=jsxRuntime.jsx(chunkBVQ2QRHA_cjs.h,{content:"Merge cells",children:jsxRuntime.jsx(chunkBVQ2QRHA_cjs.c,{variant:"ghost",size:"icon-sm",className:chunkBVQ2QRHA_cjs.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!o)&&"opacity-30 cursor-not-allowed"),onMouseDown:n,onClick:i,disabled:t||!o,"aria-label":"Merge cells","data-testid":"toolbar-table-merge",children:jsxRuntime.jsx(chunkBVQ2QRHA_cjs.d,{name:"call_merge",size:20})})}),d=jsxRuntime.jsx(chunkBVQ2QRHA_cjs.h,{content:"Split cell",children:jsxRuntime.jsx(chunkBVQ2QRHA_cjs.c,{variant:"ghost",size:"icon-sm",className:chunkBVQ2QRHA_cjs.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!r)&&"opacity-30 cursor-not-allowed"),onMouseDown:n,onClick:a,disabled:t||!r,"aria-label":"Split cell","data-testid":"toolbar-table-split",children:jsxRuntime.jsx(chunkBVQ2QRHA_cjs.d,{name:"call_split",size:20})})});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d]})}var Lo=[{action:"addRowAbove",icon:"keyboard_arrow_up",label:"Insert row above",testId:"toolbar-table-add-row-above"},{action:"addRowBelow",icon:"keyboard_arrow_down",label:"Insert row below",testId:"toolbar-table-add-row-below"},{action:"addColumnLeft",icon:"keyboard_arrow_left",label:"Insert column left",testId:"toolbar-table-add-col-left"},{action:"addColumnRight",icon:"keyboard_arrow_right",label:"Insert column right",testId:"toolbar-table-add-col-right"}];function Ti({onAction:e,disabled:t=false}){let o=qo.useCallback(r=>{r.preventDefault(),r.stopPropagation();},[]);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Lo.map(({action:r,icon:n,label:i,testId:a})=>jsxRuntime.jsx(chunkBVQ2QRHA_cjs.h,{content:i,children:jsxRuntime.jsx(chunkBVQ2QRHA_cjs.c,{variant:"ghost",size:"icon-sm",className:chunkBVQ2QRHA_cjs.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",t&&"opacity-30 cursor-not-allowed"),onMouseDown:o,onClick:()=>!t&&e(r),disabled:t,"aria-label":i,"data-testid":a,children:jsxRuntime.jsx(chunkBVQ2QRHA_cjs.d,{name:n,size:20})})},typeof r=="string"?r:r.type))})}var N={container:{position:"relative",display:"inline-block"},button:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 8px",border:"1px solid #d0d0d0",borderRadius:"3px",backgroundColor:"#fff",cursor:"pointer",fontSize:"12px",gap:"4px",minWidth:"32px",height:"28px",transition:"background-color 0.15s, border-color 0.15s"},buttonHover:{borderColor:"#1a73e8",backgroundColor:"#f0f7ff"},buttonDisabled:{opacity:.5,cursor:"not-allowed"},colorIndicator:{width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px"},dropdown:{position:"absolute",top:"100%",left:"0",marginTop:"4px",padding:"8px",backgroundColor:"#fff",border:"1px solid #e0e0e0",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"180px"},colorGrid:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",marginBottom:"8px"},colorCell:{width:"24px",height:"24px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, box-shadow 0.1s"},colorCellHover:{transform:"scale(1.1)",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.2)"},colorCellSelected:{border:"2px solid #1a73e8"},noFillButton:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 8px",border:"none",borderRadius:"3px",backgroundColor:"transparent",cursor:"pointer",fontSize:"12px",color:"#333",transition:"background-color 0.15s"},noFillButtonHover:{backgroundColor:"#f0f0f0"},separator:{height:"1px",backgroundColor:"#e0e0e0",margin:"8px 0"},customColorRow:{display:"flex",alignItems:"center",gap:"8px"},customColorInput:{width:"40px",height:"28px",padding:"0",border:"1px solid #ccc",borderRadius:"3px",cursor:"pointer"},customColorLabel:{fontSize:"11px",color:"#666"}};function Oo(){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:"M2 12L6.5 2.5L11 7L7 11H13V13H2V12Z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),jsxRuntime.jsx("circle",{cx:"13",cy:"10",r:"2",fill:"currentColor"})]})}function _o(){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("rect",{x:"2",y:"2",width:"12",height:"12",stroke:"#ccc",strokeWidth:"1",fill:"none"}),jsxRuntime.jsx("line",{x1:"2",y1:"14",x2:"14",y2:"2",stroke:"#d32f2f",strokeWidth:"1.5"})]})}var Ae=[{hex:"#FFFFFF",name:"White"},{hex:"#F2F2F2",name:"Light Gray 1"},{hex:"#D9D9D9",name:"Light Gray 2"},{hex:"#BFBFBF",name:"Gray"},{hex:"#808080",name:"Dark Gray"},{hex:"#000000",name:"Black"},{hex:"#E6F3FF",name:"Light Blue 1"},{hex:"#CCE5FF",name:"Light Blue 2"},{hex:"#99CCFF",name:"Light Blue 3"},{hex:"#4DA6FF",name:"Blue"},{hex:"#0066CC",name:"Dark Blue"},{hex:"#003366",name:"Navy"},{hex:"#E6FFE6",name:"Light Green 1"},{hex:"#CCFFCC",name:"Light Green 2"},{hex:"#99FF99",name:"Light Green 3"},{hex:"#33CC33",name:"Green"},{hex:"#009900",name:"Dark Green"},{hex:"#006600",name:"Forest"},{hex:"#FFFFCC",name:"Light Yellow"},{hex:"#FFFF99",name:"Yellow"},{hex:"#FFE066",name:"Gold"},{hex:"#FFCC00",name:"Orange Yellow"},{hex:"#FF9900",name:"Orange"},{hex:"#CC6600",name:"Dark Orange"},{hex:"#FFE6E6",name:"Light Pink"},{hex:"#FFCCCC",name:"Pink"},{hex:"#FF9999",name:"Light Red"},{hex:"#FF6666",name:"Red"},{hex:"#CC0000",name:"Dark Red"},{hex:"#660000",name:"Maroon"},{hex:"#F2E6FF",name:"Light Purple 1"},{hex:"#E6CCFF",name:"Light Purple 2"},{hex:"#CC99FF",name:"Light Purple 3"},{hex:"#9933FF",name:"Purple"},{hex:"#6600CC",name:"Dark Purple"},{hex:"#330066",name:"Indigo"}];function Li({value:e,onChange:t,colors:o=Ae,disabled:r=false,className:n,style:i,showNoFill:a=true,showCustomColor:c=true,compact:d=false}){let[s,x]=qo.useState(false),[m,p]=qo.useState(false),[g,b]=qo.useState(null),[v,u]=qo.useState(false),f=qo.useRef(null);qo.useEffect(()=>{let T=y=>{f.current&&!f.current.contains(y.target)&&x(false);};return s&&document.addEventListener("mousedown",T),()=>{document.removeEventListener("mousedown",T);}},[s]);let l=qo.useCallback(()=>{r||x(T=>!T);},[r]),h=qo.useCallback(T=>{t?.(T),x(false);},[t]),C=qo.useCallback(()=>{t?.(null),x(false);},[t]),P=qo.useCallback(T=>{t?.(T.target.value);},[t]),H={...N.button,...m&&!r?N.buttonHover:{},...r?N.buttonDisabled:{},...d?{padding:"2px 4px",minWidth:"28px",height:"24px"}:{}},R={...N.colorIndicator,backgroundColor:e||"transparent",...e===null?{background:"repeating-linear-gradient(45deg, #fff, #fff 2px, #f0f0f0 2px, #f0f0f0 4px)"}:{}},D=["docx-cell-background-picker"];return n&&D.push(n),d&&D.push("docx-cell-background-picker-compact"),jsxRuntime.jsxs("div",{ref:f,className:D.join(" "),style:{...N.container,...i},children:[jsxRuntime.jsxs("button",{type:"button",style:H,onClick:l,onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),disabled:r,title:"Cell Background Color","aria-label":"Cell Background Color","aria-haspopup":"true","aria-expanded":s,children:[jsxRuntime.jsx(Oo,{}),jsxRuntime.jsx("div",{style:R})]}),s&&jsxRuntime.jsxs("div",{style:N.dropdown,children:[a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:{...N.noFillButton,...v?N.noFillButtonHover:{}},onClick:C,onMouseEnter:()=>u(true),onMouseLeave:()=>u(false),children:[jsxRuntime.jsx(_o,{}),jsxRuntime.jsx("span",{children:"No Fill"})]}),jsxRuntime.jsx("div",{style:N.separator})]}),jsxRuntime.jsx("div",{style:N.colorGrid,children:o.map(T=>jsxRuntime.jsx("button",{type:"button",style:{...N.colorCell,backgroundColor:T.hex,...g===T.hex?N.colorCellHover:{},...e===T.hex?N.colorCellSelected:{}},onClick:()=>h(T.hex),onMouseEnter:()=>b(T.hex),onMouseLeave:()=>b(null),title:T.name,"aria-label":T.name},T.hex))}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:N.separator}),jsxRuntime.jsxs("div",{style:N.customColorRow,children:[jsxRuntime.jsx("input",{type:"color",value:e||"#FFFFFF",onChange:P,style:N.customColorInput,title:"Custom Color"}),jsxRuntime.jsx("span",{style:N.customColorLabel,children:"Custom color"})]})]})]})]})}function Di(){return Ae}function Mi(e,t){return {hex:e.toUpperCase(),name:t||e}}function Ai(e){return Ae.some(t=>t.hex.toUpperCase()===e.toUpperCase())}function Oi(e){return Ae.find(o=>o.hex.toUpperCase()===e.toUpperCase())?.name||e}function _i(e){if(e)return {fill:{rgb:e.replace("#","")},pattern:"clear"}}function Ni(e){return !e||!e.fill?null:e.fill.rgb?`#${e.fill.rgb}`:null}function No(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function Bi(e){let t=No(e);return t?(.299*t.r+.587*t.g+.114*t.b)/255>.5?"#000000":"#FFFFFF":"#000000"}var Bo="var(--doc-error)",Fo="var(--doc-success)",zo="You have unsaved changes. Are you sure you want to leave?",Wo=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ho=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),Uo=`
85
+ @keyframes docx-unsaved-pulse {
86
+ 0%, 100% { opacity: 1; }
87
+ 50% { opacity: 0.6; }
88
+ }
89
+ `,Yo=(e,t,o,r,n,i,a)=>{let c={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:o&&r?"docx-unsaved-pulse 2s ease-in-out infinite":"none"};switch(t==="absolute-top-right"?(c.position="absolute",c.top="4px",c.right="4px"):t==="absolute-top-left"&&(c.position="absolute",c.top="4px",c.left="4px"),e){case "dot":return {...c,width:`${a}px`,height:`${a}px`,borderRadius:"50%",backgroundColor:o?n:i};case "badge":return {...c,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:o?n:i,color:"white"};case "text":return {...c,fontSize:"12px",color:o?n:i,fontWeight:500};case "icon":return {...c,color:o?n:i};default:return c}},Ui=({hasUnsavedChanges:e,variant:t="dot",position:o="inline",showPulse:r=true,label:n="Unsaved",savedLabel:i="Saved",showWhenSaved:a=false,unsavedColor:c=Bo,savedColor:d=Fo,size:s=8,className:x="",style:m,onClick:p,title:g})=>{if(qo.useEffect(()=>{if(!r||!e)return;let l="docx-unsaved-pulse-keyframes";if(!document.getElementById(l)){let h=document.createElement("style");h.id=l,h.textContent=Uo,document.head.appendChild(h);}},[r,e]),!e&&!a)return null;let v={...Yo(t,o,e,r,c,d,s),...m,cursor:p?"pointer":void 0},u=e?"Document has unsaved changes":"All changes saved",f=()=>{switch(t){case "dot":return null;case "badge":return e?n:i;case "text":return e?n:i;case "icon":return e?jsxRuntime.jsx(Ho,{size:s}):jsxRuntime.jsx(Wo,{size:s});default:return null}};return jsxRuntime.jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${x}`,style:v,onClick:p,title:g??u,role:p?"button":"status","aria-label":e?"Unsaved changes":"All changes saved",children:f()})};function Yi(e={}){let{document:t,warnBeforeLeave:o=true,warningMessage:r=zo,enabled:n=true,onChangeStatusChange:i}=e,[a,c]=qo.useState(false),[d,s]=qo.useState(0),[x,m]=qo.useState(null),p=qo.useRef(null),g=qo.useRef(false),b=qo.useCallback(l=>{if(!l)return null;try{return JSON.stringify(l.package)}catch{return null}},[]),v=qo.useCallback(()=>{n&&(c(false),s(0),m(t??null),p.current=b(t));},[n,t,b]),u=qo.useCallback(()=>{n&&(a||(c(true),i?.(true)),s(l=>l+1));},[n,a,i]),f=qo.useCallback(l=>{let h=l!==void 0?l:t;c(false),s(0),m(h??null),p.current=b(h),g.current=true;},[t,b]);return qo.useEffect(()=>{!n||!t||g.current||f(t);},[n,t,f]),qo.useEffect(()=>{if(!n||!t||!g.current)return;let l=b(t),h=p.current;if(l!==h){let C=b(x);l!==C?(a||(c(true),i?.(true)),s(P=>P+1)):a&&(c(false),i?.(false)),p.current=l;}},[n,t,x,a,b,i]),qo.useEffect(()=>{if(!n||!o||!a)return;let l=h=>(h.preventDefault(),h.returnValue=r,r);return window.addEventListener("beforeunload",l),()=>window.removeEventListener("beforeunload",l)},[n,o,a,r]),{hasUnsavedChanges:a,markAsSaved:v,markAsChanged:u,resetTracking:f,lastSavedDocument:x,changeCount:d}}function Ki(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function Vi(){return ["dot","badge","text","icon"]}function $i(){return ["inline","absolute-top-right","absolute-top-left"]}function Gi(){let e=0,t=null,o=false;return {markChanged:()=>{e++,o=true;},markSaved:()=>{o=false,t=new Date;},getState:()=>({changeCount:e,lastSaveTime:t,hasUnsavedChanges:o}),reset:()=>{e=0,t=null,o=false;}}}var Ko={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},Vo="var(--doc-primary)",$o=300,Go=`
90
+ @keyframes docx-loading-spin {
91
+ 0% { transform: rotate(0deg); }
92
+ 100% { transform: rotate(360deg); }
93
+ }
94
+
95
+ @keyframes docx-loading-pulse {
96
+ 0%, 100% { opacity: 1; transform: scale(1); }
97
+ 50% { opacity: 0.5; transform: scale(0.95); }
98
+ }
99
+
100
+ @keyframes docx-loading-dots {
101
+ 0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
102
+ 40% { transform: scale(1); opacity: 1; }
103
+ }
104
+
105
+ @keyframes docx-loading-bar {
106
+ 0% { left: -35%; right: 100%; }
107
+ 60% { left: 100%; right: -90%; }
108
+ 100% { left: 100%; right: -90%; }
109
+ }
110
+ `,jo=({size:e,strokeWidth:t,color:o})=>{let r=(e-t)/2,n=r*2*Math.PI;return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${n*.75} ${n}`,opacity:.25}),jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${n*.25} ${n}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},Zo=({size:e,color:t})=>{let o=e/4,r=o/2;return jsxRuntime.jsx("div",{style:{display:"flex",gap:`${r}px`},children:[0,1,2].map(n=>jsxRuntime.jsx("div",{style:{width:o,height:o,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${n*.16}s infinite both`}},n))})},Xo=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),Jo=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),Qo=({size:e,color:t,progress:o,showText:r,fontSize:n})=>{let i=Math.max(0,Math.min(100,o));return jsxRuntime.jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${i}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),r&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n,fontWeight:500,color:i>50?"#fff":t},children:[Math.round(i),"%"]})]})},Qi=({isLoading:e,variant:t="spinner",size:o="medium",message:r,overlay:n=false,overlayOpacity:i=.5,progress:a=0,showProgressText:c=true,color:d=Vo,className:s="",style:x})=>{let m=Ko[o];if(qo.useEffect(()=>{let b="docx-loading-keyframes";if(!document.getElementById(b)){let v=document.createElement("style");v.id=b,v.textContent=Go,document.head.appendChild(v);}},[]),!e)return null;let p=()=>{switch(t){case "spinner":return jsxRuntime.jsx(jo,{size:m.size,strokeWidth:m.strokeWidth,color:d});case "dots":return jsxRuntime.jsx(Zo,{size:m.size,color:d});case "bar":return jsxRuntime.jsx(Xo,{size:m.size,color:d});case "pulse":return jsxRuntime.jsx(Jo,{size:m.size,color:d});case "progress":return jsxRuntime.jsx(Qo,{size:m.size,color:d,progress:a,showText:c,fontSize:m.fontSize});default:return null}},g=jsxRuntime.jsxs("div",{className:`docx-loading-content ${s}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...x},children:[p(),r&&jsxRuntime.jsx("div",{style:{fontSize:m.fontSize,color:n?"white":"var(--doc-text-muted)",textAlign:"center"},children:r})]});return n?jsxRuntime.jsx("div",{className:`docx-loading-overlay ${s}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${i})`,zIndex:1e4,...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":r||"Loading",children:g}):jsxRuntime.jsx("div",{className:`docx-loading-inline ${s}`,style:{display:"inline-flex",alignItems:"center",...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":r||"Loading",children:g})};function qi(e={}){let{initialLoading:t=false,minDuration:o=$o,onStart:r,onEnd:n}=e,[i,a]=qo.useState(t),[c,d]=qo.useState(null),[s,x]=qo.useState(0),m=qo.useRef(null),p=qo.useRef(null),g=qo.useCallback(u=>{m.current=Date.now(),a(true),d(u||null),x(0),r?.();},[r]),b=qo.useCallback(()=>{let u=m.current,f=Date.now(),l=u?f-u:0,h=Math.max(0,o-l);h>0?p.current=setTimeout(()=>{a(false),d(null),x(0),m.current=null,n?.();},h):(a(false),d(null),x(0),m.current=null,n?.());},[o,n]),v=qo.useCallback(async(u,f)=>{g(f);try{let l=await u();return b(),l}catch(l){throw b(),l}},[g,b]);return qo.useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]),{isLoading:i,message:c,progress:s,startLoading:g,stopLoading:b,setProgress:x,setMessage:d,withLoading:v}}function ea(){let[e,t]=qo.useState(new Map),o=qo.useCallback((c,d)=>{t(s=>{let x=new Map(s);return x.set(c,{id:c,message:d,startTime:Date.now()}),x});},[]),r=qo.useCallback((c,d)=>{t(s=>{let x=s.get(c);if(!x)return s;let m=new Map(s);return m.set(c,{...x,...d}),m});},[]),n=qo.useCallback(c=>{t(d=>{let s=new Map(d);return s.delete(c),s});},[]),i=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:i,startOperation:o,updateOperation:r,endOperation:n,getOperation:c=>e.get(c)}}function ta(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function oa(){return ["spinner","dots","bar","pulse","progress"]}function ra(){return ["small","medium","large"]}function na(e){return new Promise(t=>setTimeout(t,e))}var vt=4,yt=36,or=32,rr=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function nr(e){let{containerRef:t,items:o,itemGap:r=vt,overflowButtonWidth:n=yt}=e,[i,a]=qo.useState(o.length),c=qo.useRef(new Map),d=qo.useCallback(()=>{let m=t.current;if(!m){a(o.length);return}let p=m.offsetWidth;if(p===0)return;let g=[...o].sort((u,f)=>u.alwaysVisible&&!f.alwaysVisible?-1:!u.alwaysVisible&&f.alwaysVisible?1:(u.priority||3)-(f.priority||3)),b=0,v=0;for(let u of g){let l=(u.minWidth||c.current.get(u.id)||or)+(v>0?r:0),h=v<o.length-1?n+r:0;if(b+l+h<=p)b+=l,v++;else if(u.alwaysVisible)b+=l,v++;else break}a(Math.max(0,v));},[t,o,r,n]);qo.useLayoutEffect(()=>{let m=t.current;if(!m)return;d();let p=new ResizeObserver(()=>{d();});return p.observe(m),()=>{p.disconnect();}},[t,d]),qo.useEffect(()=>{d();},[o,d]);let{visibleItems:s,overflowItems:x}=qo.useMemo(()=>{let m=[...o].sort((p,g)=>p.alwaysVisible&&!g.alwaysVisible?-1:!p.alwaysVisible&&g.alwaysVisible?1:(p.priority||3)-(g.priority||3));return {visibleItems:m.slice(0,i),overflowItems:m.slice(i)}},[o,i]);return {visibleItems:s,overflowItems:x,hasOverflow:x.length>0,recalculate:d}}var ir=({items:e,isOpen:t,onClose:o,anchorRef:r})=>{let n=qo.useRef(null);return qo.useEffect(()=>{if(!t)return;let i=a=>{n.current&&!n.current.contains(a.target)&&r.current&&!r.current.contains(a.target)&&o();};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,o,r]),qo.useEffect(()=>{if(!t)return;let i=a=>{a.key==="Escape"&&o();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,o]),!t||e.length===0?null:jsxRuntime.jsx("div",{ref:n,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(i=>jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:i.content},i.id))})},la=({items:e,overflowItems:t=[],alwaysShowOverflow:o=false,renderOverflowButton:r,renderOverflowMenu:n,itemGap:i=vt,padding:a="8px 12px",overflowButtonWidth:c=yt,className:d="",style:s,height:x=44,backgroundColor:m="var(--doc-toolbar-bg)",borderBottom:p="1px solid var(--doc-border)"})=>{let g=qo.useRef(null),b=qo.useRef(null),[v,u]=qo.useState(false),{visibleItems:f,overflowItems:l,hasOverflow:h}=nr({containerRef:g,items:e,itemGap:i,overflowButtonWidth:c}),C=[...l,...t],P=h||o||t.length>0,H=qo.useCallback(()=>{u(T=>!T);},[]),R=qo.useCallback(()=>{u(false);},[]),D=jsxRuntime.jsx("button",{ref:b,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:H,"aria-label":`Show ${C.length} more options`,"aria-expanded":v,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${c}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:v?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsxRuntime.jsx(rr,{})});return jsxRuntime.jsxs("div",{ref:g,className:`docx-responsive-toolbar ${d}`,style:{display:"flex",alignItems:"center",gap:`${i}px`,height:typeof x=="number"?`${x}px`:x,padding:a,backgroundColor:m,borderBottom:p,position:"relative",...s},children:[f.map(T=>jsxRuntime.jsxs(qo__default.default.Fragment,{children:[jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":T.id,style:{flexShrink:0},children:T.content}),T.separatorAfter&&jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},T.id)),P&&jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),P&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[r?r(C.length,v,H):D,n?v&&n(C,R):jsxRuntime.jsx(ir,{items:C,isOpen:v,onClose:R,anchorRef:b})]})]})},da=({children:e,gap:t=2,separatorAfter:o=false,className:r="",style:n})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:`docx-toolbar-group ${r}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...n},children:e}),o&&jsxRuntime.jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function ca(e,t,o){return {id:e,content:t,priority:3,...o}}function pa(e){return e.map(t=>({...t,priority:t.priority||3}))}function ua(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var lr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},dr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},cr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},pr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},ur={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},gr={padding:"20px"},mr={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},xr={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},Et={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},fr={...Et,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},br={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},hr={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},wt={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},St={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},kt={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},Tt={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},vr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Je={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},yr={...Je,backgroundColor:"var(--doc-primary)",color:"white"},Cr={...Je,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},wr={...Je,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Sr(){return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsxRuntime.jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function ba({isOpen:e,onClose:t,onInsert:o,maxGridRows:r=8,maxGridColumns:n=10,maxRows:i=100,maxColumns:a=20,className:c,style:d}){let[s,x]=qo.useState(0),[m,p]=qo.useState(0),[g,b]=qo.useState(3),[v,u]=qo.useState(3),f=qo.useRef(null);qo.useEffect(()=>{e&&(x(0),p(0),b(3),u(3));},[e]),qo.useEffect(()=>{e&&f.current?.focus();},[e]);let l=qo.useCallback((I,M)=>{x(I),p(M);},[]),h=qo.useCallback(()=>{s>0&&m>0&&o({rows:s,columns:m});},[s,m,o]),C=qo.useCallback(()=>{let I=Math.min(Math.max(1,g),i),M=Math.min(Math.max(1,v),a);o({rows:I,columns:M});},[g,v,i,a,o]),P=qo.useCallback(I=>{I.key==="Escape"?t():I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),C());},[t,C]),H=qo.useCallback(I=>{I.target===I.currentTarget&&t();},[t]),R=qo.useCallback(I=>{let M=parseInt(I.target.value,10);isNaN(M)?I.target.value===""&&b(1):b(Math.min(Math.max(1,M),i));},[i]),D=qo.useCallback(I=>{let M=parseInt(I.target.value,10);isNaN(M)?I.target.value===""&&u(1):u(Math.min(Math.max(1,M),a));},[a]);if(!e)return null;let T=[];for(let I=1;I<=r;I++)for(let M=1;M<=n;M++){let Ee=I<=s&&M<=m;T.push(jsxRuntime.jsx("div",{style:Ee?fr:Et,onMouseEnter:()=>l(I,M),onClick:h,role:"gridcell","aria-selected":Ee},`${I}-${M}`));}let y=g>=1&&v>=1,j=s>0&&m>0?`${m} x ${s} Table`:"Hover to select size";return jsxRuntime.jsx("div",{className:`docx-insert-table-dialog-overlay ${c||""}`,style:{...lr,...d},onClick:H,onKeyDown:P,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxRuntime.jsxs("div",{ref:f,className:"docx-insert-table-dialog",style:dr,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-header",style:cr,children:[jsxRuntime.jsx("h2",{id:"insert-table-dialog-title",style:pr,children:jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(Sr,{}),"Insert Table"]})}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:ur,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-body",style:gr,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-grid-container",style:mr,children:[jsxRuntime.jsx("div",{className:"docx-insert-table-grid",style:{...xr,gridTemplateColumns:`repeat(${n}, 1fr)`},onMouseLeave:()=>{x(0),p(0);},role:"grid","aria-label":"Table size selector",children:T}),jsxRuntime.jsx("div",{className:"docx-insert-table-grid-label",style:br,children:j})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-separator",style:hr,children:[jsxRuntime.jsx("div",{style:wt}),jsxRuntime.jsx("span",{children:"or specify size"}),jsxRuntime.jsx("div",{style:wt})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-inputs",children:[jsxRuntime.jsxs("div",{style:St,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-rows",style:kt,children:"Rows:"}),jsxRuntime.jsx("input",{id:"insert-table-rows",type:"number",min:1,max:i,value:g,onChange:R,style:Tt})]}),jsxRuntime.jsxs("div",{style:St,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-cols",style:kt,children:"Columns:"}),jsxRuntime.jsx("input",{id:"insert-table-cols",type:"number",min:1,max:a,value:v,onChange:D,style:Tt})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-footer",style:vr,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:Cr,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:y?yr:wr,onClick:C,disabled:!y,children:"Insert Table"})]})]})})}function ha(){let[e,t]=qo.useState(false),o=qo.useCallback(()=>t(true),[]),r=qo.useCallback(()=>t(false),[]),n=qo.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:r,toggle:n}}function va(e=3,t=3){return {rows:e,columns:t}}function ya(e,t=100,o=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=o}function Ca(e,t=100,o=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),o)}}function wa(e){return `${e.columns} x ${e.rows}`}function Sa(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var Tr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Er={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},Ir={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Rr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Pr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},Lr={padding:"20px"},Qe={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},Dr={...Qe,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},Mr={...Qe,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},Ar={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},Or={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},_r={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},Nr={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},Br={fontSize:"12px",color:"var(--doc-text-placeholder)"},Rt={marginBottom:"16px"},Pt={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Fr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},zr={display:"flex",alignItems:"center",gap:"12px"},Lt={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Mt={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},Wr={...Mt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},Hr={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},Ur={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},qe={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},Yr={...qe,backgroundColor:"var(--doc-primary)",color:"white"},Kr={...qe,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Vr={...qe,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function $r(){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:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function Gr({locked:e}){return e?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function Ra({isOpen:e,onClose:t,onInsert:o,maxWidth:r=800,maxHeight:n=600,accept:i="image/*",className:a,style:c}){let[d,s]=qo.useState(null),[x,m]=qo.useState(false),[p,g]=qo.useState(0),[b,v]=qo.useState(0),[u,f]=qo.useState(""),[l,h]=qo.useState(true),[C,P]=qo.useState(1),[H,R]=qo.useState(null),D=qo.useRef(null),T=qo.useRef(null);qo.useEffect(()=>{e&&(s(null),m(false),g(0),v(0),f(""),h(true),P(1),R(null));},[e]);let y=qo.useCallback(E=>{if(!E.type.startsWith("image/")){R("Please select a valid image file");return}if(E.size>10*1024*1024){R("Image file is too large (max 10MB)");return}R(null);let z=new FileReader;z.onload=$t=>{let it=$t.target?.result,ae=new Image;ae.onload=()=>{let se=ae.width,le=ae.height;if(se>r||le>n){let Gt=r/se,jt=n/le,at=Math.min(Gt,jt);se=Math.round(se*at),le=Math.round(le*at);}g(se),v(le),P(ae.width/ae.height),s({src:it,width:se,height:le,fileName:E.name,mimeType:E.type});},ae.src=it;},z.onerror=()=>{R("Failed to read image file");},z.readAsDataURL(E);},[r,n]),j=qo.useCallback(E=>{let z=E.target.files?.[0];z&&y(z);},[y]),I=qo.useCallback(()=>{D.current?.click();},[]),M=qo.useCallback(E=>{E.preventDefault(),m(true);},[]),Ee=qo.useCallback(E=>{E.preventDefault(),m(false);},[]),zt=qo.useCallback(E=>{E.preventDefault(),m(false);let z=E.dataTransfer.files?.[0];z&&y(z);},[y]),Wt=qo.useCallback(E=>{let z=parseInt(E.target.value,10)||0;g(z),l&&C&&v(Math.round(z/C));},[l,C]),Ht=qo.useCallback(E=>{let z=parseInt(E.target.value,10)||0;v(z),l&&C&&g(Math.round(z*C));},[l,C]),He=qo.useCallback(()=>{d&&o({...d,width:p,height:b,alt:u||void 0});},[d,p,b,u,o]),Ut=qo.useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&d&&!E.shiftKey&&(E.preventDefault(),He());},[t,d,He]),Yt=qo.useCallback(E=>{E.target===E.currentTarget&&t();},[t]),Kt=qo.useCallback(()=>{s(null),g(0),v(0),f(""),R(null),D.current&&(D.current.value="");},[]);if(!e)return null;let nt=d!==null&&p>0&&b>0,Vt=()=>d?Mr:x?Dr:Qe;return jsxRuntime.jsx("div",{className:`docx-insert-image-dialog-overlay ${a||""}`,style:{...Tr,...c},onClick:Yt,onKeyDown:Ut,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxRuntime.jsxs("div",{ref:T,className:"docx-insert-image-dialog",style:Er,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-header",style:Ir,children:[jsxRuntime.jsx("h2",{id:"insert-image-dialog-title",style:Rr,children:"Insert Image"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:Pr,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-body",style:Lr,children:[jsxRuntime.jsx("input",{ref:D,type:"file",accept:i,onChange:j,style:{display:"none"}}),jsxRuntime.jsx("div",{className:"docx-insert-image-dropzone",style:Vt(),onClick:I,onDragOver:M,onDragLeave:Ee,onDrop:zt,role:"button",tabIndex:0,"aria-label":"Click or drag to upload image",children:d?jsxRuntime.jsx("div",{style:Ar,children:jsxRuntime.jsx("img",{src:d.src,alt:u||"Preview",style:Or})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:_r,children:jsxRuntime.jsx($r,{})}),jsxRuntime.jsx("div",{style:Nr,children:"Click to select or drag and drop an image"}),jsxRuntime.jsx("div",{style:Br,children:"PNG, JPG, GIF up to 10MB"})]})}),d?.fileName&&jsxRuntime.jsxs("div",{style:Hr,children:[d.fileName,jsxRuntime.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Kt();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:"Change"})]}),H&&jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:H}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:Rt,children:[jsxRuntime.jsx("label",{style:Pt,children:"Dimensions"}),jsxRuntime.jsxs("div",{style:zr,children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Width:"}),jsxRuntime.jsx("input",{type:"number",value:p,onChange:Wt,min:1,max:r,style:Lt}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>h(!l),style:l?Wr:Mt,title:l?"Aspect ratio locked":"Aspect ratio unlocked",children:jsxRuntime.jsx(Gr,{locked:l})}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Height:"}),jsxRuntime.jsx("input",{type:"number",value:b,onChange:Ht,min:1,max:n,style:Lt}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"})]})]}),jsxRuntime.jsxs("div",{style:Rt,children:[jsxRuntime.jsx("label",{htmlFor:"insert-image-alt",style:Pt,children:"Alt Text (optional)"}),jsxRuntime.jsx("input",{id:"insert-image-alt",type:"text",value:u,onChange:E=>f(E.target.value),placeholder:"Describe the image for accessibility",style:Fr})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-footer",style:Ur,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:Kr,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:nt?Yr:Vr,onClick:He,disabled:!nt,children:"Insert Image"})]})]})})}function Pa(){let[e,t]=qo.useState(false),o=qo.useCallback(()=>t(true),[]),r=qo.useCallback(()=>t(false),[]),n=qo.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:r,toggle:n}}function La(e){return e.type.startsWith("image/")}function Da(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function Ma(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function Aa(e,t,o,r){if(e<=o&&t<=r)return {width:e,height:t};let n=o/e,i=r/t,a=Math.min(n,i);return {width:Math.round(e*a),height:Math.round(t*a)}}function Oa(e){let t=e.split(","),o=t[0].match(/:(.*?);/)?.[1]||"image/png",r=atob(t[1]),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([n],{type:o})}function _a(e){return new Promise((t,o)=>{let r=new Image;r.onload=()=>t({width:r.width,height:r.height}),r.onerror=()=>o(new Error("Failed to load image")),r.src=e;})}function Na(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Jr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Qr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},qr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},en={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},tn={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},on={padding:"20px",flex:1,overflow:"auto"},rn={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},nn={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},At={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},an={...At,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},sn={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},ln={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},dn={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},cn={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},pn={flex:1},un={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},et={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},gn={...et,backgroundColor:"var(--doc-primary)",color:"white"},mn={...et,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},xn={...et,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Se=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function Ot(){return Se.flatMap(e=>e.symbols)}function Ha({isOpen:e,onClose:t,onInsert:o,recentSymbols:r=[],className:n,style:i}){let[a,c]=qo.useState("common"),[d,s]=qo.useState(null),[x,m]=qo.useState(""),[p,g]=qo.useState(null),b=qo.useRef(null);qo.useEffect(()=>{e&&(s(null),m(""),g(null),setTimeout(()=>b.current?.focus(),100));},[e]);let v=qo.useMemo(()=>{if(!x.trim())return a==="recent"?r:Se.find(M=>M.name===a)?.symbols||[];let y=x.toLowerCase();return Ot().filter(I=>{let M=I.codePointAt(0)?.toString(16).toUpperCase()||"";return I.includes(y)||M.includes(y.toUpperCase())||`U+${M}`.toLowerCase().includes(y)})},[x,a,r]),u=qo.useCallback(y=>{s(y);},[]),f=qo.useCallback(y=>{o(y);},[o]),l=qo.useCallback(()=>{d&&o(d);},[d,o]),h=qo.useCallback(y=>{y.key==="Escape"?t():y.key==="Enter"&&d&&(y.preventDefault(),l());},[t,d,l]),C=qo.useCallback(y=>{y.target===y.currentTarget&&t();},[t]),P=y=>{if(!y)return null;let j=y.codePointAt(0);return {character:y,codePoint:j?`U+${j.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:j||0}};if(!e)return null;let R=P(p||d),D=d!==null,T=[...r.length>0?[{name:"recent",label:"Recent"}]:[],...Se.map(y=>({name:y.name,label:y.label}))];return jsxRuntime.jsx("div",{className:`docx-insert-symbol-dialog-overlay ${n||""}`,style:{...Jr,...i},onClick:C,onKeyDown:h,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog",style:Qr,children:[jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-header",style:qr,children:[jsxRuntime.jsx("h2",{id:"insert-symbol-dialog-title",style:en,children:"Insert Symbol"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:tn,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-body",style:on,children:[jsxRuntime.jsx("input",{ref:b,type:"text",placeholder:"Search symbols (character or Unicode)...",value:x,onChange:y=>m(y.target.value),style:rn}),!x&&jsxRuntime.jsx("div",{className:"docx-insert-symbol-categories",style:nn,children:T.map(y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>c(y.name),style:a===y.name?an:At,children:y.label},y.name))}),jsxRuntime.jsx("div",{className:"docx-insert-symbol-grid",style:sn,children:v.map((y,j)=>jsxRuntime.jsx("button",{type:"button",onClick:()=>u(y),onDoubleClick:()=>f(y),onMouseEnter:()=>g(y),onMouseLeave:()=>g(null),style:{...ln,...d===y?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${y} - U+${y.codePointAt(0)?.toString(16).toUpperCase()}`,children:y},`${y}-${j}`))}),v.length===0&&jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:['No symbols found for "',x,'"']}),R&&jsxRuntime.jsxs("div",{className:"docx-insert-symbol-preview",style:dn,children:[jsxRuntime.jsx("div",{style:cn,children:R.character}),jsxRuntime.jsxs("div",{style:pn,children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:R.codePoint}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:["Decimal: ",R.decimal]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:un,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:mn,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:D?gn:xn,onClick:l,disabled:!D,children:"Insert"})]})]})})}function Ua(e=20){let[t,o]=qo.useState(false),[r,n]=qo.useState([]),i=qo.useCallback(()=>o(true),[]),a=qo.useCallback(()=>o(false),[]),c=qo.useCallback(()=>o(s=>!s),[]),d=qo.useCallback(s=>{n(x=>{let m=x.filter(p=>p!==s);return [s,...m].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:r,open:i,close:a,toggle:c,addRecent:d}}function Ya(){return Se}function Ka(e){return Se.find(o=>o.name===e)?.symbols||[]}function Va(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function $a(e){if(!e.trim())return [];let t=e.toLowerCase();return Ot().filter(o=>{let r=o.codePointAt(0)?.toString(16).toUpperCase()||"";return o.includes(e)||r.includes(t.toUpperCase())||`U+${r}`.toLowerCase().includes(t)})}function Ga(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),o=parseInt(t,16);return isNaN(o)||o<0||o>1114111?null:String.fromCodePoint(o)}chunkBVQ2QRHA_cjs.ra();var ne=[{id:"formatted",label:"Keep Source Formatting",description:"Paste with original formatting",shortcut:"Ctrl+V"},{id:"plainText",label:"Paste as Plain Text",description:"Paste without any formatting",shortcut:"Ctrl+Shift+V"}],bn=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),hn=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function vn(e){switch(e){case "formatted":return jsxRuntime.jsx(bn,{});case "plainText":return jsxRuntime.jsx(hn,{});default:return null}}var yn=({option:e,isSelected:t,onClick:o,onMouseEnter:r})=>jsxRuntime.jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:o,onMouseEnter:r,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsxRuntime.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:vn(e.id)}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsxRuntime.jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),qa=({isOpen:e,onClose:t,onPaste:o,position:r,className:n=""})=>{let i=qo.useRef(null),[a,c]=qo.useState(0),[d,s]=qo.useState(null),[x,m]=qo.useState(false),[p,g]=qo.useState(null);qo.useEffect(()=>{if(!e){s(null),g(null),c(0);return}(async()=>{m(true),g(null);try{let f=await chunkBVQ2QRHA_cjs.ia({cleanWordFormatting:!0});s(f),f||g("No content available to paste");}catch{g("Unable to read clipboard. Please use Ctrl+V to paste.");}finally{m(false);}})();},[e]),qo.useEffect(()=>{if(!e)return;let u=f=>{i.current&&!i.current.contains(f.target)&&t();};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,t]),qo.useEffect(()=>{if(!e)return;let u=f=>{switch(f.key){case "Escape":f.preventDefault(),t();break;case "ArrowDown":f.preventDefault(),c(l=>(l+1)%ne.length);break;case "ArrowUp":f.preventDefault(),c(l=>(l-1+ne.length)%ne.length);break;case "Enter":f.preventDefault(),b(ne[a].id);break}};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,a,t]);let b=qo.useCallback(u=>{if(!d){g("No content available to paste");return}o(d,u==="plainText"),t();},[d,o,t]),v=qo.useCallback(()=>{let l=r?.x??(typeof window<"u"?window.innerWidth/2-160:100),h=r?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(l+320>window.innerWidth&&(l=window.innerWidth-320-10),h+200>window.innerHeight&&(h=window.innerHeight-200-10),l<10&&(l=10),h<10&&(h=10)),{position:"fixed",top:h,left:l,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[r]);return e?jsxRuntime.jsxs("div",{ref:i,className:`docx-paste-special-dialog ${n}`,style:v(),role:"dialog","aria-label":"Paste Special",children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:"Paste Special"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{style:{padding:"8px"},children:x?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:"Reading clipboard..."}):p?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:p}):jsxRuntime.jsx("div",{role:"menu",children:ne.map((u,f)=>jsxRuntime.jsx(yn,{option:u,isSelected:f===a,onClick:()=>b(u.id),onMouseEnter:()=>c(f)},u.id))})}),d&&!x&&!p&&jsxRuntime.jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:"Preview:"}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',d.plainText.slice(0,50),d.plainText.length>50?"...":"",'"']})]})]}):null};function es(e={}){let{onPaste:t,enabled:o=true}=e,[r,n]=qo.useState(false),i=qo.useCallback(()=>{o&&n(true);},[o]),a=qo.useCallback(()=>{n(false);},[]),c=qo.useCallback(async()=>{if(!(!o||!t))try{let s=await chunkBVQ2QRHA_cjs.ia({cleanWordFormatting:!0});s&&t(s,!0);}catch(s){console.error("Failed to paste as plain text:",s);}},[o,t]),d=qo.useCallback(s=>o&&(s.ctrlKey||s.metaKey)&&s.shiftKey&&s.key.toLowerCase()==="v"?(s.preventDefault(),i(),true):false,[o,i]);return {isOpen:r,openDialog:i,closeDialog:a,handleKeyDown:d,pasteAsPlainText:c}}function ts(e){return ne.find(t=>t.id===e)}function os(){return [...ne]}function rs(){return "formatted"}function ns(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var Bt={editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},Ft=["file","editing","clipboard","formatting","selection","navigation","view","other"],We=[{id:"save",name:"Save",description:"Save document",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",description:"Print document",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",description:"Undo last action",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",description:"Delete selected text",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",description:"Find text in document",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",description:"Find and replace text",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",description:"Cut selected text",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",description:"Copy selected text",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",description:"Paste from clipboard",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",description:"Paste without formatting",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",description:"Toggle bold formatting",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",description:"Toggle italic formatting",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",description:"Toggle underline formatting",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",description:"Toggle subscript",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",description:"Left align paragraph",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",description:"Center align paragraph",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",description:"Right align paragraph",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",description:"Justify paragraph",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",description:"Increase paragraph indent",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",description:"Decrease paragraph indent",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",description:"Select all content",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",description:"Select current word",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",description:"Select current paragraph",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",description:"Extend selection to next/previous word",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",description:"Extend selection to line start/end",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",description:"Move cursor to next/previous word",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",description:"Move cursor to start of line",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",description:"Move cursor to end of line",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",description:"Move cursor to start of document",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",description:"Move cursor to end of document",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",description:"Scroll up one page",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",description:"Scroll down one page",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",description:"Decrease zoom level",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",description:"Reset zoom to 100%",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",description:"Show this help dialog",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function Cn(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function rt(e){return Cn()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var wn=({shortcut:e})=>{let t=rt(e.keys),o=e.altKeys?rt(e.altKeys):null;return jsxRuntime.jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:e.name}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:e.description})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:t}),o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:o})]})]})]})},ds=({isOpen:e,onClose:t,customShortcuts:o=[],showSearch:r=true,className:n=""})=>{let i=qo.useRef(null),a=qo.useRef(null),[c,d]=qo.useState(""),s=qo.useMemo(()=>{let p=[...We];for(let g of o){let b=p.findIndex(v=>v.id===g.id);b>=0?p[b]=g:p.push(g);}return p},[o]),x=qo.useMemo(()=>{if(!c.trim())return s;let p=c.toLowerCase();return s.filter(g=>g.name.toLowerCase().includes(p)||g.description.toLowerCase().includes(p)||g.keys.toLowerCase().includes(p)||g.altKeys&&g.altKeys.toLowerCase().includes(p))},[s,c]),m=qo.useMemo(()=>{let p=new Map;for(let b of x){let v=p.get(b.category)||[];v.push(b),p.set(b.category,v);}let g=[];for(let b of Ft){let v=p.get(b);v&&v.length>0&&g.push({category:b,shortcuts:v});}return g},[x]);return qo.useEffect(()=>{e&&r&&a.current&&setTimeout(()=>a.current?.focus(),0);},[e,r]),qo.useEffect(()=>{e||d("");},[e]),qo.useEffect(()=>{if(!e)return;let p=g=>{i.current&&!i.current.contains(g.target)&&t();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,t]),qo.useEffect(()=>{if(!e)return;let p=g=>{g.key==="Escape"&&t();};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),e?jsxRuntime.jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxRuntime.jsxs("div",{ref:i,className:`docx-shortcuts-dialog ${n}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":"Keyboard Shortcuts",children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),r&&jsxRuntime.jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsxRuntime.jsx("input",{ref:a,type:"text",value:c,onChange:p=>d(p.target.value),placeholder:"Search shortcuts...",style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsxRuntime.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:m.length===0?jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:['No shortcuts found matching "',c,'"']}):m.map(({category:p,shortcuts:g})=>jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:Bt[p]}),jsxRuntime.jsx("div",{children:g.map(b=>jsxRuntime.jsx(wn,{shortcut:b},b.id))})]},p))}),jsxRuntime.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:["Press"," ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"})," ","to close"]})]})}):null};function cs(e={}){let{enabled:t=true,openShortcut:o="Ctrl+/"}=e,[r,n]=qo.useState(false),i=qo.useCallback(()=>{t&&n(true);},[t]),a=qo.useCallback(()=>{n(false);},[]),c=qo.useCallback(()=>{n(s=>!s);},[]),d=qo.useCallback(s=>{if(!t)return;if((s.ctrlKey||s.metaKey)&&(s.key==="/"||s.key==="?")){s.preventDefault(),c();return}if(s.key==="F1"){s.preventDefault(),i();return}},[t,c,i]);return qo.useEffect(()=>{if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,d]),{isOpen:r,open:i,close:a,toggle:c,handleKeyDown:d}}function ps(){return [...We]}function us(e){return We.filter(t=>t.category===e)}function gs(){return We.filter(e=>e.common)}function ms(e){return Bt[e]}function xs(){return [...Ft]}function fs(e){return rt(e)}
111
+ exports.$=ua;exports.A=Ae;exports.Aa=ts;exports.B=Li;exports.Ba=os;exports.C=Di;exports.Ca=rs;exports.D=Mi;exports.Da=ns;exports.E=Ai;exports.Ea=ds;exports.F=Oi;exports.Fa=cs;exports.G=_i;exports.Ga=ps;exports.H=Ni;exports.Ha=us;exports.I=Bi;exports.Ia=gs;exports.J=Ui;exports.Ja=ms;exports.K=Yi;exports.Ka=xs;exports.L=Ki;exports.La=fs;exports.M=Vi;exports.N=$i;exports.O=Gi;exports.P=Qi;exports.Q=qi;exports.R=ea;exports.S=ta;exports.T=oa;exports.U=ra;exports.V=na;exports.W=nr;exports.X=la;exports.Y=da;exports.Z=ca;exports._=pa;exports.a=In;exports.aa=ba;exports.b=Rn;exports.ba=ha;exports.c=Pn;exports.ca=va;exports.d=Ln;exports.da=ya;exports.e=Dn;exports.ea=Ca;exports.f=Mn;exports.fa=wa;exports.g=Fn;exports.ga=Sa;exports.h=zn;exports.ha=Ra;exports.i=Wn;exports.ia=Pa;exports.j=Hn;exports.ja=La;exports.k=$n;exports.ka=Da;exports.l=Gn;exports.la=Ma;exports.m=jn;exports.ma=Aa;exports.n=Zn;exports.na=Oa;exports.o=Xn;exports.oa=_a;exports.p=Jn;exports.pa=Na;exports.q=ei;exports.qa=Se;exports.r=ti;exports.ra=Ha;exports.s=oi;exports.sa=Ua;exports.t=ri;exports.ta=Ya;exports.u=ni;exports.ua=Ka;exports.v=ii;exports.va=Va;exports.w=ai;exports.wa=$a;exports.x=si;exports.xa=Ga;exports.y=fi;exports.ya=qa;exports.z=Ti;exports.za=es;
@@ -0,0 +1,2 @@
1
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var j={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},q={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"400px",maxWidth:"500px",width:"100%",margin:"20px"},J={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Q={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Z={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},ee={padding:"20px"},T={marginBottom:"16px"},v={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},g={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box",outline:"none"},te={...g,borderColor:"var(--doc-error)"},re={...g,cursor:"pointer"},oe={color:"var(--doc-error)",fontSize:"12px",marginTop:"4px"},W={color:"var(--doc-text-muted)",fontSize:"12px",marginTop:"4px"},ie={display:"flex",borderBottom:"1px solid var(--doc-border)",marginBottom:"16px"},O={padding:"10px 16px",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"var(--doc-text-muted)",borderBottom:"2px solid transparent",marginBottom:"-1px"},w={...O,color:"var(--doc-link)",borderBottomColor:"var(--doc-link)",fontWeight:500},ne={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},E={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},le={...E,backgroundColor:"var(--doc-link)",color:"white"},ae={...E,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},se={...E,backgroundColor:"var(--doc-error)",color:"white"},pe={...E,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function z(t){if(!t||t.trim()==="")return false;let e=t.trim();if(e.startsWith("mailto:")||e.startsWith("tel:"))return e.length>7;if(e.startsWith("ftp://"))return e.length>6;try{let p=e.match(/^https?:\/\//)?e:`https://${e}`,u=new URL(p);return u.protocol==="http:"||u.protocol==="https:"}catch{return false}}function F(t){if(!t)return "";let e=t.trim();return e.startsWith("mailto:")||e.startsWith("tel:")||e.startsWith("ftp://")||e.match(/^https?:\/\//)?e:`https://${e}`}function ke(t){if(!t)return "unknown";let e=t.trim().toLowerCase();return e.startsWith("mailto:")?"email":e.startsWith("tel:")?"phone":e.startsWith("ftp://")?"ftp":e.startsWith("http://")||e.startsWith("https://")?"web":e.includes("@")&&!e.includes(" ")?"email":"web"}function de({isOpen:t,onClose:e,onSubmit:p,onRemove:u,initialData:a,selectedText:f="",isEditing:n=false,bookmarks:H=[],className:G,style:M}){let[i,y]=react.useState("url"),[s,C]=react.useState(""),[L,D]=react.useState(""),[x,_]=react.useState(""),[N,R]=react.useState(""),[k,m]=react.useState(""),[B,b]=react.useState(false),P=react.useRef(null),U=react.useRef(null);react.useEffect(()=>{t&&(a?(a.bookmark?(y("bookmark"),_(a.bookmark)):(y("url"),C(a.url||"")),D(a.displayText||""),R(a.tooltip||"")):(y("url"),C(""),D(f),_(""),R("")),m(""),b(false));},[t,a,f]),react.useEffect(()=>{t&&setTimeout(()=>{i==="url"?P.current?.focus():U.current?.focus();},100);},[t,i]);let $=react.useCallback(()=>{i==="url"&&s.trim()?z(s)?m(""):m("Please enter a valid URL"):m("");},[i,s]),h=react.useCallback(r=>{if(r?.preventDefault(),i==="url"){if(!s.trim()){m("URL is required"),b(true);return}if(!z(s)){m("Please enter a valid URL"),b(true);return}}else if(i==="bookmark"&&!x)return;let S={displayText:L.trim()||void 0,tooltip:N.trim()||void 0};i==="url"?S.url=F(s):S.bookmark=x,p(S);},[i,s,x,L,N,p]),K=react.useCallback(r=>{r.key==="Escape"?e():r.key==="Enter"&&!r.shiftKey&&r.target.tagName!=="TEXTAREA"&&(r.preventDefault(),h());},[e,h]),V=react.useCallback(r=>{r.target===r.currentTarget&&e();},[e]);if(!t)return null;let X=H.length>0,Y=i==="url"&&s.trim()&&!k||i==="bookmark"&&x;return jsxRuntime.jsx("div",{className:`docx-hyperlink-dialog-overlay ${G||""}`,style:{...j,...M},onClick:V,onKeyDown:K,role:"dialog","aria-modal":"true","aria-labelledby":"hyperlink-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog",style:q,children:[jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-header",style:J,children:[jsxRuntime.jsx("h2",{id:"hyperlink-dialog-title",style:Q,children:n?"Edit Hyperlink":"Insert Hyperlink"}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-close",style:Z,onClick:e,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("form",{className:"docx-hyperlink-dialog-body",style:ee,onSubmit:h,children:[X&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-tabs",style:ie,children:[jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${i==="url"?"active":""}`,style:i==="url"?w:O,onClick:()=>y("url"),"aria-selected":i==="url",children:"Web Address"}),jsxRuntime.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${i==="bookmark"?"active":""}`,style:i==="bookmark"?w:O,onClick:()=>y("bookmark"),"aria-selected":i==="bookmark",children:"Bookmark"})]}),i==="url"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:T,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-url",style:v,children:"URL"}),jsxRuntime.jsx("input",{ref:P,id:"hyperlink-url",type:"text",className:"docx-hyperlink-dialog-input",style:k&&B?te:g,value:s,onChange:r=>{C(r.target.value),B&&m("");},onBlur:()=>{b(true),$();},placeholder:"https://example.com","aria-invalid":!!k,"aria-describedby":k?"url-error":"url-hint"}),k&&B&&jsxRuntime.jsx("div",{id:"url-error",style:oe,children:k}),!k&&jsxRuntime.jsx("div",{id:"url-hint",style:W,children:"Enter a web address, email (mailto:), or phone (tel:)"})]}),i==="bookmark"&&jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:T,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-bookmark",style:v,children:"Bookmark"}),jsxRuntime.jsxs("select",{ref:U,id:"hyperlink-bookmark",className:"docx-hyperlink-dialog-select",style:re,value:x,onChange:r=>_(r.target.value),children:[jsxRuntime.jsx("option",{value:"",children:"Select a bookmark..."}),H.map(r=>jsxRuntime.jsx("option",{value:r.name,children:r.label||r.name},r.name))]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:T,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-display-text",style:v,children:"Display Text"}),jsxRuntime.jsx("input",{id:"hyperlink-display-text",type:"text",className:"docx-hyperlink-dialog-input",style:g,value:L,onChange:r=>D(r.target.value),placeholder:"Text to display (optional)"}),jsxRuntime.jsx("div",{style:W,children:"Leave empty to use the selected text"})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-field",style:T,children:[jsxRuntime.jsx("label",{htmlFor:"hyperlink-tooltip",style:v,children:"Tooltip (optional)"}),jsxRuntime.jsx("input",{id:"hyperlink-tooltip",type:"text",className:"docx-hyperlink-dialog-input",style:g,value:N,onChange:r=>R(r.target.value),placeholder:"Text shown on hover"})]})]}),jsxRuntime.jsxs("div",{className:"docx-hyperlink-dialog-footer",style:ne,children:[n&&u&&jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-remove",style:se,onClick:u,children:"Remove Link"}),jsxRuntime.jsx("div",{style:{flex:1}}),jsxRuntime.jsx("button",{type:"button",className:"docx-hyperlink-dialog-cancel",style:ae,onClick:e,children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",className:"docx-hyperlink-dialog-submit",style:Y?le:pe,onClick:h,disabled:!Y,children:n?"Update":"Insert"})]})]})})}function me(t,e){return {url:F(t),displayText:e}}function ye(t,e){return {bookmark:t,displayText:e}}function xe(t){return !!t.url&&!t.bookmark}function ge(t){return !!t.bookmark}function fe(t){return t.displayText?t.displayText:t.url?t.url.replace(/^https?:\/\//,""):t.bookmark?t.bookmark:""}function be(t){return t.startsWith("mailto:")?t:`mailto:${t}`}function he(t){return t.startsWith("tel:")?t:`tel:${t.replace(/[\s\-\(\)\.]/g,"")}`}function Se(t){return t.filter(e=>!e.name.startsWith("_")).map(e=>({name:e.name,label:e.name})).sort((e,p)=>e.name.localeCompare(p.name))}function Te(){let[t,e]=react.useState({isOpen:false,isEditing:false}),p=react.useCallback(n=>{e({isOpen:true,selectedText:n,initialData:void 0,isEditing:false});},[]),u=react.useCallback(n=>{e({isOpen:true,initialData:n,selectedText:n.displayText,isEditing:true});},[]),a=react.useCallback(()=>{e(n=>({...n,isOpen:false}));},[]),f=react.useCallback(()=>{e(n=>({...n,isOpen:!n.isOpen}));},[]);return {state:t,openInsert:p,openEdit:u,close:a,toggle:f}}var ve=de;
2
+ exports.a=z;exports.b=F;exports.c=ke;exports.d=de;exports.e=me;exports.f=ye;exports.g=xe;exports.h=ge;exports.i=fe;exports.j=be;exports.k=he;exports.l=Se;exports.m=Te;exports.n=ve;
@@ -0,0 +1 @@
1
+ var f={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},S={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},d={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function b(e){if(!e)return 1;let n=parseInt(e,16);return isNaN(n)?1:n/255}function a(e){let n=e.padStart(6,"0").slice(0,6),r=parseInt(n.slice(0,2),16),t=parseInt(n.slice(2,4),16),o=parseInt(n.slice(4,6),16);return {r:isNaN(r)?0:r,g:isNaN(t)?0:t,b:isNaN(o)?0:o}}function m(e,n,r){let t=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return `${t(e)}${t(n)}${t(r)}`.toUpperCase()}function p(e,n,r){e/=255,n/=255,r/=255;let t=Math.max(e,n,r),o=Math.min(e,n,r),u=(t+o)/2;if(t===o)return {h:0,s:0,l:u};let l=t-o,c=u>.5?l/(2-t-o):l/(t+o),i;switch(t){case e:i=((n-r)/l+(n<r?6:0))/6;break;case n:i=((r-e)/l+2)/6;break;case r:i=((e-n)/l+4)/6;break;default:i=0;}return {h:i*360,s:c,l:u}}function h(e,n,r){if(e=e/360,n===0){let l=Math.round(r*255);return {r:l,g:l,b:l}}let t=(l,c,i)=>(i<0&&(i+=1),i>1&&(i-=1),i<1/6?l+(c-l)*6*i:i<1/2?c:i<2/3?l+(c-l)*(2/3-i)*6:l),o=r<.5?r*(1+n):r+n-r*n,u=2*r-o;return {r:Math.round(t(u,o,e+1/3)*255),g:Math.round(t(u,o,e)*255),b:Math.round(t(u,o,e-1/3)*255)}}function g(e,n){if(n<=0||n>=1)return n>=1?"FFFFFF":e;let r=a(e),t=p(r.r,r.g,r.b);t.l=t.l+(1-t.l)*n;let o=h(t.h,t.s,t.l);return m(o.r,o.g,o.b)}function C(e,n){if(n<=0||n>=1)return n<=0?"000000":e;let r=a(e),t=p(r.r,r.g,r.b);t.l=t.l*n;let o=h(t.h,t.s,t.l);return m(o.r,o.g,o.b)}function x(e,n){let r=d[n]??n,t=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],o=u=>t.includes(u);return e?.colorScheme?o(r)?e.colorScheme[r]??f[r]??"000000":"000000":o(r)?f[r]??"000000":"000000"}function T(e){if(!e)return null;let n=e.toLowerCase();return d[e]??d[n]??null}function s(e,n,r="000000"){if(!e)return `#${r}`;if(e.auto)return `#${r}`;let t;if(e.themeColor){let o=T(e.themeColor);if(o?t=x(n,o):t=e.rgb??r,e.themeTint){let u=b(e.themeTint);t=g(t,u);}else if(e.themeShade){let u=b(e.themeShade);t=C(t,u);}}else e.rgb?t=e.rgb:t=r;return `#${t.toUpperCase().replace(/^#/,"")}`}function P(e){if(!e||e==="none")return "";let n=S[e];return n?`#${n}`:""}function E(e,n){return e?e.auto?"transparent":s(e,n):""}function I(e,n){if(!e)return false;if(e.auto)return true;let t=s(e,n).replace(/^#/,"").toLowerCase(),o=a(t);return (o.r+o.g+o.b)/3<20}function F(e,n){if(!e)return false;let t=s(e,n).replace(/^#/,"").toLowerCase(),o=a(t);return (o.r+o.g+o.b)/3>235}function H(e,n){if(!e)return "#000000";let t=s(e,n).replace(/^#/,""),o=a(t);return (.299*o.r+.587*o.g+.114*o.b)/255>.5?"#000000":"#FFFFFF"}function k(e){if(!e)return;let n=e.trim();if(n.toLowerCase()==="auto")return {auto:true};let r=T(n);if(r)return {themeColor:r};let t=n.replace(/^#/,"").toUpperCase();return /^[0-9A-F]{6}$/i.test(t)?{rgb:t}:/^[0-9A-F]{3}$/i.test(t)?{rgb:t.split("").map(u=>u+u).join("")}:{rgb:t.padStart(6,"0").slice(0,6)}}function R(e,n,r){let t={themeColor:e};return n!==void 0&&n>0&&n<1&&(t.themeTint=Math.round(n*255).toString(16).toUpperCase().padStart(2,"0")),r!==void 0&&r>0&&r<1&&(t.themeShade=Math.round(r*255).toString(16).toUpperCase().padStart(2,"0")),t}function N(e){return {rgb:e.replace(/^#/,"").toUpperCase()}}function M(e,n,r){let o=s(e,n).replace(/^#/,""),u=1-r/100;return `#${C(o,u)}`}function y(e,n,r){let o=s(e,n).replace(/^#/,""),u=r/100;return `#${g(o,u)}`}function L(e,n,r,t){let o=s(e,t).replace(/^#/,""),u=s(n,t).replace(/^#/,""),l=a(o),c=a(u),i={r:Math.round(l.r*(1-r)+c.r*r),g:Math.round(l.g*(1-r)+c.g*r),b:Math.round(l.b*(1-r)+c.b*r)};return `#${m(i.r,i.g,i.b)}`}function A(e,n,r){if(!e&&!n)return true;if(!e||!n)return false;let t=s(e,r).toUpperCase(),o=s(n,r).toUpperCase();return t===o}function v(e){return e/1440*96}function w(e){return e/96*1440}function D(e){return e/914400*96}function U(e){return e/96*914400}function $(e){return e/914400*1440}function B(e){return e/1440*914400}function O(e){return e/72*96}function X(e){return e/144*96}function G(e){return e/2}function K(e){return e/576*96}function _(e,n=2){let r=Math.pow(10,n);return Math.round(e*r)/r}function W(e){return `${_(e)}px`}export{s as a,P as b,E as c,I as d,F as e,H as f,k as g,R as h,N as i,M as j,y as k,L as l,A as m,v as n,w as o,D as p,U as q,$ as r,B as s,O as t,X as u,G as v,K as w,W as x};