@eigenpal/docx-js-editor 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/FindReplaceDialog-KNJETYJX.js +1 -0
- package/dist/{FindReplaceDialog-N4J5OB7O.mjs → FindReplaceDialog-YW3R4FHM.mjs} +1 -1
- package/dist/FootnotePropertiesDialog-7QX54WQT.js +1 -0
- package/dist/FootnotePropertiesDialog-LNFJXQUG.mjs +1 -0
- package/dist/HyperlinkDialog-GBAYMTUE.js +1 -0
- package/dist/{HyperlinkDialog-YQSQFHOP.mjs → HyperlinkDialog-HNYTXDCB.mjs} +1 -1
- package/dist/ImagePositionDialog-B4RLP2W5.mjs +1 -0
- package/dist/ImagePositionDialog-M65BYQQE.js +1 -0
- package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +1 -0
- package/dist/ImagePropertiesDialog-O4WQSF5M.js +1 -0
- package/dist/PageSetupDialog-2GIBTKMJ.js +1 -0
- package/dist/PageSetupDialog-Q7SHEZIJ.mjs +1 -0
- package/dist/TablePropertiesDialog-LMXWX3FI.mjs +1 -0
- package/dist/TablePropertiesDialog-WOZ4ES3H.js +1 -0
- package/dist/chunk-377ZVTSE.js +2 -0
- package/dist/chunk-3OKYQQQ5.js +111 -0
- package/dist/chunk-AU5NVRHP.js +2 -0
- package/dist/chunk-DC65PJYE.js +4 -0
- package/dist/chunk-FW5LYOOZ.mjs +111 -0
- package/dist/chunk-GZOCOWWB.mjs +2 -0
- package/dist/chunk-N6RUBUT2.js +261 -0
- package/dist/chunk-QSUPYUOP.js +2 -0
- package/dist/chunk-SZHPMPSO.mjs +261 -0
- package/dist/chunk-X5A54T6S.mjs +4 -0
- package/dist/chunk-YKBSKEBS.mjs +2 -0
- package/dist/chunk-Z26WOH6R.mjs +2 -0
- package/dist/clipboard-Cu80iVDh.d.ts +1181 -0
- package/dist/clipboard-dFROLI95.d.mts +1181 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/dist/{react-CAc4htNH.d.ts → react-1nBq3zH9.d.ts} +3 -1
- package/dist/{react-B2h6vE3D.d.mts → react-Dr8Nm-0u.d.mts} +3 -1
- package/dist/react.css +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/ui.d.mts +22 -20
- package/dist/ui.d.ts +22 -20
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/i18n/de.json +745 -0
- package/i18n/en.json +745 -0
- package/i18n/pl.json +745 -0
- package/package.json +5 -3
- package/dist/FindReplaceDialog-AQFR4OCT.js +0 -1
- package/dist/FootnotePropertiesDialog-UFUIHLDW.mjs +0 -1
- package/dist/FootnotePropertiesDialog-YYIZU5U6.js +0 -1
- package/dist/HyperlinkDialog-HGZ2S37Z.js +0 -1
- package/dist/ImagePositionDialog-DQ4JWS4F.js +0 -1
- package/dist/ImagePositionDialog-HT6J2SHV.mjs +0 -1
- package/dist/ImagePropertiesDialog-3VK2S2AF.mjs +0 -1
- package/dist/ImagePropertiesDialog-GJMGLM6G.js +0 -1
- package/dist/PageSetupDialog-2SKHDRTF.js +0 -1
- package/dist/PageSetupDialog-SMQJXEBL.mjs +0 -1
- package/dist/TablePropertiesDialog-FI5E3RCB.mjs +0 -1
- package/dist/TablePropertiesDialog-STZOGHJB.js +0 -1
- package/dist/chunk-6AJI5NPH.mjs +0 -111
- package/dist/chunk-AZRYS2WF.mjs +0 -2
- package/dist/chunk-CTYOM6BE.js +0 -2
- package/dist/chunk-EEV6TUOX.mjs +0 -261
- package/dist/chunk-EF3LLEN7.js +0 -4
- package/dist/chunk-HWWZOJMR.mjs +0 -4
- package/dist/chunk-PJVI53AH.js +0 -2
- package/dist/chunk-UMDJQ3Q4.js +0 -111
- package/dist/chunk-WH2EK2HU.js +0 -261
- package/dist/chunk-XWBCP563.mjs +0 -2
- package/dist/clipboard-B7N7Kx2X.d.ts +0 -386
- package/dist/clipboard-BkM7Zvgs.d.mts +0 -386
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {h,c,b as b$2,d,a,R}from'./chunk-X5A54T6S.mjs';import {b}from'./chunk-GZOCOWWB.mjs';import {g,e,f}from'./chunk-6WPRCJ5A.mjs';import {b as b$1}from'./chunk-QAZ4233N.mjs';import ir,{useRef,useState,useEffect,useCallback,useMemo,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var Zt={askAI:"contextMenu.aiActions.askAi",rewrite:"contextMenu.aiActions.rewrite",expand:"contextMenu.aiActions.expand",summarize:"contextMenu.aiActions.summarize",translate:"contextMenu.aiActions.translate",explain:"contextMenu.aiActions.explain",fixGrammar:"contextMenu.aiActions.fixGrammar",makeFormal:"contextMenu.aiActions.makeFormal",makeCasual:"contextMenu.aiActions.makeCasual",custom:"contextMenu.aiActions.custom"},Xt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Qt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Jt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),qt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),eo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),to=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),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"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),oo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ro=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),no=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),io=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function so(e){switch(e){case "askAI":return jsx(Xt,{});case "rewrite":return jsx(Qt,{});case "expand":return jsx(Jt,{});case "summarize":return jsx(qt,{});case "translate":return jsx(eo,{});case "explain":return jsx(to,{});case "fixGrammar":return jsx(oo,{});case "makeFormal":return jsx(ro,{});case "makeCasual":return jsx(no,{});case "custom":return jsx(io,{});default:return null}}var ao=({action:e,onClick:t,isHighlighted:o,onMouseEnter:i})=>{let{t:n}=b(),r=n(Zt[e]),s=f(e),c=so(e);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:i,title:s,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:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:c}),jsx("span",{children:r})]})},lo=({isOpen:e,onSubmit:t,onClose:o,selectedText:i})=>{let[n,r]=useState(""),s=useRef(null),{t:c}=b();useEffect(()=>{e&&s.current&&s.current.focus();},[e]);let l=m=>{m.preventDefault(),n.trim()&&(t(n.trim()),r(""));},a=m=>{m.key==="Escape"&&o();};return e?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:jsxs("form",{onSubmit:l,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',i.slice(0,50),i.length>50?"...":"",'"']}),jsx("input",{ref:s,type:"text",value:n,onChange:m=>r(m.target.value),onKeyDown:a,placeholder:c("contextMenu.customPromptPlaceholder"),style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[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:c("common.cancel")}),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:c("common.send")})]})]})}):null},On=({isOpen:e,position:t,selectedText:o,selectionContext:i,onAction:n,onClose:r,actions:s=g,showCustomPrompt:c=true,className:l=""})=>{let a=useRef(null),[m,b$1]=useState(0),[h,p]=useState(false),{t:u}=b(),g=c?[...s,"custom"]:s;useEffect(()=>{if(!e)return;let d=y=>{a.current&&!a.current.contains(y.target)&&r();};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[e,r]),useEffect(()=>{if(!e)return;let d=y=>{switch(y.key){case "Escape":h?p(false):r();break;case "ArrowDown":y.preventDefault(),b$1(L=>(L+1)%g.length);break;case "ArrowUp":y.preventDefault(),b$1(L=>(L-1+g.length)%g.length);break;case "Enter":y.preventDefault();let C=g[m];C==="custom"?p(true):(n(C),r());break}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,m,g,n,r,h]),useEffect(()=>{e&&(b$1(0),p(false));},[e]);let x=useCallback(()=>{let y=g.length*36+16,C=t.x,L=t.y;return typeof window<"u"&&(C+200>window.innerWidth&&(C=window.innerWidth-200-10),L+y>window.innerHeight&&(L=window.innerHeight-y-10),C<10&&(C=10),L<10&&(L=10)),{position:"fixed",top:L,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,g.length]),k=d=>{d==="custom"?p(true):(n(d),r());},f=d=>{n("custom",d),r();};return !e||!o?null:jsxs("div",{ref:a,className:`docx-context-menu ${l}`,style:x(),role:"menu","aria-label":u("contextMenu.ariaLabel"),children:[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?"...":"",'"']}),jsx("div",{role:"group",children:g.map((d,y)=>jsx(ao,{action:d,onClick:()=>k(d),isHighlighted:y===m,onMouseEnter:()=>b$1(y)},d))}),c&&jsx(lo,{isOpen:h,onSubmit:f,onClose:()=>p(false),selectedText:o})]})};function An(){let[e,t]=useState(false),[o,i]=useState({x:0,y:0}),[n,r]=useState(""),[s,c]=useState(),l=useCallback((m,b,h)=>{m.preventDefault(),i({x:m.clientX,y:m.clientY}),r(b),c(h),t(true);},[]),a=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:n,selectionContext:s,openMenu:l,closeMenu:a}}function Mn(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function _n(e,t,o){return !(!t||t.trim().length===0)}function Nn(){return [...g]}function Bn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var co=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),dt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),po=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),uo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),go=()=>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:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
from { transform: rotate(0deg); }
|
|
4
|
+
to { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`})]});function mo(e,t){let o=[],i=e.split(/(\s+)/),n=t.split(/(\s+)/),r=0,s=0;for(;r<i.length||s<n.length;){if(r>=i.length){o.push({type:"added",text:n.slice(s).join("")});break}if(s>=n.length){o.push({type:"removed",text:i.slice(r).join("")});break}if(i[r]===n[s])o.push({type:"same",text:i[r]}),r++,s++;else {let l=n.indexOf(i[r],s),a=i.indexOf(n[s],r);l===-1&&a===-1?(o.push({type:"removed",text:i[r]}),o.push({type:"added",text:n[s]}),r++,s++):a!==-1&&(l===-1||a-r<=l-s)?(o.push({type:"added",text:n[s]}),s++):(o.push({type:"removed",text:i[r]}),r++);}}let c=[];for(let l of o)c.length>0&&c[c.length-1].type===l.type?c[c.length-1].text+=l.text:c.push(l);return c}var ho=({original:e,modified:t})=>{let o=mo(e,t);return jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:o.map((i,n)=>{let r={};switch(i.type){case "removed":r={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":r={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsx("span",{style:r,children:i.text},n)})})},Vn=({originalText:e$1,response:t,action:o,isLoading:i,error:n,onAccept:r,onReject:s,onRetry:c,allowEdit:l=true,showDiff:a=true,className:m="",position:b$1})=>{let{t:h}=b(),[p,u]=useState(false),[g,x]=useState(""),k=useRef(null),f=useRef(null),d=t?.newText||"";useEffect(()=>{d&&x(d);},[d]),useEffect(()=>{p&&k.current&&(k.current.focus(),k.current.select());},[p]),useEffect(()=>{let D=R=>{R.key==="Escape"?p?(u(false),x(d)):s():R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),y());};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,d,s]);let y=useCallback(()=>{r(p?g:d);},[p,g,d,r]),C=useCallback(()=>{u(true);},[]),L=useCallback(()=>{u(false),x(d);},[d]),Y={position:b$1?"fixed":"relative",...b$1&&{left:b$1.x,top:b$1.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 i?jsx("div",{ref:f,className:`docx-response-preview docx-response-preview-loading ${m}`,style:Y,children:jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsx(go,{}),jsx("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:h("responsePreview.loading",{action:e(o)})})]})}):n?jsx("div",{ref:f,className:`docx-response-preview docx-response-preview-error ${m}`,style:Y,children:jsxs("div",{style:{padding:"16px"},children:[jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:n}),jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[c&&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:[jsx(po,{}),h("common.retry")]}),jsx("button",{type:"button",onClick:s,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:h("common.close")})]})]})}):!t||!d?null:jsxs("div",{ref:f,className:`docx-response-preview ${m}`,style:Y,children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:h("responsePreview.result",{action:e(o)})}),jsx("button",{type:"button",onClick:s,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:h("responsePreview.closeEsc"),children:jsx(dt,{})})]}),jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[p?jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.editPrompt")}),jsx("textarea",{ref:k,value:g,onChange:D=>x(D.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"}})]}):a?jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.changes")}),jsx(ho,{original:e$1,modified:d})]}):jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.original")}),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$1}),jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.new")}),jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:d})]}),t.warnings&&t.warnings.length>0&&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((D,R)=>jsx("div",{children:D},R))})]}),jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxs("div",{children:[l&&!p&&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:[jsx(uo,{}),h("common.edit")]}),p&&jsx("button",{type:"button",onClick:L,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:h("responsePreview.cancelEdit")})]}),jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxs("button",{type:"button",onClick:s,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:[jsx(dt,{}),h("common.reject")]}),jsxs("button",{type:"button",onClick:y,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:[jsx(co,{}),h("common.accept")]})]})]})]})};function $n(){let[e,t]=useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),o=useCallback((s,c,l)=>{t({isVisible:true,originalText:s,response:null,action:c,isLoading:true,position:l});},[]),i=useCallback(s=>{t(c=>({...c,response:s,isLoading:false}));},[]),n=useCallback(s=>{t(c=>({...c,error:s,isLoading:false}));},[]),r=useCallback(()=>{t(s=>({...s,isVisible:false}));},[]);return {state:e,showPreview:o,setResponse:i,setError:n,hidePreview:r}}function Gn(e,t){return {success:true,newText:e,warnings:t}}function jn(e){return {success:false,error:e}}var xo=[{name:"Black",nameKey:"colorPicker.colors.black",hex:"000000"},{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"7F0000"},{name:"Dark Orange",nameKey:"colorPicker.colors.darkOrange",hex:"FF6600"},{name:"Dark Yellow",nameKey:"colorPicker.colors.darkYellow",hex:"808000"},{name:"Dark Green",nameKey:"colorPicker.colors.darkGreen",hex:"006400"},{name:"Dark Teal",nameKey:"colorPicker.colors.darkTeal",hex:"008080"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"000080"},{name:"Dark Purple",nameKey:"colorPicker.colors.darkPurple",hex:"4B0082"},{name:"Dark Gray",nameKey:"colorPicker.colors.darkGray",hex:"404040"},{name:"Gray",nameKey:"colorPicker.colors.gray",hex:"808080"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FF9900"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"00FF00"},{name:"Cyan",nameKey:"colorPicker.colors.cyan",hex:"00FFFF"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"0066FF"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0000FF"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"9900FF"},{name:"Magenta",nameKey:"colorPicker.colors.magenta",hex:"FF00FF"},{name:"Pink",nameKey:"colorPicker.colors.pink",hex:"FF66FF"},{name:"Light Red",nameKey:"colorPicker.colors.lightRed",hex:"FFCCCC"},{name:"Light Orange",nameKey:"colorPicker.colors.lightOrange",hex:"FFE5CC"},{name:"Light Yellow",nameKey:"colorPicker.colors.lightYellow",hex:"FFFFCC"},{name:"Pale Green",nameKey:"colorPicker.colors.paleGreen",hex:"CCFFCC"},{name:"Light Cyan",nameKey:"colorPicker.colors.lightCyan",hex:"CCFFFF"},{name:"Sky Blue",nameKey:"colorPicker.colors.skyBlue",hex:"CCE5FF"},{name:"Light Blue 2",nameKey:"colorPicker.colors.lightBlue2",hex:"CCCCFF"},{name:"Lavender",nameKey:"colorPicker.colors.lavender",hex:"E5CCFF"},{name:"Light Magenta",nameKey:"colorPicker.colors.lightMagenta",hex:"FFCCFF"},{name:"White",nameKey:"colorPicker.colors.white",hex:"FFFFFF"}],bo=[{name:"No Color",nameKey:"colorPicker.noColor",hex:""},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Bright Green",nameKey:"colorPicker.colors.brightGreen",hex:"00FF00"},{name:"Cyan",nameKey:"colorPicker.colors.cyan",hex:"00FFFF"},{name:"Magenta",nameKey:"colorPicker.colors.magenta",hex:"FF00FF"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0000FF"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"00008B"},{name:"Teal",nameKey:"colorPicker.colors.teal",hex:"008080"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"008000"},{name:"Violet",nameKey:"colorPicker.colors.violet",hex:"800080"},{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"8B0000"},{name:"Dark Yellow",nameKey:"colorPicker.colors.darkYellow",hex:"808000"},{name:"Gray 50%",nameKey:"colorPicker.colors.grey50",hex:"808080"},{name:"Gray 25%",nameKey:"colorPicker.colors.grey25",hex:"C0C0C0"},{name:"Black",nameKey:"colorPicker.colors.black",hex:"000000"}],fo={position:"relative",display:"inline-block"},Ie={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},yo={...Ie,backgroundColor:"var(--doc-bg-hover)"},vo={...Ie,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},So={...Ie,cursor:"default",opacity:.38},Co={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},ko={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},wo={display:"grid",gap:"2px"},Le={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},To={...Le,transform:"scale(1.1)",borderColor:"#333",zIndex:1},Po={...Le,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},Eo={...Le,position:"relative",backgroundColor:"#fff"},Io={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},ut={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},Lo={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Ro={display:"flex",alignItems:"center",gap:"8px"},Do={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Ko={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Oo=()=>jsx(d,{name:"format_color_text",size:18}),Ao=()=>jsx(d,{name:"ink_highlighter",size:18}),Mo=()=>jsx(d,{name:"arrow_drop_down",size:14});function _o({colors:e,selectedColor:t,onSelect:o,columns:i=10,cellSize:n=20}){let[r,s]=useState(null),{t:c}=b(),l={...wo,gridTemplateColumns:`repeat(${i}, ${n}px)`};return jsx("div",{style:l,className:"docx-color-grid",role:"grid",children:e.map((a,m)=>{let b=t?.toUpperCase()===a.hex.toUpperCase(),h=r===m,p=a.hex==="",u=a.nameKey?c(a.nameKey):a.name,g={...b?Po:h?To:Le,width:`${n}px`,height:`${n}px`};return p||(g.backgroundColor=`#${a.hex}`),jsx("button",{type:"button",style:p?{...Eo,...g}:g,onClick:()=>o(a),onMouseDown:x=>x.preventDefault(),onMouseEnter:()=>s(m),onMouseLeave:()=>s(null),title:u,role:"gridcell","aria-label":u,"aria-selected":b,children:p&&jsx("span",{style:Io})},`${a.hex}-${m}`)})})}function oi({value:e,onChange:t,type:o="text",theme:i,colors:n,disabled:r=false,className:s,style:c,title:l,children:a,dropdownWidth:m=230,showNoColor:b$2=true,showMoreColors:h$1=true}){let[p,u]=useState(false),[g,x]=useState(false),[k,f]=useState(""),{t:d}=b(),y=useCallback(()=>u(false),[]),{containerRef:C,dropdownRef:L,dropdownStyle:Y}=h({isOpen:p,onClose:y}),D=useMemo(()=>{if(o==="highlight")return bo;let A=[...xo];return b$2&&A.unshift({name:"Automatic",nameKey:"colorPicker.automatic",hex:"000000"}),A},[o,b$2]),R=n||D,X=useMemo(()=>e?e.startsWith("#")?e:o==="highlight"?b$1(e)||"transparent":`#${e}`:o==="text"?"#000000":"transparent",[e,o]),G=useCallback(A=>{t?.(A.hex),u(false);},[t]),v=useCallback(()=>{let A=k.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(A)&&(t?.(A),u(false),f(""));},[k,t]),T=useCallback(()=>{r||u(A=>!A);},[r]),K=r?So:p?vo:g?yo:Ie,V=d(o==="text"?"formattingBar.fontColor":"formattingBar.highlightColor");return jsxs("div",{ref:C,className:`docx-color-picker docx-color-picker-${o} ${s||""}`,style:{...fo,...c},children:[jsxs("button",{type:"button",className:"docx-color-picker-button",style:K,onClick:T,onMouseDown:A=>A.preventDefault(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),disabled:r,title:l||V,"aria-label":l||V,"aria-haspopup":"true","aria-expanded":p,children:[a||jsxs("div",{style:Co,children:[o==="text"?jsx(Oo,{}):jsx(Ao,{}),jsx("div",{style:{...ko,backgroundColor:X==="transparent"?"#fff":X,border:X==="transparent"?"1px solid #ccc":"none"}})]}),jsx(Mo,{})]}),p&&jsxs("div",{ref:L,className:"docx-color-picker-dropdown",style:{...Y,padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",width:m},role:"dialog","aria-label":d("colorPicker.ariaLabel",{type:o==="text"?"Font":"Highlight"}),onMouseDown:A=>A.preventDefault(),children:[o==="highlight"&&jsx("div",{style:ut,children:d("colorPicker.highlightColors")}),jsx(_o,{colors:R,selectedColor:e,onSelect:G,columns:o==="highlight"?8:10}),h$1&&o==="text"&&jsxs("div",{style:Lo,children:[jsx("div",{style:ut,children:d("colorPicker.customColor")}),jsxs("div",{style:Ro,children:[jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsx("input",{type:"text",style:Do,value:k,onChange:A=>f(A.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:A=>{A.key==="Enter"&&v();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsx("button",{type:"button",style:Ko,onClick:v,disabled:!/^[0-9A-Fa-f]{6}$/.test(k),children:d("common.apply")})]})]})]})]})}var No={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function si({onPrint:e,disabled:t=false,label:o,className:i="",style:n,showIcon:r=true,compact:s=false}){let{t:c}=b(),l=o??c("print.label"),a={display:"flex",alignItems:"center",gap:s?"4px":"6px",padding:s?"4px 8px":"6px 12px",fontSize:s?"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 jsxs("button",{className:`docx-print-button ${i}`.trim(),style:a,onClick:e,disabled:t,"aria-label":l,title:l,children:[r&&jsx(Bo,{size:s?14:16}),!s&&jsx("span",{children:l})]})}function ai(){return 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 Bo({size:e=18}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),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"}),jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function li(){window.print();}function ci(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 di(){return {...No}}function pi(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 i=o.match(/^(\d+)-(\d+)$/);if(i){let n=parseInt(i[1],10),r=parseInt(i[2],10);return n>=1&&r<=t&&n<=r?{start:n,end:r}:null}return null}function ui(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function gi(){return typeof window<"u"&&typeof window.print=="function"}function ki({onAction:e,disabled:t=false,canMerge:o=false,canSplit:i=false}){let{t:n}=b(),r=useCallback(m=>{m.preventDefault(),m.stopPropagation();},[]),s=useCallback(()=>{o&&e("mergeCells");},[e,o]),c$1=useCallback(()=>{i&&e("splitCell");},[e,i]),l=jsx(c,{content:n("table.mergeCells"),children:jsx(b$2,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!o)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:s,disabled:t||!o,"aria-label":n("table.mergeCells"),"data-testid":"toolbar-table-merge",children:jsx(d,{name:"call_merge",size:20})})}),a$1=jsx(c,{content:n("table.splitCell"),children:jsx(b$2,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!i)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:c$1,disabled:t||!i,"aria-label":n("table.splitCell"),"data-testid":"toolbar-table-split",children:jsx(d,{name:"call_split",size:20})})});return jsxs(Fragment,{children:[l,a$1]})}var Yo=[{action:"addRowAbove",icon:"keyboard_arrow_up",labelKey:"table.insertRowAbove",testId:"toolbar-table-add-row-above"},{action:"addRowBelow",icon:"keyboard_arrow_down",labelKey:"table.insertRowBelow",testId:"toolbar-table-add-row-below"},{action:"addColumnLeft",icon:"keyboard_arrow_left",labelKey:"table.insertColumnLeft",testId:"toolbar-table-add-col-left"},{action:"addColumnRight",icon:"keyboard_arrow_right",labelKey:"table.insertColumnRight",testId:"toolbar-table-add-col-right"}];function Oi({onAction:e,disabled:t=false}){let{t:o}=b(),i=useCallback(n=>{n.preventDefault(),n.stopPropagation();},[]);return jsx(Fragment,{children:Yo.map(({action:n,icon:r,labelKey:s,testId:c$1})=>{let l=o(s);return jsx(c,{content:l,children:jsx(b$2,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",t&&"opacity-30 cursor-not-allowed"),onMouseDown:i,onClick:()=>!t&&e(n),disabled:t,"aria-label":l,"data-testid":c$1,children:jsx(d,{name:r,size:20})})},typeof n=="string"?n:n.type)})})}var Ho="var(--doc-error)",Vo="var(--doc-success)",$o=({size:e=16})=>jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Go=({size:e=16})=>jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),jo=`
|
|
85
|
+
@keyframes docx-unsaved-pulse {
|
|
86
|
+
0%, 100% { opacity: 1; }
|
|
87
|
+
50% { opacity: 0.6; }
|
|
88
|
+
}
|
|
89
|
+
`,Zo=(e,t,o,i,n,r,s)=>{let c={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:o&&i?"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:`${s}px`,height:`${s}px`,borderRadius:"50%",backgroundColor:o?n:r};case "badge":return {...c,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:o?n:r,color:"white"};case "text":return {...c,fontSize:"12px",color:o?n:r,fontWeight:500};case "icon":return {...c,color:o?n:r};default:return c}},Fi=({hasUnsavedChanges:e,variant:t="dot",position:o="inline",showPulse:i=true,label:n,savedLabel:r,showWhenSaved:s=false,unsavedColor:c=Ho,savedColor:l=Vo,size:a=8,className:m="",style:b$1,onClick:h,title:p})=>{let{t:u}=b(),g=n??u("unsaved.unsaved"),x=r??u("unsaved.saved");if(useEffect(()=>{if(!i||!e)return;let C="docx-unsaved-pulse-keyframes";if(!document.getElementById(C)){let L=document.createElement("style");L.id=C,L.textContent=jo,document.head.appendChild(L);}},[i,e]),!e&&!s)return null;let f={...Zo(t,o,e,i,c,l,a),...b$1,cursor:h?"pointer":void 0},d=u(e?"unsaved.unsavedTitle":"unsaved.savedTitle"),y=()=>{switch(t){case "dot":return null;case "badge":return e?g:x;case "text":return e?g:x;case "icon":return e?jsx(Go,{size:a}):jsx($o,{size:a});default:return null}};return jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${m}`,style:f,onClick:h,title:p??d,role:h?"button":"status","aria-label":u(e?"unsaved.unsavedAriaLabel":"unsaved.savedAriaLabel"),children:y()})};function zi(e={}){let{t}=b(),{document:o,warnBeforeLeave:i=true,warningMessage:n=t("errors.unsavedChanges"),enabled:r=true,onChangeStatusChange:s}=e,[c,l]=useState(false),[a,m]=useState(0),[b$1,h]=useState(null),p=useRef(null),u=useRef(false),g=useCallback(d=>{if(!d)return null;try{return JSON.stringify(d.package)}catch{return null}},[]),x=useCallback(()=>{r&&(l(false),m(0),h(o??null),p.current=g(o));},[r,o,g]),k=useCallback(()=>{r&&(c||(l(true),s?.(true)),m(d=>d+1));},[r,c,s]),f=useCallback(d=>{let y=d!==void 0?d:o;l(false),m(0),h(y??null),p.current=g(y),u.current=true;},[o,g]);return useEffect(()=>{!r||!o||u.current||f(o);},[r,o,f]),useEffect(()=>{if(!r||!o||!u.current)return;let d=g(o),y=p.current;if(d!==y){let C=g(b$1);d!==C?(c||(l(true),s?.(true)),m(L=>L+1)):c&&(l(false),s?.(false)),p.current=d;}},[r,o,b$1,c,g,s]),useEffect(()=>{if(!r||!i||!c)return;let d=y=>(y.preventDefault(),y.returnValue=n,n);return window.addEventListener("beforeunload",d),()=>window.removeEventListener("beforeunload",d)},[r,i,c,n]),{hasUnsavedChanges:c,markAsSaved:x,markAsChanged:k,resetTracking:f,lastSavedDocument:b$1,changeCount:a}}function Wi(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function Yi(){return ["dot","badge","text","icon"]}function Ui(){return ["inline","absolute-top-right","absolute-top-left"]}function Hi(){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 Xo={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},Qo="var(--doc-primary)",Jo=300,qo=`
|
|
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
|
+
`,er=({size:e,strokeWidth:t,color:o})=>{let i=(e-t)/2,n=i*2*Math.PI;return jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsx("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${n*.75} ${n}`,opacity:.25}),jsx("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${n*.25} ${n}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},tr=({size:e,color:t})=>{let o=e/4,i=o/2;return jsx("div",{style:{display:"flex",gap:`${i}px`},children:[0,1,2].map(n=>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))})},or=({size:e,color:t})=>jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children: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"}})}),rr=({size:e,color:t})=>jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),nr=({size:e,color:t,progress:o,showText:i,fontSize:n})=>{let r=Math.max(0,Math.min(100,o));return jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${r}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),i&&jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n,fontWeight:500,color:r>50?"#fff":t},children:[Math.round(r),"%"]})]})},Xi=({isLoading:e,variant:t="spinner",size:o="medium",message:i,overlay:n=false,overlayOpacity:r=.5,progress:s=0,showProgressText:c=true,color:l=Qo,className:a="",style:m})=>{let{t:b$1}=b(),h=Xo[o];if(useEffect(()=>{let g="docx-loading-keyframes";if(!document.getElementById(g)){let x=document.createElement("style");x.id=g,x.textContent=qo,document.head.appendChild(x);}},[]),!e)return null;let p=()=>{switch(t){case "spinner":return jsx(er,{size:h.size,strokeWidth:h.strokeWidth,color:l});case "dots":return jsx(tr,{size:h.size,color:l});case "bar":return jsx(or,{size:h.size,color:l});case "pulse":return jsx(rr,{size:h.size,color:l});case "progress":return jsx(nr,{size:h.size,color:l,progress:s,showText:c,fontSize:h.fontSize});default:return null}},u=jsxs("div",{className:`docx-loading-content ${a}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...m},children:[p(),i&&jsx("div",{style:{fontSize:h.fontSize,color:n?"white":"var(--doc-text-muted)",textAlign:"center"},children:i})]});return n?jsx("div",{className:`docx-loading-overlay ${a}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${r})`,zIndex:1e4,...m},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?s:void 0,"aria-busy":"true","aria-label":i||b$1("loading.label"),children:u}):jsx("div",{className:`docx-loading-inline ${a}`,style:{display:"inline-flex",alignItems:"center",...m},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?s:void 0,"aria-busy":"true","aria-label":i||"Loading",children:u})};function Qi(e={}){let{initialLoading:t=false,minDuration:o=Jo,onStart:i,onEnd:n}=e,[r,s]=useState(t),[c,l]=useState(null),[a,m]=useState(0),b=useRef(null),h=useRef(null),p=useCallback(x=>{b.current=Date.now(),s(true),l(x||null),m(0),i?.();},[i]),u=useCallback(()=>{let x=b.current,k=Date.now(),f=x?k-x:0,d=Math.max(0,o-f);d>0?h.current=setTimeout(()=>{s(false),l(null),m(0),b.current=null,n?.();},d):(s(false),l(null),m(0),b.current=null,n?.());},[o,n]),g=useCallback(async(x,k)=>{p(k);try{let f=await x();return u(),f}catch(f){throw u(),f}},[p,u]);return useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),{isLoading:r,message:c,progress:a,startLoading:p,stopLoading:u,setProgress:m,setMessage:l,withLoading:g}}function Ji(){let[e,t]=useState(new Map),o=useCallback((c,l)=>{t(a=>{let m=new Map(a);return m.set(c,{id:c,message:l,startTime:Date.now()}),m});},[]),i=useCallback((c,l)=>{t(a=>{let m=a.get(c);if(!m)return a;let b=new Map(a);return b.set(c,{...m,...l}),b});},[]),n=useCallback(c=>{t(l=>{let a=new Map(l);return a.delete(c),a});},[]),r=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:r,startOperation:o,updateOperation:i,endOperation:n,getOperation:c=>e.get(c)}}function qi(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function es(){return ["spinner","dots","bar","pulse","progress"]}function ts(){return ["small","medium","large"]}function os(e){return new Promise(t=>setTimeout(t,e))}var yt=4,vt=36,lr=32,cr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function dr(e){let{containerRef:t,items:o,itemGap:i=yt,overflowButtonWidth:n=vt}=e,[r,s]=useState(o.length),c=useRef(new Map),l=useCallback(()=>{let b=t.current;if(!b){s(o.length);return}let h=b.offsetWidth;if(h===0)return;let p=[...o].sort((x,k)=>x.alwaysVisible&&!k.alwaysVisible?-1:!x.alwaysVisible&&k.alwaysVisible?1:(x.priority||3)-(k.priority||3)),u=0,g=0;for(let x of p){let f=(x.minWidth||c.current.get(x.id)||lr)+(g>0?i:0),d=g<o.length-1?n+i:0;if(u+f+d<=h)u+=f,g++;else if(x.alwaysVisible)u+=f,g++;else break}s(Math.max(0,g));},[t,o,i,n]);useLayoutEffect(()=>{let b=t.current;if(!b)return;l();let h=new ResizeObserver(()=>{l();});return h.observe(b),()=>{h.disconnect();}},[t,l]),useEffect(()=>{l();},[o,l]);let{visibleItems:a,overflowItems:m}=useMemo(()=>{let b=[...o].sort((h,p)=>h.alwaysVisible&&!p.alwaysVisible?-1:!h.alwaysVisible&&p.alwaysVisible?1:(h.priority||3)-(p.priority||3));return {visibleItems:b.slice(0,r),overflowItems:b.slice(r)}},[o,r]);return {visibleItems:a,overflowItems:m,hasOverflow:m.length>0,recalculate:l}}var pr=({items:e,isOpen:t,onClose:o,anchorRef:i})=>{let n=useRef(null);return useEffect(()=>{if(!t)return;let r=s=>{n.current&&!n.current.contains(s.target)&&i.current&&!i.current.contains(s.target)&&o();};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t,o,i]),useEffect(()=>{if(!t)return;let r=s=>{s.key==="Escape"&&o();};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,o]),!t||e.length===0?null: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(r=>jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:r.content},r.id))})},ss=({items:e,overflowItems:t=[],alwaysShowOverflow:o=false,renderOverflowButton:i,renderOverflowMenu:n,itemGap:r=yt,padding:s="8px 12px",overflowButtonWidth:c=vt,className:l="",style:a,height:m=44,backgroundColor:b="var(--doc-toolbar-bg)",borderBottom:h="1px solid var(--doc-border)"})=>{let p=useRef(null),u=useRef(null),[g,x]=useState(false),{visibleItems:k,overflowItems:f,hasOverflow:d}=dr({containerRef:p,items:e,itemGap:r,overflowButtonWidth:c}),y=[...f,...t],C=d||o||t.length>0,L=useCallback(()=>{x(R=>!R);},[]),Y=useCallback(()=>{x(false);},[]),D=jsx("button",{ref:u,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:L,"aria-label":`Show ${y.length} more options`,"aria-expanded":g,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${c}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:g?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsx(cr,{})});return jsxs("div",{ref:p,className:`docx-responsive-toolbar ${l}`,style:{display:"flex",alignItems:"center",gap:`${r}px`,height:typeof m=="number"?`${m}px`:m,padding:s,backgroundColor:b,borderBottom:h,position:"relative",...a},children:[k.map(R=>jsxs(ir.Fragment,{children:[jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":R.id,style:{flexShrink:0},children:R.content}),R.separatorAfter&&jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},R.id)),C&&jsx("div",{style:{flex:1,minWidth:0}}),C&&jsxs("div",{style:{position:"relative",flexShrink:0},children:[i?i(y.length,g,L):D,n?g&&n(y,Y):jsx(pr,{items:y,isOpen:g,onClose:Y,anchorRef:u})]})]})},as=({children:e,gap:t=2,separatorAfter:o=false,className:i="",style:n})=>jsxs(Fragment,{children:[jsx("div",{className:`docx-toolbar-group ${i}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...n},children:e}),o&&jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function ls(e,t,o){return {id:e,content:t,priority:3,...o}}function cs(e){return e.map(t=>({...t,priority:t.priority||3}))}function ds(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 mr={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},hr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},xr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},br={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},fr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},yr={padding:"20px"},vr={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},Sr={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},Pt={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},Cr={...Pt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},kr={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},wr={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},Ct={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},kt={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},wt={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"},Tr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ze={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},Pr={...Ze,backgroundColor:"var(--doc-primary)",color:"white"},Er={...Ze,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Ir={...Ze,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Lr(){return jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function xs({isOpen:e,onClose:t,onInsert:o,maxGridRows:i=8,maxGridColumns:n=10,maxRows:r=100,maxColumns:s=20,className:c,style:l}){let{t:a}=b(),[m,b$1]=useState(0),[h,p]=useState(0),[u,g]=useState(3),[x,k]=useState(3),f=useRef(null);useEffect(()=>{e&&(b$1(0),p(0),g(3),k(3));},[e]),useEffect(()=>{e&&f.current?.focus();},[e]);let d=useCallback((T,K)=>{b$1(T),p(K);},[]),y=useCallback(()=>{m>0&&h>0&&o({rows:m,columns:h});},[m,h,o]),C=useCallback(()=>{let T=Math.min(Math.max(1,u),r),K=Math.min(Math.max(1,x),s);o({rows:T,columns:K});},[u,x,r,s,o]),L=useCallback(T=>{T.key==="Escape"?t():T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),C());},[t,C]),Y=useCallback(T=>{T.target===T.currentTarget&&t();},[t]),D=useCallback(T=>{let K=parseInt(T.target.value,10);isNaN(K)?T.target.value===""&&g(1):g(Math.min(Math.max(1,K),r));},[r]),R=useCallback(T=>{let K=parseInt(T.target.value,10);isNaN(K)?T.target.value===""&&k(1):k(Math.min(Math.max(1,K),s));},[s]);if(!e)return null;let X=[];for(let T=1;T<=i;T++)for(let K=1;K<=n;K++){let V=T<=m&&K<=h;X.push(jsx("div",{style:V?Cr:Pt,onMouseEnter:()=>d(T,K),onClick:y,role:"gridcell","aria-selected":V},`${T}-${K}`));}let G=u>=1&&x>=1,v=m>0&&h>0?a("dialogs.insertTable.tableSize",{cols:h,rows:m}):a("dialogs.insertTable.hoverToSelect");return jsx("div",{className:`docx-insert-table-dialog-overlay ${c||""}`,style:{...mr,...l},onClick:Y,onKeyDown:L,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxs("div",{ref:f,className:"docx-insert-table-dialog",style:hr,tabIndex:-1,children:[jsxs("div",{className:"docx-insert-table-dialog-header",style:xr,children:[jsx("h2",{id:"insert-table-dialog-title",style:br,children:jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsx(Lr,{}),a("dialogs.insertTable.title")]})}),jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:fr,onClick:t,"aria-label":a("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-insert-table-dialog-body",style:yr,children:[jsxs("div",{className:"docx-insert-table-grid-container",style:vr,children:[jsx("div",{className:"docx-insert-table-grid",style:{...Sr,gridTemplateColumns:`repeat(${n}, 1fr)`},onMouseLeave:()=>{b$1(0),p(0);},role:"grid","aria-label":"Table size selector",children:X}),jsx("div",{className:"docx-insert-table-grid-label",style:kr,children:v})]}),jsxs("div",{className:"docx-insert-table-separator",style:wr,children:[jsx("div",{style:Ct}),jsx("span",{children:a("dialogs.insertTable.orSpecifySize")}),jsx("div",{style:Ct})]}),jsxs("div",{className:"docx-insert-table-inputs",children:[jsxs("div",{style:kt,children:[jsx("label",{htmlFor:"insert-table-rows",style:wt,children:a("dialogs.insertTable.rowsLabel")}),jsx("input",{id:"insert-table-rows",type:"number",min:1,max:r,value:u,onChange:D,style:Tt})]}),jsxs("div",{style:kt,children:[jsx("label",{htmlFor:"insert-table-cols",style:wt,children:a("dialogs.insertTable.columnsLabel")}),jsx("input",{id:"insert-table-cols",type:"number",min:1,max:s,value:x,onChange:R,style:Tt})]})]})]}),jsxs("div",{className:"docx-insert-table-dialog-footer",style:Tr,children:[jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:Er,onClick:t,children:a("common.cancel")}),jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:G?Pr:Ir,onClick:C,disabled:!G,children:a("dialogs.insertTable.insertButton")})]})]})})}function bs(){let[e,t]=useState(false),o=useCallback(()=>t(true),[]),i=useCallback(()=>t(false),[]),n=useCallback(()=>t(r=>!r),[]);return {isOpen:e,open:o,close:i,toggle:n}}function fs(e=3,t=3){return {rows:e,columns:t}}function ys(e,t=100,o=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=o}function vs(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 Ss(e){return `${e.columns} x ${e.rows}`}function Cs(){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 Dr={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},Kr={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"},Or={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Ar={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Mr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},_r={padding:"20px"},Xe={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"},Nr={...Xe,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},Br={...Xe,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},Fr={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},zr={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},Wr={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},Yr={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},Ur={fontSize:"12px",color:"var(--doc-text-placeholder)"},It={marginBottom:"16px"},Lt={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Hr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},Vr={display:"flex",alignItems:"center",gap:"12px"},Rt={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Kt={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},$r={...Kt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},Gr={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},jr={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"},Zr={...Qe,backgroundColor:"var(--doc-primary)",color:"white"},Xr={...Qe,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Qr={...Qe,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Jr(){return jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function qr({locked:e}){return e?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function Is({isOpen:e,onClose:t,onInsert:o,maxWidth:i=800,maxHeight:n=600,accept:r="image/*",className:s,style:c}){let{t:l}=b(),[a,m]=useState(null),[b$1,h]=useState(false),[p,u]=useState(0),[g,x]=useState(0),[k,f]=useState(""),[d,y]=useState(true),[C,L]=useState(1),[Y,D]=useState(null),R=useRef(null),X=useRef(null);useEffect(()=>{e&&(m(null),h(false),u(0),x(0),f(""),y(true),L(1),D(null));},[e]);let G=useCallback(E=>{if(!E.type.startsWith("image/")){D(l("dialogs.insertImage.invalidFile"));return}if(E.size>10*1024*1024){D(l("dialogs.insertImage.fileTooLarge"));return}D(null);let z=new FileReader;z.onload=$t=>{let rt=$t.target?.result,ae=new Image;ae.onload=()=>{let le=ae.width,ce=ae.height;if(le>i||ce>n){let Gt=i/le,jt=n/ce,nt=Math.min(Gt,jt);le=Math.round(le*nt),ce=Math.round(ce*nt);}u(le),x(ce),L(ae.width/ae.height),m({src:rt,width:le,height:ce,fileName:E.name,mimeType:E.type});},ae.src=rt;},z.onerror=()=>{D("Failed to read image file");},z.readAsDataURL(E);},[i,n]),v=useCallback(E=>{let z=E.target.files?.[0];z&&G(z);},[G]),T=useCallback(()=>{R.current?.click();},[]),K=useCallback(E=>{E.preventDefault(),h(true);},[]),V=useCallback(E=>{E.preventDefault(),h(false);},[]),A=useCallback(E=>{E.preventDefault(),h(false);let z=E.dataTransfer.files?.[0];z&&G(z);},[G]),zt=useCallback(E=>{let z=parseInt(E.target.value,10)||0;u(z),d&&C&&x(Math.round(z/C));},[d,C]),Wt=useCallback(E=>{let z=parseInt(E.target.value,10)||0;x(z),d&&C&&u(Math.round(z*C));},[d,C]),Be=useCallback(()=>{a&&o({...a,width:p,height:g,alt:k||void 0});},[a,p,g,k,o]),Yt=useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&a&&!E.shiftKey&&(E.preventDefault(),Be());},[t,a,Be]),Ut=useCallback(E=>{E.target===E.currentTarget&&t();},[t]),Ht=useCallback(()=>{m(null),u(0),x(0),f(""),D(null),R.current&&(R.current.value="");},[]);if(!e)return null;let ot=a!==null&&p>0&&g>0,Vt=()=>a?Br:b$1?Nr:Xe;return jsx("div",{className:`docx-insert-image-dialog-overlay ${s||""}`,style:{...Dr,...c},onClick:Ut,onKeyDown:Yt,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxs("div",{ref:X,className:"docx-insert-image-dialog",style:Kr,tabIndex:-1,children:[jsxs("div",{className:"docx-insert-image-dialog-header",style:Or,children:[jsx("h2",{id:"insert-image-dialog-title",style:Ar,children:l("dialogs.insertImage.title")}),jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:Mr,onClick:t,"aria-label":l("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-insert-image-dialog-body",style:_r,children:[jsx("input",{ref:R,type:"file",accept:r,onChange:v,style:{display:"none"}}),jsx("div",{className:"docx-insert-image-dropzone",style:Vt(),onClick:T,onDragOver:K,onDragLeave:V,onDrop:A,role:"button",tabIndex:0,"aria-label":l("dialogs.insertImage.uploadAriaLabel"),children:a?jsx("div",{style:Fr,children:jsx("img",{src:a.src,alt:k||"Preview",style:zr})}):jsxs(Fragment,{children:[jsx("div",{style:Wr,children:jsx(Jr,{})}),jsx("div",{style:Yr,children:l("dialogs.insertImage.uploadText")}),jsx("div",{style:Ur,children:l("dialogs.insertImage.uploadSubtext")})]})}),a?.fileName&&jsxs("div",{style:Gr,children:[a.fileName,jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Ht();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:l("common.change")})]}),Y&&jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:Y}),a&&jsxs(Fragment,{children:[jsxs("div",{style:It,children:[jsx("label",{style:Lt,children:l("dialogs.insertImage.dimensions")}),jsxs("div",{style:Vr,children:[jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("dialogs.insertImage.widthLabel")}),jsx("input",{type:"number",value:p,onChange:zt,min:1,max:i,style:Rt}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("common.px")}),jsx("button",{type:"button",onClick:()=>y(!d),style:d?$r:Kt,title:l(d?"dialogs.insertImage.aspectRatioLocked":"dialogs.insertImage.aspectRatioUnlocked"),children:jsx(qr,{locked:d})}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("dialogs.insertImage.heightLabel")}),jsx("input",{type:"number",value:g,onChange:Wt,min:1,max:n,style:Rt}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("common.px")})]})]}),jsxs("div",{style:It,children:[jsx("label",{htmlFor:"insert-image-alt",style:Lt,children:l("dialogs.insertImage.altTextLabel")}),jsx("input",{id:"insert-image-alt",type:"text",value:k,onChange:E=>f(E.target.value),placeholder:l("dialogs.insertImage.altTextPlaceholder"),style:Hr})]})]})]}),jsxs("div",{className:"docx-insert-image-dialog-footer",style:jr,children:[jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:Xr,onClick:t,children:l("common.cancel")}),jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:ot?Zr:Qr,onClick:Be,disabled:!ot,children:l("dialogs.insertImage.insertButton")})]})]})})}function Ls(){let[e,t]=useState(false),o=useCallback(()=>t(true),[]),i=useCallback(()=>t(false),[]),n=useCallback(()=>t(r=>!r),[]);return {isOpen:e,open:o,close:i,toggle:n}}function Rs(e){return e.type.startsWith("image/")}function Ds(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function Ks(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function Os(e,t,o,i){if(e<=o&&t<=i)return {width:e,height:t};let n=o/e,r=i/t,s=Math.min(n,r);return {width:Math.round(e*s),height:Math.round(t*s)}}function As(e){let t=e.split(","),o=t[0].match(/:(.*?);/)?.[1]||"image/png",i=atob(t[1]),n=new Uint8Array(i.length);for(let r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return new Blob([n],{type:o})}function Ms(e){return new Promise((t,o)=>{let i=new Image;i.onload=()=>t({width:i.width,height:i.height}),i.onerror=()=>o(new Error("Failed to load image")),i.src=e;})}function _s(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var rn={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},nn={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"},sn={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},an={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},ln={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},cn={padding:"20px",flex:1,overflow:"auto"},dn={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},pn={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},Ot={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},un={...Ot,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},gn={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},mn={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"},hn={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},xn={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},bn={flex:1},fn={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"},yn={...Je,backgroundColor:"var(--doc-primary)",color:"white"},vn={...Je,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Sn={...Je,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Ce=[{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 At(){return Ce.flatMap(e=>e.symbols)}function Ys({isOpen:e,onClose:t,onInsert:o,recentSymbols:i=[],className:n,style:r}){let{t:s}=b(),[c,l]=useState("common"),[a,m]=useState(null),[b$1,h]=useState(""),[p,u]=useState(null),g=useRef(null);useEffect(()=>{e&&(m(null),h(""),u(null),setTimeout(()=>g.current?.focus(),100));},[e]);let x=useMemo(()=>{if(!b$1.trim())return c==="recent"?i:Ce.find(V=>V.name===c)?.symbols||[];let v=b$1.toLowerCase();return At().filter(K=>{let V=K.codePointAt(0)?.toString(16).toUpperCase()||"";return K.includes(v)||V.includes(v.toUpperCase())||`U+${V}`.toLowerCase().includes(v)})},[b$1,c,i]),k=useCallback(v=>{m(v);},[]),f=useCallback(v=>{o(v);},[o]),d=useCallback(()=>{a&&o(a);},[a,o]),y=useCallback(v=>{v.key==="Escape"?t():v.key==="Enter"&&a&&(v.preventDefault(),d());},[t,a,d]),C=useCallback(v=>{v.target===v.currentTarget&&t();},[t]),L=v=>{if(!v)return null;let T=v.codePointAt(0);return {character:v,codePoint:T?`U+${T.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:T||0}};if(!e)return null;let D=L(p||a),R=a!==null,X={common:s("dialogs.insertSymbol.categories.common"),arrows:s("dialogs.insertSymbol.categories.arrows"),math:s("dialogs.insertSymbol.categories.math"),greek:s("dialogs.insertSymbol.categories.greek"),shapes:s("dialogs.insertSymbol.categories.shapes"),punctuation:s("dialogs.insertSymbol.categories.punctuation"),currency:s("dialogs.insertSymbol.categories.currency"),music:s("dialogs.insertSymbol.categories.music"),emoji:s("dialogs.insertSymbol.categories.emoji")},G=[...i.length>0?[{name:"recent",label:"Recent"}]:[],...Ce.map(v=>({name:v.name,label:X[v.name]||v.label}))];return jsx("div",{className:`docx-insert-symbol-dialog-overlay ${n||""}`,style:{...rn,...r},onClick:C,onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxs("div",{className:"docx-insert-symbol-dialog",style:nn,children:[jsxs("div",{className:"docx-insert-symbol-dialog-header",style:sn,children:[jsx("h2",{id:"insert-symbol-dialog-title",style:an,children:s("dialogs.insertSymbol.title")}),jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:ln,onClick:t,"aria-label":s("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-insert-symbol-dialog-body",style:cn,children:[jsx("input",{ref:g,type:"text",placeholder:s("dialogs.insertSymbol.searchPlaceholder"),value:b$1,onChange:v=>h(v.target.value),style:dn}),!b$1&&jsx("div",{className:"docx-insert-symbol-categories",style:pn,children:G.map(v=>jsx("button",{type:"button",onClick:()=>l(v.name),style:c===v.name?un:Ot,children:v.label},v.name))}),jsx("div",{className:"docx-insert-symbol-grid",style:gn,children:x.map((v,T)=>jsx("button",{type:"button",onClick:()=>k(v),onDoubleClick:()=>f(v),onMouseEnter:()=>u(v),onMouseLeave:()=>u(null),style:{...mn,...a===v?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${v} - U+${v.codePointAt(0)?.toString(16).toUpperCase()}`,children:v},`${v}-${T}`))}),x.length===0&&jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:s("dialogs.insertSymbol.noResults",{query:b$1})}),D&&jsxs("div",{className:"docx-insert-symbol-preview",style:hn,children:[jsx("div",{style:xn,children:D.character}),jsxs("div",{style:bn,children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:D.codePoint}),jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:s("dialogs.insertSymbol.decimal",{value:D.decimal})})]})]})]}),jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:fn,children:[jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:vn,onClick:t,children:s("common.cancel")}),jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:R?yn:Sn,onClick:d,disabled:!R,children:s("common.insert")})]})]})})}function Us(e=20){let[t,o]=useState(false),[i,n]=useState([]),r=useCallback(()=>o(true),[]),s=useCallback(()=>o(false),[]),c=useCallback(()=>o(a=>!a),[]),l=useCallback(a=>{n(m=>{let b=m.filter(h=>h!==a);return [a,...b].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:i,open:r,close:s,toggle:c,addRecent:l}}function Hs(){return Ce}function Vs(e){return Ce.find(o=>o.name===e)?.symbols||[]}function $s(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 Gs(e){if(!e.trim())return [];let t=e.toLowerCase();return At().filter(o=>{let i=o.codePointAt(0)?.toString(16).toUpperCase()||"";return o.includes(e)||i.includes(t.toUpperCase())||`U+${i}`.toLowerCase().includes(t)})}function js(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)}var ie=[{id:"formatted",labelKey:"dialogs.pasteSpecial.keepFormatting",descriptionKey:"dialogs.pasteSpecial.keepFormattingDescription",shortcutKey:"dialogs.pasteSpecial.keepFormattingShortcut"},{id:"plainText",labelKey:"dialogs.pasteSpecial.plainText",descriptionKey:"dialogs.pasteSpecial.plainTextDescription",shortcutKey:"dialogs.pasteSpecial.plainTextShortcut"}],kn=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),wn=()=>jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function Tn(e){switch(e){case "formatted":return jsx(kn,{});case "plainText":return jsx(wn,{});default:return null}}var Pn=({option:e,isSelected:t,onClick:o,onMouseEnter:i})=>jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:o,onMouseEnter:i,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:[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:Tn(e.id)}),jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),ta=({isOpen:e,onClose:t,onPaste:o,position:i,className:n=""})=>{let{t:r}=b(),s=useRef(null),[c,l]=useState(0),[a,m]=useState(null),[b$1,h]=useState(false),[p,u]=useState(null),g=ie.map(f=>({id:f.id,label:r(f.labelKey),description:r(f.descriptionKey),shortcut:r(f.shortcutKey)}));useEffect(()=>{if(!e){m(null),u(null),l(0);return}(async()=>{h(true),u(null);try{let d=await R({cleanWordFormatting:!0});m(d),d||u(r("dialogs.pasteSpecial.noContent"));}catch{u(r("dialogs.pasteSpecial.clipboardError"));}finally{h(false);}})();},[e]),useEffect(()=>{if(!e)return;let f=d=>{s.current&&!s.current.contains(d.target)&&t();};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[e,t]),useEffect(()=>{if(!e)return;let f=d=>{switch(d.key){case "Escape":d.preventDefault(),t();break;case "ArrowDown":d.preventDefault(),l(y=>(y+1)%ie.length);break;case "ArrowUp":d.preventDefault(),l(y=>(y-1+ie.length)%ie.length);break;case "Enter":d.preventDefault(),x(ie[c].id);break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,c,t]);let x=useCallback(f=>{if(!a){u(r("dialogs.pasteSpecial.noContent"));return}o(a,f==="plainText"),t();},[a,o,t]),k=useCallback(()=>{let y=i?.x??(typeof window<"u"?window.innerWidth/2-160:100),C=i?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(y+320>window.innerWidth&&(y=window.innerWidth-320-10),C+200>window.innerHeight&&(C=window.innerHeight-200-10),y<10&&(y=10),C<10&&(C=10)),{position:"fixed",top:C,left:y,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"}},[i]);return e?jsxs("div",{ref:s,className:`docx-paste-special-dialog ${n}`,style:k(),role:"dialog","aria-label":r("dialogs.pasteSpecial.title"),children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:r("dialogs.pasteSpecial.title")}),jsx("button",{type:"button",onClick:t,"aria-label":r("common.closeDialog"),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:jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsx("div",{style:{padding:"8px"},children:b$1?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:r("dialogs.pasteSpecial.readingClipboard")}):p?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:p}):jsx("div",{role:"menu",children:g.map((f,d)=>jsx(Pn,{option:f,isSelected:d===c,onClick:()=>x(f.id),onMouseEnter:()=>l(d)},f.id))})}),a&&!b$1&&!p&&jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:r("dialogs.pasteSpecial.preview")}),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:['"',a.plainText.slice(0,50),a.plainText.length>50?"...":"",'"']})]})]}):null};function oa(e={}){let{onPaste:t,enabled:o=true}=e,[i,n]=useState(false),r=useCallback(()=>{o&&n(true);},[o]),s=useCallback(()=>{n(false);},[]),c=useCallback(async()=>{if(!(!o||!t))try{let a=await R({cleanWordFormatting:!0});a&&t(a,!0);}catch(a){console.error("Failed to paste as plain text:",a);}},[o,t]),l=useCallback(a=>o&&(a.ctrlKey||a.metaKey)&&a.shiftKey&&a.key.toLowerCase()==="v"?(a.preventDefault(),r(),true):false,[o,r]);return {isOpen:i,openDialog:r,closeDialog:s,handleKeyDown:l,pasteAsPlainText:c}}function ra(e){return ie.find(t=>t.id===e)}function na(){return [...ie]}function ia(){return "formatted"}function sa(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var Nt={editing:"dialogs.keyboardShortcuts.categories.editing",formatting:"dialogs.keyboardShortcuts.categories.formatting",navigation:"dialogs.keyboardShortcuts.categories.navigation",clipboard:"dialogs.keyboardShortcuts.categories.clipboard",selection:"dialogs.keyboardShortcuts.categories.selection",view:"dialogs.keyboardShortcuts.categories.view",file:"dialogs.keyboardShortcuts.categories.file",other:"dialogs.keyboardShortcuts.categories.other"},Bt=["file","editing","clipboard","formatting","selection","navigation","view","other"],Ne=[{id:"save",name:"Save",nameKey:"dialogs.keyboardShortcuts.shortcuts.save",description:"Save document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.saveDescription",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",nameKey:"dialogs.keyboardShortcuts.shortcuts.print",description:"Print document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.printDescription",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",nameKey:"dialogs.keyboardShortcuts.shortcuts.undo",description:"Undo last action",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.undoDescription",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",nameKey:"dialogs.keyboardShortcuts.shortcuts.redo",description:"Redo last action",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.redoDescription",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",nameKey:"dialogs.keyboardShortcuts.shortcuts.delete",description:"Delete selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.deleteDescription",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",nameKey:"dialogs.keyboardShortcuts.shortcuts.find",description:"Find text in document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findDescription",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",nameKey:"dialogs.keyboardShortcuts.shortcuts.findReplace",description:"Find and replace text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findReplaceDescription",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",nameKey:"dialogs.keyboardShortcuts.shortcuts.cut",description:"Cut selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.cutDescription",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",nameKey:"dialogs.keyboardShortcuts.shortcuts.copy",description:"Copy selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.copyDescription",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",nameKey:"dialogs.keyboardShortcuts.shortcuts.paste",description:"Paste from clipboard",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pasteDescription",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",nameKey:"dialogs.keyboardShortcuts.shortcuts.pastePlainText",description:"Paste without formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pastePlainTextDescription",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",nameKey:"dialogs.keyboardShortcuts.shortcuts.bold",description:"Toggle bold formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.boldDescription",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",nameKey:"dialogs.keyboardShortcuts.shortcuts.italic",description:"Toggle italic formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.italicDescription",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",nameKey:"dialogs.keyboardShortcuts.shortcuts.underline",description:"Toggle underline formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.underlineDescription",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",nameKey:"dialogs.keyboardShortcuts.shortcuts.strikethrough",description:"Toggle strikethrough",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.strikethroughDescription",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.subscript",description:"Toggle subscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.subscriptDescription",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.superscript",description:"Toggle superscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.superscriptDescription",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignLeft",description:"Left align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignLeftDescription",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignCenter",description:"Center align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignCenterDescription",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignRight",description:"Right align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignRightDescription",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",nameKey:"dialogs.keyboardShortcuts.shortcuts.justify",description:"Justify paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.justifyDescription",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndent",description:"Increase paragraph indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndentDescription",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndent",description:"Decrease paragraph indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndentDescription",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectAll",description:"Select all content",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectAllDescription",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectWord",description:"Select current word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectWordDescription",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraph",description:"Select current paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraphDescription",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionByWord",description:"Extend selection to next/previous word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionByWordDescription",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",nameKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionToLineEdge",description:"Extend selection to line start/end",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionToLineEdgeDescription",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveByWord",description:"Move cursor to next/previous word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveByWordDescription",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStart",description:"Move cursor to start of line",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStartDescription",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEnd",description:"Move cursor to end of line",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEndDescription",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStart",description:"Move cursor to start of document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStartDescription",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEnd",description:"Move cursor to end of document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEndDescription",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",nameKey:"dialogs.keyboardShortcuts.shortcuts.pageUp",description:"Scroll up one page",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pageUpDescription",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",nameKey:"dialogs.keyboardShortcuts.shortcuts.pageDown",description:"Scroll down one page",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pageDownDescription",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomIn",description:"Increase zoom level",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomInDescription",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomOut",description:"Decrease zoom level",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomOutDescription",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",nameKey:"dialogs.keyboardShortcuts.shortcuts.resetZoom",description:"Reset zoom to 100%",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.resetZoomDescription",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",nameKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcuts",description:"Show this help dialog",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcutsDescription",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function En(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function tt(e){return En()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var In=({shortcut:e,translatedName:t,translatedDescription:o})=>{let i=tt(e.keys),n=e.altKeys?tt(e.altKeys):null;return 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:[jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:t}),jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:o})]}),jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[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:i}),n&&jsxs(Fragment,{children:[jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),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:n})]})]})]})},ua=({isOpen:e,onClose:t,customShortcuts:o=[],showSearch:i=true,className:n=""})=>{let{t:r}=b(),s=useRef(null),c=useRef(null),[l,a]=useState(""),m=useMemo(()=>{let p=[...Ne];for(let u of o){let g=p.findIndex(x=>x.id===u.id);g>=0?p[g]=u:p.push(u);}return p},[o]),b$1=useMemo(()=>{if(!l.trim())return m;let p=l.toLowerCase();return m.filter(u=>{let g=u.nameKey?r(u.nameKey):u.name,x=u.descriptionKey?r(u.descriptionKey):u.description;return g.toLowerCase().includes(p)||x.toLowerCase().includes(p)||u.keys.toLowerCase().includes(p)||u.altKeys&&u.altKeys.toLowerCase().includes(p)})},[m,l,r]),h=useMemo(()=>{let p=new Map;for(let g of b$1){let x=p.get(g.category)||[];x.push(g),p.set(g.category,x);}let u=[];for(let g of Bt){let x=p.get(g);x&&x.length>0&&u.push({category:g,shortcuts:x});}return u},[b$1]);return useEffect(()=>{e&&i&&c.current&&setTimeout(()=>c.current?.focus(),0);},[e,i]),useEffect(()=>{e||a("");},[e]),useEffect(()=>{if(!e)return;let p=u=>{s.current&&!s.current.contains(u.target)&&t();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,t]),useEffect(()=>{if(!e)return;let p=u=>{u.key==="Escape"&&t();};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),e?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:jsxs("div",{ref:s,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":r("dialogs.keyboardShortcuts.ariaLabel"),children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:r("dialogs.keyboardShortcuts.ariaLabel")}),jsx("button",{type:"button",onClick:t,"aria-label":r("common.closeDialog"),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:jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),i&&jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsx("input",{ref:c,type:"text",value:l,onChange:p=>a(p.target.value),placeholder:r("dialogs.keyboardShortcuts.searchPlaceholder"),style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:h.length===0?jsx("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:r("dialogs.keyboardShortcuts.noResults",{query:l})}):h.map(({category:p,shortcuts:u})=>jsxs("div",{style:{marginBottom:"24px"},children:[jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:r(Nt[p])}),jsx("div",{children:u.map(g=>jsx(In,{shortcut:g,translatedName:g.nameKey?r(g.nameKey):g.name,translatedDescription:g.descriptionKey?r(g.descriptionKey):g.description},g.id))})]},p))}),jsx("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:(()=>{let u=r("dialogs.keyboardShortcuts.pressEscToClose",{key:"Esc"}).split("Esc");return jsxs(Fragment,{children:[u[0],jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"}),u[1]]})})()})]})}):null};function ga(e={}){let{enabled:t=true,openShortcut:o="Ctrl+/"}=e,[i,n]=useState(false),r=useCallback(()=>{t&&n(true);},[t]),s=useCallback(()=>{n(false);},[]),c=useCallback(()=>{n(a=>!a);},[]),l=useCallback(a=>{if(!t)return;if((a.ctrlKey||a.metaKey)&&(a.key==="/"||a.key==="?")){a.preventDefault(),c();return}if(a.key==="F1"){a.preventDefault(),r();return}},[t,c,r]);return useEffect(()=>{if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,l]),{isOpen:i,open:r,close:s,toggle:c,handleKeyDown:l}}function ma(){return [...Ne]}function ha(e){return Ne.filter(t=>t.category===e)}function xa(){return Ne.filter(e=>e.common)}function ba(e){return Nt[e]}function fa(){return [...Bt]}function ya(e){return tt(e)}
|
|
111
|
+
export{As as $,Hi as A,Xi as B,Qi as C,Ji as D,qi as E,es as F,ts as G,os as H,dr as I,ss as J,as as K,ls as L,cs as M,ds as N,xs as O,bs as P,fs as Q,ys as R,vs as S,Ss as T,Cs as U,Is as V,Ls as W,Rs as X,Ds as Y,Ks as Z,Os as _,On as a,Ms as aa,An as b,_s as ba,Mn as c,Ce as ca,_n as d,Ys as da,Nn as e,Us as ea,Bn as f,Hs as fa,Vn as g,Vs as ga,$n as h,$s as ha,Gn as i,Gs as ia,jn as j,js as ja,oi as k,ta as ka,si as l,oa as la,ai as m,ra as ma,li as n,na,ci as o,ia as oa,di as p,sa as pa,pi as q,ua as qa,ui as r,ga as ra,gi as s,ma as sa,ki as t,ha as ta,Oi as u,xa as ua,Fi as v,ba as va,zi as w,fa as wa,Wi as x,ya as xa,Yi as y,Ui as z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createContext,useMemo,useContext,useCallback}from'react';import {jsx}from'react/jsx-runtime';var p={_lang:"en",common:{cancel:"Cancel",insert:"Insert",apply:"Apply",close:"Close",delete:"Delete",update:"Update",save:"Save",retry:"Retry",send:"Send",edit:"Edit",comment:"Comment",reply:"Reply",accept:"Accept",reject:"Reject",dismiss:"Dismiss",change:"Change",px:"px",closeDialog:"Close dialog"},toolbar:{ariaLabel:"Formatting toolbar",file:"File",format:"Format",insert:"Insert",print:"Print",printShortcut:"Ctrl+P",pageSetup:"Page setup",leftToRight:"Left-to-right text",rightToLeft:"Right-to-left text",image:"Image",table:"Table",pageBreak:"Page break",tableOfContents:"Table of contents",symbol:"Symbol"},formattingBar:{groups:{history:"History",zoom:"Zoom",styles:"Styles",font:"Font",textFormatting:"Text formatting",script:"Script",alignment:"Alignment",listFormatting:"List formatting",image:"Image",table:"Table"},undo:"Undo",undoShortcut:"Undo (Ctrl+Z)",redo:"Redo",redoShortcut:"Redo (Ctrl+Y)",bold:"Bold",boldShortcut:"Bold (Ctrl+B)",italic:"Italic",italicShortcut:"Italic (Ctrl+I)",underline:"Underline",underlineShortcut:"Underline (Ctrl+U)",strikethrough:"Strikethrough",fontColor:"Font Color",highlightColor:"Text Highlight Color",insertLink:"Insert link",insertLinkShortcut:"Insert link (Ctrl+K)",superscript:"Superscript",superscriptShortcut:"Superscript (Ctrl+Shift+=)",subscript:"Subscript",subscriptShortcut:"Subscript (Ctrl+=)",imageProperties:"Image properties",imagePropertiesShortcut:"Image properties (alt text, border)...",clearFormatting:"Clear formatting"},alignment:{alignLeft:"Align Left",alignLeftShortcut:"Ctrl+L",center:"Center",centerShortcut:"Ctrl+E",alignRight:"Align Right",alignRightShortcut:"Ctrl+R",justify:"Justify",justifyShortcut:"Ctrl+J"},lists:{ariaLabel:"List formatting",typeAriaLabel:"List type",indentationAriaLabel:"List indentation",bulletList:"Bullet List",numberedList:"Numbered List",decreaseIndent:"Decrease Indent",increaseIndent:"Increase Indent"},lineSpacing:{single:"Single",double:"Double",lineSpacingTitle:"Line spacing: {label}",paragraphSpacing:"Paragraph spacing"},styles:{selectAriaLabel:"Select paragraph style",normalText:"Normal text",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},font:{selectAriaLabel:"Select font family",sansSerif:"Sans Serif",serif:"Serif",monospace:"Monospace"},fontSize:{decrease:"Decrease font size",increase:"Increase font size",label:"Font size",listLabel:"Font sizes"},zoom:{ariaLabel:"Zoom: {label}"},colorPicker:{ariaLabel:"{type} color picker",highlightColors:"Highlight Colors",customColor:"Custom Color",noColor:"No Color",automatic:"Automatic",themeColors:"Theme Colors",standardColors:"Standard Colors",colors:{black:"Black",darkRed:"Dark Red",red:"Red",orange:"Orange",yellow:"Yellow",darkYellow:"Dark Yellow",green:"Green",darkGreen:"Dark Green",teal:"Teal",darkTeal:"Dark Teal",blue:"Blue",darkBlue:"Dark Blue",purple:"Purple",darkPurple:"Dark Purple",brown:"Brown",grey50:"Grey 50%",grey25:"Grey 25%",grey10:"Grey 10%",white:"White",lightRed:"Light Red",lightOrange:"Light Orange",lightYellow:"Light Yellow",lightGreen:"Light Green",lightBlue:"Light Blue",lightPurple:"Light Purple",pink:"Pink",rose:"Rose",gold:"Gold",aqua:"Aqua",lavender:"Lavender",silver:"Silver",darkOrange:"Dark Orange",darkGray:"Dark Gray",gray:"Gray",cyan:"Cyan",magenta:"Magenta",paleGreen:"Pale Green",lightCyan:"Light Cyan",skyBlue:"Sky Blue",lightBlue2:"Light Blue 2",lightMagenta:"Light Magenta",brightGreen:"Bright Green",violet:"Violet"}},dialogs:{findReplace:{titleFind:"Find",titleFindReplace:"Find and Replace",findLabel:"Find:",findPlaceholder:"Enter text to find...",findAriaLabel:"Find text",findPrevious:"Find previous",findPreviousTitle:"Find Previous (Shift+Enter)",findNext:"Find next",findNextTitle:"Find Next (Enter)",matchCount:"{current} of {total} matches",noResults:"No results found",replaceLabel:"Replace:",replacePlaceholder:"Enter replacement text...",replaceAriaLabel:"Replace text",replaceButton:"Replace",replaceCurrentTitle:"Replace current match",replaceAllButton:"Replace All",replaceAllTitle:"Replace all matches",matchCase:"Match case",wholeWords:"Whole words",toggleReplace:"+ Replace"},hyperlink:{titleEdit:"Edit Hyperlink",titleInsert:"Insert Hyperlink",tabWebAddress:"Web Address",tabBookmark:"Bookmark",urlLabel:"URL",urlPlaceholder:"https://example.com",urlHint:"Enter a web address, email (mailto:), or phone (tel:)",bookmarkLabel:"Bookmark",bookmarkPlaceholder:"Select a bookmark...",displayTextLabel:"Display Text",displayTextPlaceholder:"Text to display (optional)",displayTextHint:"Leave empty to use the selected text",tooltipLabel:"Tooltip (optional)",tooltipPlaceholder:"Text shown on hover",removeLink:"Remove Link",invalidUrl:"Please enter a valid URL",urlRequired:"URL is required"},insertTable:{title:"Insert Table",hoverToSelect:"Hover to select size",tableSize:"{cols} x {rows} Table",orSpecifySize:"or specify size",rowsLabel:"Rows:",columnsLabel:"Columns:",insertButton:"Insert Table",sizeSelector:"Table size selector"},insertImage:{title:"Insert Image",uploadAriaLabel:"Click or drag to upload image",uploadText:"Click to select or drag and drop an image",uploadSubtext:"PNG, JPG, GIF up to 10MB",dimensions:"Dimensions",widthLabel:"Width:",heightLabel:"Height:",aspectRatioLocked:"Aspect ratio locked",aspectRatioUnlocked:"Aspect ratio unlocked",altTextLabel:"Alt Text (optional)",altTextPlaceholder:"Describe the image for accessibility",insertButton:"Insert Image",invalidFile:"Please select a valid image file",fileTooLarge:"Image file is too large (max 10MB)",readFailed:"Failed to read image file",loadFailed:"Failed to load image",preview:"Preview"},insertSymbol:{title:"Insert Symbol",searchPlaceholder:"Search symbols (character or Unicode)...",noResults:'No symbols found for "{query}"',decimal:"Decimal: {value}",categories:{common:"Common",arrows:"Arrows",math:"Math",greek:"Greek",shapes:"Shapes",punctuation:"Punctuation",currency:"Currency",music:"Music",emoji:"Emoji"}},imageProperties:{title:"Image Properties",altText:"Alt Text",altTextPlaceholder:"Describe this image for accessibility...",border:"Border",width:"Width",style:"Style",color:"Color",preview:"Preview",borderStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset"}},imagePosition:{title:"Image Position",horizontal:"Horizontal",vertical:"Vertical",position:"Position",alignment:"Alignment",offset:"Offset",offsetPx:"Offset (px)",align:"Align",relativeTo:"Relative to",alignOptions:{left:"Left",center:"Center",right:"Right",top:"Top",bottom:"Bottom"},relativeOptions:{page:"Page",column:"Column",margin:"Margin",character:"Character",paragraph:"Paragraph",line:"Line"}},pageSetup:{title:"Page Setup",pageSize:"PAGE SIZE",sizeLabel:"Size",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"MARGINS",top:"Top",bottom:"Bottom",left:"Left",right:"Right",pageSizes:{letter:'Letter (8.5" \xD7 11")',a4:'A4 (8.27" \xD7 11.69")',legal:'Legal (8.5" \xD7 14")',a3:'A3 (11.69" \xD7 16.54")',a5:'A5 (5.83" \xD7 8.27")',b5:'B5 (6.93" \xD7 9.84")',executive:'Executive (7.25" \xD7 10.5")'}},tableProperties:{title:"Table Properties",widthType:"Width type",widthLabel:"Width",alignmentLabel:"Alignment",widthTypes:{auto:"Auto",fixed:"Fixed (twips)",percentage:"Percentage"},units:{fiftiethsPercent:"(50ths of %)",twips:"tw"},alignOptions:{left:"Left",center:"Center",right:"Right"}},pasteSpecial:{title:"Paste Special",keepFormatting:"Keep Source Formatting",keepFormattingDescription:"Paste with original formatting",keepFormattingShortcut:"Ctrl+V",plainText:"Paste as Plain Text",plainTextDescription:"Paste without any formatting",plainTextShortcut:"Ctrl+Shift+V",readingClipboard:"Reading clipboard...",preview:"Preview:",noContent:"No content available to paste",clipboardError:"Unable to read clipboard. Please use Ctrl+V to paste."},footnoteProperties:{title:"Footnote & Endnote Properties",footnotes:"Footnotes",endnotes:"Endnotes",position:"Position",numberFormat:"Number format",startAt:"Start at",numbering:"Numbering",footnotePositions:{bottomOfPage:"Bottom of page",belowText:"Below text"},endnotePositions:{endOfDocument:"End of document",endOfSection:"End of section"},numberingOptions:{continuous:"Continuous",restartSection:"Restart each section",restartPage:"Restart each page"},formats:{decimal:"1, 2, 3, ...",lowerRoman:"i, ii, iii, ...",upperRoman:"I, II, III, ...",lowerAlpha:"a, b, c, ...",upperAlpha:"A, B, C, ...",symbols:"*, \u2020, \u2021, ..."}},keyboardShortcuts:{ariaLabel:"Keyboard Shortcuts",searchPlaceholder:"Search shortcuts...",categories:{editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},shortcuts:{save:"Save",saveDescription:"Save document",print:"Print",printDescription:"Print document",undo:"Undo",undoDescription:"Undo last action",redo:"Redo",redoDescription:"Redo last action",delete:"Delete",deleteDescription:"Delete selected text",find:"Find",findDescription:"Find text in document",findReplace:"Find & Replace",findReplaceDescription:"Find and replace text",cut:"Cut",cutDescription:"Cut selected text",copy:"Copy",copyDescription:"Copy selected text",paste:"Paste",pasteDescription:"Paste from clipboard",pastePlainText:"Paste as Plain Text",pastePlainTextDescription:"Paste without formatting",bold:"Bold",boldDescription:"Toggle bold formatting",italic:"Italic",italicDescription:"Toggle italic formatting",underline:"Underline",underlineDescription:"Toggle underline formatting",strikethrough:"Strikethrough",strikethroughDescription:"Toggle strikethrough",subscript:"Subscript",subscriptDescription:"Toggle subscript",superscript:"Superscript",superscriptDescription:"Toggle superscript",alignLeft:"Align Left",alignLeftDescription:"Left align paragraph",alignCenter:"Align Center",alignCenterDescription:"Center align paragraph",alignRight:"Align Right",alignRightDescription:"Right align paragraph",justify:"Justify",justifyDescription:"Justify paragraph",increaseIndent:"Increase Indent",increaseIndentDescription:"Increase paragraph indent",decreaseIndent:"Decrease Indent",decreaseIndentDescription:"Decrease paragraph indent",selectAll:"Select All",selectAllDescription:"Select all content",selectWord:"Select Word",selectWordDescription:"Select current word",selectParagraph:"Select Paragraph",selectParagraphDescription:"Select current paragraph",extendSelectionByWord:"Extend Selection by Word",extendSelectionByWordDescription:"Extend selection to next/previous word",extendSelectionToLineEdge:"Extend Selection to Line Edge",extendSelectionToLineEdgeDescription:"Extend selection to line start/end",moveByWord:"Move by Word",moveByWordDescription:"Move cursor to next/previous word",moveToLineStart:"Move to Line Start",moveToLineStartDescription:"Move cursor to start of line",moveToLineEnd:"Move to Line End",moveToLineEndDescription:"Move cursor to end of line",moveToDocumentStart:"Move to Document Start",moveToDocumentStartDescription:"Move cursor to start of document",moveToDocumentEnd:"Move to Document End",moveToDocumentEndDescription:"Move cursor to end of document",pageUp:"Page Up",pageUpDescription:"Scroll up one page",pageDown:"Page Down",pageDownDescription:"Scroll down one page",zoomIn:"Zoom In",zoomInDescription:"Increase zoom level",zoomOut:"Zoom Out",zoomOutDescription:"Decrease zoom level",resetZoom:"Reset Zoom",resetZoomDescription:"Reset zoom to 100%",keyboardShortcuts:"Keyboard Shortcuts",keyboardShortcutsDescription:"Show this help dialog"},noResults:'No shortcuts found matching "{query}"',pressEscToClose:"Press {key} to close",or:"or"}},comments:{resolved:"Resolved",resolve:"Resolve",reopen:"Reopen",moreOptions:"More options",unknown:"Unknown",addComment:"Add a comment...",replyPlaceholder:"Reply or add others with @",replyCount:"{count, plural, one {# reply} other {# replies}}"},trackedChanges:{unknown:"Unknown",replaced:"Replaced",with:"with",added:"Added",deleted:"Deleted"},contextMenu:{ariaLabel:"AI actions menu",textMenuAriaLabel:"Text editing menu",customPromptPlaceholder:"Enter custom prompt...",cut:"Cut",cutShortcut:"Ctrl+X",copy:"Copy",copyShortcut:"Ctrl+C",paste:"Paste",pasteShortcut:"Ctrl+V",pastePlainText:"Paste as Plain Text",pastePlainTextShortcut:"Ctrl+Shift+V",delete:"Delete",deleteShortcut:"Del",selectAll:"Select All",selectAllShortcut:"Ctrl+A",selected:"Selected:",aiActions:{askAi:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom"}},documentOutline:{ariaLabel:"Document outline",closeAriaLabel:"Close outline",closeTitle:"Close outline",title:"Outline",noHeadings:"No headings found. Add headings to your document to see them here."},sidebar:{ariaLabel:"Annotations sidebar"},titleBar:{untitled:"Untitled",documentNameAriaLabel:"Document name",menuBarAriaLabel:"Menu bar"},errors:{loadingDocument:"Loading document...",noDocumentLoaded:"No document loaded",failedToLoad:"Failed to Load Document",unableToParse:"Unable to Parse Document",somethingWentWrong:"Something went wrong",errorDescription:"An error occurred while rendering this component. Please try again or contact support if the problem persists.",errorLabel:"Error:",componentStack:"Component Stack:",tryAgain:"Try Again",showDetails:"Show details",hideDetails:"Hide details",unsavedChanges:"You have unsaved changes. Are you sure you want to leave?"},table:{insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",mergeCells:"Merge cells",splitCell:"Split cell",editingTools:"Table editing tools",label:"Table:",cellFillColor:"Cell Fill Color",borderColor:"Border Color",borderWidth:"Border width",unknownAction:"Unknown Action",borders:{all:"All borders",outside:"Outside borders",inside:"Inside borders",none:"No borders",remove:"Remove borders",top:"Top border",bottom:"Bottom border",left:"Left border",right:"Right border",styleAriaLabel:"Border style",tooltip:"Borders"},moreOptions:"More table options",styles:{title:"Table Styles",label:"Styles",normalTable:"Normal Table",tableGrid:"Table Grid",gridTableLight:"Grid Table Light",plainTable1:"Plain Table 1",plainTable2:"Plain Table 2",plainTable3:"Plain Table 3",plainTable4:"Plain Table 4",gridTable1Light:"Grid Table 1 Light",gridTable4Accent1:"Grid Table 4 Accent 1",gridTable5Dark:"Grid Table 5 Dark",listTable3Accent2:"List Table 3 Accent 2",listTable4Accent3:"List Table 4 Accent 3",gridTable4Accent5:"Grid Table 4 Accent 5",gridTable4Accent6:"Grid Table 4 Accent 6"}},tableAdvanced:{verticalAlignment:"Vertical alignment",top:"Top",middle:"Middle",bottom:"Bottom",cellMargins:"Cell margins",textDirection:"Text direction",textDirections:{horizontal:"Horizontal (LR)",verticalRL:"Vertical (top-bottom, RL)",verticalLR:"Vertical (bottom-top, LR)"},toggleNoWrap:"Toggle no-wrap",rowHeight:"Row height",heightRules:{auto:"Auto",atLeast:"At least",exact:"Exact"},rule:"Rule",height:"Height",toggleHeaderRow:"Toggle header row",distributeColumns:"Distribute columns evenly",autoFit:"Auto-fit to contents",tableProperties:"Table properties...",tableAlignment:"Table alignment",alignTableLeft:"Align table left",alignTableCenter:"Align table center",alignTableRight:"Align table right",tableOptionsMenu:"Table options menu",tableOptions:"Table options"},imageTransform:{tooltip:"Transform",rotateClockwise:"Rotate clockwise",rotateCounterClockwise:"Rotate counter-clockwise",flipHorizontal:"Flip horizontal",flipVertical:"Flip vertical"},imageWrap:{inline:"Inline with text",floatLeft:"Float left (wrap right)",floatRight:"Float right (wrap left)",topAndBottom:"Top and bottom",behindText:"Behind text",inFrontOfText:"In front of text",tooltipPrefix:"Wrap: {label}"},responsePreview:{loading:"{action}...",result:"{action} Result",closeEsc:"Close (Esc)",editPrompt:"Edit the result before accepting:",changes:"Changes:",original:"Original:",new:"New:",cancelEdit:"Cancel Edit"},commentMarkers:{resolvedComment:"Resolved comment",comment:"Comment"},editor:{toggleCommentsSidebar:"Toggle comments sidebar",showDocumentOutline:"Show document outline",editing:"Editing",editingDescription:"Edit document directly",suggesting:"Suggesting",suggestingDescription:"Edits become suggestions",viewing:"Viewing",viewingDescription:"Read-only, no edits",failedToParse:"Failed to parse document",linkRemoved:"Link removed",linkCopied:"Link copied to clipboard",failedToSave:"Failed to save document"},hyperlinkPopup:{displayTextPlaceholder:"Display text",urlPlaceholder:"https://example.com",copyLink:"Copy link",editLink:"Edit link",removeLink:"Remove link"},headerFooter:{header:"Header",footer:"Footer",options:"Options",insertPageNumber:"Insert current page number",insertTotalPages:"Insert total page count",remove:"Remove {label}",closeEditing:"Close {label} editing"},image:{placeholder:"Image placeholder",placeholderText:"[Image]",editableAriaLabel:"Editable image"},ruler:{horizontal:"Horizontal ruler",vertical:"Vertical ruler",firstLineIndent:"First line indent",leftIndent:"Left indent",rightIndent:"Right indent",topMargin:"Top margin",bottomMargin:"Bottom margin"},print:{label:"Print",allPages:"All ({totalPages} pages)",singlePage:"Page {start}",pageRange:"Pages {start}-{end}"},unsaved:{unsaved:"Unsaved",saved:"Saved",unsavedTitle:"Document has unsaved changes",savedTitle:"All changes saved",unsavedAriaLabel:"Unsaved changes",savedAriaLabel:"All changes saved"},loading:{label:"Loading"}};var b=p,f=createContext(b),T=createContext("en");function d(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function y(e,o){if(!o)return e;let t={...e};for(let r of Object.keys(o)){let i=o[r];i!==null&&(d(e[r])&&d(i)?t[r]=y(e[r],i):i!==void 0&&(t[r]=i));}return t}function v(e,o){let t=e;for(let r of o.split(".")){if(!d(t))return;t=t[r];}return typeof t=="string"?t:void 0}function C(e){let o={},t=/(=\d+|\w+)\s*\{([^}]*)\}/g,r;for(;(r=t.exec(e))!==null;)o[r[1]]=r[2];return o}function R(e,o,t){return o?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(i,n,l)=>{let a=Number(o[n]);if(isNaN(a))return i;let s=C(l),g=s[`=${a}`];if(g!==void 0)return g.replace(/#/g,String(a));let c;try{c=new Intl.PluralRules(t||"en").select(a);}catch{c=a===1?"one":"other";}return (s[c]??s.other??"").replace(/#/g,String(a))}).replace(/\{(\w+)\}/g,(i,n)=>{let l=o[n];return l!==void 0?String(l):`{${n}}`}):e}function x({i18n:e,children:o}){let t=e,r=typeof t?._lang=="string"?t._lang:"en",i=useMemo(()=>y(b,t),[t]);return jsx(T.Provider,{value:r,children:jsx(f.Provider,{value:i,children:o})})}function A(){let e=useContext(f),o=useContext(T);return {t:useCallback((r,i)=>{let n=v(e,r);return R(n??r,i,o)},[e,o])}}
|
|
2
|
+
export{x as a,A as b};
|