@docx-editor.dev/react 2.30.0 → 2.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +753 -68
- package/dist/index.d.ts +753 -68
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var Et=require('react'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),editor=require('@docx-editor.dev/core/editor'),store=require('@docx-editor.dev/core/store'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),we=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Et__namespace=/*#__PURE__*/_interopNamespace(Et);var we__namespace=/*#__PURE__*/_interopNamespace(we);var fm={version:"2.30.0"};var Qy=fm.version;var dc=Et.createContext(i18n.en),uc=Et.createContext("en");function Un({i18n:e,children:t}){let o=Et.useContext(dc),n=Et.useContext(uc),r=typeof e?._lang=="string"?e._lang:n,i=Et.useMemo(()=>i18n.deepMerge(o,e),[o,e]);return jsxRuntime.jsx(uc.Provider,{value:r,children:jsxRuntime.jsx(dc.Provider,{value:i,children:t})})}function N(){let e=Et.useContext(dc),t=Et.useContext(uc);return {t:Et.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function vm(e){let{t}=N();return Et.useCallback((o,n)=>e?.get(o)??t(o,n),[e,t])}var pc=Et.createContext(null);function H(){return Et.useContext(pc)}var Ct=Et.createContext(null);var mc=0,fc=false,gc=false;function xm(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(fc||(fc=true,mc+=1,queueMicrotask(()=>{fc=false;}),gc||(gc=true,setTimeout(()=>{gc=false,mc=0;},0))),mc>16)}function Cm(e){let t=false;return ()=>{if(t)return;t=true;let o=()=>{t=false,e();};xm()?setTimeout(o,0):queueMicrotask(o);}}var lx=()=>{},bc=0;function sx(){return bc}function $r(e){return Cm(e)}function B(e,t=Object.is,o){let n=H(),r=o?.onSubscribe,i=o?.onUnsubscribe,a=Et.useCallback(d=>{if(!n)return lx;let f=false;bc++,r?.();let u=$r(()=>{f||d();}),g=[n.on("change",u),n.on("selectionChange",u),n.on("error",u)];return ()=>{f=true,bc--,i?.();for(let m of g)m();}},[n,r,i]),s=Et.useMemo(()=>{let d=false,f,u;return g=>{if(d&&g===f)return u;let m=e(g);return d&&t(u,m)?(f=g,u):(d=true,f=g,u=m,m)}},[n,e,t]),l=Et.useCallback(()=>s(n?n.snapshot():editor.LOADING_SNAPSHOT),[n,s]),c=Et.useCallback(()=>s(editor.LOADING_SNAPSHOT),[s]);return Et.useSyncExternalStore(a,l,c)}function px(e,t){return typeof t!="function"?e:typeof e!="function"?t:o=>{e(o),o.defaultPrevented||t(o);}}function mx(e,t){let o={...e,...t};for(let n of Object.keys(e))/^on[A-Z]/.test(n)?o[n]=px(t[n],e[n]):n==="className"?o[n]=[e[n],t[n]].filter(Boolean).join(" "):n==="style"&&(o[n]={...e[n],...t[n]});return o}function G({children:e,...t}){let o=Et.Children.only(e);if(!Et.isValidElement(o))return null;let n=o.props,r=mx(t,n),i=o.ref,a=t.ref;return (i||a)&&(r.ref=s=>{for(let l of [i,a])typeof l=="function"?l(s):l&&typeof l=="object"&&(l.current=s);}),Et.cloneElement(o,r)}var Sm=e=>{let t=e["data-docx-part"];return typeof t=="string"?t==="field"?`field:${e["data-docx-field"]}`:t:null};function ko(){let e=Et.createContext(null),t=new Map,o=y=>{let x=t.get(y.type);return x==="field"?`field:${y.props.name}`:x};function n(y,x){Et.Children.forEach(y,b=>{Et.isValidElement(b)&&(x(b),n(b.props.children,x));});}function r(){let y=Et.useContext(e);if(!y)throw new globalThis.Error("Dialog controls must be rendered inside their dialog.");return y.state}function i(y,x){return Et.Children.map(y,b=>{if(!Et.isValidElement(b))return b;let h=Sm(b.props);return h&&x.has(h)?x.get(h):b.props.children===void 0?b:Et.cloneElement(b,{children:i(b.props.children,x)})})}function a(y){function x(b){let h=Et.useContext(e);if(!h||b.hidden)return null;let C=y==="field"?`field:${b.name}`:y,T=h.defaults.get(C);if(!T)return b.children??null;let{children:S,asChild:P,className:k,style:w,hidden:E,name:D,...A}=b,_={...A,...T.props,className:[T.props.className,k].filter(Boolean).join(" "),style:{...T.props.style,...w}};if(P){let{children:F,className:M,style:I,...U}=_;return jsxRuntime.jsx(G,{...U,...k?{className:k}:{},...w?{style:w}:{},children:S})}return Et.cloneElement(T,_,S===void 0?i(T.props.children,h.overrides):S)}return t.set(x,y),x}let s=a("header"),l=a("title"),c=a("body"),d=a("footer"),f=a("apply"),u=a("cancel"),g=a("reset"),m=a("error"),p=a("field");function v({defaults:y,children:x,preset:b=true,state:h}){let C=new Map;n(y,k=>{let w=Sm(k.props);w&&C.set(w,k);});let T=new Map;n(x,k=>{let w=o(k);w&&T.set(w,k);});let S=k=>Et.Children.toArray(k).flatMap(w=>Et.isValidElement(w)&&w.type===Et.Fragment?S(w.props.children):[w]),P=S(x).filter(k=>!Et.isValidElement(k)||!o(k));return jsxRuntime.jsx(e.Provider,{value:{defaults:C,overrides:T,state:h},children:b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i(y,T),P]}):x})}return {Header:s,Title:l,Body:c,Footer:d,Apply:f,Cancel:u,Reset:g,Error:m,Field:p,Composition:v,useState:r}}function pt({kind:e,role:t="dialog",className:o,style:n,label:r,onClose:i,onKeyDown:a,panelRef:s,children:l,dismissOutside:c=true,sessionSignal:d,restoreFocus:f=true}){let u=Et.useRef(null),g=s??u,m=Et.useRef(i);return m.current=i,Et.useLayoutEffect(()=>{let p=g.current;if(!p)return;p.parentElement?.closest(".docx-editor")||p.classList.add("docx-editor");let v=p.ownerDocument.activeElement,y=()=>{p.open&&p.close?.();};return d?.addEventListener("abort",y),typeof p.showModal=="function"?p.showModal():p.setAttribute("open",""),p.querySelector('input:not([disabled]),select:not([disabled]),button:not([disabled]),[tabindex="0"]')?.focus({preventScroll:true}),()=>{d?.removeEventListener("abort",y),typeof p.close=="function"&&p.open&&p.close(),f&&v?.isConnected&&v.focus({preventScroll:true});}},[g,d,f]),jsxRuntime.jsx("dialog",{ref:g,role:t,"aria-modal":"true","aria-label":r,className:`docx-dialog${o?` ${o}`:""}`,style:n,"data-docx-dialog":e,onCancel:p=>{p.preventDefault(),m.current();},onMouseDown:p=>p.stopPropagation(),onClick:p=>{if(c&&p.target===p.currentTarget){let v=p.currentTarget.getBoundingClientRect();(p.clientX<v.left||p.clientX>v.right||p.clientY<v.top||p.clientY>v.bottom)&&m.current();}p.stopPropagation();},onKeyDown:p=>{p.key==="Escape"&&!p.nativeEvent.isComposing?(p.preventDefault(),m.current()):editor.trapTabWithin(p.currentTarget,p.nativeEvent)?p.preventDefault():!p.nativeEvent.isComposing&&!p.defaultPrevented&&a?.(p),p.stopPropagation();},children:l})}function Ai(e,t){let o=H(),n=Cc(),r=Et.useRef(null);return Et.useEffect(()=>{if(!e){r.current=null;return}o?.surface&&(r.current===null?r.current=o.mountGeneration:r.current!==o.mountGeneration&&t());},[e,o,n,t]),()=>!!o?.surface&&r.current===o.mountGeneration}function Cc(){let e=H(),t=Et.useCallback(o=>{if(!e)return ()=>{};let n=true,r=$r(()=>{n&&o();}),i=[e.on("change",r),e.on("selectionChange",r),e.on("error",r)];return ()=>{n=false,i.forEach(a=>a());}},[e]);return Et.useSyncExternalStore(t,()=>e?.mountGeneration??0,()=>0)}function Em(){let e=0,t=0,o=null,n=new Set,r=new Set,i=new Set,a=s=>{for(let l of [...s])l();};return {getShift:()=>e,setShift(s){let l=Math.max(0,Math.round(s));l!==e&&(e=l,a(n));},subscribeShift(s){return n.add(s),()=>n.delete(s)},getReservation:()=>t,setReservation(s){let l=Math.max(0,Math.round(s));l!==t&&(t=l,a(r));},subscribeReservation(s){return r.add(s),()=>r.delete(s)},getViewport:()=>o,setViewport(s){s!==o&&(o=s,a(i));},subscribeViewport(s){return i.add(s),()=>i.delete(s)}}}var Pc=Et.createContext(null);function rn(){return Et.useContext(Pc)}var wm=()=>0,Sc=()=>()=>{};function an(){let e=rn(),t=Et.useCallback(n=>e?e.subscribeShift(n):Sc(),[e]),o=Et.useCallback(()=>e?e.getShift():0,[e]);return Et.useSyncExternalStore(t,o,wm)}function Mm(){let e=rn(),t=Et.useCallback(n=>e?e.subscribeReservation(n):Sc(),[e]),o=Et.useCallback(()=>e?e.getReservation():0,[e]);return Et.useSyncExternalStore(t,o,wm)}function Ye(){let e=rn(),t=Et.useCallback(r=>e?e.subscribeViewport(r):Sc(),[e]),o=Et.useCallback(()=>e?e.getViewport():null,[e]),n=Et.useCallback(()=>null,[]);return Et.useSyncExternalStore(t,o,n)}function go(e,t,o){let n=Ye(),r=Et.useRef({close:o,viewport:n});r.current={close:o,viewport:n},Et.useEffect(()=>{let i=e.current;if(!(!t||!i))return kx(i,()=>r.current.close(),()=>r.current.viewport)},[e,t]);}function kx(e,t,o){let n=s=>{if(s.defaultPrevented||s.altKey||s.ctrlKey||s.metaKey)return;let l=s.target;if(l.matches('input[role="combobox"]')||l.matches("input, textarea, select")&&s.key!=="ArrowDown"&&s.key!=="ArrowUp")return;let d=Array.from(e.querySelectorAll('[role="option"]')).filter(g=>!g.matches(':disabled, [aria-disabled="true"]'));if(d.length===0)return;let f=d.indexOf(l),u;if(s.key==="Home")u=0;else if(s.key==="End")u=d.length-1;else if(s.key==="ArrowDown")u=(f+1)%d.length;else if(s.key==="ArrowUp")u=f<0?d.length-1:(f-1+d.length)%d.length;else return;s.preventDefault(),s.stopPropagation(),d[u]?.focus();},r=s=>{s.relatedTarget instanceof Node&&!e.contains(s.relatedTarget)&&t();},i=editor.listenForPopupEscape({popup:e,contains:s=>e.contains(s),chromeRoot:()=>e.closest(".docx-editor"),editorElements:()=>[o()],skip:s=>s.target instanceof Element&&e.contains(s.target)&&s.target.matches('input[role="combobox"]'),close:s=>{s&&e.querySelector("[aria-haspopup]")?.focus(),t();}}),a=editor.listenForPopupFocusLeave({popup:e,contains:s=>e.contains(s),close:t});return e.addEventListener("keydown",n),e.addEventListener("focusout",r),()=>{e.removeEventListener("keydown",n),e.removeEventListener("focusout",r),i(),a();}}function Hx(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Ec(e){return typeof e=="string"}function se(e){let t=H(),{t:o}=N(),n=Ec(e)?e:editor.editorCommandKey(e),r=Et.useRef(e);r.current=e;let i=Et.useCallback(l=>{let c=r.current;if(Ec(c)){let f=editor.toolbarCommandState(t,c);return {active:f.active,enabled:f.enabled,disabledReason:i18n.localizeDisabledReason(f.disabledReason,o),value:f.value??null}}if(!t)return {active:false,enabled:false,disabledReason:null,value:null};let d=t.can(c);return {active:t.isActive(c),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,o),value:null}},[t,n,o]),a=B(i,Hx),s=Et.useCallback(l=>{let c=editor.commandExecOptions(l),d=r.current;return Ec(d)?editor.runToolbarCommand(t,d,void 0,c??{}).ok:t?t.exec(d,c).ok:false},[t]);return Et.useMemo(()=>({execute:s,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason,value:a.value}),[s,a])}var ln=Et.createContext({t:void 0,onSave:void 0});function Ox(){return Et.useContext(ln)}function Oi(e){let{t}=N();return o=>e?.(o)??t(o)}function Q(){let{t:e}=Et.useContext(ln);return Oi(e)}var Kx=()=>()=>{},Wx=()=>true,zx=()=>false;function Do(){let e=Et.useSyncExternalStore(Kx,Wx,zx);return Et.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function $x(e){let t=e.viteEnv?.DEV;return typeof t=="boolean"?t:e.hasProcess&&e.nodeEnv!=="production"}function Ux(){try{return undefined}catch{return}}function mt(){let e=typeof process<"u";return $x({viteEnv:Ux(),nodeEnv:e?"production":void 0,hasProcess:e})}var Im=new Set;function Io(e){!mt()||Im.has(e)||(Im.add(e),console.warn(`[docx-editor] ${e}`));}function _m(e){Io(`Menu.Item and ContextMenu.Slot take the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Nm(e){Io(`A hidden context-menu override names "${e}", but no packaged row has that id, so nothing is removed.`);}function Lm(){Io("A Menu.Item or ContextMenu.Slot has no slotId, so it renders nothing.");}function Fm(){Io("A Menu.Submenu has neither label nor labelKey, so its row has no name.");}function Hm(e){Io(`Toolbar.Button takes the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Am(){Io("A Toolbar.Button has no slotId, so it renders nothing.");}function ee(e){for(let t of editor.CHROME_GROUPS)for(let o of t.controls)if(editor.chromeSlotId(t,o)===e)return o;return null}function ae(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function Z(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Yx(e){if(e.slotId)return e.slotId;if(e.slot)return Hm(e.slot),e.slot;Am();}function sn(e){let{icon:t,asChild:o,className:n,children:r,hidden:i}=e,a=Yx(e)??"",{execute:s,isActive:l,isEnabled:c,disabledReason:d,value:f}=se(a),u=Q(),g=Do();if(i||!a)return null;let m=ee(a),p=g(u(m?.labelKey??a)),v=editor.chromeSlotIsToggle(a),y={onClick:()=>s(),onMouseDown:Z,disabled:!c,"data-slot":a,className:`docx-toolbar__button${n?` ${n}`:""}`,...l?{"data-active":""}:{},...c?{}:{"data-disabled":""},...v?{"aria-pressed":l}:{},...f!==null?{"data-value":f}:{},"aria-label":p,title:d??p};return o?jsxRuntime.jsx(G,{...y,children:r}):jsxRuntime.jsx("button",{type:"button",...y,children:t??r??ae(m?.paths)})}sn.docxToolbarPart=true;var oC=[{value:"C00000",labelKey:"colorPicker.colors.darkRed",css:"#c00000"},{value:"FF0000",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"FFC000",labelKey:"colorPicker.colors.orange",css:"#ffc000"},{value:"FFFF00",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"92D050",labelKey:"colorPicker.colors.lightGreen",css:"#92d050"},{value:"00B050",labelKey:"colorPicker.colors.green",css:"#00b050"},{value:"00B0F0",labelKey:"colorPicker.colors.lightBlue",css:"#00b0f0"},{value:"0070C0",labelKey:"colorPicker.colors.blue",css:"#0070c0"},{value:"002060",labelKey:"colorPicker.colors.darkBlue",css:"#002060"},{value:"7030A0",labelKey:"colorPicker.colors.purple",css:"#7030a0"}],Om=[{value:"yellow",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"green",labelKey:"colorPicker.colors.brightGreen",css:"#00ff00"},{value:"cyan",labelKey:"colorPicker.colors.cyan",css:"#00ffff"},{value:"magenta",labelKey:"colorPicker.colors.magenta",css:"#ff00ff"},{value:"blue",labelKey:"colorPicker.colors.blue",css:"#0000ff"},{value:"red",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"darkBlue",labelKey:"colorPicker.colors.darkBlue",css:"#000080"},{value:"darkCyan",labelKey:"colorPicker.colors.darkCyan",css:"#008080"},{value:"darkGreen",labelKey:"colorPicker.colors.darkGreen",css:"#008000"},{value:"darkMagenta",labelKey:"colorPicker.colors.darkMagenta",css:"#800080"},{value:"darkRed",labelKey:"colorPicker.colors.darkRed",css:"#800000"},{value:"darkYellow",labelKey:"colorPicker.colors.darkYellow",css:"#808000"},{value:"darkGray",labelKey:"colorPicker.colors.darkGray",css:"#808080"},{value:"lightGray",labelKey:"colorPicker.colors.lightGray",css:"#c0c0c0"},{value:"black",labelKey:"colorPicker.colors.black",css:"#000000"},{value:"white",labelKey:"colorPicker.colors.white",css:"#ffffff"}],Bm=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],Zi=["colorPicker.theme.background1","colorPicker.theme.text1","colorPicker.theme.background2","colorPicker.theme.text2","colorPicker.theme.accent1","colorPicker.theme.accent2","colorPicker.theme.accent3","colorPicker.theme.accent4","colorPicker.theme.accent5","colorPicker.theme.accent6"],_o=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Mt=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function nC(e){let t=[0,2,4].map(n=>parseInt(e.slice(n,n+2),16)),o=(Math.max(...t)+Math.min(...t))/2/255;return o===1?[Mt(5),Mt(15),Mt(25),Mt(35),Mt(50)]:o===0?[_o(50),_o(35),_o(25),_o(15),_o(5)]:o>=.8?[Mt(10),Mt(25),Mt(50),Mt(75),Mt(90)]:[_o(80),_o(60),_o(40),Mt(25),Mt(50)]}var rC=/^[0-9A-Fa-f]{6}$/;function aC(e,t){let o="";for(let n=0;n<6;n+=2){let r=Math.round(t(parseInt(e.slice(n,n+2),16)));o+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return o.toUpperCase()}function iC(e){let t=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16);return .299*t+.587*o+.114*n>230}function Gn({value:e,css:t,title:o,selected:n,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":o,"aria-pressed":n,title:o,"data-value":e,...n?{"data-selected":""}:{},...t.startsWith("var(")||iC(t.replace("#",""))?{"data-light":""}:{},onMouseDown:Z,onClick:()=>r(e)})}function lC({apply:e,label:t,current:o,themeHexes:n}){let r=n.map(nC),i=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[n.map((a,s)=>jsxRuntime.jsx(Gn,{value:a,css:`#${a.toLowerCase()}`,title:t(Zi[s]),selected:o===a,apply:e},`base-${s}`)),i.map(a=>n.map((s,l)=>{let c=r[l][a],d=aC(s,c.apply);return jsxRuntime.jsx(Gn,{value:d,css:`#${d.toLowerCase()}`,title:`${t(Zi[l])}, ${t(c.labelKey)}`,selected:o===d,apply:e},`${a}-${l}`)}))]})]})}function sC(e){let{apply:t,label:o,current:n}=e,[r,i]=Et.useState(""),a=rC.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lC,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:oC.map(s=>jsxRuntime.jsx(Gn,{value:s.value,css:s.css,title:o(s.labelKey),selected:n===s.value,apply:t},s.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.customColor")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-custom",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-hash","aria-hidden":"true",children:"#"}),jsxRuntime.jsx("input",{type:"text",className:"docx-toolbar__swatch-hex",value:r,maxLength:6,spellCheck:false,"aria-label":o("colorPicker.customColor"),onChange:s=>i(s.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:s=>{s.key==="Enter"&&a&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!a,onMouseDown:Z,onClick:()=>t(r.toUpperCase()),children:o("colorPicker.apply")})]})]})]})}function Mc({apply:e,current:t}){let o=H(),n=Q(),r=o?.getDocumentThemeColors()??[],i=r.length===Zi.length?r.map(s=>s.hex):Bm,a=t?.toUpperCase()??null;return jsxRuntime.jsx(sC,{apply:e,label:n,current:a,themeHexes:i})}var cC=Om.filter(e=>e.value!=="white");function dC({apply:e,label:t,current:o}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.highlightColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--highlight",role:"group",children:cC.map(n=>jsxRuntime.jsx(Gn,{value:n.value,css:n.css,title:t(n.labelKey),selected:o===n.value,apply:e},n.value))})]})}function Zm(e){let{slot:t,defaultValue:o,cssOf:n,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:l,hidden:c,icon:d})=>{let f=H(),{isEnabled:u,disabledReason:g}=se(t),m=Q(),[p,v]=Et.useState(false),[y,x]=Et.useState(o),b=Et.useRef(null);go(b,p,()=>v(false));let h=B(w=>{if(a){let E=w.formatting?.color;return E&&E.kind==="hex"?E.value.toUpperCase():null}return w.formatting?.highlight??null}),C=f?.getDocumentThemeColors()??[],T=C.length===Zi.length?C.map(w=>w.hex):Bm;Et.useEffect(()=>{if(!p)return;let w=E=>{let D=b.current;D&&E.target instanceof Node&&D.contains(E.target)||v(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[p]);let S=Et.useCallback(w=>{if(v(false),!f)return;f.focus();let E=editor.commandForSlotValue(t,w);E&&f.can(E).ok&&(f.exec(E),w!==r.value&&x(w));},[f]),P=Et.useMemo(()=>ee(t),[]);if(c)return null;let k=m(P?.labelKey??t);return jsxRuntime.jsxs("div",{ref:b,className:`docx-toolbar__colorsplit${l?` ${l}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!u,...u?{}:{"data-disabled":""},"aria-label":k,title:g??k,onMouseDown:Z,onClick:()=>S(y),children:[d??ae(P?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:n(y)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!u,...u?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":p,"aria-label":k,title:g??k,onMouseDown:Z,onClick:()=>v(w=>!w),children:"\u25BE"}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":k,onMouseDown:Z,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:Z,onClick:()=>S(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),m(r.labelKey)]}),i({apply:S,label:m,current:h,themeHexes:T})]}):null]})},{docxSlot:t})}var uC=new Map(Om.map(e=>[e.value,e.css])),Rc=Zm({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Mc,{apply:e.apply,current:e.current})}),kc=Zm({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>uC.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(dC,{...e})});var Ic=e=>e==="auto"?"currentColor":e==="byAuthor"?"var(--doc-review-author-0)":e==="none"?"transparent":`var(--doc-revision-color-${e})`;function Ki({label:e,value:t,values:o,disabled:n,change:r,t:i}){let a=Et.useId(),[s,l]=Et.useState(false),c=Et.useRef(null),d=Et.useRef(null),f=Et.useRef(null);Et.useLayoutEffect(()=>{if(!s||!f.current||!d.current)return;let g=editor.observeContentControlPopup(f.current,d.current);return (f.current.querySelector("[data-selected]")??f.current.querySelector("button"))?.focus(),g},[s]),Et.useEffect(()=>{if(n&&l(false),!s)return;let g=c.current?.ownerDocument,m=p=>{c.current?.contains(p.target)||l(false);};return g?.addEventListener("pointerdown",m),()=>g?.removeEventListener("pointerdown",m)},[s,n]);let u=()=>{l(false),d.current?.focus();};return jsxRuntime.jsxs("div",{ref:c,className:"docx-revision-color-picker",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||l(false);},children:[jsxRuntime.jsx("span",{id:`${a}-label`,children:e}),jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-revision-color-trigger",disabled:n,"aria-labelledby":`${a}-label ${a}-value`,"aria-expanded":s&&!n,"aria-controls":`${a}-options`,onClick:()=>l(!s),children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:Ic(t)}}),jsxRuntime.jsx("span",{id:`${a}-value`,children:i(`values.${t}`)})]}),jsxRuntime.jsxs("div",{ref:f,id:`${a}-options`,className:"docx-revision-color-options",hidden:!s||n,role:"group","aria-labelledby":`${a}-label`,onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u());let m=Array.from(g.currentTarget.querySelectorAll("button")),p=m.indexOf(g.target),v=g.key==="Home"?0:g.key==="End"?m.length-1:["ArrowRight","ArrowDown"].includes(g.key)?(p+1)%m.length:["ArrowLeft","ArrowUp"].includes(g.key)?(p-1+m.length)%m.length:null;v!==null&&(g.preventDefault(),g.stopPropagation(),m[v]?.focus());},children:[jsxRuntime.jsx("div",{className:"docx-revision-color-special",children:o.filter(g=>["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear","aria-pressed":t===g,"data-selected":t===g?"":void 0,onClick:()=>{r(g),u();},children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:Ic(g)}}),i(`values.${g}`)]},g))}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",children:o.filter(g=>!["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsx(Gn,{value:g,css:Ic(g),title:i(`values.${g}`),selected:t===g,apply:m=>{r(m),u();}},g))})]})]})}var qm=["none","colorOnly","bold","italic","underline","doubleUnderline","strikethrough","doubleStrikethrough"],vC=["byAuthor","auto",...editor.REVISION_MARKUP_COLORS];function Km(e,t,o){let{values:n}=e,r=a=>{let s=a==="changedLines"?["none","leftBorder","rightBorder","outsideBorder"]:a==="deletions"||a==="movedFrom"?[...qm,"hidden","caret","pound"]:qm,l=(a==="movedFrom"||a==="movedTo")&&!n.trackMoves;return jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("div",{className:"docx-revision-markup-row",children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-row-title","aria-hidden":"true",children:t(a)}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-field-label",children:t(a)}),jsxRuntime.jsx("select",{value:n[a].mark,disabled:l,onChange:c=>e.setValue(a,{...n[a],mark:c.target.value}),children:s.map(c=>jsxRuntime.jsx("option",{value:c,children:t(`values.${c}`)},c))})]}),jsxRuntime.jsx(Ki,{label:t(`${a}Color`),value:n[a].color,values:vC,disabled:l,t,change:c=>e.setValue(a,{...n[a],color:c})})]}),a!=="changedLines"&&jsxRuntime.jsx("div",{className:"docx-revision-markup-background",children:jsxRuntime.jsx(Ki,{label:t(`${a}Background`),value:n[a].background,values:["none","byAuthor",...editor.REVISION_MARKUP_COLORS],disabled:l,t,change:c=>e.setValue(a,{...n[a],background:c})})})]})},i=a=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n[a],"aria-describedby":`${o}-${a}`,onChange:s=>e.setValue(a,s.target.checked)}),t(a)]}),jsxRuntime.jsx("p",{id:`${o}-${a}`,children:t(`${a}Note`)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("markup")}),r("insertions"),r("deletions"),r("changedLines")]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("moves")}),i("trackMoves"),r("movedFrom"),r("movedTo")]}),jsxRuntime.jsxs("fieldset",{"data-docx-part":"field","data-docx-field":"cells",className:"docx-revision-markup-tableCells",children:[jsxRuntime.jsx("legend",{children:t("tableCells")}),["inserted","deleted","merged","split"].map(a=>jsxRuntime.jsx(Ki,{label:t(`${a}Cells`),value:n.cells[a],values:["byAuthor","none",...editor.REVISION_MARKUP_COLORS],t,change:s=>e.setValue("cells",{...n.cells,[a]:s})},a))]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("formatting")}),i("trackFormatting"),r("formatting")]})]})}var Ht=ko();function EC(){return Ht.useState()}function wC({session:e,...t}){return e?jsxRuntime.jsx(MC,{session:e,...t}):null}function MC({session:e,children:t,preset:o,className:n,style:r}){let i=Et.useId(),{t:a}=N(),s=p=>a(`revisionMarkup.${p}`),l=Et.useCallback(p=>e.subscribe(p),[e]),c=Et.useCallback(()=>e.get(),[e]),d=Et.useSyncExternalStore(l,c,c),[f,u]=Et.useState(e.signal.aborted),g=Et.useRef(null);Et.useEffect(()=>{g.current=e;let p=()=>u(true);return u(e.signal.aborted),e.signal.addEventListener("abort",p),()=>{e.signal.removeEventListener("abort",p),g.current=null,queueMicrotask(()=>{g.current!==e&&e.cancel();});}},[e]);let m={values:d,setValue(p,v){e.set({[p]:v});},errors:{},isEnabled:!f&&e.canApply(),apply(){e.apply();},cancel(){e.cancel();},reset(){e.reset();}};return f?null:jsxRuntime.jsx(pt,{kind:"revisionMarkup",label:s("title"),className:["docx-revision-markup-dialog",n].filter(Boolean).join(" "),style:r,onClose:m.cancel,dismissOutside:false,sessionSignal:e.signal,children:jsxRuntime.jsx(Ht.Composition,{state:m,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",children:jsxRuntime.jsx("h2",{"data-docx-part":"title",children:s("title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-revision-markup-body",children:Km(m,s,i)}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-revision-markup-actions",children:[jsxRuntime.jsx("button",{"data-docx-part":"reset",type:"button",onClick:m.reset,children:s("reset")}),jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",children:m.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",type:"button",onClick:m.cancel,children:s("cancel")}),jsxRuntime.jsx("button",{"data-docx-part":"apply",type:"button",disabled:!m.isEnabled,onClick:m.apply,children:s("ok")})]})]}),children:t})})}var Ur=Object.assign(wC,{Header:Ht.Header,Title:Ht.Title,Body:Ht.Body,Footer:Ht.Footer,Apply:Ht.Apply,Cancel:Ht.Cancel,Error:Ht.Error,Field:Ht.Field,Reset:Ht.Reset});function Nc(e){let t=H(),o=Et.useRef(e.onRevisionMarkupChange);o.current=e.onRevisionMarkupChange;let{onRevisionMarkupChange:n,...r}=e,i=JSON.stringify(r);return Et.useEffect(()=>t?.on("revisionMarkupChange",a=>o.current?.(a)),[t]),Et.useEffect(()=>{t&&t.setRevisionMarkup(JSON.parse(i));},[t,i]),null}function Vr({open:e,format:t,pending:o,error:n,onClose:r,className:i,style:a,children:s}){let{t:l}=N();if(!e)return null;let c=l(n?t==="pdf"?"toolbar.exportPdfFailed":"toolbar.exportMarkdownFailed":t==="pdf"?"toolbar.exportingPdf":"toolbar.exportingMarkdown");return jsxRuntime.jsx(pt,{kind:"export",label:c,role:n?"alertdialog":"dialog",className:`docx-export-dialog${o?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[o&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:n?"alert":"status",children:n||l("toolbar.exportDownloadHint")})}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l(n?"common.close":"toolbar.exportContinueEditing")})})]})})}function Gr({open:e,pending:t,error:o,url:n,onClose:r,className:i,style:a,children:s}){let{t:l}=N();if(!e)return null;let c=l(o?"toolbar.printFailed":"toolbar.printPreparing"),d=n.startsWith("blob:")?n:"";return jsxRuntime.jsx(pt,{kind:"print",label:c,role:o?"alertdialog":"dialog",className:`docx-export-dialog docx-print-dialog${t?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,onKeyDown:f=>{editor.isChromePrintShortcut(f.nativeEvent)&&f.preventDefault();},children:s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[t&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),o&&jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:"alert",children:o})}),jsxRuntime.jsxs("footer",{className:"docx-dialog__footer",children:[o&&d&&jsxRuntime.jsx("a",{className:"docx-dialog__link-button docx-print-dialog__open",href:d,target:"_blank",rel:"noopener noreferrer",children:l("toolbar.printOpenPdf")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l(o?"common.close":"common.cancel")})]})]})})}var ct={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function jn({text:e,x:t,y:o,className:n}){return jsxRuntime.jsx("div",{role:"tooltip",className:n,"data-testid":"docx-notes-preview",style:{position:"fixed",left:t,top:o,zIndex:ct.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg)",color:"var(--doc-popover-fg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",fontSize:12,lineHeight:1.4,pointerEvents:"none"},onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:e})}function Yn({noteKind:e,x:t,y:o,onDelete:n,onConvert:r,onConvertAll:i,onOpenProperties:a,onClose:s,deleteEnabled:l,convertEnabled:c,convertAllEnabled:d,deleteDisabledReason:f,convertDisabledReason:u,convertAllDisabledReason:g,className:m}){let{t:p}=N();return jsxRuntime.jsxs("div",{role:"menu",className:m,onKeyDown:v=>{v.key==="Escape"&&s();},"data-testid":"docx-notes-menu",style:{position:"fixed",left:t,top:o,zIndex:ct.popover,minWidth:160,background:"var(--doc-popover-bg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",padding:4},onMouseDown:Z,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!l,title:f,onClick:n,children:p("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!c,title:u,onClick:r,children:p(e==="footnote"?"notes.convertToEndnote":"notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!d,title:g,onClick:i,children:p(e==="footnote"?"notes.convertAllFootnotes":"notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:a,children:p("dialogs.footnoteProperties.title")})]})}function FC(e){return t=>Et.createElement(e,t)}var Vm=new WeakMap,HC=0;function ke(e,t,o){if(e===false)return null;let n=e(t);if(!o)return n;let r=Vm.get(o);return r===void 0&&Vm.set(o,r=++HC),Et.createElement(Et.Fragment,{key:r},n)}function Xn(e,t,o){let n=e.getBoundingClientRect();return {left:t-n.left-e.clientLeft+e.scrollLeft,top:o-n.top-e.clientTop+e.scrollTop}}function Yr(e){return e.paragraphId===""}var dn=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),qC=e=>e;function KC(){let e=o=>!!o&&(o.width>0||o.height>0);if(typeof document<"u"){let n=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(n))return {left:n.left,top:n.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let o=t.getRangeAt(0),n=o.getBoundingClientRect();if(e(n))return {left:n.left,top:n.bottom};let r=o.startContainer,a=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(a))return {left:a.left,top:a.bottom}}return null}var Xr=Et.createContext(null);function Fc(){let e=Et.useContext(Xr),t=zi(e===null);return e??t}function zi(e=true){let t=H(),[o,n]=Et.useState(dn),r=Et.useRef(null),i=Et.useRef(o);i.current=o;let a=B(qC),s=t?t.can({type:"insertText",text:""}).ok:false,l=Et.useCallback(()=>{let b=r.current;b&&(b.editor.releaseSelection(b.pin),r.current=null);},[]),c=Et.useCallback((b,h)=>{l(),n({mode:b?"reading":"editing",link:b??null,anchor:h??null,text:b?.text??"",url:b?b.kind==="internal"?`#${b.anchor??""}`:b.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,l]),d=Et.useCallback(()=>{l(),n(dn);},[l]);Et.useEffect(()=>l,[l]);let f=Et.useCallback(()=>{let b=KC();l();let h=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(h&&Yr(h)){c(h,b);return}if(h){n({mode:"editing",link:h,anchor:b,text:h.text,url:h.kind==="internal"?`#${h.anchor??""}`:h.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let C=t?.query({type:"selectedText"})??"",T=t?.retainSelection()??null;t&&T&&(r.current={editor:t,pin:T}),n({mode:"editing",link:null,anchor:b,text:C,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c,l]);Et.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:b=>c(b.link,{left:b.rect.left,top:b.rect.bottom}),onRequest:f})},[t,e,c,f]),Et.useEffect(()=>{let b=i.current;if(b.mode!=="reading"||!b.link)return;let h=Yr(b.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;h&&h.id===b.link.id||n(dn);},[a,t]),Et.useEffect(()=>{let b=i.current;if(b.mode!=="editing"||b.link)return;let h=t?.surface;!h||h.retainedSelection()||n(dn);},[a,t]);let u=Et.useCallback(async()=>{let b=i.current.link?.href;if(!b)return false;try{await navigator.clipboard.writeText(b);}catch{return false}return n(h=>({...h,copied:true})),true},[]),g=Et.useCallback(()=>{n(b=>({...b,mode:"editing",copied:false,error:false}));},[]),m=Et.useCallback(b=>{n(h=>({...h,text:b,copied:false,error:false}));},[]),p=Et.useCallback(b=>{n(h=>({...h,url:b,copied:false,error:false}));},[]),v=Et.useCallback(()=>{let b=i.current,h=t?.surface?.hyperlinks;if(!h)return false;let C=b.url.trim();if(C.length===0)return n(P=>({...P,error:true})),false;let T=C.startsWith("#");return h.applyHyperlink({...T?{anchor:C.slice(1)}:{url:C},...b.text.trim().length>0?{text:b.text}:{}})?(d(),true):(n(P=>({...P,error:true})),false)},[t,d]),y=Et.useCallback(()=>{let b=t?.surface?.hyperlinks,h=i.current.link;if(!b)return false;let C=b.removeHyperlink(h?.id);return C&&d(),C},[t,d]),x=Et.useCallback(()=>{let b=t?.surface?.navigation,h=i.current.link;if(!b||!h)return false;if(h.kind==="internal"){let T=h.anchor?b.goToBookmark(h.anchor):false;return T&&n(dn),T}let C=b.openExternal(h.href);return C&&n(dn),C},[t]);return Et.useMemo(()=>({state:o.mode==="closed"?dn:{...o,canEdit:s},open:c,openAtCaret:f,close:d,copy:u,beginEdit:g,setText:m,setUrl:p,commitEdit:v,unlink:y,openTarget:x}),[o,s,c,f,d,u,g,m,p,v,y,x])}function pn(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var $i=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),jC="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z",YC="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z",XC="M770-302 656-416l57-57 114 114-57 57ZM603-469 469-603l57-57 134 134-57 57ZM280-280h133v80H280q-83 0-141.5-58.5T80-400q0-83 58.5-141.5T280-600h133v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm40-80v-80h101l80 80H320Zm493-15-57-57q23-11 33.5-32t10.5-36q0-50-35-85t-85-35H547v-80h133q83 0 141.5 58.5T880-400q0 32-11 61.5T813-375ZM792-56 56-792l56-56 736 736-56 56Z",JC="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z";function QC({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=Qt(),a=Et.useRef(null),{state:s,close:l}=i;Et.useEffect(()=>{if(s.mode==="closed")return;let p=y=>{y.key==="Escape"&&(y.preventDefault(),l());},v=y=>{let x=a.current;x&&y.target instanceof Node&&x.contains(y.target)||l();};return document.addEventListener("keydown",p),document.addEventListener("mousedown",v,true),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",v,true);}},[s.mode,l]);let[c,d]=Et.useState(null);Et.useLayoutEffect(()=>{let p=s.anchor,v=a.current;if(!p||!v){d(null);return}let y=v.offsetParent;if(!y){d(null);return}let{left:x,top:b}=Xn(y,p.left,p.top),h=Math.max(0,y.scrollWidth-v.offsetWidth);d({left:Math.max(0,Math.min(x,h)),top:b});},[s.anchor]);let{t:f}=N(),u=s.mode==="editing"?f(s.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):f("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(eT,{children:n}):n;if(o)return s.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});let m={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":s.mode,role:"dialog","aria-modal":false,onMouseDown:pn,style:c??void 0,"aria-label":u};return s.mode==="closed"?null:t?jsxRuntime.jsx(G,{...m,children:n}):jsxRuntime.jsx("div",{...m,children:g})}function eT({children:e}){let{state:t}=Qt(),o=Et.useMemo(()=>tT(e),[e]),n=(i,a)=>i in o?o[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Fields",jsxRuntime.jsx(qc,{})),n("Error",jsxRuntime.jsx(Wc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Apply",jsxRuntime.jsx(Kc,{})),n("Cancel",jsxRuntime.jsx(zc,{}))]}),o.__extra]});let r=t.canEdit&&!(t.link&&Yr(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Url",jsxRuntime.jsx(Ac,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Copy",jsxRuntime.jsx(Oc,{})),r?n("Edit",jsxRuntime.jsx(Bc,{})):null,r?n("Unlink",jsxRuntime.jsx(Zc,{})):null]}),o.__extra]})}function tT(e){let t={},o=[],n=r=>{if(Array.isArray(r)){r.forEach(n);return}if(!r||typeof r!="object"||!("type"in r)){r&&o.push(r);return}if(r.type===Et.Fragment){n(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:o.push(r);};return n(e),o.length>0&&(t.__extra=o),t}function Qt(){return Et.useContext(Xr)??oT}var oT={state:{mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:false},open:()=>{},openAtCaret:()=>{},close:()=>{},copy:async()=>false,beginEdit:()=>{},setText:()=>{},setUrl:()=>{},commitEdit:()=>false,unlink:()=>false,openTarget:()=>false};function Ac({className:e,asChild:t,hidden:o,children:n}){let{state:r,openTarget:i}=Qt(),{t:a}=N();if(o||!r.link)return null;let s=!r.link.href,l=r.link.kind==="internal",c=l?`#${r.link.anchor??""}`:r.link.authored,d=a(s?"hyperlinkPopup.inertTarget":l?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),f={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...s?{"data-inert":""}:{},title:d,onMouseDown:pn,...s?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(G,{...f,className:e,children:n}):s?jsxRuntime.jsxs("span",{...f,children:[n??c,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...f,children:[n??c,$i(JC)]})}Ac.docxHyperLinkPart="Url";function Oc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{state:i,copy:a}=Qt(),{t:s}=N();if(o||!i.link?.href)return null;let l=i.copied?s("editor.linkCopied"):s("hyperlinkPopup.copyLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":l,title:l,onMouseDown:pn,onClick:()=>{a();}};return t?jsxRuntime.jsx(G,{...c,className:e,children:n}):jsxRuntime.jsx("button",{...c,children:r??n??$i(jC)})}Oc.docxHyperLinkPart="Copy";function Bc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{beginEdit:i}=Qt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.editLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":s,title:s,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(G,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:r??n??$i(YC)})}Bc.docxHyperLinkPart="Edit";function Zc({className:e,asChild:t,hidden:o,children:n,icon:r}){let{unlink:i}=Qt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.removeLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":s,title:s,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(G,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:r??n??$i(XC)})}Zc.docxHyperLinkPart="Unlink";function qc({className:e,hidden:t}){let{state:o,setText:n,setUrl:r,commitEdit:i,close:a}=Qt(),{t:s}=N(),l=Et.useRef(null),c=Et.useId(),d=Et.useId();Et.useEffect(()=>{o.mode==="editing"&&(l.current?.focus({preventScroll:true}),l.current?.select());},[o.mode]);let f=Et.useCallback(u=>{if(u.key==="Enter"){u.preventDefault(),i();return}u.key==="Escape"&&(u.preventDefault(),a());},[i,a]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:s("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:c,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:o.text,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onChange:u=>n(u.target.value),onKeyDown:f}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:s("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:l,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:o.url,placeholder:s("hyperlinkPopup.urlPlaceholder"),onChange:u=>r(u.target.value),onKeyDown:f})]})}qc.docxHyperLinkPart="Fields";function Kc({className:e,asChild:t,hidden:o,children:n}){let{state:r,commitEdit:i}=Qt(),{t:a}=N();if(o)return null;let s=a("hyperlinkPopup.apply"),l={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:pn,onClick:()=>i()};return t?jsxRuntime.jsx(G,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:n??s})}function Wc({className:e,hidden:t}){let{state:o}=Qt(),{t:n}=N();return t||!o.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:n("hyperlinkPopup.refused")})}Wc.docxHyperLinkPart="Error";Kc.docxHyperLinkPart="Apply";function zc({className:e,asChild:t,hidden:o,children:n}){let{close:r}=Qt(),{t:i}=N();if(o)return null;let a=i("hyperlinkPopup.cancel"),s={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:pn,onClick:()=>r()};return t?jsxRuntime.jsx(G,{...s,className:e,children:n}):jsxRuntime.jsx("button",{...s,children:n??a})}zc.docxHyperLinkPart="Cancel";var Jr=Object.assign(QC,{Url:Ac,Copy:Oc,Edit:Bc,Unlink:Zc,Fields:qc,Error:Wc,Apply:Kc,Cancel:zc});var gt={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function iT(e){return e==="sdtLocked"||e==="sdtContentLocked"}function lT(e){return e==="contentLocked"||e==="sdtContentLocked"}function Uc(e,t){return !e.ok&&e.code===t}function eo(){let e=Et.useContext(Vc),t=Ui();return e??t}function Ui(){let e=H(),[t,o]=Et.useState(false),[n,r]=Et.useState(false),[i,a]=Et.useState(false),s=B(S=>S),l=e?.surface??null,c=l?.contentControls;Et.useEffect(()=>{r(c?.showAll()??l?.state().contentControls.showAll??false),a(c?.formFill()??l?.state().contentControls.formFill??false);},[s,c,l]);let d=Et.useMemo(()=>{if(!e)return null;let S=c?.atCaret()??null;if(S){let M=c?.disabledReason(S.id,"edit")??null,I=c?.disabledReason(S.id,"remove")??null;return {id:S.id,tag:S.tag??null,alias:S.alias??null,controlType:S.controlType,locked:lT(S.effectiveLock)||M==="locked",removalLocked:iT(S.effectiveLock)||I==="locked",placeholder:S.placeholder,bound:S.bound||M==="bound",effectiveLock:S.effectiveLock}}let P=e.query({type:"contentControlAt"});if(!P)return null;let k=c?.disabledReason(P.id,"edit")??null,w=c?.disabledReason(P.id,"remove")??null,E=e.can({type:"setContentControlValue",value:""}),D=e.can({type:"removeContentControl"}),A=P.locked===true||k==="locked"||Uc(E,"locked"),_=k==="bound"||Uc(E,"bound"),F=w==="locked"||Uc(D,"locked");return {id:P.id,tag:P.tag??null,alias:P.alias??null,controlType:P.controlType,locked:A,removalLocked:F,placeholder:false,bound:_,effectiveLock:null}},[e,s,c]),f=Et.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,s]),u=Et.useCallback(S=>{c?.setShowAll(S),r(S);},[c]),g=Et.useCallback(S=>{c?.setFormFill(S),a(S);},[c]),m=Et.useCallback(()=>u(!n),[u,n]),p=Et.useCallback(()=>g(!i),[g,i]),v=Et.useCallback(()=>o(true),[]),y=Et.useCallback(()=>o(false),[]),x=Et.useCallback(()=>o(S=>!S),[]),b=Et.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let P=c.disabledReason(d.id,"edit");return P==="locked"?"the content control is locked":P==="bound"?"the content control is bound to external data":P==="notFound"?"the content control was not found":P}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let S=e.can({type:"setContentControlValue",value:""});return S.ok?null:S.reason},[d,c,e]),h=Et.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let P=c.disabledReason(d.id,"remove");return P==="locked"?"the content control is locked":P==="notFound"?"the content control was not found":P}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let S=e.can({type:"removeContentControl"});return S.ok?null:S.reason},[d,c,e]),C=Et.useCallback(S=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c&&d){let P=c.disabledReason(d.id,"edit");if(P)return {ok:false,code:P==="bound"?"bound":P==="locked"?"locked":"notFound",reason:P==="bound"?"the content control is bound to external data":P==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:S})},[e,c,d]),T=Et.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c){let S=d?.id;if(!S)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let P=c.disabledReason(S,"remove");return P?{ok:false,code:P==="locked"?"locked":"notFound",reason:P==="locked"?"the content control is locked":"the content control was not found"}:c.remove(S)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,c,d]);return Et.useMemo(()=>({control:d,controls:f,showAll:n,formFill:i,inspectorOpen:t,canSetValue:b===null&&d!==null,canRemove:h===null&&d!==null,setValueDisabledReason:b,removeDisabledReason:h,setShowAll:u,toggleShowAll:m,setFormFill:g,toggleFormFill:p,openInspector:v,closeInspector:y,toggleInspector:x,remove:T,setValue:C}),[d,f,n,i,t,b,h,u,m,g,p,v,y,x,T,C])}var Vc=Et.createContext(null);function Gc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var ef=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),dT="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",uT="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z",pT={position:"absolute",zIndex:20,minWidth:240,maxWidth:320,top:12,right:12,padding:12,borderRadius:8,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-surface)",boxShadow:"0 4px 16px var(--doc-shadow)",color:"var(--doc-text)",fontSize:13,display:"flex",flexDirection:"column",gap:10},mT={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},fT={color:"var(--doc-text-muted)",flexShrink:0},gT={textAlign:"right",wordBreak:"break-word"},hT={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},bT={display:"flex",gap:8,marginTop:4},tf={display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text)",font:"inherit",cursor:"pointer"};function vT(e){switch(e){case "plainText":return "contentControl.types.plainText";case "checkbox":return "contentControl.types.checkbox";case "dropdown":return "contentControl.types.dropdown";case "comboBox":return "contentControl.types.comboBox";case "date":return "contentControl.types.date";case "picture":return "contentControl.types.picture";case "buildingBlockGallery":return "contentControl.types.buildingBlockGallery";case "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function yT(e){return e.effectiveLock==="sdtContentLocked"?"contentControl.lock.sdtContentLocked":e.effectiveLock==="contentLocked"||e.locked?"contentControl.lock.contentLocked":e.effectiveLock==="sdtLocked"||e.removalLocked?"contentControl.lock.sdtLocked":"contentControl.lock.unlocked"}function Jn({label:e,value:t,testId:o}){return jsxRuntime.jsxs("div",{style:mT,"data-testid":o,children:[jsxRuntime.jsx("span",{style:fT,children:e}),jsxRuntime.jsx("span",{style:gT,children:t})]})}function xT({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=eo(),a=Et.useRef(null),s=Et.useId(),{t:l}=N(),{control:c,inspectorOpen:d,closeInspector:f}=i;if(Et.useEffect(()=>{if(!d)return;let p=y=>{y.key==="Escape"&&(y.preventDefault(),f());},v=y=>{let x=a.current;x&&y.target instanceof Node&&x.contains(y.target)||f();};return document.addEventListener("keydown",p),document.addEventListener("mousedown",v,true),()=>{document.removeEventListener("keydown",p),document.removeEventListener("mousedown",v,true);}},[d,f]),Et.useEffect(()=>{d&&!c&&f();},[d,c,f]),o||!d||!c)return null;let u=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(of,{}),jsxRuntime.jsx(nf,{}),jsxRuntime.jsx("div",{style:bT,children:jsxRuntime.jsx(rf,{})}),n]}):n,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":s,"data-testid":"content-control-inspector","data-control-id":c.id,"data-control-type":c.controlType,...c.locked?{"data-locked":""}:{},...c.bound?{"data-bound":""}:{},...c.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:pT,onMouseDown:p=>{Gc(p),p.stopPropagation();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:s,className:"docx-editor-sr-only",children:l("contentControl.inspectorPanel.title")}),u]});return t?jsxRuntime.jsx(G,{...g,children:m}):jsxRuntime.jsx("div",{...g,children:m})}function of({className:e,asChild:t,hidden:o,children:n}){let{closeInspector:r}=eo(),{t:i}=N();if(o)return null;let a={style:hT,className:e??void 0,"data-testid":"content-control-inspector-header"},s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:n??i("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":i("common.close"),title:i("common.close"),style:{...tf,padding:4,border:"none",background:"transparent"},onMouseDown:Gc,onClick:()=>r(),children:ef(dT)})]});return t?jsxRuntime.jsx(G,{...a,children:s}):jsxRuntime.jsx("div",{...a,children:s})}function nf({className:e,asChild:t,hidden:o,children:n}){let{control:r}=eo(),{t:i}=N();if(o||!r)return null;let a=i("contentControl.inspectorPanel.empty"),s=i("contentControl.inspectorPanel.yes"),l=i("contentControl.inspectorPanel.no"),c=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.type"),value:i(vT(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.lock"),value:i(yT(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?s:l,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(Jn,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?s:l,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:i("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:i("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(G,{...d,children:c}):jsxRuntime.jsx("div",{...d,children:c})}function rf({className:e,asChild:t,hidden:o,icon:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:s,closeInspector:l}=eo(),{t:c}=N();if(o)return null;let d=c("contentControl.remove"),f={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":d,title:a??d,style:tf,onMouseDown:Gc,onClick:()=>{s().ok&&l();}},u=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n??r??ef(uT),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(G,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}var ta=Object.assign(xT,{Header:of,Fields:nf,Remove:rf});var ST=e=>e;function Qc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function oa(){let e=H(),{t}=N(),[o,n]=Et.useState(null),[r,i]=Et.useState(null),a=Et.useRef(null),s=Et.useRef(null),l=Et.useRef(null),c=Et.useId(),d=Et.useId(),f=Et.useId(),u=o?.activation??null,g=B(ST),m=Et.useMemo(()=>{if(!e?.surface||!u)return {replaceEnabled:false,removeEnabled:false,reason:null};let b=e.surface.equations.can(u.equation.id,"replace"),h=e.surface.equations.can(u.equation.id,"remove"),C=b.ok?h.ok?null:h.reason:b.reason;return {replaceEnabled:b.ok,removeEnabled:h.ok,reason:C?i18n.localizeDisabledReason(C,t):null}},[u,e,g,t]),p=Et.useCallback((b=false)=>{l.current?.(),l.current=null,n(null),b&&e&&queueMicrotask(()=>e.focus());},[e]);Et.useEffect(()=>{if(!e)return;let b=e.setEquationChrome({onPopover:h=>{l.current?.();let C=e.surface;if(C&&typeof C.retainSelection=="function"){let T=C.retainSelection();l.current=()=>C.releaseSelection(T);}else l.current=null;n({activation:h,mountGeneration:e.mountGeneration,draft:h.equation.linear,error:false});}});return ()=>{b(),l.current?.(),l.current=null,n(null);}},[e,p]),Et.useEffect(()=>{if(!o||!e?.surface)return;(e.mountGeneration!==o.mountGeneration||!e.surface.equations.equationById(o.activation.equation.id))&&p();},[e,g,o,p]),Et.useEffect(()=>{if(!o)return;let b=a.current,h=b?.ownerDocument,C=h?.defaultView;if(!b||!h||!C)return;let T=P=>{P.key==="Escape"&&(P.preventDefault(),p(true));},S=P=>{P.target instanceof C.Node&&b.contains(P.target)||p();};return h.addEventListener("keydown",T),h.addEventListener("pointerdown",S,true),()=>{h.removeEventListener("keydown",T),h.removeEventListener("pointerdown",S,true);}},[o,p]),Et.useLayoutEffect(()=>{if(!u){i(null);return}let b=a.current;if(!b)return;let h=b.offsetParent;if(!h){i(null);return}let C=u.rect,T=Xn(h,C.left,C.bottom),S=Math.max(0,h.scrollWidth-b.offsetWidth);i({left:Math.max(0,Math.min(T.left,S)),top:T.top}),s.current?.focus({preventScroll:true}),s.current?.select();},[u]);let v=Et.useCallback(()=>{if(!o||!e?.surface||!m.replaceEnabled)return false;let b=e.surface.equations.applyEquation(o.activation.equation.id,o.draft);return b?p(true):n(h=>h&&{...h,error:true}),b},[e,o,p,m.replaceEnabled]),y=Et.useCallback(()=>{if(!o||!e?.surface||!m.removeEnabled)return false;let b=e.surface.equations.removeEquation(o.activation.equation.id);return b?p(true):n(h=>h&&{...h,error:true}),b},[e,o,p,m.removeEnabled]);if(!o)return null;let x=[o.error?d:null,m.reason?f:null].filter(Boolean).join(" ");return jsxRuntime.jsxs("div",{ref:a,className:"docx-equation-popup","data-testid":"equation-popup",role:"dialog","aria-modal":false,"aria-label":t("equationPopup.title"),style:r??void 0,onMouseDown:Qc,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:t("equationPopup.inputLabel")}),jsxRuntime.jsx("input",{id:c,ref:s,className:"docx-equation-popup__input","data-testid":"equation-popup-input",value:o.draft,placeholder:t("equationPopup.placeholder"),spellCheck:false,"aria-describedby":x||void 0,onChange:b=>n(h=>h&&{...h,draft:b.target.value,error:false}),onKeyDown:b=>{b.key!=="Enter"||b.nativeEvent.isComposing||(b.preventDefault(),v());}}),o.error?jsxRuntime.jsx("div",{id:d,className:"docx-equation-popup__error","data-testid":"equation-popup-error",role:"alert",children:t("equationPopup.refused")}):null,m.reason?jsxRuntime.jsx("div",{id:f,className:"docx-equation-popup__error","data-testid":"equation-popup-disabled-reason",role:"status",children:m.reason}):null,jsxRuntime.jsxs("div",{className:"docx-equation-popup__actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__apply","data-testid":"equation-popup-apply",disabled:!m.replaceEnabled,title:m.reason??void 0,onMouseDown:Qc,onClick:v,children:t("equationPopup.apply")}),jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__delete","data-testid":"equation-popup-delete",disabled:!m.removeEnabled,title:m.reason??void 0,onMouseDown:Qc,onClick:y,children:t("equationPopup.delete")})]})]})}var sf="review.comments",ed="review.addComment";function cf(e){return e!==sf?e:(Io(`The context-menu row "${sf}" is now "${ed}". The old id still works in this release; write "${ed}".`),ed)}function tr(e,t){if(!Et.isValidElement(e)||e.type!==Et.Fragment)return null;let n=Et.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return n.length===1?n[0]:null}function Vi({entries:e,children:t,preset:o,keyOfEntry:n,keyOfChild:r,renderEntry:i,childrenOfEntry:a,onUnmatched:s}){if(!o)return t;let l=new Map,c=[];for(let m of Et.Children.toArray(t)){let p=r(m);p?l.set(p,m):c.push(m);}let d=new Set,f=m=>m.map((p,v)=>{let y=n(p,v);d.add(y);let x=a?.(p),b=x?f(x):void 0,h=l.get(y);return jsxRuntime.jsx(Et.Fragment,{children:h??i(p,v,b)},y)}),u=f(e),g=[...l.entries()].filter(([m])=>!d.has(m)).map(([m,p])=>(s?.(m,p),jsxRuntime.jsx(Et.Fragment,{children:p},m)));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,g,c]})}var RT="review.addComment",kT=e=>e.editingMode==="viewing";function Gi(e){let{isEnabled:t,disabledReason:o}=se(RT),n=B(kT);return t?{isEnabled:t,reason:null}:{isEnabled:t,reason:n?e("editingMode.viewingHint"):o}}var na=Et.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),or="docx-menubar-more",ji=Et.createContext({measuring:false,overflow:new Set,inMore:false});function mf(){return Et.useContext(ji)}function at(){return Et.useContext(na)}function De(){let{t:e}=at(),{t}=N();return o=>e?.(o)??t(o)}var nr=Et.createContext(-1);var DT='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function mn(e){return [...e.querySelectorAll(DT)].filter(t=>t.closest('[role="menu"]')===e)}function nd(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function Ot(e,t,o){if(e.length===0)return false;let n=t?e.indexOf(t):-1,r=n===-1?o>0?0:e.length-1:(n+o+e.length)%e.length;return e[r]?.focus(),true}function Bt(e,t){let o=t==="first"?e[0]:e[e.length-1];return o?(o.focus(),true):false}function rd(e){let t=e?.ownerDocument.activeElement;((t&&e?.contains(t)?t.closest("[data-menu]"):null)?.querySelector(':scope > [role="menuitem"]')??e?.querySelector('.docx-menubar__trigger[aria-expanded="true"]'))?.focus({preventScroll:true});}var Fo="data-toolbar-group",fn="data-toolbar-fixed",aa="data-toolbar-more",WT=34,Yi=new Set;function Xi(e,t,o){let n=Et.useRef(null),r=Et.useRef(new Map),i=Et.useRef(WT),[a,s]=Et.useState(Yi),l=Et.useRef(a);l.current=a;let c=Et.useRef({groups:t,order:o});c.current={groups:t,order:o};let d=t.join("\0"),f=o.join("\0"),u=Et.useCallback(()=>{let m=n.current;if(!m||!e)return;let p=getComputedStyle(m),v=editor.readColumnGap(p),y=editor.readAvailableWidth(m,p),x=m.querySelector(".docx-toolbar__separator"),b=v*2;if(x){let k=getComputedStyle(x),w=editor.readInlineMargins(k);b=editor.separatorLeadingCost(x.offsetWidth,w.start,w.end,v);}for(let k of m.querySelectorAll(`[${Fo}]`)){let w=k.getAttribute(Fo);w&&k.offsetWidth>0&&r.current.set(w,editor.collapsibleGroupCost(k.offsetWidth,b));}let h=0;for(let k of m.querySelectorAll(`[${fn}]`))k.offsetWidth>0&&(h+=editor.trailingGapCost(k.offsetWidth,v));let C=m.querySelector(`[${aa}]`);C&&C.offsetWidth>0&&(i.current=editor.trailingGapCost(C.offsetWidth,v));let T={available:y,widths:r.current,groups:c.current.groups,order:c.current.order,fixed:h,more:i.current,previous:l.current,hysteresis:editor.TOOLBAR_OVERFLOW_HYSTERESIS},P=l.current.size===0&&editor.controlsOverflow(m,p)===false?Yi:editor.toolbarOverflowGroups(T);editor.sameOverflow(P,l.current)||(l.current=P,s(P));},[e]),g=Et.useCallback(m=>{n.current=m;},[]);return Et.useLayoutEffect(()=>{if(!e){l.current.size>0&&(l.current=Yi,s(Yi));return}u();},[e,d,u,f]),Et.useEffect(()=>{let m=n.current;if(!e||!m||typeof ResizeObserver>"u")return;let p=0,v=new ResizeObserver(()=>{p===0&&(p=requestAnimationFrame(()=>{p=0,u();}));});v.observe(m),m.parentElement&&v.observe(m.parentElement);for(let y of m.querySelectorAll(`[${Fo}], [${fn}]`))v.observe(y);return ()=>{p!==0&&cancelAnimationFrame(p),v.disconnect();}},[e,d,u,f,a]),{attach:g,overflow:a}}function hf(e,t,o){let n=e.overflow.has(t),r=t===or;return {skip:e.inMore?!n:n,asSubmenu:e.inMore&&n,iconOnly:r,rootAttributes:{...e.measuring&&!r?{[Fo]:t}:{},...r?{[aa]:""}:{}},tabStop:o===t||r&&o!==null&&e.overflow.has(o)}}function bf(e,t,o){let[n,r]=Et.useState(void 0);return Et.useLayoutEffect(()=>{if(!e){r(void 0);return}let i=()=>{let s=t.current,l=o.current,c=s?.parentElement,d=s?.ownerDocument.defaultView;if(!s||!l||!c||!d)return;let f=s.getBoundingClientRect(),u=editor.toolbarPanelPlacement({triggerLeft:f.left,triggerRight:f.right,panelWidth:l.offsetWidth,viewportWidth:d.innerWidth});r({left:u.left-c.getBoundingClientRect().left,right:"auto",maxInlineSize:u.maxWidth});};i();let a=t.current?.ownerDocument.defaultView;return a?.addEventListener("resize",i),()=>a?.removeEventListener("resize",i)},[e,o,t]),n}var yf=12700,vf=96;function YT(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function XT(e,t,o,n){let r=e*72/o,i=t*72/n;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function Ji(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let o=editor.sniffImageMime(e);if(!YT(o))return o==="image/svg+xml"||o==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let n=editor.validateRasterHeader(e,o);if(!n)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(n.pixelWidth*n.pixelHeight>t.maxPixels||n.pixelWidth>t.maxDimension||n.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=XT(n.pixelWidth,n.pixelHeight,n.dpiX??vf,n.dpiY??vf);return Object.freeze({ok:true,bytes:e,mime:o,widthPoints:i,heightPoints:a})}function Ho(e){return Math.round(e/yf*100)/100}function ia(e){return Math.round(e*yf)}var oP="image/png,image/jpeg,image/gif",id=Et.createContext(null);function Pf(){let e=Et.useContext(id);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function la(){return Et.useContext(id)}function Qi({children:e}){let t=H(),{t:o}=N(),n=Et.useRef(null),r=Et.useRef(false),i=Et.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=B(i,(p,v)=>p.enabled===v.enabled&&p.disabledReason===v.disabledReason),s=a.enabled,l=i18n.localizeDisabledReason(a.disabledReason,o),c=Et.useCallback(async p=>{if(!t||r.current)return;let v=Ji(p);if(!v.ok){window.alert(o(v.reasonKey));return}let y={type:"insertImage",data:v.bytes,mime:v.mime,widthPoints:v.widthPoints,heightPoints:v.heightPoints};r.current=true;try{let x=await editor.executeImageCommand(t,y);x.ok?t.focus():window.alert(i18n.localizeDisabledReason(nP(x.reason)??null,o)??o("imageInsert.errors.refused"));}finally{r.current=false;}},[t,o]),d=Et.useCallback(async p=>{let v=p?.[0];if(!v)return;let y=await v.arrayBuffer();await c(new Uint8Array(y));},[c]),f=Et.useCallback(async p=>{if(!p)return;let v=[...p.files].find(y=>y.type.startsWith("image/"));if(v){await d([v]);return}for(let y of p.items){if(y.kind!=="file"||!y.type.startsWith("image/"))continue;let x=y.getAsFile();if(!x)continue;let b=await x.arrayBuffer();await c(new Uint8Array(b));return}},[c,d]),u=Et.useCallback(()=>{s&&n.current?.click();},[s]),g=Et.useCallback(async p=>{let v=p.currentTarget;await d(v.files),v.value="";},[d]),m=Et.useMemo(()=>({openFilePicker:u,insertFromFileList:d,insertFromDataTransfer:f,isEnabled:s,disabledReason:l,inputRef:n,onInputChange:g}),[u,d,f,s,l,g]);return jsxRuntime.jsxs(id.Provider,{value:m,children:[jsxRuntime.jsx("input",{ref:n,type:"file",accept:oP,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:p=>p.stopPropagation()}),e]})}function el({className:e,hidden:t,asChild:o,children:n}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=Pf(),s=Q();if(t)return null;let l=ee("image.insert"),c=s(l?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":c,title:a??c,onMouseDown:Z,onClick:r};return o?jsxRuntime.jsx(G,{...d,children:n}):jsxRuntime.jsx("button",{...d,children:n??ae(l?.paths)})}el.docxSlot="image.insert";var sa=Object.assign(el,{docxSlot:"image.insert"});function nP(e){return e&&/\s/.test(e)?e:void 0}var ld=6,wf=6;function ol({slot:e,label:t,onInserted:o,className:n}){let r=H(),{isEnabled:i}=se(e),[a,s]=Et.useState(null),[l,c]=Et.useState({rows:1,cols:1}),d=Et.useRef(null),f=Et.useCallback((m,p)=>{if(!r||!i)return;let v={type:"insertTable",rows:m,cols:p};r.can(v).ok&&(r.exec(v),o(),r.focus());},[r,i,o]),u=Et.useCallback(m=>{c(p=>{let v={rows:Math.min(wf,Math.max(1,p.rows+(m.rows??0))),cols:Math.min(ld,Math.max(1,m.toCol??p.cols+(m.cols??0)))};return s(v),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${v.rows}x${v.cols}"]`)?.focus()),v});},[]),g=[];for(let m=1;m<=wf;m+=1){let p=[];for(let v=1;v<=ld;v+=1){let y=!!a&&m<=a.rows&&v<=a.cols;p.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${m}x${v}`,className:"docx-menubar__grid-cell",tabIndex:l.rows===m&&l.cols===v?0:-1,...y?{"data-filled":""}:{},"aria-label":`${v} \xD7 ${m}`,onMouseDown:Z,onMouseEnter:()=>s({rows:m,cols:v}),onFocus:()=>s({rows:m,cols:v}),onClick:()=>f(m,v)},v));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:p},m));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":t,className:`docx-menubar__grid${n?` ${n}`:""}`,onMouseLeave:()=>s(null),onKeyDown:m=>{if(m.key==="ArrowRight")u({cols:1});else if(m.key==="ArrowLeft")u({cols:-1});else if(m.key==="ArrowDown")u({rows:1});else if(m.key==="ArrowUp")u({rows:-1});else if(m.key==="Home")u({toCol:1});else if(m.key==="End")u({toCol:ld});else return;m.preventDefault(),m.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function ar({slot:e="table.insert",className:t}){let{setOpenMenu:o}=at(),n=De(),r=Et.useCallback(()=>o(null),[o]);return jsxRuntime.jsx(ol,{slot:e,label:n("toolbar.insertTable"),onInserted:r,className:t})}function _e(e){let{icon:t,shortcut:o,disabled:n,title:r,active:i,selected:a,slot:s,onSelect:l,className:c,children:d}=e,f=e["data-value"],u=Do(),g=Et.useId(),m=Et.useContext(nr),p=n&&r?g:void 0;return jsxRuntime.jsxs("button",{type:"button",role:i===void 0?"menuitem":a===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${c?` ${c}`:""}`,tabIndex:m,...s?{"data-slot":s}:{},...f!==void 0?{"data-value":f}:{},...i?{"data-active":""}:{},...n?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...p?{"aria-describedby":p}:{},...r?{title:r}:{},onMouseDown:Z,onClick:n?void 0:l,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),o?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:u(o)}):null,p?jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r}):null]})}function da({label:e,labelKey:t,className:o,hidden:n,children:r}){let i=De();if(n)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${o?` ${o}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function nl(e){if(e.slotId)return e.slotId;if(e.slot)return _m(e.slot),e.slot;Lm();}function bo(e){let{labelKey:t,shortcutKey:o,className:n,hidden:r}=e,i=nl(e)??"",{execute:a,isActive:s,isEnabled:l,disabledReason:c,value:d}=se(i),{setOpenMenu:f}=at(),u=De();if(r||!i)return null;let g=ee(i),m=u(t??g?.labelKey??i),p=editor.chromeSlotIsToggle(i),v=["setAlignment","setParagraphDirection","setReviewDisplayMode"].includes(editor.commandForSlot(i)?.type??"");return jsxRuntime.jsx(_e,{slot:i,icon:ae(g?.paths),...o?{shortcut:u(o)}:{},disabled:!l,...c?{title:c}:{},...p?{active:s}:{},...v?{selected:true}:{},...d!==null?{"data-value":d}:{},onSelect:()=>{a(),f(null);},...n?{className:n}:{},children:m})}bo.docxMenuRow=true;function ua(e,t,o,n,r=()=>true){return Object.assign(({className:a,hidden:s})=>{let l=at(),c=De(),d=n(l),f=o&&r(l)?o:void 0;if(s)return null;let u=ee(e),g=c(t??u?.labelKey??e);return jsxRuntime.jsx(_e,{slot:e,icon:ae(u?.paths),...f?{shortcut:c(f)}:{},disabled:!d,onSelect:()=>{d?.(),l.setOpenMenu(null);},...a?{className:a}:{},children:g})},{docxSlot:e})}var cd=ua("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),dd=ua("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave),ud=ua("file.exportMarkdown",void 0,void 0,e=>e.onExport?()=>e.onExport?.("markdown"):void 0),pd=ua("file.exportPdf",void 0,void 0,e=>e.onExport?()=>e.onExport?.("pdf"):void 0),md=ua("file.print",void 0,"toolbar.printShortcut",e=>e.onPrint,e=>e.printShortcut===true);function gP({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=se(editor.chromeProbeForSlot("file.pageSetup")),r=at(),i=De();if(t)return null;let a=ee("file.pageSetup"),s=i(a?.labelKey??"file.pageSetup"),l=o&&!!r.onPageSetup;return jsxRuntime.jsx(_e,{slot:"file.pageSetup",icon:ae(a?.paths),disabled:!l,...n?{title:n}:{},onSelect:()=>{r.onPageSetup?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:s})}function hP({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=se(editor.chromeProbeForSlot("paragraph.dialog")),r=at(),i=De();if(t)return null;let a=ee("paragraph.dialog"),s=i(a?.labelKey??"lineSpacing.options"),l=o&&!!r.onParagraphDialog;return jsxRuntime.jsx(_e,{slot:"paragraph.dialog",icon:ae(a?.paths),disabled:!l,...n?{title:n}:{},onSelect:()=>{r.onParagraphDialog?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:s})}var bP=Object.assign(hP,{docxSlot:"paragraph.dialog"}),fd=Object.assign(gP,{docxSlot:"file.pageSetup"});function vP({className:e,hidden:t}){let o=la(),n=at(),r=De();if(t)return null;let i=ee("image.insert"),a=r(i?.labelKey??"toolbar.image"),s=o?.isEnabled??false,l=o?.disabledReason??null;return jsxRuntime.jsx(_e,{slot:"image.insert",icon:ae(i?.paths),disabled:!s,...l?{title:l}:{},onSelect:()=>{o?.openFilePicker(),n.setOpenMenu(null);},...e?{className:e}:{},children:a})}var gd=Object.assign(vP,{docxSlot:"image.insert"}),ca=8;function Zt({labelKey:e,label:t,paths:o,className:n,children:r}){let i=De(),[a,s]=Et.useState(false),l=Et.useRef(null),c=Et.useRef(null),d=Et.useId();t===void 0&&e===void 0&&Fm();let f=t??i(e??""),[u,g]=Et.useState(null);return Et.useLayoutEffect(()=>{if(!a){g(null);return}let m=l.current,p=c.current,v=m?.ownerDocument.defaultView;if(!m||!p||!v)return;let y=m.getBoundingClientRect(),x=p.offsetWidth,b=p.offsetHeight,h=y.right+x>v.innerWidth-ca;g({left:h?Math.max(ca,y.left-x):Math.min(y.right,v.innerWidth-x-ca),top:Math.max(ca,Math.min(y.top-4,v.innerHeight-b-ca))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onKeyDown:m=>{m.key==="ArrowRight"&&document.activeElement===l.current?(m.preventDefault(),s(true),queueMicrotask(()=>{c.current&&Bt(mn(c.current),"first");})):(m.key==="ArrowLeft"||m.key==="Escape")&&a&&(m.preventDefault(),m.stopPropagation(),s(false),l.current?.focus());},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||s(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?d:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:Z,onFocus:()=>s(true),onClick:()=>s(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:ae(o)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:f}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:d,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":f,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:m=>{let p=c.current;if(!p)return;let v=mn(p);m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),Ot(v,document.activeElement,1)):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),Ot(v,document.activeElement,-1));},children:jsxRuntime.jsx(nr.Provider,{value:-1,children:r})}):null]})}function yP({entry:e}){let{isEnabled:t}=se(e.slot),o=ee(e.slot);return t?jsxRuntime.jsx(Zt,{labelKey:e.labelKey??o?.labelKey??e.slot,paths:o?.paths,children:jsxRuntime.jsx(ar,{slot:e.slot})}):jsxRuntime.jsx(bo,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function gn({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function pa({entry:e,children:t}){return e.kind==="separator"?jsxRuntime.jsx(gn,{}):e.kind==="submenu"?jsxRuntime.jsx(Zt,{labelKey:e.labelKey,paths:e.paths,children:t??e.items.map((o,n)=>jsxRuntime.jsx(pa,{entry:o},n))}):e.slot==="file.open"?jsxRuntime.jsx(cd,{}):e.slot==="file.save"?jsxRuntime.jsx(dd,{}):e.slot==="file.exportMarkdown"?jsxRuntime.jsx(ud,{}):e.slot==="file.exportPdf"?jsxRuntime.jsx(pd,{}):e.slot==="file.print"?jsxRuntime.jsx(md,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(fd,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(bP,{}):e.slot==="image.insert"?jsxRuntime.jsx(gd,{}):e.picker==="tableGrid"?jsxRuntime.jsx(yP,{entry:e}):jsxRuntime.jsx(bo,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function Df(e){if(!Et.isValidElement(e))return null;let t=tr(e,Df);if(t!==null)return t;let o=e.type;return typeof o!="function"&&typeof o!="object"?null:typeof o.docxSlot=="string"?o.docxSlot:o.docxMenuRow===true?nl(e.props)??null:null}function xP(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function Rf(e,t,o){return Vi({entries:e??[],children:t,preset:o,keyOfEntry:xP,keyOfChild:Df,childrenOfEntry:n=>n.kind==="submenu"?n.items:void 0,renderEntry:(n,r,i)=>jsxRuntime.jsx(pa,{entry:n,children:i})})}function qt({id:e,labelKey:t,label:o,icon:n,className:r,hidden:i,preset:a=true,children:s}){let{openMenu:l,setOpenMenu:c,activeMenu:d,opening:f}=at(),u=mf(),g=De(),m=Et.useId(),p=Et.useRef(null),v=Et.useRef(null),y=Et.useRef(false),x=Et.useRef(false),b=editor.CHROME_MENUS.find(E=>E.id===e),h=l===e,C=bf(h&&e===or,p,v);if(i)return null;let T=o??g(t??b?.labelKey??e),S=hf(u,e,d);if(S.skip)return null;if(S.asSubmenu)return jsxRuntime.jsx(Zt,{labelKey:t??b?.labelKey??e,label:T,children:Rf(b?.entries,s,a)});let P=Rf(b?.entries,s,a),k=S.iconOnly,w=()=>{c(null),p.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,...S.rootAttributes,children:[jsxRuntime.jsxs("button",{ref:p,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":h,"aria-controls":h?m:void 0,className:"docx-menubar__trigger",disabled:f===true,tabIndex:S.tabStop?0:-1,...h?{"data-open":""}:{},...k?{"aria-label":T,title:T}:{},onMouseDown:Z,onKeyDown:E=>{E.key==="ArrowDown"||E.key==="Enter"||E.key===" "||E.key==="ArrowUp"?(E.preventDefault(),y.current=true,c(e)):E.key==="Escape"&&h&&(E.preventDefault(),w());},onClick:()=>{if(x.current){x.current=false;return}c(h?null:e);},onMouseEnter:()=>{l!==null&&l!==e&&(x.current=true,c(e));},onMouseLeave:()=>{x.current=false;},children:[n?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:n}):null,k?null:T]}),h?jsxRuntime.jsx("div",{ref:E=>{v.current=E,E&&y.current&&(y.current=false,Bt(mn(E),"first"));},id:m,role:"menu","aria-label":T,style:C,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:E=>{let D=v.current;if(!D)return;let A=mn(D),_=document.activeElement;E.key==="ArrowDown"?(E.preventDefault(),Ot(A,_,1)):E.key==="ArrowUp"?(E.preventDefault(),Ot(A,_,-1)):E.key==="Home"?(E.preventDefault(),Bt(A,"first")):E.key==="End"?(E.preventDefault(),Bt(A,"last")):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),w()):E.key==="Tab"&&c(null);},children:jsxRuntime.jsx(nr.Provider,{value:-1,children:P})}):null]})}function hd(e){return Object.assign(o=>jsxRuntime.jsx(qt,{id:e,...o}),{docxMenu:e})}var bd=hd("file"),vd=hd("format"),yd=hd("insert");var rl=Et.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function Ao(){return Et.useContext(rl)}function _f(){return Et.useContext(rl).target}var Nf=["M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-560l-80-80 240-240h120v40L600-560ZM240-640q33 0 56.5-23.5T320-720q0-33-23.5-56.5T240-800q-33 0-56.5 23.5T160-720q0 33 23.5 56.5T240-640Zm240 180q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6Zm-240 300q33 0 56.5-23.5T320-240q0-33-23.5-56.5T240-320q-33 0-56.5 23.5T160-240q0 33 23.5 56.5T240-160Z"],Lf=["M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"],xd=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],Ff=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],Hf=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Af=["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],Of=["M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"];function sr(e,t,o){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:s,hidden:l})=>{let c=H(),{close:d}=Ao(),f=De(),{isEnabled:u,disabledReason:g}=se(t);return l?null:jsxRuntime.jsx(_e,{slot:e,icon:r??ae(o.paths),shortcut:f(a??o.shortcutKey),disabled:!u,...g?{title:g}:{},onSelect:()=>{c?.exec(t),d(true);},...s?{className:s}:{},children:f(i??o.labelKey)})},{docxRow:e})}var ma=sr("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:Nf}),fa=sr("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:Lf}),ga=sr("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Ff}),ha=sr("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:Of});function cr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=H(),{close:a,clipboardRefusal:s,reportClipboardRefusal:l}=Ao(),c=De(),d=Et.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:f,disabledReason:u}=se(d);if(r)return null;let g=s!==null;return jsxRuntime.jsx(_e,{slot:"edit.paste",icon:e??ae(xd),shortcut:c(o??"contextMenu.pasteShortcut"),disabled:!f||g,...s??u?{title:s??u??""}:{},onSelect:()=>{(async()=>{try{let{text:m,html:p}=await PP();(m||p)&&i?.exec({type:"paste",text:m,...p?{html:p}:{}});}catch(m){l(m instanceof Error?m.message:"the clipboard is not readable");}finally{a(true);}})();},...n?{className:n}:{},children:c(t??"contextMenu.paste")})}cr.docxRow="edit.paste";async function PP(){let e=navigator.clipboard;if(typeof e.read=="function"&&typeof ClipboardItem<"u")try{let t=await e.read(),o="",n=null;for(let r of t)r.types.includes("text/plain")&&(o=await(await r.getType("text/plain")).text()),r.types.includes("text/html")&&(n=await(await r.getType("text/html")).text());if(o||n)return {text:o,html:n}}catch{}return {text:await e.readText(),html:null}}function dr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=H(),{close:a,clipboardRefusal:s,reportClipboardRefusal:l}=Ao(),c=De(),d=Et.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:f,disabledReason:u}=se(d);if(r)return null;let g=s!==null;return jsxRuntime.jsx(_e,{slot:"edit.pasteWithoutFormatting",icon:e??ae(xd),shortcut:c(o??"contextMenu.pasteWithoutFormattingShortcut"),disabled:!f||g,...s??u?{title:s??u??""}:{},onSelect:()=>{(async()=>{try{let m=await navigator.clipboard.readText();m&&i?.exec({type:"pasteWithoutFormatting",text:m});}catch(m){l(m instanceof Error?m.message:"the clipboard is not readable");}finally{a(true);}})();},...n?{className:n}:{},children:c(t??"contextMenu.pasteWithoutFormatting")})}dr.docxRow="edit.pasteWithoutFormatting";var Bf=ee("format.painter")?.paths??[],al=sr("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:Bf}),il=sr("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:Bf});function hn(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:s,destructive:l})=>{let{close:c}=Ao(),d=De(),f=ll(),{isEnabled:u,disabledReason:g,execute:m}=se(t);return s||!f?null:jsxRuntime.jsx(_e,{slot:e,icon:r??ae(o.paths),disabled:!u,...g?{title:g}:{},className:`${l??o.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{m()&&c(true);},children:d(i??o.labelKey)})},{docxRow:e})}var ur=hn("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),pr=hn("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),mr=hn("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),fr=hn("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),gr=hn("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),hr=hn("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),br=hn("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),SP=[{alignment:"top",labelKey:"tableAdvanced.top",icon:"vertical_align_top"},{alignment:"center",labelKey:"tableAdvanced.middle",icon:"vertical_align_center"},{alignment:"bottom",labelKey:"tableAdvanced.bottom",icon:"vertical_align_bottom"}];function bn({hidden:e}){let{close:t}=Ao(),o=De(),n=ll(),r=se({type:"setTableCellVerticalAlignment",alignment:"top"}),i=se({type:"setTableCellVerticalAlignment",alignment:"center"}),a=se({type:"setTableCellVerticalAlignment",alignment:"bottom"}),s=[r,i,a];return e||!n?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":o("tableAdvanced.verticalAlignment"),children:SP.map((l,c)=>{let d=s[c];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":o(l.labelKey),title:d.disabledReason??o(l.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:f=>{f.preventDefault(),f.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:ae(editor.tableChromeIconPaths(l.icon))},l.alignment)})})]})}bn.docxRow="table.cellVerticalAlignment";function Zf(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:s})=>{let l=H(),{close:c,tocId:d}=Ao(),f=De(),u=Et.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:m}=se(u);return s||d===null?null:jsxRuntime.jsx(_e,{slot:e,icon:r??ae(o.paths),disabled:!g,...m?{title:m}:{},onSelect:()=>{l?.exec(u),c(true);},...a?{className:a}:{},children:f(i??o.labelKey)})},{docxRow:e})}var vr=Zf("toc.refresh","entire",{labelKey:"toc.refresh",paths:Hf}),yr=Zf("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Af});function ll(){return B(Et.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function sl({label:e,icon:t,shortcut:o,disabled:n,disabledReason:r,active:i,onSelect:a,className:s}){let{close:l}=Ao();return jsxRuntime.jsx(_e,{...t?{icon:t}:{},...o?{shortcut:o}:{},...n?{disabled:n}:{},...n&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),l(true);},...s?{className:s}:{},children:e})}var vn=Et.createContext(false);function Tt(){return Et.useContext(vn)?"":"docx-editor "}var ul=8;function DP(){let e=Et.useContext(Ct),t=at(),o=De(),{isEnabled:n,reason:r}=Gi(o);if((e?.mounted??0)===0)return null;let i=ee("review.addComment");return jsxRuntime.jsx(_e,{icon:ae(i?.paths),slot:"review.addComment",disabled:!n,title:r??void 0,onSelect:()=>{e?.requestCommentDraft()&&t.setOpenMenu(null);},children:o("comments.addComment")})}function IP(){let e=H(),t=at(),o=De();return e?.can({type:"editTextFormField"}).ok?jsxRuntime.jsx(_e,{slot:"field.edit",onSelect:()=>{t.setOpenMenu(null),e.exec({type:"editTextFormField"});},children:o("textFormField.edit")}):null}var _P=[{kind:"row",id:"field.edit",render:()=>jsxRuntime.jsx(IP,{})},{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(ma,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(fa,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(cr,{})},{kind:"row",id:"edit.pasteWithoutFormatting",render:()=>jsxRuntime.jsx(dr,{})},{kind:"row",id:"format.copyFormatting",render:()=>jsxRuntime.jsx(al,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(il,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(ga,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(ha,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(bo,{slotId:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.addComment",render:()=>jsxRuntime.jsx(DP,{})}];function NP(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:ur.docxRow,render:()=>jsxRuntime.jsx(ur,{})},{kind:"row",id:pr.docxRow,render:()=>jsxRuntime.jsx(pr,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:mr.docxRow,render:()=>jsxRuntime.jsx(mr,{})},{kind:"row",id:fr.docxRow,render:()=>jsxRuntime.jsx(fr,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:gr.docxRow,render:()=>jsxRuntime.jsx(gr,{})},{kind:"row",id:hr.docxRow,render:()=>jsxRuntime.jsx(hr,{})},{kind:"row",id:br.docxRow,render:()=>jsxRuntime.jsx(br,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:bn.docxRow,render:()=>jsxRuntime.jsx(bn,{})}]}function LP(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:vr.docxRow,render:()=>jsxRuntime.jsx(vr,{})},{kind:"row",id:yr.docxRow,render:()=>jsxRuntime.jsx(yr,{})}]}function FP(e,t=false){return [..._P,...e?NP():[],...t?LP():[]]}function $f(e){if(!Et.isValidElement(e))return null;let t=tr(e,$f);if(t!==null)return t;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxRow=="string")return o.docxRow;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxMenuRow===true){let n=nl(e.props);if(n)return n}return null}function Wf(e){if(!Et.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function HP(e){return e?.closest(".docx-editor__scroll-container")??null}function va({className:e,t,preset:o=true,disabled:n,onOpenChange:r,children:i}){let a=Tt(),s=H(),{t:l}=N(),c=ll(),d=Et.useRef(null),f=Et.useRef(null),[u,g]=Et.useState(null),[m,p]=Et.useState(null),[v,y]=Et.useState(null),x=Et.useMemo(()=>FP(c,m!==null),[c,m]),[b,h]=Et.useState(null),C=Et.useCallback((A=false)=>{g(null),h(null),p(null),y(null),A&&s?.focus();},[s]);Et.useEffect(()=>{if(n)return;let A=HP(d.current);if(!A)return;let _=F=>{F.preventDefault();let M=F.button===-1||F.clientX===0&&F.clientY===0,I=A.getBoundingClientRect();p(s?.snapshot().tocContext?.id??null),y(M||!(F.target instanceof HTMLElement)?null:F.target),g(M?{x:I.left+16,y:I.top+16}:{x:F.clientX,y:F.clientY});};return A.addEventListener("contextmenu",_),()=>A.removeEventListener("contextmenu",_)},[n,s]),Et.useEffect(()=>{n&&C();},[n,C]),Et.useEffect(()=>{if(!u)return;let A=M=>{f.current?.contains(M.target)||C();},_=M=>{M.key==="Escape"?(M.preventDefault(),C(true)):M.key==="Tab"&&C();},F=()=>C();return document.addEventListener("pointerdown",A,true),document.addEventListener("keydown",_),document.addEventListener("scroll",F,{capture:true,passive:true}),window.addEventListener("blur",F),window.addEventListener("resize",F),()=>{document.removeEventListener("pointerdown",A,true),document.removeEventListener("keydown",_),document.removeEventListener("scroll",F,true),window.removeEventListener("blur",F),window.removeEventListener("resize",F);}},[u,C]),Et.useLayoutEffect(()=>{let A=f.current;if(!u||!A)return;let{width:_,height:F}=A.getBoundingClientRect(),M=window.innerWidth-_-ul,I=window.innerHeight-F-ul,U=Math.max(ul,u.x>M?u.x-_:u.x),L=Math.max(ul,u.y>I?u.y-F:u.y);h({x:U,y:L});},[u]),Et.useLayoutEffect(()=>{b&&f.current?.focus({preventScroll:true});},[b]);let T=Et.useRef(r);T.current=r;let S=Et.useRef(false);Et.useEffect(()=>{let A=u!==null;A!==S.current&&(S.current=A,T.current?.(A));},[u]);let P=Et.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>C(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,C]),[k,w]=Et.useState(null),E=Et.useMemo(()=>({close:C,anchor:u,tocId:m,target:v,clipboardRefusal:k,reportClipboardRefusal:w}),[C,u,m,v,k]),D={position:"fixed",left:(b??u)?.x??0,top:(b??u)?.y??0,visibility:b?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:u?jsxRuntime.jsx(na.Provider,{value:P,children:jsxRuntime.jsx(rl.Provider,{value:E,children:jsxRuntime.jsxs("div",{ref:f,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??l("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:D,onKeyDown:A=>{let _=f.current;if(!_)return;let F=mn(_);A.key==="ArrowDown"?(A.preventDefault(),Ot(F,document.activeElement,1)):A.key==="ArrowUp"?(A.preventDefault(),Ot(F,document.activeElement,-1)):A.key==="Home"?(A.preventDefault(),Bt(F,"first")):A.key==="End"&&(A.preventDefault(),Bt(F,"last"));},children:[Et.Children.toArray(i).filter(Wf),Vi({entries:x,children:Et.Children.toArray(i).filter(A=>!Wf(A)),preset:o,keyOfEntry:A=>A.id,keyOfChild:A=>cf($f(A)),renderEntry:A=>A.kind==="separator"?jsxRuntime.jsx(gn,{}):A.render(),onUnmatched:(A,_)=>{_.props.hidden&&Nm(A);}})]})})}):null})}var Pd=Object.assign(va,{Cut:ma,Copy:fa,Paste:cr,PasteWithoutFormatting:dr,Delete:ga,SelectAll:ha,InsertRowAbove:ur,InsertRowBelow:pr,InsertColumnLeft:mr,InsertColumnRight:fr,DeleteTableRow:gr,DeleteTableColumn:hr,DeleteTable:br,CellVerticalAlignment:bn,RefreshToc:vr,RefreshTocPageNumbers:yr,Item:sl,Slot:bo,Row:_e,Group:da,Separator:gn,Submenu:Zt});var Uf=Et.createContext(void 0),Vf=Uf.Provider,Kt=()=>Et.useContext(Uf);function Gf(){let e=Kt(),{t}=N();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e?.hyperlink&&ke(e.hyperlink,{}),e?.contentControl&&ke(e.contentControl,{}),e?.equation&&ke(e.equation,{}),e?.contextMenu&&ke(e.contextMenu,{t:o=>t(o)})]})}function jf(e,t,o,n){return {...e,hyperlink:e?.hyperlink??(t===false?false:r=>jsxRuntime.jsx(Jr,{...r})),contentControl:e?.contentControl??(r=>jsxRuntime.jsx(ta,{...r})),equation:e?.equation??(()=>jsxRuntime.jsx(oa,{})),contextMenu:e?.contextMenu!==void 0?e.contextMenu===false?false:r=>e.contextMenu&&ke(e.contextMenu,{...r,t:n??r.t}):o===false?false:r=>jsxRuntime.jsx(va,{...r,t:n??r.t,...typeof o=="object"?o:{}})}}function KP(e,t){return e===t?true:!e||!t||e.kind!==t.kind?false:e.kind==="note"&&t.kind==="note"?e.id===t.id:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:true}function Sd(){let e=H(),t=Et.useCallback(n=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),o=B(t,KP);return o?.kind==="note"?o:null}function Yf(e,t){return e===t?true:!e||!t?false:e.pos===t.pos&&e.numFmt===t.numFmt&&e.numStart===t.numStart&&e.numRestart===t.numRestart}function Xf(e,t){return e.resolved.pos===t.resolved.pos&&e.resolved.numFmt===t.resolved.numFmt&&e.resolved.numStart===t.resolved.numStart&&e.resolved.numRestart===t.resolved.numRestart&&Yf(e.documentAuthored,t.documentAuthored)&&Yf(e.sectionAuthored,t.sectionAuthored)}function WP(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Xf(e.footnote,t.footnote)&&Xf(e.endnote,t.endnote)}function Ed(){let e=H(),t=Et.useCallback(o=>e?.getNotePropertiesState()??null,[e]);return B(t,WP)}function ya(e,t){let[o,n]=Et.useState(null),r=Et.useCallback(s=>n(s),[]),[i,a]=Et.useState({visibility:"hidden"});return Et.useLayoutEffect(()=>{let s=o?.closest(".docx-editor__scroll-container"),l=s??o?.parentElement?.querySelector(".docx-editor__scroll-container");if(!o||!l)return;let c=0,d=null,f=new ResizeObserver(()=>g()),u=()=>{c=0;let p=e(l);if(p!==d&&(f.disconnect(),f.observe(l),f.observe(o),p&&f.observe(p),d=p),!p||!p.isConnected){a({visibility:"hidden"});return}let v=p.getBoundingClientRect(),y=t==="story-label"?Math.max(o.offsetHeight,28):o.offsetHeight,x=t==="story-label"?6:4,b=s===l,h=t==="after"?v.bottom+6:v.top-y-x,C=b?Xn(l,v.left,h):{left:v.left,top:h},T=C.left,S=C.top,P=b?l.scrollLeft+8:8;a({position:b?"absolute":"fixed",left:t==="story-label"?T:Math.max(P,T+8),top:t==="story-label"?S:Math.max(b?l.scrollTop+8:8,S),...t==="story-label"?{width:Math.max(240,Math.min(v.width,l.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(v.width-16,l.clientWidth-16))},visibility:"visible"});},g=()=>{c||(c=requestAnimationFrame(u));};f.observe(l),f.observe(o);let m=new MutationObserver(g);return m.observe(l,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),l.addEventListener("scroll",g,{passive:true}),window.addEventListener("resize",g),u(),()=>{c&&cancelAnimationFrame(c),f.disconnect(),m.disconnect(),l.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[o,e,t]),{ref:r,style:i}}var UP=/^(footnote|endnote):(-?\d{1,10})$/;function eg(e){let t=UP.exec(e);if(!t)return null;let o=Number(t[2]);return Number.isInteger(o)?{noteKind:t[1],noteId:o}:null}function VP(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Md(e){let t=H();return Et.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function GP(e){let{t}=N(),[o,n]=Et.useState(false),r=Et.useRef(null);return Et.useEffect(()=>{if(!o)return;let i=a=>{r.current?.contains(a.target)||n(false);};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":o,"aria-haspopup":"menu",onMouseDown:Z,onClick:()=>n(i=>!i),children:t("headerFooter.options")}),o?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:Z,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),n(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),n(false);},children:t("common.close")})]}):null]})}function fl({className:e}){let t=Kt(),o=Et.useRef(null),{t:n}=N(),r=H(),i=Sd(),[a,s]=Et.useState(null),[l,c]=Et.useState(null),[d,f]=Et.useState(false),u=Et.useRef(null),g=Et.useCallback(D=>{if(!i)return null;let _=[...D.querySelectorAll("[data-docx-note-scope]")].find(F=>F.matches("[data-docx-note]")&&F.dataset.docxNoteScope===i.id)??null;return _?.closest("[data-docx-notes]")??_},[i]),m=ya(g,"story-label"),p=Et.useCallback(()=>{u.current&&clearTimeout(u.current),u.current=null,s(null);},[]);Et.useEffect(()=>{if(!r)return;let D=o.current?.closest(".docx-editor__scroll-container")??o.current?.closest(".docx-editor");if(!D)return;let A=M=>{let I=M.target;if(!I)return;let U=I.closest("[data-docx-note-ref]");if(U?.dataset.docxNoteScope){M.preventDefault(),p(),c(null),r.setActiveScope({kind:"note",id:U.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(M.preventDefault(),p(),c(null),r.setActiveScope({kind:"body"}));},_=M=>{let I=M,L=I.target?.closest("[data-docx-note-scope]");L?.dataset.docxNoteScope&&(I.preventDefault(),c({scopeId:L.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},F=M=>{if(VP())return;let U=M.target?.closest("[data-docx-note-ref]");if(!U?.dataset.docxNoteScope){p();return}let L=U.dataset.docxNoteScope,j=r.getNotePreviewText(L)??U.getAttribute("aria-description")??n("notes.previewFallback"),me=U.getBoundingClientRect();u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{s({scopeId:L,text:j,x:me.left,y:me.bottom+4});},400);};return D.addEventListener("click",A),D.addEventListener("contextmenu",_),D.addEventListener("pointerover",F),D.addEventListener("scroll",p,true),()=>{D.removeEventListener("click",A),D.removeEventListener("contextmenu",_),D.removeEventListener("pointerover",F),D.removeEventListener("scroll",p,true),p();}},[r,p,n]);let v=Et.useCallback(D=>{r&&(r.exec(D),c(null));},[r]),y=l?eg(l.scopeId):null,x=Et.useMemo(()=>y?{type:"deleteNote",noteKind:y.noteKind,noteId:y.noteId}:null,[y]),b=Et.useMemo(()=>y?{type:"convertNote",fromKind:y.noteKind,noteId:y.noteId}:null,[y]),h=Et.useMemo(()=>y?{type:"convertAllNotes",fromKind:y.noteKind}:null,[y]),C=Md(x??{type:"deleteNote",noteKind:"footnote",noteId:0}),T=Md(b??{type:"convertNote",fromKind:"footnote",noteId:0}),S=Md(h??{type:"convertAllNotes",fromKind:"footnote"}),P=i?eg(i.id):null,k=P?n("notes.editingRegion",{kind:P.noteKind==="footnote"?n("notes.footnoteKind"):n("notes.endnoteKind"),number:P.noteId}):null,w=l&&y?{...l,...y,onDelete:()=>{x&&v(x);},onConvert:()=>{b&&v(b);},onConvertAll:()=>{h&&v(h);},onOpenProperties:()=>f(true),onClose:()=>c(null),deleteEnabled:C.enabled,convertEnabled:T.enabled,convertAllEnabled:S.enabled,deleteDisabledReason:C.reason??void 0,convertDisabledReason:T.reason??void 0,convertAllDisabledReason:S.reason??void 0}:null,E={onClose:()=>f(false),onApply:D=>{v(D),f(false);}};return r?jsxRuntime.jsxs("div",{className:e,ref:o,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":i?void 0:true,children:[i&&P?jsxRuntime.jsxs("div",{ref:m.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":n("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":i.id,style:{...m.style,zIndex:ct.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:k}),jsxRuntime.jsx(GP,{onOpenProperties:()=>f(true),onClose:()=>r.setActiveScope({kind:"body"})})]}):null,a&&t?.notePreview!==false?t?.notePreview?ke(t.notePreview,a):jsxRuntime.jsx(jn,{...a}):null,w&&t?.notesContextMenu!==false?t?.notesContextMenu?ke(t.notesContextMenu,w):jsxRuntime.jsx(Yn,{...w}):null,d&&t?.noteProperties!==false?t?.noteProperties?ke(t.noteProperties,E):jsxRuntime.jsx(gl,{...E}):null]}):null}function gl(e){let{t}=N(),o=H(),n=Ed(),[r,i]=Et.useState("document"),[a,s]=Et.useState("decimal"),[l,c]=Et.useState("continuous"),[d,f]=Et.useState("pageBottom"),[u,g]=Et.useState("decimal"),[m,p]=Et.useState("continuous"),[v,y]=Et.useState("docEnd");Et.useEffect(()=>{n&&(s(n.footnote.resolved.numFmt),c(n.footnote.resolved.numRestart),f(n.footnote.resolved.pos),g(n.endnote.resolved.numFmt),p(n.endnote.resolved.numRestart),y(n.endnote.resolved.pos));},[n]);let x=!n?.footnote.documentAuthored&&!n?.footnote.sectionAuthored,b=!n?.endnote.documentAuthored&&!n?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","data-docx-modal":"","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:ct.modal},onClick:e.onClose,onKeyDown:h=>{h.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:h=>h.stopPropagation(),onMouseDown:h=>h.stopPropagation(),children:[jsxRuntime.jsx("h2",{className:"docx-note-properties__title",children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-note-properties__body",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__scope",children:[jsxRuntime.jsx("span",{children:t("notes.scope")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:r,onChange:h=>i(h.target.value),children:[jsxRuntime.jsx("option",{value:"document",children:t("notes.scopeDocument")}),jsxRuntime.jsx("option",{value:"section",children:t("notes.scopeSection")})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.footnotes")}),x?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange:h=>s(h.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:l,onChange:h=>c(h.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:d,onChange:h=>f(h.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsxRuntime.jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.endnotes")}),b?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:u,onChange:h=>g(h.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:m,onChange:h=>p(h.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:v,"data-testid":"docx-notes-endnote-position",onChange:h=>y(h.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsxRuntime.jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__footer",children:[jsxRuntime.jsx("button",{className:"docx-note-properties__button",type:"button",onClick:e.onClose,children:t("common.cancel")}),jsxRuntime.jsx("button",{className:"docx-note-properties__button docx-note-properties__button--primary",type:"button","data-testid":"docx-notes-properties-apply",onClick:()=>{if(!o)return;let h={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?n?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:l,position:d},endnote:{numFmt:u,numRestart:m,position:v}};o.can(h).ok&&e.onApply(h);},children:t("common.apply")})]})]})})}var ng=e=>e.image;function og(e){return Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(t=>t.offsetParent!==null||t===document.activeElement)}function tS(e){e&&!e.closest(".docx-editor")&&e.classList.add("docx-editor");}function oS(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Nd(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String(Ho(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ho(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(Ho(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ho(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function nS(e,t){let o=Nd(t);return e.horizontalPoints!==o.horizontalPoints||e.verticalPoints!==o.verticalPoints||e.relativeToH!==o.relativeToH||e.relativeToV!==o.relativeToV}function hl(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let o=ia(t);return Number.isInteger(o)?o:null}function rS(e,t){let o=Nd(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let c=e.horizontalPoints!==o.horizontalPoints,d=e.verticalPoints!==o.verticalPoints,f=c?hl(e.horizontalPoints):t.position?.horizontalEmu,u=d?hl(e.verticalPoints):t.position?.verticalEmu;return c&&f===null?{ok:false}:d&&u===null?{ok:false}:f===void 0||u===void 0?{ok:false}:{ok:true,value:{horizontalEmu:f,verticalEmu:u}}}let n=e.horizontalPoints!==o.horizontalPoints,r=e.verticalPoints!==o.verticalPoints,i=e.relativeToH!==o.relativeToH,a=e.relativeToV!==o.relativeToV,s=n?hl(e.horizontalPoints):t.position?.horizontalEmu,l=r?hl(e.verticalPoints):t.position?.verticalEmu;return n&&s===null?{ok:false}:r&&l===null?{ok:false}:{ok:true,value:{...typeof s=="number"?{horizontalEmu:s}:{},...typeof l=="number"?{verticalEmu:l}:{},...i||n||r?{relativeToH:e.relativeToH}:{},...a||n||r?{relativeToV:e.relativeToV}:{}}}}function bl(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function vl(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Ca({open:e,onClose:t,className:o,triggerRef:n}){let r=H(),{t:i}=N(),a=B(ng),s=Et.useId(),l=Et.useId(),c=Et.useId(),d=Et.useRef(null),f=Et.useRef(null),u=Et.useRef(null),g=Et.useRef(null),[m,p]=Et.useState(null),[v,y]=Et.useState(null),x=f.current,b=x?.canCrop===false,h=x?.canResize===false,C=x?.locks.changeAspect===true,T=x?.kind==="anchored"&&x.canMove===true,S=x?.kind==="inline",P=x?.kind==="anchored"&&x.canMove===false;Et.useEffect(()=>{if(!e){f.current=null,u.current=null,g.current=null;return}if(!a)return;if(f.current=a,r?.surface){let{anchor:U}=r.surface.state().selection;u.current={paragraphId:U.paragraphId,offset:U.offset},g.current=r.surface.session.packageRevision();}y(null);let M=Nd(a),I=a.crop;p({widthPoints:String(Ho(a.widthEmu)),heightPoints:String(Ho(a.heightEmu)),cropLeft:String(I.left),cropTop:String(I.top),cropRight:String(I.right),cropBottom:String(I.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...M});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let k=Et.useCallback(()=>{n?.current?.focus(),r?.focus();},[r,n]),w=Et.useCallback(()=>{t(),k();},[t,k]);Et.useEffect(()=>{if(!e)return;let M=d.current;if(!M)return;let I=og(M);(I.find(Y=>Y.id==="image-prop-width"&&!Y.hasAttribute("disabled"))??I.find(Y=>!Y.hasAttribute("disabled"))??M).focus();let L=Y=>{if(Y.key==="Escape"){Y.preventDefault(),w();return}if(Y.key!=="Tab")return;let j=og(M);if(j.length===0)return;let me=document.activeElement,z=j.findIndex(J=>J===me);if(z===-1)return;Y.preventDefault();let ie=Y.shiftKey?(z-1+j.length)%j.length:(z+1)%j.length;j[ie]?.focus();};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[e,w]);let E=Et.useMemo(()=>{let M=x??a;return !M||M.widthEmu<=0?1:M.widthEmu/M.heightEmu},[a,x]),D=Et.useCallback(M=>{p(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:M};let U=vl(M);if(U===null)return {...I,widthPoints:M};let L=Math.round(U/E*100)/100;return {...I,widthPoints:M,heightPoints:String(L)}});},[E]),A=Et.useCallback(M=>{p(I=>{if(!I)return I;if(!I.lockAspect)return {...I,heightPoints:M};let U=vl(M);if(U===null)return {...I,heightPoints:M};let L=Math.round(U*E*100)/100;return {...I,widthPoints:String(L),heightPoints:M}});},[E]),_=Et.useCallback(()=>{let M=f.current;if(!M?.intrinsic)return;let I=M.intrinsic.pixelWidth*72/M.intrinsic.dpiX,U=M.intrinsic.pixelHeight*72/M.intrinsic.dpiY;p(L=>L&&{...L,widthPoints:String(Math.round(I*100)/100),heightPoints:String(Math.round(U*100)/100)});},[a]),F=Et.useCallback(()=>{let M=f.current,I=u.current,U=g.current;if(!r||!M||!m||!I||U===null)return;let L={type:"setImageProperties",drawingNodeId:M.id,expectedPackageRevision:U,selectionParagraphId:I.paragraphId,selectionOffset:I.offset};if(!h){let J=vl(m.widthPoints),W=vl(m.heightPoints);if(J===null||W===null){y("imageProperties.errors.invalidDimensions");return}let q=ia(J),fe=ia(W);q!==M.widthEmu&&(L.widthEmu=q),fe!==M.heightEmu&&(L.heightEmu=fe);}if(M.canCrop&&!b){let J=bl(m.cropLeft),W=bl(m.cropTop),q=bl(m.cropRight),fe=bl(m.cropBottom);if(J===null||W===null||q===null||fe===null){y("imageProperties.errors.invalidCrop");return}let ve=M.crop;(J!==ve.left||W!==ve.top||q!==ve.right||fe!==ve.bottom)&&(L.crop={left:J,top:W,right:q,bottom:fe});}m.title!==M.title&&(L.title=m.title),m.description!==M.description&&(L.description=m.description);let Y=m.hyperlink.trim();if(Y!==(M.hyperlink??"")&&(L.hyperlink=Y===""?null:Y),M.canChangeWrap&&m.wrap!==M.wrap&&(L.wrap=m.wrap),M.kind==="anchored"&&M.canMove&&nS(m,M)){let J=rS(m,M);if(!J.ok){y("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(J.value,M))){y("imageProperties.errors.invalidPosition");return}Object.assign(L,J.value);}if(!(L.widthEmu!==void 0||L.heightEmu!==void 0||L.title!==void 0||L.description!==void 0||L.hyperlink!==void 0||L.crop!==void 0||L.wrap!==void 0||L.horizontalEmu!==void 0||L.verticalEmu!==void 0||L.relativeToH!==void 0||L.relativeToV!==void 0)){w();return}if(!r.can(L).ok){y("imageProperties.errors.refused");return}if(!r.exec(L).ok){y("imageProperties.errors.refused");return}w();},[r,m,b,h,w]);return !e||!m?null:jsxRuntime.jsx("div",{ref:tS,className:`docx-dialog-overlay${o?` ${o}`:""}`,onClick:w,onMouseDown:M=>{M.stopPropagation(),oS(M);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","data-docx-modal":"","aria-labelledby":s,className:"docx-dialog docx-image-properties-dialog",onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),children:[jsxRuntime.jsx("div",{id:s,className:"docx-dialog__header",children:i("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[v?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:i(v)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:i("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:m.widthPoints,disabled:h,onChange:M=>D(M.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:i("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:m.heightPoints,disabled:h,onChange:M=>A(M.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m.lockAspect,disabled:C,onChange:M=>p(I=>I&&{...I,lockAspect:M.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:b||!x?.intrinsic,onClick:_,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),S?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,P?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:i("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:m.relativeToH??"page",onChange:M=>p(I=>I&&{...I,relativeToH:M.target.value}),children:editor.DRAWING_REL_FROM_H.map(M=>jsxRuntime.jsx("option",{value:M,children:i(`dialogs.imagePosition.relativeOptions.${M}`)},M))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:i("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:m.relativeToV??"line",onChange:M=>p(I=>I&&{...I,relativeToV:M.target.value}),children:editor.DRAWING_REL_FROM_V.map(M=>jsxRuntime.jsx("option",{value:M,children:i(`dialogs.imagePosition.relativeOptions.${M}`)},M))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:i("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:m.horizontalPoints,onChange:M=>p(I=>I&&{...I,horizontalPoints:M.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:i("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:m.verticalPoints,onChange:M=>p(I=>I&&{...I,verticalPoints:M.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:i("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:m.title,onChange:M=>p(I=>I&&{...I,title:M.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:i("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:m.description,onChange:M=>p(I=>I&&{...I,description:M.target.value}),placeholder:i("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:c,className:"docx-dialog__input docx-dialog__input--full",value:m.hyperlink,onChange:M=>p(I=>I&&{...I,hyperlink:M.target.value}),placeholder:i("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:l,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:l,className:"docx-dialog__select docx-dialog__input--full",value:m.wrap,disabled:x?.canChangeWrap===false,onChange:M=>p(I=>I&&{...I,wrap:M.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(M=>jsxRuntime.jsx("option",{value:M,children:i(`imageWrap.targets.${M}`)},M))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:i("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:b,value:m.cropLeft,onChange:M=>p(I=>I&&{...I,cropLeft:M.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:i("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:b,value:m.cropTop,onChange:M=>p(I=>I&&{...I,cropTop:M.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:i("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:b,value:m.cropRight,onChange:M=>p(I=>I&&{...I,cropRight:M.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:i("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:b,value:m.cropBottom,onChange:M=>p(I=>I&&{...I,cropBottom:M.target.value})})]}),b?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:w,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:F,children:i("common.apply")})]})]})})}function yl({className:e,hidden:t,asChild:o,children:n}){let r=Kt(),i=H(),{t:a}=N(),s=B(ng),[l,c]=Et.useState(false),d=Et.useRef(null),f={type:"setImageProperties",description:"probe"},u=i&&s?i.can(f):null,g=u?.ok===true,m=u&&!u.ok?u.reason:null;if(t)return null;let p=ee("image.properties"),v={type:"button",ref:d,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":a("formattingBar.imagePropertiesShortcut"),title:m??a("formattingBar.imagePropertiesShortcut"),onMouseDown:Z,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(G,{...v,children:n}):jsxRuntime.jsx("button",{...v,children:n??ae(p?.paths)}),l&&r?.imageProperties!==false?r?.imageProperties?ke(r.imageProperties,{open:l,onClose:()=>c(false),triggerRef:d}):jsxRuntime.jsx(Ca,{open:l,onClose:()=>c(false),triggerRef:d}):null]})}yl.docxSlot="image.properties";var Cr=Object.assign(yl,{docxSlot:"image.properties"});function Ta(e){let t=H(),o=Et.useCallback(()=>editor.toolbarCommandState(t,e),[t,e]),n=B(o,(r,i)=>r.value===i.value&&r.enabled===i.enabled&&r.disabledReason===i.disabledReason);return Et.useMemo(()=>({execute:(r,i)=>editor.runToolbarCommand(t,e,r,i),value:n.value===void 0?null:e==="font.size"||e==="list.lineSpacing"?Number(n.value):n.value,options:e==="image.wrap"?editor.IMAGE_WRAP_TARGETS:[],isEnabled:n.enabled,disabledReason:n.disabledReason}),[t,e,n])}function xl({className:e,hidden:t,asChild:o,children:n}){let r=Kt(),i=Q(),{execute:a,value:s,isEnabled:l,disabledReason:c}=Ta("image.altText"),[d,f]=Et.useState(false),[u,g]=Et.useState(""),m=Et.useRef(null),p=Et.useRef(null),v=Et.useId();Et.useEffect(()=>{d&&g(s??"");},[d,s]),Et.useEffect(()=>{if(!d)return;let T=P=>{let k=m.current;P.target instanceof Node&&(k?.contains(P.target)||k?.ownerDocument.getElementById(v)?.contains(P.target))||f(false);},S=P=>{P.key==="Escape"&&(P.preventDefault(),f(false),p.current?.focus());};return document.addEventListener("mousedown",T,true),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",T,true),document.removeEventListener("keydown",S);}},[d,v]);let y=Et.useCallback(()=>{a(u),f(false);},[u,a]);if(t)return null;let x=ee("image.altText"),b=i(x?.labelKey??"formattingBar.altText"),h={type:"button",ref:p,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!l,...l?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?v:void 0,"aria-label":b,title:c??b,onMouseDown:Z,onClick:()=>f(T=>!T)},C={id:v,value:u,onValueChange:g,onApply:y,onClose:()=>f(false),isEnabled:l,anchorRef:p};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__alt-text",children:[o?jsxRuntime.jsx(G,{...h,children:n}):jsxRuntime.jsx("button",{...h,children:n??b}),d&&r?.imageAltText!==false?r?.imageAltText?ke(r.imageAltText,C):jsxRuntime.jsx(Cl,{...C}):null]})}xl.docxSlot="image.altText";var Pa=Object.assign(xl,{docxSlot:"image.altText"});function Cl({id:e,value:t,onValueChange:o,onApply:n,onClose:r,isEnabled:i,className:a}){let{t:s}=N();return jsxRuntime.jsxs("div",{id:e,role:"dialog","aria-label":s("imageAltText.panelTitle"),className:`docx-toolbar__alt-text-panel${a?` ${a}`:""}`,onMouseDown:l=>l.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${e}-description`,children:s("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${e}-description`,className:"docx-dialog__textarea",value:t,onChange:l=>o(l.target.value),placeholder:s("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:s("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",disabled:!i,onClick:n,children:s("common.apply")})]})]})}var lg=Et.createContext(void 0),sg=lg.Provider;function Ue(){let e=Et.useContext(lg),{t}=N();return Et.useCallback((o,n)=>{let r=e?.(o,n);return r===void 0||r===o?t(o,n):r},[e,t])}function Hd(e){let[t,o]=Et.useState(e.session),[n,r]=Et.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(bS,{...e},n)}function bS({session:e,className:t,style:o,children:n}){let r=Ue(),[i,a]=Et.useState(e.signal.aborted),s=Et.useRef(null);return Et.useEffect(()=>{let l=()=>a(true);return e.signal.addEventListener("abort",l,{once:true}),e.signal.aborted&&l(),()=>e.signal.removeEventListener("abort",l)},[e]),i?null:jsxRuntime.jsx(pt,{kind:"invalidTextFormField",role:"alertdialog",label:r("textFormField.invalidTitle"),className:t,style:o,panelRef:s,dismissOutside:false,onClose:e.acknowledge,sessionSignal:e.signal,restoreFocus:false,onKeyDown:l=>{l.key==="Enter"&&!l.nativeEvent.isComposing&&(l.preventDefault(),e.acknowledge());},children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("header",{className:"docx-dialog__header",children:jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:r("textFormField.invalidTitle")})}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:r(e.type==="number"?"textFormField.invalidNumber":"textFormField.invalidDate")}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:e.acknowledge,children:r("textFormField.apply")})})]})})}var ug=Et.createContext(null),pg=ug.Provider;function Qe(){let e=Et.useContext(ug);if(!e)throw new globalThis.Error("useContentControlWidget must be rendered inside DocxEditorContentControlWidget.");return e}function kS(e){return e.kind==="date"?editor.parseIsoDate(e.value)?e.value.slice(0,10):"":e.value}function mg(e){let t=`docx-cc-list-${Et.useId()}`,[o,n]=Et.useState(()=>kS(e)),[r,i]=Et.useState(()=>editor.calendarDateText(e.value,e.locale)),a=Et.useMemo(()=>editor.createContentControlListNavigation(e.locale),[e]),[s,l]=Et.useState(false),c=Et.useCallback(E=>{i(E),l(false);},[]),d=B(()=>e.canApply()),f=e.kind==="date"?editor.parseIsoDate(e.value):null,[u,g]=Et.useState(()=>{let E=f??new Date;return {year:E.getFullYear(),month:E.getMonth()}}),m=Et.useCallback(E=>{let D=e.apply(E??o);return l(!D),D},[e,o]),p=Et.useCallback(()=>e.cancel(),[e]),v=Et.useCallback(async E=>{if(!e.replaceImage)return l(true),false;try{let D=E instanceof Uint8Array?E.byteLength:E.size;if(!e.canApply()||D>store.DEFAULT_IMAGE_RESOURCE_LIMITS.maxEncodedBytes)return l(!0),!1;let A=E instanceof Uint8Array?E:new Uint8Array(await E.arrayBuffer()),_=await e.replaceImage(A);return l(!_),_}catch{return l(true),false}},[e]),y=Et.useMemo(()=>editor.calendarMonth(u.year,u.month,{locale:e.locale,selected:e.kind==="date"?e.value:null}),[u,e]),x=Et.useCallback(()=>{g(E=>editor.shiftMonth(E.year,E.month,-1)),S(null);},[]),b=Et.useCallback(()=>{g(E=>editor.shiftMonth(E.year,E.month,1)),S(null);},[]),h=Et.useCallback(E=>m(E),[m]),C=Et.useCallback(()=>m(editor.isoDateOf(new Date)),[m]),[T,S]=Et.useState(null),P=Et.useCallback(E=>{let D=editor.parseIsoDate(E);D&&(g({year:D.getFullYear(),month:D.getMonth()}),S(editor.isoDateOf(D)));},[]),k=Et.useCallback(()=>{let E=editor.calendarDateFromText(r,e.locale);return E?m(E):(l(true),false)},[r,e.locale,m]),w=Et.useCallback((E,D)=>{!Number.isInteger(E)||E<100||E>9999||!Number.isInteger(D)||D<0||D>11||(g({year:E,month:D}),S(null));},[]);return Et.useMemo(()=>({session:e,kind:e.kind,items:e.items,value:o,setValue:n,isEnabled:d,refused:s,apply:m,cancel:p,calendar:y,previousMonth:x,nextMonth:b,selectDay:h,selectToday:C,focusIso:T,focusDay:P,dateText:r,setDateText:c,applyDateText:k,showMonth:w,listNavigation:a,listId:t,accept:editor.CONTENT_CONTROL_PICTURE_ACCEPT,replaceImage:v}),[e,v,o,d,s,m,p,y,x,b,h,C,T,P,r,c,k,w,a,t])}function Ve(e,t,o,n){if(t.hidden)return null;let{children:r,asChild:i,className:a,style:s,hidden:l,id:c,title:d,"aria-label":f,...u}=t,g=r===void 0?n:r,{key:m,...p}=o,v={...c!==void 0?{id:c}:{},...d!==void 0?{title:d}:{},...f!==void 0?{"aria-label":f}:{}};if(i){let{className:x,style:b,...h}=p;return jsxRuntime.jsx(G,{...u,...h,...v,...a?{className:a}:{},style:{...b,...s},children:g},m)}return jsxRuntime.jsx(e,{...u,...p,...v,className:[o.className,a].filter(Boolean).join(" "),style:{...o.style,...s},children:g},m)}var Cn=e=>e.stopPropagation();function Zd(e){return Ve("div",e,{className:"docx-content-control-calendar-header","data-docx-part":"header"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qd,{}),jsxRuntime.jsx(Xd,{}),jsxRuntime.jsx(Kd,{}),jsxRuntime.jsx(Wd,{className:"docx-content-control-calendar-announcement"})]}))}function qd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"previousMonth","aria-label":o("contentControl.calendar.previousMonth"),onMouseDown:Cn,onClick:t.previousMonth},"\u2039")}function Kd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"nextMonth","aria-label":o("contentControl.calendar.nextMonth"),onMouseDown:Cn,onClick:t.nextMonth},"\u203A")}function Wd(e){let t=Qe();return Ve("div",e,{className:"docx-content-control-calendar-title","data-docx-part":"title","aria-live":"polite"},t.calendar.title)}function zd(e){let t=Qe();return Ve("div",e,{className:"docx-content-control-calendar-weekdays","data-docx-part":"weekdays"},t.calendar.weekdays.map((o,n)=>jsxRuntime.jsx("span",{children:o},n)))}function $d({day:e,...t}){let o=Qe(),n=o.calendar.days.find(i=>i.iso===o.focusIso)??o.calendar.days.find(i=>i.selected)??o.calendar.days.find(i=>i.today&&!i.otherMonth)??o.calendar.days.find(i=>!i.otherMonth),r=i=>{if(i.nativeEvent.isComposing||i.altKey||i.ctrlKey||i.metaKey)return;let a=editor.calendarDateForKey(e.iso,i.key,o.session.locale,i.shiftKey);a&&(i.preventDefault(),o.focusDay(a));};return Ve("button",t,{type:"button",className:"docx-content-control-calendar-day","data-docx-part":"day","data-iso":e.iso,role:"gridcell",tabIndex:e.iso===n?.iso?0:-1,"aria-label":e.label,...e.selected?{"data-selected":"","aria-selected":true}:{},"aria-current":e.today?"date":void 0,"aria-selected":e.selected,...e.today?{"data-today":""}:{},...e.otherMonth?{"data-other-month":""}:{},disabled:!o.isEnabled,onMouseDown:Cn,onClick:()=>o.selectDay(e.iso),onKeyDown:r},String(e.day))}function Ud(e){let t=Qe(),o=Et.useRef(null);return Et.useLayoutEffect(()=>{let n=o.current;if(!n||n.ownerDocument.activeElement?.closest("[data-docx-part=previousMonth],[data-docx-part=nextMonth],[data-docx-part=month],[data-docx-part=year]"))return;((t.focusIso?n.querySelector(`[data-iso="${t.focusIso}"]`):null)??n.querySelector("[data-selected]")??n.querySelector("[data-today]:not([data-other-month])")??n.querySelector('[data-docx-part="day"]:not([data-other-month])'))?.focus({preventScroll:true});},[t.focusIso,t.calendar]),Ve("div",e,{ref:o,className:"docx-content-control-calendar-grid","data-docx-part":"grid",role:"grid","aria-label":t.calendar.title},Array.from({length:6},(n,r)=>jsxRuntime.jsx("div",{role:"row",className:"docx-content-control-calendar-week",children:t.calendar.days.slice(r*7,r*7+7).map(i=>jsxRuntime.jsx($d,{day:i},i.iso))},r)))}function Vd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-content-control-calendar-today","data-docx-part":"today",disabled:!t.isEnabled,onMouseDown:Cn,onClick:t.selectToday},o("contentControl.calendar.today"))}function Gd(e){return Ve("div",e,{className:"docx-content-control-calendar","data-docx-part":"calendar"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Zd,{}),jsxRuntime.jsx(zd,{}),jsxRuntime.jsx(Ud,{}),jsxRuntime.jsxs("div",{className:"docx-content-control-calendar-entry","data-docx-part":"dateEntry",children:[jsxRuntime.jsx(Vd,{}),jsxRuntime.jsx(Pl,{})]}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(El,{})]}))}function jd({item:e,...t}){let o=Qe();return Ve("button",t,{type:"button",className:"docx-content-control-menu-item","data-docx-part":"item","data-value":e.value,role:"option",tabIndex:o.items.findIndex(n=>n.value===o.value)<0?o.items[0]===e?0:-1:o.value===e.value?0:-1,"aria-selected":o.value===e.value,disabled:!o.isEnabled,onMouseDown:Cn,onClick:()=>o.apply(e.value)},e.displayText)}function Tl(e){let t=Qe(),o=Ue();return Ve("div",e,{className:"docx-content-control-menu-list","data-docx-part":"list",role:"listbox",id:t.listId,"aria-label":o(`contentControl.types.${t.kind}`)},t.kind==="buildingBlockGallery"&&t.items.length===0?jsxRuntime.jsx("div",{className:"docx-content-control-menu-empty","data-docx-part":"empty",role:"note",tabIndex:0,children:o("contentControl.gallery.empty")}):t.items.map((n,r)=>jsxRuntime.jsx(jd,{item:n},r)))}function Pl(e){let t=Qe(),o=Ue();return Ve("input",e,{type:"text",className:"docx-content-control-menu-input","data-docx-part":"input","aria-label":o(`contentControl.types.${t.kind}`),value:t.kind==="date"?t.dateText:t.value,placeholder:t.kind==="date"?editor.calendarDateText("2006-11-22",t.session.locale):void 0,"aria-invalid":t.refused||void 0,role:t.kind==="comboBox"?"combobox":void 0,"aria-expanded":t.kind==="comboBox"?true:void 0,"aria-controls":t.kind==="comboBox"?t.listId:void 0,"aria-autocomplete":t.kind==="comboBox"?"list":void 0,onKeyDown:n=>{n.key!=="Enter"||n.nativeEvent.isComposing||(n.preventDefault(),n.stopPropagation(),t.kind==="date"?t.applyDateText():t.apply());},onMouseDown:Cn,onChange:n=>(t.kind==="date"?t.setDateText:t.setValue)(n.target.value)},void 0)}function Tr(e){let t=Qe(),o=Ue();return t.refused?Ve("div",e,{className:"docx-content-control-widget-error","data-docx-part":"error",role:"alert"},o("disabledReason.invalidValue")):null}function Yd(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-dialog__button docx-dialog__button--primary","data-docx-part":"apply",disabled:!t.isEnabled,onClick:()=>t.kind==="date"?t.applyDateText():t.apply()},o("common.apply"))}function Sl(e){let t=Qe(),o=Ue();return Ve("button",e,{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t.cancel},o("common.cancel"))}function El(e){return Ve("div",e,{className:"docx-dialog__footer","data-docx-part":"footer"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sl,{}),jsxRuntime.jsx(Yd,{})]}))}function Xd(e){return Ve("div",e,{className:"docx-content-control-calendar-navigation","data-docx-part":"navigation"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jd,{}),jsxRuntime.jsx(Qd,{})]}))}function Jd(e){let t=Qe(),o=Ue();return Ve("select",e,{className:"docx-content-control-calendar-month","data-docx-part":"month","aria-label":o("contentControl.calendar.month"),value:t.calendar.month,onChange:n=>t.showMonth(t.calendar.year,Number(n.target.value))},editor.calendarMonthNames(t.session.locale).map((n,r)=>jsxRuntime.jsx("option",{value:r,children:n},r)))}function Qd(e){let t=Qe(),o=Ue();return Ve("input",e,{type:"number",min:100,max:9999,className:"docx-content-control-calendar-year","data-docx-part":"year","aria-label":o("contentControl.calendar.year"),key:t.calendar.year,defaultValue:t.calendar.year,onBlur:n=>{let r=Number(n.target.value);if(!Number.isInteger(r)||r<100||r>9999){n.target.value=String(t.calendar.year);return}t.showMonth(r,t.calendar.month);},onKeyDown:n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&(n.preventDefault(),n.currentTarget.blur());}},void 0)}function eu({autoOpen:e,...t}){let o=Qe(),n=Ue(),r=Et.useRef(null),i=Et.useRef(false);return Et.useLayoutEffect(()=>{e!==false&&!i.current&&(i.current=true,r.current?.click());},[e]),Ve("input",t,{ref:r,type:"file",accept:o.accept,className:"docx-content-control-picture-input","data-docx-part":"picture","aria-label":n("contentControl.types.picture"),"aria-invalid":o.refused||void 0,onMouseDown:Cn,onCancel:o.cancel,onChange:a=>{let s=a.target.files?.[0];a.target.value="",s&&o.replaceImage(s);}},void 0)}function OS(e){let[t,o]=Et.useState(e.session),[n,r]=Et.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(BS,{...e},n)}function BS({session:e,className:t,style:o,children:n}){let r=Ue(),i=mg(e),[a,s]=Et.useState(e.signal.aborted),l=Et.useRef(null),[c]=Et.useState(()=>editor.contentControlPopupOpener(e.anchor)),d=e.kind==="checkbox"&&n===void 0;if(Et.useEffect(()=>{let u=()=>s(true);return e.signal.addEventListener("abort",u,{once:true}),e.signal.aborted&&u(),()=>e.signal.removeEventListener("abort",u)},[e]),Et.useEffect(()=>{!d||e.signal.aborted||e.apply(e.value==="true"?"false":"true");},[d,e]),Et.useLayoutEffect(()=>{if(a||d)return;let u=l.current,g=u?.ownerDocument,m=u&&e.anchor?editor.observeContentControlPopup(u,e.anchor):void 0;return u?.querySelector('[data-docx-part="grid"]')||(u?.querySelector("input")??u?.querySelector('[role=option][tabindex="0"]')??u?.querySelector("select,button,[data-docx-part=empty]"))?.focus({preventScroll:true}),()=>{m?.();let p=g?.activeElement;c?.isConnected&&(p===g?.body||p&&u?.contains(p))&&c.focus({preventScroll:true});}},[e,a,d,c]),Et.useEffect(()=>{let u=l.current;if(!u||a||d)return;let g=m=>{u.contains(m.target)||e.cancel();};return u.ownerDocument.addEventListener("pointerdown",g,true),()=>u.ownerDocument.removeEventListener("pointerdown",g,true)},[e,a,d]),a||d)return null;let f=r(`contentControl.types.${e.kind}`);return jsxRuntime.jsx(pg,{value:i,children:jsxRuntime.jsx("div",{ref:l,role:"dialog","aria-label":f,className:`docx-content-control-widget-popup${t?` ${t}`:""}`,style:o,"data-docx-popup":"contentControlWidget","data-docx-part":"popup","data-kind":e.kind,onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{editor.contentControlPopupKeyDown(u.currentTarget,u.nativeEvent,e.cancel),i.listNavigation.keyDown(u.nativeEvent,u.currentTarget);},children:n??ZS(i)})})}function ZS(e){return e.kind==="date"?jsxRuntime.jsx(Gd,{}):e.kind==="picture"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(eu,{}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(Sl,{})]}):e.kind==="comboBox"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pl,{}),jsxRuntime.jsx(Tl,{}),jsxRuntime.jsx(Tr,{}),jsxRuntime.jsx(El,{})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tl,{}),jsxRuntime.jsx(Tr,{})]})}var ru=Object.assign(OS,{Navigation:Xd,Month:Jd,Year:Qd,Calendar:Gd,Header:Zd,PreviousMonth:qd,Title:Wd,NextMonth:Kd,Weekdays:zd,Grid:Ud,Day:$d,Today:Vd,List:Tl,Item:jd,Input:Pl,Picture:eu,Error:Tr,Footer:El,Apply:Yd,Cancel:Sl});var to=ko();function KS(){return to.useState()}function WS({session:e,...t}){let[o,n]=Et.useState(e),[r,i]=Et.useState(0);return o!==e&&(n(e),i(r+1)),e?jsxRuntime.jsx(zS,{session:e,...t},r):null}function zS({session:e,children:t,preset:o,className:n,style:r}){let i=Ue(),a=B(()=>e.canApply()),[s,l]=Et.useState(()=>({defaultText:e.field.defaultText,type:e.field.type,maxLength:e.field.maxLength,format:e.field.format,enabled:e.field.enabled})),[c,d]=Et.useState(e.signal.aborted),[f,u]=Et.useState(false);Et.useEffect(()=>{let x=()=>d(true);return e.signal.addEventListener("abort",x),e.signal.aborted&&x(),()=>e.signal.removeEventListener("abort",x)},[e]);let g=()=>{if(e.signal.aborted)return;let x=Number.isInteger(s.maxLength)&&s.maxLength>=0&&s.maxLength<=32767&&e.apply(s.defaultText,{type:s.type,maxLength:s.maxLength,format:s.format,enabled:s.enabled});u(!x);},m={values:s,setValue(x,b){l(h=>({...h,[x]:b,...x==="type"?{format:""}:{}})),u(false);},errors:f?{form:i("textFormField.invalidOptions")}:{},isEnabled:!c&&a,apply:g,cancel:e.cancel};if(c)return null;let p=editor.TEXT_FORM_FORMATS[s.type]??[],v={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"},y=(x,b)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":x,className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label",children:i(`textFormField.${x}`)}),b]});return jsxRuntime.jsx(pt,{kind:"textFormField",className:n,style:r,label:i("textFormField.title"),onClose:e.cancel,dismissOutside:false,sessionSignal:e.signal,restoreFocus:false,onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),e.cancel()),x.key==="Enter"&&x.target instanceof HTMLInputElement&&(x.preventDefault(),g());},children:jsxRuntime.jsx(to.Composition,{state:m,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:i("textFormField.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[y("defaultText",jsxRuntime.jsx("input",{className:"docx-dialog__input",value:s.defaultText,onChange:x=>m.setValue("defaultText",x.target.value)})),y("type",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:s.type,onChange:x=>m.setValue("type",x.target.value),children:[["regular","number","date"].map(x=>jsxRuntime.jsx("option",{value:x,children:i(`textFormField.${x}`)},x)),Object.hasOwn(editor.TEXT_FORM_FORMATS,s.type)?null:jsxRuntime.jsx("option",{value:s.type,disabled:true,children:i("textFormField.preservedType")})]})),y("maxLength",jsxRuntime.jsx("input",{className:"docx-dialog__input",type:"number",min:0,max:32767,step:1,value:Number.isNaN(s.maxLength)?"":s.maxLength,onChange:x=>m.setValue("maxLength",x.target.valueAsNumber)})),y("format",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:s.format,onChange:x=>m.setValue("format",x.target.value),children:[p.map(x=>jsxRuntime.jsx("option",{value:x,children:v[x]?i(v[x]):x||i("textFormField.noFormat")},x)),p.includes(s.format)?null:jsxRuntime.jsx("option",{value:s.format,disabled:true,children:s.format||i("textFormField.noFormat")})]})),jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":"enabled",className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:s.enabled,onChange:x=>m.setValue("enabled",x.target.checked)}),i("textFormField.enabled")]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",className:"docx-dialog__error",role:"alert",children:m.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",className:"docx-dialog__button",type:"button",onClick:e.cancel,children:i("textFormField.cancel")}),jsxRuntime.jsx("button",{disabled:!a,"data-docx-part":"apply",className:"docx-dialog__button docx-dialog__apply",type:"button",onClick:g,children:i("textFormField.apply")})]})]}),children:t})})}var Ma=Object.assign(WS,{Header:to.Header,Title:to.Title,Body:to.Body,Footer:to.Footer,Apply:to.Apply,Cancel:to.Cancel,Error:to.Error,Field:to.Field});var hg="(prefers-color-scheme: dark)";function bg(){return typeof window<"u"&&typeof window.matchMedia=="function"}function vg(){return bg()?window.matchMedia(hg).matches:false}function yg(e,t){return e==="dark"||e==="system"&&t}function xg(e){if(!bg())return ()=>{};let t=window.matchMedia(hg);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}function iu(e){return e==="checkbox"?"contentControlCheckbox":e==="picture"?"contentControlPicture":"contentControlWidget"}function Tg(){let e=H(),t=Kt(),o=Et.useRef(t);o.current=t;let[n,r]=Et.useState(null),[i,a]=Et.useState(null),s=t?.contentControlWidget!==void 0,l=t?.contentControlCheckbox!==void 0,c=t?.contentControlPicture!==void 0,d=t?.invalidTextFormField!==void 0;Et.useEffect(()=>{if(!e||!s&&!l&&!c)return;let u=true,g=[...s?["dropdown","comboBox","date","buildingBlockGallery"]:[],...l?["checkbox"]:[],...c?["picture"]:[]],m=e.setContentControlWidgetChrome({kinds:g,onRequest(p){if(o.current?.[iu(p.kind)]===false)return p.cancel();r(p),p.signal.addEventListener("abort",()=>{u&&r(v=>v===p?null:v);},{once:true});}},{fallback:true});return ()=>{u=false,m(),r(null);}},[e,s,l,c]),Et.useEffect(()=>{if(!e||!d)return;let u=true,g=e.setInvalidTextFormFieldChrome({onRequest(m){if(o.current?.invalidTextFormField===false)return m.cancel();a(m),m.signal.addEventListener("abort",()=>{u&&a(p=>p===m?null:p);},{once:true});}},{fallback:true});return ()=>{u=false,g(),a(null);}},[e,d]),Et.useEffect(()=>{n&&t?.[iu(n.kind)]===false&&n.cancel(),t?.invalidTextFormField===false&&i?.cancel();},[t,n,i]);let f=n?t?.[iu(n.kind)]:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n&&f&&ke(f,{session:n},n),i&&t?.invalidTextFormField&&ke(t.invalidTextFormField,{session:i},i)]})}var YS=e=>e.pageSetup??null,XS=e=>e.editable;function Pn(){let e=H(),t=B(YS),o=B(XS),n=Et.useMemo(()=>o&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,o]),r=Et.useCallback(i=>e?e.exec({...i.pageWidthTwips!==void 0?{pageWidth:i.pageWidthTwips}:{},...i.pageHeightTwips!==void 0?{pageHeight:i.pageHeightTwips}:{},...i.orientation!==void 0?{orientation:i.orientation}:{},...i.marginTopTwips!==void 0?{marginTop:i.marginTopTwips}:{},...i.marginRightTwips!==void 0?{marginRight:i.marginRightTwips}:{},...i.marginBottomTwips!==void 0?{marginBottom:i.marginBottomTwips}:{},...i.marginLeftTwips!==void 0?{marginLeft:i.marginLeftTwips}:{},...i.scope!==void 0?{scope:i.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Et.useMemo(()=>({pageSetup:t,isEnabled:n,apply:r}),[t,n,r])}var su=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],Mg=1440,QS=e=>Math.round(e/Mg*100)/100,eE=e=>Math.round(e*Mg);function tE(e,t){let o=Math.min(e,t),n=Math.max(e,t);return su.findIndex(r=>Math.abs(r.width-o)<20&&Math.abs(r.height-n)<20)}var Eg=12240,wg=15840,Bo=1440;function oE({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),s=Ai(e,t),{pageSetup:l,isEnabled:c,apply:d}=Pn(),[f,u]=Et.useState(Eg),[g,m]=Et.useState(wg),[p,v]=Et.useState("portrait"),[y,x]=Et.useState(Bo),[b,h]=Et.useState(Bo),[C,T]=Et.useState(Bo),[S,P]=Et.useState(Bo),[k,w]=Et.useState(false),[E,D]=Et.useState("document"),A=Et.useRef(null),_=Et.useRef("no");Et.useEffect(()=>{if(!e){_.current="no";return}if(_.current==="yes"&&l===null){_.current="no";return}_.current==="yes"||_.current==="loading"&&l===null||(w(false),u(l?.pageWidthTwips??Eg),m(l?.pageHeightTwips??wg),v(l?.orientation??"portrait"),x(l?.marginsTwips.top??Bo),h(l?.marginsTwips.bottom??Bo),T(l?.marginsTwips.left??Bo),P(l?.marginsTwips.right??Bo),D("document"),_.current=l===null?"loading":"yes");},[e,l]);let F=Et.useCallback(z=>{let ie=su[z];ie&&(u(p==="landscape"?ie.height:ie.width),m(p==="landscape"?ie.width:ie.height));},[p]),M=Et.useCallback(z=>{z!==p&&(v(z),u(g),m(f));},[p,f,g]),I=Et.useCallback(()=>{if(!c)return;if(!s()){t();return}let z=d({pageWidthTwips:f,pageHeightTwips:g,orientation:p,marginTopTwips:y,marginRightTwips:S,marginBottomTwips:b,marginLeftTwips:C,scope:E});w(!z),z&&t();},[c,s,d,f,g,p,y,S,b,C,E,t]);if(!e)return null;let U=tE(f,g),L=(z,ie,J)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":`margin${z[0].toUpperCase()}${z.slice(1)}`,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a(`dialogs.pageSetup.${z}`)}),jsxRuntime.jsx("input",{type:"number",className:"docx-dialog__input",min:0,max:22,step:.1,value:QS(ie),onChange:W=>J(Math.max(0,eE(Number(W.target.value)||0))),"aria-label":a(`dialogs.pageSetup.${z}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:"in"})]}),Y={pageWidth:f,pageHeight:g,orientation:p,marginTop:y,marginBottom:b,marginLeft:C,marginRight:S,scope:E},j={pageWidth:u,pageHeight:m,orientation:M,marginTop:x,marginBottom:h,marginLeft:T,marginRight:P,scope:D},me={values:Y,setValue(z,ie){j[z](ie);},errors:k?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:I,cancel:t};return jsxRuntime.jsx(pt,{kind:"pageSetup",className:o,style:n,panelRef:A,label:a("dialogs.pageSetup.title"),onClose:t,onKeyDown:z=>{z.key==="Escape"&&t(),z.key==="Enter"&&z.target instanceof HTMLInputElement&&c&&(z.preventDefault(),I());},children:jsxRuntime.jsx(no.Composition,{state:me,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.pageSetup.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"pageSize",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:U,onChange:z=>F(Number(z.target.value)),"aria-label":a("dialogs.pageSetup.sizeLabel"),children:[su.map((z,ie)=>jsxRuntime.jsx("option",{value:ie,children:a(z.labelKey)},z.labelKey)),U<0&&jsxRuntime.jsx("option",{value:-1,children:a("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"orientation",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:p,onChange:z=>M(z.target.value),"aria-label":a("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:a("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:a("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label docx-dialog__section-label--spaced",children:a("dialogs.pageSetup.margins")}),L("top",y,x),L("bottom",b,h),L("left",C,T),L("right",S,P),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"scope",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:E,onChange:z=>D(z.target.value),"aria-label":a("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:a("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:a("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",className:"docx-dialog__error",children:k?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:I,children:a("common.apply")})]})]}),children:r})})}var no=ko();function nE(){return no.useState()}var Sn=Object.assign(oE,{Header:no.Header,Title:no.Title,Body:no.Body,Footer:no.Footer,Apply:no.Apply,Cancel:no.Cancel,Error:no.Error,Field:no.Field});var lE={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},sE=e=>{let t=e.formatting??null;if(!t)return null;let o=t.indent,n=t.paragraphFlags??lE;return {alignment:t.alignment==="both"?"justify":t.alignment??null,direction:t.direction??null,spaceBeforePt:t.spaceBeforePt??null,spaceAfterPt:t.spaceAfterPt??null,lineSpacing:t.lineSpacing??null,indentLeftTwips:o&&!o.mixed.left?o.left:null,indentRightTwips:o&&!o.mixed.right?o.right:null,indentFirstLineTwips:o&&!o.mixed.firstLine?o.firstLine:null,contextualSpacing:n.contextualSpacing,keepNext:n.keepNext,keepLines:n.keepLines,widowControl:n.widowControl,pageBreakBefore:n.pageBreakBefore,tabStops:t.tabStops??null,indentUnknown:!o,disagrees:{alignment:t.disagrees?.alignment??false,direction:t.disagrees?.direction??false,spaceBeforePt:t.disagrees?.spaceBeforePt??false,spaceAfterPt:t.disagrees?.spaceAfterPt??false,lineSpacing:t.disagrees?.lineSpacing??false,tabStops:t.disagrees?.tabStops??false,indentLeft:o?.mixed.left??false,indentRight:o?.mixed.right??false,indentFirstLine:o?.mixed.firstLine??false}}},cE=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],dE=(e,t)=>cE.every(o=>e.disagrees[o]===t.disagrees[o]),uE=(e,t)=>e===null||t===null?e===t:e.alignment===t.alignment&&e.direction===t.direction&&e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value&&e.indentLeftTwips===t.indentLeftTwips&&e.indentRightTwips===t.indentRightTwips&&e.indentFirstLineTwips===t.indentFirstLineTwips&&e.contextualSpacing===t.contextualSpacing&&e.keepNext===t.keepNext&&e.keepLines===t.keepLines&&e.widowControl===t.widowControl&&e.pageBreakBefore===t.pageBreakBefore&&dE(e,t)&&e.indentUnknown===t.indentUnknown&&e.tabStops?.length===t.tabStops?.length&&(e.tabStops??[]).every((o,n)=>o.positionTwips===t.tabStops?.[n]?.positionTwips&&o.alignment===t.tabStops?.[n]?.alignment&&(o.leader??"none")===(t.tabStops?.[n]?.leader??"none")),pE=e=>e.editable;function cu(){let e=H(),t=B(sE,uE),o=B(pE),n=Et.useMemo(()=>o&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,o]),r=Et.useCallback(i=>{if(!e)return false;let a={type:"setParagraphFormat",...i};return e.can(a).ok?e.exec(a).ok:false},[e]);return {format:t,isEnabled:n,apply:r}}function gE({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),s=Ai(e,t),{format:l,isEnabled:c,apply:d}=cu(),[f,u]=Et.useState("left"),[g,m]=Et.useState("ltr"),[p,v]=Et.useState(0),[y,x]=Et.useState(0),[b,h]=Et.useState("none"),[C,T]=Et.useState(0),[S,P]=Et.useState(0),[k,w]=Et.useState(0),[E,D]=Et.useState("multiple"),[A,_]=Et.useState(1.08),[F,M]=Et.useState(false),[I,U]=Et.useState(false),[L,Y]=Et.useState(false),[j,me]=Et.useState(true),[z,ie]=Et.useState(false),[J,W]=Et.useState([]),[q,fe]=Et.useState(false),[ve,de]=Et.useState(0),[ze,Lt]=Et.useState("left"),[Je,ut]=Et.useState("none"),[Se,uo]=Et.useState(editor.NO_MIXED_FIELDS),[po,mo]=Et.useState(false),Mo=K=>a(po&&(K==="indentLeft"||K==="indentRight"||K==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),Yt=Et.useRef(editor.NO_MIXED_FIELDS),ne=Et.useId(),[ge,xt]=Et.useState(false),zn=Et.useRef(null),re=Et.useRef(false),oe=Et.useRef(null);Et.useEffect(()=>{if(!e){re.current=false;return}if(re.current||l===null)return;let K=editor.seedFields(l);u(K.alignment),m(K.direction),v(K.indentLeft),x(K.indentRight),h(K.special),T(K.specialBy),P(K.spaceBefore),w(K.spaceAfter),D(K.lineRule),_(K.lineValue),M(K.contextualSpacing),U(K.keepNext),Y(K.keepLines),me(K.widowControl),ie(K.pageBreakBefore),W(K.tabStops),fe(false);let be=editor.mixedFieldsOf(l);uo(be),mo(l.indentUnknown),de(0),Lt("left"),ut("none"),Yt.current=be,xt(false),oe.current=K,re.current=true;},[e,l]);let ye=Et.useCallback(()=>{if(!c)return;if(!s()){t();return}let K=oe.current,be=K===null?null:editor.changedFields(K,{alignment:f,direction:g,indentLeft:p,indentRight:y,special:b,specialBy:C,spaceBefore:S,spaceAfter:k,lineRule:E,lineValue:A,contextualSpacing:F,keepNext:I,keepLines:L,widowControl:j,pageBreakBefore:z,tabStops:J,clearedAllTabStops:q},Yt.current,Se);if(be===null){t();return}if(d(be)){xt(false),t();return}xt(true);},[c,s,d,t,Se,q,f,g,p,y,b,C,S,k,E,A,F,I,L,j,z,J]),$e=Et.useCallback(()=>{let K=Math.round(ve);return K<=0?false:(uo(be=>({...be,tabStops:false})),W(editor.withTabStop(J,{positionTwips:K,alignment:ze,...Je!=="none"?{leader:Je}:{}})),de(0),Lt("left"),ut("none"),true)},[J,ve,ze,Je]);if(!e)return null;let Ze=K=>uo(be=>({...be,[K]:false})),fo=(K,be,Ro,rt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":rt,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-${K}`,children:a(`dialogs.paragraph.${K}`)}),jsxRuntime.jsx("input",{id:`${ne}-${K}`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Se[rt]?"":editor.twipsToInches(be),placeholder:Se[rt]?Mo(rt):void 0,onChange:zr=>{Ze(rt),Ro(editor.inchesToTwips(Number(zr.target.value)||0));},"aria-label":a(`dialogs.paragraph.${K}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),$n=(K,be,Ro,rt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":K,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-${K}`,children:a(`dialogs.paragraph.${K}`)}),jsxRuntime.jsx("input",{id:`${ne}-${K}`,type:"number",className:"docx-dialog__input",min:0,step:1,value:Se[rt]?"":be,placeholder:Se[rt]?Mo(rt):void 0,onChange:zr=>{Ze(rt),Ro(Math.max(0,Number(zr.target.value)||0));},"aria-label":a(`dialogs.paragraph.${K}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitPoints")})]}),Wr=(K,be,Ro)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":K,className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:be,ref:rt=>{rt&&(rt.indeterminate=Se[K]);},onChange:rt=>{uo(zr=>({...zr,[K]:false})),Ro(rt.target.checked);}}),a(`dialogs.paragraph.${K}`)]}),jy={alignment:f,direction:g,indentLeft:p,indentRight:y,special:b,specialBy:C,spaceBefore:S,spaceAfter:k,lineRule:E,lineValue:A,contextualSpacing:F,keepNext:I,keepLines:L,widowControl:j,pageBreakBefore:z,tabStops:J,clearedAllTabStops:q},mm=K=>{let be=Yt.current;K!==g&&!be.direction&&!be.alignment&&u(editor.alignmentAfterDirectionChange),m(K);},Yy={alignment:u,direction:mm,indentLeft:v,indentRight:x,special:h,specialBy:T,spaceBefore:P,spaceAfter:w,lineRule:D,lineValue:_,contextualSpacing:M,keepNext:U,keepLines:Y,widowControl:me,pageBreakBefore:ie,tabStops:W,clearedAllTabStops:fe},Xy={values:jy,mixed:Se,setValue(K,be){Yy[K](be),K==="lineRule"?(Ze("lineSpacing"),_(be===oe.current?.lineRule?oe.current.lineValue:be==="multiple"?1.08:12)):K==="specialBy"?Ze("special"):K in Se&&Ze(K);},errors:ge?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:ye,cancel:t};return jsxRuntime.jsx(pt,{kind:"paragraph",className:o,style:n,panelRef:zn,label:a("dialogs.paragraph.title"),onClose:t,onKeyDown:K=>{K.key==="Escape"&&t();let be=K.target instanceof HTMLButtonElement||K.target instanceof HTMLSelectElement;if(K.key==="Enter"&&!be){let Ro=K.target;if(Ro instanceof HTMLElement&&Ro.dataset.docxTabEntry!==void 0){$e();return}c&&ye();}},children:jsxRuntime.jsx(ro.Composition,{state:Xy,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.paragraph.title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-dialog__body",children:jsxRuntime.jsxs("div",{className:"docx-dialog__columns",children:[jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"alignment",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-alignment`,children:a("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${ne}-alignment`,className:"docx-dialog__input",value:Se.alignment?"":f,onChange:K=>{Ze("alignment"),u(K.target.value);},"aria-label":a("dialogs.paragraph.alignment"),children:[Se.alignment?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.alignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.alignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.alignRight")}),jsxRuntime.jsx("option",{value:"justify",children:a("dialogs.paragraph.alignJustify")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"direction",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-direction`,children:a("dialogs.paragraph.direction")}),jsxRuntime.jsxs("select",{id:`${ne}-direction`,className:"docx-dialog__input",value:Se.direction?"":g,onChange:K=>{Ze("direction"),mm(K.target.value);},"aria-label":a("dialogs.paragraph.direction"),children:[Se.direction?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"rtl",children:a("dialogs.paragraph.directionRtl")}),jsxRuntime.jsx("option",{value:"ltr",children:a("dialogs.paragraph.directionLtr")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.indentation")}),fo("beforeText",p,v,"indentLeft"),fo("afterText",y,x,"indentRight"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"special",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-special`,children:a("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${ne}-special`,className:"docx-dialog__input",value:Se.special?"":b,onChange:K=>{Ze("special"),h(K.target.value);},"aria-label":a("dialogs.paragraph.special"),children:[Se.special?jsxRuntime.jsx("option",{value:"",children:Mo("special")}):null,jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.specialNone")}),jsxRuntime.jsx("option",{value:"firstLine",children:a("dialogs.paragraph.specialFirstLine")}),jsxRuntime.jsx("option",{value:"hanging",children:a("dialogs.paragraph.specialHanging")})]})]}),b!=="none"?jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"specialBy",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-by`,children:a("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${ne}-by`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Se.special?"":editor.twipsToInches(C),placeholder:Se.special?Mo("special"):void 0,onChange:K=>{Ze("special"),T(Math.max(0,editor.inchesToTwips(Number(K.target.value)||0)));},"aria-label":a("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"tabStops",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.tabStops")}),J.length===0?jsxRuntime.jsx("div",{className:"docx-dialog__note",children:a(Se.tabStops?"dialogs.paragraph.tabMixed":"dialogs.paragraph.tabEmpty")}):J.map(K=>jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label docx-dialog__tab-position",children:a("dialogs.paragraph.tabPositionLabel",{position:editor.formatInches(K.positionTwips)})}),jsxRuntime.jsx("span",{className:"docx-dialog__tab-description",children:a(editor.TAB_ALIGNMENT_LABELS[K.alignment])}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>W(J.filter(be=>be!==K)),"aria-label":a("dialogs.paragraph.tabRemoveAt",{position:editor.formatInches(K.positionTwips)}),children:a("dialogs.paragraph.tabRemove")})]},K.positionTwips)),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-tabPosition`,children:a("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${ne}-tabPosition`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:editor.twipsToInches(ve),onChange:K=>de(Math.max(0,editor.inchesToTwips(Number(K.target.value)||0))),"aria-label":a("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-tabAlignment`,children:a("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${ne}-tabAlignment`,className:"docx-dialog__input",value:ze,onChange:K=>Lt(K.target.value),"aria-label":a("dialogs.paragraph.tabAlignment"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.tabAlignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.tabAlignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.tabAlignRight")}),jsxRuntime.jsx("option",{value:"decimal",children:a("dialogs.paragraph.tabAlignDecimal")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-tabLeader`,children:a("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${ne}-tabLeader`,className:"docx-dialog__input",value:Je,onChange:K=>ut(K.target.value),"aria-label":a("dialogs.paragraph.tabLeader"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.tabNone")}),jsxRuntime.jsx("option",{value:"dot",children:a("dialogs.paragraph.tabLeaderDot")}),jsxRuntime.jsx("option",{value:"hyphen",children:a("dialogs.paragraph.tabLeaderHyphen")}),jsxRuntime.jsx("option",{value:"underscore",children:a("dialogs.paragraph.tabLeaderUnderscore")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row docx-dialog__row--actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:$e,children:a("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>{uo(K=>({...K,tabStops:false})),fe(true),W([]);},children:a("dialogs.paragraph.tabClearAll")})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.spacing")}),$n("spaceBefore",S,P,"spaceBefore"),$n("spaceAfter",k,w,"spaceAfter"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineRule",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-lineSpacing`,children:a("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${ne}-lineSpacing`,className:"docx-dialog__input",value:Se.lineSpacing?"":E,onChange:K=>{let be=K.target.value;Ze("lineSpacing"),D(be),_(be===oe.current?.lineRule?oe.current.lineValue:be==="multiple"?1.08:12);},"aria-label":a("dialogs.paragraph.lineSpacing"),children:[Se.lineSpacing?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"multiple",children:a("dialogs.paragraph.ruleMultiple")}),jsxRuntime.jsx("option",{value:"atLeast",children:a("dialogs.paragraph.ruleAtLeast")}),jsxRuntime.jsx("option",{value:"exact",children:a("dialogs.paragraph.ruleExactly")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineValue",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ne}-at`,children:a("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${ne}-at`,type:"number",className:"docx-dialog__input",min:.01,step:E==="multiple"?.01:1,value:Se.lineSpacing?"":A,disabled:Se.lineSpacing,onChange:K=>{let be=K.target.value.trim();_(be===""?E==="multiple"?1.08:12:Number(be)||0);},"aria-label":a("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:E==="multiple"?"":a("dialogs.paragraph.unitPoints")})]}),Wr("contextualSpacing",F,M),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.pagination")}),Wr("keepNext",I,U),Wr("widowControl",j,me),Wr("keepLines",L,Y),Wr("pageBreakBefore",z,ie)]})]})}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{role:"alert","data-docx-part":"error",className:"docx-dialog__error",children:ge?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:ye,children:a("dialogs.paragraph.ok")})]})]}),children:r})})}var ro=ko();function hE(){return ro.useState()}var xo=Object.assign(gE,{Header:ro.Header,Title:ro.Title,Body:ro.Body,Footer:ro.Footer,Apply:ro.Apply,Cancel:ro.Cancel,Error:ro.Error,Field:ro.Field});var Hg=Et.createContext(null),Pr=()=>Et.useContext(Hg);function Ag({popups:e,children:t}){let o=H(),n=Cc(),[r,i]=Et.useState(null),[a,s]=Et.useState(null),[l,c]=Et.useState(null),[d,f]=Et.useState(null),u=Et.useRef(d);u.current=d;let g=Et.useRef(e);g.current=e;let m=Et.useRef(null),p=Et.useRef(l);p.current=l;let v=()=>s(null);Et.useEffect(()=>{if(a!==null)return;let h=m.current;m.current=null,h?.isConnected&&h.focus({preventScroll:true});},[a]),Et.useEffect(()=>{if(o)return o.setTextFormFieldChrome({onRequest(h){if(g.current?.textFormField===false){h.cancel();return}u.current?.cancel(),s(null),c(h),h.signal.addEventListener("abort",()=>c(C=>C===h?null:C),{once:true});}},{fallback:true})},[o]),Et.useEffect(()=>{if(!o||!r&&e?.revisionMarkup!==false)return;let h=o.setRevisionMarkupChrome({onRequest(C){if(g.current?.revisionMarkup===false){C.cancel();return}p.current?.cancel(),s(null),f(C),C.signal.addEventListener("abort",()=>f(T=>T===C?null:T),{once:true});}},{fallback:true});return ()=>{u.current?.cancel(),h();}},[o,r,e?.revisionMarkup===false]),Et.useEffect(()=>{s(null),c(null),f(null);},[o,n]),Et.useEffect(()=>{e?.revisionMarkup===false&&u.current?.cancel(),e?.textFormField===false&&p.current?.cancel(),a&&e?.[a]===false&&s(null);},[e,a]);let y=Et.useMemo(()=>({container:r,setContainer:i,ownsPageSetup:e?.pageSetup!==void 0,open(h,C){p.current?.cancel(),u.current?.cancel(),g.current?.[h]!==false&&(m.current=C??r?.ownerDocument.activeElement,s(h));}}),[r,e?.pageSetup]),x={open:true,onClose:v},b=a==="pageSetup"&&e?.pageSetup!==false?e?.pageSetup?ke(e.pageSetup,x):jsxRuntime.jsx(Sn,{...x}):a==="paragraph"&&e?.paragraph!==false?e?.paragraph?ke(e.paragraph,x):jsxRuntime.jsx(xo,{...x}):d&&e?.revisionMarkup!==false?e?.revisionMarkup?ke(e.revisionMarkup,{session:d},d):jsxRuntime.jsx(Ur,{session:d}):l&&e?.textFormField!==false?e?.textFormField?ke(e.textFormField,{session:l},l):jsxRuntime.jsx(Ma,{session:l}):null;return jsxRuntime.jsxs(Hg.Provider,{value:y,children:[t,r?reactDom.createPortal(b,r):null]})}function Og(){let e=Pr();return jsxRuntime.jsx("div",{className:"docx-dialog-mount",ref:e?.setContainer})}function Bg({children:e}){let t=Pr();return t?.container?reactDom.createPortal(e,t.container):e}var NE=["nw","n","ne","e","se","s","sw","w"],Wg=40,zg=12;function LE(e){return `imageOverlay.handle.${e}`}function FE(e){switch(e){case "nw":case "se":return "nwse-resize";case "ne":case "sw":return "nesw-resize";case "n":case "s":return "ns-resize";default:return "ew-resize"}}function HE(e){return {nw:{x:"0%",y:"0%"},n:{x:"50%",y:"0%"},ne:{x:"100%",y:"0%"},e:{x:"100%",y:"50%"},se:{x:"100%",y:"100%"},s:{x:"50%",y:"100%"},sw:{x:"0%",y:"100%"},w:{x:"0%",y:"50%"}}[e]}function AE(e,t){return e>0&&t>0?"se":e>0&&t<0?"ne":e<0&&t>0?"sw":e<0&&t<0?"nw":e>0?"e":e<0?"w":t>0?"s":"n"}function mu({containerRef:e,portalRef:t,scrollPort:o}){let n=H(),{t:r}=N(),[i,a]=Et.useState(null),[s,l]=Et.useState(null),[c,d]=Et.useState({left:0,top:0}),f=Et.useRef(null);f.current=s;let u=Et.useRef(null),g=Et.useRef(null),m=Et.useRef(null),p=Et.useRef(null),v=Et.useRef(null);Et.useEffect(()=>{let P=e.current;if(!P)return;let k=w=>{let E=w.target instanceof Element?w.target:null;if(E?.closest(".docx-drawing-textbox-content")){p.current=null;return}let D=E?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");p.current=D??null,D&&D===i?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return P.addEventListener("pointerdown",k,{capture:true}),()=>P.removeEventListener("pointerdown",k,{capture:true})},[e,i?.id]),Et.useEffect(()=>{if(!n){a(null);return}let P=()=>{a(editor.selectedDrawingOverlayTargetOf(n.surface));},k=()=>{queueMicrotask(P);};P();let w=[n.on("change",k),n.on("selectionChange",P)];return ()=>{for(let E of w)E();}},[n]);let y=Et.useCallback(()=>{d(P=>{let k=editor.overlayHostOrigin(e.current);return k.left===P.left&&k.top===P.top?P:k});},[e]);Et.useEffect(()=>{y();let P=t.current;if(!P||typeof ResizeObserver!="function")return;let k=new ResizeObserver(y);k.observe(P);let w=e.current;return w&&k.observe(w),()=>k.disconnect()},[e,t,y,i]),Et.useEffect(()=>{if(o){v.current=o;return}let P=e.current;if(!P||!n?.surface)return;let k=P.closest(".docx-editor__scroll-container");if(!k)return;let w=n.surface.overlayCoordinates();return v.current=editor.createImageOverlayScrollPort(k,w.paintScale),()=>{v.current=null;}},[e,n,o]);let x=Et.useCallback(()=>{l(null),u.current=null;let P=g.current;if(g.current=null,P)try{P.releasePointerCapture(P._lastPointerId??0);}catch{}},[]),b=Et.useCallback((P,k,w,E,D,A,_)=>{if(!n?.surface)return;let F=n.surface.activeScope();if(F.kind==="frame"&&!n.surface.selectDrawing(w.id,F.hostParagraphId))return;let M=n.surface.layout(),I=editor.captureImageMutationPreconditions(n);if(I){u.current=Object.freeze({x:E,y:D}),g.current=A,A._lastPointerId=_;try{A.setPointerCapture(_);}catch{}l({session:Object.freeze({drawingNodeId:w.id,startBounds:Object.freeze({x:w.x,y:w.y,width:w.width,height:w.height}),startWidthEmu:w.widthEmu,startHeightEmu:w.heightEmu,startPosition:w.position,anchorFrameOrigin:w.anchorFrameOrigin,transform:w.transform,mode:P,handle:k,preconditions:I,layoutRevision:M.revision,packageRevision:n.surface.session.packageRevision(),kind:w.kind}),bounds:w,accumulatedScrollPt:0}),m.current?.focus({preventScroll:true});}},[n]),h=Et.useCallback((P,k,w,E,D)=>{if(!n)return;if(editor.isStaleImageInteractionCommit(n,P)){x();return}P.mode==="resize"?n.exec({type:"setImageProperties",widthEmu:k,heightEmu:w,...D?.mode==="simple"?{horizontalEmu:D.horizontalEmu,verticalEmu:D.verticalEmu}:{},...D?.mode==="frame"?{...D.horizontalEmu!==void 0?{horizontalEmu:D.horizontalEmu}:{},...D.verticalEmu!==void 0?{verticalEmu:D.verticalEmu}:{}}:{}}):P.mode==="move"&&D&&n.exec({type:"setImagePosition",...D}),x();},[x,n]),C=Et.useCallback(P=>{if(!n)return;let k=f.current?.bounds??editor.selectedDrawingOverlayTargetOf(n.surface);if(!k)return;if(f.current&&P.key==="Escape"){P.preventDefault(),P.stopPropagation(),x();return}if(f.current)return;let w=P.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(P.key==="Delete"||P.key==="Backspace"){P.preventDefault(),P.stopPropagation(),n.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault(),P.stopPropagation();let E=P.key==="ArrowLeft"?-w:P.key==="ArrowRight"?w:0,D=P.key==="ArrowUp"?-w:P.key==="ArrowDown"?w:0;if(P.altKey){if(!k.canResize)return;let _=AE(E,D),F=editor.computeImageResizeResult({handle:_,startWidthEmu:k.widthEmu,startHeightEmu:k.heightEmu,startBounds:{x:k.x,y:k.y,width:k.width,height:k.height},startPosition:k.position,anchorFrameOrigin:k.anchorFrameOrigin,deltaXPt:E,deltaYPt:D,transform:k.transform,preserveAspect:editor.resizePreservesAspect(_,k.aspectLocked,P.shiftKey,k.textbox),kind:k.kind});n.exec({type:"setImageProperties",widthEmu:F.widthEmu,heightEmu:F.heightEmu,...F.position?.mode==="simple"?{horizontalEmu:F.position.horizontalEmu,verticalEmu:F.position.verticalEmu}:{},...F.position?.mode==="frame"?{...F.position.horizontalEmu!==void 0?{horizontalEmu:F.position.horizontalEmu}:{},...F.position.verticalEmu!==void 0?{verticalEmu:F.position.verticalEmu}:{}}:{}});return}if(k.kind!=="anchored"||!k.canMove||!k.position)return;let A=editor.computeMovedImagePosition(k.position,E,D);n.exec({type:"setImagePosition",...A});},[x,n]);Et.useEffect(()=>{if(!s||!n?.surface)return;let P=n.surface.overlayCoordinates(),k=E=>{let D=f.current,A=u.current;if(!D||!A)return;let _=editor.cssPixelsToLayoutPoints(E.clientX-A.x,P.paintScale),F=editor.cssPixelsToLayoutPoints(E.clientY-A.y,P.paintScale);if(D.session.mode==="move"){let I=0,U=v.current,L=e.current?.closest(".docx-editor__scroll-container");if(U&&L){let j=L.getBoundingClientRect();E.clientY>j.bottom-Wg?I=zg:E.clientY<j.top+Wg&&(I=-zg),I!==0&&(I=U.scrollBy(I));}let Y=D.accumulatedScrollPt+I;l({...D,accumulatedScrollPt:Y,bounds:Object.freeze({...D.bounds,x:D.session.startBounds.x+_,y:D.session.startBounds.y+F+Y})});return}if(!D.session.handle)return;let M=editor.computeImageResizeResult({handle:D.session.handle,startWidthEmu:D.session.startWidthEmu,startHeightEmu:D.session.startHeightEmu,startBounds:D.session.startBounds,startPosition:D.session.startPosition,anchorFrameOrigin:D.session.anchorFrameOrigin,deltaXPt:_,deltaYPt:F,transform:D.session.transform,preserveAspect:editor.resizePreservesAspect(D.session.handle,D.bounds.aspectLocked,E.shiftKey,D.bounds.textbox),kind:D.session.kind});l({...D,bounds:Object.freeze({...D.bounds,x:M.previewBounds.x,y:M.previewBounds.y,width:M.previewBounds.width,height:M.previewBounds.height,widthEmu:M.widthEmu,heightEmu:M.heightEmu})});},w=E=>{let D=f.current;if(D)if(E.type==="pointerup"){let A=editor.cssPixelsToLayoutPoints(E.clientX-(u.current?.x??E.clientX),P.paintScale),_=editor.cssPixelsToLayoutPoints(E.clientY-(u.current?.y??E.clientY),P.paintScale),F=editor.finalizeImageOverlayInteraction({session:D.session,deltaXPt:A,deltaYPt:_,accumulatedScrollPt:D.accumulatedScrollPt,aspectLocked:D.bounds.aspectLocked,textbox:D.bounds.textbox,shiftKey:E.shiftKey,anchorFrameOrigin:D.session.anchorFrameOrigin});h(D.session,F.widthEmu,F.heightEmu,F.previewBounds,F.position);}else x();};return window.addEventListener("pointermove",k),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w),()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w);}},[x,h,e,n,s]),Et.useEffect(()=>{!i||p.current!==i.id||(p.current=null,m.current?.focus({preventScroll:true}));},[i]);let T=s?.bounds??i,S=Et.useMemo(()=>{if(!n?.surface||!T)return null;let P=n.surface.publishedLayout(),k=n.surface.overlayCoordinates(),w=editor.overlayFrameToSheetCssPixels(P,{pageIndex:T.pageIndex,x:T.x,y:T.y,width:T.width,height:T.height},k),E={left:w.left+c.left,top:w.top+c.top,width:w.width,height:w.height},D=T.canResize,A=T.kind==="anchored"&&T.canMove;return jsxRuntime.jsxs("div",{ref:m,className:"docx-image-selection-overlay","data-drawing-node-id":T.id,tabIndex:0,onKeyDown:C,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${A?" docx-editor-one-surface__overlay-control":""}`,"data-textbox":T.textbox?"true":void 0,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${E.left}px`,top:`${E.top}px`,width:`${E.width}px`,height:`${E.height}px`,cursor:A?"move":"default"},onPointerDown:_=>{Z(_),!(!A||!T.position)&&_.button===0&&(_.preventDefault(),_.stopPropagation(),b("move",null,T,_.clientX,_.clientY,_.currentTarget,_.pointerId));}}),D?NE.map(_=>{let F=HE(_);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(LE(_)),tabIndex:0,style:{left:`calc(${E.left}px + ${E.width}px * ${parseFloat(F.x)/100} - 5px)`,top:`calc(${E.top}px + ${E.height}px * ${parseFloat(F.y)/100} - 5px)`,cursor:FE(_)},onPointerDown:M=>{Z(M),M.button===0&&(M.preventDefault(),M.stopPropagation(),b("resize",_,T,M.clientX,M.clientY,M.currentTarget,M.pointerId));}},_)}):null]})},[T,b,n,C,c.left,c.top,r]);return !S||!t.current?null:reactDom.createPortal(S,t.current)}function gu(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Ll({className:e}){let t=H(),o=la(),n=Et.useRef(null),r=Et.useRef(null);Et.useLayoutEffect(()=>{let l=n.current;if(!(!t||!l))return t.attach(l),()=>{t.detach();}},[t]);let i=Et.useCallback(l=>{if(!o?.isEnabled)return;let c=l.clipboardData;c&&gu(c)&&(editor.clipboardPasteLandsContent(c)||(l.preventDefault(),o.insertFromDataTransfer(c)));},[o]),a=Et.useCallback(l=>{!o?.isEnabled||!gu(l.dataTransfer)||l.preventDefault();},[o]),s=Et.useCallback(l=>{if(o?.isEnabled&&gu(l.dataTransfer)){if(editor.clipboardDropLandsText(l.dataTransfer)){if((l.target instanceof Element?l.target:null)?.closest("[contenteditable]")?.getAttribute("contenteditable")==="true")return;l.preventDefault();return}l.preventDefault(),o.insertFromDataTransfer(l.dataTransfer);}},[o]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:n,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:s}),jsxRuntime.jsx(Og,{}),jsxRuntime.jsx(Gf,{}),jsxRuntime.jsx(Tg,{}),t?jsxRuntime.jsx(mu,{containerRef:n,portalRef:r}):null]})}function Ne(e){return e/1440*96}function Fl(e){return e/96*1440}function ht(e){return `${Math.round(e*100)/100}px`}function hu(e){return e/2}var UE=e=>e.isLoading||e.isOpening===true,VE=e=>({width:Ne(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ne(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),GE=(e,t)=>e.width===t.width&&e.height===t.height;function bu({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}var Vg=false;function Gg(){Vg||!mt()||(Vg=true,console.warn("[docx-editor] loadingIndicator is ignored with chrome={false}, which renders no loading screen. Compose <DocxEditor.Loading overlay indicator={...} /> in a positioned box instead."));}function jE(e){let t=H(),[o,n]=Et.useState(null);return Et.useEffect(()=>{if(!(!t||!e))return t.setOpeningIndicatorHost({publish:n}),()=>{t.setOpeningIndicatorHost(null),n(null);}},[t,e]),o}function YE({when:e=false,overlay:t=false,className:o,style:n,indicator:r,children:i}){let a=B(UE),s=B(VE,GE),l=jE(t),{t:c}=N();if(!e&&!a)return null;let d=r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bu,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:c("loading.label")})]});if(l)return reactDom.createPortal(d,l);let f=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${o?` ${o}`:""}`;return jsxRuntime.jsx("div",{className:f,style:n,role:"status","aria-live":"polite",children:i??jsxRuntime.jsx("div",{className:"docx-paginated-surface docx-editor__loading-surface",style:{width:s.width,height:s.height},children:jsxRuntime.jsx("div",{className:"docx-pages",children:jsxRuntime.jsx("div",{className:"docx-page docx-editor__loading-page",children:jsxRuntime.jsx("div",{className:"docx-editor__loading-page-status",children:d})})})})})}var Hl=Object.assign(YE,{Spinner:bu});function jg(){let e=new Set,t=new Map,o=new Map,n=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let u=Object.create(null),g=[...t].sort((m,p)=>(o.get(m[0])??0)-(o.get(p[0])??0));for(let[,{author:m,style:p}]of g)u[m]=p;return {authors:u,others:e.size>0?"kind":"author"}}let s=null,l=false;function c(u){if(u===void 0)return "none";if(typeof u=="string")return u;let g=Object.entries(u.authors).map(([m,p])=>`${m}\0${JSON.stringify(p)}`).sort();return `${u.others??"kind"}${g.join("")}`}function d(){if(!r)return;let u=a(),g=c(u);if(g!==s){if(u===void 0){i&&(r.setRevisionStyles("author"),i=false,s=g);return}r.setRevisionStyles(u),i=true,s=g;}}function f(){!r||l||(l=true,queueMicrotask(()=>{l=false,d();}));}return {registerScheme(u){e.add(u),f();},register(u,g,m){o.has(u)||o.set(u,n++),t.set(u,{author:g,style:m}),f();},unregister(u){(e.delete(u)||t.delete(u))&&f();},connect(u){r=u;let g=a();i=u!==null&&g!==void 0,s=u===null?null:c(g),f();},current:a}}var _a=Et.createContext(null);function Jg(){let e=Et.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function vu(){let e=Et.useContext(_a),t=Jg();return Et.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function yu(e){let{author:t,color:o,background:n,activeBackground:r,spanClassName:i,avatarUrl:a}=e,s=Et.useContext(_a),l=Jg();return Et.useEffect(()=>{if(s)return s.register(l,t,{...o!==void 0?{color:o}:{},...n!==void 0?{background:n}:{},...r!==void 0?{activeBackground:r}:{},...i!==void 0?{spanClassName:i}:{},...a!==void 0?{avatarUrl:a}:{}}),()=>s.unregister(l)},[s,l,t,o,n,r,i,a]),null}var Qg=false;function eh(e,t){e===t||Qg||!mt()||(Qg=true,console.warn("[docx-editor] fieldResults changed after the editor was created, so the change is ignored. The editor reads fieldResults once; create a new editor to change it."));}var th=false,oh=e=>e?.allowFormattingInLockedContent===true;function nh(e,t){oh(e)===oh(t)||th||!mt()||(th=true,console.warn("[docx-editor] contentLockPolicy changed after the editor was created, so the change is ignored. The editor reads contentLockPolicy once; create a new editor to change it."));}var rh=false;function ah(e){return e===void 0?"characters":e}function ih(e,t){ah(e)===ah(t)||rh||!mt()||(rh=true,console.warn("[docx-editor] lockedControlNavigation changed after the editor was created, so the change is ignored. The editor reads lockedControlNavigation once; create a new editor to change it."));}function iw(e,t){if(e===t)return true;let o=editor.resolveZoomMode(e),n=editor.resolveZoomMode(t);return o!==null&&n!==null&&editor.sameZoomMode(o,n)}function lw(e){let t=Et.useRef(e);t.current=e;let[o,n]=Et.useState(null),{onReady:r,onChange:i,onFontError:a,onRevisionMarkupChange:s,...l}=e,c=Et.useMemo(()=>({onReady:d=>{n(d),t.current.onReady?.(d);},onChange:d=>t.current.onChange?.(d),onFontError:d=>t.current.onFontError?.(d),onRevisionMarkupChange:d=>t.current.onRevisionMarkupChange?.(d)}),[]);return {DocxEditorRoot:Na,rootProps:l,rootListeners:c,editorRef:o}}function Na(e){let{document:t,fonts:o,fontShaping:n,author:r,locale:i,translate:a,mode:s,zoom:l,zoomMode:c,tableInteractionLabel:d,imageDecodePort:f,children:u}=e,{t:g}=N(),m=Et.useCallback((L,Y)=>g(L,Y),[g]),p=Et.useRef(m);p.current=m;let v=Et.useRef(false),[y,x]=Et.useState(0),b=Et.useRef(e);b.current=e;let h=n?.maxFontBytes,[C,T]=Et.useState(null),S=Et.useRef(e.fieldResults),P=Et.useRef(e.contentLockPolicy),k=Et.useRef(e.lockedControlNavigation),w=Et.useRef(null);w.current??=jg();let E=w.current;Et.useEffect(()=>{let L=b.current,Y=L.translate??p.current,j=E.current();S.current=L.fieldResults,P.current=L.contentLockPolicy,k.current=L.lockedControlNavigation;let me=editor.createDocxEditor({...L.document!==void 0?{document:L.document}:{},...L.fonts?{fonts:L.fonts}:{},...L.fontShaping?{fontShaping:L.fontShaping}:{},...L.author!==void 0?{author:L.author}:{},...L.locale!==void 0?{locale:L.locale}:{},translate:Y,...L.revisionMarkup!==void 0?{revisionMarkup:L.revisionMarkup}:{},...L.reviewDisplayMode!==void 0?{reviewDisplayMode:L.reviewDisplayMode}:{},...L.fieldResults!==void 0?{fieldResults:L.fieldResults}:{},...L.contentLockPolicy!==void 0?{contentLockPolicy:L.contentLockPolicy}:{},...L.lockedControlNavigation!==void 0?{lockedControlNavigation:L.lockedControlNavigation}:{},...L.mode!==void 0?{mode:L.mode}:{},...j!==void 0?{revisionStyles:j}:{},...L.modules!==void 0?{modules:L.modules}:{},...L.zoom!==void 0?{zoom:L.zoom}:{},...L.zoomMode!==void 0?{zoomMode:L.zoomMode}:{},...L.tableInteractionLabel?{tableInteractionLabel:L.tableInteractionLabel}:{},...L.imageDecodePort?{imageDecodePort:L.imageDecodePort}:{},onFontError:J=>b.current.onFontError?.(J)}),z=me.on("revisionMarkupChange",J=>{v.current||(b.current.onRevisionMarkupChange?.(J),x(W=>W+1));}),ie=me.on("change",J=>b.current.onChange?.(J));return T(me),()=>{z(),ie(),me.destroy(),T(J=>J===me?null:J);}},[t,o,h,f,E]),Et.useEffect(()=>{if(!C)return;if(!C.snapshot().isOpening){b.current.onReady?.(C);return}let L=C.on("change",()=>{L(),b.current.onReady?.(C);});return L},[C]);let D=Et.useRef({editor:null,zoom:void 0,mode:void 0});Et.useEffect(()=>{if(!C)return;D.current.editor!==C&&(D.current={editor:C,zoom:void 0,mode:void 0});let Y=false;l!==void 0&&l!==D.current.zoom&&(D.current.zoom=l,C.setZoom(l),Y=true);let j=D.current.mode,me=c!==void 0&&(j===void 0||!iw(j,c)),z=c===void 0?null:editor.resolveZoomMode(c),ie=Y&&c!==void 0&&z!==null&&z.type==="fit";(me||ie)&&(D.current.mode=c,C.setZoomMode(c));},[C,l,c]),Et.useEffect(()=>{if(!C||e.revisionMarkup===void 0)return;let L=editor.resolveRevisionMarkup(e.revisionMarkup);if(JSON.stringify(L)!==JSON.stringify(C.snapshot().revisionMarkup)){v.current=true;try{C.setRevisionMarkup(L);}finally{v.current=false;}}},[C,e.revisionMarkup,y]),Et.useEffect(()=>{C&&C.setAuthor(r);},[C,r]);let A=Et.useRef({editor:null,value:void 0});Et.useEffect(()=>{if(C){if(A.current.editor!==C){A.current={editor:C,value:s};return}A.current.value!==s&&(A.current.value=s,C.setMode(s));}},[C,s]),Et.useEffect(()=>{C&&C.setTranslate(a??m);},[C,a,m]),Et.useEffect(()=>{C&&C.setLocale(i);},[C,i]),Et.useEffect(()=>{C&&eh(S.current,e.fieldResults);},[C,e.fieldResults]),Et.useEffect(()=>{C&&nh(P.current,e.contentLockPolicy);},[C,e.contentLockPolicy]),Et.useEffect(()=>{C&&ih(k.current,e.lockedControlNavigation);},[C,e.lockedControlNavigation]),Et.useEffect(()=>{C&&C.setTableInteractionLabel(d??editor.defaultTableLabel);},[C,d]);let[_,F]=Et.useState(0),M=Et.useRef([]),I=Et.useMemo(()=>({mounted:_,register:()=>(F(L=>L+1),()=>F(L=>Math.max(0,L-1))),registerCommentDraft:L=>(M.current.push(L),()=>{let Y=M.current.indexOf(L);Y!==-1&&M.current.splice(Y,1);}),requestCommentDraft:()=>{let L=M.current.at(-1);return L?(L(),true):false}}),[_]),U=Et.useMemo(Em,[]);return Et.useEffect(()=>(E.connect(C),()=>E.connect(null)),[E,C]),jsxRuntime.jsx(sg,{value:a??m,children:jsxRuntime.jsx(Ct.Provider,{value:I,children:jsxRuntime.jsx(pc.Provider,{value:C,children:jsxRuntime.jsx(Pc.Provider,{value:U,children:jsxRuntime.jsx(_a.Provider,{value:E,children:jsxRuntime.jsx(sw,{children:jsxRuntime.jsx(cw,{children:jsxRuntime.jsx(Qi,{children:jsxRuntime.jsx(Vf,{value:e.popups,children:jsxRuntime.jsx(Ag,{popups:e.popups,children:u})})})})})})})})})})}function sw({children:e}){let t=zi(true);return jsxRuntime.jsx(Xr.Provider,{value:t,children:e})}function cw({children:e}){let t=Ui();return jsxRuntime.jsx(Vc.Provider,{value:t,children:e})}var La=316,wr=editor.REVIEW_MARKERS_GUTTER_PX,dh=24,Ol={inlineStart:0,inlineEnd:La},lh={inlineStart:wr,inlineEnd:wr},gw={inlineStart:0,inlineEnd:0},Tu={inlineStart:dh,inlineEnd:La};function hw(e){return e.inlineStart===Tu.inlineStart&&e.inlineEnd===Tu.inlineEnd}function uh(e,t){return hw(e)?Math.max(0,t-(La-wr)):t}function ph({open:e,viewportWidth:t,pageWidthPx:o,inlineStartReservation:n=0,docked:r=false,scroll:i=false}){if(!e)return lh;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0)return Ol;let a=Number.isFinite(n)&&n>0?n:0;return t-a-o-2*dh>=La?Ol:i?Tu:lh}var bw=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:editor.reviewPaneEntitledZoom(t,e.zoom,e.reviewPane.overflow),scroll:e.reviewPane.overflow==="scroll"}},vw=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.scroll===t.scroll&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function mh(){let e=Ye(),[t,o]=Et.useState(null);return Et.useEffect(()=>{if(!e){o(null);return}let n=()=>o(e.clientWidth);if(n(),typeof ResizeObserver>"u")return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e]),t}function qo(){let e=Et.useContext(Ct),{pageSetup:t,reviewPaneOpen:o,entitledZoom:n,scroll:r}=B(bw,vw),i=Ye(),a=Mm(),s=Et.useRef(null);t&&(s.current=t.pageWidthTwips);let l=t?.pageWidthTwips??s.current,c=(e?.mounted??0)>0,d=Et.useCallback(g=>c?ph({open:o,viewportWidth:g??0,pageWidthPx:l===null||n===null?0:Ne(l)*n,inlineStartReservation:a,docked:n===null,scroll:r}):gw,[c,o,l,n,a,r]),[f,u]=Et.useState(()=>d(i?i.clientWidth:null));return Et.useEffect(()=>{let g=()=>u(d(i?i.clientWidth:null));if(g(),!i||typeof ResizeObserver>"u")return;let m=new ResizeObserver(g);return m.observe(i),()=>m.disconnect()},[i,d]),f}var Bl=[.25,.5,.75,1,1.25,1.5,2];function Fa(e,t){return t==="in"?Bl.find(n=>n>e+.001)??null:[...Bl].reverse().find(n=>n<e-.001)??null}function fh(e,t){return e==="0"?1:e==="+"||e==="="?Fa(t,"in")??t:e==="-"?Fa(t,"out")??t:null}var Pu=Et.createContext(false);function gh(e){let t=Et.useContext(Pu),[o,n]=Et.useState(null);return Et.useLayoutEffect(()=>{let r=t?e?.parentElement??null:null;n(r?{host:r,scoped:r.closest(".docx-editor")!==null}:null);},[t,e]),{inside:t,host:o?.host??null,hostScoped:o?.scoped??false}}var Sw=e=>e.reviewPaneOpen??true,Ew=e=>e.zoomMode?.type==="fit";function Zl({className:e,style:t,children:o}){let{t:n}=N(),r=Tt(),i=H(),a=B(Sw),s=qo(),l=B(Ew),d=(Et.useContext(Ct)?.mounted??0)>0,f=rn(),u=an(),g=Et.useCallback(p=>f?.setViewport(p),[f]),m=Et.useCallback(p=>{if(!i||!(p.metaKey||p.ctrlKey)||p.altKey)return;let v=p.target;if(v instanceof Element&&v.closest('input, textarea, select, [role="dialog"]'))return;let y=fh(p.key,i.getZoom());y!==null&&(p.preventDefault(),i.setZoom(y));},[i]);return jsxRuntime.jsx("div",{ref:g,"data-testid":"docx-editor-scroll",tabIndex:0,role:"region","aria-label":n("editor.documentViewport"),onKeyDownCapture:m,...d?{"data-review-pane":a?"open":"closed"}:{},...l?{"data-zoom-fit":""}:{},className:`${r}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...d?{"--docx-review-gutter":`${s.inlineEnd}px`,"--docx-review-gutter-start":`${s.inlineStart}px`,"--docx-review-strip":`${2*wr}px`}:{}},children:jsxRuntime.jsx(vn.Provider,{value:true,children:jsxRuntime.jsx(Pu.Provider,{value:true,children:o})})})}var Mw=editor.LOADING_SNAPSHOT;function bh({ref:e,editorRef:t}){Et.useImperativeHandle(e,()=>({load:o=>t.current?.load(o),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(o,n)=>t.current?.exec(o,n)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:o=>t.current?.snapshot(o)??Mw}),[t]);}function Mr(e,t,o,n){let r=Ye(),i=Et.useRef({close:o,skip:n,viewport:r});i.current={close:o,skip:n,viewport:r},Et.useEffect(()=>{let a=t.current;if(!e||!a)return;let s=d=>a.contains(d),l=editor.listenForPopupEscape({popup:a,contains:s,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current.viewport],skip:d=>i.current.skip?.(d)===true,close:d=>i.current.close(d)}),c=editor.listenForPopupFocusLeave({popup:a,contains:s,close:()=>i.current.close(false)});return ()=>{l(),c();}},[e,t]);}var Hw=e=>e.editingMode??"editing",wu='[role="menuitemradio"]:not([disabled])',Aw=(e,t)=>e.length===t.length&&e.every((o,n)=>o===t[n]),Ow=e=>e.isLoading||e.isOpening===true,Ha=[{mode:"editing",labelKey:"editingMode.editing",hintKey:"editingMode.editingHint",path:"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"},{mode:"suggesting",labelKey:"editingMode.suggesting",hintKey:"editingMode.suggestingHint",path:"M240-400h122l40-40H240v40Zm0-100h222l40-40H240v40Zm0-100h322l40-40H240v40ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v320h-80v-320H160v525l46-45h274v80H240L80-80Zm520-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T943-380L723-160H600Zm300-263-37-37 37 37ZM660-220h38l121-122-19-18-18-19-122 121v38Zm140-141-18-19 37 37-19-18Z"},{mode:"viewing",labelKey:"editingMode.viewing",hintKey:"editingMode.viewingHint",path:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Z"}],Bw=Object.freeze(Ha.map(()=>null));function Zw(e){return e?Ha.map(t=>{let o=e.can({type:"setEditingMode",mode:t.mode});return o.ok?null:o.reason}):Bw}var qw="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Kl({className:e,hidden:t}){let o=H(),n=B(Hw),r=B(Ow),i=Q(),{t:a}=N(),[s,l]=Et.useState(false),c=Et.useRef(null),d=Et.useRef(null),f=Et.useRef(null);Et.useEffect(()=>{if(!s)return;let b=f.current?.querySelectorAll(wu);(f.current?.querySelector(`${wu}[aria-checked="true"]`)??b?.[0]??void 0)?.focus();},[s]);let u=Et.useCallback(b=>{let h=[...f.current?.querySelectorAll(wu)??[]],C=h.indexOf(document.activeElement),T=S=>{b.preventDefault(),h[(S+h.length)%h.length]?.focus();};b.key==="ArrowDown"?T(C+1):b.key==="ArrowUp"?T(C-1):b.key==="Home"?T(0):b.key==="End"&&T(h.length-1);},[]);Et.useEffect(()=>{if(!s)return;let b=h=>{let C=c.current;C&&h.target instanceof Node&&C.contains(h.target)||l(false);};return document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("mousedown",b,true);}},[s]),Mr(s,c,b=>{l(false),b&&d.current?.focus();});let g=Et.useCallback(b=>{l(false),editor.runToolbarCommand(o,"review.editingMode",b),o?.focus();},[o]),m=editor.toolbarCommandState(o,"review.editingMode"),p=i18n.localizeDisabledReason(m.disabledReason,a),v=B(()=>Zw(o),Aw),y=Et.useMemo(()=>Ha.find(b=>b.mode===n)??Ha[0],[n]);if(t)return null;let x=ee("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":n,"aria-haspopup":"menu","aria-expanded":s,"aria-label":i(x?.labelKey??"editingMode.label"),disabled:r||!m.enabled,...p?{title:p}:{},onMouseDown:Z,onClick:()=>l(b=>!b),children:[Mu(y.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(y.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{ref:f,className:"docx-toolbar__mode-menu",role:"menu","aria-label":i(x?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:Ha.map((b,h)=>{let C=i18n.localizeDisabledReason(v[h]??null,a);return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":b.mode===n,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${b.mode}`,disabled:C!==null,...C?{title:C}:{},onMouseDown:Z,onClick:()=>g(b.mode),children:[Mu(b.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(b.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(b.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:b.mode===n?Mu(qw):null})]},b.mode)})}):null]})}Kl.docxSlot="review.editingMode";function Mu(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}var Ch=[],zw=()=>{};function Aa(){let e=H(),t=Et.useCallback(o=>{if(!e)return zw;let n=$r(o),r=e.on("change",n),i=e.on("selectionChange",n);return ()=>{r(),i();}},[e]);return Et.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Ch,()=>Ch)}var Yw=e=>e.hiddenReviewAuthors??[];function zl({className:e,hidden:t,icon:o}){let n=H(),r=Aa(),i=B(Yw),a=new Set(i),s=r.every(h=>!a.has(h.author)),[l,c]=Et.useState(false),d=Et.useRef(null),f=Et.useRef(null),u=Et.useRef(null),g=Q(),{t:m}=N();Et.useEffect(()=>{if(!l)return;u.current?.querySelector('[role="menuitemcheckbox"]')?.focus();let h=C=>{d.current?.contains(C.target)||c(false);};return document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("mousedown",h,true);}},[l]),Mr(l,d,h=>{c(false),h&&f.current?.focus();});let p=Et.useCallback(h=>{let C=[...u.current?.querySelectorAll('[role="menuitemcheckbox"]')??[]],T=C.indexOf(document.activeElement),S=P=>{h.preventDefault(),C[(P+C.length)%C.length]?.focus();};h.key==="ArrowDown"?S(T+1):h.key==="ArrowUp"?S(T-1):h.key==="Home"?S(0):h.key==="End"?S(C.length-1):h.key==="Tab"&&c(false);},[]);if(t)return null;let v=ee("review.authors"),y=editor.toolbarCommandState(n,"review.authors"),x=i18n.localizeDisabledReason(y.disabledReason,m),b=g(v?.labelKey??"reviewers.label");return jsxRuntime.jsxs("div",{ref:d,className:`docx-toolbar__reviewers${e?` ${e}`:""}`,"data-slot":"review.authors",children:[jsxRuntime.jsxs("button",{ref:f,type:"button",className:"docx-toolbar__picker","data-testid":"reviewers-trigger","aria-haspopup":"menu","aria-expanded":l,"aria-label":b,disabled:!y.enabled,title:x??b,onMouseDown:Z,onClick:()=>c(h=>!h),children:[o??ae(v?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:b}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__reviewers-menu",role:"menu","aria-label":b,"data-testid":"reviewers-menu",onKeyDown:p,children:[jsxRuntime.jsx(Th,{checked:s,label:m("reviewers.all"),testId:"reviewer-all",onChoose:()=>n?.setAllReviewAuthorsVisible(!s)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),r.map(h=>jsxRuntime.jsx(Th,{checked:!a.has(h.author),label:h.author||"\u2014",testId:`reviewer-${h.slot}`,color:h.color,onChoose:()=>n?.setReviewAuthorVisible(h.author,a.has(h.author))},h.author))]}):null]})}zl.docxSlot="review.authors";function Th(e){return jsxRuntime.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,className:"docx-toolbar__reviewer-item","data-testid":e.testId,onMouseDown:Z,onClick:e.onChoose,children:[jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:e.checked?"\u2713":""}),e.color?jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-swatch",style:{background:e.color}}):null,jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-name",children:e.label})]})}var Ph=Et.createContext(null);function Sh({children:e}){let t=Pr(),[o,n]=Et.useState(false),r=Et.useRef(null),i=Et.useMemo(()=>({open:s=>{if(t){t.open("paragraph",s);return}r.current=s??document.activeElement,n(true);}}),[t]),a=Et.useCallback(()=>{n(false);let s=r.current;r.current=null,s instanceof HTMLElement&&s.isConnected&&s.focus({preventScroll:true});},[]);return jsxRuntime.jsxs(Ph.Provider,{value:i,children:[e,jsxRuntime.jsx(xo,{open:o,onClose:a})]})}function Eh(){return Et.useContext(Ph)}var ku=["M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"],Du=Et.createContext({close:()=>{}});function Rr(){return Et.useContext(Du).close}function g1(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function kh({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__more-control",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-label",children:e}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-body",children:t})]})}function Dh({slot:e}){let t=Q(),o=Do(),{close:n}=Et.useContext(Du),{execute:r,isActive:i,isEnabled:a,disabledReason:s,value:l}=se(e),c=ee(e),d=editor.chromeSlotIsToggle(e),f=o(t(c?.labelKey??e));return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...s?{title:s}:{},...d?{"aria-pressed":i}:{},...i?{"data-active":""}:{},...l!==null?{"data-value":l}:{},onMouseDown:Z,onClick:u=>{r(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:ae(c?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:f})]})}function Ih({sections:e,className:t}){let o=Q(),[n,r]=Et.useState(false),i=Et.useRef(null),a=Et.useRef(null),s=Et.useRef(null),l=Et.useRef(false),c=Et.useId(),d=Ye(),f=Et.useRef(d);f.current=d;let u=o("formattingBar.more"),g=Et.useCallback(x=>{r(false),x&&a.current?.focus();},[]),m=Et.useMemo(()=>({close:g}),[g]);Et.useEffect(()=>{if(!n)return;let x=S=>{let P=S.target;P instanceof Node&&i.current?.contains(P)||r(false);},b=i.current,h=S=>i.current?.contains(S)===true||s.current?.contains(S)===true,C=b?editor.listenForPopupEscape({popup:b,contains:h,chromeRoot:()=>i.current?.closest(".docx-editor"),editorElements:()=>[f.current],skip:()=>editor.hasOpenNestedPopup(s.current),close:g}):void 0,T=b?editor.listenForPopupFocusLeave({popup:b,contains:h,close:()=>r(false)}):void 0;return document.addEventListener("mousedown",x,true),()=>{document.removeEventListener("mousedown",x,true),C?.(),T?.();}},[n,g]);let[p,v]=Et.useState(null);Et.useLayoutEffect(()=>{if(!n){v(null);return}let x=()=>{let h=i.current,C=s.current,T=a.current,S=h?.ownerDocument.defaultView;if(!h||!C||!T||!S)return;let P=T.getBoundingClientRect(),k=editor.toolbarPanelPlacement({triggerLeft:P.left,triggerRight:P.right,panelWidth:C.offsetWidth,viewportWidth:S.innerWidth}),w=k.left-h.getBoundingClientRect().left;v(E=>E&&E.left===w&&E.maxWidth===k.maxWidth&&E.anchor===k.anchor?E:{...k,left:w});};x();let b=i.current?.ownerDocument.defaultView;return b?.addEventListener("resize",x),()=>b?.removeEventListener("resize",x)},[n]),Et.useEffect(()=>{if(!n||!l.current)return;l.current=false;let x=s.current;x&&g1(x);},[n]);let y=x=>{x.key!=="Escape"||x.defaultPrevented||(x.preventDefault(),g(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[aa]:"",children:[jsxRuntime.jsx("button",{ref:a,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?c:void 0,"aria-label":u,title:u,...n?{"data-active":""}:{},onMouseDown:Z,onClick:()=>r(x=>!x),onKeyDown:x=>{x.key==="ArrowDown"&&(x.preventDefault(),l.current=true,r(true));},children:ae(ku)}),n?jsxRuntime.jsx(Du.Provider,{value:m,children:jsxRuntime.jsx("div",{ref:s,id:c,role:"dialog","aria-label":u,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",...p?{"data-anchor":p.anchor}:{},style:p?{left:p.left,right:"auto",maxInlineSize:p.maxWidth}:void 0,onKeyDown:y,children:e.map(x=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":x.label??o(x.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:x.label??o(x.labelKey)}),x.children]},x.id))})}):null]})}function b1(e){if(!Et.isValidElement(e))return false;let t=e.type;return (typeof t=="function"||typeof t=="object")&&t.docxToolbarGroup===true}function Nh(e,t,o,n){let r=new Map,i=new Map,a=new Map,s=[];for(let l of Et.Children.toArray(e)){if(b1(l)){a.delete(l.props.id),a.set(l.props.id,l.props);continue}let c=t(l);if(c&&o(c))r.set(c,l);else if(c&&n(c))i.set(c,l);else {if(c&&Et.isValidElement(l)&&l.props.hidden===true)continue;s.push(l);}}return {overrides:r,tableOverrides:i,groups:[...a.values()],appended:s}}function Ul(e,t){return e.label!==void 0?e.label:e.labelKey!==void 0?t(e.labelKey):e.id}function Iu(e){let t=Q();return e.hidden?null:jsxRuntime.jsx("div",{role:"group","aria-label":Ul(e,t),className:`docx-toolbar__group${e.className?` ${e.className}`:""}`,"data-toolbar-host-group":e.id,children:e.children})}Iu.docxToolbarGroup=true;function Ba(e){return e.hidden?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.children})}Ba.docxToolbarSlot=true;var _u=Et.createContext("bar");function Lh(){return Et.useContext(_u)}var Vl="review.addComment";function T1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=Et.useContext(Ct),a=Q(),{isEnabled:s,reason:l}=Gi(a),c=Rr();if(t||(i?.mounted??0)===0)return null;let d=ee(Vl),f=a(d?.labelKey??Vl),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Vl,disabled:!s,...s?{}:{"data-disabled":""},"aria-label":f,title:l??f,onMouseDown:Z,onClick:()=>{i?.requestCommentDraft()&&c(false);}};return n?jsxRuntime.jsx(G,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??ae(d?.paths)})}var Nu=Object.assign(T1,{docxSlot:Vl});var Ah=new Set;function Gl(e){!mt()||Ah.has(e)||(Ah.add(e),console.warn(`[docx-editor] ${e}`));}function Oh(e,t,o){Gl(`Toolbar.Group "${e}" has after="${t}", but no group has that id. The group is placed after every other group. Known ids: ${o.join(", ")}.`);}function Bh(e,t){Gl(`Toolbar.Group "${e}" is a built-in group, so its ${t} is ignored. A built-in group keeps its own label and place in the bar.`);}function Zh(e){Gl(`Toolbar.Group "${e}" uses the id of the contextual table group, so it is ignored. Give the group another id.`);}function qh(e,t){Gl(t?`Toolbar slot "${e}" is not part of the preset arrangement, so its content is appended after the groups. Put it in a Toolbar.Group to give it a place.`:`"${e}" is not a toolbar slot id. Its content is appended after the groups. Use a ChromeSlotId such as "text.bold".`);}var Fu=[{value:"inline",labelKey:"imageWrap.menu.inLineWithText",iconName:"wrap_text"},{value:"square",labelKey:"imageWrap.square",iconName:"crop_square"},{value:"squareLeft",labelKey:"imageWrap.menu.squareLeft",iconName:"format_image_left"},{value:"squareRight",labelKey:"imageWrap.menu.squareRight",iconName:"format_image_right"},{value:"tight",labelKey:"imageWrap.tight",iconName:"wrap_text"},{value:"through",labelKey:"imageWrap.through",iconName:"wrap_text"},{value:"topAndBottom",labelKey:"imageWrap.topAndBottom",iconName:"vertical_align_center"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function Yl({className:e,hidden:t,asChild:o,children:n}){let{t:r}=N(),i=Q(),{execute:a,value:s,isEnabled:l,disabledReason:c}=Ta("image.wrap"),[d,f]=Et.useState(false),u=Et.useRef(null),g=Et.useRef(null),m=Et.useRef(null),p=Et.useId(),v=Et.useMemo(()=>Fu.find(T=>T.value===s)??Fu[0],[s]),y=ee("image.wrap"),x=i(y?.labelKey??"formattingBar.imageWrap");Et.useEffect(()=>{if(!d)return;let T=P=>{let k=u.current;k&&P.target instanceof Node&&k.contains(P.target)||f(false);},S=P=>{P.key==="Escape"&&(P.preventDefault(),f(false),g.current?.focus());};return document.addEventListener("mousedown",T,true),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",T,true),document.removeEventListener("keydown",S);}},[d]);let b=Et.useCallback(T=>{f(false),a(T);},[a]);if(t)return null;let h=r("imageWrap.tooltipPrefix",{label:r(v.labelKey)}),C={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!l,...l?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?p:void 0,"aria-label":x,title:c??h,onMouseDown:Z,onClick:()=>f(T=>!T)};return jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__image-wrap",children:[o?jsxRuntime.jsx(G,{...C,children:n}):jsxRuntime.jsx("button",{...C,children:n??ae(y?.paths)}),d?jsxRuntime.jsx("div",{ref:m,id:p,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:T=>T.stopPropagation(),children:Fu.map(T=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":s===T.value,...s===T.value?{"data-active":""}:{},onMouseDown:Z,onClick:()=>b(T.value),children:r(T.labelKey)},T.value))}):null]})}Yl.docxSlot="image.wrap";var Za=Object.assign(Yl,{docxSlot:"image.wrap"});var kr="table.insert";function L1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=H(),{isEnabled:a,disabledReason:s}=se(kr),l=Q(),[c,d]=Et.useState(false),f=Et.useRef(null),u=Et.useRef(null),g=Et.useRef(null),m=Et.useId(),p=Rr();Et.useEffect(()=>{let C=f.current?.ownerDocument;if(!c||!C)return;let T=S=>{let P=f.current;P&&S.target instanceof Node&&P.contains(S.target)||d(false);};return C.addEventListener("mousedown",T,true),()=>C.removeEventListener("mousedown",T,true)},[c]),Et.useEffect(()=>{c&&f.current?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();},[c]);let v=c&&a;Et.useLayoutEffect(()=>{let C=g.current,T=f.current,S=T?.ownerDocument.defaultView;if(!v||!C||!T||!S||T.closest(".docx-toolbar__more-panel"))return;let P=T.getBoundingClientRect(),k=editor.toolbarPopupLeft({anchorLeft:P.left,popupWidth:C.offsetWidth,viewportWidth:S.innerWidth});C.style.left=`${k-P.left}px`;},[v]);let y=Et.useCallback(()=>{d(false),p(false);},[p]);if(t)return null;let x=ee(kr),b=l(x?.labelKey??kr),h={ref:u,type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":kr,disabled:!a,...a?{}:{"data-disabled":""},...v?{"data-active":""}:{},"aria-haspopup":"grid","aria-expanded":v,"aria-controls":v?m:void 0,"aria-label":b,title:s??b,onMouseDown:Z,onClick:()=>{if(!c){d(true);return}d(false),i?.focus();},onKeyDown:C=>{C.key==="ArrowDown"&&(C.preventDefault(),d(true));}};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__table-insert",children:[n?jsxRuntime.jsx(G,{...h,children:r}):jsxRuntime.jsx("button",{...h,children:o??r??ae(x?.paths)}),v?jsxRuntime.jsx("div",{ref:g,id:m,className:"docx-toolbar__menu docx-toolbar__table-insert-menu",onBlur:C=>{let T=C.relatedTarget;T instanceof Node&&!f.current?.contains(T)&&d(false);},onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),C.stopPropagation(),d(false),u.current?.focus());},children:jsxRuntime.jsx(ol,{slot:kr,label:l("toolbar.insertTable"),onInserted:y})}):null]})}var Au=Object.assign(L1,{docxSlot:kr});function Ge(e){return Object.assign(o=>jsxRuntime.jsx(sn,{slotId:e,...o}),{docxSlot:e})}var Wh=Ge("history.undo"),zh=Ge("history.redo"),$h=Ge("text.bold"),Uh=Ge("text.italic"),Vh=Ge("text.underline"),Gh=Ge("text.strike"),jh=Ge("format.clear"),Yh=Ge("script.super"),Xh=Ge("script.sub"),Jh=Ge("alignment.left"),Qh=Ge("alignment.center"),e0=Ge("alignment.right"),t0=Ge("alignment.justify"),o0=Ge("direction.ltr"),n0=Ge("direction.rtl"),r0=Ge("list.bullet"),a0=Ge("list.numbered"),i0=Ge("list.outdent"),l0=Ge("list.indent");var s0=Ge("review.comments");function B1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=H(),{openAtCaret:a}=Fc(),s=editor.chromeProbeForSlot("text.link"),l=i&&s?i.can(s):null,c=l?.ok===true,{t:d}=N(),f=i18n.localizeDisabledReason(l&&!l.ok?l.reason:null,d),u=Q();if(t)return null;let g=ee("text.link"),m=u(g?.labelKey??"text.link"),p={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!c,...c?{}:{"data-disabled":""},"aria-label":m,title:f??m,onMouseDown:Z,onClick:()=>a()};return n?jsxRuntime.jsx(G,{...p,children:r}):jsxRuntime.jsx("button",{...p,children:o??r??ae(g?.paths)})}var Ou=Object.assign(B1,{docxSlot:"text.link"});function Z1({className:e,hidden:t}){let o=H(),{onSave:n}=Et.useContext(ln),r=Q();if(t)return null;let i=ee("file.save"),a=r(i?.labelKey??"file.save"),s=!o||!n;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:s,...s?{"data-disabled":""}:{},"aria-label":a,title:a,onMouseDown:Z,onClick:()=>n?.(),children:ae(i?.paths)})}var Bu=Object.assign(Z1,{docxSlot:"file.save"});function En({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}var W1=e=>({zoom:e.zoom,mode:e.zoomMode}),z1=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,d0={type:"fixed"};function Zu(){let e=H(),{zoom:t,mode:o}=B(W1,z1),n=Et.useCallback(i=>{e?.setZoom(i);},[e]),r=Et.useCallback(i=>{e?.setZoomMode(i);},[e]);return Et.useMemo(()=>{let i=o??d0,a=Fa(t,"out"),s=Fa(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:n,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(d0),n(1);},zoomIn:()=>s!==null&&n(s),zoomOut:()=>a!==null&&n(a),canZoomIn:!!e&&s!==null,canZoomOut:!!e&&a!==null,levels:Bl}},[e,t,o,n,r])}var Wa=2,za=3276,Ka=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],G1=e=>e.formatting?.fontSizePt??null;function m0(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function f0(e,t,o){for(let n=t.length-1;n>=0;n-=1)if(t[n]<e)return t[n];return Math.max(e-1,o)}function h0(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:Z,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:Z,onClick:e.onIncrease,children:"+"})]})}function j1(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let o=Number(t);if(!Number.isFinite(o))return null;let n=Math.round(o*2);return n<Wa||n>za?null:n}function Y1({className:e,hidden:t}){let o=H(),n=B(G1),{isEnabled:r,disabledReason:i}=se("font.size"),a=Q(),[s,l]=Et.useState(false),[c,d]=Et.useState(null),f=Et.useRef(null);go(f,s,()=>l(false));let u=Et.useRef(null),g=Et.useId(),m=Et.useCallback(T=>{if(!o)return;let S=editor.commandForSlotValue("font.size",T);S&&o.can(S).ok&&o.exec(S);},[o]),p=Et.useCallback(T=>{m(Math.min(za,Math.max(Wa,Math.round(T*2))));},[m]),v=Et.useCallback(T=>{l(false),d(null),u.current?.blur(),T&&o?.focus();},[o]);if(Et.useEffect(()=>{if(!s)return;let T=S=>{let P=f.current;P&&S.target instanceof Node&&P.contains(S.target)||(l(false),d(null));};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[s]),t)return null;let y=r&&n!==null,x=n===null?"\u2014":String(Math.round(n*2)/2),b=c??x,h=n===null?null:Math.round(n*2)/2,C=()=>{if(c===null)return;let T=j1(c);T!==null&&m(T);};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(h0,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:u,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:b,disabled:!r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),"aria-controls":s?g:void 0,autoComplete:"off",onChange:T=>{d(T.target.value),l(true);},onFocus:T=>{T.target.select(),l(true);},onClick:()=>l(true),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),C(),v(true)):T.key==="Escape"?(T.preventDefault(),v(true)):(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),l(true),n!==null&&p(T.key==="ArrowDown"?f0(n,Ka,Wa/2):m0(n,Ka,za/2)));},onBlur:()=>{C(),d(null);}}),canDecrease:y&&Math.round(n*2)>Wa,canIncrease:y&&Math.round(n*2)<za,onDecrease:()=>p(f0(n??0,Ka,Wa/2)),onIncrease:()=>p(m0(n??0,Ka,za/2))}),s&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox",tabIndex:0,"aria-label":a("fontSize.listLabel"),id:g,children:Ka.map(T=>{let S=h===T;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>{p(T),v(true);},children:T},T)})}):null]})}var Wu=Object.assign(Y1,{docxSlot:"font.size"});function X1({className:e,hidden:t}){let o=H(),{zoom:n,isFit:r,mode:i,setZoom:a,setMode:s,zoomIn:l,zoomOut:c,canZoomIn:d,canZoomOut:f,levels:u}=Zu(),g=Q(),[m,p]=Et.useState(false),v=Et.useRef(null);go(v,m,()=>p(false)),Et.useEffect(()=>{if(!m)return;let T=S=>{let P=v.current;P&&S.target instanceof Node&&P.contains(S.target)||p(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[m]);let y=Et.useCallback(T=>{v.current?.querySelector("[aria-haspopup]")?.focus(),p(false),a(T);},[a]),x=Et.useCallback(T=>{v.current?.querySelector("[aria-haspopup]")?.focus(),p(false),s(T==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[s]);if(t)return null;let b=`${Math.round(n*100)}%`,h=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),C=editor.sameZoomMode(i,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:v,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(h0,{className:e,groupLabel:g("zoom.zoomLevel"),decreaseLabel:g("zoom.zoomOut"),increaseLabel:g("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!o,"aria-haspopup":"listbox","aria-expanded":m,"aria-label":`${g("zoom.zoomLevel")}: ${b}`,onMouseDown:Z,onClick:()=>p(T=>!T),children:[b,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:f,canIncrease:d,onDecrease:c,onIncrease:l}),m?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox",tabIndex:0,"aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":h,...h?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>x("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":C,...C?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>x("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),u.map(T=>{let S=!r&&Math.abs(T-n)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>y(T),children:`${Math.round(T*100)}%`},T)})]}):null]})}var zu=Object.assign(X1,{docxSlot:"zoom.level"});function wn(e,t,o,n=false){let r=Ye(),i=Et.useRef(r);i.current=r,Et.useEffect(()=>{e&&n&&t(false);},[e,n,t]),Et.useEffect(()=>{let a=o.current;if(!e||n||!a)return;let s=a.ownerDocument,l=u=>a.contains(u),c=u=>{u.composedPath().includes(a)||t(false);},d=editor.listenForPopupEscape({popup:a,contains:l,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current],close:u=>{t(false),u&&a.querySelector("[aria-haspopup]")?.focus();}}),f=editor.listenForPopupFocusLeave({popup:a,contains:l,close:()=>t(false)});return s.addEventListener("mousedown",c),()=>{s.removeEventListener("mousedown",c),d(),f();}},[e,n,t,o]);}var nM=[1,1.15,1.5,2,2.5,3],x0=10,C0=0,rM=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),aM=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function iM({className:e,hidden:t}){let o=H(),n=B(rM,aM),{isEnabled:r,disabledReason:i}=se("list.lineSpacing"),a=se("paragraph.dialog"),s=Eh(),l=Q(),[c,d]=Et.useState(false),f=Et.useRef(null),u=Et.useRef(null);wn(c,d,f,t);let g=Et.useCallback(b=>{if(d(false),!o)return;let h=editor.commandForSlotValue("list.lineSpacing",b);h&&o.can(h).ok&&o.exec(h);},[o]),m=Et.useCallback((b,h)=>{if(d(false),!o)return;let C={type:"setParagraphSpacing",[b]:h};o.can(C).ok&&o.exec(C);},[o]);if(t)return null;let p=ee("list.lineSpacing"),v=(n.spaceBeforePt??0)>0,y=(n.spaceAfterPt??0)>0,x=n.lineSpacing?.rule==="multiple"?n.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{ref:u,type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":c,"aria-label":l("lineSpacing.label"),title:i??l("lineSpacing.label"),onMouseDown:Z,onClick:()=>d(b=>!b),children:[ae(p?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),c&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[nM.map(b=>{let h=x===b;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":h,...h?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>g(b),children:Number.isInteger(b*10)?b.toFixed(1):b.toFixed(2)},b)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item","data-slot":"paragraph.dialog",disabled:!a.isEnabled,title:a.disabledReason??void 0,onMouseDown:Z,onClick:()=>{d(false),s?.open(u.current);},children:l("lineSpacing.options")}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>m("beforePt",v?C0:x0),children:l(v?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:Z,onClick:()=>m("afterPt",y?C0:x0),children:l(y?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Uu=Object.assign(iM,{docxSlot:"list.lineSpacing"});var cM=["alignment.left","alignment.center","alignment.right","alignment.justify"];function dM({className:e,hidden:t}){let o=se("alignment.left"),n=se("alignment.center"),r=se("alignment.right"),i=se("alignment.justify"),a=Q(),[s,l]=Et.useState(false),c=Et.useRef(null);if(wn(s,l,c,t),t)return null;let d=[o,n,r,i],f=cM.map((p,v)=>({slot:p,control:ee(p),state:d[v]})),u=f.find(p=>p.state.isActive)??f[0],g=f.some(p=>p.state.isEnabled),m=a(u.control?.labelKey??u.slot);return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":s,"aria-label":m,title:g?m:u.state.disabledReason??m,onMouseDown:Z,onClick:()=>l(p=>!p),children:[ae(u.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:f.map(p=>{let v=a(p.control?.labelKey??p.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":p.slot,disabled:!p.state.isEnabled,...p.state.isActive?{"data-active":""}:{},"aria-pressed":p.state.isActive,"aria-label":v,title:p.state.disabledReason??v,onMouseDown:Z,onClick:()=>{p.state.execute(),l(false);},children:ae(p.control?.paths)},p.slot)})}):null]})}var Jl=Object.assign(dM,{docxSlot:"alignment"});function Gu(e){let{label:t,icon:o,active:n,disabled:r,disabledReason:i,onSelect:a,asChild:s,className:l,children:c}=e,d=Lh(),f=Rr();if(d==="panel"&&!s)return jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__more-command${l?` ${l}`:""}`,disabled:r,...n?{"data-active":""}:{},...n!==void 0?{"aria-pressed":n}:{},...r&&i?{title:i}:{},onMouseDown:g=>Z(g),onClick:g=>{a?.(),f(g.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:o??c}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:t})]});let u={type:"button",className:`docx-toolbar__button${l?` ${l}`:""}`,disabled:r,...n?{"data-active":""}:{},...r?{"data-disabled":""}:{},...n!==void 0?{"aria-pressed":n}:{},"aria-label":t,title:r?i??t:t,onMouseDown:g=>Z(g),onClick:r?void 0:a};return s?jsxRuntime.jsx(G,{...u,children:c}):jsxRuntime.jsx("button",{...u,children:o??c})}var bM=Object.freeze([]),vM=e=>e.formatting?.fontFamily??null,yM=e=>e;function ts(){let e=H(),t=B(vM),o=B(yM),n=Et.useMemo(()=>e&&!o.isLoading?e.getAvailableFonts():bM,[e,o]),{isEnabled:r}=se("font.family"),i=Et.useCallback(a=>{if(!e)return;let s=editor.commandForSlotValue("font.family",a);s&&e.can(s).ok&&e.exec(s);},[e]);return Et.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var E0=Et.createContext(null);function Yu(){return Et.useContext(E0)}function Xu({asChild:e,className:t,children:o}){let n=Yu(),r=Q();if(!n)return null;let i=r(ee("font.family")?.labelKey??"font.family"),a={onClick:()=>n.setOpen(!n.open),onMouseDown:Z,disabled:!n.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,"aria-label":o!==void 0?void 0:`${i}: ${n.value??"\u2014"}`,title:i},s=o??jsxRuntime.jsx("span",{children:n.value??"\u2014"});return e?jsxRuntime.jsx(G,{...a,children:s}):jsxRuntime.jsx("button",{type:"button",...a,children:s})}Xu.docxToolbarPart=true;var xM=new Map([["arial","sansSerif"],["calibri","sansSerif"],["helvetica","sansSerif"],["verdana","sansSerif"],["open sans","sansSerif"],["roboto","sansSerif"],["times new roman","serif"],["georgia","serif"],["cambria","serif"],["garamond","serif"],["courier new","monospace"],["consolas","monospace"]]),CM=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function w0({asChild:e,className:t,children:o}){let n=Yu(),r=Q(),[i,a]=Et.useState("");if(Et.useEffect(()=>{n?.open||a("");},[n?.open]),!n||!n.open)return null;let s={role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`},l;return o!==void 0?l=o:l=CM.map(d=>({...d,fonts:n.options.filter(f=>f.toLowerCase().includes(i.toLowerCase())&&(xM.get(f.toLowerCase())??"other")===d.category)})).filter(d=>d.fonts.length>0).map((d,f)=>jsxRuntime.jsxs("div",{role:"group",children:[f>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator","aria-hidden":"true"}):null,d.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(d.labelKey)}):null,d.fonts.map(u=>jsxRuntime.jsx(M0,{value:u},u))]},d.category)),e?jsxRuntime.jsx(G,{...s,children:l}):o!==void 0?jsxRuntime.jsx("div",{...s,children:l}):jsxRuntime.jsxs("div",{className:s.className,children:[jsxRuntime.jsx("input",{type:"search",className:"docx-toolbar__font-search","aria-label":r("font.search"),placeholder:r("font.search"),value:i,onChange:c=>a(c.target.value)}),jsxRuntime.jsx("div",{role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:"docx-toolbar__font-options",children:l})]})}function M0({value:e,asChild:t,className:o,children:n}){let r=H(),i=Yu();if(!i)return null;let a=i.value===e,s={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:Z,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__font-family-item${o?` ${o}`:""}`},l=n??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(G,{...s,children:l}):jsxRuntime.jsxs("button",{type:"button",...s,children:[l,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function TM({hidden:e,asChild:t,className:o,children:n}){let r=ts(),[i,a]=Et.useState(false),s=Et.useRef(null);go(s,i,()=>a(false)),Et.useEffect(()=>{if(!i)return;let f=u=>{let g=s.current;g&&u.target instanceof Node&&g.contains(u.target)||a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);let l=Et.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__font-family${o?` ${o}`:""}`,"data-slot":"font.family"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xu,{}),jsxRuntime.jsx(w0,{})]});return jsxRuntime.jsx(E0.Provider,{value:l,children:t?jsxRuntime.jsx(G,{...c,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...c,children:d})})}var Ju=Object.assign(TM,{docxSlot:"font.family",Trigger:Xu,Content:w0,Item:M0});var SM={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},EM=new Set(["Title","Heading1","Heading2","Heading3"]),wM={Subtitle:"666666"},MM="#4a6c8c";function R0(e){let t=SM[e.styleId],n={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??EM.has(e.styleId))&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic");let r=e.color??wM[e.styleId];return r?n.color=`#${r}`:e.styleId.startsWith("Heading")&&(n.color=MM),n}var RM=/^heading ([1-9])$/;function Qu(e,t){let o=e||t,n=RM.exec(o);return n?`Heading ${n[1]}`:o}function k0(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:Qu(t.name,t.styleId),priority:99}))}function HM(e){let t=e.fontSizePt;return {...e.fontFamily?{fontFamily:e.fontFamily}:{},...t?{fontSize:`${Math.min(Math.max(t,9),20)}px`}:{},...e.bold?{fontWeight:700}:{},...e.italic?{fontStyle:"italic"}:{},...e.color?{color:`#${e.color}`}:{}}}var AM=Object.freeze([]),OM=e=>e.formatting?.styleId??null,BM=e=>e;function os(){let e=H(),t=B(OM),o=B(BM),n=Et.useMemo(()=>e&&!o.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:Qu(a.name,a.styleId),preview:a.preview})):AM,[e,o]),{isEnabled:r}=se("styles.style"),i=Et.useCallback(a=>{if(!e)return;let s=editor.commandForSlotValue("styles.style",a);s&&e.can(s).ok&&e.exec(s);},[e]);return Et.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var D0=Et.createContext(null);function tp(){return Et.useContext(D0)}function op({asChild:e,className:t,children:o}){let n=tp(),r=Q();if(!n)return null;let i=ee("styles.style"),a=r(i?.labelKey??"styles.style"),s={onClick:()=>n.setOpen(!n.open),onMouseDown:Z,disabled:!n.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,title:a},l=n.options.find(d=>d.styleId===n.value),c=o??(n.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:l?.name??n.value}));return e?jsxRuntime.jsx(G,{...s,children:c}):jsxRuntime.jsx("button",{type:"button",...s,children:c})}op.docxToolbarPart=true;function I0({asChild:e,className:t,children:o}){let n=Q(),r=tp();if(!r||!r.open)return null;let i={role:"listbox",tabIndex:0,"aria-label":n("styles.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`},a=o??r.options.map(s=>jsxRuntime.jsx(_0,{value:s.styleId},s.styleId));return e?jsxRuntime.jsx(G,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function _0({value:e,asChild:t,className:o,children:n}){let r=H(),i=tp();if(!i)return null;let a=i.value===e,s=i.options.find(d=>d.styleId===e),l={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:Z,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__style-item${o?` ${o}`:""}`},c=n??jsxRuntime.jsx("span",{style:s?HM(s.preview):void 0,children:s?.name??e});return t?jsxRuntime.jsx(G,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function ZM({hidden:e,asChild:t,className:o,children:n}){let r=os(),[i,a]=Et.useState(false),s=Et.useRef(null);go(s,i,()=>a(false)),Et.useEffect(()=>{if(!i)return;let f=u=>{let g=s.current;g&&u.target instanceof Node&&g.contains(u.target)||a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);let l=Et.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__style${o?` ${o}`:""}`,"data-slot":"styles.style"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(op,{}),jsxRuntime.jsx(I0,{})]});return jsxRuntime.jsx(D0.Provider,{value:l,children:t?jsxRuntime.jsx(G,{...c,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...c,children:d})})}var np=Object.assign(ZM,{docxSlot:"styles.style",Trigger:op,Content:I0,Item:_0});function L0(e,t){let o=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:s,children:l})=>{let{isEnabled:c,disabledReason:d}=se(o),f=eo(),u=t==="showAll"?f.showAll:f.formFill,g=Q();if(i)return null;let m=ee(o),p=g(m?.labelKey??e),v={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!c,...c?{}:{"data-disabled":""},...u?{"data-active":""}:{},"aria-pressed":u,"aria-label":p,title:d??p,onMouseDown:Z,onClick:()=>{t==="showAll"?f.toggleShowAll():f.toggleFormFill();}};return s?jsxRuntime.jsx(G,{...v,children:l}):jsxRuntime.jsx("button",{...v,children:a??l??ae(m?.paths)})},{docxSlot:o})}function KM({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=gt.inspector,{isEnabled:a,disabledReason:s}=se(i),{inspectorOpen:l,openInspector:c}=eo(),d=Q();if(t)return null;let f=ee(i),u=d(f?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":gt.inspector,disabled:!a,...a?{}:{"data-disabled":""},...l?{"data-active":""}:{},"aria-pressed":l,"aria-label":u,title:s??u,onMouseDown:Z,onClick:()=>c()};return n?jsxRuntime.jsx(G,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:o??r??ae(f?.paths)})}function WM({className:e,hidden:t,icon:o,asChild:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:s}=eo(),l=Q();if(t)return null;let c=gt.remove,d=ee(c),f=l(d?.labelKey??"contentControl.remove"),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":gt.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":f,title:a??f,onMouseDown:Z,onClick:()=>{s();}};return n?jsxRuntime.jsx(G,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??ae(d?.paths)})}var ns=L0(gt.showAll,"showAll"),rs=L0(gt.formFill,"formFill"),as=Object.assign(WM,{docxSlot:gt.remove}),is=Object.assign(KM,{docxSlot:gt.inspector}),F0={[gt.showAll]:ns,[gt.formFill]:rs,[gt.inspector]:is,[gt.remove]:as};function rp(e,t){let o=H(),n=Et.useRef(t);n.current=t,Et.useEffect(()=>{if(!o)return;let r=((...i)=>{n.current(...i);});return o.on(e,r)},[o,e]);}var YM=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],ip=Et.createContext(null);function K0(){let e=Et.useContext(ip);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function JM(e,t){let o=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=o?`${r}|${o.rows}|${o.columns}|${o.rowIndex}|${o.columnIndex}`:"",a=t.selection,s=a?`${a.from&&"paraId"in a.from?a.from.paraId:""}|${a.to&&"paraId"in a.to?a.to.paraId:""}|${t.selectionCollapsed}`:"",l=e?.getTableCellSelection()??null,c=l?`${l.tableId}|${l.rows.from}-${l.rows.to}|${l.columns.from}-${l.columns.to}|${l.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:s,cellSelectionKey:c,editable:t.editable,editingMode:t.editingMode??"editing"}}function QM(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function eR(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Z0={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function tR(e,t){let o={};for(let n of YM){let r=editor.tableChromeToolbarState(e,n,t);o[n]={enabled:r.enabled,disabledReason:r.disabledReason};}return o}function lp({children:e}){let t=H(),[o,n]=Et.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=Et.useState(Z0);Et.useEffect(()=>(()=>{}),[]);let a=B(Et.useCallback(u=>({table:u.table,editable:u.editable,editingMode:u.editingMode??"editing",headParagraphId:u.selection?.to&&"paraId"in u.selection.to?u.selection.to.paraId:u.selection?.from&&"paraId"in u.selection.from?u.selection.from.paraId:""}),[]),QM,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),s=Et.useCallback(()=>{if(!t){i(Z0);return}let u=JM(t,t.snapshot());i(g=>eR(g,u)?g:u);},[t]);Et.useEffect(()=>{s();},[s,a]),rp("selectionChange",Et.useCallback(()=>{s();},[s]));let l=r.tableKey!=="",c=Et.useMemo(()=>t?tR(t,o):{},[t,o,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Et.useCallback((u,g)=>{if(!t)return;let{result:m,nextDraft:p}=editor.runTableChromeCommand(t,u,g,o);m.ok&&p&&n(p);},[t,o]),f=Et.useMemo(()=>({visible:l,draft:o,setDraft:n,slotState:u=>c[u]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[l,o,c,d]);return jsxRuntime.jsx(ip.Provider,{value:f,children:e})}function oR(){let e=Et.useContext(ip);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ss(e){let t=oR(),o=t.slotState(e);return Et.useMemo(()=>({visible:t.visible,enabled:o.enabled,disabledReason:o.disabledReason,draft:t.draft,apply:n=>t.apply(e,n)}),[t,e,o])}function cs(e){(editor.editorInstanceScope(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function ds({enabled:e,disabledReason:t,ariaLabel:o}){let{t:n}=N(),r=i18n.localizeDisabledReason(t,n),i=Et.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:Z,"aria-label":o,...a?{"aria-describedby":a}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:a&&r?jsxRuntime.jsx("span",{id:i,className:"docx-editor-sr-only",children:r}):null}}var lR='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function z0(e,t,o,n){Et.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll(lR)].filter(c=>c.closest('[role="menu"]')===r);queueMicrotask(()=>{let c=a();(c.find(f=>f.hasAttribute("data-selected")||f.hasAttribute("data-active"))??c[0])?.focus();});let l=c=>{if(c.defaultPrevented||c.isComposing||c.keyCode===229)return;let d=a();if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),Ot(d,document.activeElement,1);return}if(c.key==="ArrowUp"){c.preventDefault(),Ot(d,document.activeElement,-1);return}if(c.key==="Home"){c.preventDefault(),Bt(d,"first");return}if(c.key==="End"){c.preventDefault(),Bt(d,"last");return}if(c.key==="Enter"||c.key===" "){let f=document.activeElement;f instanceof HTMLElement&&d.includes(f)&&(c.preventDefault(),f.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,o,n]);}function $0(e,t,o,n){Et.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(l=>l.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let s=l=>{if(l.key==="Escape"){l.preventDefault(),t(false),i?.focus();return}if(l.key==="Enter"||l.key===" "){let c=document.activeElement,d=a();c instanceof HTMLElement&&d.includes(c)&&(l.preventDefault(),c.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,o,n]);}function Y0(e,t,o){if(e)return n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),o(!t));}}function fR(e){return ae(editor.tableChromeIconPaths(e))}function X0(){return Et.createContext(null)}function Co(e){let t=Et.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function cp(e,t,o){let n=X0();function r({hidden:s,asChild:l,className:c,children:d}){let{visible:f,enabled:u,disabledReason:g,draft:m,apply:p}=ss(e),[v,y]=Et.useState(false),x=Et.useRef(null),b=Et.useRef(null);wn(v,y,x,s||!f);let h=Et.useMemo(()=>({open:v,setOpen:y,enabled:u,disabledReason:g,apply:p,draft:m,triggerRef:b}),[v,u,g,p,m]);if(s||!f)return null;let C={className:`${t}${c?` ${c}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},T=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(n.Provider,{value:h,children:l?jsxRuntime.jsx(G,{...C,ref:x,children:T}):jsxRuntime.jsx("div",{ref:x,...C,children:T})})}function i({asChild:s,className:l,children:c}){let{open:d,setOpen:f,enabled:u,disabledReason:g,triggerRef:m}=Co(n),p=Q(),v=ee(e),y=p(v?.labelKey??o),{shared:x,reasonNode:b}=ds({enabled:u,disabledReason:g,ariaLabel:y}),h={...x,ref:m,className:`docx-toolbar__button docx-table-chrome__trigger${l?` ${l}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:u?()=>f(!d):void 0,...s?{tabIndex:u?0:-1,role:"button",onKeyDown:Y0(u,d,f)}:{}},C=c??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ae(v?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(G,{...h,children:C}),b]}):jsxRuntime.jsxs("button",{...h,children:[C,b]})}i.docxToolbarPart=true;function a({asChild:s,className:l,children:c}){let{open:d,setOpen:f,enabled:u,triggerRef:g}=Co(n),m=Q(),p=Et.useRef(null);if(z0(d&&u,f,p,g),!d||!u)return null;let v=ee(e),y=m(v?.labelKey??o),x={ref:p,role:"menu","aria-label":y,className:`docx-table-chrome__panel${l?` ${l}`:""}`,onMouseDown:Z};return s?jsxRuntime.jsx(G,{...x,children:c}):jsxRuntime.jsx("div",{...x,children:c})}return {Root:r,Trigger:i,Content:a,Ctx:n}}var Va=cp("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function J0({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(Va.Ctx),s=Q(),l=editor.TABLE_BORDER_TARGET_OPTIONS.find(u=>u.value===e);if(!l)return null;let c=l.value==="none"?false:l.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":c,"data-value":l.value,className:`docx-table-chrome__target-btn${o?` ${o}`:""}`,...c?{"data-active":""}:{},"aria-label":s(l.labelKey),title:s(l.labelKey),onMouseDown:Z,onClick:()=>{i(false),r(l.value);}},f=n??fR(l.icon);return t?jsxRuntime.jsx(G,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function Q0(e){let{children:t}=e;return jsxRuntime.jsx(Va.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(o=>jsxRuntime.jsx(J0,{value:o.value},o.value))})})}function gR(e){let{children:t}=e,o=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Va.Trigger,{}),jsxRuntime.jsx(Q0,{})]});return jsxRuntime.jsx(Va.Root,{...e,children:o})}var Ja=Object.assign(gR,{docxSlot:"table.borderTarget",Trigger:Va.Trigger,Content:Q0,Item:J0}),Ga=cp("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function eb({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(Ga.Ctx),s=Q(),l=editor.TABLE_BORDER_STYLE_OPTIONS.find(u=>u.value===e);if(!l)return null;let c=l.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":c,...c?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:Z,onClick:()=>{i(false),r(l.value);}},f=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${l.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(l.labelKey)})]});return t?jsxRuntime.jsx(G,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function tb(e){let{children:t}=e;return jsxRuntime.jsx(Ga.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(o=>jsxRuntime.jsx(eb,{value:o.value},o.value))})}function hR(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ga.Trigger,{}),jsxRuntime.jsx(tb,{})]});return jsxRuntime.jsx(Ga.Root,{...e,children:t})}var Qa=Object.assign(hR,{docxSlot:"table.borderStyle",Trigger:Ga.Trigger,Content:tb,Item:eb}),ja=cp("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function ob({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Co(ja.Ctx),s=Q(),l=Number(e),c=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===l);if(!c)return null;let d=c.size===a.spec.size,f={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:Z,onClick:()=>{i(false),r(c.size);}},u=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${c.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(c.labelKey)})]});return t?jsxRuntime.jsx(G,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}function nb(e){let{children:t}=e;return jsxRuntime.jsx(ja.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(o=>jsxRuntime.jsx(ob,{value:String(o.size)},o.size))})}function bR(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ja.Trigger,{}),jsxRuntime.jsx(nb,{})]});return jsxRuntime.jsx(ja.Root,{...e,children:t})}var ei=Object.assign(bR,{docxSlot:"table.borderWidth",Trigger:ja.Trigger,Content:nb,Item:ob});function rb(e,t,o){let n=o?.defaultHex??"FF0000",r=X0();function i({hidden:d,asChild:f,className:u,children:g}){let{visible:m,enabled:p,disabledReason:v,draft:y,apply:x}=ss(e),[b,h]=Et.useState(false),[C,T]=Et.useState(n),S=Et.useRef(null),P=Et.useRef(null);wn(b,h,S,d||!m);let k=Et.useMemo(()=>({open:b,setOpen:h,enabled:p,disabledReason:v,apply:x,draft:y,triggerRef:P,lastHex:C,setLastHex:T}),[b,p,v,x,y,C]);if(d||!m)return null;let w={className:`docx-toolbar__colorsplit docx-table-chrome${u?` ${u}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},E=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(s,{}),jsxRuntime.jsx(l,{clearFill:o?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:k,children:f?jsxRuntime.jsx(G,{...w,ref:S,children:E}):jsxRuntime.jsx("div",{ref:S,...w,children:E})})}function a({asChild:d,className:f,children:u}){let{enabled:g,disabledReason:m,apply:p,draft:v,lastHex:y}=Co(r),x=Q(),b=ee(e),h=x(b?.labelKey??t),{shared:C,reasonNode:T}=ds({enabled:g,disabledReason:m,ariaLabel:h}),S=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:y??n,P={...C,className:`docx-toolbar__button docx-toolbar__colorsplit-main${f?` ${f}`:""}`,onClick:g?()=>p({kind:"hex",value:S}):void 0},k=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ae(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${S.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(G,{...P,children:k}),T]}):jsxRuntime.jsxs("button",{...P,children:[k,T]})}a.docxToolbarPart=true;function s({asChild:d,className:f,children:u}){let{open:g,setOpen:m,enabled:p,disabledReason:v,triggerRef:y}=Co(r),x=Q(),b=ee(e),h=x(b?.labelKey??t),{shared:C,reasonNode:T}=ds({enabled:p,disabledReason:v,ariaLabel:h}),S={...C,ref:y,className:`docx-toolbar__colorsplit-caret${f?` ${f}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:p?()=>m(!g):void 0,...d?{tabIndex:p?0:-1,role:"button",onKeyDown:Y0(p,g,m)}:{}},P=u??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(G,{...S,children:P}),T]}):jsxRuntime.jsxs("button",{...S,children:[P,T]})}s.docxToolbarPart=true;function l({asChild:d,className:f,children:u,clearFill:g}){let{open:m,setOpen:p,enabled:v,apply:y,draft:x,triggerRef:b,lastHex:h,setLastHex:C}=Co(r),T=Q(),S=Et.useRef(null);if($0(m&&v,p,S,b),!m||!v)return null;let P=T(t),k=e==="table.borderColor"&&x.spec.color.kind==="hex"?x.spec.color.value:h??n,w={ref:S,role:"dialog","aria-label":P,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${f?` ${f}`:""}`,onMouseDown:Z},E=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:Z,onClick:()=>{p(false),y(null),cs(b.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),T("table.clearCellFill")]}):null,jsxRuntime.jsx(Mc,{apply:D=>{p(false),C?.(D),y({kind:"hex",value:D}),cs(b.current);},current:k})]});return d?jsxRuntime.jsx(G,{...w,children:E}):jsxRuntime.jsx("div",{...w,children:E})}function c({value:d,css:f,labelKey:u,asChild:g,className:m,children:p}){let{apply:v,setOpen:y,setLastHex:x,triggerRef:b}=Co(r),h=Q(),C=f??`#${d.toLowerCase()}`,T=u?h(u):d,S={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${m?` ${m}`:""}`,style:{backgroundColor:C},"data-value":d,"aria-label":T,title:T,onMouseDown:Z,onClick:()=>{y(false),x?.(d),v({kind:"hex",value:d}),cs(b.current);}};return g?jsxRuntime.jsx(G,{...S,children:p}):jsxRuntime.jsx("button",{...S,children:p})}return {Root:i,Main:a,Trigger:s,Content:l,Item:c,Ctx:r}}var Ya=rb("table.borderColor","table.borderColor",{defaultHex:"000000"});function vR(e){return jsxRuntime.jsx(Ya.Content,{...e,clearFill:false})}function yR(e){return jsxRuntime.jsx(Ya.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function xR(e){return jsxRuntime.jsx(Ya.Root,{...e})}var ti=Object.assign(xR,{docxSlot:"table.borderColor",Trigger:Ya.Trigger,Content:vR,Item:yR,Main:Ya.Main}),Xa=rb("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function CR(e){return jsxRuntime.jsx(Xa.Content,{...e,clearFill:true})}function TR(e){return jsxRuntime.jsx(Xa.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function PR(e){return jsxRuntime.jsx(Xa.Root,{...e})}var oi=Object.assign(PR,{docxSlot:"table.cellFill",Trigger:Xa.Trigger,Content:CR,Item:TR,Main:Xa.Main});function ab({overrides:e=new Map,separator:t=true}){return K0()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(En,{}):null,[Ja,ti,Qa,ei,oi].map(r=>{let i=e.get(r.docxSlot);return i?jsxRuntime.jsx(Et.Fragment,{children:i},r.docxSlot):jsxRuntime.jsx(r,{},r.docxSlot)})]}):null}function ib(){let e=Q(),{draft:t}=ss("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var up=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Nr="contextual-table",pp={"zoom.level":zu,"styles.style":np,"font.family":Ju,"font.size":Wu,"text.color":Rc,"text.highlight":kc,"text.link":Ou,"list.lineSpacing":Uu,"review.editingMode":Kl,"review.authors":zl,"file.save":Bu,...F0,"table.borderTarget":Ja,"table.borderColor":ti,"table.borderStyle":Qa,"table.borderWidth":ei,"table.cellFill":oi,"image.insert":sa,"image.properties":Cr,"image.wrap":Za,"image.altText":Pa},us={id:Nr,labelKey:"formattingBar.groups.table",entries:up.map(e=>({slot:e,Part:pp[e]}))},lb=new Map;function DR(e){let t=lb.get(e);return t||(t=o=>jsxRuntime.jsx(sn,{slotId:e,...o}),lb.set(e,t)),t}function IR(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:Jl}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(o=>{let n=editor.chromeSlotId(t,o);return {slot:n,Part:pp[n]??DR(n)}})})}var _R=e=>e.image,NR=e=>e.isLoading||e.isOpening===true,LR=e=>e.table!==null;function FR(e){return e==="alignment"||e in pp}function ms(e){let t=tr(e,ms);if(t!==null)return t;if(!Et.isValidElement(e))return null;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxToolbarSlot===true){let n=e.props.slotId;return typeof n=="string"?n:null}if(o.docxToolbarPart===true){let n=e.props,r=n.slotId??n.slot;if(typeof r=="string")return r}return null}function dp(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(dp);let t=ms(e);return t!=null&&up.includes(t)?true:Et.isValidElement(e)?Et.Children.toArray(e.props.children).some(dp):false}function HR(e,t){return t?true:Et.Children.toArray(e).some(dp)}function AR(e){let t=Tt(),{className:o,t:n,onSave:r,preset:i=true,overflow:a=true,children:s}=e,l=Et.useMemo(()=>({t:n,onSave:r}),[n,r]),c=Oi(n),d=B(_R),f=B(NR),u=B(LR),g=Et.useMemo(()=>IR(d),[d]),m=Et.useMemo(()=>new Set(g.flatMap(S=>S.entries.map(P=>P.slot))),[g]),p=Et.useMemo(()=>i?Nh(s,ms,S=>m.has(S),S=>up.includes(S)):null,[i,s,m]),v=Et.useMemo(()=>p?OR(g,p):[],[g,p]),y=Et.useMemo(()=>[...v.filter(S=>!S.pinned).map(S=>S.id),...u?[Nr]:[]],[v,u]),x=Et.useMemo(()=>{let S=new Map;for(let P of v)P.priority!==void 0&&S.set(P.id,P.priority);return editor.collapseOrder(y,editor.TOOLBAR_COLLAPSE_ORDER,S)},[v,y]),b=i&&a,{attach:h,overflow:C}=Xi(b,y,x),T;if(!p)T=s;else {let{overrides:S,tableOverrides:P,appended:k}=p,w=M=>{let I=S.get(M.slot);if(I)return I;let U=M.Part;return jsxRuntime.jsx(U,{})},E=M=>{let I=P.get(M.slot);if(I)return I;let U=M.Part;return jsxRuntime.jsx(U,{})},D=[],A=[],_=0;for(let M of v){if(C.has(M.id)){let I=M.entries.flatMap(L=>{let Y=sb(L,S,c,M.labelKey,w);return Y===null?[]:[jsxRuntime.jsx(Et.Fragment,{children:Y},L.slot)]}),U=ZR(M);if(U!==null&&I.push(jsxRuntime.jsx(Et.Fragment,{children:U},"host")),I.length===0)continue;A.push({id:M.id,labelKey:M.labelKey,...M.heading?{label:Ul(M.heading,c)}:{},children:I});continue}_>0&&D.push(jsxRuntime.jsx(En,{},`separator-${M.id}`)),_+=1,D.push(jsxRuntime.jsxs("div",{className:`docx-toolbar__group${M.className?` ${M.className}`:""}`,...M.heading?{role:"group","aria-label":Ul(M.heading,c)}:{},...M.pinned?{[fn]:""}:{[Fo]:M.id},children:[M.entries.map(I=>jsxRuntime.jsx(Et.Fragment,{children:w(I)},I.slot)),M.extras.length>0?jsxRuntime.jsx(Et.Fragment,{children:M.extras},"host"):null]},M.id));}let F=C.has(Nr);if(u&&F){let M=us.entries.flatMap(I=>{let U=sb(I,P,c,us.labelKey,E);return U===null?[]:[jsxRuntime.jsx(Et.Fragment,{children:U},I.slot)]});M.length>0&&A.unshift({id:us.id,labelKey:us.labelKey,children:M});}T=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D,u&&!F?jsxRuntime.jsx(En,{},"separator-contextual-table"):null,F?null:jsxRuntime.jsx("div",{className:"docx-toolbar__contextual",[Fo]:Nr,children:jsxRuntime.jsx(ab,{overrides:P,separator:false})}),k.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[fn]:"",children:k}):null,A.length>0?jsxRuntime.jsx(Ih,{sections:A}):null]});}return jsxRuntime.jsx(ln.Provider,{value:l,children:jsxRuntime.jsx(Sh,{children:jsxRuntime.jsx("fieldset",{ref:h,disabled:f,"aria-label":c("formattingBar.label"),"data-testid":"docx-toolbar",className:`${t}docx-toolbar${o?` ${o}`:""}`,...b?{"data-overflow":""}:{},onMouseDown:Z,children:HR(s,i)?jsxRuntime.jsx(lp,{children:T}):T})})})}function mp(e){if(!e)return false;if(e.type===Et.Fragment){let t=Et.Children.toArray(e.props.children).find(o=>ms(o)!==null);return Et.isValidElement(t)?mp(t):false}return !!e.props.hidden}function OR(e,t){let o=new Map(t.groups.map(l=>[l.id,l])),n=new Set(e.map(l=>l.id)),r=new Map;for(let l of e){let c=o.get(l.id);if(c&&BR(c),c?.hidden)continue;let d=Et.Children.toArray(c?.children);!l.entries.some(u=>!mp(t.overrides.get(u.slot)))&&d.length===0||r.set(l.id,{id:l.id,labelKey:l.labelKey,heading:void 0,entries:l.entries,extras:d,pinned:c?.pinned??editor.TOOLBAR_PINNED_GROUPS.has(l.id),priority:c?.priority,overflowContent:c?.overflowContent,className:c?.className,host:false});}for(let l of t.groups)l.id===Nr&&Zh(l.id);let i=t.groups.filter(l=>!n.has(l.id)&&l.id!==Nr);for(let l of i){let c=Et.Children.toArray(l.children);l.hidden||c.length===0||r.set(l.id,{id:l.id,labelKey:l.labelKey??l.id,heading:{id:l.id,label:l.label,labelKey:l.labelKey},entries:[],extras:c,pinned:l.pinned===true,priority:l.priority,overflowContent:l.overflowContent,className:l.className,host:true});}let a=[...n,...i.map(l=>l.id)];for(let l of i)l.after!==void 0&&!a.includes(l.after)&&Oh(l.id,l.after,a);for(let l of t.appended){if(!Et.isValidElement(l)||l.type!==Ba)continue;let c=l.props.slotId;qh(c,ee(c)!==null);}return editor.arrangeToolbarGroups(e.map(l=>l.id),i.map(l=>({id:l.id,after:l.after}))).flatMap(l=>{let c=r.get(l);return c?[c]:[]})}function BR(e){for(let t of ["label","labelKey","after"])e[t]!==void 0&&Bh(e.id,t);}function ZR(e){return e.overflowContent?e.overflowContent():e.extras.length===0?null:jsxRuntime.jsx(_u.Provider,{value:"panel",children:jsxRuntime.jsx("div",{className:"docx-toolbar__more-host",children:e.extras})})}function sb(e,t,o,n,r){let i=t.get(e.slot);if(mp(i))return null;let a=i?.type===Ba?i.props.overflowContent:void 0;return i||FR(e.slot)?jsxRuntime.jsx(kh,{label:qR(o,e,n),children:a?a():r(e)}):jsxRuntime.jsx(Dh,{slot:e.slot})}function qR(e,t,o){let n=t.slot==="alignment"?null:ee(t.slot);return e(n?.labelKey??o)}var ri=Object.assign(AR,{Button:sn,Action:Gu,Separator:En,Group:Iu,Slot:Ba,AddComment:Nu,Undo:Wh,Redo:zh,Bold:$h,Italic:Uh,Underline:Vh,Strike:Gh,Link:Ou,ClearFormatting:jh,Superscript:Yh,Subscript:Xh,Alignment:Jl,AlignLeft:Jh,AlignCenter:Qh,AlignRight:e0,AlignJustify:t0,LeftToRight:o0,RightToLeft:n0,LineSpacing:Uu,BulletList:r0,NumberedList:a0,Outdent:i0,Indent:l0,ImageInsert:sa,ImageProperties:Cr,ImageWrap:Za,ImageAltText:Pa,TableInsert:Au,TableBorderTarget:Ja,TableBorderColor:ti,TableBorderStyle:Qa,TableBorderWidth:ei,TableCellFill:oi,Comments:s0,FontFamily:Ju,FontSize:Wu,FontColor:Rc,Highlight:kc,Zoom:zu,StylePicker:np,EditingMode:Kl,Reviewers:zl,Save:Bu,ContentControlShowAll:ns,ContentControlFormFill:rs,ContentControlInspector:is,ContentControlRemove:as});var db=/^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])$/i,WR=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var ub=new TextEncoder;function zR(e,t){if(ub.encode(e).length<=t)return e;let o=0,n="";for(let r of e){let i=ub.encode(r).length;if(o+i>t)break;o+=i,n+=r;}return n}function pb(e){let t=e.length;for(;t>0;){let o=e.charCodeAt(t-1);if(o!==46&&o!==32)break;t-=1;}return e.slice(0,t)}function mb(e){return pb(pb(e).replace(/\.docx$/i,""))}function fs(e){let t=(e??"").replace(WR," ").replace(/\s+/g," ").trim(),o=mb(t).replace(/^[. ]+/,""),n=zR(o,200),r=n===o?o:mb(n);return !r||db.test(r)?"document.docx":db.test(r.split(".",1)[0].trim())?`_${r}.docx`:`${r}.docx`}function gs(e,t,o="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let n=URL.createObjectURL(new Blob([e],{type:o})),r=document.createElement("a");r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}function fb(e,t,o){let{t:n}=N(),r=Et.useRef(false),[i,a]=Et.useState(false),[s,l]=Et.useState(""),[c,d]=Et.useState("pdf"),[f,u]=Et.useState(false),[g,m]=Et.useState({});return {pending:i,error:s,format:c,visible:f,session:g,dismiss:()=>u(false),execute:async v=>{if(!(!e||r.current)){r.current=true,m({}),d(v),u(true),a(true),l("");try{let y=await editor.runChromeExport(e,v,t);gs(y.bytes.slice().buffer,fs(o).replace(/\.docx$/,`.${y.extension}`),y.mimeType),u(!1);}catch(y){u(true),l(y instanceof editor.ChromeExportError?n(y.format==="markdown"?"toolbar.exportMarkdownMissing":"toolbar.exportPdfMissing"):n("toolbar.exportFailed",{message:y instanceof Error?y.message:String(y)}));}finally{r.current=false,a(false);}}}}}function hb(e,t,o){let{t:n}=N(),r=Et.useRef({editor:e,exporters:t,feedback:o,t:n});r.current={editor:e,exporters:t,feedback:o,t:n};let i=Et.useRef(null),a=Et.useRef(null),[s,l]=Et.useState(false),[c,d]=Et.useState(""),[f,u]=Et.useState(""),[g,m]=Et.useState(false),[p,v]=Et.useState(false),[y,x]=Et.useState({}),b=Et.useCallback(T=>{let{t:S}=r.current;if(T instanceof editor.ChromeExportError)return S("toolbar.printPdfMissing");if(T instanceof editor.ChromePrintError){if(T.code==="pdf-viewer-unavailable")return S("toolbar.printNoViewer");if(T.code==="pdf-load-failed")return S("toolbar.printLoadFailed");if(T.code==="print-refused")return S("toolbar.printRefused")}return S("toolbar.printFailedMessage",{message:T instanceof Error?T.message:String(T)})},[]),h=Et.useCallback(()=>{i.current=null,v(false),m(false),l(false);},[]),C=Et.useCallback(async T=>{let{editor:S,exporters:P}=r.current;if(!S||i.current)return;let k={};i.current=k,a.current?.dispose(),a.current=null,x(k),v(true),m(true),l(true),d(""),u("");try{let w=await editor.runChromePrint(S,P,T??document);if(i.current!==k){w.dispose();return}a.current=w,await w.print({beforePrint:()=>{if(i.current!==k)throw new editor.ChromePrintError("print-ended");reactDom.flushSync(()=>m(!1));}}),i.current===k&&h();}catch(w){if(i.current!==k)return;if(!r.current.feedback){console.error("[docx-editor] print failed",w),h();return}l(false),u(a.current?.url??""),d(b(w)),m(true);}},[h,b]);return Et.useEffect(()=>()=>{i.current=null,a.current?.dispose(),a.current=null;},[]),{pending:s,error:c,url:f,visible:g,active:p,session:y,execute:C,close:h}}var JR="https://github.com/eigenpal/docx-editor/issues/new";function QR(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function bb(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),o=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??QR()}`,`- Viewport: ${o.width} x ${o.height}`,`- User agent: ${t}`,""].join(`
|
|
2
|
-
`),i=new URLSearchParams({title:"[Bug] ",body:r});return `${JR}?${i.toString()}`}function ii(e){typeof window>"u"||window.open(bb(e),"_blank","noopener,noreferrer");}function ek({className:e,hidden:t,onSelect:o}){let{setOpenMenu:n,onReportIssue:r,reportIssue:i}=at(),a=De();if(t||i===false)return null;let s=o??r??ii;return jsxRuntime.jsx(_e,{slot:"help.reportIssue",onSelect:()=>{s(),n(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var hs=Object.assign(ek,{docxSlot:"help.reportIssue"});function tk({children:e,...t}){let{reportIssue:o}=at();return e===void 0&&o===false?null:jsxRuntime.jsxs(qt,{id:"help",...t,children:[jsxRuntime.jsx(hs,{}),e]})}var hp=Object.assign(tk,{docxMenu:"help"});var ak=e=>e.hiddenReviewAuthors??[];function bs({className:e,hidden:t}){let o=H(),n=Aa(),r=B(ak),i=De(),{t:a}=N();if(t)return null;let s=i("reviewers.label"),l=editor.toolbarCommandState(o,"review.authors"),c=i18n.localizeDisabledReason(l.disabledReason,a);if(!l.enabled)return jsxRuntime.jsx(_e,{disabled:true,title:c??void 0,slot:"review.authors",children:s});let d=new Set(r),f=n.every(u=>!d.has(u.author));return jsxRuntime.jsxs(Zt,{labelKey:"reviewers.label",className:e,children:[jsxRuntime.jsx(yb,{checked:f,label:i("reviewers.all"),slot:"reviewer-all",onChoose:()=>o?.setAllReviewAuthorsVisible(!f)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),n.map(u=>jsxRuntime.jsx(yb,{checked:!d.has(u.author),label:u.author||"\u2014",slot:`reviewer-${u.slot}`,onChoose:()=>o?.setReviewAuthorVisible(u.author,d.has(u.author))},u.author))]})}function yb(e){return jsxRuntime.jsx(_e,{active:e.checked,slot:e.slot,className:"docx-menubar__reviewer-item",icon:jsxRuntime.jsx("span",{className:"docx-menubar__reviewer-check",children:e.checked?"\u2713":""}),onSelect:e.onChoose,children:e.label})}function ik({children:e,...t}){return jsxRuntime.jsxs(qt,{id:"review",...t,children:[jsxRuntime.jsx(Zt,{labelKey:"reviewers.markupOptions",className:"docx-menubar__markup-options",children:jsxRuntime.jsx(bs,{className:"docx-menubar__reviewers-submenu"})}),e]})}var vs=Object.assign(ik,{docxMenu:"review"});var sk={file:bd,format:vd,insert:yd,review:vs,help:hp};function si(e,t=false){if(!Et.isValidElement(e))return null;if(e.type===Et.Fragment){let i=Et.Children.toArray(e.props.children).map(a=>si(a,t)).filter(a=>a!==null);return i.length===1?i[0]:null}let o=e.props;if(o.hidden===true&&!t)return null;let n=e.type;return (typeof n=="function"||typeof n=="object")&&typeof n.docxMenu=="string"?n.docxMenu:e.type===qt&&typeof o.id=="string"?o.id:null}var ck=new Set(editor.CHROME_MENUS.map(e=>e.id));function Ts(e){if(!Et.isValidElement(e))return null;if(e.type===Et.Fragment){let n=Et.Children.toArray(e.props.children).map(Ts).filter(r=>r!==null);return n.length===1?n[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===qt){let o=e.props.id;if(typeof o=="string"&&ck.has(o))return o}return null}var dk=e=>e.isOpening===true;function uk(e){let t=Pr(),o=Kt(),n=Tt(),{className:r,t:i,fileName:a,exporters:s,onOpen:l,onOpenFile:c,onSave:d,onPageSetup:f,onReportIssue:u,reportIssue:g,preset:m=true,overflow:p=true,children:v}=e,y=H(),{t:x}=N(),[b,h]=Et.useState(null),C=B(dk);Et.useEffect(()=>{C&&h(null);},[C]);let[T,S]=Et.useState(null),P=fb(y,s,a??T??void 0),{pending:k,execute:w}=P,E=hb(y,s,o?.print!==false),{active:D,execute:A}=E,_=E.visible&&o?.print!==false,[F,M]=Et.useState(null),[I,U]=Et.useState(false),[L,Y]=Et.useState(false),j=Et.useRef(null),me=Et.useRef(null);Et.useEffect(()=>{if(b===null)return;let re=oe=>{let ye=j.current;ye&&oe.target instanceof Node&&ye.contains(oe.target)||h(null);};return document.addEventListener("mousedown",re),()=>{document.removeEventListener("mousedown",re);}},[b]),Mr(b!==null,j,()=>h(null),re=>re.target instanceof Node&&j.current?.contains(re.target)===true);let z=Et.useCallback(re=>{h(re),re!==null&&M(re);},[]),ie=Et.useCallback(()=>me.current?.click(),[]),J=Et.useCallback(()=>{y&&y.save().then(re=>gs(re,fs(a??T??void 0))).catch(re=>{console.error("[docx-editor] save failed",re);});},[y,a,T]),W=Et.useCallback(()=>t?t.open("pageSetup",j.current?.querySelector('[data-menu="file"] > [role="menuitem"]')):U(true),[t]),q=y?l??ie:void 0,fe=y?d??J:void 0,ve=!!s?.pdf,de=Et.useMemo(()=>y&&!D?()=>{rd(j.current),A(editor.editorInstanceScope(j.current)??j.current??void 0);}:void 0,[y,D,A]),ze=y?t?.ownsPageSetup?W:f??W:void 0;Et.useEffect(()=>{let re=oe=>{if(!(oe.metaKey||oe.ctrlKey)||oe.altKey||oe.shiftKey)return;let ye=oe.key.toLowerCase(),$e=editor.isChromePrintShortcut(oe);if(ye!=="s"&&ye!=="o"&&!$e)return;let Ze=oe.target,fo=editor.editorInstanceScope(j.current)??j.current;if(!(!Ze||!fo?.contains(Ze)))if($e){if(!ve||!y||!de&&!_)return;oe.preventDefault(),de?.();}else ye==="s"&&fe?(oe.preventDefault(),fe()):ye==="o"&&q&&(oe.preventDefault(),q());};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[q,fe,de,_,ve,y]);let Lt=Et.useMemo(()=>({t:i,openMenu:b,setOpenMenu:z,activeMenu:F,onOpen:q,onSave:fe,onExport:y&&!k?re=>(rd(j.current),w(re)):void 0,onPrint:de,printShortcut:ve,onPageSetup:ze,onParagraphDialog:()=>t?t.open("paragraph",j.current?.querySelector('[data-menu="format"] > [role="menuitem"]')):Y(true),onReportIssue:u,reportIssue:g,opening:C}),[C,y,k,w,de,ve,i,b,z,F,q,fe,ze,t,u,g]),Je=Et.Children.toArray(v),ut=[];if(m){let re=new Map(Je.map(oe=>[Ts(oe),oe]));for(let oe of editor.CHROME_MENUS){let ye=re.get(oe.id);(ye===void 0||si(ye)!==null)&&ut.push(oe.id);}for(let oe of Je){if(Ts(oe)!==null)continue;let ye=si(oe);ye!==null&&ut.push(ye);}}else for(let re of Je){let oe=si(re);oe!==null&&ut.push(oe);}let Se=[...ut].reverse(),{attach:uo,overflow:po}=Xi(p,ut,Se),mo=Et.useMemo(()=>({measuring:p,overflow:po,inMore:false}),[p,po]),Mo=Et.useMemo(()=>({measuring:false,overflow:po,inMore:true}),[po]),Yt=re=>si(re,true)!==null,ne=(re,oe)=>jsxRuntime.jsx("div",{role:"none",className:"docx-menubar__host",[fn]:"",children:re},oe),ge,xt;if(!m)ge=Je.filter(Yt),xt=p?Je.map((re,oe)=>Yt(re)?re:ne([re],`host-${oe}`)):v;else {let re=new Map,oe=[];for(let $e of Je){let Ze=Ts($e);Ze?re.set(Ze,$e):oe.push($e);}ge=[...editor.CHROME_MENUS.map($e=>{let Ze=re.get($e.id);if(Ze)return jsxRuntime.jsx(Et.Fragment,{children:Ze},$e.id);let fo=sk[$e.id];return jsxRuntime.jsx(fo,{},$e.id)}),...oe.filter(Yt)];let ye=oe.filter($e=>!Yt($e));xt=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ge,ye.length>0?ne(ye,"host"):null]});}let zn=i?.("formattingBar.more")??x("formattingBar.more");return jsxRuntime.jsxs(na.Provider,{value:Lt,children:[jsxRuntime.jsx("div",{ref:re=>{if(j.current=re,uo(re),re&&F===null){let oe=nd(re)[0]?.closest("[data-menu]")?.getAttribute("data-menu");oe&&M(oe);}},role:"menubar","aria-label":i?.("titleBar.menuBarAriaLabel")??x("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",...p?{"data-overflow":""}:{},className:`${n}docx-menubar${r?` ${r}`:""}`,onMouseDown:Z,onKeyDown:re=>{if(re.key!=="ArrowLeft"&&re.key!=="ArrowRight")return;let oe=j.current;if(!oe)return;let ye=nd(oe),$e=ye.indexOf(document.activeElement);if($e===-1)return;re.preventDefault();let Ze=re.key==="ArrowRight"?1:-1,fo=ye[($e+Ze+ye.length)%ye.length],$n=fo?.closest("[data-menu]")?.getAttribute("data-menu");$n&&(M($n),fo?.focus(),b!==null&&h($n));},children:jsxRuntime.jsxs(ji.Provider,{value:mo,children:[jsxRuntime.jsx(nr.Provider,{value:0,children:xt}),po.size>0?jsxRuntime.jsx(qt,{id:or,label:zn,icon:ae(ku),preset:false,children:jsxRuntime.jsx(ji.Provider,{value:Mo,children:ge})}):null]})}),jsxRuntime.jsxs(Bg,{children:[P.visible&&o?.export!==false?o?.export?ke(o.export,{open:true,format:P.format,pending:P.pending,error:P.error,onClose:P.dismiss},P.session):jsxRuntime.jsx(Vr,{open:true,format:P.format,pending:P.pending,error:P.error,onClose:P.dismiss}):null,E.visible&&o?.print!==false?o?.print?ke(o.print,{open:true,pending:E.pending,error:E.error,url:E.url,onClose:E.close},E.session):jsxRuntime.jsx(Gr,{open:true,pending:E.pending,error:E.error,url:E.url,onClose:E.close}):null]}),jsxRuntime.jsx("input",{ref:me,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:re=>{let oe=re.target.files?.[0];re.target.value="",!(!oe||!y)&&(S(oe.name),c?.(oe),oe.arrayBuffer().then(ye=>y.load(new Uint8Array(ye))).catch(ye=>{console.error("[docx-editor] could not open the file",ye);}));}}),jsxRuntime.jsx(Sn,{open:I,onClose:()=>U(false)}),jsxRuntime.jsx(xo,{open:L,onClose:()=>Y(false)})]})}var ci=Object.assign(uk,{Menu:qt,File:bd,Format:vd,Insert:yd,Review:vs,Help:hp,Item:bo,Row:_e,Group:da,Separator:gn,Submenu:Zt,TableGrid:ar,Entry:pa,Open:cd,Save:dd,ExportMarkdown:ud,ExportPdf:pd,Print:md,PageSetup:fd,ImageInsert:gd,Reviewers:bs,ReportIssue:hs});var hk=12240,wb=1440,kb=1440,Db=567,kn=20,Tp=6,Sp=kn+Tp+2,bk="var(--doc-text-muted)",vk="var(--doc-text-subtle)",Mb="var(--doc-shadow-subtle)",yk="var(--doc-primary)",xk="var(--doc-primary-hover)",Ck="var(--doc-text-subtle)",ui=5,di=7,Tk={left:0,right:0,firstLine:0};function Rb(e,t){return t==="inch"?(e/kb).toFixed(2)+'"':(e/Db).toFixed(1)+" cm"}function Pk(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function Dn({pageSetup:e,zoom:t=1,editable:o=false,onLeftMarginChange:n,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:s,indentEditable:l=false,onIndentChange:c,onIndentDragEnd:d,unit:f="inch",className:u="",style:g,tabMarks:m,onTabMarkRemove:p}){let{t:v}=N(),[y,x]=Et.useState(null),[b,h]=Et.useState(null),[C,T]=Et.useState(null),[S,P]=Et.useState(null),k=Et.useRef(null),w=e?.pageWidthTwips??hk,E=e?.marginsTwips.left??wb,D=e?.marginsTwips.right??wb,A=e?.gutterTwips??0,_={pageWidth:w,leftMargin:E,rightMargin:D},F=s??Tk,M=Ne(w)*t,I=Ne(E)*t,U=Ne(D)*t,L=Et.useCallback(q=>{let fe=k.current?.getBoundingClientRect();return fe?Fl((q-fe.left)/t):null},[t]),Y=Et.useCallback((q,fe,ve)=>{let de=L(fe);if(de===null)return;if(P(Ne(de)*t),q==="leftMargin"||q==="rightMargin"){if(q==="leftMargin"){let Lt=w-D-A-720,Je=Math.round(Math.max(0,Math.min(de,Lt)));T(Je),n?.(Je);}else {let Lt=w-de,Je=w-E-A-720,ut=Math.round(Math.max(0,Math.min(Lt,Je)));T(ut),r?.(ut);}return}let ze=editor.dragIndent(q,de,F,_,{unit:f,precise:ve});T(q==="right"?ze.right:q==="firstLine"?ze.firstLine:ze.left),c?.(ze);},[L,t,w,E,D,A,n,r,c,F,_,f]),j=Et.useCallback(q=>{q==="leftMargin"||q==="rightMargin"?i?.():d?.(),x(null),T(null),P(null);},[i,d]),me=Et.useCallback((q,fe,ve)=>{let de=editor.handlePosition(q,F,_),ze=editor.dragIndent(q,de+fe*Pk(f,ve),F,_,{unit:f,precise:true});c?.(ze),d?.();},[F,_,f,c,d]),z=kk(w,t,f),ie=a&&l&&c!==void 0,J=q=>Ne(editor.handlePosition(q,F,_))*t,W=(q,fe,ve)=>({positionPx:J(q),editable:ie,isDragging:y===q,isHovered:b===q,onPointerEnter:()=>h(q),onPointerLeave:()=>h(null),onPointerDown:de=>{ie&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),x(q));},onPointerMove:de=>{y===q&&Y(q,de.clientX,de.altKey);},onPointerUp:de=>{y===q&&(de.currentTarget.releasePointerCapture(de.pointerId),j(q));},onKeyDown:de=>{ie&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),me(q,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:v(fe),valueNow:ve,valueText:Rb(ve,f),pageWidthTwips:w});return jsxRuntime.jsxs("div",{ref:k,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:ht(M),height:Sp,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:y?"ew-resize":"default",flexShrink:0,marginInline:"auto",...g},role:"group","aria-label":v("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:ht(I),height:kn,backgroundColor:Mb,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&n?q=>{q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),x("leftMargin");}:void 0,onPointerMove:q=>y==="leftMargin"&&Y("leftMargin",q.clientX,q.altKey),onPointerUp:q=>{y==="leftMargin"&&(q.currentTarget.releasePointerCapture(q.pointerId),j("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:ht(U),height:kn,backgroundColor:Mb,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&r?q=>{q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),x("rightMargin");}:void 0,onPointerMove:q=>y==="rightMargin"&&Y("rightMargin",q.clientX,q.altKey),onPointerUp:q=>{y==="rightMargin"&&(q.currentTarget.releasePointerCapture(q.pointerId),j("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:kn,pointerEvents:"none"},children:z.map((q,fe)=>jsxRuntime.jsx(Sk,{tick:q},fe))}),m?.map(q=>jsxRuntime.jsx(Rk,{tabMark:q,positionPx:Ne(q.position)*t,onDoubleClick:()=>p?.(q.position)},q.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cp,{direction:"down",anchor:"top",...W("firstLine","ruler.firstLineIndent",F.firstLine)}),jsxRuntime.jsx(Cp,{direction:"up",anchor:"strip",...W("hanging","ruler.hangingIndent",F.left)}),jsxRuntime.jsx(Ek,{...W("left","ruler.leftIndent",F.left)}),jsxRuntime.jsx(Cp,{direction:"up",anchor:"strip",...W("right","ruler.rightIndent",F.right)})]}),y&&C!==null&&S!==null&&jsxRuntime.jsx(wk,{value:Rb(C,f),positionPx:S})]})}function Sk({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:ht(e.position),bottom:0,width:1,height:e.height,backgroundColor:vk}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:ht(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:bk,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Ib(e){return e.editable?e.isDragging||e.isHovered?xk:yk:Ck}function _b(e,t,o){return {position:"absolute",left:ht(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...o}}function Nb(e){return {role:"slider","aria-label":e.label,"aria-orientation":"horizontal","aria-valuenow":e.valueNow,"aria-valuemin":-e.pageWidthTwips,"aria-valuemax":e.pageWidthTwips,"aria-valuetext":e.valueText,"aria-disabled":e.editable?void 0:true,tabIndex:e.editable?0:-1}}function Cp({direction:e,anchor:t,...o}){let n=Ib(o),r=t==="top"?{top:0,height:di+1}:{top:kn-di,height:di};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:_b(o,ui*2,r),onPointerEnter:o.onPointerEnter,onPointerLeave:o.onPointerLeave,onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onKeyDown:o.onKeyDown,...Nb(o),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${ui}px solid transparent`,borderRight:`${ui}px solid transparent`,...e==="down"?{top:0,borderTop:`${di}px solid ${n}`}:{bottom:0,borderBottom:`${di}px solid ${n}`},transition:"border-color 0.1s"}})})}function Ek(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:_b(e,ui*2,{top:kn+1,height:Tp}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Nb(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:ui*2-2,height:Tp,backgroundColor:Ib(e),borderRadius:1,transition:"background-color 0.1s"}})})}function wk({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ht(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var Mk={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function Rk({tabMark:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ht(t-5),top:kn-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:n=>{n.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:Mk[e.alignment]||"L"})}function kk(e,t,o){let n=[];if(o==="inch"){let r=kb/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;a%8===0?n.push({position:l,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?n.push({position:l,height:5}):a%2===0?n.push({position:l,height:3}):n.push({position:l,height:2});}}else {let r=Db/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;a%10===0?n.push({position:l,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?n.push({position:l,height:5}):n.push({position:l,height:3});}}return n}var _k=15840,Hb=1440,Es=1440,ws=567,Fr=20,Nk="var(--doc-text-muted)",Lk="var(--doc-text-subtle)",Fk="var(--doc-primary)",Hk="var(--doc-primary)",Ak="var(--doc-primary-hover)";function pi({pageSetup:e,zoom:t=1,editable:o=false,onTopMarginChange:n,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:s="",style:l}){let{t:c}=N(),[d,f]=Et.useState(null),[u,g]=Et.useState(null),m=Et.useRef(null),p=e?.pageHeightTwips??_k,v=e?.marginsTwips.top??Hb,y=e?.marginsTwips.bottom??Hb,x=(E,D)=>{if(!o||E.altKey||E.ctrlKey||E.metaKey||!["ArrowUp","ArrowDown","Home","End"].includes(E.key))return;E.preventDefault();let A=D==="topMargin"?v:y,F=Math.max(0,p-(D==="topMargin"?y:v)-720),M=E.shiftKey?1:Math.round(a==="cm"?ws/10:Es/8),I=E.key==="Home"?0:E.key==="End"?F:Math.max(0,Math.min(F,A+(E.key==="ArrowUp"?M:-M)));I!==A&&((D==="topMargin"?n:r)?.(I),i?.());},b=Ne(p)*t,h=Ne(v)*t,C=Ne(y)*t,T=Et.useCallback((E,D)=>{o&&(E.preventDefault(),f(D));},[o]),S=Et.useCallback(E=>{if(!d||!m.current)return;let D=m.current.getBoundingClientRect(),A=E.clientY-D.top,_=Fl(A/t);if(d==="topMargin"){let F=p-y-720,M=Math.max(0,Math.min(_,F));n?.(Math.round(M));}else if(d==="bottomMargin"){let F=p-_,M=p-v-720,I=Math.max(0,Math.min(F,M));r?.(Math.round(I));}},[d,t,p,v,y,n,r]),P=Et.useCallback(()=>{d!==null&&i?.(),f(null);},[d,i]);Et.useEffect(()=>{if(d)return document.addEventListener("mousemove",S),document.addEventListener("mouseup",P),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",P);}},[d,S,P]);let k=Bk(p,t,a),w={position:"relative",width:Fr,height:ht(b),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...l};return jsxRuntime.jsxs("div",{ref:m,className:`docx-vertical-ruler ${s}`,style:w,role:"group","aria-label":c("ruler.vertical"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:k.map((E,D)=>jsxRuntime.jsx(Ok,{tick:E},D))}),jsxRuntime.jsx(Ab,{type:"topMargin",value:v,maximum:Math.max(0,p-y-720),valueText:v/(a==="cm"?ws:Es),unit:a,onKeyDown:E=>x(E,"topMargin"),position:h,editable:o,isDragging:d==="topMargin",isHovered:u==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>T(E,"topMargin")}),jsxRuntime.jsx(Ab,{type:"bottomMargin",value:y,maximum:Math.max(0,p-v-720),valueText:y/(a==="cm"?ws:Es),unit:a,onKeyDown:E=>x(E,"bottomMargin"),position:b-C,editable:o,isDragging:d==="bottomMargin",isHovered:u==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>T(E,"bottomMargin")})]})}function Ok({tick:e}){let t={position:"absolute",top:ht(e.position),right:0,height:1,width:e.width,backgroundColor:Lk},o={position:"absolute",top:ht(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Nk,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:o,children:e.label})]})}function Ab({type:e,position:t,value:o,maximum:n,valueText:r,unit:i,onKeyDown:a,editable:s,isDragging:l,isHovered:c,onMouseEnter:d,onMouseLeave:f,onMouseDown:u}){let{t:g}=N(),m=l?Ak:c?Hk:Fk,p={position:"absolute",top:ht(t-5),right:0,width:Fr,height:10,cursor:s?"ns-resize":"default",zIndex:l?10:1},v={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${m}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:p,onMouseEnter:d,onMouseLeave:f,onMouseDown:u,role:"slider","aria-label":g(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":n,"aria-valuetext":`${r.toFixed(2)} ${i==="cm"?"cm":"in"}`,"aria-disabled":!s,onKeyDown:a,tabIndex:s?0:-1,children:jsxRuntime.jsx("div",{style:v})})}function Bk(e,t,o){let n=[];if(o==="inch"){let r=Es/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;if(a%8===0){let c=a/8;n.push({position:l,width:10,label:c>0?String(c):void 0});}else a%4===0?n.push({position:l,width:6}):a%2===0?n.push({position:l,width:4}):n.push({position:l,width:2});}}else {let r=ws/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let s=a*r;if(s>e)break;let l=Ne(s)*t;if(a%10===0){let c=a/10;n.push({position:l,width:10,label:c>0?String(c):void 0});}else a%5===0?n.push({position:l,width:6}):n.push({position:l,width:3});}}return n}var In=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var Kk=e=>e.formatting?.indent??null,Wk=e=>e.editable;function wp(){let e=H(),t=B(Kk),o=B(Wk),n=Et.useMemo(()=>o&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,o]),r=Et.useCallback(i=>e?e.exec({...i.left!==void 0?{left:i.left}:{},...i.right!==void 0?{right:i.right}:{},...i.firstLine!==void 0?{firstLine:i.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Et.useMemo(()=>({indent:t,isEnabled:n,apply:r}),[t,n,r])}var Kb=e=>e.zoom,$k=e=>e.isOpening===true;function Wb(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function zb(){let{apply:e}=Pn(),[t,o]=Et.useState({}),n=Et.useRef({}),r=Et.useCallback(a=>s=>{n.current={...n.current,[a]:Math.round(s)},o(n.current);},[]),i=Et.useCallback(()=>{let a=n.current;n.current={},o({}),Object.keys(a).length!==0&&e({...a.top!==void 0?{marginTopTwips:a.top}:{},...a.right!==void 0?{marginRightTwips:a.right}:{},...a.bottom!==void 0?{marginBottomTwips:a.bottom}:{},...a.left!==void 0?{marginLeftTwips:a.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:i}}function qb(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function Uk(){let e=H(),{indent:t,isEnabled:o,apply:n}=wp(),[r,i]=Et.useState(null),a=Et.useRef(null),s=Et.useRef(null),l=Et.useCallback(f=>{s.current===null&&(s.current=qb(e)),a.current=f,i(f);},[e]),c=Et.useCallback(()=>{let f=a.current,u=s.current;a.current=null,s.current=null,i(null),f&&(u!==null&&u!==qb(e)||n({left:f.left,right:f.right,firstLine:f.firstLine}));},[e,n]),d=Et.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine,...t.rtl?{rtl:true}:{}}:null),[r,t]);return Et.useMemo(()=>({indent:d,isEnabled:o,preview:l,commit:c}),[d,o,l,c])}function Vk(){let e=Ye(),[t,o]=Et.useState(0);return Et.useEffect(()=>{if(!e){o(0);return}let n=()=>o(e.scrollLeft);return n(),e.addEventListener("scroll",n,{passive:true}),()=>e.removeEventListener("scroll",n)},[e]),t}function Rs(e){let t=B(In),o=B($k),{pageSetup:n,isEnabled:r}=Pn(),i=B(Kb),{pending:a,preview:s,commit:l}=zb(),c=Uk(),d=an(),f=qo(),u=Vk();return t?null:jsxRuntime.jsx("div",{className:`docx-ruler-frame${o?" docx-ruler-frame--opening":""}`,style:{paddingInlineStart:d+f.inlineStart,paddingRight:f.inlineEnd},children:jsxRuntime.jsx(Dn,{pageSetup:Wb(n,a),zoom:i,editable:r,onLeftMarginChange:s("left"),onRightMarginChange:s("right"),onMarginDragEnd:l,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-u}px)`,clipPath:d>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function ks(e){let t=B(In),{pageSetup:o,isEnabled:n}=Pn(),r=B(Kb),{pending:i,preview:a,commit:s}=zb(),l=an(),c=qo(),d=mh();return t||d!==null&&d>0&&o&&Ne(o.pageWidthTwips)*r>d-l-c.inlineStart-c.inlineEnd?null:jsxRuntime.jsx(pi,{pageSetup:Wb(o,i),zoom:r,editable:n,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:s,unit:e.unit??"inch",className:e.className??"",style:e.style})}function O({size:e=20,className:t="",style:o,children:n}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...o},"aria-hidden":"true",children:n})}function $b(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function Ub(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function Vb(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Gb(e){return jsxRuntime.jsxs(O,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function jb(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function Yb(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function Xb(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Jb(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Qb(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function ev(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function tv(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function ov(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"})})}function Yk(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function Xk(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function Jk(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function Qk(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function eD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function tD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function oD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function nD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function rD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function aD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function iD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function lD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function sD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"})})}function cD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"})})}function dD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function uD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function pD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function mD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function fD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Dp(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function gD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function hD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function bD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function vD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function yD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function xD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function CD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function TD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function PD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function SD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function ED(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function wD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function MD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function nv(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function RD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function kD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function DD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function ID(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function _D(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function ND(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function LD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function FD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function HD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function AD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function OD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function BD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function ZD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function qD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function KD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function WD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function zD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function $D(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function UD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function VD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function GD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function jD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function YD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function XD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function JD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function QD(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function e2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function t2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function o2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function n2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function r2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function a2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function i2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function l2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function s2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function c2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function d2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function u2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function p2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function m2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function f2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function g2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function h2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function b2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function v2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function y2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function x2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function C2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function T2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function P2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function S2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function E2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function w2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function M2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function R2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function k2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function D2(e){return jsxRuntime.jsx(O,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var I2={undo:Yk,redo:Xk,print:Jk,file_download:Qk,file_upload:eD,format_bold:tD,format_italic:oD,format_underlined:nD,strikethrough_s:rD,superscript:aD,subscript:iD,link:lD,format_clear:dD,format_paragraph:sD,format_shapes:cD,lock:ov,format_align_left:uD,format_align_center:pD,format_align_right:mD,format_align_justify:fD,format_line_spacing:Dp,format_list_bulleted:gD,format_list_numbered:hD,format_indent_increase:bD,format_indent_decrease:vD,format_color_text:yD,ink_highlighter:xD,format_color_reset:CD,arrow_drop_down:TD,table:PD,table_chart:SD,grid_on:ED,table_rows:wD,view_column:MD,border_all:nv,select_all:nv,border_outer:RD,border_inner:kD,border_clear:DD,add:ID,remove:_D,delete:ND,delete_sweep:LD,call_merge:FD,call_split:HD,drag_indicator:AD,image:OD,format_image_left:BD,format_image_right:ZD,horizontal_rule:qD,flip_to_back:KD,flip_to_front:WD,open_with:zD,tune:$D,rotate_right:UD,rotate_left:VD,swap_horiz:GD,swap_vert:jD,shapes:YD,format_paint:XD,expand_more:JD,expand_less:QD,border_top:e2,border_bottom:t2,border_left:o2,border_right:n2,border_horizontal:r2,border_vertical:a2,padding:i2,text_rotation_none:l2,wrap_text:s2,height:c2,fit_width:d2,settings:u2,border_color:p2,format_color_fill:m2,vertical_align_top:f2,vertical_align_center:g2,vertical_align_bottom:h2,line_weight:b2,keyboard_arrow_up:v2,keyboard_arrow_down:y2,keyboard_arrow_left:x2,keyboard_arrow_right:C2,more_vert:T2,page_break:P2,branding_watermark:S2,arrow_back:E2,search:w2,toc:M2,done_all:$b,check_circle:Ub,chat_bubble_outline:Vb,chat_bubble_check:Gb,check:jb,close:Yb,add_comment:Xb,comment:Jb,edit_note:Qb,rate_review:ev,visibility:tv,format_textdirection_l_to_r:R2,format_textdirection_r_to_l:k2,"agent-sparkle":D2};function $({name:e,size:t=20,className:o="",style:n}){let r=I2[e];return r?jsxRuntime.jsx(r,{size:t,className:o,style:n}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:o,style:{fontSize:t,width:t,height:t,...n},children:e}))}var mi=12,Ip=240,av=16,F2=24,H2=mi+Ip+av,Hr=12,A2=36,O2=Hr+A2+av,fi=Et__namespace.default.memo(function({headings:t,onHeadingClick:o,onClose:n,topOffset:r=0,scrollLeft:i=0,leftOffset:a=mi}){let{t:s}=N(),[l,c]=Et.useState(false),d=t.length?Math.min(...t.map(f=>f.level)):0;return Et.useEffect(()=>{requestAnimationFrame(()=>c(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":s("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:Ip,paddingTop:F2,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:l?"translateX(0)":`translateX(-${a+Ip}px)`,transition:"transform 0.15s ease-out"},onMouseDown:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":s("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:s("documentOutline.closeTitle"),children:jsxRuntime.jsx($,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:s("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:s("documentOutline.noHeadings")}):t.map((f,u)=>jsxRuntime.jsx("div",{style:{marginLeft:(f.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>o(f.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:f.text,children:f.text})},`${f.blockId}-${u}`))})]})});var q2=e=>e,K2=Object.freeze([]),W2=()=>{};function _p(e){let t=H(),o=B(q2),n=Et.useMemo(()=>t&&!o.isLoading?t.getOutline():K2,[t,o]),r=Et.useCallback(i=>{if(!t)return;t.focus();let a={paragraphId:i,offset:0};t.exec({type:"setSelection",range:{anchor:a,head:a}}),t.scrollToBlock(i);},[t]);return In(o)?null:jsxRuntime.jsx(fi,{headings:n,onHeadingClick:r,onClose:e.onClose??W2,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Np=Et.createContext(null);function Vo(e){let t=Et.useContext(Np);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Ar=280,Ds=32,iv=16;function Or(e=280){return 32+e+16}function Is({viewportWidth:e,pageWidthPx:t,reservation:o,inlineEndReservation:n=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(n)||n<0||!Number.isFinite(r)||r<0)return 0;let a=(e-n-t)/2,s=a>=o?0:!i&&o<=2*a?2*(o-a):o;return Math.ceil(Math.max(0,s-r))}var Lp=320;function _s(e,t){return !Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?false:e-t<Lp}var j2=Object.freeze([]),Y2=e=>e;function Ns(){let e=H(),t=B(Y2),[o,n]=Et.useState(null),r=Et.useMemo(()=>e&&!t.isLoading?e.getOutline():j2,[e,t]),i=Et.useMemo(()=>{if(r.length===0)return [];let s=r[0].level;for(let l of r)l.level<s&&(s=l.level);return r.map(l=>({heading:l,depth:l.level-s}))},[r]),a=Et.useCallback(s=>{if(!e||typeof s!="string"||s.length===0)return;e.focus();let l={paragraphId:s,offset:0};e.exec({type:"setSelection",range:{anchor:l,head:l}}),e.scrollToBlock(s),n(s);},[e]);return {headings:r,items:i,selectedBlockId:o,goTo:a,isEmpty:r.length===0}}var mv=Object.freeze({query:"",matchCase:false,wholeWord:false,matches:Object.freeze([]),truncated:false,activeIndex:-1,activeMatch:null,isPending:false}),e8=()=>()=>{},sv=()=>mv;function Ls(e={}){let t=e.highlight??"all",o=H(),n=Et.useMemo(()=>o?editor.createDocumentSearch(o):null,[o]),r=Et.useSyncExternalStore(n?n.subscribe:e8,n?n.getState:sv,n?n.getState:sv);Et.useEffect(()=>{if(!(!n||t==="none"))return n.showHighlights(t)},[n,t]);let i=Et.useMemo(()=>({setQuery:a=>n?.setQuery(a),find:(a,s)=>n?.find(a,s)??mv.matches,setMatchCase:a=>n?.setMatchCase(a),setWholeWord:a=>n?.setWholeWord(a),goTo:a=>n?.goTo(a)??false,next:()=>n?.next()??false,previous:()=>n?.previous()??false,clear:()=>n?.clear()}),[n]);return Et.useMemo(()=>({...r,...i}),[r,i])}function hv(e,t=i18n.isApplePlatform()){return e.altKey||e.shiftKey||e.isComposing||(t?!e.metaKey||e.ctrlKey:!e.ctrlKey||e.metaKey)?false:editor.chordLetter(e)==="f"}function bv(e){return e.startsWith("Ctrl")?"Control+F":"Meta+F"}function vv(e,t,o){if(e?.isConnected){o&&e.closest(".docx-pages")?o():e.focus({preventScroll:true});return}t?t.focus({preventScroll:true}):o?.();}function yv(e,t,o){if(!e||typeof Node>"u"||!(e instanceof Node))return false;if(t?.contains(e))return true;if(!o)return false;if(o.contains(e))return true;let n=e instanceof Element?e:e.parentElement;if(!n)return false;let r=editor.editorInstanceScope(o);if(r&&r!==o&&r.contains(n))return true;if(!n.closest(".docx-editor")||editor.editorInstanceScope(n)!==null)return false;let i=o.ownerDocument.querySelectorAll(".docx-editor__scroll-container");return i.length===1&&i[0]===o}function Hp(e,t){let o=e?.querySelector(`#docx-nav-panel-${t}`);if(!o)return null;if(t==="headings"){let n=o.querySelector(".docx-nav__heading--current")??o.querySelector(".docx-nav__heading");if(n)return n}return o.querySelector(".docx-nav__search-input")}function Ap(e){e.focus(),typeof HTMLInputElement<"u"&&e instanceof HTMLInputElement&&e.select();}function n8(e){let o=e.querySelector('[role="tab"][aria-selected="true"]')?.id==="docx-nav-tab-find"?"find":"headings",n=Hp(e,o);if(n){Ap(n);return}e instanceof HTMLElement&&(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus());}function r8(e,t){let o=[];if(t.contains(e)){let i=e;for(;i!==t&&i.parentElement;){for(let a of i.parentElement.children)a!==i&&o.push(a);i=i.parentElement;}}else o.push(...t.children);let n=e.ownerDocument.activeElement;n&&o.some(i=>i.contains(n))&&n8(e);let r=[];for(let i of o)i.hasAttribute("inert")||(i.setAttribute("inert",""),r.push(i));return ()=>{for(let i of r)i.removeAttribute("inert");r.length=0;}}function xv(e,t,o){let n=r8(e,t),r=i=>{i.target instanceof Node&&e.contains(i.target)||o();};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),n();}}function gv(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Cv(e,t){let o=()=>{let r=getComputedStyle(t),i=t.clientHeight-gv(r.paddingTop)-gv(r.paddingBottom);e.style.setProperty("--docx-nav-block-size",`${Math.max(0,Math.round(i))}px`),e.style.setProperty("--docx-nav-inline-size",`${Math.round(t.clientWidth)}px`);};if(o(),typeof ResizeObserver>"u")return ()=>{};let n=new ResizeObserver(o);return n.observe(t),()=>n.disconnect()}function Tv(e,t=true){let o=H(),n=Ye(),r=Et.useRef(null),i=Et.useRef(null),a=Et.useRef(false),s=Et.useRef(false),l=Et.useRef(false),c=Et.useRef(0),d=Et.useCallback(()=>{let h=++c.current;setTimeout(()=>{c.current===h&&(a.current=false,s.current=false,l.current=false);},0);},[]),f=Et.useRef(e);f.current=e;let u=Et.useCallback(()=>{a.current=false;let h=Hp(r.current,f.current.tab);h&&Ap(h);},[]),g=Et.useCallback(()=>{s.current=false;let h=i.current;i.current=null;let C=r.current?.querySelector(".docx-nav__toggle")??null;vv(h,C,o?()=>o.focus():null);},[o]),m=Et.useRef(g);m.current=g,Et.useEffect(()=>()=>{s.current&&m.current();},[]);let p=Et.useCallback(()=>{a.current=false,s.current=true,f.current.setOpen(false),d();},[d]),v=Et.useMemo(()=>({toggle:()=>{if(f.current.open){p();return}i.current=null,s.current=false,a.current=true,f.current.setOpen(true),d();},close:p,picked:()=>{let h=f.current;if(!h.overlay)return;let C=r.current?.ownerDocument.activeElement;l.current=!!C&&!!r.current?.contains(C),h.setOpen(false),d();}}),[p,d]),y=Et.useRef(v);y.current=v,Et.useEffect(()=>{let h=r.current?.ownerDocument;if(!h||!t)return;let C=T=>{if(T.defaultPrevented||!hv(T)||!yv(T.target,r.current,n))return;T.preventDefault();let S=h.activeElement;S instanceof HTMLElement&&!r.current?.contains(S)&&(i.current=S),s.current=false;let P=f.current;if(P.open&&P.tab==="find"){u();return}a.current=true,P.tab!=="find"&&P.setTab("find"),P.open||P.setOpen(true),d();};return h.addEventListener("keydown",C),()=>h.removeEventListener("keydown",C)},[n,u,t,d]),Et.useEffect(()=>{a.current&&(f.current.open?u():a.current=false),s.current&&(f.current.open?s.current=false:g()),l.current&&(l.current=false,f.current.open||o?.focus());});let x=e.open&&e.overlay;Et.useEffect(()=>{let h=r.current;if(!(!x||!h||!n))return xv(h,n,()=>y.current.close())},[x,n]),Et.useEffect(()=>{let h=r.current;if(!(!h||!n||!n.contains(h)))return Cv(h,n)},[n]);let b=Et.useCallback(h=>{h.key!=="Escape"||h.defaultPrevented||h.nativeEvent.isComposing||f.current.open&&(h.preventDefault(),p());},[p]);return {rootRef:r,intents:v,onKeyDown:b}}function i8(e){return e.source!==void 0?true:(e.created?.length??0)>0||(e.deleted?.length??0)>0}function l8(e){let t=0;for(let o of e)t=Math.max(t,o.box.width);return t>0?t:null}function Pv(e,t){let o=null,n=false,r=()=>{o=null,n||t(l8(e.getPageGeometry()));},i=()=>{n||(o!==null&&clearTimeout(o),o=setTimeout(r,150));},a=e.on("change",s=>{i8(s)&&i();});return r(),{nudge:i,dispose(){n=true,o!==null&&clearTimeout(o),o=null,a();}}}var p8=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,zoom:e.zoom,reviewPaneOpen:e.reviewPaneOpen??true,fitting:t?.type==="fit"&&e.zoom<(t.maxZoom??editor.ZOOM_MAX)&&e.zoom>(t.minZoom??editor.ZOOM_MIN)}},m8=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips,f8=e=>e.page.total;function Fs(e={}){let{defaultOpen:t=false,defaultTab:o="headings",paneWidth:n=280}=e,[r,i]=Et.useState(t),[a,s]=Et.useState(o),l=e.open??r,c=e.tab??a,{onOpenChange:d,onTabChange:f}=e,u=e.open!==void 0,g=e.tab!==void 0,m=Et.useCallback(W=>{u||i(W),d?.(W);},[u,d]),p=Et.useCallback(()=>m(!l),[l,m]),v=Et.useCallback(W=>{g||s(W),f?.(W);},[g,f]),y=rn(),x=Ye(),b=Et.useContext(Ct),{pageSetup:h,zoom:C,reviewPaneOpen:T,fitting:S}=B(p8,m8),P=H(),k=B(f8),[w,E]=Et.useState(0),[D,A]=Et.useState(null),[_,F]=Et.useState(0),[M,I]=Et.useState(0),U=qo();Et.useEffect(()=>{if(!x){E(0),F(0),I(0);return}let W=()=>{E(x.clientWidth);let fe=getComputedStyle(x),ve=Number.parseFloat(fe.paddingInlineEnd);F(Number.isFinite(ve)?ve:0);let de=Number.parseFloat(fe.getPropertyValue("--docx-review-gutter-start"));I(Number.isFinite(de)?de:0);};if(W(),typeof ResizeObserver>"u")return;let q=new ResizeObserver(W);return q.observe(x),()=>q.disconnect()},[x,l,T,b?.mounted,U]);let L=Et.useRef(null);h&&(L.current=h.pageWidthTwips);let Y=h?.pageWidthTwips??L.current,j=Et.useRef(null);Et.useEffect(()=>{if(!l||!P)return;let W=Pv(P,A);return j.current=W,()=>{W.dispose(),j.current===W&&(j.current=null);}},[l,P]),Et.useEffect(()=>j.current?.nudge(),[k,Y]);let me=Or(n),z=uh(U,_),ie=l&&_s(w-z,me),J=Et.useMemo(()=>!l||ie||Y===null?0:Is({viewportWidth:w,pageWidthPx:Math.max(D??0,Ne(Y))*C,reservation:me,inlineEndReservation:_,inlineStartReservation:M,docked:S}),[l,ie,Y,D,C,w,me,_,M,S]);return Et.useEffect(()=>{if(y)return y.setShift(J),()=>y.setShift(0)},[y,J]),Et.useEffect(()=>{if(y)return y.setReservation(l&&!ie?me:0),()=>y.setReservation(0)},[y,l,ie,me]),{open:l,setOpen:m,toggle:p,tab:c,setTab:v,paneWidth:n,shift:J,overlay:ie}}var vi=["headings","find"],io=(...e)=>e.filter(Boolean).join(" ");function yi({className:e,style:t,children:o}){return jsxRuntime.jsx("div",{className:io("docx-nav__header",e),style:t,children:o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xi,{}),jsxRuntime.jsx(Ci,{})]})})}function xi({className:e,style:t,children:o}){let{intents:n,t:r}=Vo("Close");return jsxRuntime.jsx("button",{type:"button",className:io("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:n.close,children:o??jsxRuntime.jsx($,{name:"arrow_back",size:20})})}function Ci({className:e,style:t,children:o}){let{t:n}=Vo("Title");return jsxRuntime.jsx("h2",{className:io("docx-nav__title",e),style:t,children:o??n("navigation.title")})}function Ti({className:e,style:t,children:o}){let{pane:n,t:r}=Vo("Tabs"),i=Et.useCallback(a=>{let s=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(s===0)return;a.preventDefault();let l=vi.indexOf(n.tab);n.setTab(vi[(l+s+vi.length)%vi.length]);},[n]);return jsxRuntime.jsx("div",{className:io("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:o??vi.map(a=>jsxRuntime.jsx(Pi,{value:a},a))})}function Pi({value:e,className:t,style:o,children:n}){let{pane:r,t:i}=Vo("Tab"),a=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":a,"aria-controls":`docx-nav-panel-${e}`,tabIndex:a?0:-1,className:io("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:o,onClick:()=>r.setTab(e),children:n??i(`navigation.tabs.${e}`)})}function Ev({value:e,onChange:t,onClear:o,placeholder:n,label:r,clearLabel:i,autoFocus:a,onEnter:s}){let l=Et.useRef(null);return Et.useEffect(()=>{a&&l.current?.focus();},[a]),jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx($,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{ref:l,type:"search",className:"docx-nav__search-input",value:e,placeholder:n,"aria-label":r,autoFocus:a,onChange:c=>t(c.target.value),onKeyDown:c=>{!s||c.key!=="Enter"||c.nativeEvent.isComposing||(c.preventDefault(),s(c.shiftKey));}}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:o,children:jsxRuntime.jsx($,{name:"close",size:16})})]})}function Si({className:e,style:t}){let{pane:o,outline:n,intents:r,t:i}=Vo("Headings"),[a,s]=Et.useState(""),l=B(In),c=Et.useMemo(()=>{let f=a.trim().toLowerCase();return f.length===0?n.items:n.items.filter(u=>u.heading.text.toLowerCase().includes(f))},[n.items,a]),d=o.tab!=="headings";return jsxRuntime.jsxs("div",{className:io("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:d,children:[jsxRuntime.jsx(Ev,{value:a,onChange:s,onClear:()=>s(""),placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel")}),l?null:n.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((f,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:io("docx-nav__heading",n.selectedBlockId===f.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+f.depth*14}px`},title:f.heading.text,onClick:()=>{n.goTo(f.heading.blockId),r.picked();},children:f.heading.text})},`${f.heading.blockId}-${u}`))})]})}function x8({match:e,active:t,onSelect:o}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:io("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:o,children:jsxRuntime.jsxs("span",{className:"docx-nav__result-text",children:[e.contextBefore,jsxRuntime.jsx("mark",{className:"docx-nav__result-hit",children:e.text}),e.contextAfter]})})})}function Ei({className:e,style:t}){let{pane:o,search:n,intents:r,t:i}=Vo("Find"),a=o.tab!=="find",s=n.query.trim().length>0,l=o.open&&!a,c=n.matches.length===0?null:n.activeIndex<0?i(n.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:n.matches.length}):i(n.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:n.activeIndex+1,total:n.matches.length});return jsxRuntime.jsxs("div",{className:io("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(Ev,{value:n.query,onChange:n.setQuery,onClear:n.clear,placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel"),autoFocus:l,onEnter:d=>{n.isPending&&n.find(n.query),d?n.previous():n.next();}}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":i("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.matchCase,onChange:d=>n.setMatchCase(d.target.checked)}),i("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.wholeWord,onChange:d=>n.setWholeWord(d.target.checked)}),i("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:s?n.isPending?i("navigation.find.searching"):c??i("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.previousAriaLabel"),disabled:n.matches.length===0,onClick:n.previous,children:jsxRuntime.jsx($,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.nextAriaLabel"),disabled:n.matches.length===0,onClick:n.next,children:jsxRuntime.jsx($,{name:"keyboard_arrow_down",size:18})})]})]}),n.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":i("navigation.find.resultsAriaLabel"),children:n.matches.map((d,f)=>jsxRuntime.jsx(x8,{match:d,active:f===n.activeIndex,onSelect:()=>{n.goTo(f),r.picked();}},`${d.blockId}-${d.start}-${f}`))})]})}function wi({className:e,style:t,children:o}){let{pane:n,intents:r,findShortcut:i,t:a}=Vo("Toggle"),l=Do()("Ctrl+F"),c=i?bv(l):void 0,d=i?a("navigation.openShortcutTitle",{shortcut:l}):a("navigation.openTitle");return jsxRuntime.jsx("button",{type:"button",className:io("docx-nav__toggle",e),style:t,"aria-label":a("navigation.openAriaLabel"),"aria-expanded":n.open,"aria-keyshortcuts":c,title:d,onMouseDown:f=>f.preventDefault(),onClick:r.toggle,children:o??jsxRuntime.jsx($,{name:"toc",size:20})})}function Bp(e){let t=Tt(),{t:o,toggle:n=true,searchHighlight:r="all",findShortcut:i=true,className:a,style:s,children:l,...c}=e,d=Fs(c),f=Ns(),u=d.open&&d.tab==="find"?r:"none",g=Ls({highlight:u}),m=Ue(),p=Et.useMemo(()=>o??((b,h)=>m(b,h)),[o,m]),v=Tv(d,i),y=Et.useMemo(()=>({pane:d,outline:f,search:g,t:p,intents:v.intents,findShortcut:i}),[d,f,g,p,v.intents,i]),x=e.paneWidth??280;return jsxRuntime.jsx(Np.Provider,{value:y,children:jsxRuntime.jsxs("div",{ref:v.rootRef,className:`${t}docx-nav${d.open?" docx-nav--open":""}${d.overlay?" docx-nav--overlay":""}${a?` ${a}`:""}`,"data-open":d.open?"true":"false",onKeyDown:v.onKeyDown,style:{"--docx-nav-width":`${x}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Or(x)}px`,...s},children:[n!==false&&!d.open&&jsxRuntime.jsx(wi,{...typeof n=="object"?n:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":y.t("navigation.ariaLabel"),inert:!d.open,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yi,{}),jsxRuntime.jsx(Ti,{}),jsxRuntime.jsx(Si,{}),jsxRuntime.jsx(Ei,{})]})})]})})}var Hs=Object.assign(Bp,{Header:yi,Close:xi,Title:Ci,Tabs:Ti,Tab:Pi,Headings:Si,Find:Ei,Toggle:wi});var M8=600,R8=e=>e.isOpening===true?0:e.page.total,As=Et.createContext(null);function Os({className:e,style:t}){let o=Tt(),n=H(),r=Ye(),{inside:i,host:a,hostScoped:s}=gh(r),l=B(R8),{t:c}=N(),d=Et.useContext(As),[f,u]=Et.useState(1),[g,m]=Et.useState(false);if(Et.useEffect(()=>{if(m(false),!n||!r||l<=1)return;u(n.getCurrentPage("viewport"));let x=null,b=()=>{u(n.getCurrentPage("viewport")),m(true),x&&clearTimeout(x),x=setTimeout(()=>m(false),M8);};return r.addEventListener("scroll",b,{passive:true}),()=>{r.removeEventListener("scroll",b),x&&clearTimeout(x);}},[n,l,r]),l<=1)return null;let p=a?s?"":"docx-editor ":o,v=d?d("viewer.pageIndicator").replace(/\{current\}/g,String(f)).replace(/\{total\}/g,String(l)):c("viewer.pageIndicator",{current:f,total:l}),y=jsxRuntime.jsx("div",{className:`${p}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":g?"true":"false",role:"status","aria-live":"polite",children:v});return i?a?reactDom.createPortal(y,a):null:y}var I8=[],_8=e=>e.fontSubstitutions??I8;function Bs({className:e,style:t,t:o}){let n=B(_8),{t:r}=N(),i=o??r,[a,s]=Et.useState(null);if(n.length===0)return null;let l=n.join("\0");return a===l?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:i("editor.fontSubstitutionNotice",{fonts:n.join(", ")}).replace("{fonts}",n.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>s(l),children:i("common.dismiss")})]})}function Zp(e){return Math.round(e/1440*100)/100}function Dv(e){return Math.round(e*1440)}function F8(e,t){return e===t?true:!e||!t?false:e.editing===t.editing&&e.sectionIndex===t.sectionIndex&&e.variant===t.variant&&e.rId===t.rId&&e.partName===t.partName&&e.inherited===t.inherited&&e.titlePage===t.titlePage&&e.evenAndOddHeaders===t.evenAndOddHeaders&&e.headerDistanceTwips===t.headerDistanceTwips&&e.footerDistanceTwips===t.footerDistanceTwips}function qp(){let e=H(),t=Et.useCallback(o=>e?.getHeaderFooterState()??null,[e]);return B(t,F8)}function O8(e,t){return t==="first"?e==="header"?"headerFooter.firstPageHeader":"headerFooter.firstPageFooter":t==="even"?e==="header"?"headerFooter.evenPageHeader":"headerFooter.evenPageFooter":e==="header"?"headerFooter.header":"headerFooter.footer"}var B8=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Mi(e){let t=H();return Et.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function Z8(e){let{state:t,onMouseDown:o}=e,{t:n}=N(),r=H(),[i,a]=Et.useState(false),s=Et.useRef(null),[l,c]=Et.useState(""),[d,f]=Et.useState("");Et.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(c(String(Zp(t.headerDistanceTwips))),f(String(Zp(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),Et.useEffect(()=>{if(!i)return;let S=P=>{s.current?.contains(P.target)||a(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]);let u=Et.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=Et.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),m=Et.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),p=Et.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),v=Et.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),y=Mi(u),x=Mi(g),b=Mi(m),h=Mi(p),C=Mi(v),T=(S,P)=>{if(!r)return;let k=Number.parseFloat(P);Number.isFinite(k)&&r.exec({type:"setHeaderFooterOptions",[S]:Dv(k)});};return jsxRuntime.jsxs("div",{ref:s,className:"docx-hf-chrome__options",onMouseDown:o,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(S=>!S),onMouseDown:o,children:n("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:o,children:[B8.map(S=>{let P={type:"insertPageField",field:S.field},k=r?.can(P);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!k?.ok,title:k&&!k.ok?k.reason:void 0,onClick:()=>{r?.exec(P),a(false);},onMouseDown:o,children:n(S.labelKey)},S.field)}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.titlePage===true,disabled:!y.enabled,title:y.reason??void 0,onChange:()=>r?.exec(u)}),jsxRuntime.jsx("span",{children:n("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!x.enabled,title:x.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[n("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:n("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:o,children:n("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!b.enabled,title:b.reason??void 0,onClick:()=>r?.exec(m),onMouseDown:o,children:n("headerFooter.linkToPrevious")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.headerDistance"),value:l,onChange:S=>c(S.target.value),onBlur:()=>T("headerDistanceTwips",l)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.footerDistance"),value:d,onChange:S=>f(S.target.value),onBlur:()=>T("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>r?.exec(v),onMouseDown:o,children:t.editing==="header"?n("headerFooter.removeHeader"):n("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),a(false);},onMouseDown:o,children:n("common.close")})]}):null]})}function Zs({className:e}){let{t}=N(),o=qp(),n=Et.useCallback(s=>s.querySelector("[data-docx-hf-active]"),[]),r=ya(n,"story-label"),i=Z;if(!o?.editing)return null;let a=O8(o.editing,o.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:ct.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),o.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(Z8,{state:o,onMouseDown:i})]})}var z8={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},$8={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},U8={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},V8={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},G8={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},j8={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:"var(--doc-z-overlay)",backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},Y8={padding:"8px 12px"},X8={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},J8={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},Q8={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function eI({forwardedRef:e}){let t=H(),o=Et.useRef(null);return o.current=t,bh({ref:e,editorRef:o}),null}var tI=Et.forwardRef(function(t,o){let{document:n,fonts:r,fontShaping:i,className:a,t:s,chrome:l=true,title:c,onTitleChange:d,renderTitleBarLeft:f,renderTitleBarRight:u,loadingIndicator:g,colorMode:m="light",author:p,locale:v,mode:y="edit",modules:x,zoom:b,zoomMode:h,revisionMarkup:C,onRevisionMarkupChange:T,reviewDisplayMode:S,fieldResults:P,contentLockPolicy:k,lockedControlNavigation:w,onReady:E,onChange:D,onFontError:A,onOpen:_,onSave:F,hyperlinkPopup:M,contextMenu:I=true,menu:U=true,navigation:L=true,rulers:Y=true}=t;!l&&g!==void 0&&Gg();let[j,me]=Et.useState(vg);Et.useEffect(()=>{if(m==="system")return xg(me)},[m]);let z=yg(m,j),{t:ie}=N(),J=Et.useCallback((ve,de)=>s?s(ve,de):ie(ve,de),[s,ie]),W=jsxRuntime.jsxs(Zl,{className:l?z?"dark":void 0:a,style:l?$8:void 0,children:[l?jsxRuntime.jsx(Zs,{}):null,l?jsxRuntime.jsx(fl,{}):null,jsxRuntime.jsx(Ll,{}),Y&&l?jsxRuntime.jsx("div",{style:G8,children:jsxRuntime.jsx(ks,{})}):null,t.children]}),q=l?jsxRuntime.jsxs("div",{className:`docx-editor${z?" dark":""}${a?` ${a}`:""}`,style:z8,children:[jsxRuntime.jsxs("div",{style:j8,children:[jsxRuntime.jsxs("div",{style:X8,children:[f?.(),jsxRuntime.jsxs("div",{style:J8,children:[d?jsxRuntime.jsx("input",{"aria-label":J("titleBar.documentNameAriaLabel"),value:c??"",placeholder:J("titleBar.untitled"),onChange:ve=>d(ve.target.value),style:Q8}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??J("titleBar.untitled")}),U!==false?jsxRuntime.jsx(ci,{t:J,...c!==void 0?{fileName:c}:{},..._?{onOpen:_}:{},...F?{onSave:F}:{},...typeof U=="object"?U:{}}):null]}),u?.()]}),jsxRuntime.jsx("div",{style:Y8,children:jsxRuntime.jsx(ri,{t:J})})]}),Y?jsxRuntime.jsx("div",{style:V8,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(Rs,{})}):null,jsxRuntime.jsx(Bs,{t:J}),jsxRuntime.jsxs("div",{style:U8,children:[L===false?null:jsxRuntime.jsx(Hs,{t:J,...typeof L=="object"?L:{}}),W,jsxRuntime.jsx(As.Provider,{value:J,children:jsxRuntime.jsx(Os,{})}),jsxRuntime.jsx(Hl,{overlay:true,indicator:g})]})]}):W,fe=Et.useCallback(ve=>J(ve),[J]);return jsxRuntime.jsxs(Na,{popups:jf(t.popups,M,I,J),...n!==void 0?{document:n}:{},...r?{fonts:r}:{},...i?{fontShaping:i}:{},...p!==void 0?{author:p}:{},...v!==void 0?{locale:v}:{},translate:J,mode:y,...x!==void 0?{modules:x}:{},...b!==void 0?{zoom:b}:{},revisionMarkup:C,onRevisionMarkupChange:T,reviewDisplayMode:S,...P!==void 0?{fieldResults:P}:{},...k!==void 0?{contentLockPolicy:k}:{},...w!==void 0?{lockedControlNavigation:w}:{},...h!==void 0?{zoomMode:h}:{},tableInteractionLabel:fe,...E?{onReady:E}:{},...D?{onChange:D}:{},...A?{onFontError:A}:{},children:[jsxRuntime.jsx(eI,{forwardedRef:o}),jsxRuntime.jsx(vn.Provider,{value:l,children:q})]})}),oI=Et.forwardRef(function(t,o){return jsxRuntime.jsx(Un,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(tI,{...t,ref:o})})}),nI=Object.assign(oI,{Root:Na,Viewport:Zl,Content:Ll,Toolbar:ri,Menu:ci,Loading:Hl,ColorByChangeType:vu,RevisionMarkup:Nc,RevisionMarkupDialog:Ur,AuthorStyle:yu,HorizontalRuler:Rs,VerticalRuler:ks,DocumentOutline:_p,Navigation:Hs,ExportDialog:Vr,PrintDialog:Gr,PageSetupDialog:Sn,ParagraphDialog:xo,TextFormFieldDialog:Ma,PageNumber:Os,FontNotice:Bs,HeaderFooterChrome:Zs,NotesChrome:fl,Equation:oa,HyperLink:Jr,ContextMenu:Pd,ContentControlWidget:ru,InvalidTextFormFieldDialog:Hd,ImageAltTextPopup:Cl,ImagePropertiesDialog:Ca,NotePropertiesDialog:gl,NotePreview:jn,NotesContextMenu:Yn,ContentControl:ta});function sI(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Wp(e){return Array.isArray(e)?e:[e]}function cI(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function Fv(e){return e!==void 0&&Wp(e).some(t=>editor.isFontResolver(t))}async function dI(e){return typeof e!="function"?await e:await e()}function uI(e,t={}){let[o,n]=Et.useState(void 0),[r,i]=Et.useState(void 0),[a,s]=Et.useState(null),[l,c]=Et.useState(e!=null),d=Fv(t.fonts),f=t.fonts===void 0?"absent":d?"on-demand":"eager",[u,g]=Et.useState(t.fonts===void 0),m=Et.useRef(t);m.current=t;let p=Et.useMemo(()=>editor.defineFontResolver(v=>editor.composeFontOrigins(Wp(m.current.fonts??[]).map(cI),v)),[]);return Et.useEffect(()=>{let v=m.current.fonts;if(v===void 0){i(void 0),g(true);return}if(Fv(v)){g(true);return}g(false);let y=true;return (async()=>{try{let x=await Promise.allSettled(Wp(v).map(dI)),b=[];for(let h of x){if(h.status==="rejected"){console.warn("[fonts] font loading failed for one origin; the others still compose",h.reason);continue}h.value!==void 0&&b.push(h.value);}y&&b.length>0&&i(editor.composeFontConfiguration(b[0],...b.slice(1)));}catch(x){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",x);}finally{y&&g(true);}})(),()=>{y=false;}},[f]),Et.useEffect(()=>{if(e==null){n(void 0),s(null),c(false);return}let v=sI(e);if(v){n(v),s(null),c(false);return}let y=true,x=new AbortController;return c(true),s(null),(async()=>{try{let b=await fetch(String(e),{...m.current.fetchOptions,signal:x.signal});if(!b.ok)throw new Error(`could not open the document: ${b.status} ${b.statusText}`);let h=new Uint8Array(await b.arrayBuffer());if(!y)return;n(h),c(!1);}catch(b){if(!y||b instanceof Error&&b.name==="AbortError")return;s(b instanceof Error?b:new Error("could not open the document")),c(false);}})(),()=>{y=false,x.abort();}},[e]),{document:u?o:void 0,fonts:d?p:r,error:a,isLoading:l||!u}}function hI(...e){let t=Et.useRef(e);return t.current=e,Et.useMemo(()=>editor.defineFontResolver(o=>editor.composeFontOrigins(t.current,o)),[])}function yI(e){let o=e?.surface?.state?.().selection?.head;return o&&typeof o.paragraphId=="string"&&Number.isFinite(o.offset)?o:null}function xI(){let e=H(),t=Et.useRef(null),o=Et.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),n=Et.useCallback(()=>{let r=yI(e),i=t.current;return (r===null?i===null:i!==null&&CI(i,r))?i:(t.current=r,r)},[e]);return Et.useSyncExternalStore(o,n,()=>null)}function CI(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}var Zv=Object.freeze({applied:0,unavailable:0});function qv(e){if(!e)return "";let{color:t,activeColor:o,activeIndex:n,className:r,priority:i}=e;return JSON.stringify([t,o,n,r,i])}function EI(e,t,o){let n=H(),[r,i]=Et.useState(Zv),a=Et.useRef(null),s=Et.useRef(o);s.current=o;let l=Et.useRef(t);l.current=t;let c=qv(o);return Et.useEffect(()=>{if(!n){i(Zv);return}let d=editor.watchHighlights(n,e,l.current,{...s.current,onResult:i});return a.current={watch:d,source:l.current,key:qv(s.current)},i(d.result),()=>{d.stop(),a.current=null;}},[n,e]),Et.useEffect(()=>{let d=a.current;!d||d.source===t&&d.key===c||(d.source=t,d.key=c,d.watch.update(t,s.current??{}));},[t,c]),r}function RI(e,t){return e===t?true:!e||!t?false:e.name===t.name&&e.index===t.index&&e.range===t.range&&e.active===t.active&&e.rect.left===t.rect.left&&e.rect.top===t.rect.top&&e.rect.width===t.rect.width&&e.rect.height===t.rect.height}function kI(e){let t=H(),[o,n]=Et.useState(null);return Et.useEffect(()=>{if(!t){n(null);return}let r=globalThis.document,i=0,a=null,s=()=>{i=0;let u=a?t.getHighlightsAt(a.x,a.y).find(g=>e===void 0||g.name===e)??null:null;n(g=>RI(g,u)?g:u);},l=()=>{i===0&&(i=requestAnimationFrame(s));},c=u=>{let g=u.target;a=g instanceof Element&&g.closest("[data-page-index]")!==null?{x:u.clientX,y:u.clientY}:null,l();},d=u=>{u.relatedTarget||(a=null,l());};r.addEventListener("pointermove",c,{passive:true}),r.addEventListener("pointerout",d,{passive:true}),r.addEventListener("scroll",l,{passive:true,capture:true});let f=t.on("change",l);return ()=>{r.removeEventListener("pointermove",c),r.removeEventListener("pointerout",d),r.removeEventListener("scroll",l,{capture:true}),f(),i!==0&&cancelAnimationFrame(i);}},[t,e]),o}function $p({source:e,scale:t,measurer:o,onStateChange:n,onError:r,className:i,documentFontFamily:a,ref:s}){let l=Et.useRef(null),c=Et.useRef(null),[d,f]=Et.useState(null),u=Et.useRef(n);u.current=n;let g=Et.useRef(r);return g.current=r,Et.useEffect(()=>{let m=l.current;if(!m)return;let p=editor.mountPaginatedSurface(m,e,{...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onChange:y=>{f(y),u.current?.(y);}});if(!p.ok){g.current?.(p.reason,p.detail);return}c.current=p.surface;let v=p.surface.state();return f(v),u.current?.(v),()=>{p.surface.destroy(),c.current=null;}},[e,o]),Et.useImperativeHandle(s,()=>({focus:()=>c.current?.focus(),type:m=>c.current?.type(m),undo:()=>c.current?.undo(),redo:()=>c.current?.redo(),selectAll:()=>c.current?.selectAll(),navigate:(m,p)=>c.current?.navigate(m,p),toggleRunProperty:(m,p)=>c.current?.toggleRunProperty(m,p),setRunProperty:(m,p)=>c.current?.setRunProperty(m,p),setParagraphProperty:(m,p,v)=>c.current?.setParagraphProperty(m,p,v),formatting:()=>c.current?.formatting()??null,sectionProperties:()=>c.current?.sectionProperties()??null,save:()=>c.current?.save()??null}),[]),jsxRuntime.jsx("div",{ref:l,style:{margin:"24px auto",...a?{fontFamily:a}:{}},className:i?`docx-paginated-surface ${i}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var ki=Et.createContext(null);function Kv(){let e=Et.useContext(ki);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function OI(e){return "type"in e&&e.type==="separator"}var $v={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},BI={...$v,background:"var(--doc-bg-hover)"},Uv={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},ZI={...Uv,opacity:.4,cursor:"default"},qI={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},KI={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},WI={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function Di({label:e,items:t,disabled:o,showChevron:n=false}){let[r,i]=Et.useState(false),[a,s]=Et.useState(null),l=Et.useRef(null),c=Et.useRef(null),[d,f]=Et.useState({top:0,left:0}),u=Et.useCallback(()=>{i(false),s(null);},[]);Et.useEffect(()=>{if(!r||!l.current)return;let m=l.current.getBoundingClientRect();f({top:m.bottom+2,left:m.left});},[r]),Et.useEffect(()=>{if(!r)return;function m(y){let x=y.target;l.current&&!l.current.contains(x)&&c.current&&!c.current.contains(x)&&u();}function p(y){y.key==="Escape"&&u();}function v(){u();}return document.addEventListener("mousedown",m),document.addEventListener("keydown",p),window.addEventListener("scroll",v,true),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",p),window.removeEventListener("scroll",v,true);}},[r,u]);let g=m=>{m.disabled||m.submenuContent||m.onClick&&(m.onClick(),u());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",onClick:()=>!o&&i(!r),onMouseDown:m=>m.preventDefault(),disabled:o,style:r?BI:$v,children:[e,n&&jsxRuntime.jsx($,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:c,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:m=>m.preventDefault(),children:t.map((m,p)=>{if(OI(m))return jsxRuntime.jsx("div",{style:qI},`sep-${p}`);let v=m;if(v.customContent)return jsxRuntime.jsx("div",{onMouseDown:b=>b.preventDefault(),children:v.customContent},v.label);let y=!!v.submenuContent,x=a===v.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>y&&s(v.label),onMouseLeave:()=>y&&s(null),children:[jsxRuntime.jsxs("button",{type:"button",style:v.disabled?ZI:Uv,onClick:()=>g(v),onMouseDown:b=>b.preventDefault(),onMouseOver:b=>{v.disabled||(b.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:b=>{b.currentTarget.style.backgroundColor="transparent";},disabled:v.disabled,children:[v.icon&&jsxRuntime.jsx($,{name:v.icon,size:18}),jsxRuntime.jsx("span",{children:v.label}),v.shortcut&&jsxRuntime.jsx("span",{style:KI,children:v.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx($,{name:"keyboard_arrow_right",size:16})})]}),y&&x&&jsxRuntime.jsx("div",{style:WI,onMouseDown:b=>b.preventDefault(),children:v.submenuContent(u)})]},v.label)})})]})}var Gp=18,$I=2,Gv={width:Gp,height:Gp,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},UI={...Gv,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},VI={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function jv({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[n,r]=Et.useState(0),[i,a]=Et.useState(0),s=Et.useCallback(()=>{n>0&&i>0&&e(n,i);},[n,i,e]),l=[];for(let d=1;d<=t;d++)for(let f=1;f<=o;f++){let u=d<=n&&f<=i;l.push(jsxRuntime.jsx("div",{style:u?UI:Gv,onMouseEnter:()=>{r(d),a(f);},onClick:s,role:"gridcell","aria-selected":u},`${d}-${f}`));}let c=n>0&&i>0?`${i} \xD7 ${n}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:$I,gridTemplateColumns:`repeat(${o}, ${Gp}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:l}),jsxRuntime.jsx("div",{style:VI,children:c})]})}function XI({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(o=>{let n=!o.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:n,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:n?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:n?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{n||(o.onClick?.(),t());},onMouseOver:r=>{n||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx($,{name:o.icon,size:18}),jsxRuntime.jsx("span",{children:o.label})]},o.label)})})}function JI(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Ws({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function QI(e){return e.replace(/\.docx$/i,"")}function Yp({value:e,onChange:t,placeholder:o,editable:n=true}){let{t:r}=N(),i=o??r("titleBar.untitled"),a=QI(e)??"";return n?jsxRuntime.jsx("input",{type:"text",value:a,onChange:s=>{let l=s.target.value;t?.(l.endsWith(".docx")?l:l+".docx");},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function zs({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function $s(){let{t:e}=N(),t=Kv(),{disabled:o=false,onFormat:n,onPrint:r,onOpen:i,onSave:a,onPageSetup:s,onInsertImage:l,onInsertTable:c,showTableInsert:d=true,showHelpMenu:f=true,onInsertPageBreak:u,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:m,onInsertTOC:p,onWatermark:v,onRefocusEditor:y}=t,x=Et.useCallback(T=>{!o&&n&&n(T);},[o,n]),b=Et.useCallback((T,S)=>{!o&&c&&(c(T,S),requestAnimationFrame(()=>y?.()));},[o,c,y]),h=!!r||!!s,C=h||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[C&&jsxRuntime.jsx(Di,{label:e("toolbar.file"),disabled:o,items:[...i?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:i}]:[],...a?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:a}]:[],...(i||a)&&h?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...s?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:s}]:[]]}),jsxRuntime.jsx(Di,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>x("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>x("setRtl")}]}),jsxRuntime.jsx(Di,{label:e("toolbar.insert"),disabled:o,items:[...l?[{icon:"image",label:e("toolbar.image"),onClick:l}]:[],...d&&c?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:T=>jsxRuntime.jsx(jv,{onInsert:(S,P)=>{b(S,P),T();}})}]:[],...l||d&&c?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:T=>jsxRuntime.jsx(XI,{closeMenu:T,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:u},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:m}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:p,disabled:!p},...v?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:v}]:[]]}),f&&jsxRuntime.jsx(Di,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>ii()}]})]})}function Xp({children:e}){let t=null,o=null,n=[],r=[];Et.Children.forEach(e,a=>{Et.isValidElement(a)&&(a.type===Ws?t=a:a.type===zs?o=a:a.type===$s?r.push(a):n.push(a));});let i=Et.useCallback(a=>{let s=a.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(JI,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:n}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),o&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}var Us={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},n_={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},Yv={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function r_(e,t){let o=Yv[t]??Yv[t.toLowerCase()]??t,r=e?.colorScheme?.[o];return typeof r=="string"&&r?r:Us[o]??"000000"}function Xv(e){let t=e.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/.test(t))return t;if(/^[0-9A-F]{3}$/.test(t))return t.split("").map(o=>o+o).join("")}function Jp(e,t,o="000000"){if(!e||e.kind==="auto")return `#${o}`;if(e.kind==="hex")return `#${Xv(e.value)??o}`;let n=Object.entries(t?.colorScheme??Us).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,n);return `#${r.ok?r.hex:r_(t,e.slot)}`}function So(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?Xv(e.value):Jp(e,t).slice(1)}function Jv(e){if(!e||e==="none")return "";let t=n_[e];return t?`#${t}`:""}var a_=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],i_=[{type:"base",keep:1,labelSuffix:""},{type:"tint",keep:.2,labelSuffix:", Lighter 80%"},{type:"tint",keep:.4,labelSuffix:", Lighter 60%"},{type:"tint",keep:.6,labelSuffix:", Lighter 40%"},{type:"shade",keep:.75,labelSuffix:", Darker 25%"},{type:"shade",keep:.5,labelSuffix:", Darker 50%"}];function Qv(e){let t=e??Us;return i_.map(o=>a_.map(n=>{let r=t[n.slot]??Us[n.slot]??"000000",a={hex:o.type==="base"?r.toUpperCase():o.type==="tint"?editor.applyThemeTint(r,o.keep):editor.applyThemeShade(r,o.keep),themeSlot:n.slot,label:`${n.name}${o.labelSuffix}`};return o.type==="tint"?a.tint=o.keep:o.type==="shade"&&(a.shade=o.keep),a}))}function le(...e){return clsx.clsx(e)}var c_=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),Xe=Et__namespace.forwardRef(({className:e,variant:t,size:o,...n},r)=>jsxRuntime.jsx("button",{className:le(c_({variant:t,size:o,className:e})),ref:r,...n}));Xe.displayName="Button";function It({content:e,children:t,side:o="bottom",delayMs:n=400}){let[r,i]=Et__namespace.useState(false),[a,s]=Et__namespace.useState({x:0,y:0}),l=Et__namespace.useRef(null),c=Et__namespace.useRef(null),d=Et__namespace.useCallback(()=>{c.current=setTimeout(()=>{if(l.current){let m=l.current.getBoundingClientRect(),p=m.left+m.width/2,v=o==="top"?m.top-8:m.bottom+8;s({x:p,y:v});}i(true);},n);},[n,o]),f=Et__namespace.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),i(false);},[]);Et__namespace.useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]);let u=t.props,g=Et__namespace.cloneElement(t,{ref:l,onMouseEnter:m=>{d(),u.onMouseEnter?.(m);},onMouseLeave:m=>{f(),u.onMouseLeave?.(m);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:a.x,top:a.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var Go=we__namespace.Root,jo=we__namespace.Group,Vs=we__namespace.Value;function Yo({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(we__namespace.Trigger,{className:le("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[t,jsxRuntime.jsx(we__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(f_,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Xo({className:e,children:t,position:o="popper",onCloseAutoFocus:n,...r}){let i=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(we__namespace.Portal,{children:jsxRuntime.jsx("div",{className:le("docx-editor",i&&"dark"),children:jsxRuntime.jsx(we__namespace.Content,{className:le("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:a=>{a.preventDefault(),n?.(a);},...r,children:jsxRuntime.jsx(we__namespace.Viewport,{className:le("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:a=>a.preventDefault(),children:t})})})})}function Fn({className:e,...t}){return jsxRuntime.jsx(we__namespace.Label,{className:le("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function _t({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(we__namespace.Item,{className:le("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[jsxRuntime.jsx(we__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(we__namespace.ItemIndicator,{children:jsxRuntime.jsx(g_,{className:"h-4 w-4"})})})]})}function Hn({className:e,...t}){return jsxRuntime.jsx(we__namespace.Separator,{className:le("-mx-1 my-1 h-px bg-muted",e),...t})}function f_({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function g_({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function Qp(e){let t=e.trim();if(!t)return "";let o=null,n="";for(let r of t){if((r==='"'||r==="'")&&o===null){o=r,n+=r;continue}if(r===o){o=null,n+=r;continue}if(r===","&&o===null)break;n+=r;}return n.trim().replace(/^['"]|['"]$/g,"")}var h_=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function oy({value:e,onChange:t,fonts:o=h_,documentFonts:n,disabled:r=false,className:i,placeholder:a="Arial",width:s=120,showPreview:l=true}){let{t:c}=N(),d=Et__namespace.useMemo(()=>{if(!n)return [];let p=new Set(o.map(v=>v.name.toLowerCase()));return n.filter(v=>!p.has(v.name.toLowerCase()))},[n,o]),f=Et__namespace.useMemo(()=>[...d,...o],[d,o]),u=Et__namespace.useMemo(()=>e?f.find(v=>v.fontFamily===e||v.name.toLowerCase()===e.toLowerCase()||Qp(v.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,f,a]),g=Et__namespace.useCallback(p=>{let v=f.find(y=>y.name===p);v&&t?.(Qp(v.fontFamily)||v.name);},[t,f]),m=Et__namespace.useMemo(()=>{let p={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(v=>{let y=v.category||"other";p[y].push(v);}),p},[o]);return jsxRuntime.jsxs(Go,{value:u,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(Yo,{className:le("h-8 text-sm",i),style:{minWidth:typeof s=="number"?`${s}px`:s},"aria-label":c("font.selectAriaLabel"),children:jsxRuntime.jsx(Vs,{placeholder:a,children:u})}),jsxRuntime.jsxs(Xo,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.documentFonts")}),d.map(p=>jsxRuntime.jsx(_t,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},`doc-${p.name}`))]}),jsxRuntime.jsx(Hn,{})]}),m["sans-serif"].length>0&&jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.sansSerif")}),m["sans-serif"].map(p=>jsxRuntime.jsx(_t,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]}),m.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.serif")}),m.serif.map(p=>jsxRuntime.jsx(_t,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),m.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsxs(jo,{children:[jsxRuntime.jsx(Fn,{children:c("font.monospace")}),m.monospace.map(p=>jsxRuntime.jsx(_t,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))]})]}),m.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(jo,{children:m.other.map(p=>jsxRuntime.jsx(_t,{value:p.name,style:l?{fontFamily:p.fontFamily}:void 0,children:p.name},p.name))})]})]})]})}function em(e){if(e===void 0)return;let t=e.map(o=>typeof o=="string"?{name:o,fontFamily:o,category:"other"}:o);if(mt()){let o=new Set,n=new Set;for(let r of t)n.has(r.name)&&!o.has(r.name)&&(console.warn(`[DocxEditor] Duplicate font name in fontFamilies: "${r.name}"`),o.add(r.name)),n.add(r.name);}return t}function y_(e,t,o,n){let i=Math.max(8,window.innerWidth-o-8),a=Math.max(8,window.innerHeight-n-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function vt({isOpen:e,onClose:t,align:o="left"}){let n=Et.useRef(null),r=Et.useRef(null),[i,a]=Et.useState({top:0,left:0});Et.useEffect(()=>{if(!e||!n.current)return;let c=n.current.getBoundingClientRect();o==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),f=y_(c.bottom+4,c.right-d.width,d.width,d.height);a(f);}else a({top:c.bottom+4,left:c.left});}):a({top:c.bottom+4,left:c.left});},[e,o]),Et.useEffect(()=>{if(!e)return;let c=performance.now()+150,d=g=>{let m=g.target;n.current&&!n.current.contains(m)&&r.current&&!r.current.contains(m)&&t();},f=g=>{g.key==="Escape"&&t();},u=g=>{if(performance.now()<c)return;let m=g.target;m&&r.current&&r.current.contains(m)||m instanceof Element&&m!==document.documentElement&&m!==document.body&&n.current&&m.contains(n.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),window.addEventListener("scroll",u,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f),window.removeEventListener("scroll",u,true);}},[e,t]);let s=Et.useCallback(c=>{c.preventDefault(),c.stopPropagation();},[]),l={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:n,dropdownRef:r,dropdownStyle:l,handleMouseDown:s}}var T_=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],P_=1,S_=400;function ay(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function iy(e,t,o){for(let n=t.length-1;n>=0;n--)if(t[n]<e)return t[n];return Math.max(e-1,o)}function ly({value:e,onChange:t,sizes:o=T_,disabled:n=false,className:r,placeholder:i="11",minSize:a=P_,maxSize:s=S_}){let{t:l}=N(),[c,d]=Et.useState(false),[f,u]=Et.useState(""),[g,m]=Et.useState(false),p=Et.useRef(null),v=Et.useCallback(()=>{m(false),d(false);},[]),{containerRef:y,dropdownRef:x,dropdownStyle:b}=vt({isOpen:g,onClose:v}),h=e??(parseInt(i,10)||11),C=e!==void 0?e.toString():i,T=Et.useCallback(_=>{if(_.preventDefault(),n)return;let F=iy(h,o,a);t?.(F);},[h,o,a,n,t]),S=Et.useCallback(_=>{if(_.preventDefault(),n)return;let F=ay(h,o,s);t?.(F);},[h,o,s,n,t]),P=Et.useCallback(_=>{_.preventDefault(),!n&&(d(true),u(C),m(true),requestAnimationFrame(()=>{p.current?.focus(),p.current?.select();}));},[n,C]),k=Et.useCallback(_=>{u(_.target.value);},[]),w=Et.useCallback(()=>{d(false);let _=parseFloat(f);if(!isNaN(_)&&_>=a&&_<=s){let F=Math.round(_*2)/2;t?.(F);}},[f,a,s,t]),E=Et.useCallback(_=>{if(_.key==="Enter")_.preventDefault(),w(),m(false);else if(_.key==="Escape")d(false),m(false);else if(_.key==="ArrowUp"){_.preventDefault();let F=ay(h,o,s);u(F.toString()),t?.(F);}else if(_.key==="ArrowDown"){_.preventDefault();let F=iy(h,o,a);u(F.toString()),t?.(F);}},[w,h,o,s,a,t]),D=Et.useCallback(_=>{t?.(_),m(false),d(false);},[t]),A=Et.useCallback(_=>{_.target.tagName!=="INPUT"&&_.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:y,className:le("flex items-center",r),onMouseDown:A,children:[jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:le("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:T,disabled:n||h<=a,"aria-label":l("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx($,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:c?jsxRuntime.jsx("input",{ref:p,type:"text",value:f,onChange:k,onBlur:w,onKeyDown:E,className:le("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":l("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:P,className:le("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",n&&"opacity-50 cursor-not-allowed"),disabled:n,"aria-label":l("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:C})}),g&&jsxRuntime.jsx("div",{ref:x,style:{...b,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":l("fontSize.listLabel"),children:o.map(_=>jsxRuntime.jsx("button",{type:"button",onClick:()=>D(_),className:le("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",_===h&&"bg-muted font-medium"),role:"option","aria-selected":_===h,children:_},_))}),jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:le("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:S,disabled:n||h>=s,"aria-label":l("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx($,{name:"add",size:18})})]})}var M_=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],js=18,R_=2,k_={position:"relative",display:"inline-block"},D_={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)"},I_={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},nm={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},rm={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},dy={display:"grid",gap:`${R_}px`},Ys={width:`${js}px`,height:`${js}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},uy={...Ys,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},py={...Ys,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},__={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},N_={display:"flex",alignItems:"center",gap:"6px"},L_={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},F_={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},sy={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},H_={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},A_={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},O_={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function am(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let n=Jv(e);return n||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Jp(e,o)}function cy(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (o*299+n*587+r*114)/1e3>230}function my(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():So(e,o))===t.toUpperCase():false}function B_({matrix:e,selectedColor:t,theme:o,onSelect:n}){let[r,i]=Et.useState(null);return jsxRuntime.jsx("div",{style:{...dy,gridTemplateColumns:`repeat(10, ${js}px)`},children:e.flatMap((a,s)=>a.map((l,c)=>{let d=`${s}-${c}`,f=r===d,u=my(t,l.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...u?py:f?uy:Ys,backgroundColor:`#${l.hex}`},title:l.label,"aria-label":l.label,"aria-selected":u,onClick:()=>n(l),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function Z_({selectedColor:e,theme:t,onSelect:o}){let[n,r]=Et.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...dy,gridTemplateColumns:`repeat(10, ${js}px)`},children:M_.map((a,s)=>{let l=n===s,c=my(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...c?py:l?uy:Ys,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":c,onClick:()=>o(a.hex),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>r(s),onMouseLeave:()=>r(null)},a.hex)})})}function Bn({mode:e,value:t,onChange:o,theme:n,disabled:r=false,className:i,style:a,title:s,icon:l,autoLabel:c,splitButton:d=true,defaultColor:f}){let[u,g]=Et.useState(false),[m,p]=Et.useState(false),[v,y]=Et.useState(false),[x,b]=Et.useState(false),[h,C]=Et.useState(""),[T,S]=Et.useState(()=>f??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:P}=N();Et.useEffect(()=>{let W=am(t,e,n).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(W)&&C(W.toUpperCase());},[t,e,n]);let k=Et.useCallback(()=>g(false),[]),{containerRef:w,dropdownRef:E,dropdownStyle:D}=vt({isOpen:u,onClose:k}),A=n?.colorScheme??null,_=Et.useMemo(()=>Qv(A),[A]),F=Et.useMemo(()=>am(t,e,n),[t,e,n]),M=Et.useMemo(()=>am(T,e,n),[T,e,n]),I=Et.useCallback(()=>{r||g(W=>!W);},[r]),U=Et.useCallback(W=>{let q;e==="highlight"?q=W.hex:q={kind:"theme",slot:W.themeSlot,...W.tint!==void 0?{tint:W.tint}:{},...W.shade!==void 0?{shade:W.shade}:{}},S(q),o?.(q),g(false);},[e,o]),L=Et.useCallback(W=>{let q=e==="highlight"?W:{kind:"hex",value:W};S(q),o?.(q),g(false);},[e,o]),Y=Et.useCallback(()=>{o?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,o]),j=Et.useCallback(()=>{let W=h.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(W)){let q=e==="highlight"?W:{kind:"hex",value:W};S(q),o?.(q),g(false),C("");}},[e,h,o]),me=Et.useCallback(()=>{r||o?.(T);},[r,T,o]),z={...D_,...r?{cursor:"default",opacity:.38}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:m?{backgroundColor:"var(--doc-bg-hover)"}:{}},ie=P(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),J=l??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:w,className:`docx-color-picker ${i||""}`,style:{...k_,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...H_,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...A_,...r?{cursor:"default"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:me,onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:r,title:s||ie,"aria-label":s||ie,children:[jsxRuntime.jsx($,{name:J,size:18}),jsxRuntime.jsx("div",{style:{...sy,backgroundColor:M==="transparent"?"#fff":M,outline:M==="transparent"||cy(M)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...O_,...r?{cursor:"default"}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:x?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:I,onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),disabled:r,title:s||ie,"aria-label":s||ie,"aria-haspopup":"true","aria-expanded":u,children:jsxRuntime.jsx($,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:z,onClick:I,onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),disabled:r,title:s||ie,"aria-label":s||ie,"aria-haspopup":"true","aria-expanded":u,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx($,{name:J,size:18}),jsxRuntime.jsx("div",{style:{...sy,backgroundColor:F==="transparent"?"#fff":F,outline:F==="transparent"||cy(F)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx($,{name:"arrow_drop_down",size:14})]}),u&&jsxRuntime.jsx("div",{ref:E,className:"docx-color-picker-dropdown",style:{...D,...I_},role:"dialog","aria-label":`${ie} picker`,onMouseDown:W=>{W.target.tagName!=="INPUT"&&W.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:__,onClick:Y,onMouseDown:W=>W.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),c??P(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:P("colorPicker.themeColors")}),jsxRuntime.jsx(B_,{matrix:_,selectedColor:t,theme:n,onSelect:U}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:P("colorPicker.standardColors")}),jsxRuntime.jsx(Z_,{selectedColor:t,theme:n,onSelect:L}),jsxRuntime.jsx("div",{style:rm}),jsxRuntime.jsx("div",{style:nm,children:P("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:N_,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:L_,value:h,onChange:W=>C(W.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:W=>{W.key==="Enter"&&j();},onMouseDown:W=>{W.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...F_,opacity:/^[0-9A-Fa-f]{6}$/.test(h)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(h)?"pointer":"default"},onClick:j,onMouseDown:W=>W.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(h),children:P("common.apply")})]})]})})]})}var _i=20,im=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx($,{name:"format_align_left",size:_i}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx($,{name:"format_align_center",size:_i}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx($,{name:"format_align_right",size:_i}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx($,{name:"format_align_justify",size:_i}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function hy({value:e="left",onChange:t,disabled:o=false}){let{t:n}=N(),[r,i]=Et.useState(false),a=Et.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:l,dropdownStyle:c,handleMouseDown:d}=vt({isOpen:r,onClose:a}),f=Et.useCallback(y=>{o||t?.(y),i(false);},[o,t]),u=im.find(y=>y.value===e)||im[0],g=n(u.labelKey),m=u.shortcutKey?n(u.shortcutKey):void 0,p=`${g}${m?` (${m})`:""}`,v=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:le("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",o&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!o&&i(y=>!y),disabled:o,"aria-label":p,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx($,{name:u.iconName,size:_i}),jsxRuntime.jsx($,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?v:jsxRuntime.jsx(It,{content:p,children:v}),r&&!o&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:y=>y.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:im.map(y=>{let x=e===y.value,b=n(y.labelKey),h=y.shortcutKey?n(y.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${b}${h?` (${h})`:""}`,"data-testid":`alignment-${y.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:x?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:x?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{x||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=x?"var(--doc-primary-light)":"transparent";},onClick:()=>f(y.value),children:jsxRuntime.jsx($,{name:y.iconName,size:18})},y.value)})})})]})}function Xs(){return {type:"none",level:0,isInList:false}}var $_={display:"inline-flex",alignItems:"center",gap:"4px"},by={display:"inline-flex",alignItems:"center",gap:"4px"},tc={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},U_={...tc,backgroundColor:"var(--doc-bg-hover)"},V_={...tc,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},G_={...tc,cursor:"default",opacity:.38},j_={width:"28px",height:"28px",padding:"2px"},Y_={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Js=20;function Qs({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,style:a}){let[s,l]=Et.useState(false),c={...t?G_:e?V_:s?U_:tc,...a},d=f=>{f.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:t?void 0:n,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:r})}function vy({listState:e,onBulletList:t,onNumberedList:o,onIndent:n,onOutdent:r,disabled:i=false,className:a,style:s,showIndentButtons:l=true,compact:c=false,hasIndent:d=false}){let{t:f}=N(),u=Et.useCallback(()=>c?{...j_}:{},[c]),g=e?.type==="bullet",m=e?.type==="numbered",v=(e?.isInList||g||m)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...$_,...s},role:"group","aria-label":f("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:by,role:"group","aria-label":f("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Qs,{active:g,disabled:i,title:f("lists.bulletList"),onClick:t,style:u(),children:jsxRuntime.jsx($,{name:"format_list_bulleted",size:Js})}),jsxRuntime.jsx(Qs,{active:m,disabled:i,title:f("lists.numberedList"),onClick:o,style:u(),children:jsxRuntime.jsx($,{name:"format_list_numbered",size:Js})})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Y_,role:"separator"}),jsxRuntime.jsxs("div",{style:by,role:"group","aria-label":f("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Qs,{active:false,disabled:i||!v,title:f("lists.decreaseIndent"),onClick:r,style:u(),children:jsxRuntime.jsx($,{name:"format_indent_decrease",size:Js})}),jsxRuntime.jsx(Qs,{active:false,disabled:i,title:f("lists.increaseIndent"),onClick:n,style:u(),children:jsxRuntime.jsx($,{name:"format_indent_increase",size:Js})})]})]})]})}var J_=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function xy({value:e,onChange:t,options:o=J_,disabled:n=false,className:r}){let{t:i}=N(),a=Et__namespace.useMemo(()=>e===void 0?o[0]:o.find(c=>c.twipsValue===e)||o[0],[e,o]),s=Et__namespace.useCallback(c=>{let d=parseInt(c,10);isNaN(d)||t?.(d);},[t]),l=c=>c.labelKey?i(c.labelKey):c.label;return jsxRuntime.jsxs(Go,{value:a.twipsValue.toString(),onValueChange:s,disabled:n,children:[jsxRuntime.jsx(Yo,{className:le("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:l(a)}),children:jsxRuntime.jsx(Dp,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Xo,{children:[o.map(c=>jsxRuntime.jsx(_t,{value:c.twipsValue.toString(),children:l(c)},c.twipsValue)),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(jo,{children:jsxRuntime.jsx(Fn,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var Cy=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function Ty({value:e,onChange:t,styles:o,disabled:n=false,className:r,width:i=120}){let{t:a}=N(),s=Et__namespace.useMemo(()=>{let g=k0(o);return g.length===0?Cy:g.map(m=>({...m,type:"paragraph",nameKey:Cy.find(p=>p.styleId===m.styleId)?.nameKey}))},[o]),l=Et__namespace.useCallback(g=>{t?.(g);},[t]),c=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",f=s.find(g=>g.styleId===d),u=f?c(f):d;return jsxRuntime.jsxs(Go,{value:d,onValueChange:l,disabled:n,children:[jsxRuntime.jsx(Yo,{className:le("h-8 text-sm",r),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":a("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:u})}),jsxRuntime.jsx(Xo,{className:"min-w-[260px] max-h-[400px]",children:s.map(g=>jsxRuntime.jsx(_t,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:R0(g),children:c(g)})},g.styleId))})]})}var e5=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function Sy({value:e=1,onChange:t,levels:o=e5,disabled:n=false,className:r,compact:i=false}){let{t:a}=N(),s=Et__namespace.useMemo(()=>{let g=o.find(m=>Math.abs(m.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[o,e]),l=Et__namespace.useCallback(g=>{let m=parseFloat(g);isNaN(m)||t?.(m);},[t]),c=Et__namespace.useMemo(()=>[...o].sort((g,m)=>g.value-m.value),[o]),d=Et__namespace.useMemo(()=>[...c].reverse().find(g=>g.value<e-.001),[c,e]),f=Et__namespace.useMemo(()=>c.find(g=>g.value>e+.001),[c,e]),u=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:le(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(n||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:n||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx($,{name:"remove",size:18})}),jsxRuntime.jsxs(Go,{value:e.toString(),onValueChange:l,disabled:n,children:[jsxRuntime.jsx(Yo,{className:le(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":a("zoom.ariaLabel",{label:s}),children:jsxRuntime.jsx(Vs,{placeholder:"100%",children:s})}),jsxRuntime.jsx(Xo,{children:o.map(g=>jsxRuntime.jsx(_t,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:le(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(n||!f)&&"opacity-30 cursor-not-allowed"),onClick:()=>f&&t?.(f.value),disabled:n||!f,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx($,{name:"add",size:18})})]})}var o5=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function My({onAction:e,disabled:t=false}){let{t:o}=N(),[n,r]=Et.useState(false),i=Et.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:s,dropdownStyle:l,handleMouseDown:c}=vt({isOpen:n,onClose:i}),d=Et.useCallback(u=>{e(u),r(false);},[e]),f=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:le("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&r(u=>!u),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx($,{name:"border_all",size:20}),jsxRuntime.jsx($,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?f:jsxRuntime.jsx(It,{content:o("table.borders.tooltip"),children:f}),n&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:u=>u.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:o5.map(({action:u,icon:g,labelKey:m})=>jsxRuntime.jsx("button",{type:"button",title:o(m),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:p=>p.preventDefault(),onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:jsxRuntime.jsx($,{name:g,size:18})},typeof u=="string"?u:u.type))})})]})}function Ry({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Et.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let s=a.kind==="auto"?"000000":So(a,o);s&&e({type:"borderColor",color:s});},[e,o]);return jsxRuntime.jsx(Bn,{mode:"border",value:n,onChange:i,theme:o,disabled:t,title:r("table.borderColor")})}var i5=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function Dy({onAction:e,disabled:t=false}){let[o,n]=Et.useState(false),{t:r}=N(),i=Et.useCallback(()=>n(false),[]),{containerRef:a,dropdownRef:s,dropdownStyle:l,handleMouseDown:c}=vt({isOpen:o,onClose:i}),d=Et.useCallback(u=>{e({type:"borderWidth",size:u}),n(false);},[e]),f=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:le("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&n(u=>!u),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx($,{name:"line_weight",size:20}),jsxRuntime.jsx($,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?f:jsxRuntime.jsx(It,{content:r("table.borderWidth"),children:f}),o&&!t&&jsxRuntime.jsx("div",{ref:s,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:u=>u.stopPropagation(),children:i5.map(({size:u,label:g,thickness:m})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:p=>p.preventDefault(),onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(m,1),backgroundColor:"#000",borderRadius:m>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},u))})]})}function _y({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Et.useCallback(a=>{typeof a=="string"&&e(a==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:a.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(Bn,{mode:"highlight",value:n,onChange:i,theme:o,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var s5={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Kn={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Fy={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Hy({onAction:e,disabled:t=false,tableContext:o}){let{t:n}=N(),[r,i]=Et.useState(false),[a,s]=Et.useState(null),l=Et.useCallback(()=>i(false),[]),{containerRef:c,dropdownRef:d,dropdownStyle:f,handleMouseDown:u}=vt({isOpen:r,onClose:l,align:"right"}),g=o?.table?.attrs?.justification??"left",m=Et.useCallback(y=>{e(y),i(false);},[e]),p=(y,x,b,h,C)=>{let T=t||C?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...s5,backgroundColor:a===y&&!T?"var(--doc-bg-hover)":"transparent",color:T?"var(--doc-text-muted)":C?.danger?"var(--doc-error)":"var(--doc-text)",cursor:T?"not-allowed":"pointer"},onClick:()=>!T&&m(h),onMouseEnter:()=>s(y),onMouseLeave:()=>s(null),disabled:T,children:[jsxRuntime.jsx($,{name:x,size:16,className:C?.danger&&!T?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:b})]},y)},v=jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:le("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!t&&i(y=>!y),disabled:t,"aria-label":n("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx($,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[r?v:jsxRuntime.jsx(It,{content:n("table.moreOptions"),children:v}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...f,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:y=>y.stopPropagation(),children:[p("addRowAbove","add",n("table.insertRowAbove"),"addRowAbove"),p("addRowBelow","add",n("table.insertRowBelow"),"addRowBelow"),p("addColumnLeft","add",n("table.insertColumnLeft"),"addColumnLeft"),p("addColumnRight","add",n("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("mergeCells","call_merge",n("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),p("splitCell","call_split",n("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("selectTable","select_all",n("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("deleteRow","delete",n("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),p("deleteColumn","delete",n("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),p("deleteTable","delete",n("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),jsxRuntime.jsx("div",{style:Fy,children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let x={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:n({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:h=>h.preventDefault(),onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},onClick:()=>m({type:"cellVerticalAlign",align:y}),children:jsxRuntime.jsx($,{name:x[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),jsxRuntime.jsx("div",{style:Fy,children:n("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let x={left:"format_align_left",center:"format_align_center",right:"format_align_right"},b=g===y;return jsxRuntime.jsx("button",{type:"button",title:n({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:b?"var(--doc-primary-light)":"transparent",borderColor:b?"var(--doc-primary)":"var(--doc-border)",color:b?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:h=>h.preventDefault(),onClick:()=>m({type:"tableProperties",props:{justification:y}}),children:jsxRuntime.jsx($,{name:x[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("headerRow","table_rows",n("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),p("distribute","view_column",n("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),p("autoFit","fit_width",n("tableAdvanced.autoFit"),{type:"autoFitContents"}),p("noWrap","wrap_text",n("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Kn,role:"separator"}),p("properties","settings",n("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var d5=20;function rc({options:e,activeValue:t,triggerIcon:o,tooltipContent:n,onSelect:r,disabled:i=false,ariaLabel:a,testId:s,showLabels:l=false}){let[c,d]=Et.useState(false),f=Et.useCallback(()=>d(false),[]),{containerRef:u,dropdownRef:g,dropdownStyle:m,handleMouseDown:p}=vt({isOpen:c,onClose:f}),v=Et.useCallback(x=>{i||r(x),d(false);},[i,r]),y=jsxRuntime.jsxs(Xe,{variant:"ghost",size:"icon-sm",className:le("text-muted-foreground hover:text-foreground hover:bg-muted/80",c&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!i&&d(x=>!x),disabled:i,"aria-label":a??n,"aria-expanded":c,"aria-haspopup":"true","data-testid":s,children:[jsxRuntime.jsx($,{name:o,size:d5}),jsxRuntime.jsx($,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:u,style:{position:"relative",display:"inline-block"},children:[c?y:jsxRuntime.jsx(It,{content:n,children:y}),c&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...m,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:x=>x.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:l?1:2,minWidth:l?200:void 0},children:e.map(x=>{let b=t===x.value;return jsxRuntime.jsxs("button",{type:"button",title:x.label,"data-testid":s?`${s}-${x.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:b?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:b?"var(--doc-primary)":"var(--doc-text)",...l?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:h=>h.preventDefault(),onMouseEnter:h=>{b||(h.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:h=>{h.currentTarget.style.backgroundColor=b?"var(--doc-primary-light)":"transparent";},onClick:()=>v(x.value),children:[jsxRuntime.jsx($,{name:x.iconName,size:18}),l&&jsxRuntime.jsx("span",{style:{flex:1},children:x.label})]},x.value)})})})]})}var u5=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function p5(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Oy({imageContext:e,onChange:t,disabled:o=false}){let{t:n}=N(),r=u5.map(s=>({...s,label:n(s.labelKey)})),i=p5(e),a=r.find(s=>s.value===i)||r[0];return jsxRuntime.jsx(rc,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var f5=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function By({onTransform:e,disabled:t=false}){let{t:o}=N(),n=f5.map(r=>({...r,label:o(r.labelKey)}));return jsxRuntime.jsx(rc,{options:n,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var Vt=18;function Nt({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,ariaLabel:a}){let s=a?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),l=d=>{d.preventDefault();},c=jsxRuntime.jsx(Xe,{variant:"ghost",size:"icon-sm",className:le("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:l,onClick:t?void 0:n,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||o,"data-testid":s?`toolbar-${s}`:void 0,children:r});return o?jsxRuntime.jsx(It,{content:o,children:c}):c}function Gt({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:le("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function y5(e){let t=Et__namespace.default.useContext(ki);return t?{...t,...x5(e)}:e}function x5(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function dm(e){let{t}=N(),o=y5(e),{currentFormatting:n={},onFormat:r,onUndo:i,onRedo:a,canUndo:s=false,canRedo:l=false,disabled:c=false,className:d,style:f,enableShortcuts:u=true,editorRef:g,children:m,showFontPicker:p=true,fontFamilies:v,documentFonts:y,showFontSizePicker:x=true,showTextColorPicker:b=true,showHighlightColorPicker:h=true,showAlignmentButtons:C=true,showListButtons:T=true,showLineSpacingPicker:S=true,showStylePicker:P=true,documentStyles:k,theme:w,showZoomControl:E=true,zoom:D,onZoomChange:A,onRefocusEditor:_,imageContext:F,onImageWrapType:M,onImageTransform:I,onOpenImageProperties:U,tableContext:L,onTableAction:Y,inline:j=false}=o,me=Et.useRef(null),z=Et.useCallback(ne=>{!c&&r&&r(ne);},[c,r]),ie=Et.useCallback(()=>{!c&&s&&i&&i();},[c,s,i]),J=Et.useCallback(()=>{!c&&l&&a&&a();},[c,l,a]),W=Et.useCallback(ne=>{!c&&r&&r({type:"fontFamily",value:ne});},[c,r]),q=Et__namespace.default.useMemo(()=>em(v),[v]),fe=Et.useCallback(ne=>{!c&&r&&r({type:"fontSize",value:ne});},[c,r]),ve=Et.useCallback(ne=>{!c&&r&&r({type:"textColor",value:ne});},[c,r]),de=Et.useCallback(ne=>{!c&&r&&r({type:"highlightColor",value:typeof ne=="string"?ne:""});},[c,r]),ze=Et.useCallback(ne=>{!c&&r&&r({type:"alignment",value:ne});},[c,r]),Lt=Et.useCallback(()=>{!c&&r&&r("bulletList");},[c,r]),Je=Et.useCallback(()=>{!c&&r&&r("numberedList");},[c,r]),ut=Et.useCallback(()=>{!c&&r&&r("indent");},[c,r]),Se=Et.useCallback(()=>{!c&&r&&r("outdent");},[c,r]),uo=Et.useCallback(ne=>{!c&&r&&(r({type:"lineSpacing",value:ne}),requestAnimationFrame(()=>_?.()));},[c,r,_]),po=Et.useCallback(ne=>{!c&&r&&r({type:"applyStyle",value:ne});},[c,r]),mo=Et.useCallback(ne=>{!c&&Y&&(Y(ne),requestAnimationFrame(()=>_?.()));},[c,Y,_]);Et.useEffect(()=>{if(!u)return;let ne=ge=>{if(ge.defaultPrevented)return;let xt=ge.target,zn=g?.current,re=me.current,oe=zn?.contains(xt),ye=re?.contains(xt);if(!oe&&!ye)return;if((ge.ctrlKey||ge.metaKey)&&!ge.altKey)switch(ge.key.toLowerCase()){case "b":ge.preventDefault(),z("bold");break;case "i":ge.preventDefault(),z("italic");break;case "u":ge.preventDefault(),z("underline");break;case "=":ge.shiftKey?(ge.preventDefault(),z("superscript")):(ge.preventDefault(),z("subscript"));break;case "l":ge.preventDefault(),ze("left");break;case "e":ge.preventDefault(),ze("center");break;case "r":ge.preventDefault(),ze("right");break;case "j":ge.preventDefault(),ze("both");break;case "k":ge.preventDefault(),z("insertLink");break}};return document.addEventListener("keydown",ne),()=>{document.removeEventListener("keydown",ne);}},[u,z,ze,g]);let Mo=Et.useCallback(ne=>{let ge=ne.target;ge.tagName==="INPUT"||ge.tagName==="TEXTAREA"||ge.tagName==="SELECT"||ge.tagName==="OPTION"||ne.preventDefault();},[]),Yt=Et.useCallback(ne=>{let ge=ne.target,xt=document.activeElement;ge.tagName==="SELECT"||ge.tagName==="OPTION"||xt?.tagName==="SELECT"||requestAnimationFrame(()=>{_?.();});},[_]);return jsxRuntime.jsxs("div",{ref:me,className:le(!j&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:j?{display:"contents",...f}:f,role:j?void 0:"toolbar","aria-label":j?void 0:t("toolbar.ariaLabel"),"data-testid":j?void 0:"formatting-bar",onMouseDown:j?void 0:Mo,onMouseUp:j?void 0:Yt,children:[jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(Nt,{onClick:ie,disabled:c||!s,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx($,{name:"undo",size:Vt})}),jsxRuntime.jsx(Nt,{onClick:J,disabled:c||!l,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx($,{name:"redo",size:Vt})})]}),E&&jsxRuntime.jsx(Gt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(Sy,{value:D,onChange:A,disabled:c,compact:true})}),P&&jsxRuntime.jsx(Gt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(Ty,{value:n.styleId||"Normal",onChange:po,styles:k,theme:w,disabled:c,width:120})}),(p||x)&&jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.font"),children:[p&&jsxRuntime.jsx(oy,{value:n.fontFamily||"Arial",onChange:W,fonts:q,documentFonts:y,disabled:c,width:60,placeholder:"Arial"}),x&&jsxRuntime.jsx(ly,{value:n.fontSize!==void 0?hu(n.fontSize):11,onChange:fe,disabled:c,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(Nt,{onClick:()=>z("bold"),active:n.bold,disabled:c,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx($,{name:"format_bold",size:Vt})}),jsxRuntime.jsx(Nt,{onClick:()=>z("italic"),active:n.italic,disabled:c,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx($,{name:"format_italic",size:Vt})}),jsxRuntime.jsx(Nt,{onClick:()=>z("underline"),active:n.underline,disabled:c,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx($,{name:"format_underlined",size:Vt})}),jsxRuntime.jsx(Nt,{onClick:()=>z("strikethrough"),active:n.strike,disabled:c,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx($,{name:"strikethrough_s",size:Vt})}),b&&jsxRuntime.jsx(Bn,{mode:"text",value:n.color?.replace(/^#/,""),onChange:ve,theme:w,disabled:c,title:t("formattingBar.fontColor")}),h&&jsxRuntime.jsx(Bn,{mode:"highlight",value:n.highlight,onChange:de,theme:w,disabled:c,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(Nt,{onClick:()=>z("insertLink"),disabled:c,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx($,{name:"link",size:Vt})})]}),jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(Nt,{onClick:()=>z("superscript"),active:n.superscript,disabled:c,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx($,{name:"superscript",size:Vt})}),jsxRuntime.jsx(Nt,{onClick:()=>z("subscript"),active:n.subscript,disabled:c,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx($,{name:"subscript",size:Vt})})]}),C&&jsxRuntime.jsx(Gt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(hy,{value:n.alignment||"left",onChange:ze,disabled:c})}),(T||S)&&jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.listFormatting"),children:[T&&jsxRuntime.jsx(vy,{listState:n.listState||Xs(),onBulletList:Lt,onNumberedList:Je,onIndent:ut,onOutdent:Se,disabled:c,showIndentButtons:true,compact:true,hasIndent:(n.indentLeft??0)>0}),S&&jsxRuntime.jsx(xy,{value:n.lineSpacing,onChange:uo,disabled:c})]}),F&&M&&jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Oy,{imageContext:F,onChange:M,disabled:c}),I&&jsxRuntime.jsx(By,{onTransform:I,disabled:c}),U&&jsxRuntime.jsx(Nt,{onClick:U,disabled:c,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx($,{name:"tune",size:Vt})})]}),L?.isInTable&&Y&&jsxRuntime.jsxs(Gt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(My,{onAction:mo,disabled:c}),jsxRuntime.jsx(Ry,{onAction:mo,disabled:c,theme:w,value:So(L?.cellBorderColor,w)}),jsxRuntime.jsx(Dy,{onAction:mo,disabled:c}),jsxRuntime.jsx(_y,{onAction:mo,disabled:c,theme:w,value:L?.cellBackgroundColor}),jsxRuntime.jsx(Hy,{onAction:mo,disabled:c,tableContext:L})]}),jsxRuntime.jsx(Nt,{onClick:()=>z("clearFormatting"),disabled:c,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx($,{name:"format_clear",size:Vt})}),m]})}function C5({children:e,className:t,style:o,...n}){return jsxRuntime.jsx(ki.Provider,{value:n,children:jsxRuntime.jsx("div",{className:le("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:ct.toolbar,...o},"data-testid":"editor-toolbar",children:e})})}var yt=C5;yt.TitleBar=Xp;yt.Logo=Ws;yt.DocumentName=Yp;yt.MenuBar=$s;yt.TitleBarRight=zs;yt.Toolbar=dm;var S5=new Map([["#ffff00","yellow"],["#00ff00","green"],["#00ffff","cyan"],["#ff00ff","magenta"],["#0000ff","blue"],["#ff0000","red"],["#000080","darkBlue"],["#008080","darkCyan"],["#008000","darkGreen"],["#800080","darkMagenta"],["#800000","darkRed"],["#808000","darkYellow"],["#808080","darkGray"],["#c0c0c0","lightGray"],["#ffffff","white"]]),E5=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function w5({source:e,scale:t,measurer:o,documentName:n,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:s,renderTitleBarRight:l,ref:c,colorMode:d,onZoomChange:f,documentFontFamily:u,className:g}){let m=Et.useRef(null),[p,v]=Et.useState(null),[y,x]=Et.useState({}),[b,h]=Et.useState(null),C=Et.useCallback(k=>{v(k);let w=m.current?.formatting();w&&x({bold:w.bold,italic:w.italic,underline:w.underline,strike:w.strikethrough,superscript:w.superscript,subscript:w.subscript,...w.fontFamily?{fontFamily:w.fontFamily}:{},...w.fontSizeHalfPoints?{fontSize:w.fontSizeHalfPoints}:{},...w.alignment?{alignment:w.alignment}:{},...w.styleId?{styleId:w.styleId}:{},...w.color?{color:`#${w.color}`}:{},...w.highlight?{highlight:w.highlight}:{}}),h(m.current?.sectionProperties()??null),r?.(k);},[r]),T=Et.useCallback(k=>{let w=m.current;if(w){if(typeof k=="string")switch(k){case "bold":return w.toggleRunProperty("b");case "italic":return w.toggleRunProperty("i");case "underline":return w.toggleRunProperty("u",{val:"single"});case "strikethrough":return w.toggleRunProperty("strike");case "superscript":return w.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return w.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":w.setRunProperty("b",{val:"0"}),w.setRunProperty("i",{val:"0"}),w.setRunProperty("u",{val:"none"}),w.setRunProperty("strike",{val:"0"}),w.setRunProperty("vertAlign",{val:"baseline"});return;case "setRtl":case "setLtr":return w.setParagraphProperty("bidi",void 0,{paragraphDirection:k==="setRtl"?"rtl":"ltr"});default:return}switch(k.type){case "fontFamily":return w.setRunProperty("rFonts",{ascii:k.value,hAnsi:k.value});case "fontSize":return w.setRunProperty("sz",{val:String(Math.round(k.value*2))});case "textColor":{let E=k.value,D=typeof E=="string"?E5(E):So(E,null)??null;return D?w.setRunProperty("color",{val:D}):void 0}case "highlightColor":{let E=k.value.trim().toLowerCase();if(E==="none"||E==="")return w.setRunProperty("highlight",{val:"none"});let D=S5.get(E.startsWith("#")?E:`#${E}`);return D?w.setRunProperty("highlight",{val:D}):void 0}case "alignment":return w.setParagraphProperty("jc",{val:String(k.value)},{physicalAlignment:true});case "lineSpacing":return w.setParagraphProperty("spacing",{line:String(Math.round(k.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return w.setParagraphProperty("pStyle",{val:k.value});default:return}}},[]);Et.useImperativeHandle(c,()=>m.current,[]);let S=t===void 0?1:t/(96/72),P=b?{pageWidthTwips:b.pageSize.widthTwips,pageHeightTwips:b.pageSize.heightTwips,orientation:b.landscape?"landscape":"portrait",marginsTwips:{top:b.margins.topTwips,right:b.margins.rightTwips,bottom:b.margins.bottomTwips,left:b.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",g??""].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:"var(--doc-bg)",color:"var(--doc-text)"},"data-testid":"paginated-shell",children:[jsxRuntime.jsxs(yt,{currentFormatting:y,onFormat:T,onUndo:()=>m.current?.undo(),onRedo:()=>m.current?.redo(),canUndo:p?.canUndo??false,canRedo:p?.canRedo??false,zoom:S,onZoomChange:f,onSave:()=>{let k=m.current?.save();k&&a?.(k);},children:[jsxRuntime.jsxs(yt.TitleBar,{children:[s&&jsxRuntime.jsx(yt.Logo,{children:s()}),jsxRuntime.jsx(yt.DocumentName,{value:n??"Document",editable:false}),l&&jsxRuntime.jsx(yt.TitleBarRight,{children:l()}),jsxRuntime.jsx(yt.MenuBar,{})]}),jsxRuntime.jsx(yt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[P?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Dn,{pageSetup:P,zoom:S})}):null,jsxRuntime.jsx($p,{ref:m,source:e,...u?{documentFontFamily:u}:{},...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onStateChange:C,...i?{onError:i}:{}})]})]})}var ic=class{listeners=new Set;snapshot;constructor(t){this.snapshot=t;}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t);});getSnapshot=()=>this.snapshot;setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var lc=class extends ic{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,o){return this.addNotification(t,"error",o)}showWarning(t,o){return this.addNotification(t,"warning",o)}showInfo(t,o){return this.addNotification(t,"info",o)}dismiss(t){this.notifications=this.notifications.map(n=>n.id===t?{...n,dismissed:true}:n),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(n=>n.id!==t),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,o,n){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:o,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let a=setTimeout(()=>{this.timers.delete(a),this.dismiss(r);},5e3);this.timers.add(a);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var _5=Et.createContext(null);function zy({children:e}){let t=Et.useMemo(()=>new lc,[]),o=Et.useSyncExternalStore(t.subscribe,t.getSnapshot),n=Et.useCallback((c,d)=>{t.showError(c,d);},[t]),r=Et.useCallback((c,d)=>{t.showWarning(c,d);},[t]),i=Et.useCallback((c,d)=>{t.showInfo(c,d);},[t]),a=Et.useCallback(c=>{t.dismiss(c);},[t]),s=Et.useCallback(()=>{t.clearAll();},[t]),l=Et.useMemo(()=>({notifications:o.notifications,showError:n,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:s}),[o.notifications,n,r,i,a,s]);return jsxRuntime.jsxs(_5.Provider,{value:l,children:[e,jsxRuntime.jsx(N5,{notifications:o.notifications,onDismiss:a})]})}function N5({notifications:e,onDismiss:t}){let o=e.filter(r=>!r.dismissed);return o.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:o.map(r=>jsxRuntime.jsx(L5,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function L5({notification:e,onDismiss:t}){let{t:o}=N(),[n,r]=Et.useState(false),a=(p=>{switch(p){case "error":return {bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case "info":return {bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(e.severity),s={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"docx-notification-slide-in 0.3s ease-out"},l={display:"flex",alignItems:"flex-start",gap:"8px"},c={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},f={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},u={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},m=p=>{switch(p){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsx("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:s,children:jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("span",{style:c,children:m(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:f,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!n),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:o(n?"errors.hideDetails":"errors.showDetails")}),n&&jsxRuntime.jsx("div",{style:u,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:o("common.dismiss"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})})}var sc=class extends Et.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",t,o),this.props.onError&&this.props.onError(t,o);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:o=true}=this.props,{error:n,errorInfo:r}=this.state;return t?typeof t=="function"?t(n,this.resetError):t:jsxRuntime.jsx(F5,{error:n,errorInfo:r,showDetails:o,onReset:this.resetError})}return this.props.children}};function F5({error:e,errorInfo:t,showDetails:o,onReset:n}){let{t:r}=N(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},a={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},l={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},c={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:i,children:[jsxRuntime.jsx("div",{style:a,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:s,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:l,children:r("errors.errorDescription")}),o&&jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
|
|
1
|
+
'use strict';var Lt=require('react'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),editor=require('@docx-editor.dev/core/editor'),store=require('@docx-editor.dev/core/store'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),Le=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Lt__namespace=/*#__PURE__*/_interopNamespace(Lt);var Le__namespace=/*#__PURE__*/_interopNamespace(Le);var wf={version:"2.31.0"};var bT=wf.version;var Yc=Lt.createContext(i18n.en),Xc=Lt.createContext("en");function dr({i18n:e,children:t}){let o=Lt.useContext(Yc),n=Lt.useContext(Xc),r=typeof e?._lang=="string"?e._lang:n,i=Lt.useMemo(()=>i18n.deepMerge(o,e),[o,e]);return jsxRuntime.jsx(Xc.Provider,{value:r,children:jsxRuntime.jsx(Yc.Provider,{value:i,children:t})})}function N(){let e=Lt.useContext(Yc),t=Lt.useContext(Xc);return {t:Lt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e,lang:t}}function _f(e){let{t}=N();return Lt.useCallback((o,n)=>e?.get(o)??t(o,n),[e,t])}var Jc=Lt.createContext(null);function H(){return Lt.useContext(Jc)}function il(e){return (e?.mounted??0)+(e?.gutters??0)>0}var Rt=Lt.createContext(null);var Qc=0,ed=false,td=false,ll=[],sl=null;function Nf(e){if(typeof MessageChannel!="function"){globalThis.setTimeout(e,0);return}sl||(sl=new MessageChannel,sl.port1.onmessage=()=>{let t=ll;ll=[];for(let o of t)try{o();}catch(n){queueMicrotask(()=>{throw n});}}),ll.push(e),ll.length===1&&sl.port2.postMessage(null);}function Lf(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(ed||(ed=true,Qc+=1,queueMicrotask(()=>{ed=false;}),td||(td=true,Nf(()=>{td=false,Qc=0;}))),Qc>16)}function Ff(e){let t=false;return ()=>{if(t)return;t=true;let o=()=>{t=false,e();};Lf()?Nf(o):queueMicrotask(o);}}var ST=()=>{},nd=0;function kT(){return nd}function ba(e){return Ff(e)}function W(e,t=Object.is,o){let n=H(),r=o?.onSubscribe,i=o?.onUnsubscribe,a=Lt.useCallback(d=>{if(!n)return ST;let f=false;nd++,r?.();let u=ba(()=>{f||d();}),g=[n.on("change",u),n.on("selectionChange",u),n.on("error",u)];return ()=>{f=true,nd--,i?.();for(let p of g)p();}},[n,r,i]),l=Lt.useMemo(()=>{let d=false,f,u;return g=>{if(d&&g===f)return u;let p=e(g);return d&&t(u,p)?(f=g,u):(d=true,f=g,u=p,p)}},[n,e,t]),s=Lt.useCallback(()=>l(n?n.snapshot():editor.LOADING_SNAPSHOT),[n,l]),c=Lt.useCallback(()=>l(editor.LOADING_SNAPSHOT),[l]);return Lt.useSyncExternalStore(a,s,c)}function MT(e,t){return typeof t!="function"?e:typeof e!="function"?t:o=>{e(o),o.defaultPrevented||t(o);}}function _T(e,t){let o={...e,...t};for(let n of Object.keys(e))/^on[A-Z]/.test(n)?o[n]=MT(t[n],e[n]):n==="className"?o[n]=[e[n],t[n]].filter(Boolean).join(" "):n==="style"&&(o[n]={...e[n],...t[n]});return o}function Y({children:e,...t}){let o=Lt.Children.only(e);if(!Lt.isValidElement(o))return null;let n=o.props,r=_T(t,n),i=o.ref,a=t.ref;return (i||a)&&(r.ref=l=>{for(let s of [i,a])typeof s=="function"?s(l):s&&typeof s=="object"&&(s.current=l);}),Lt.cloneElement(o,r)}var Of=e=>{let t=e["data-docx-part"];return typeof t=="string"?t==="field"?`field:${e["data-docx-field"]}`:t:null};function At(){let e=Lt.createContext(null),t=new Map,o=h=>{let v=t.get(h.type);return v==="field"?`field:${h.props.name}`:v};function n(h,v){Lt.Children.forEach(h,y=>{Lt.isValidElement(y)&&(v(y),n(y.props.children,v));});}function r(){let h=Lt.useContext(e);if(!h)throw new globalThis.Error("Dialog controls must be rendered inside their dialog.");return h.state}function i(h,v){return Lt.Children.map(h,y=>{if(!Lt.isValidElement(y))return y;let C=Of(y.props);return C&&v.has(C)?v.get(C):y.props.children===void 0?y:Lt.cloneElement(y,{children:i(y.props.children,v)})})}function a(h){function v(y){let C=Lt.useContext(e);if(!C||y.hidden)return null;let T=h==="field"?`field:${y.name}`:h,x=C.defaults.get(T);if(!x)return y.children??null;let{children:E,asChild:P,className:D,style:w,hidden:S,name:L,...I}=y,F={...I,...x.props,className:[x.props.className,D].filter(Boolean).join(" "),style:{...x.props.style,...w}};if(P){let{children:O,className:k,style:_,...U}=F;return jsxRuntime.jsx(Y,{...U,...D?{className:D}:{},...w?{style:w}:{},children:E})}return Lt.cloneElement(x,F,E===void 0?i(x.props.children,C.overrides):E)}return t.set(v,h),v}let l=a("header"),s=a("title"),c=a("body"),d=a("footer"),f=a("apply"),u=a("cancel"),g=a("reset"),p=a("error"),m=a("field");function b({defaults:h,children:v,preset:y=true,state:C}){let T=new Map;n(h,D=>{let w=Of(D.props);w&&T.set(w,D);});let x=new Map;n(v,D=>{let w=o(D);w&&x.set(w,D);});let E=D=>Lt.Children.toArray(D).flatMap(w=>Lt.isValidElement(w)&&w.type===Lt.Fragment?E(w.props.children):[w]),P=E(v).filter(D=>!Lt.isValidElement(D)||!o(D));return jsxRuntime.jsx(e.Provider,{value:{defaults:T,overrides:x,state:C},children:y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i(h,x),P]}):v})}return {Header:l,Title:s,Body:c,Footer:d,Apply:f,Cancel:u,Reset:g,Error:p,Field:m,Composition:b,useState:r,part:h=>a(h)}}function ze({kind:e,role:t="dialog",className:o,style:n,label:r,onClose:i,onKeyDown:a,panelRef:l,children:s,dismissOutside:c=true,sessionSignal:d,restoreFocus:f=true,describedBy:u}){let g=Lt.useRef(null),p=l??g,m=Lt.useRef(i);m.current=i;let[b,h]=Lt.useState(false);return Lt.useLayoutEffect(()=>{let v=p.current;if(!v)return;h(!v.parentElement?.closest(".docx-editor"));let y=v.ownerDocument.activeElement,C=()=>{v.open&&v.close?.();};return d?.addEventListener("abort",C),typeof v.showModal=="function"?v.showModal():v.setAttribute("open",""),(v.querySelector('input:not([disabled]),select:not([disabled]),button:not([disabled]),[tabindex="0"]')??v.querySelector("a[href]"))?.focus({preventScroll:true}),()=>{d?.removeEventListener("abort",C),typeof v.close=="function"&&v.open&&v.close(),f&&y?.isConnected&&y.focus({preventScroll:true});}},[p,d,f]),jsxRuntime.jsx("dialog",{ref:p,role:t,"aria-modal":"true","aria-label":r,"aria-describedby":u,className:`docx-dialog${b?" docx-editor":""}${o?` ${o}`:""}`,style:n,"data-docx-dialog":e,onCancel:v=>{v.preventDefault(),m.current();},onMouseDown:v=>v.stopPropagation(),onClick:v=>{if(c&&v.target===v.currentTarget){let y=v.currentTarget.getBoundingClientRect();(v.clientX<y.left||v.clientX>y.right||v.clientY<y.top||v.clientY>y.bottom)&&m.current();}v.stopPropagation();},onKeyDown:v=>{v.key==="Escape"&&!v.nativeEvent.isComposing?(v.preventDefault(),m.current()):editor.trapTabWithin(v.currentTarget,v.nativeEvent)?v.preventDefault():!v.nativeEvent.isComposing&&!v.defaultPrevented&&a?.(v),v.stopPropagation();},children:s})}function Vo(e,t){let o=H(),n=ld(),r=Lt.useRef(null);return Lt.useEffect(()=>{if(!e){r.current=null;return}o?.surface&&(r.current===null?r.current=o.mountGeneration:r.current!==o.mountGeneration&&t());},[e,o,n,t]),()=>!!o?.surface&&r.current===o.mountGeneration}function ld(){let e=H(),t=Lt.useCallback(o=>{if(!e)return ()=>{};let n=true,r=ba(()=>{n&&o();}),i=[e.on("change",r),e.on("selectionChange",r),e.on("error",r)];return ()=>{n=false,i.forEach(a=>a());}},[e]);return Lt.useSyncExternalStore(t,()=>e?.mountGeneration??0,()=>0)}function Bf(){let e=0,t=0,o=null,n=new Set,r=new Set,i=new Set,a=l=>{for(let s of [...l])s();};return {getShift:()=>e,setShift(l){let s=Math.max(0,Math.round(l));s!==e&&(e=s,a(n));},subscribeShift(l){return n.add(l),()=>n.delete(l)},getReservation:()=>t,setReservation(l){let s=Math.max(0,Math.round(l));s!==t&&(t=s,a(r));},subscribeReservation(l){return r.add(l),()=>r.delete(l)},getViewport:()=>o,setViewport(l){l!==o&&(o=l,a(i));},subscribeViewport(l){return i.add(l),()=>i.delete(l)}}}var cd=Lt.createContext(null);function Pn(){return Lt.useContext(cd)}var Wf=()=>0,dd=()=>()=>{};function Sn(){let e=Pn(),t=Lt.useCallback(n=>e?e.subscribeShift(n):dd(),[e]),o=Lt.useCallback(()=>e?e.getShift():0,[e]);return Lt.useSyncExternalStore(t,o,Wf)}function Zf(){let e=Pn(),t=Lt.useCallback(n=>e?e.subscribeReservation(n):dd(),[e]),o=Lt.useCallback(()=>e?e.getReservation():0,[e]);return Lt.useSyncExternalStore(t,o,Wf)}function Pe(){let e=Pn(),t=Lt.useCallback(r=>e?e.subscribeViewport(r):dd(),[e]),o=Lt.useCallback(()=>e?e.getViewport():null,[e]),n=Lt.useCallback(()=>null,[]);return Lt.useSyncExternalStore(t,o,n)}function Ro(e,t,o){let n=Pe(),r=Lt.useRef({close:o,viewport:n});r.current={close:o,viewport:n},Lt.useEffect(()=>{let i=e.current;if(!(!t||!i))return YT(i,()=>r.current.close(),()=>r.current.viewport)},[e,t]);}function YT(e,t,o){let n=l=>{if(l.defaultPrevented||l.altKey||l.ctrlKey||l.metaKey)return;let s=l.target;if(s.matches('input[role="combobox"]')||s.matches("input, textarea, select")&&l.key!=="ArrowDown"&&l.key!=="ArrowUp")return;let d=Array.from(e.querySelectorAll('[role="option"]')).filter(g=>!g.matches(':disabled, [aria-disabled="true"]'));if(d.length===0)return;let f=d.indexOf(s),u;if(l.key==="Home")u=0;else if(l.key==="End")u=d.length-1;else if(l.key==="ArrowDown")u=(f+1)%d.length;else if(l.key==="ArrowUp")u=f<0?d.length-1:(f-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),d[u]?.focus();},r=l=>{editor.isDomNode(l.relatedTarget)&&!e.contains(l.relatedTarget)&&t();},i=editor.listenForPopupEscape({popup:e,contains:l=>e.contains(l),chromeRoot:()=>e.closest(".docx-editor"),editorElements:()=>[o()],skip:l=>editor.isElementNode(l.target)&&e.contains(l.target)&&l.target.matches('input[role="combobox"]'),close:l=>{l&&e.querySelector("[aria-haspopup]")?.focus(),t();}}),a=editor.listenForPopupFocusLeave({popup:e,contains:l=>e.contains(l),close:t});return e.addEventListener("keydown",n),e.addEventListener("focusout",r),()=>{e.removeEventListener("keydown",n),e.removeEventListener("focusout",r),i(),a();}}function nE(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function ud(e){return typeof e=="string"}function ce(e){let t=H(),{t:o}=N(),n=ud(e)?e:editor.editorCommandKey(e),r=Lt.useRef(e);r.current=e;let i=Lt.useCallback(s=>{let c=r.current;if(ud(c)){let f=editor.toolbarCommandState(t,c);return {active:f.active,enabled:f.enabled,disabledReason:i18n.localizeDisabledReason(f.disabledReason,o),value:f.value??null}}if(!t)return {active:false,enabled:false,disabledReason:null,value:null};let d=t.can(c);return {active:t.isActive(c),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,o),value:null}},[t,n,o]),a=W(i,nE),l=Lt.useCallback(s=>{let c=editor.commandExecOptions(s),d=r.current;return ud(d)?editor.runToolbarCommand(t,d,void 0,c??{}).ok:t?t.exec(d,c).ok:false},[t]);return Lt.useMemo(()=>({execute:l,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason,value:a.value}),[l,a])}var kn=Lt.createContext({t:void 0,onSave:void 0});function aE(){return Lt.useContext(kn)}function dl(e){let{t}=N();return o=>e?.(o)??t(o)}function te(){let{t:e}=Lt.useContext(kn);return dl(e)}var cE=()=>()=>{},dE=()=>true,uE=()=>false;function Mo(){let e=Lt.useSyncExternalStore(cE,dE,uE);return Lt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function pE(e){let t=e.viteEnv?.DEV;return typeof t=="boolean"?t:e.hasProcess&&e.nodeEnv!=="production"}function mE(){try{return undefined}catch{return}}function mt(){let e=typeof process<"u";return pE({viteEnv:mE(),nodeEnv:e?"production":void 0,hasProcess:e})}var $f=new Set;function Go(e){!mt()||$f.has(e)||($f.add(e),console.warn(`[docx-editor] ${e}`));}function Uf(e){Go(`Menu.Item and ContextMenu.Slot take the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Vf(e){Go(`A hidden context-menu override names "${e}", but no packaged row has that id, so nothing is removed.`);}function Gf(){Go("A Menu.Item or ContextMenu.Slot has no slotId, so it renders nothing.");}function jf(){Go("A Menu.Submenu has neither label nor labelKey, so its row has no name.");}function Yf(e){Go(`Toolbar.Button takes the slot id as slotId. slot="${e}" still works in this release; write slotId="${e}".`);}function Xf(){Go("A Toolbar.Button has no slotId, so it renders nothing.");}function ee(e){for(let t of editor.CHROME_GROUPS)for(let o of t.controls)if(editor.chromeSlotId(t,o)===e)return o;return null}function oe(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function q(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function bE(e){if(e.slotId)return e.slotId;if(e.slot)return Yf(e.slot),e.slot;Xf();}function wn(e){let{icon:t,asChild:o,className:n,children:r,hidden:i}=e,a=bE(e)??"",{execute:l,isActive:s,isEnabled:c,disabledReason:d,value:f}=ce(a),u=te(),g=Mo();if(i||!a)return null;let p=ee(a),m=g(u(p?.labelKey??a)),b=editor.chromeSlotIsToggle(a),h={onClick:()=>l(),onMouseDown:q,disabled:!c,"data-slot":a,className:`docx-toolbar__button${n?` ${n}`:""}`,...s?{"data-active":""}:{},...c?{}:{"data-disabled":""},...b?{"aria-pressed":s}:{},...f!==null?{"data-value":f}:{},"aria-label":m,title:d??m};return o?jsxRuntime.jsx(Y,{...h,children:r}):jsxRuntime.jsx("button",{type:"button",...h,children:t??r??oe(p?.paths)})}wn.docxToolbarPart=true;var SE=[{value:"C00000",labelKey:"colorPicker.colors.darkRed",css:"#c00000"},{value:"FF0000",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"FFC000",labelKey:"colorPicker.colors.orange",css:"#ffc000"},{value:"FFFF00",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"92D050",labelKey:"colorPicker.colors.lightGreen",css:"#92d050"},{value:"00B050",labelKey:"colorPicker.colors.green",css:"#00b050"},{value:"00B0F0",labelKey:"colorPicker.colors.lightBlue",css:"#00b0f0"},{value:"0070C0",labelKey:"colorPicker.colors.blue",css:"#0070c0"},{value:"002060",labelKey:"colorPicker.colors.darkBlue",css:"#002060"},{value:"7030A0",labelKey:"colorPicker.colors.purple",css:"#7030a0"}],Jf=[{value:"yellow",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"green",labelKey:"colorPicker.colors.brightGreen",css:"#00ff00"},{value:"cyan",labelKey:"colorPicker.colors.cyan",css:"#00ffff"},{value:"magenta",labelKey:"colorPicker.colors.magenta",css:"#ff00ff"},{value:"blue",labelKey:"colorPicker.colors.blue",css:"#0000ff"},{value:"red",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"darkBlue",labelKey:"colorPicker.colors.darkBlue",css:"#000080"},{value:"darkCyan",labelKey:"colorPicker.colors.darkCyan",css:"#008080"},{value:"darkGreen",labelKey:"colorPicker.colors.darkGreen",css:"#008000"},{value:"darkMagenta",labelKey:"colorPicker.colors.darkMagenta",css:"#800080"},{value:"darkRed",labelKey:"colorPicker.colors.darkRed",css:"#800000"},{value:"darkYellow",labelKey:"colorPicker.colors.darkYellow",css:"#808000"},{value:"darkGray",labelKey:"colorPicker.colors.darkGray",css:"#808080"},{value:"lightGray",labelKey:"colorPicker.colors.lightGray",css:"#c0c0c0"},{value:"black",labelKey:"colorPicker.colors.black",css:"#000000"},{value:"white",labelKey:"colorPicker.colors.white",css:"#ffffff"}],Qf=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],pl=["colorPicker.theme.background1","colorPicker.theme.text1","colorPicker.theme.background2","colorPicker.theme.text2","colorPicker.theme.accent1","colorPicker.theme.accent2","colorPicker.theme.accent3","colorPicker.theme.accent4","colorPicker.theme.accent5","colorPicker.theme.accent6"],jo=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Ot=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function kE(e){let t=[0,2,4].map(n=>parseInt(e.slice(n,n+2),16)),o=(Math.max(...t)+Math.min(...t))/2/255;return o===1?[Ot(5),Ot(15),Ot(25),Ot(35),Ot(50)]:o===0?[jo(50),jo(35),jo(25),jo(15),jo(5)]:o>=.8?[Ot(10),Ot(25),Ot(50),Ot(75),Ot(90)]:[jo(80),jo(60),jo(40),Ot(25),Ot(50)]}var wE=/^[0-9A-Fa-f]{6}$/;function DE(e,t){let o="";for(let n=0;n<6;n+=2){let r=Math.round(t(parseInt(e.slice(n,n+2),16)));o+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return o.toUpperCase()}function RE(e){let t=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16);return .299*t+.587*o+.114*n>230}function pr({value:e,css:t,title:o,selected:n,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":o,"aria-pressed":n,title:o,"data-value":e,...n?{"data-selected":""}:{},...t.startsWith("var(")||RE(t.replace("#",""))?{"data-light":""}:{},onMouseDown:q,onClick:()=>r(e)})}function ME({apply:e,label:t,current:o,themeHexes:n}){let r=n.map(kE),i=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[n.map((a,l)=>jsxRuntime.jsx(pr,{value:a,css:`#${a.toLowerCase()}`,title:t(pl[l]),selected:o===a,apply:e},`base-${l}`)),i.map(a=>n.map((l,s)=>{let c=r[s][a],d=DE(l,c.apply);return jsxRuntime.jsx(pr,{value:d,css:`#${d.toLowerCase()}`,title:`${t(pl[s])}, ${t(c.labelKey)}`,selected:o===d,apply:e},`${a}-${s}`)}))]})]})}function _E(e){let{apply:t,label:o,current:n}=e,[r,i]=Lt.useState(""),a=wE.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ME,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:SE.map(l=>jsxRuntime.jsx(pr,{value:l.value,css:l.css,title:o(l.labelKey),selected:n===l.value,apply:t},l.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:o("colorPicker.customColor")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-custom",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-hash","aria-hidden":"true",children:"#"}),jsxRuntime.jsx("input",{type:"text",className:"docx-toolbar__swatch-hex",value:r,maxLength:6,spellCheck:false,"aria-label":o("colorPicker.customColor"),onChange:l=>i(l.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:l=>{l.key==="Enter"&&a&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!a,onMouseDown:q,onClick:()=>t(r.toUpperCase()),children:o("colorPicker.apply")})]})]})]})}function md({apply:e,current:t}){let o=H(),n=te(),r=o?.getDocumentThemeColors()??[],i=r.length===pl.length?r.map(l=>l.hex):Qf,a=t?.toUpperCase()??null;return jsxRuntime.jsx(_E,{apply:e,label:n,current:a,themeHexes:i})}var IE=Jf.filter(e=>e.value!=="white");function NE({apply:e,label:t,current:o}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.highlightColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--highlight",role:"group",children:IE.map(n=>jsxRuntime.jsx(pr,{value:n.value,css:n.css,title:t(n.labelKey),selected:o===n.value,apply:e},n.value))})]})}function eg(e){let{slot:t,defaultValue:o,cssOf:n,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:s,hidden:c,icon:d})=>{let f=H(),{isEnabled:u,disabledReason:g}=ce(t),p=te(),[m,b]=Lt.useState(false),[h,v]=Lt.useState(o),y=Lt.useRef(null);Ro(y,m,()=>b(false));let C=W(w=>{if(a){let S=w.formatting?.color;return S&&S.kind==="hex"?S.value.toUpperCase():null}return w.formatting?.highlight??null}),T=f?.getDocumentThemeColors()??[],x=T.length===pl.length?T.map(w=>w.hex):Qf;Lt.useEffect(()=>{if(!m)return;let w=L=>{let I=y.current;I&&editor.isDomNode(L.target)&&I.contains(L.target)||b(false);},S=editor.hostDocumentOf(y.current);return S.addEventListener("mousedown",w),()=>S.removeEventListener("mousedown",w)},[m]);let E=Lt.useCallback(w=>{if(b(false),!f)return;f.focus();let S=editor.commandForSlotValue(t,w);S&&f.can(S).ok&&(f.exec(S),w!==r.value&&v(w));},[f]),P=Lt.useMemo(()=>ee(t),[]);if(c)return null;let D=p(P?.labelKey??t);return jsxRuntime.jsxs("div",{ref:y,className:`docx-toolbar__colorsplit${s?` ${s}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!u,...u?{}:{"data-disabled":""},"aria-label":D,title:g??D,onMouseDown:q,onClick:()=>E(h),children:[d??oe(P?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:n(h)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!u,...u?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":m,"aria-label":D,title:g??D,onMouseDown:q,onClick:()=>b(w=>!w),children:"\u25BE"}),m?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":D,onMouseDown:q,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:q,onClick:()=>E(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),p(r.labelKey)]}),i({apply:E,label:p,current:C,themeHexes:x})]}):null]})},{docxSlot:t})}var LE=new Map(Jf.map(e=>[e.value,e.css])),fd=eg({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(md,{apply:e.apply,current:e.current})}),gd=eg({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>LE.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(NE,{...e})});var bd=e=>e==="auto"?"currentColor":e==="byAuthor"?"var(--doc-review-author-0)":e==="none"?"transparent":`var(--doc-revision-color-${e})`;function fl({label:e,value:t,values:o,disabled:n,change:r,t:i}){let a=Lt.useId(),[l,s]=Lt.useState(false),c=Lt.useRef(null),d=Lt.useRef(null),f=Lt.useRef(null);Lt.useLayoutEffect(()=>{if(!l||!f.current||!d.current)return;let g=editor.observeContentControlPopup(f.current,d.current);return (f.current.querySelector("[data-selected]")??f.current.querySelector("button"))?.focus(),g},[l]),Lt.useEffect(()=>{if(n&&s(false),!l)return;let g=c.current?.ownerDocument,p=m=>{c.current?.contains(m.target)||s(false);};return g?.addEventListener("pointerdown",p),()=>g?.removeEventListener("pointerdown",p)},[l,n]);let u=()=>{s(false),d.current?.focus();};return jsxRuntime.jsxs("div",{ref:c,className:"docx-revision-color-picker",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||s(false);},children:[jsxRuntime.jsx("span",{id:`${a}-label`,children:e}),jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-revision-color-trigger",disabled:n,"aria-labelledby":`${a}-label ${a}-value`,"aria-expanded":l&&!n,"aria-controls":`${a}-options`,onClick:()=>s(!l),children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:bd(t)}}),jsxRuntime.jsx("span",{id:`${a}-value`,children:i(`values.${t}`)})]}),jsxRuntime.jsxs("div",{ref:f,id:`${a}-options`,className:"docx-revision-color-options",hidden:!l||n,role:"group","aria-labelledby":`${a}-label`,onKeyDown:g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),u());let p=Array.from(g.currentTarget.querySelectorAll("button")),m=p.indexOf(g.target),b=g.key==="Home"?0:g.key==="End"?p.length-1:["ArrowRight","ArrowDown"].includes(g.key)?(m+1)%p.length:["ArrowLeft","ArrowUp"].includes(g.key)?(m-1+p.length)%p.length:null;b!==null&&(g.preventDefault(),g.stopPropagation(),p[b]?.focus());},children:[jsxRuntime.jsx("div",{className:"docx-revision-color-special",children:o.filter(g=>["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear","aria-pressed":t===g,"data-selected":t===g?"":void 0,onClick:()=>{r(g),u();},children:[jsxRuntime.jsx("span",{className:"docx-revision-color-swatch","aria-hidden":"true",style:{backgroundColor:bd(g)}}),i(`values.${g}`)]},g))}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",children:o.filter(g=>!["auto","none","byAuthor"].includes(g)).map(g=>jsxRuntime.jsx(pr,{value:g,css:bd(g),title:i(`values.${g}`),selected:t===g,apply:p=>{r(p),u();}},g))})]})]})}var tg=["none","colorOnly","bold","italic","underline","doubleUnderline","strikethrough","doubleStrikethrough"],ZE=["byAuthor","auto",...editor.REVISION_MARKUP_COLORS];function og(e,t,o){let{values:n}=e,r=a=>{let l=a==="changedLines"?["none","leftBorder","rightBorder","outsideBorder"]:a==="deletions"||a==="movedFrom"?[...tg,"hidden","caret","pound"]:tg,s=(a==="movedFrom"||a==="movedTo")&&!n.trackMoves;return jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("div",{className:"docx-revision-markup-row",children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-row-title","aria-hidden":"true",children:t(a)}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("span",{className:"docx-revision-markup-field-label",children:t(a)}),jsxRuntime.jsx("select",{value:n[a].mark,disabled:s,onChange:c=>e.setValue(a,{...n[a],mark:c.target.value}),children:l.map(c=>jsxRuntime.jsx("option",{value:c,children:t(`values.${c}`)},c))})]}),jsxRuntime.jsx(fl,{label:t(`${a}Color`),value:n[a].color,values:ZE,disabled:s,t,change:c=>e.setValue(a,{...n[a],color:c})})]}),a!=="changedLines"&&jsxRuntime.jsx("div",{className:"docx-revision-markup-background",children:jsxRuntime.jsx(fl,{label:t(`${a}Background`),value:n[a].background,values:["none","byAuthor",...editor.REVISION_MARKUP_COLORS],disabled:s,t,change:c=>e.setValue(a,{...n[a],background:c})})})]})},i=a=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":a,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n[a],"aria-describedby":`${o}-${a}`,onChange:l=>e.setValue(a,l.target.checked)}),t(a)]}),jsxRuntime.jsx("p",{id:`${o}-${a}`,children:t(`${a}Note`)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("markup")}),r("insertions"),r("deletions"),r("changedLines")]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("moves")}),i("trackMoves"),r("movedFrom"),r("movedTo")]}),jsxRuntime.jsxs("fieldset",{"data-docx-part":"field","data-docx-field":"cells",className:"docx-revision-markup-tableCells",children:[jsxRuntime.jsx("legend",{children:t("tableCells")}),["inserted","deleted","merged","split"].map(a=>jsxRuntime.jsx(fl,{label:t(`${a}Cells`),value:n.cells[a],values:["byAuthor","none",...editor.REVISION_MARKUP_COLORS],t,change:l=>e.setValue("cells",{...n.cells,[a]:l})},a))]}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx("legend",{children:t("formatting")}),i("trackFormatting"),r("formatting")]})]})}var Gt=At();function GE(){return Gt.useState()}function jE({session:e,...t}){return e?jsxRuntime.jsx(YE,{session:e,...t}):null}function YE({session:e,children:t,preset:o,className:n,style:r}){let i=Lt.useId(),{t:a}=N(),l=m=>a(`revisionMarkup.${m}`),s=Lt.useCallback(m=>e.subscribe(m),[e]),c=Lt.useCallback(()=>e.get(),[e]),d=Lt.useSyncExternalStore(s,c,c),[f,u]=Lt.useState(e.signal.aborted),g=Lt.useRef(null);Lt.useEffect(()=>{g.current=e;let m=()=>u(true);return u(e.signal.aborted),e.signal.addEventListener("abort",m),()=>{e.signal.removeEventListener("abort",m),g.current=null,queueMicrotask(()=>{g.current!==e&&e.cancel();});}},[e]);let p={values:d,setValue(m,b){e.set({[m]:b});},errors:{},isEnabled:!f&&e.canApply(),apply(){e.apply();},cancel(){e.cancel();},reset(){e.reset();}};return f?null:jsxRuntime.jsx(ze,{kind:"revisionMarkup",label:l("title"),className:["docx-revision-markup-dialog",n].filter(Boolean).join(" "),style:r,onClose:p.cancel,dismissOutside:false,sessionSignal:e.signal,children:jsxRuntime.jsx(Gt.Composition,{state:p,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",children:jsxRuntime.jsx("h2",{"data-docx-part":"title",children:l("title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-revision-markup-body",children:og(p,l,i)}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-revision-markup-actions",children:[jsxRuntime.jsx("button",{"data-docx-part":"reset",type:"button",onClick:p.reset,children:l("reset")}),jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",children:p.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",type:"button",onClick:p.cancel,children:l("cancel")}),jsxRuntime.jsx("button",{"data-docx-part":"apply",type:"button",disabled:!p.isEnabled,onClick:p.apply,children:l("ok")})]})]}),children:t})})}var ya=Object.assign(jE,{Header:Gt.Header,Title:Gt.Title,Body:Gt.Body,Footer:Gt.Footer,Apply:Gt.Apply,Cancel:Gt.Cancel,Error:Gt.Error,Field:Gt.Field,Reset:Gt.Reset});function vd(e){let t=H(),o=Lt.useRef(e.onRevisionMarkupChange);o.current=e.onRevisionMarkupChange;let{onRevisionMarkupChange:n,...r}=e,i=JSON.stringify(r);return Lt.useEffect(()=>t?.on("revisionMarkupChange",a=>o.current?.(a)),[t]),Lt.useEffect(()=>{t&&t.setRevisionMarkup(JSON.parse(i));},[t,i]),null}function va({open:e,format:t,pending:o,error:n,onClose:r,className:i,style:a,children:l}){let{t:s}=N();if(!e)return null;let c=s(n?t==="pdf"?"toolbar.exportPdfFailed":"toolbar.exportMarkdownFailed":t==="pdf"?"toolbar.exportingPdf":"toolbar.exportingMarkdown");return jsxRuntime.jsx(ze,{kind:"export",label:c,role:n?"alertdialog":"dialog",className:`docx-export-dialog${o?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[o&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:n?"alert":"status",children:n||s("toolbar.exportDownloadHint")})}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:s(n?"common.close":"toolbar.exportContinueEditing")})})]})})}function xa({open:e,pending:t,error:o,url:n,onClose:r,className:i,style:a,children:l}){let{t:s}=N();if(!e)return null;let c=s(o?"toolbar.printFailed":"toolbar.printPreparing"),d=n.startsWith("blob:")?n:"";return jsxRuntime.jsx(ze,{kind:"print",label:c,role:o?"alertdialog":"dialog",className:`docx-export-dialog docx-print-dialog${t?" docx-export-dialog--pending":""}${i?` ${i}`:""}`,style:a,dismissOutside:false,onClose:r,onKeyDown:f=>{editor.isChromePrintShortcut(f.nativeEvent)&&f.preventDefault();},children:l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("header",{className:"docx-dialog__header",children:[t&&jsxRuntime.jsx("div",{className:"docx-export-dialog__progress","aria-hidden":"true",children:jsxRuntime.jsx("span",{className:"docx-export-dialog__spinner"})}),jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:c})]}),o&&jsxRuntime.jsx("div",{className:"docx-dialog__body",children:jsxRuntime.jsx("p",{className:"docx-export-dialog__message",role:"alert",children:o})}),jsxRuntime.jsxs("footer",{className:"docx-dialog__footer",children:[o&&d&&jsxRuntime.jsx("a",{className:"docx-dialog__link-button docx-print-dialog__open",href:d,target:"_blank",rel:"noopener noreferrer",children:s("toolbar.printOpenPdf")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:s(o?"common.close":"common.cancel")})]})]})})}var ht={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function mr({text:e,x:t,y:o,className:n}){return jsxRuntime.jsx("div",{role:"tooltip",className:n,"data-testid":"docx-notes-preview",style:{position:"fixed",left:t,top:o,zIndex:ht.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg)",color:"var(--doc-popover-fg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",fontSize:12,lineHeight:1.4,pointerEvents:"none"},onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:e})}function fr({noteKind:e,x:t,y:o,onDelete:n,onConvert:r,onConvertAll:i,onOpenProperties:a,onClose:l,deleteEnabled:s,convertEnabled:c,convertAllEnabled:d,deleteDisabledReason:f,convertDisabledReason:u,convertAllDisabledReason:g,className:p}){let{t:m}=N();return jsxRuntime.jsxs("div",{role:"menu",className:p,onKeyDown:b=>{b.key==="Escape"&&l();},"data-testid":"docx-notes-menu",style:{position:"fixed",left:t,top:o,zIndex:ht.popover,minWidth:160,background:"var(--doc-popover-bg)",border:"1px solid var(--doc-border)",boxShadow:"0 4px 16px var(--doc-shadow)",padding:4},onMouseDown:q,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!s,title:f,onClick:n,children:m("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!c,title:u,onClick:r,children:m(e==="footnote"?"notes.convertToEndnote":"notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!d,title:g,onClick:i,children:m(e==="footnote"?"notes.convertAllFootnotes":"notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:a,children:m("dialogs.footnoteProperties.title")})]})}function rP(e){return t=>Lt.createElement(e,t)}var lg=new WeakMap,aP=0;function Ee(e,t,o){if(e===false)return null;let n=e(t);if(!o)return n;let r=lg.get(o);return r===void 0&&lg.set(o,r=++aP),Lt.createElement(Lt.Fragment,{key:r},n)}var Cd=Lt.createContext(void 0),Ct=()=>Lt.useContext(Cd);function gr(e,t,o){let n=e.getBoundingClientRect();return {left:t-n.left-e.clientLeft+e.scrollLeft,top:o-n.top-e.clientTop+e.scrollTop}}function Ta(e){return e.paragraphId===""}var Rn=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),gP=e=>e;function hP(e){let t=r=>!!r&&(r.width>0||r.height>0),o=editor.hostDocumentOf(e);if(o){let i=o.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(t(i))return {left:i.left,top:i.bottom}}let n=o?o.getSelection():null;if(n&&n.rangeCount>0){let r=n.getRangeAt(0),i=r.getBoundingClientRect();if(t(i))return {left:i.left,top:i.bottom};let a=r.startContainer,s=(editor.isElementNode(a)?a:a.parentElement)?.getBoundingClientRect();if(t(s))return {left:s.left,top:s.bottom}}return null}var Ea=Lt.createContext(null);function Ed(){let e=Lt.useContext(Ea),t=hl(e===null);return e??t}function hl(e=true){let t=H(),o=Pe(),n=Lt.useRef(o);n.current=o;let[r,i]=Lt.useState(Rn),a=Lt.useRef(null),l=Lt.useRef(r);l.current=r;let s=W(gP),c=t?t.can({type:"insertText",text:""}).ok:false,d=Lt.useCallback(()=>{let T=a.current;T&&(T.editor.releaseSelection(T.pin),a.current=null);},[]),f=Lt.useCallback((T,x)=>{d(),i({mode:T?"reading":"editing",link:T??null,anchor:x??null,text:T?.text??"",url:T?T.kind==="internal"?`#${T.anchor??""}`:T.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,d]),u=Lt.useCallback(()=>{d(),i(Rn);},[d]);Lt.useEffect(()=>d,[d]);let g=Lt.useCallback(()=>{let T=hP(n.current);d();let x=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(x&&Ta(x)){f(x,T);return}if(x){i({mode:"editing",link:x,anchor:T,text:x.text,url:x.kind==="internal"?`#${x.anchor??""}`:x.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let E=t?.query({type:"selectedText"})??"",P=t?.retainSelection()??null;t&&P&&(a.current={editor:t,pin:P}),i({mode:"editing",link:null,anchor:T,text:E,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,f,d]);Lt.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:T=>f(T.link,{left:T.rect.left,top:T.rect.bottom}),onRequest:g})},[t,e,f,g]),Lt.useEffect(()=>{let T=l.current;if(T.mode!=="reading"||!T.link)return;let x=Ta(T.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;x&&x.id===T.link.id||i(Rn);},[s,t]),Lt.useEffect(()=>{let T=l.current;if(T.mode!=="editing"||T.link)return;let x=t?.surface;!x||x.retainedSelection()||i(Rn);},[s,t]);let p=Lt.useCallback(async()=>{let T=l.current.link?.href;if(!T)return false;try{await editor.hostWindowOf(n.current).navigator.clipboard.writeText(T);}catch{return false}return i(x=>({...x,copied:true})),true},[]),m=Lt.useCallback(()=>{i(T=>({...T,mode:"editing",copied:false,error:false}));},[]),b=Lt.useCallback(T=>{i(x=>({...x,text:T,copied:false,error:false}));},[]),h=Lt.useCallback(T=>{i(x=>({...x,url:T,copied:false,error:false}));},[]),v=Lt.useCallback(()=>{let T=l.current,x=t?.surface?.hyperlinks;if(!x)return false;let E=T.url.trim();if(E.length===0)return i(w=>({...w,error:true})),false;let P=E.startsWith("#");return x.applyHyperlink({...P?{anchor:E.slice(1)}:{url:E},...T.text.trim().length>0?{text:T.text}:{}})?(u(),true):(i(w=>({...w,error:true})),false)},[t,u]),y=Lt.useCallback(()=>{let T=t?.surface?.hyperlinks,x=l.current.link;if(!T)return false;let E=T.removeHyperlink(x?.id);return E&&u(),E},[t,u]),C=Lt.useCallback(()=>{let T=t?.surface?.navigation,x=l.current.link;if(!T||!x)return false;if(x.kind==="internal"){let P=x.anchor?T.goToBookmark(x.anchor):false;return P&&i(Rn),P}let E=T.openExternal(x.href);return E&&i(Rn),E},[t]);return Lt.useMemo(()=>({state:r.mode==="closed"?Rn:{...r,canEdit:c},open:f,openAtCaret:g,close:u,copy:p,beginEdit:m,setText:b,setUrl:h,commitEdit:v,unlink:y,openTarget:C}),[r,c,f,g,u,p,m,b,h,v,y,C])}function _n(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var bl=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),SP="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z",kP="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z",wP="M770-302 656-416l57-57 114 114-57 57ZM603-469 469-603l57-57 134 134-57 57ZM280-280h133v80H280q-83 0-141.5-58.5T80-400q0-83 58.5-141.5T280-600h133v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm40-80v-80h101l80 80H320Zm493-15-57-57q23-11 33.5-32t10.5-36q0-50-35-85t-85-35H547v-80h133q83 0 141.5 58.5T880-400q0 32-11 61.5T813-375ZM792-56 56-792l56-56 736 736-56 56Z",DP="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z";function RP({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=mo(),a=Lt.useRef(null),{state:l,close:s}=i;Lt.useEffect(()=>{if(l.mode==="closed")return;let m=v=>{v.key==="Escape"&&(v.preventDefault(),s());},b=v=>{let y=a.current;y&&editor.isDomNode(v.target)&&y.contains(v.target)||s();},h=editor.hostDocumentOf(a.current);return h.addEventListener("keydown",m),h.addEventListener("mousedown",b,true),()=>{h.removeEventListener("keydown",m),h.removeEventListener("mousedown",b,true);}},[l.mode,s]);let[c,d]=Lt.useState(null);Lt.useLayoutEffect(()=>{let m=l.anchor,b=a.current;if(!m||!b){d(null);return}let h=b.offsetParent;if(!h){d(null);return}let{left:v,top:y}=gr(h,m.left,m.top),C=Math.max(0,h.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(v,C)),top:y});},[l.anchor]);let{t:f}=N(),u=l.mode==="editing"?f(l.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):f("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(MP,{children:n}):n;if(o)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:n});let p={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:_n,style:c??void 0,"aria-label":u};return l.mode==="closed"?null:t?jsxRuntime.jsx(Y,{...p,children:n}):jsxRuntime.jsx("div",{...p,children:g})}function MP({children:e}){let{state:t}=mo(),o=Lt.useMemo(()=>_P(e),[e]),n=(i,a)=>i in o?o[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Fields",jsxRuntime.jsx(Rd,{})),n("Error",jsxRuntime.jsx(_d,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Apply",jsxRuntime.jsx(Md,{})),n("Cancel",jsxRuntime.jsx(Id,{}))]}),o.__extra]});let r=t.canEdit&&!(t.link&&Ta(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n("Url",jsxRuntime.jsx(Sd,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[n("Copy",jsxRuntime.jsx(kd,{})),r?n("Edit",jsxRuntime.jsx(wd,{})):null,r?n("Unlink",jsxRuntime.jsx(Dd,{})):null]}),o.__extra]})}function _P(e){let t={},o=[],n=r=>{if(Array.isArray(r)){r.forEach(n);return}if(!r||typeof r!="object"||!("type"in r)){r&&o.push(r);return}if(r.type===Lt.Fragment){n(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:o.push(r);};return n(e),o.length>0&&(t.__extra=o),t}function mo(){return Lt.useContext(Ea)??IP}var IP={state:{mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:false},open:()=>{},openAtCaret:()=>{},close:()=>{},copy:async()=>false,beginEdit:()=>{},setText:()=>{},setUrl:()=>{},commitEdit:()=>false,unlink:()=>false,openTarget:()=>false};function Sd({className:e,asChild:t,hidden:o,children:n}){let{state:r,openTarget:i}=mo(),{t:a}=N();if(o||!r.link)return null;let l=!r.link.href,s=r.link.kind==="internal",c=s?`#${r.link.anchor??""}`:r.link.authored,d=a(l?"hyperlinkPopup.inertTarget":s?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),f={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...l?{"data-inert":""}:{},title:d,onMouseDown:_n,...l?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(Y,{...f,className:e,children:n}):l?jsxRuntime.jsxs("span",{...f,children:[n??c,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...f,children:[n??c,bl(DP)]})}Sd.docxHyperLinkPart="Url";function kd({className:e,asChild:t,hidden:o,children:n,icon:r}){let{state:i,copy:a}=mo(),{t:l}=N();if(o||!i.link?.href)return null;let s=i.copied?l("editor.linkCopied"):l("hyperlinkPopup.copyLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":s,title:s,onMouseDown:_n,onClick:()=>{a();}};return t?jsxRuntime.jsx(Y,{...c,className:e,children:n}):jsxRuntime.jsx("button",{...c,children:r??n??bl(SP)})}kd.docxHyperLinkPart="Copy";function wd({className:e,asChild:t,hidden:o,children:n,icon:r}){let{beginEdit:i}=mo(),{t:a}=N();if(o)return null;let l=a("hyperlinkPopup.editLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":l,title:l,onMouseDown:_n,onClick:()=>i()};return t?jsxRuntime.jsx(Y,{...s,className:e,children:n}):jsxRuntime.jsx("button",{...s,children:r??n??bl(kP)})}wd.docxHyperLinkPart="Edit";function Dd({className:e,asChild:t,hidden:o,children:n,icon:r}){let{unlink:i}=mo(),{t:a}=N();if(o)return null;let l=a("hyperlinkPopup.removeLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":l,title:l,onMouseDown:_n,onClick:()=>i()};return t?jsxRuntime.jsx(Y,{...s,className:e,children:n}):jsxRuntime.jsx("button",{...s,children:r??n??bl(wP)})}Dd.docxHyperLinkPart="Unlink";function Rd({className:e,hidden:t}){let{state:o,setText:n,setUrl:r,commitEdit:i,close:a}=mo(),{t:l}=N(),s=Lt.useRef(null),c=Lt.useId(),d=Lt.useId();Lt.useEffect(()=>{o.mode==="editing"&&(s.current?.focus({preventScroll:true}),s.current?.select());},[o.mode]);let f=Lt.useCallback(u=>{if(u.key==="Enter"){u.preventDefault(),i();return}u.key==="Escape"&&(u.preventDefault(),a());},[i,a]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:l("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:c,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:o.text,placeholder:l("hyperlinkPopup.displayTextPlaceholder"),onChange:u=>n(u.target.value),onKeyDown:f}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:l("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:s,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:o.url,placeholder:l("hyperlinkPopup.urlPlaceholder"),onChange:u=>r(u.target.value),onKeyDown:f})]})}Rd.docxHyperLinkPart="Fields";function Md({className:e,asChild:t,hidden:o,children:n}){let{state:r,commitEdit:i}=mo(),{t:a}=N();if(o)return null;let l=a("hyperlinkPopup.apply"),s={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:_n,onClick:()=>i()};return t?jsxRuntime.jsx(Y,{...s,className:e,children:n}):jsxRuntime.jsx("button",{...s,children:n??l})}function _d({className:e,hidden:t}){let{state:o}=mo(),{t:n}=N();return t||!o.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:n("hyperlinkPopup.refused")})}_d.docxHyperLinkPart="Error";Md.docxHyperLinkPart="Apply";function Id({className:e,asChild:t,hidden:o,children:n}){let{close:r}=mo(),{t:i}=N();if(o)return null;let a=i("hyperlinkPopup.cancel"),l={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:_n,onClick:()=>r()};return t?jsxRuntime.jsx(Y,{...l,className:e,children:n}):jsxRuntime.jsx("button",{...l,children:n??a})}Id.docxHyperLinkPart="Cancel";var Pa=Object.assign(RP,{Url:Sd,Copy:kd,Edit:wd,Unlink:Dd,Fields:Rd,Error:_d,Apply:Md,Cancel:Id});var Tt={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function HP(e){return e==="sdtLocked"||e==="sdtContentLocked"}function AP(e){return e==="contentLocked"||e==="sdtContentLocked"}function Ld(e,t){return !e.ok&&e.code===t}function fo(){let e=Lt.useContext(Fd),t=yl();return e??t}function yl(){let e=H(),[t,o]=Lt.useState(false),[n,r]=Lt.useState(false),[i,a]=Lt.useState(false),l=W(E=>E),s=e?.surface??null,c=s?.contentControls;Lt.useEffect(()=>{r(c?.showAll()??s?.state().contentControls.showAll??false),a(c?.formFill()??s?.state().contentControls.formFill??false);},[l,c,s]);let d=Lt.useMemo(()=>{if(!e)return null;let E=c?.atCaret()??null;if(E){let k=c?.disabledReason(E.id,"edit")??null,_=c?.disabledReason(E.id,"remove")??null;return {id:E.id,tag:E.tag??null,alias:E.alias??null,controlType:E.controlType,locked:AP(E.effectiveLock)||k==="locked",removalLocked:HP(E.effectiveLock)||_==="locked",placeholder:E.placeholder,bound:E.bound||k==="bound",effectiveLock:E.effectiveLock}}let P=e.query({type:"contentControlAt"});if(!P)return null;let D=c?.disabledReason(P.id,"edit")??null,w=c?.disabledReason(P.id,"remove")??null,S=e.can({type:"setContentControlValue",value:""}),L=e.can({type:"removeContentControl"}),I=P.locked===true||D==="locked"||Ld(S,"locked"),F=D==="bound"||Ld(S,"bound"),O=w==="locked"||Ld(L,"locked");return {id:P.id,tag:P.tag??null,alias:P.alias??null,controlType:P.controlType,locked:I,removalLocked:O,placeholder:false,bound:F,effectiveLock:null}},[e,l,c]),f=Lt.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,l]),u=Lt.useCallback(E=>{c?.setShowAll(E),r(E);},[c]),g=Lt.useCallback(E=>{c?.setFormFill(E),a(E);},[c]),p=Lt.useCallback(()=>u(!n),[u,n]),m=Lt.useCallback(()=>g(!i),[g,i]),b=Lt.useCallback(()=>o(true),[]),h=Lt.useCallback(()=>o(false),[]),v=Lt.useCallback(()=>o(E=>!E),[]),y=Lt.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let P=c.disabledReason(d.id,"edit");return P==="locked"?"the content control is locked":P==="bound"?"the content control is bound to external data":P==="notFound"?"the content control was not found":P}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let E=e.can({type:"setContentControlValue",value:""});return E.ok?null:E.reason},[d,c,e]),C=Lt.useMemo(()=>{if(!d)return "no content control at the current selection";if(c){let P=c.disabledReason(d.id,"remove");return P==="locked"?"the content control is locked":P==="notFound"?"the content control was not found":P}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let E=e.can({type:"removeContentControl"});return E.ok?null:E.reason},[d,c,e]),T=Lt.useCallback(E=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c&&d){let P=c.disabledReason(d.id,"edit");if(P)return {ok:false,code:P==="bound"?"bound":P==="locked"?"locked":"notFound",reason:P==="bound"?"the content control is bound to external data":P==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:E})},[e,c,d]),x=Lt.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(c){let E=d?.id;if(!E)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let P=c.disabledReason(E,"remove");return P?{ok:false,code:P==="locked"?"locked":"notFound",reason:P==="locked"?"the content control is locked":"the content control was not found"}:c.remove(E)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,c,d]);return Lt.useMemo(()=>({control:d,controls:f,showAll:n,formFill:i,inspectorOpen:t,canSetValue:y===null&&d!==null,canRemove:C===null&&d!==null,setValueDisabledReason:y,removeDisabledReason:C,setShowAll:u,toggleShowAll:p,setFormFill:g,toggleFormFill:m,openInspector:b,closeInspector:h,toggleInspector:v,remove:x,setValue:T}),[d,f,n,i,t,y,C,u,p,g,m,b,h,v,x,T])}var Fd=Lt.createContext(null);function Hd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var mg=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),qP="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",KP="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z",zP={position:"absolute",zIndex:20,minWidth:240,maxWidth:320,top:12,right:12,padding:12,borderRadius:8,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-surface)",boxShadow:"0 4px 16px var(--doc-shadow)",color:"var(--doc-text)",fontSize:13,display:"flex",flexDirection:"column",gap:10},$P={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},UP={color:"var(--doc-text-muted)",flexShrink:0},VP={textAlign:"right",wordBreak:"break-word"},GP={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},jP={display:"flex",gap:8,marginTop:4},fg={display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text)",font:"inherit",cursor:"pointer"};function YP(e){switch(e){case "plainText":return "contentControl.types.plainText";case "checkbox":return "contentControl.types.checkbox";case "dropdown":return "contentControl.types.dropdown";case "comboBox":return "contentControl.types.comboBox";case "date":return "contentControl.types.date";case "picture":return "contentControl.types.picture";case "buildingBlockGallery":return "contentControl.types.buildingBlockGallery";case "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function XP(e){return e.effectiveLock==="sdtContentLocked"?"contentControl.lock.sdtContentLocked":e.effectiveLock==="contentLocked"||e.locked?"contentControl.lock.contentLocked":e.effectiveLock==="sdtLocked"||e.removalLocked?"contentControl.lock.sdtLocked":"contentControl.lock.unlocked"}function hr({label:e,value:t,testId:o}){return jsxRuntime.jsxs("div",{style:$P,"data-testid":o,children:[jsxRuntime.jsx("span",{style:UP,children:e}),jsxRuntime.jsx("span",{style:VP,children:t})]})}function JP({className:e,asChild:t,hidden:o,children:n,preset:r=true}){let i=fo(),a=Lt.useRef(null),l=Lt.useId(),{t:s}=N(),{control:c,inspectorOpen:d,closeInspector:f}=i;if(Lt.useEffect(()=>{if(!d)return;let m=v=>{v.key==="Escape"&&(v.preventDefault(),f());},b=v=>{let y=a.current;y&&editor.isDomNode(v.target)&&y.contains(v.target)||f();},h=editor.hostDocumentOf(a.current);return h.addEventListener("keydown",m),h.addEventListener("mousedown",b,true),()=>{h.removeEventListener("keydown",m),h.removeEventListener("mousedown",b,true);}},[d,f]),Lt.useEffect(()=>{d&&!c&&f();},[d,c,f]),o||!d||!c)return null;let u=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(gg,{}),jsxRuntime.jsx(hg,{}),jsxRuntime.jsx("div",{style:jP,children:jsxRuntime.jsx(bg,{})}),n]}):n,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":l,"data-testid":"content-control-inspector","data-control-id":c.id,"data-control-type":c.controlType,...c.locked?{"data-locked":""}:{},...c.bound?{"data-bound":""}:{},...c.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:zP,onMouseDown:m=>{Hd(m),m.stopPropagation();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:l,className:"docx-editor-sr-only",children:s("contentControl.inspectorPanel.title")}),u]});return t?jsxRuntime.jsx(Y,{...g,children:p}):jsxRuntime.jsx("div",{...g,children:p})}function gg({className:e,asChild:t,hidden:o,children:n}){let{closeInspector:r}=fo(),{t:i}=N();if(o)return null;let a={style:GP,className:e??void 0,"data-testid":"content-control-inspector-header"},l=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:n??i("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":i("common.close"),title:i("common.close"),style:{...fg,padding:4,border:"none",background:"transparent"},onMouseDown:Hd,onClick:()=>r(),children:mg(qP)})]});return t?jsxRuntime.jsx(Y,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function hg({className:e,asChild:t,hidden:o,children:n}){let{control:r}=fo(),{t:i}=N();if(o||!r)return null;let a=i("contentControl.inspectorPanel.empty"),l=i("contentControl.inspectorPanel.yes"),s=i("contentControl.inspectorPanel.no"),c=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hr,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(hr,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(hr,{label:i("contentControl.inspectorPanel.type"),value:i(YP(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(hr,{label:i("contentControl.inspectorPanel.lock"),value:i(XP(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(hr,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:s,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(hr,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?l:s,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:i("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:i("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(Y,{...d,children:c}):jsxRuntime.jsx("div",{...d,children:c})}function bg({className:e,asChild:t,hidden:o,icon:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l,closeInspector:s}=fo(),{t:c}=N();if(o)return null;let d=c("contentControl.remove"),f={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":d,title:a??d,style:fg,onMouseDown:Hd,onClick:()=>{l().ok&&s();}},u=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n??r??mg(KP),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(Y,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}var wa=Object.assign(JP,{Header:gg,Fields:hg,Remove:bg});var nS=e=>e;function Zd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Da(){let e=H(),{t}=N(),[o,n]=Lt.useState(null),[r,i]=Lt.useState(null),a=Lt.useRef(null),l=Lt.useRef(null),s=Lt.useRef(null),c=Lt.useId(),d=Lt.useId(),f=Lt.useId(),u=o?.activation??null,g=W(nS),p=Lt.useMemo(()=>{if(!e?.surface||!u)return {replaceEnabled:false,removeEnabled:false,reason:null};let y=e.surface.equations.can(u.equation.id,"replace"),C=e.surface.equations.can(u.equation.id,"remove"),T=y.ok?C.ok?null:C.reason:y.reason;return {replaceEnabled:y.ok,removeEnabled:C.ok,reason:T?i18n.localizeDisabledReason(T,t):null}},[u,e,g,t]),m=Lt.useCallback((y=false)=>{s.current?.(),s.current=null,n(null),y&&e&&queueMicrotask(()=>e.focus());},[e]);Lt.useEffect(()=>{if(!e)return;let y=e.setEquationChrome({onPopover:C=>{s.current?.();let T=e.surface;if(T&&typeof T.retainSelection=="function"){let x=T.retainSelection();s.current=()=>T.releaseSelection(x);}else s.current=null;n({activation:C,mountGeneration:e.mountGeneration,draft:C.equation.linear,error:false});}});return ()=>{y(),s.current?.(),s.current=null,n(null);}},[e,m]),Lt.useEffect(()=>{if(!o||!e?.surface)return;(e.mountGeneration!==o.mountGeneration||!e.surface.equations.equationById(o.activation.equation.id))&&m();},[e,g,o,m]),Lt.useEffect(()=>{if(!o)return;let y=a.current,C=y?.ownerDocument,T=C?.defaultView;if(!y||!C||!T)return;let x=P=>{P.key==="Escape"&&(P.preventDefault(),m(true));},E=P=>{editor.isDomNode(P.target)&&y.contains(P.target)||m();};return C.addEventListener("keydown",x),C.addEventListener("pointerdown",E,true),()=>{C.removeEventListener("keydown",x),C.removeEventListener("pointerdown",E,true);}},[o,m]),Lt.useLayoutEffect(()=>{if(!u){i(null);return}let y=a.current;if(!y)return;let C=y.offsetParent;if(!C){i(null);return}let T=u.rect,x=gr(C,T.left,T.bottom),E=Math.max(0,C.scrollWidth-y.offsetWidth);i({left:Math.max(0,Math.min(x.left,E)),top:x.top}),l.current?.focus({preventScroll:true}),l.current?.select();},[u]);let b=Lt.useCallback(()=>{if(!o||!e?.surface||!p.replaceEnabled)return false;let y=e.surface.equations.applyEquation(o.activation.equation.id,o.draft);return y?m(true):n(C=>C&&{...C,error:true}),y},[e,o,m,p.replaceEnabled]),h=Lt.useCallback(()=>{if(!o||!e?.surface||!p.removeEnabled)return false;let y=e.surface.equations.removeEquation(o.activation.equation.id);return y?m(true):n(C=>C&&{...C,error:true}),y},[e,o,m,p.removeEnabled]);if(!o)return null;let v=[o.error?d:null,p.reason?f:null].filter(Boolean).join(" ");return jsxRuntime.jsxs("div",{ref:a,className:"docx-equation-popup","data-testid":"equation-popup",role:"dialog","aria-modal":false,"aria-label":t("equationPopup.title"),style:r??void 0,onMouseDown:Zd,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:c,children:t("equationPopup.inputLabel")}),jsxRuntime.jsx("input",{id:c,ref:l,className:"docx-equation-popup__input","data-testid":"equation-popup-input",value:o.draft,placeholder:t("equationPopup.placeholder"),spellCheck:false,"aria-describedby":v||void 0,onChange:y=>n(C=>C&&{...C,draft:y.target.value,error:false}),onKeyDown:y=>{y.key!=="Enter"||y.nativeEvent.isComposing||(y.preventDefault(),b());}}),o.error?jsxRuntime.jsx("div",{id:d,className:"docx-equation-popup__error","data-testid":"equation-popup-error",role:"alert",children:t("equationPopup.refused")}):null,p.reason?jsxRuntime.jsx("div",{id:f,className:"docx-equation-popup__error","data-testid":"equation-popup-disabled-reason",role:"status",children:p.reason}):null,jsxRuntime.jsxs("div",{className:"docx-equation-popup__actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__apply","data-testid":"equation-popup-apply",disabled:!p.replaceEnabled,title:p.reason??void 0,onMouseDown:Zd,onClick:b,children:t("equationPopup.apply")}),jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__delete","data-testid":"equation-popup-delete",disabled:!p.removeEnabled,title:p.reason??void 0,onMouseDown:Zd,onClick:h,children:t("equationPopup.delete")})]})]})}var xg="review.comments",qd="review.addComment";function Cg(e){return e!==xg?e:(Go(`The context-menu row "${xg}" is now "${qd}". The old id still works in this release; write "${qd}".`),qd)}function vr(e,t){if(!Lt.isValidElement(e)||e.type!==Lt.Fragment)return null;let n=Lt.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return n.length===1?n[0]:null}function vl({entries:e,children:t,preset:o,keyOfEntry:n,keyOfChild:r,renderEntry:i,childrenOfEntry:a,onUnmatched:l}){if(!o)return t;let s=new Map,c=[];for(let p of Lt.Children.toArray(t)){let m=r(p);m?s.set(m,p):c.push(p);}let d=new Set,f=p=>p.map((m,b)=>{let h=n(m,b);d.add(h);let v=a?.(m),y=v?f(v):void 0,C=s.get(h);return jsxRuntime.jsx(Lt.Fragment,{children:C??i(m,b,y)},h)}),u=f(e),g=[...s.entries()].filter(([p])=>!d.has(p)).map(([p,m])=>(l?.(p,m),jsxRuntime.jsx(Lt.Fragment,{children:m},p)));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,g,c]})}var lS="review.addComment",sS=e=>e.editingMode==="viewing";function xl(e){let{isEnabled:t,disabledReason:o}=ce(lS),n=W(sS);return t?{isEnabled:t,reason:null}:{isEnabled:t,reason:n?e("editingMode.viewingHint"):o}}var Ra=Lt.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onWatermarkDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),xr="docx-menubar-more",Cl=Lt.createContext({measuring:false,overflow:new Set,inMore:false});function Sg(){return Lt.useContext(Cl)}function rt(){return Lt.useContext(Ra)}function we(){let{t:e}=rt(),{t}=N();return o=>e?.(o)??t(o)}var Cr=Lt.createContext(-1);var cS='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function In(e){return [...e.querySelectorAll(cS)].filter(t=>t.closest('[role="menu"]')===e)}function $d(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function Yt(e,t,o){if(e.length===0)return false;let n=t?e.indexOf(t):-1,r=n===-1?o>0?0:e.length-1:(n+o+e.length)%e.length;return e[r]?.focus(),true}function Xt(e,t){let o=t==="first"?e[0]:e[e.length-1];return o?(o.focus(),true):false}function Ud(e){let t=e?.ownerDocument.activeElement;((t&&e?.contains(t)?t.closest("[data-menu]"):null)?.querySelector(':scope > [role="menuitem"]')??e?.querySelector('.docx-menubar__trigger[aria-expanded="true"]'))?.focus({preventScroll:true});}function kg(e,t,o){return !o||o.ownerDocument===t?false:o.contains(e)}var Jo="data-toolbar-group",Nn="data-toolbar-fixed",_a="data-toolbar-more",TS=34,Tl=new Set;function El(e,t,o){let n=Lt.useRef(null),r=Lt.useRef(new Map),i=Lt.useRef(TS),[a,l]=Lt.useState(Tl),s=Lt.useRef(a);s.current=a;let c=Lt.useRef({groups:t,order:o});c.current={groups:t,order:o};let d=t.join("\0"),f=o.join("\0"),u=Lt.useCallback(()=>{let p=n.current;if(!p||!e)return;let m=editor.hostWindowOf(p),b=m.getComputedStyle(p),h=editor.readColumnGap(b),v=editor.readAvailableWidth(p,b),y=p.querySelector(".docx-toolbar__separator"),C=h*2;if(y){let w=m.getComputedStyle(y),S=editor.readInlineMargins(w);C=editor.separatorLeadingCost(y.offsetWidth,S.start,S.end,h);}for(let w of p.querySelectorAll(`[${Jo}]`)){let S=w.getAttribute(Jo);S&&w.offsetWidth>0&&r.current.set(S,editor.collapsibleGroupCost(w.offsetWidth,C));}let T=0;for(let w of p.querySelectorAll(`[${Nn}]`))w.offsetWidth>0&&(T+=editor.trailingGapCost(w.offsetWidth,h));let x=p.querySelector(`[${_a}]`);x&&x.offsetWidth>0&&(i.current=editor.trailingGapCost(x.offsetWidth,h));let E={available:v,widths:r.current,groups:c.current.groups,order:c.current.order,fixed:T,more:i.current,previous:s.current,hysteresis:editor.TOOLBAR_OVERFLOW_HYSTERESIS},D=s.current.size===0&&editor.controlsOverflow(p,b)===false?Tl:editor.toolbarOverflowGroups(E);editor.sameOverflow(D,s.current)||(s.current=D,l(D));},[e]),g=Lt.useCallback(p=>{n.current=p;},[]);return Lt.useLayoutEffect(()=>{if(!e){s.current.size>0&&(s.current=Tl,l(Tl));return}u();},[e,d,u,f]),Lt.useEffect(()=>{let p=n.current,m=p?editor.hostWindowOf(p):null;if(!e||!p||!m||typeof m.ResizeObserver>"u")return;let b=0,h=new m.ResizeObserver(()=>{b===0&&(b=m.requestAnimationFrame(()=>{b=0,u();}));});h.observe(p),p.parentElement&&h.observe(p.parentElement);for(let v of p.querySelectorAll(`[${Jo}], [${Nn}]`))h.observe(v);return ()=>{b!==0&&m.cancelAnimationFrame(b),h.disconnect();}},[e,d,u,f,a]),{attach:g,overflow:a}}function Mg(e,t,o){let n=e.overflow.has(t),r=t===xr;return {skip:e.inMore?!n:n,asSubmenu:e.inMore&&n,iconOnly:r,rootAttributes:{...e.measuring&&!r?{[Jo]:t}:{},...r?{[_a]:""}:{}},tabStop:o===t||r&&o!==null&&e.overflow.has(o)}}function _g(e,t,o){let[n,r]=Lt.useState(void 0);return Lt.useLayoutEffect(()=>{if(!e){r(void 0);return}let i=()=>{let l=t.current,s=o.current,c=l?.parentElement,d=l?.ownerDocument.defaultView;if(!l||!s||!c||!d)return;let f=l.getBoundingClientRect(),u=editor.toolbarPanelPlacement({triggerLeft:f.left,triggerRight:f.right,panelWidth:s.offsetWidth,viewportWidth:d.innerWidth});r({left:u.left-c.getBoundingClientRect().left,right:"auto",maxInlineSize:u.maxWidth});};i();let a=t.current?.ownerDocument.defaultView;return a?.addEventListener("resize",i),()=>a?.removeEventListener("resize",i)},[e,o,t]),n}var Ng=12700,Ig=96;function RS(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function MS(e,t,o,n){let r=e*72/o,i=t*72/n;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function Pl(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let o=editor.sniffImageMime(e);if(!RS(o))return o==="image/svg+xml"||o==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let n=editor.validateRasterHeader(e,o);if(!n)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(n.pixelWidth*n.pixelHeight>t.maxPixels||n.pixelWidth>t.maxDimension||n.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=MS(n.pixelWidth,n.pixelHeight,n.dpiX??Ig,n.dpiY??Ig);return Object.freeze({ok:true,bytes:e,mime:o,widthPoints:i,heightPoints:a})}function Qo(e){return Math.round(e/Ng*100)/100}function Ia(e){return Math.round(e*Ng)}function Vd({message:e,onClose:t,className:o,style:n,children:r}){let{t:i}=N();return jsxRuntime.jsx(ze,{kind:"imageInsertError",role:"alertdialog",label:i("imageInsert.errors.title"),className:o,style:n,onClose:t,onKeyDown:a=>{a.key==="Enter"&&!a.nativeEvent.isComposing&&(a.preventDefault(),t());},children:r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("header",{className:"docx-dialog__header",children:jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:i("imageInsert.errors.title")})}),jsxRuntime.jsx("div",{className:"docx-dialog__body","data-docx-part":"message",children:e}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:t,children:i("common.close")})})]})})}var Fg="image/png,image/jpeg,image/gif",jd=Lt.createContext(null);function Ag(){let e=Lt.useContext(jd);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function Na(){return Lt.useContext(jd)}function kl({children:e}){let t=H(),{t:o}=N(),n=Lt.useRef(null),r=Lt.useRef(false),i=Ct(),[a,l]=Lt.useState(null),s=Lt.useRef(null),c=Lt.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),d=W(c,(y,C)=>y.enabled===C.enabled&&y.disabledReason===C.disabledReason),f=d.enabled,u=i18n.localizeDisabledReason(d.disabledReason,o),g=Lt.useCallback(async y=>{if(!t||r.current)return;let C=Pl(y);if(!C.ok){l(o(C.reasonKey));return}let T={type:"insertImage",data:C.bytes,mime:C.mime,widthPoints:C.widthPoints,heightPoints:C.heightPoints};r.current=true;try{let x=await editor.executeImageCommand(t,T);x.ok?t.focus():l(i18n.localizeDisabledReason(BS(x.reason)??null,o)??o("imageInsert.errors.refused"));}finally{r.current=false;}},[t,o]),p=Lt.useCallback(async y=>{let C=y?.[0];if(!C)return;let T=await C.arrayBuffer();await g(new Uint8Array(T));},[g]),m=Lt.useCallback(async y=>{if(!y)return;let C=[...y.files].find(T=>T.type.startsWith("image/"));if(C){await p([C]);return}for(let T of y.items){if(T.kind!=="file"||!T.type.startsWith("image/"))continue;let x=T.getAsFile();if(!x)continue;let E=await x.arrayBuffer();await g(new Uint8Array(E));return}},[g,p]),b=Lt.useCallback(()=>{if(!f)return;let y=n.current,C=t?editor.editorHostDocument(t):null;if(!C||!y||y.ownerDocument===C){y?.click();return}s.current?.remove();let T=C.createElement("input");T.type="file",T.accept=Fg,T.hidden=true,T.tabIndex=-1,T.setAttribute("aria-hidden","true");let x=()=>{T.remove(),s.current===T&&(s.current=null);};T.addEventListener("change",()=>{p(T.files).finally(x);},{once:true}),T.addEventListener("cancel",x,{once:true}),C.body.append(T),s.current=T,T.click();},[t,f,p]),h=Lt.useCallback(async y=>{let C=y.currentTarget;await p(C.files),C.value="";},[p]),v=Lt.useMemo(()=>({openFilePicker:b,insertFromFileList:p,insertFromDataTransfer:m,isEnabled:f,disabledReason:u,inputRef:n,onInputChange:h}),[b,p,m,f,u,h]);return jsxRuntime.jsxs(jd.Provider,{value:v,children:[jsxRuntime.jsx("input",{ref:n,type:"file",accept:Fg,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:h,onMouseDown:y=>y.stopPropagation()}),e,a!==null&&(i?.imageInsertError!==void 0?Ee(i.imageInsertError,{message:a,onClose:()=>l(null)}):jsxRuntime.jsx(Vd,{message:a,onClose:()=>l(null)}))]})}function wl({className:e,hidden:t,asChild:o,children:n}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=Ag(),l=te();if(t)return null;let s=ee("image.insert"),c=l(s?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":c,title:a??c,onMouseDown:q,onClick:r};return o?jsxRuntime.jsx(Y,{...d,children:n}):jsxRuntime.jsx("button",{...d,children:n??oe(s?.paths)})}wl.docxSlot="image.insert";var La=Object.assign(wl,{docxSlot:"image.insert"});function BS(e){return e&&/\s/.test(e)?e:void 0}var Yd=6,Wg=6;function Rl({slot:e,label:t,onInserted:o,className:n}){let r=H(),{isEnabled:i}=ce(e),[a,l]=Lt.useState(null),[s,c]=Lt.useState({rows:1,cols:1}),d=Lt.useRef(null),f=Lt.useCallback((p,m)=>{if(!r||!i)return;let b={type:"insertTable",rows:p,cols:m};r.can(b).ok&&(r.exec(b),o(),r.focus());},[r,i,o]),u=Lt.useCallback(p=>{c(m=>{let b={rows:Math.min(Wg,Math.max(1,m.rows+(p.rows??0))),cols:Math.min(Yd,Math.max(1,p.toCol??m.cols+(p.cols??0)))};return l(b),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${b.rows}x${b.cols}"]`)?.focus()),b});},[]),g=[];for(let p=1;p<=Wg;p+=1){let m=[];for(let b=1;b<=Yd;b+=1){let h=!!a&&p<=a.rows&&b<=a.cols;m.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${p}x${b}`,className:"docx-menubar__grid-cell",tabIndex:s.rows===p&&s.cols===b?0:-1,...h?{"data-filled":""}:{},"aria-label":`${b} \xD7 ${p}`,onMouseDown:q,onMouseEnter:()=>l({rows:p,cols:b}),onFocus:()=>l({rows:p,cols:b}),onClick:()=>f(p,b)},b));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:m},p));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":t,className:`docx-menubar__grid${n?` ${n}`:""}`,onMouseLeave:()=>l(null),onKeyDown:p=>{if(p.key==="ArrowRight")u({cols:1});else if(p.key==="ArrowLeft")u({cols:-1});else if(p.key==="ArrowDown")u({rows:1});else if(p.key==="ArrowUp")u({rows:-1});else if(p.key==="Home")u({toCol:1});else if(p.key==="End")u({toCol:Yd});else return;p.preventDefault(),p.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function Pr({slot:e="table.insert",className:t}){let{setOpenMenu:o}=rt(),n=we(),r=Lt.useCallback(()=>o(null),[o]);return jsxRuntime.jsx(Rl,{slot:e,label:n("toolbar.insertTable"),onInserted:r,className:t})}function US({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ce(editor.chromeProbeForSlot("insert.watermark")),r=rt(),i=we();if(t)return null;let a=ee("insert.watermark"),l=i(a?.labelKey??"toolbar.watermark"),s=o&&!!r.onWatermarkDialog;return jsxRuntime.jsx(Ie,{slot:"insert.watermark",icon:oe(a?.paths),disabled:!s,...n?{title:n}:{},onSelect:()=>{r.onWatermarkDialog?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:l})}var Ml=Object.assign(US,{docxSlot:"insert.watermark"});var jS={type:"openGoTo",fromShortcut:true};function Zg(){let e=ce(jS),t=i18n.isApplePlatform()?"toolbar.goToBookmarkShortcutApple":"toolbar.goToBookmarkShortcut";return jsxRuntime.jsx(Bt,{slotId:"insert.goToBookmark",...e.isEnabled?{shortcutKey:t}:{}})}function YS({className:e,hidden:t}){return jsxRuntime.jsx(Bt,{slotId:"insert.bookmark",shortcutKey:"toolbar.bookmarkShortcut",...e?{className:e}:{},...t?{hidden:t}:{}})}var _l=Object.assign(YS,{docxSlot:"insert.bookmark"});function Ie(e){let{icon:t,shortcut:o,disabled:n,title:r,active:i,selected:a,slot:l,onSelect:s,className:c,children:d}=e,f=e["data-value"],u=Mo(),g=Lt.useId(),p=Lt.useContext(Cr),m=n&&r?g:void 0;return jsxRuntime.jsxs("button",{type:"button",role:i===void 0?"menuitem":a===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${c?` ${c}`:""}`,tabIndex:p,...l?{"data-slot":l}:{},...f!==void 0?{"data-value":f}:{},...i?{"data-active":""}:{},...n?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...m?{"aria-describedby":m}:{},...r?{title:r}:{},onMouseDown:q,onClick:n?void 0:s,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),o?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:u(o)}):null,m?jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r}):null]})}function Ha({label:e,labelKey:t,className:o,hidden:n,children:r}){let i=we();if(n)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${o?` ${o}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function Nl(e){if(e.slotId)return e.slotId;if(e.slot)return Uf(e.slot),e.slot;Gf();}function Bt(e){let{labelKey:t,shortcutKey:o,className:n,hidden:r}=e,i=Nl(e)??"",{execute:a,isActive:l,isEnabled:s,disabledReason:c,value:d}=ce(i),{setOpenMenu:f}=rt(),u=we();if(r||!i)return null;let g=ee(i),p=u(t??g?.labelKey??i),m=editor.chromeSlotIsToggle(i),b=["setAlignment","setParagraphDirection","setReviewDisplayMode"].includes(editor.commandForSlot(i)?.type??"");return jsxRuntime.jsx(Ie,{slot:i,icon:oe(g?.paths),...o?{shortcut:u(o)}:{},disabled:!s,...c?{title:c}:{},...m?{active:l}:{},...b?{selected:true}:{},...d!==null?{"data-value":d}:{},onSelect:()=>{a(),f(null);},...n?{className:n}:{},children:p})}Bt.docxMenuRow=true;function Aa(e,t,o,n,r=()=>true){return Object.assign(({className:a,hidden:l})=>{let s=rt(),c=we(),d=n(s),f=o&&r(s)?o:void 0;if(l)return null;let u=ee(e),g=c(t??u?.labelKey??e);return jsxRuntime.jsx(Ie,{slot:e,icon:oe(u?.paths),...f?{shortcut:c(f)}:{},disabled:!d,onSelect:()=>{d?.(),s.setOpenMenu(null);},...a?{className:a}:{},children:g})},{docxSlot:e})}var Jd=Aa("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),Qd=Aa("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave),eu=Aa("file.exportMarkdown",void 0,void 0,e=>e.onExport?()=>e.onExport?.("markdown"):void 0),tu=Aa("file.exportPdf",void 0,void 0,e=>e.onExport?()=>e.onExport?.("pdf"):void 0),ou=Aa("file.print",void 0,"toolbar.printShortcut",e=>e.onPrint,e=>e.printShortcut===true);function nk({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ce(editor.chromeProbeForSlot("file.pageSetup")),r=rt(),i=we();if(t)return null;let a=ee("file.pageSetup"),l=i(a?.labelKey??"file.pageSetup"),s=o&&!!r.onPageSetup;return jsxRuntime.jsx(Ie,{slot:"file.pageSetup",icon:oe(a?.paths),disabled:!s,...n?{title:n}:{},onSelect:()=>{r.onPageSetup?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:l})}function rk({className:e,hidden:t}){let{isEnabled:o,disabledReason:n}=ce(editor.chromeProbeForSlot("paragraph.dialog")),r=rt(),i=we();if(t)return null;let a=ee("paragraph.dialog"),l=i(a?.labelKey??"lineSpacing.options"),s=o&&!!r.onParagraphDialog;return jsxRuntime.jsx(Ie,{slot:"paragraph.dialog",icon:oe(a?.paths),disabled:!s,...n?{title:n}:{},onSelect:()=>{r.onParagraphDialog?.(),r.setOpenMenu(null);},...e?{className:e}:{},children:l})}var ak=Object.assign(rk,{docxSlot:"paragraph.dialog"}),nu=Object.assign(nk,{docxSlot:"file.pageSetup"});function ik({className:e,hidden:t}){let o=Na(),n=rt(),r=we();if(t)return null;let i=ee("image.insert"),a=r(i?.labelKey??"toolbar.image"),l=o?.isEnabled??false,s=o?.disabledReason??null;return jsxRuntime.jsx(Ie,{slot:"image.insert",icon:oe(i?.paths),disabled:!l,...s?{title:s}:{},onSelect:()=>{o?.openFilePicker(),n.setOpenMenu(null);},...e?{className:e}:{},children:a})}var ru=Object.assign(ik,{docxSlot:"image.insert"}),Fa=8;function Jt({labelKey:e,label:t,paths:o,className:n,children:r}){let i=we(),[a,l]=Lt.useState(false),s=Lt.useRef(null),c=Lt.useRef(null),d=Lt.useId();t===void 0&&e===void 0&&jf();let f=t??i(e??""),[u,g]=Lt.useState(null);return Lt.useLayoutEffect(()=>{if(!a){g(null);return}let p=s.current,m=c.current,b=p?.ownerDocument.defaultView;if(!p||!m||!b)return;let h=p.getBoundingClientRect(),v=m.offsetWidth,y=m.offsetHeight,C=h.right+v>b.innerWidth-Fa;g({left:C?Math.max(Fa,h.left-v):Math.min(h.right,b.innerWidth-v-Fa),top:Math.max(Fa,Math.min(h.top-4,b.innerHeight-y-Fa))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onKeyDown:p=>{p.key==="ArrowRight"&&editor.hostDocumentOf(s.current).activeElement===s.current?(p.preventDefault(),l(true),queueMicrotask(()=>{c.current&&Xt(In(c.current),"first");})):(p.key==="ArrowLeft"||p.key==="Escape")&&a&&(p.preventDefault(),p.stopPropagation(),l(false),s.current?.focus());},onBlur:p=>{p.currentTarget.contains(p.relatedTarget)||l(false);},children:[jsxRuntime.jsxs("button",{ref:s,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?d:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:q,onFocus:()=>l(true),onClick:()=>l(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:oe(o)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:f}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:d,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":f,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:p=>{let m=c.current;if(!m)return;let b=In(m);p.key==="ArrowDown"?(p.preventDefault(),p.stopPropagation(),Yt(b,editor.hostDocumentOf(m).activeElement,1)):p.key==="ArrowUp"&&(p.preventDefault(),p.stopPropagation(),Yt(b,editor.hostDocumentOf(m).activeElement,-1));},children:jsxRuntime.jsx(Cr.Provider,{value:-1,children:r})}):null]})}function lk({entry:e}){let{isEnabled:t}=ce(e.slot),o=ee(e.slot);return t?jsxRuntime.jsx(Jt,{labelKey:e.labelKey??o?.labelKey??e.slot,paths:o?.paths,children:jsxRuntime.jsx(Pr,{slot:e.slot})}):jsxRuntime.jsx(Bt,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function Ln({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function Oa({entry:e,children:t}){return e.kind==="separator"?jsxRuntime.jsx(Ln,{}):e.kind==="submenu"?jsxRuntime.jsx(Jt,{labelKey:e.labelKey,paths:e.paths,children:t??e.items.map((o,n)=>jsxRuntime.jsx(Oa,{entry:o},n))}):e.slot==="file.open"?jsxRuntime.jsx(Jd,{}):e.slot==="file.save"?jsxRuntime.jsx(Qd,{}):e.slot==="file.exportMarkdown"?jsxRuntime.jsx(eu,{}):e.slot==="file.exportPdf"?jsxRuntime.jsx(tu,{}):e.slot==="file.print"?jsxRuntime.jsx(ou,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(nu,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(ak,{}):e.slot==="insert.watermark"?jsxRuntime.jsx(Ml,{}):e.slot==="insert.bookmark"?jsxRuntime.jsx(_l,{}):e.slot==="insert.goToBookmark"?jsxRuntime.jsx(Zg,{}):e.slot==="image.insert"?jsxRuntime.jsx(ru,{}):e.picker==="tableGrid"?jsxRuntime.jsx(lk,{entry:e}):jsxRuntime.jsx(Bt,{slotId:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function Ug(e){if(!Lt.isValidElement(e))return null;let t=vr(e,Ug);if(t!==null)return t;let o=e.type;return typeof o!="function"&&typeof o!="object"?null:typeof o.docxSlot=="string"?o.docxSlot:o.docxMenuRow===true?Nl(e.props)??null:null}function sk(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function zg(e,t,o){return vl({entries:e??[],children:t,preset:o,keyOfEntry:sk,keyOfChild:Ug,childrenOfEntry:n=>n.kind==="submenu"?n.items:void 0,renderEntry:(n,r,i)=>jsxRuntime.jsx(Oa,{entry:n,children:i})})}function Qt({id:e,labelKey:t,label:o,icon:n,className:r,hidden:i,preset:a=true,children:l}){let{openMenu:s,setOpenMenu:c,activeMenu:d,opening:f}=rt(),u=Sg(),g=we(),p=Lt.useId(),m=Lt.useRef(null),b=Lt.useRef(null),h=Lt.useRef(false),v=Lt.useRef(false),y=editor.CHROME_MENUS.find(S=>S.id===e),C=s===e,T=_g(C&&e===xr,m,b);if(i)return null;let x=o??g(t??y?.labelKey??e),E=Mg(u,e,d);if(E.skip)return null;if(E.asSubmenu)return jsxRuntime.jsx(Jt,{labelKey:t??y?.labelKey??e,label:x,children:zg(y?.entries,l,a)});let P=zg(y?.entries,l,a),D=E.iconOnly,w=()=>{c(null),m.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,...E.rootAttributes,children:[jsxRuntime.jsxs("button",{ref:m,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":C,"aria-controls":C?p:void 0,className:"docx-menubar__trigger",disabled:f===true,tabIndex:E.tabStop?0:-1,...C?{"data-open":""}:{},...D?{"aria-label":x,title:x}:{},onMouseDown:q,onKeyDown:S=>{S.key==="ArrowDown"||S.key==="Enter"||S.key===" "||S.key==="ArrowUp"?(S.preventDefault(),h.current=true,c(e)):S.key==="Escape"&&C&&(S.preventDefault(),w());},onClick:()=>{if(v.current){v.current=false;return}c(C?null:e);},onMouseEnter:()=>{s!==null&&s!==e&&(v.current=true,c(e));},onMouseLeave:()=>{v.current=false;},children:[n?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:n}):null,D?null:x]}),C?jsxRuntime.jsx("div",{ref:S=>{b.current=S,S&&h.current&&(h.current=false,Xt(In(S),"first"));},id:p,role:"menu","aria-label":x,style:T,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:S=>{let L=b.current;if(!L)return;let I=In(L),F=editor.hostDocumentOf(L).activeElement;S.key==="ArrowDown"?(S.preventDefault(),Yt(I,F,1)):S.key==="ArrowUp"?(S.preventDefault(),Yt(I,F,-1)):S.key==="Home"?(S.preventDefault(),Xt(I,"first")):S.key==="End"?(S.preventDefault(),Xt(I,"last")):S.key==="Escape"?(S.preventDefault(),S.stopPropagation(),w()):S.key==="Tab"&&c(null);},children:jsxRuntime.jsx(Cr.Provider,{value:-1,children:P})}):null]})}function au(e){return Object.assign(o=>jsxRuntime.jsx(Qt,{id:e,...o}),{docxMenu:e})}var iu=au("file"),lu=au("format"),su=au("insert");var Ll=Lt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function en(){return Lt.useContext(Ll)}function Gg(){return Lt.useContext(Ll).target}var jg=["M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-560l-80-80 240-240h120v40L600-560ZM240-640q33 0 56.5-23.5T320-720q0-33-23.5-56.5T240-800q-33 0-56.5 23.5T160-720q0 33 23.5 56.5T240-640Zm240 180q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6Zm-240 300q33 0 56.5-23.5T320-240q0-33-23.5-56.5T240-320q-33 0-56.5 23.5T160-240q0 33 23.5 56.5T240-160Z"],Yg=["M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"],cu=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],Xg=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],Jg=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Qg=["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],eh=["M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"];function wr(e,t,o){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:l,hidden:s})=>{let c=H(),{close:d}=en(),f=we(),{isEnabled:u,disabledReason:g}=ce(t);return s?null:jsxRuntime.jsx(Ie,{slot:e,icon:r??oe(o.paths),shortcut:f(a??o.shortcutKey),disabled:!u,...g?{title:g}:{},onSelect:()=>{c?.exec(t),d(true);},...l?{className:l}:{},children:f(i??o.labelKey)})},{docxRow:e})}var Ba=wr("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:jg}),Wa=wr("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:Yg}),Za=wr("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Xg}),qa=wr("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:eh});function Dr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:s}=en(),c=Pe(),d=we(),f=Lt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:u,disabledReason:g}=ce(f);if(r)return null;let p=l!==null;return jsxRuntime.jsx(Ie,{slot:"edit.paste",icon:e??oe(cu),shortcut:d(o??"contextMenu.pasteShortcut"),disabled:!u||p,...l??g?{title:l??g??""}:{},onSelect:()=>{a(true),(async()=>{try{let{text:m,html:b}=await uk(c);(m||b)&&i?.exec({type:"paste",text:m,...b?{html:b}:{}});}catch(m){s(m instanceof Error?m.message:"the clipboard is not readable");}})();},...n?{className:n}:{},children:d(t??"contextMenu.paste")})}Dr.docxRow="edit.paste";async function uk(e){let t=editor.hostWindowOf(e),o=t.navigator.clipboard;if(typeof o.read=="function"&&typeof t.ClipboardItem<"u")try{let n=await o.read(),r="",i=null;for(let a of n)a.types.includes("text/plain")&&(r=await(await a.getType("text/plain")).text()),a.types.includes("text/html")&&(i=await(await a.getType("text/html")).text());if(r||i)return {text:r,html:i}}catch{}return {text:await o.readText(),html:null}}function Rr({icon:e,labelKey:t,shortcutKey:o,className:n,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:s}=en(),c=Pe(),d=we(),f=Lt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:u,disabledReason:g}=ce(f);if(r)return null;let p=l!==null;return jsxRuntime.jsx(Ie,{slot:"edit.pasteWithoutFormatting",icon:e??oe(cu),shortcut:d(o??"contextMenu.pasteWithoutFormattingShortcut"),disabled:!u||p,...l??g?{title:l??g??""}:{},onSelect:()=>{a(true),(async()=>{try{let m=await editor.hostWindowOf(c).navigator.clipboard.readText();m&&i?.exec({type:"pasteWithoutFormatting",text:m});}catch(m){s(m instanceof Error?m.message:"the clipboard is not readable");}})();},...n?{className:n}:{},children:d(t??"contextMenu.pasteWithoutFormatting")})}Rr.docxRow="edit.pasteWithoutFormatting";var oh=ee("format.painter")?.paths??[],Fl=wr("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:oh}),Hl=wr("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:oh});function Fn(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:s})=>{let{close:c}=en(),d=we(),f=Al(),{isEnabled:u,disabledReason:g,execute:p}=ce(t);return l||!f?null:jsxRuntime.jsx(Ie,{slot:e,icon:r??oe(o.paths),disabled:!u,...g?{title:g}:{},className:`${s??o.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{p()&&c(true);},children:d(i??o.labelKey)})},{docxRow:e})}var Mr=Fn("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),_r=Fn("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),Ir=Fn("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Nr=Fn("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),Lr=Fn("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),Fr=Fn("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),Hr=Fn("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),pk=[{alignment:"top",labelKey:"tableAdvanced.top",icon:"vertical_align_top"},{alignment:"center",labelKey:"tableAdvanced.middle",icon:"vertical_align_center"},{alignment:"bottom",labelKey:"tableAdvanced.bottom",icon:"vertical_align_bottom"}];function Hn({hidden:e}){let{close:t}=en(),o=we(),n=Al(),r=ce({type:"setTableCellVerticalAlignment",alignment:"top"}),i=ce({type:"setTableCellVerticalAlignment",alignment:"center"}),a=ce({type:"setTableCellVerticalAlignment",alignment:"bottom"}),l=[r,i,a];return e||!n?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":o("tableAdvanced.verticalAlignment"),children:pk.map((s,c)=>{let d=l[c];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":o(s.labelKey),title:d.disabledReason??o(s.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:f=>{f.preventDefault(),f.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:oe(editor.tableChromeIconPaths(s.icon))},s.alignment)})})]})}Hn.docxRow="table.cellVerticalAlignment";function nh(e,t,o){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let s=H(),{close:c,tocId:d}=en(),f=we(),u=Lt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:p}=ce(u);return l||d===null?null:jsxRuntime.jsx(Ie,{slot:e,icon:r??oe(o.paths),disabled:!g,...p?{title:p}:{},onSelect:()=>{s?.exec(u),c(true);},...a?{className:a}:{},children:f(i??o.labelKey)})},{docxRow:e})}var Ar=nh("toc.refresh","entire",{labelKey:"toc.refresh",paths:Jg}),Or=nh("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Qg});function Al(){return W(Lt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Ol({label:e,icon:t,shortcut:o,disabled:n,disabledReason:r,active:i,onSelect:a,className:l}){let{close:s}=en();return jsxRuntime.jsx(Ie,{...t?{icon:t}:{},...o?{shortcut:o}:{},...n?{disabled:n}:{},...n&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),s(true);},...l?{className:l}:{},children:e})}var An=Lt.createContext(false);function Mt(){return Lt.useContext(An)?"":"docx-editor "}var Zl=8;function vk(){let e=Lt.useContext(Rt),t=rt(),o=we(),{isEnabled:n,reason:r}=xl(o);if((e?.mounted??0)===0)return null;let i=ee("review.addComment");return jsxRuntime.jsx(Ie,{icon:oe(i?.paths),slot:"review.addComment",disabled:!n,title:r??void 0,onSelect:()=>{e?.requestCommentDraft()&&t.setOpenMenu(null);},children:o("comments.addComment")})}function xk(){let e=H(),t=rt(),o=we();return e?.can({type:"editTextFormField"}).ok?jsxRuntime.jsx(Ie,{slot:"field.edit",onSelect:()=>{t.setOpenMenu(null),e.exec({type:"editTextFormField"});},children:o("textFormField.edit")}):null}var Ck=[{kind:"row",id:"field.edit",render:()=>jsxRuntime.jsx(xk,{})},{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(Ba,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(Wa,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Dr,{})},{kind:"row",id:"edit.pasteWithoutFormatting",render:()=>jsxRuntime.jsx(Rr,{})},{kind:"row",id:"format.copyFormatting",render:()=>jsxRuntime.jsx(Fl,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(Hl,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(Za,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(qa,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(Bt,{slotId:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.addComment",render:()=>jsxRuntime.jsx(vk,{})}];function Tk(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Mr.docxRow,render:()=>jsxRuntime.jsx(Mr,{})},{kind:"row",id:_r.docxRow,render:()=>jsxRuntime.jsx(_r,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:Ir.docxRow,render:()=>jsxRuntime.jsx(Ir,{})},{kind:"row",id:Nr.docxRow,render:()=>jsxRuntime.jsx(Nr,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:Lr.docxRow,render:()=>jsxRuntime.jsx(Lr,{})},{kind:"row",id:Fr.docxRow,render:()=>jsxRuntime.jsx(Fr,{})},{kind:"row",id:Hr.docxRow,render:()=>jsxRuntime.jsx(Hr,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:Hn.docxRow,render:()=>jsxRuntime.jsx(Hn,{})}]}function Ek(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:Ar.docxRow,render:()=>jsxRuntime.jsx(Ar,{})},{kind:"row",id:Or.docxRow,render:()=>jsxRuntime.jsx(Or,{})}]}function Pk(e,t=false){return [...Ck,...e?Tk():[],...t?Ek():[]]}function ch(e){if(!Lt.isValidElement(e))return null;let t=vr(e,ch);if(t!==null)return t;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxRow=="string")return o.docxRow;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxMenuRow===true){let n=Nl(e.props);if(n)return n}return null}function lh(e){if(!Lt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function Sk(e){return e?.closest(".docx-editor__scroll-container")??null}function za({className:e,t,preset:o=true,disabled:n,onOpenChange:r,children:i}){let a=Mt(),l=H(),{t:s}=N(),c=Al(),d=Lt.useRef(null),f=Lt.useRef(null),[u,g]=Lt.useState(null),[p,m]=Lt.useState(null),[b,h]=Lt.useState(null),v=Lt.useMemo(()=>Pk(c,p!==null),[c,p]),[y,C]=Lt.useState(null),T=Lt.useCallback((I=false)=>{g(null),C(null),m(null),h(null),I&&l?.focus();},[l]);Lt.useEffect(()=>{if(n)return;let I=Sk(d.current);if(!I)return;let F=O=>{O.preventDefault();let k=O.button===-1||O.clientX===0&&O.clientY===0,_=I.getBoundingClientRect();m(l?.snapshot().tocContext?.id??null),h(k||!editor.isHTMLElementNode(O.target)?null:O.target),g(k?{x:_.left+16,y:_.top+16}:{x:O.clientX,y:O.clientY});};return I.addEventListener("contextmenu",F),()=>I.removeEventListener("contextmenu",F)},[n,l]),Lt.useEffect(()=>{n&&T();},[n,T]),Lt.useEffect(()=>{if(!u)return;let I=U=>{f.current?.contains(U.target)||T();},F=U=>{U.key==="Escape"?(U.preventDefault(),T(true)):U.key==="Tab"&&T();},O=()=>T(),k=editor.hostDocumentOf(d.current??f.current),_=editor.hostWindowOf(d.current??f.current);return k.addEventListener("pointerdown",I,true),k.addEventListener("keydown",F),k.addEventListener("scroll",O,{capture:true,passive:true}),_.addEventListener("blur",O),_.addEventListener("resize",O),()=>{k.removeEventListener("pointerdown",I,true),k.removeEventListener("keydown",F),k.removeEventListener("scroll",O,true),_.removeEventListener("blur",O),_.removeEventListener("resize",O);}},[u,T]),Lt.useLayoutEffect(()=>{let I=f.current;if(!u||!I)return;let{width:F,height:O}=I.getBoundingClientRect(),k=editor.hostWindowOf(I),_=k.innerWidth-F-Zl,U=k.innerHeight-O-Zl,z=Math.max(Zl,u.x>_?u.x-F:u.x),re=Math.max(Zl,u.y>U?u.y-O:u.y);C({x:z,y:re});},[u]),Lt.useLayoutEffect(()=>{y&&f.current?.focus({preventScroll:true});},[y]);let x=Lt.useRef(r);x.current=r;let E=Lt.useRef(false);Lt.useEffect(()=>{let I=u!==null;I!==E.current&&(E.current=I,x.current?.(I));},[u]);let P=Lt.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>T(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,T]),[D,w]=Lt.useState(null),S=Lt.useMemo(()=>({close:T,anchor:u,tocId:p,target:b,clipboardRefusal:D,reportClipboardRefusal:w}),[T,u,p,b,D]),L={position:"fixed",left:(y??u)?.x??0,top:(y??u)?.y??0,visibility:y?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:u?jsxRuntime.jsx(Ra.Provider,{value:P,children:jsxRuntime.jsx(Ll.Provider,{value:S,children:jsxRuntime.jsxs("div",{ref:f,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??s("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:L,onKeyDown:I=>{let F=f.current;if(!F)return;let O=In(F);I.key==="ArrowDown"?(I.preventDefault(),Yt(O,editor.hostDocumentOf(F).activeElement,1)):I.key==="ArrowUp"?(I.preventDefault(),Yt(O,editor.hostDocumentOf(F).activeElement,-1)):I.key==="Home"?(I.preventDefault(),Xt(O,"first")):I.key==="End"&&(I.preventDefault(),Xt(O,"last"));},children:[Lt.Children.toArray(i).filter(lh),vl({entries:v,children:Lt.Children.toArray(i).filter(I=>!lh(I)),preset:o,keyOfEntry:I=>I.id,keyOfChild:I=>Cg(ch(I)),renderEntry:I=>I.kind==="separator"?jsxRuntime.jsx(Ln,{}):I.render(),onUnmatched:(I,F)=>{F.props.hidden&&Vf(I);}})]})})}):null})}var mu=Object.assign(za,{Cut:Ba,Copy:Wa,Paste:Dr,PasteWithoutFormatting:Rr,Delete:Za,SelectAll:qa,InsertRowAbove:Mr,InsertRowBelow:_r,InsertColumnLeft:Ir,InsertColumnRight:Nr,DeleteTableRow:Lr,DeleteTableColumn:Fr,DeleteTable:Hr,CellVerticalAlignment:Hn,RefreshToc:Ar,RefreshTocPageNumbers:Or,Item:Ol,Slot:Bt,Row:Ie,Group:Ha,Separator:Ln,Submenu:Jt});var dh=Cd.Provider;function uh(){let e=Ct(),{t}=N();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e?.hyperlink&&Ee(e.hyperlink,{}),e?.contentControl&&Ee(e.contentControl,{}),e?.equation&&Ee(e.equation,{}),e?.contextMenu&&Ee(e.contextMenu,{t:o=>t(o)})]})}function ph(e,t,o,n){return {...e,hyperlink:e?.hyperlink??(t===false?false:r=>jsxRuntime.jsx(Pa,{...r})),contentControl:e?.contentControl??(r=>jsxRuntime.jsx(wa,{...r})),equation:e?.equation??(()=>jsxRuntime.jsx(Da,{})),contextMenu:e?.contextMenu!==void 0?e.contextMenu===false?false:r=>e.contextMenu&&Ee(e.contextMenu,{...r,t:n??r.t}):o===false?false:r=>jsxRuntime.jsx(za,{...r,t:n??r.t,...typeof o=="object"?o:{}})}}function Rk(e,t){return e===t?true:!e||!t||e.kind!==t.kind?false:e.kind==="note"&&t.kind==="note"?e.id===t.id:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:true}function fu(){let e=H(),t=Lt.useCallback(n=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),o=W(t,Rk);return o?.kind==="note"?o:null}function mh(e,t){return e===t?true:!e||!t?false:e.pos===t.pos&&e.numFmt===t.numFmt&&e.numStart===t.numStart&&e.numRestart===t.numRestart}function fh(e,t){return e.resolved.pos===t.resolved.pos&&e.resolved.numFmt===t.resolved.numFmt&&e.resolved.numStart===t.resolved.numStart&&e.resolved.numRestart===t.resolved.numRestart&&mh(e.documentAuthored,t.documentAuthored)&&mh(e.sectionAuthored,t.sectionAuthored)}function Mk(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&fh(e.footnote,t.footnote)&&fh(e.endnote,t.endnote)}function gu(){let e=H(),t=Lt.useCallback(o=>e?.getNotePropertiesState()??null,[e]);return W(t,Mk)}function $a(e,t){let[o,n]=Lt.useState(null),r=Lt.useCallback(l=>n(l),[]),[i,a]=Lt.useState({visibility:"hidden"});return Lt.useLayoutEffect(()=>{let l=o?.closest(".docx-editor__scroll-container"),s=l??o?.parentElement?.querySelector(".docx-editor__scroll-container");if(!o||!s)return;let c=editor.hostWindowOf(s),d=0,f=null,u=new c.ResizeObserver(()=>p()),g=()=>{d=0;let b=e(s);if(b!==f&&(u.disconnect(),u.observe(s),u.observe(o),b&&u.observe(b),f=b),!b||!b.isConnected){a({visibility:"hidden"});return}let h=b.getBoundingClientRect(),v=t==="story-label"?Math.max(o.offsetHeight,28):o.offsetHeight,y=t==="story-label"?6:4,C=l===s,T=t==="after"?h.bottom+6:h.top-v-y,x=C?gr(s,h.left,T):{left:h.left,top:T},E=x.left,P=x.top,D=C?s.scrollLeft+8:8;a({position:C?"absolute":"fixed",left:t==="story-label"?E:Math.max(D,E+8),top:t==="story-label"?P:Math.max(C?s.scrollTop+8:8,P),...t==="story-label"?{width:Math.max(240,Math.min(h.width,s.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(h.width-16,s.clientWidth-16))},visibility:"visible"});},p=()=>{d||(d=c.requestAnimationFrame(g));};u.observe(s),u.observe(o);let m=new c.MutationObserver(p);return m.observe(s,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),s.addEventListener("scroll",p,{passive:true}),c.addEventListener("resize",p),g(),()=>{d&&c.cancelAnimationFrame(d),u.disconnect(),m.disconnect(),s.removeEventListener("scroll",p),c.removeEventListener("resize",p);}},[o,e,t]),{ref:r,style:i}}var Fk=/^(footnote|endnote):(-?\d{1,10})$/;function bh(e){let t=Fk.exec(e);if(!t)return null;let o=Number(t[2]);return Number.isInteger(o)?{noteKind:t[1],noteId:o}:null}function Hk(e){let t=editor.hostWindowOf(e);return typeof t.matchMedia!="function"?false:t.matchMedia("(pointer: coarse)").matches}function bu(e){let t=H();return Lt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function Ak(e){let{t}=N(),[o,n]=Lt.useState(false),r=Lt.useRef(null);return Lt.useEffect(()=>{if(!o)return;let i=l=>{r.current?.contains(l.target)||n(false);},a=editor.hostDocumentOf(r.current);return a.addEventListener("mousedown",i),()=>a.removeEventListener("mousedown",i)},[o]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":o,"aria-haspopup":"menu",onMouseDown:q,onClick:()=>n(i=>!i),children:t("headerFooter.options")}),o?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:q,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),n(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),n(false);},children:t("common.close")})]}):null]})}function zl({className:e}){let t=Ct(),o=Lt.useRef(null),{t:n}=N(),r=H(),i=fu(),[a,l]=Lt.useState(null),[s,c]=Lt.useState(null),[d,f]=Lt.useState(false),u=Lt.useRef(null),g=Lt.useCallback(L=>{if(!i)return null;let F=[...L.querySelectorAll("[data-docx-note-scope]")].find(O=>O.matches("[data-docx-note]")&&O.dataset.docxNoteScope===i.id)??null;return F?.closest("[data-docx-notes]")??F},[i]),p=$a(g,"story-label"),m=Lt.useCallback(()=>{u.current&&u.current.win.clearTimeout(u.current.handle),u.current=null,l(null);},[]);Lt.useEffect(()=>{if(!r)return;let L=o.current?.closest(".docx-editor__scroll-container")??o.current?.closest(".docx-editor");if(!L)return;let I=k=>{let _=k.target;if(!_)return;let U=_.closest("[data-docx-note-ref]");if(U?.dataset.docxNoteScope){k.preventDefault(),m(),c(null),r.setActiveScope({kind:"note",id:U.dataset.docxNoteScope});return}_.closest("[data-docx-note-mark-back]")&&(k.preventDefault(),m(),c(null),r.setActiveScope({kind:"body"}));},F=k=>{let _=k,z=_.target?.closest("[data-docx-note-scope]");z?.dataset.docxNoteScope&&(_.preventDefault(),c({scopeId:z.dataset.docxNoteScope,x:_.clientX,y:_.clientY}));},O=k=>{let _=k.target;if(Hk(_))return;let U=_?.closest("[data-docx-note-ref]");if(!U?.dataset.docxNoteScope){m();return}let z=U.dataset.docxNoteScope,X=r.getNotePreviewText(z)??U.getAttribute("aria-description")??n("notes.previewFallback"),ae=U.getBoundingClientRect();u.current&&u.current.win.clearTimeout(u.current.handle);let K=editor.hostWindowOf(U),J=K.setTimeout(()=>{l({scopeId:z,text:X,x:ae.left,y:ae.bottom+4});},400);u.current={win:K,handle:J};};return L.addEventListener("click",I),L.addEventListener("contextmenu",F),L.addEventListener("pointerover",O),L.addEventListener("scroll",m,true),()=>{L.removeEventListener("click",I),L.removeEventListener("contextmenu",F),L.removeEventListener("pointerover",O),L.removeEventListener("scroll",m,true),m();}},[r,m,n]);let b=Lt.useCallback(L=>{r&&(r.exec(L),c(null));},[r]),h=s?bh(s.scopeId):null,v=Lt.useMemo(()=>h?{type:"deleteNote",noteKind:h.noteKind,noteId:h.noteId}:null,[h]),y=Lt.useMemo(()=>h?{type:"convertNote",fromKind:h.noteKind,noteId:h.noteId}:null,[h]),C=Lt.useMemo(()=>h?{type:"convertAllNotes",fromKind:h.noteKind}:null,[h]),T=bu(v??{type:"deleteNote",noteKind:"footnote",noteId:0}),x=bu(y??{type:"convertNote",fromKind:"footnote",noteId:0}),E=bu(C??{type:"convertAllNotes",fromKind:"footnote"}),P=i?bh(i.id):null,D=P?n("notes.editingRegion",{kind:P.noteKind==="footnote"?n("notes.footnoteKind"):n("notes.endnoteKind"),number:P.noteId}):null,w=s&&h?{...s,...h,onDelete:()=>{v&&b(v);},onConvert:()=>{y&&b(y);},onConvertAll:()=>{C&&b(C);},onOpenProperties:()=>f(true),onClose:()=>c(null),deleteEnabled:T.enabled,convertEnabled:x.enabled,convertAllEnabled:E.enabled,deleteDisabledReason:T.reason??void 0,convertDisabledReason:x.reason??void 0,convertAllDisabledReason:E.reason??void 0}:null,S={onClose:()=>f(false),onApply:L=>{b(L),f(false);}};return r?jsxRuntime.jsxs("div",{className:e,ref:o,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":i?void 0:true,children:[i&&P?jsxRuntime.jsxs("div",{ref:p.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":n("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":i.id,style:{...p.style,zIndex:ht.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:D}),jsxRuntime.jsx(Ak,{onOpenProperties:()=>f(true),onClose:()=>r.setActiveScope({kind:"body"})})]}):null,a&&t?.notePreview!==false?t?.notePreview?Ee(t.notePreview,a):jsxRuntime.jsx(mr,{...a}):null,w&&t?.notesContextMenu!==false?t?.notesContextMenu?Ee(t.notesContextMenu,w):jsxRuntime.jsx(fr,{...w}):null,d&&t?.noteProperties!==false?t?.noteProperties?Ee(t.noteProperties,S):jsxRuntime.jsx($l,{...S}):null]}):null}function $l(e){let{t}=N(),o=H(),n=gu(),[r,i]=Lt.useState("document"),[a,l]=Lt.useState("decimal"),[s,c]=Lt.useState("continuous"),[d,f]=Lt.useState("pageBottom"),[u,g]=Lt.useState("decimal"),[p,m]=Lt.useState("continuous"),[b,h]=Lt.useState("docEnd");Lt.useEffect(()=>{n&&(l(n.footnote.resolved.numFmt),c(n.footnote.resolved.numRestart),f(n.footnote.resolved.pos),g(n.endnote.resolved.numFmt),m(n.endnote.resolved.numRestart),h(n.endnote.resolved.pos));},[n]);let v=!n?.footnote.documentAuthored&&!n?.footnote.sectionAuthored,y=!n?.endnote.documentAuthored&&!n?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","data-docx-modal":"","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:ht.modal},onClick:e.onClose,onKeyDown:C=>{C.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:C=>C.stopPropagation(),onMouseDown:C=>C.stopPropagation(),children:[jsxRuntime.jsx("h2",{className:"docx-note-properties__title",children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-note-properties__body",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__scope",children:[jsxRuntime.jsx("span",{children:t("notes.scope")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:r,onChange:C=>i(C.target.value),children:[jsxRuntime.jsx("option",{value:"document",children:t("notes.scopeDocument")}),jsxRuntime.jsx("option",{value:"section",children:t("notes.scopeSection")})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.footnotes")}),v?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange:C=>l(C.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:s,onChange:C=>c(C.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:d,onChange:C=>f(C.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsxRuntime.jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.endnotes")}),y?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:u,onChange:C=>g(C.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:p,onChange:C=>m(C.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:b,"data-testid":"docx-notes-endnote-position",onChange:C=>h(C.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsxRuntime.jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__footer",children:[jsxRuntime.jsx("button",{className:"docx-note-properties__button",type:"button",onClick:e.onClose,children:t("common.cancel")}),jsxRuntime.jsx("button",{className:"docx-note-properties__button docx-note-properties__button--primary",type:"button","data-testid":"docx-notes-properties-apply",onClick:()=>{if(!o)return;let C={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?n?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:s,position:d},endnote:{numFmt:u,numRestart:p,position:b}};o.can(C).ok&&e.onApply(C);},children:t("common.apply")})]})]})})}var Ch=e=>e.image;function xh(e){return Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(t=>t.offsetParent!==null||t===editor.hostDocumentOf(e).activeElement)}function zk(e){e&&!e.closest(".docx-editor")&&e.classList.add("docx-editor");}function $k(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Pu(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String(Qo(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Qo(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(Qo(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Qo(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function Uk(e,t){let o=Pu(t);return e.horizontalPoints!==o.horizontalPoints||e.verticalPoints!==o.verticalPoints||e.relativeToH!==o.relativeToH||e.relativeToV!==o.relativeToV}function Ul(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let o=Ia(t);return Number.isInteger(o)?o:null}function Vk(e,t){let o=Pu(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let c=e.horizontalPoints!==o.horizontalPoints,d=e.verticalPoints!==o.verticalPoints,f=c?Ul(e.horizontalPoints):t.position?.horizontalEmu,u=d?Ul(e.verticalPoints):t.position?.verticalEmu;return c&&f===null?{ok:false}:d&&u===null?{ok:false}:f===void 0||u===void 0?{ok:false}:{ok:true,value:{horizontalEmu:f,verticalEmu:u}}}let n=e.horizontalPoints!==o.horizontalPoints,r=e.verticalPoints!==o.verticalPoints,i=e.relativeToH!==o.relativeToH,a=e.relativeToV!==o.relativeToV,l=n?Ul(e.horizontalPoints):t.position?.horizontalEmu,s=r?Ul(e.verticalPoints):t.position?.verticalEmu;return n&&l===null?{ok:false}:r&&s===null?{ok:false}:{ok:true,value:{...typeof l=="number"?{horizontalEmu:l}:{},...typeof s=="number"?{verticalEmu:s}:{},...i||n||r?{relativeToH:e.relativeToH}:{},...a||n||r?{relativeToV:e.relativeToV}:{}}}}function Vl(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function Gl(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Va({open:e,onClose:t,className:o,triggerRef:n}){let r=H(),{t:i}=N(),a=W(Ch),l=Lt.useId(),s=Lt.useId(),c=Lt.useId(),d=Lt.useRef(null),f=Lt.useRef(null),u=Lt.useRef(null),g=Lt.useRef(null),[p,m]=Lt.useState(null),[b,h]=Lt.useState(null),v=f.current,y=v?.canCrop===false,C=v?.canResize===false,T=v?.locks.changeAspect===true,x=v?.kind==="anchored"&&v.canMove===true,E=v?.kind==="inline",P=v?.kind==="anchored"&&v.canMove===false;Lt.useEffect(()=>{if(!e){f.current=null,u.current=null,g.current=null;return}if(!a)return;if(f.current=a,r?.surface){let{anchor:U}=r.surface.state().selection;u.current={paragraphId:U.paragraphId,offset:U.offset},g.current=r.surface.session.packageRevision();}h(null);let k=Pu(a),_=a.crop;m({widthPoints:String(Qo(a.widthEmu)),heightPoints:String(Qo(a.heightEmu)),cropLeft:String(_.left),cropTop:String(_.top),cropRight:String(_.right),cropBottom:String(_.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...k});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let D=Lt.useCallback(()=>{n?.current?.focus(),r?.focus();},[r,n]),w=Lt.useCallback(()=>{t(),D();},[t,D]);Lt.useEffect(()=>{if(!e)return;let k=d.current;if(!k)return;let _=xh(k);(_.find(X=>X.id==="image-prop-width"&&!X.hasAttribute("disabled"))??_.find(X=>!X.hasAttribute("disabled"))??k).focus();let z=X=>{if(X.key==="Escape"){X.preventDefault(),w();return}if(X.key!=="Tab")return;let ae=xh(k);if(ae.length===0)return;let K=editor.hostDocumentOf(k).activeElement,J=ae.findIndex(A=>A===K);if(J===-1)return;X.preventDefault();let B=X.shiftKey?(J-1+ae.length)%ae.length:(J+1)%ae.length;ae[B]?.focus();},re=editor.hostDocumentOf(k);return re.addEventListener("keydown",z),()=>re.removeEventListener("keydown",z)},[e,w]);let S=Lt.useMemo(()=>{let k=v??a;return !k||k.widthEmu<=0?1:k.widthEmu/k.heightEmu},[a,v]),L=Lt.useCallback(k=>{m(_=>{if(!_)return _;if(!_.lockAspect)return {..._,widthPoints:k};let U=Gl(k);if(U===null)return {..._,widthPoints:k};let z=Math.round(U/S*100)/100;return {..._,widthPoints:k,heightPoints:String(z)}});},[S]),I=Lt.useCallback(k=>{m(_=>{if(!_)return _;if(!_.lockAspect)return {..._,heightPoints:k};let U=Gl(k);if(U===null)return {..._,heightPoints:k};let z=Math.round(U*S*100)/100;return {..._,widthPoints:String(z),heightPoints:k}});},[S]),F=Lt.useCallback(()=>{let k=f.current;if(!k?.intrinsic)return;let _=k.intrinsic.pixelWidth*72/k.intrinsic.dpiX,U=k.intrinsic.pixelHeight*72/k.intrinsic.dpiY;m(z=>z&&{...z,widthPoints:String(Math.round(_*100)/100),heightPoints:String(Math.round(U*100)/100)});},[a]),O=Lt.useCallback(()=>{let k=f.current,_=u.current,U=g.current;if(!r||!k||!p||!_||U===null)return;let z={type:"setImageProperties",drawingNodeId:k.id,expectedPackageRevision:U,selectionParagraphId:_.paragraphId,selectionOffset:_.offset};if(!C){let B=Gl(p.widthPoints),A=Gl(p.heightPoints);if(B===null||A===null){h("imageProperties.errors.invalidDimensions");return}let M=Ia(B),j=Ia(A);M!==k.widthEmu&&(z.widthEmu=M),j!==k.heightEmu&&(z.heightEmu=j);}if(k.canCrop&&!y){let B=Vl(p.cropLeft),A=Vl(p.cropTop),M=Vl(p.cropRight),j=Vl(p.cropBottom);if(B===null||A===null||M===null||j===null){h("imageProperties.errors.invalidCrop");return}let ue=k.crop;(B!==ue.left||A!==ue.top||M!==ue.right||j!==ue.bottom)&&(z.crop={left:B,top:A,right:M,bottom:j});}p.title!==k.title&&(z.title=p.title),p.description!==k.description&&(z.description=p.description);let re=p.hyperlink.trim();if(re!==(k.hyperlink??"")&&(z.hyperlink=re===""?null:re),k.canChangeWrap&&p.wrap!==k.wrap&&(z.wrap=p.wrap),k.kind==="anchored"&&k.canMove&&Uk(p,k)){let B=Vk(p,k);if(!B.ok){h("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(B.value,k))){h("imageProperties.errors.invalidPosition");return}Object.assign(z,B.value);}if(!(z.widthEmu!==void 0||z.heightEmu!==void 0||z.title!==void 0||z.description!==void 0||z.hyperlink!==void 0||z.crop!==void 0||z.wrap!==void 0||z.horizontalEmu!==void 0||z.verticalEmu!==void 0||z.relativeToH!==void 0||z.relativeToV!==void 0)){w();return}if(!r.can(z).ok){h("imageProperties.errors.refused");return}if(!r.exec(z).ok){h("imageProperties.errors.refused");return}w();},[r,p,y,C,w]);return !e||!p?null:jsxRuntime.jsx("div",{ref:zk,className:`docx-dialog-overlay${o?` ${o}`:""}`,onClick:w,onMouseDown:k=>{k.stopPropagation(),$k(k);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","data-docx-modal":"","aria-labelledby":l,className:"docx-dialog docx-image-properties-dialog",onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),children:[jsxRuntime.jsx("div",{id:l,className:"docx-dialog__header",children:i("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[b?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:i(b)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:i("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:p.widthPoints,disabled:C,onChange:k=>L(k.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:i("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:p.heightPoints,disabled:C,onChange:k=>I(k.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.lockAspect,disabled:T,onChange:k=>m(_=>_&&{..._,lockAspect:k.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:y||!v?.intrinsic,onClick:F,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),E?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,P?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:i("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:p.relativeToH??"page",onChange:k=>m(_=>_&&{..._,relativeToH:k.target.value}),children:editor.DRAWING_REL_FROM_H.map(k=>jsxRuntime.jsx("option",{value:k,children:i(`dialogs.imagePosition.relativeOptions.${k}`)},k))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:i("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:p.relativeToV??"line",onChange:k=>m(_=>_&&{..._,relativeToV:k.target.value}),children:editor.DRAWING_REL_FROM_V.map(k=>jsxRuntime.jsx("option",{value:k,children:i(`dialogs.imagePosition.relativeOptions.${k}`)},k))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:i("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:p.horizontalPoints,onChange:k=>m(_=>_&&{..._,horizontalPoints:k.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:i("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:p.verticalPoints,onChange:k=>m(_=>_&&{..._,verticalPoints:k.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:i("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:p.title,onChange:k=>m(_=>_&&{..._,title:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:i("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:p.description,onChange:k=>m(_=>_&&{..._,description:k.target.value}),placeholder:i("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:c,className:"docx-dialog__input docx-dialog__input--full",value:p.hyperlink,onChange:k=>m(_=>_&&{..._,hyperlink:k.target.value}),placeholder:i("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:s,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:s,className:"docx-dialog__select docx-dialog__input--full",value:p.wrap,disabled:v?.canChangeWrap===false,onChange:k=>m(_=>_&&{..._,wrap:k.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(k=>jsxRuntime.jsx("option",{value:k,children:i(`imageWrap.targets.${k}`)},k))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:i("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:y,value:p.cropLeft,onChange:k=>m(_=>_&&{..._,cropLeft:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:i("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:y,value:p.cropTop,onChange:k=>m(_=>_&&{..._,cropTop:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:i("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:y,value:p.cropRight,onChange:k=>m(_=>_&&{..._,cropRight:k.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:i("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:y,value:p.cropBottom,onChange:k=>m(_=>_&&{..._,cropBottom:k.target.value})})]}),y?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:w,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:O,children:i("common.apply")})]})]})})}function jl({className:e,hidden:t,asChild:o,children:n}){let r=Ct(),i=H(),{t:a}=N(),l=W(Ch),[s,c]=Lt.useState(false),d=Lt.useRef(null),f={type:"setImageProperties",description:"probe"},u=i&&l?i.can(f):null,g=u?.ok===true,p=u&&!u.ok?u.reason:null;if(t)return null;let m=ee("image.properties"),b={type:"button",ref:d,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":a("formattingBar.imagePropertiesShortcut"),title:p??a("formattingBar.imagePropertiesShortcut"),onMouseDown:q,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o?jsxRuntime.jsx(Y,{...b,children:n}):jsxRuntime.jsx("button",{...b,children:n??oe(m?.paths)}),s&&r?.imageProperties!==false?r?.imageProperties?Ee(r.imageProperties,{open:s,onClose:()=>c(false),triggerRef:d}):jsxRuntime.jsx(Va,{open:s,onClose:()=>c(false),triggerRef:d}):null]})}jl.docxSlot="image.properties";var Wr=Object.assign(jl,{docxSlot:"image.properties"});function Ga(e){let t=H(),o=Lt.useCallback(()=>editor.toolbarCommandState(t,e),[t,e]),n=W(o,(r,i)=>r.value===i.value&&r.enabled===i.enabled&&r.disabledReason===i.disabledReason);return Lt.useMemo(()=>({execute:(r,i)=>editor.runToolbarCommand(t,e,r,i),value:n.value===void 0?null:e==="font.size"||e==="list.lineSpacing"?Number(n.value):n.value,options:e==="image.wrap"?editor.IMAGE_WRAP_TARGETS:[],isEnabled:n.enabled,disabledReason:n.disabledReason}),[t,e,n])}function Yl({className:e,hidden:t,asChild:o,children:n}){let r=Ct(),i=te(),{execute:a,value:l,isEnabled:s,disabledReason:c}=Ga("image.altText"),[d,f]=Lt.useState(false),[u,g]=Lt.useState(""),p=Lt.useRef(null),m=Lt.useRef(null),b=Lt.useId();Lt.useEffect(()=>{d&&g(l??"");},[d,l]),Lt.useEffect(()=>{if(!d)return;let x=D=>{let w=p.current;editor.isDomNode(D.target)&&(w?.contains(D.target)||w?.ownerDocument.getElementById(b)?.contains(D.target))||f(false);},E=D=>{D.key==="Escape"&&(D.preventDefault(),f(false),m.current?.focus());},P=editor.hostDocumentOf(p.current);return P.addEventListener("mousedown",x,true),P.addEventListener("keydown",E),()=>{P.removeEventListener("mousedown",x,true),P.removeEventListener("keydown",E);}},[d,b]);let h=Lt.useCallback(()=>{a(u),f(false);},[u,a]);if(t)return null;let v=ee("image.altText"),y=i(v?.labelKey??"formattingBar.altText"),C={type:"button",ref:m,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!s,...s?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?b:void 0,"aria-label":y,title:c??y,onMouseDown:q,onClick:()=>f(x=>!x)},T={id:b,value:u,onValueChange:g,onApply:h,onClose:()=>f(false),isEnabled:s,anchorRef:m};return jsxRuntime.jsxs("div",{ref:p,className:"docx-toolbar__alt-text",children:[o?jsxRuntime.jsx(Y,{...C,children:n}):jsxRuntime.jsx("button",{...C,children:n??y}),d&&r?.imageAltText!==false?r?.imageAltText?Ee(r.imageAltText,T):jsxRuntime.jsx(Xl,{...T}):null]})}Yl.docxSlot="image.altText";var ja=Object.assign(Yl,{docxSlot:"image.altText"});function Xl({id:e,value:t,onValueChange:o,onApply:n,onClose:r,isEnabled:i,className:a}){let{t:l}=N();return jsxRuntime.jsxs("div",{id:e,role:"dialog","aria-label":l("imageAltText.panelTitle"),className:`docx-toolbar__alt-text-panel${a?` ${a}`:""}`,onMouseDown:s=>s.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${e}-description`,children:l("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${e}-description`,className:"docx-dialog__textarea",value:t,onChange:s=>o(s.target.value),placeholder:l("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:r,children:l("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",disabled:!i,onClick:n,children:l("common.apply")})]})]})}var Sh=Lt.createContext(void 0),kh=Sh.Provider;function Xe(){let e=Lt.useContext(Sh),{t}=N();return Lt.useCallback((o,n)=>{let r=e?.(o,n);return r===void 0||r===o?t(o,n):r},[e,t])}function wu(e){let[t,o]=Lt.useState(e.session),[n,r]=Lt.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(sw,{...e},n)}function sw({session:e,className:t,style:o,children:n}){let r=Xe(),[i,a]=Lt.useState(e.signal.aborted),l=Lt.useRef(null);return Lt.useEffect(()=>{let s=()=>a(true);return e.signal.addEventListener("abort",s,{once:true}),e.signal.aborted&&s(),()=>e.signal.removeEventListener("abort",s)},[e]),i?null:jsxRuntime.jsx(ze,{kind:"invalidTextFormField",role:"alertdialog",label:r("textFormField.invalidTitle"),className:t,style:o,panelRef:l,dismissOutside:false,onClose:e.acknowledge,sessionSignal:e.signal,restoreFocus:false,onKeyDown:s=>{s.key==="Enter"&&!s.nativeEvent.isComposing&&(s.preventDefault(),e.acknowledge());},children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("header",{className:"docx-dialog__header",children:jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:r("textFormField.invalidTitle")})}),jsxRuntime.jsx("div",{className:"docx-dialog__body",children:r(e.type==="number"?"textFormField.invalidNumber":"textFormField.invalidDate")}),jsxRuntime.jsx("footer",{className:"docx-dialog__footer",children:jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:e.acknowledge,children:r("textFormField.apply")})})]})})}var Rh=Lt.createContext(null),Mh=Rh.Provider;function at(){let e=Lt.useContext(Rh);if(!e)throw new globalThis.Error("useContentControlWidget must be rendered inside DocxEditorContentControlWidget.");return e}function xw(e){return e.kind==="date"?editor.parseIsoDate(e.value)?e.value.slice(0,10):"":e.value}function _h(e){let t=`docx-cc-list-${Lt.useId()}`,[o,n]=Lt.useState(()=>xw(e)),[r,i]=Lt.useState(()=>editor.calendarDateText(e.value,e.locale)),a=Lt.useMemo(()=>editor.createContentControlListNavigation(e.locale),[e]),[l,s]=Lt.useState(false),c=Lt.useCallback(S=>{i(S),s(false);},[]),d=W(()=>e.canApply()),f=e.kind==="date"?editor.parseIsoDate(e.value):null,[u,g]=Lt.useState(()=>{let S=f??new Date;return {year:S.getFullYear(),month:S.getMonth()}}),p=Lt.useCallback(S=>{let L=e.apply(S??o);return s(!L),L},[e,o]),m=Lt.useCallback(()=>e.cancel(),[e]),b=Lt.useCallback(async S=>{if(!e.replaceImage)return s(true),false;try{let L=S instanceof Uint8Array?S.byteLength:S.size;if(!e.canApply()||L>store.DEFAULT_IMAGE_RESOURCE_LIMITS.maxEncodedBytes)return s(!0),!1;let I=S instanceof Uint8Array?S:new Uint8Array(await S.arrayBuffer()),F=await e.replaceImage(I);return s(!F),F}catch{return s(true),false}},[e]),h=Lt.useMemo(()=>editor.calendarMonth(u.year,u.month,{locale:e.locale,selected:e.kind==="date"?e.value:null}),[u,e]),v=Lt.useCallback(()=>{g(S=>editor.shiftMonth(S.year,S.month,-1)),E(null);},[]),y=Lt.useCallback(()=>{g(S=>editor.shiftMonth(S.year,S.month,1)),E(null);},[]),C=Lt.useCallback(S=>p(S),[p]),T=Lt.useCallback(()=>p(editor.isoDateOf(new Date)),[p]),[x,E]=Lt.useState(null),P=Lt.useCallback(S=>{let L=editor.parseIsoDate(S);L&&(g({year:L.getFullYear(),month:L.getMonth()}),E(editor.isoDateOf(L)));},[]),D=Lt.useCallback(()=>{let S=editor.calendarDateFromText(r,e.locale);return S?p(S):(s(true),false)},[r,e.locale,p]),w=Lt.useCallback((S,L)=>{!Number.isInteger(S)||S<100||S>9999||!Number.isInteger(L)||L<0||L>11||(g({year:S,month:L}),E(null));},[]);return Lt.useMemo(()=>({session:e,kind:e.kind,items:e.items,value:o,setValue:n,isEnabled:d,refused:l,apply:p,cancel:m,calendar:h,previousMonth:v,nextMonth:y,selectDay:C,selectToday:T,focusIso:x,focusDay:P,dateText:r,setDateText:c,applyDateText:D,showMonth:w,listNavigation:a,listId:t,accept:editor.CONTENT_CONTROL_PICTURE_ACCEPT,replaceImage:b}),[e,b,o,d,l,p,m,h,v,y,C,T,x,P,r,c,D,w,a,t])}function Je(e,t,o,n){if(t.hidden)return null;let{children:r,asChild:i,className:a,style:l,hidden:s,id:c,title:d,"aria-label":f,...u}=t,g=r===void 0?n:r,{key:p,...m}=o,b={...c!==void 0?{id:c}:{},...d!==void 0?{title:d}:{},...f!==void 0?{"aria-label":f}:{}};if(i){let{className:v,style:y,...C}=m;return jsxRuntime.jsx(Y,{...u,...C,...b,...a?{className:a}:{},style:{...y,...l},children:g},p)}return jsxRuntime.jsx(e,{...u,...m,...b,className:[o.className,a].filter(Boolean).join(" "),style:{...o.style,...l},children:g},p)}var Wn=e=>e.stopPropagation();function _u(e){return Je("div",e,{className:"docx-content-control-calendar-header","data-docx-part":"header"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Iu,{}),jsxRuntime.jsx(qu,{}),jsxRuntime.jsx(Nu,{}),jsxRuntime.jsx(Lu,{className:"docx-content-control-calendar-announcement"})]}))}function Iu(e){let t=at(),o=Xe();return Je("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"previousMonth","aria-label":o("contentControl.calendar.previousMonth"),onMouseDown:Wn,onClick:t.previousMonth},"\u2039")}function Nu(e){let t=at(),o=Xe();return Je("button",e,{type:"button",className:"docx-content-control-calendar-nav","data-docx-part":"nextMonth","aria-label":o("contentControl.calendar.nextMonth"),onMouseDown:Wn,onClick:t.nextMonth},"\u203A")}function Lu(e){let t=at();return Je("div",e,{className:"docx-content-control-calendar-title","data-docx-part":"title","aria-live":"polite"},t.calendar.title)}function Fu(e){let t=at();return Je("div",e,{className:"docx-content-control-calendar-weekdays","data-docx-part":"weekdays"},t.calendar.weekdays.map((o,n)=>jsxRuntime.jsx("span",{children:o},n)))}function Hu({day:e,...t}){let o=at(),n=o.calendar.days.find(i=>i.iso===o.focusIso)??o.calendar.days.find(i=>i.selected)??o.calendar.days.find(i=>i.today&&!i.otherMonth)??o.calendar.days.find(i=>!i.otherMonth),r=i=>{if(i.nativeEvent.isComposing||i.altKey||i.ctrlKey||i.metaKey)return;let a=editor.calendarDateForKey(e.iso,i.key,o.session.locale,i.shiftKey);a&&(i.preventDefault(),o.focusDay(a));};return Je("button",t,{type:"button",className:"docx-content-control-calendar-day","data-docx-part":"day","data-iso":e.iso,role:"gridcell",tabIndex:e.iso===n?.iso?0:-1,"aria-label":e.label,...e.selected?{"data-selected":"","aria-selected":true}:{},"aria-current":e.today?"date":void 0,"aria-selected":e.selected,...e.today?{"data-today":""}:{},...e.otherMonth?{"data-other-month":""}:{},disabled:!o.isEnabled,onMouseDown:Wn,onClick:()=>o.selectDay(e.iso),onKeyDown:r},String(e.day))}function Au(e){let t=at(),o=Lt.useRef(null);return Lt.useLayoutEffect(()=>{let n=o.current;if(!n||n.ownerDocument.activeElement?.closest("[data-docx-part=previousMonth],[data-docx-part=nextMonth],[data-docx-part=month],[data-docx-part=year]"))return;((t.focusIso?n.querySelector(`[data-iso="${t.focusIso}"]`):null)??n.querySelector("[data-selected]")??n.querySelector("[data-today]:not([data-other-month])")??n.querySelector('[data-docx-part="day"]:not([data-other-month])'))?.focus({preventScroll:true});},[t.focusIso,t.calendar]),Je("div",e,{ref:o,className:"docx-content-control-calendar-grid","data-docx-part":"grid",role:"grid","aria-label":t.calendar.title},Array.from({length:6},(n,r)=>jsxRuntime.jsx("div",{role:"row",className:"docx-content-control-calendar-week",children:t.calendar.days.slice(r*7,r*7+7).map(i=>jsxRuntime.jsx(Hu,{day:i},i.iso))},r)))}function Ou(e){let t=at(),o=Xe();return Je("button",e,{type:"button",className:"docx-content-control-calendar-today","data-docx-part":"today",disabled:!t.isEnabled,onMouseDown:Wn,onClick:t.selectToday},o("contentControl.calendar.today"))}function Bu(e){return Je("div",e,{className:"docx-content-control-calendar","data-docx-part":"calendar"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_u,{}),jsxRuntime.jsx(Fu,{}),jsxRuntime.jsx(Au,{}),jsxRuntime.jsxs("div",{className:"docx-content-control-calendar-entry","data-docx-part":"dateEntry",children:[jsxRuntime.jsx(Ou,{}),jsxRuntime.jsx(Ql,{})]}),jsxRuntime.jsx(Zr,{}),jsxRuntime.jsx(ts,{})]}))}function Wu({item:e,...t}){let o=at();return Je("button",t,{type:"button",className:"docx-content-control-menu-item","data-docx-part":"item","data-value":e.value,role:"option",tabIndex:o.items.findIndex(n=>n.value===o.value)<0?o.items[0]===e?0:-1:o.value===e.value?0:-1,"aria-selected":o.value===e.value,disabled:!o.isEnabled,onMouseDown:Wn,onClick:()=>o.apply(e.value)},e.displayText)}function Jl(e){let t=at(),o=Xe();return Je("div",e,{className:"docx-content-control-menu-list","data-docx-part":"list",role:"listbox",id:t.listId,"aria-label":o(`contentControl.types.${t.kind}`)},t.kind==="buildingBlockGallery"&&t.items.length===0?jsxRuntime.jsx("div",{className:"docx-content-control-menu-empty","data-docx-part":"empty",role:"note",tabIndex:0,children:o("contentControl.gallery.empty")}):t.items.map((n,r)=>jsxRuntime.jsx(Wu,{item:n},r)))}function Ql(e){let t=at(),o=Xe();return Je("input",e,{type:"text",className:"docx-content-control-menu-input","data-docx-part":"input","aria-label":o(`contentControl.types.${t.kind}`),value:t.kind==="date"?t.dateText:t.value,placeholder:t.kind==="date"?editor.calendarDateText("2006-11-22",t.session.locale):void 0,"aria-invalid":t.refused||void 0,role:t.kind==="comboBox"?"combobox":void 0,"aria-expanded":t.kind==="comboBox"?true:void 0,"aria-controls":t.kind==="comboBox"?t.listId:void 0,"aria-autocomplete":t.kind==="comboBox"?"list":void 0,onKeyDown:n=>{n.key!=="Enter"||n.nativeEvent.isComposing||(n.preventDefault(),n.stopPropagation(),t.kind==="date"?t.applyDateText():t.apply());},onMouseDown:Wn,onChange:n=>(t.kind==="date"?t.setDateText:t.setValue)(n.target.value)},void 0)}function Zr(e){let t=at(),o=Xe();return t.refused?Je("div",e,{className:"docx-content-control-widget-error","data-docx-part":"error",role:"alert"},o("disabledReason.invalidValue")):null}function Zu(e){let t=at(),o=Xe();return Je("button",e,{type:"button",className:"docx-dialog__button docx-dialog__button--primary","data-docx-part":"apply",disabled:!t.isEnabled,onClick:()=>t.kind==="date"?t.applyDateText():t.apply()},o("common.apply"))}function es(e){let t=at(),o=Xe();return Je("button",e,{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t.cancel},o("common.cancel"))}function ts(e){return Je("div",e,{className:"docx-dialog__footer","data-docx-part":"footer"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(es,{}),jsxRuntime.jsx(Zu,{})]}))}function qu(e){return Je("div",e,{className:"docx-content-control-calendar-navigation","data-docx-part":"navigation"},jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ku,{}),jsxRuntime.jsx(zu,{})]}))}function Ku(e){let t=at(),o=Xe();return Je("select",e,{className:"docx-content-control-calendar-month","data-docx-part":"month","aria-label":o("contentControl.calendar.month"),value:t.calendar.month,onChange:n=>t.showMonth(t.calendar.year,Number(n.target.value))},editor.calendarMonthNames(t.session.locale).map((n,r)=>jsxRuntime.jsx("option",{value:r,children:n},r)))}function zu(e){let t=at(),o=Xe();return Je("input",e,{type:"number",min:100,max:9999,className:"docx-content-control-calendar-year","data-docx-part":"year","aria-label":o("contentControl.calendar.year"),key:t.calendar.year,defaultValue:t.calendar.year,onBlur:n=>{let r=Number(n.target.value);if(!Number.isInteger(r)||r<100||r>9999){n.target.value=String(t.calendar.year);return}t.showMonth(r,t.calendar.month);},onKeyDown:n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&(n.preventDefault(),n.currentTarget.blur());}},void 0)}function $u({autoOpen:e,...t}){let o=at(),n=Xe(),r=Lt.useRef(null),i=Lt.useRef(false);return Lt.useLayoutEffect(()=>{e!==false&&!i.current&&(i.current=true,r.current?.click());},[e]),Je("input",t,{ref:r,type:"file",accept:o.accept,className:"docx-content-control-picture-input","data-docx-part":"picture","aria-label":n("contentControl.types.picture"),"aria-invalid":o.refused||void 0,onMouseDown:Wn,onCancel:o.cancel,onChange:a=>{let l=a.target.files?.[0];a.target.value="",l&&o.replaceImage(l);}},void 0)}function Rw(e){let[t,o]=Lt.useState(e.session),[n,r]=Lt.useState(0);return t!==e.session&&(o(e.session),r(n+1)),jsxRuntime.jsx(Mw,{...e},n)}function Mw({session:e,className:t,style:o,children:n}){let r=Xe(),i=_h(e),[a,l]=Lt.useState(e.signal.aborted),s=Lt.useRef(null),[c]=Lt.useState(()=>editor.contentControlPopupOpener(e.anchor)),d=e.kind==="checkbox"&&n===void 0;if(Lt.useEffect(()=>{let u=()=>l(true);return e.signal.addEventListener("abort",u,{once:true}),e.signal.aborted&&u(),()=>e.signal.removeEventListener("abort",u)},[e]),Lt.useEffect(()=>{!d||e.signal.aborted||e.apply(e.value==="true"?"false":"true");},[d,e]),Lt.useLayoutEffect(()=>{if(a||d)return;let u=s.current,g=u?.ownerDocument,p=u&&e.anchor?editor.observeContentControlPopup(u,e.anchor):void 0;return u?.querySelector('[data-docx-part="grid"]')||(u?.querySelector("input")??u?.querySelector('[role=option][tabindex="0"]')??u?.querySelector("select,button,[data-docx-part=empty]"))?.focus({preventScroll:true}),()=>{p?.();let m=g?.activeElement;c?.isConnected&&(m===g?.body||m&&u?.contains(m))&&c.focus({preventScroll:true});}},[e,a,d,c]),Lt.useEffect(()=>{let u=s.current;if(!u||a||d)return;let g=p=>{u.contains(p.target)||e.cancel();};return u.ownerDocument.addEventListener("pointerdown",g,true),()=>u.ownerDocument.removeEventListener("pointerdown",g,true)},[e,a,d]),a||d)return null;let f=r(`contentControl.types.${e.kind}`);return jsxRuntime.jsx(Mh,{value:i,children:jsxRuntime.jsx("div",{ref:s,role:"dialog","aria-label":f,className:`docx-content-control-widget-popup${t?` ${t}`:""}`,style:o,"data-docx-popup":"contentControlWidget","data-docx-part":"popup","data-kind":e.kind,onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{editor.contentControlPopupKeyDown(u.currentTarget,u.nativeEvent,e.cancel),i.listNavigation.keyDown(u.nativeEvent,u.currentTarget);},children:n??_w(i)})})}function _w(e){return e.kind==="date"?jsxRuntime.jsx(Bu,{}):e.kind==="picture"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($u,{}),jsxRuntime.jsx(Zr,{}),jsxRuntime.jsx(es,{})]}):e.kind==="comboBox"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ql,{}),jsxRuntime.jsx(Jl,{}),jsxRuntime.jsx(Zr,{}),jsxRuntime.jsx(ts,{})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jl,{}),jsxRuntime.jsx(Zr,{})]})}var ju=Object.assign(Rw,{Navigation:qu,Month:Ku,Year:zu,Calendar:Bu,Header:_u,PreviousMonth:Iu,Title:Lu,NextMonth:Nu,Weekdays:Fu,Grid:Au,Day:Hu,Today:Ou,List:Jl,Item:Wu,Input:Ql,Picture:$u,Error:Zr,Footer:ts,Apply:Zu,Cancel:es});var go=At();function Lw(){return go.useState()}function Fw({session:e,...t}){let[o,n]=Lt.useState(e),[r,i]=Lt.useState(0);return o!==e&&(n(e),i(r+1)),e?jsxRuntime.jsx(Hw,{session:e,...t},r):null}function Hw({session:e,children:t,preset:o,className:n,style:r}){let i=Xe(),a=W(()=>e.canApply()),[l,s]=Lt.useState(()=>({defaultText:e.field.defaultText,type:e.field.type,maxLength:e.field.maxLength,format:e.field.format,enabled:e.field.enabled})),[c,d]=Lt.useState(e.signal.aborted),[f,u]=Lt.useState(false);Lt.useEffect(()=>{let v=()=>d(true);return e.signal.addEventListener("abort",v),e.signal.aborted&&v(),()=>e.signal.removeEventListener("abort",v)},[e]);let g=()=>{if(e.signal.aborted)return;let v=Number.isInteger(l.maxLength)&&l.maxLength>=0&&l.maxLength<=32767&&e.apply(l.defaultText,{type:l.type,maxLength:l.maxLength,format:l.format,enabled:l.enabled});u(!v);},p={values:l,setValue(v,y){s(C=>({...C,[v]:y,...v==="type"?{format:""}:{}})),u(false);},errors:f?{form:i("textFormField.invalidOptions")}:{},isEnabled:!c&&a,apply:g,cancel:e.cancel};if(c)return null;let m=editor.TEXT_FORM_FORMATS[l.type]??[],b={Uppercase:"textFormField.uppercase",Lowercase:"textFormField.lowercase","First capital":"textFormField.firstCapital","Title case":"textFormField.titleCase"},h=(v,y)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":v,className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label",children:i(`textFormField.${v}`)}),y]});return jsxRuntime.jsx(ze,{kind:"textFormField",className:n,style:r,label:i("textFormField.title"),onClose:e.cancel,dismissOutside:false,sessionSignal:e.signal,restoreFocus:false,onKeyDown:v=>{v.key==="Escape"&&(v.preventDefault(),e.cancel()),v.key==="Enter"&&editor.isHTMLElementNode(v.target)&&v.target.localName==="input"&&(v.preventDefault(),g());},children:jsxRuntime.jsx(go.Composition,{state:p,preset:o,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:i("textFormField.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[h("defaultText",jsxRuntime.jsx("input",{className:"docx-dialog__input",value:l.defaultText,onChange:v=>p.setValue("defaultText",v.target.value)})),h("type",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:l.type,onChange:v=>p.setValue("type",v.target.value),children:[["regular","number","date"].map(v=>jsxRuntime.jsx("option",{value:v,children:i(`textFormField.${v}`)},v)),Object.hasOwn(editor.TEXT_FORM_FORMATS,l.type)?null:jsxRuntime.jsx("option",{value:l.type,disabled:true,children:i("textFormField.preservedType")})]})),h("maxLength",jsxRuntime.jsx("input",{className:"docx-dialog__input",type:"number",min:0,max:32767,step:1,value:Number.isNaN(l.maxLength)?"":l.maxLength,onChange:v=>p.setValue("maxLength",v.target.valueAsNumber)})),h("format",jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:l.format,onChange:v=>p.setValue("format",v.target.value),children:[m.map(v=>jsxRuntime.jsx("option",{value:v,children:b[v]?i(b[v]):v||i("textFormField.noFormat")},v)),m.includes(l.format)?null:jsxRuntime.jsx("option",{value:l.format,disabled:true,children:l.format||i("textFormField.noFormat")})]})),jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":"enabled",className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:l.enabled,onChange:v=>p.setValue("enabled",v.target.checked)}),i("textFormField.enabled")]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",className:"docx-dialog__error",role:"alert",children:p.errors.form}),jsxRuntime.jsx("button",{"data-docx-part":"cancel",className:"docx-dialog__button",type:"button",onClick:e.cancel,children:i("textFormField.cancel")}),jsxRuntime.jsx("button",{disabled:!a,"data-docx-part":"apply",className:"docx-dialog__button docx-dialog__apply",type:"button",onClick:g,children:i("textFormField.apply")})]})]}),children:t})})}var Qa=Object.assign(Fw,{Header:go.Header,Title:go.Title,Body:go.Body,Footer:go.Footer,Apply:go.Apply,Cancel:go.Cancel,Error:go.Error,Field:go.Field});var Lh="(prefers-color-scheme: dark)";function Fh(){return typeof globalThis.window<"u"&&typeof globalThis.window.matchMedia=="function"}function Hh(){return Fh()?globalThis.window.matchMedia(Lh).matches:false}function Ah(e,t){return e==="dark"||e==="system"&&t}function Oh(e){if(!Fh())return ()=>{};let t=globalThis.window.matchMedia(Lh);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}function Xu(e){return e==="checkbox"?"contentControlCheckbox":e==="picture"?"contentControlPicture":"contentControlWidget"}function Wh(){let e=H(),t=Ct(),o=Lt.useRef(t);o.current=t;let[n,r]=Lt.useState(null),[i,a]=Lt.useState(null),l=t?.contentControlWidget!==void 0,s=t?.contentControlCheckbox!==void 0,c=t?.contentControlPicture!==void 0,d=t?.invalidTextFormField!==void 0;Lt.useEffect(()=>{if(!e||!l&&!s&&!c)return;let u=true,g=[...l?["dropdown","comboBox","date","buildingBlockGallery"]:[],...s?["checkbox"]:[],...c?["picture"]:[]],p=e.setContentControlWidgetChrome({kinds:g,onRequest(m){if(o.current?.[Xu(m.kind)]===false)return m.cancel();r(m),m.signal.addEventListener("abort",()=>{u&&r(b=>b===m?null:b);},{once:true});}},{fallback:true});return ()=>{u=false,p(),r(null);}},[e,l,s,c]),Lt.useEffect(()=>{if(!e||!d)return;let u=true,g=e.setInvalidTextFormFieldChrome({onRequest(p){if(o.current?.invalidTextFormField===false)return p.cancel();a(p),p.signal.addEventListener("abort",()=>{u&&a(m=>m===p?null:m);},{once:true});}},{fallback:true});return ()=>{u=false,g(),a(null);}},[e,d]),Lt.useEffect(()=>{n&&t?.[Xu(n.kind)]===false&&n.cancel(),t?.invalidTextFormField===false&&i?.cancel();},[t,n,i]);let f=n?t?.[Xu(n.kind)]:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n&&f&&Ee(f,{session:n},n),i&&t?.invalidTextFormField&&Ee(t.invalidTextFormField,{session:i},i)]})}var qw=e=>e.pageSetup??null,Kw=e=>e.editable;function qn(){let e=H(),t=W(qw),o=W(Kw),n=Lt.useMemo(()=>o&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,o]),r=Lt.useCallback(i=>e?e.exec({...i.pageWidthTwips!==void 0?{pageWidth:i.pageWidthTwips}:{},...i.pageHeightTwips!==void 0?{pageHeight:i.pageHeightTwips}:{},...i.orientation!==void 0?{orientation:i.orientation}:{},...i.marginTopTwips!==void 0?{marginTop:i.marginTopTwips}:{},...i.marginRightTwips!==void 0?{marginRight:i.marginRightTwips}:{},...i.marginBottomTwips!==void 0?{marginBottom:i.marginBottomTwips}:{},...i.marginLeftTwips!==void 0?{marginLeft:i.marginLeftTwips}:{},...i.scope!==void 0?{scope:i.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Lt.useMemo(()=>({pageSetup:t,isEnabled:n,apply:r}),[t,n,r])}var Qu=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],$h=1440,Uw=e=>Math.round(e/$h*100)/100,Vw=e=>Math.round(e*$h);function Gw(e,t){let o=Math.min(e,t),n=Math.max(e,t);return Qu.findIndex(r=>Math.abs(r.width-o)<20&&Math.abs(r.height-n)<20)}var Kh=12240,zh=15840,on=1440;function jw({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),l=Vo(e,t),{pageSetup:s,isEnabled:c,apply:d}=qn(),[f,u]=Lt.useState(Kh),[g,p]=Lt.useState(zh),[m,b]=Lt.useState("portrait"),[h,v]=Lt.useState(on),[y,C]=Lt.useState(on),[T,x]=Lt.useState(on),[E,P]=Lt.useState(on),[D,w]=Lt.useState(false),[S,L]=Lt.useState("document"),I=Lt.useRef(null),F=Lt.useRef("no");Lt.useEffect(()=>{if(!e){F.current="no";return}if(F.current==="yes"&&s===null){F.current="no";return}F.current==="yes"||F.current==="loading"&&s===null||(w(false),u(s?.pageWidthTwips??Kh),p(s?.pageHeightTwips??zh),b(s?.orientation??"portrait"),v(s?.marginsTwips.top??on),C(s?.marginsTwips.bottom??on),x(s?.marginsTwips.left??on),P(s?.marginsTwips.right??on),L("document"),F.current=s===null?"loading":"yes");},[e,s]);let O=Lt.useCallback(K=>{let J=Qu[K];J&&(u(m==="landscape"?J.height:J.width),p(m==="landscape"?J.width:J.height));},[m]),k=Lt.useCallback(K=>{K!==m&&(b(K),u(g),p(f));},[m,f,g]),_=Lt.useCallback(()=>{if(!c)return;if(!l()){t();return}let K=d({pageWidthTwips:f,pageHeightTwips:g,orientation:m,marginTopTwips:h,marginRightTwips:E,marginBottomTwips:y,marginLeftTwips:T,scope:S});w(!K),K&&t();},[c,l,d,f,g,m,h,E,y,T,S,t]);if(!e)return null;let U=Gw(f,g),z=(K,J,B)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":`margin${K[0].toUpperCase()}${K.slice(1)}`,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a(`dialogs.pageSetup.${K}`)}),jsxRuntime.jsx("input",{type:"number",className:"docx-dialog__input",min:0,max:22,step:.1,value:Uw(J),onChange:A=>B(Math.max(0,Vw(Number(A.target.value)||0))),"aria-label":a(`dialogs.pageSetup.${K}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:"in"})]}),re={pageWidth:f,pageHeight:g,orientation:m,marginTop:h,marginBottom:y,marginLeft:T,marginRight:E,scope:S},X={pageWidth:u,pageHeight:p,orientation:k,marginTop:v,marginBottom:C,marginLeft:x,marginRight:P,scope:L},ae={values:re,setValue(K,J){X[K](J);},errors:D?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:_,cancel:t};return jsxRuntime.jsx(ze,{kind:"pageSetup",className:o,style:n,panelRef:I,label:a("dialogs.pageSetup.title"),onClose:t,onKeyDown:K=>{K.key==="Escape"&&t(),K.key==="Enter"&&editor.isHTMLElementNode(K.target)&&K.target.localName==="input"&&c&&(K.preventDefault(),_());},children:jsxRuntime.jsx(bo.Composition,{state:ae,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.pageSetup.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"pageSize",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:U,onChange:K=>O(Number(K.target.value)),"aria-label":a("dialogs.pageSetup.sizeLabel"),children:[Qu.map((K,J)=>jsxRuntime.jsx("option",{value:J,children:a(K.labelKey)},K.labelKey)),U<0&&jsxRuntime.jsx("option",{value:-1,children:a("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"orientation",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:m,onChange:K=>k(K.target.value),"aria-label":a("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:a("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:a("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label docx-dialog__section-label--spaced",children:a("dialogs.pageSetup.margins")}),z("top",h,v),z("bottom",y,C),z("left",T,x),z("right",E,P),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"scope",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",children:a("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{className:"docx-dialog__input",value:S,onChange:K=>L(K.target.value),"aria-label":a("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:a("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:a("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",className:"docx-dialog__error",children:D?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:_,children:a("common.apply")})]})]}),children:r})})}var bo=At();function Yw(){return bo.useState()}var Kn=Object.assign(jw,{Header:bo.Header,Title:bo.Title,Body:bo.Body,Footer:bo.Footer,Apply:bo.Apply,Cancel:bo.Cancel,Error:bo.Error,Field:bo.Field});var eD={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},tD=e=>{let t=e.formatting??null;if(!t)return null;let o=t.indent,n=t.paragraphFlags??eD;return {alignment:t.alignment==="both"?"justify":t.alignment??null,direction:t.direction??null,spaceBeforePt:t.spaceBeforePt??null,spaceAfterPt:t.spaceAfterPt??null,lineSpacing:t.lineSpacing??null,indentLeftTwips:o&&!o.mixed.left?o.left:null,indentRightTwips:o&&!o.mixed.right?o.right:null,indentFirstLineTwips:o&&!o.mixed.firstLine?o.firstLine:null,contextualSpacing:n.contextualSpacing,keepNext:n.keepNext,keepLines:n.keepLines,widowControl:n.widowControl,pageBreakBefore:n.pageBreakBefore,tabStops:t.tabStops??null,indentUnknown:!o,disagrees:{alignment:t.disagrees?.alignment??false,direction:t.disagrees?.direction??false,spaceBeforePt:t.disagrees?.spaceBeforePt??false,spaceAfterPt:t.disagrees?.spaceAfterPt??false,lineSpacing:t.disagrees?.lineSpacing??false,tabStops:t.disagrees?.tabStops??false,indentLeft:o?.mixed.left??false,indentRight:o?.mixed.right??false,indentFirstLine:o?.mixed.firstLine??false}}},oD=["alignment","direction","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],nD=(e,t)=>oD.every(o=>e.disagrees[o]===t.disagrees[o]),rD=(e,t)=>e===null||t===null?e===t:e.alignment===t.alignment&&e.direction===t.direction&&e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value&&e.indentLeftTwips===t.indentLeftTwips&&e.indentRightTwips===t.indentRightTwips&&e.indentFirstLineTwips===t.indentFirstLineTwips&&e.contextualSpacing===t.contextualSpacing&&e.keepNext===t.keepNext&&e.keepLines===t.keepLines&&e.widowControl===t.widowControl&&e.pageBreakBefore===t.pageBreakBefore&&nD(e,t)&&e.indentUnknown===t.indentUnknown&&e.tabStops?.length===t.tabStops?.length&&(e.tabStops??[]).every((o,n)=>o.positionTwips===t.tabStops?.[n]?.positionTwips&&o.alignment===t.tabStops?.[n]?.alignment&&(o.leader??"none")===(t.tabStops?.[n]?.leader??"none")),aD=e=>e.editable;function ep(){let e=H(),t=W(tD,rD),o=W(aD),n=Lt.useMemo(()=>o&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,o]),r=Lt.useCallback(i=>{if(!e)return false;let a={type:"setParagraphFormat",...i};return e.can(a).ok?e.exec(a).ok:false},[e]);return {format:t,isEnabled:n,apply:r}}function sD({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),l=Vo(e,t),{format:s,isEnabled:c,apply:d}=ep(),[f,u]=Lt.useState("left"),[g,p]=Lt.useState("ltr"),[m,b]=Lt.useState(0),[h,v]=Lt.useState(0),[y,C]=Lt.useState("none"),[T,x]=Lt.useState(0),[E,P]=Lt.useState(0),[D,w]=Lt.useState(0),[S,L]=Lt.useState("multiple"),[I,F]=Lt.useState(1.08),[O,k]=Lt.useState(false),[_,U]=Lt.useState(false),[z,re]=Lt.useState(false),[X,ae]=Lt.useState(true),[K,J]=Lt.useState(false),[B,A]=Lt.useState([]),[M,j]=Lt.useState(false),[ue,de]=Lt.useState(0),[ge,Ye]=Lt.useState("left"),[yt,Dt]=Lt.useState("none"),[Me,vt]=Lt.useState(editor.NO_MIXED_FIELDS),[ko,wo]=Lt.useState(false),zo=$=>a(ko&&($==="indentLeft"||$==="indentRight"||$==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),Ut=Lt.useRef(editor.NO_MIXED_FIELDS),ie=Lt.useId(),[ot,Te]=Lt.useState(false),$o=Lt.useRef(null),so=Lt.useRef(false),Ht=Lt.useRef(null);Lt.useEffect(()=>{if(!e){so.current=false;return}if(so.current||s===null)return;let $=editor.seedFields(s);u($.alignment),p($.direction),b($.indentLeft),v($.indentRight),C($.special),x($.specialBy),P($.spaceBefore),w($.spaceAfter),L($.lineRule),F($.lineValue),k($.contextualSpacing),U($.keepNext),re($.keepLines),ae($.widowControl),J($.pageBreakBefore),A($.tabStops),j(false);let xe=editor.mixedFieldsOf(s);vt(xe),wo(s.indentUnknown),de(0),Ye("left"),Dt("none"),Ut.current=xe,Te(false),Ht.current=$,so.current=true;},[e,s]);let Tn=Lt.useCallback(()=>{if(!c)return;if(!l()){t();return}let $=Ht.current,xe=$===null?null:editor.changedFields($,{alignment:f,direction:g,indentLeft:m,indentRight:h,special:y,specialBy:T,spaceBefore:E,spaceAfter:D,lineRule:S,lineValue:I,contextualSpacing:O,keepNext:_,keepLines:z,widowControl:X,pageBreakBefore:K,tabStops:B,clearedAllTabStops:M},Ut.current,Me);if(xe===null){t();return}if(d(xe)){Te(false),t();return}Te(true);},[c,l,d,t,Me,M,f,g,m,h,y,T,E,D,S,I,O,_,z,X,K,B]),le=Lt.useCallback(()=>{let $=Math.round(ue);return $<=0?false:(vt(xe=>({...xe,tabStops:false})),A(editor.withTabStop(B,{positionTwips:$,alignment:ge,...yt!=="none"?{leader:yt}:{}})),de(0),Ye("left"),Dt("none"),true)},[B,ue,ge,yt]);if(!e)return null;let se=$=>vt(xe=>({...xe,[$]:false})),_e=($,xe,Uo,pt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":pt,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-${$}`,children:a(`dialogs.paragraph.${$}`)}),jsxRuntime.jsx("input",{id:`${ie}-${$}`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Me[pt]?"":editor.twipsToInches(xe),placeholder:Me[pt]?zo(pt):void 0,onChange:ha=>{se(pt),Uo(editor.inchesToTwips(Number(ha.target.value)||0));},"aria-label":a(`dialogs.paragraph.${$}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),ye=($,xe,Uo,pt)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":$,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-${$}`,children:a(`dialogs.paragraph.${$}`)}),jsxRuntime.jsx("input",{id:`${ie}-${$}`,type:"number",className:"docx-dialog__input",min:0,step:1,value:Me[pt]?"":xe,placeholder:Me[pt]?zo(pt):void 0,onChange:ha=>{se(pt),Uo(Math.max(0,Number(ha.target.value)||0));},"aria-label":a(`dialogs.paragraph.${$}`)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitPoints")})]}),nt=($,xe,Uo)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":$,className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:xe,ref:pt=>{pt&&(pt.indeterminate=Me[$]);},onChange:pt=>{vt(ha=>({...ha,[$]:false})),Uo(pt.target.checked);}}),a(`dialogs.paragraph.${$}`)]}),Do={alignment:f,direction:g,indentLeft:m,indentRight:h,special:y,specialBy:T,spaceBefore:E,spaceAfter:D,lineRule:S,lineValue:I,contextualSpacing:O,keepNext:_,keepLines:z,widowControl:X,pageBreakBefore:K,tabStops:B,clearedAllTabStops:M},co=$=>{let xe=Ut.current;$!==g&&!xe.direction&&!xe.alignment&&u(editor.alignmentAfterDirectionChange),p($);},jc={alignment:u,direction:co,indentLeft:b,indentRight:v,special:C,specialBy:x,spaceBefore:P,spaceAfter:w,lineRule:L,lineValue:F,contextualSpacing:k,keepNext:U,keepLines:re,widowControl:ae,pageBreakBefore:J,tabStops:A,clearedAllTabStops:j},kf={values:Do,mixed:Me,setValue($,xe){jc[$](xe),$==="lineRule"?(se("lineSpacing"),F(xe===Ht.current?.lineRule?Ht.current.lineValue:xe==="multiple"?1.08:12)):$==="specialBy"?se("special"):$ in Me&&se($);},errors:ot?{form:a("dialogs.paragraph.refused")}:{},isEnabled:c,apply:Tn,cancel:t};return jsxRuntime.jsx(ze,{kind:"paragraph",className:o,style:n,panelRef:$o,label:a("dialogs.paragraph.title"),onClose:t,onKeyDown:$=>{$.key==="Escape"&&t();let xe=editor.isHTMLElementNode($.target)&&($.target.localName==="button"||$.target.localName==="select");if($.key==="Enter"&&!xe){let Uo=$.target;if(editor.isHTMLElementNode(Uo)&&Uo.dataset.docxTabEntry!==void 0){le();return}c&&Tn();}},children:jsxRuntime.jsx(yo.Composition,{state:kf,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.paragraph.title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-dialog__body",children:jsxRuntime.jsxs("div",{className:"docx-dialog__columns",children:[jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"alignment",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-alignment`,children:a("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${ie}-alignment`,className:"docx-dialog__input",value:Me.alignment?"":f,onChange:$=>{se("alignment"),u($.target.value);},"aria-label":a("dialogs.paragraph.alignment"),children:[Me.alignment?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.alignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.alignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.alignRight")}),jsxRuntime.jsx("option",{value:"justify",children:a("dialogs.paragraph.alignJustify")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"direction",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-direction`,children:a("dialogs.paragraph.direction")}),jsxRuntime.jsxs("select",{id:`${ie}-direction`,className:"docx-dialog__input",value:Me.direction?"":g,onChange:$=>{se("direction"),co($.target.value);},"aria-label":a("dialogs.paragraph.direction"),children:[Me.direction?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"rtl",children:a("dialogs.paragraph.directionRtl")}),jsxRuntime.jsx("option",{value:"ltr",children:a("dialogs.paragraph.directionLtr")})]})]}),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.indentation")}),_e("beforeText",m,b,"indentLeft"),_e("afterText",h,v,"indentRight"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"special",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-special`,children:a("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${ie}-special`,className:"docx-dialog__input",value:Me.special?"":y,onChange:$=>{se("special"),C($.target.value);},"aria-label":a("dialogs.paragraph.special"),children:[Me.special?jsxRuntime.jsx("option",{value:"",children:zo("special")}):null,jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.specialNone")}),jsxRuntime.jsx("option",{value:"firstLine",children:a("dialogs.paragraph.specialFirstLine")}),jsxRuntime.jsx("option",{value:"hanging",children:a("dialogs.paragraph.specialHanging")})]})]}),y!=="none"?jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"specialBy",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-by`,children:a("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${ie}-by`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:Me.special?"":editor.twipsToInches(T),placeholder:Me.special?zo("special"):void 0,onChange:$=>{se("special"),x(Math.max(0,editor.inchesToTwips(Number($.target.value)||0)));},"aria-label":a("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"tabStops",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.tabStops")}),B.length===0?jsxRuntime.jsx("div",{className:"docx-dialog__note",children:a(Me.tabStops?"dialogs.paragraph.tabMixed":"dialogs.paragraph.tabEmpty")}):B.map($=>jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("span",{className:"docx-dialog__label docx-dialog__tab-position",children:a("dialogs.paragraph.tabPositionLabel",{position:editor.formatInches($.positionTwips)})}),jsxRuntime.jsx("span",{className:"docx-dialog__tab-description",children:a(editor.TAB_ALIGNMENT_LABELS[$.alignment])}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>A(B.filter(xe=>xe!==$)),"aria-label":a("dialogs.paragraph.tabRemoveAt",{position:editor.formatInches($.positionTwips)}),children:a("dialogs.paragraph.tabRemove")})]},$.positionTwips)),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-tabPosition`,children:a("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${ie}-tabPosition`,type:"number",className:"docx-dialog__input",min:0,step:.1,value:editor.twipsToInches(ue),onChange:$=>de(Math.max(0,editor.inchesToTwips(Number($.target.value)||0))),"aria-label":a("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-tabAlignment`,children:a("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${ie}-tabAlignment`,className:"docx-dialog__input",value:ge,onChange:$=>Ye($.target.value),"aria-label":a("dialogs.paragraph.tabAlignment"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"left",children:a("dialogs.paragraph.tabAlignLeft")}),jsxRuntime.jsx("option",{value:"center",children:a("dialogs.paragraph.tabAlignCenter")}),jsxRuntime.jsx("option",{value:"right",children:a("dialogs.paragraph.tabAlignRight")}),jsxRuntime.jsx("option",{value:"decimal",children:a("dialogs.paragraph.tabAlignDecimal")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-tabLeader`,children:a("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${ie}-tabLeader`,className:"docx-dialog__input",value:yt,onChange:$=>Dt($.target.value),"aria-label":a("dialogs.paragraph.tabLeader"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"none",children:a("dialogs.paragraph.tabNone")}),jsxRuntime.jsx("option",{value:"dot",children:a("dialogs.paragraph.tabLeaderDot")}),jsxRuntime.jsx("option",{value:"hyphen",children:a("dialogs.paragraph.tabLeaderHyphen")}),jsxRuntime.jsx("option",{value:"underscore",children:a("dialogs.paragraph.tabLeaderUnderscore")})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row docx-dialog__row--actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:le,children:a("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>{vt($=>({...$,tabStops:false})),j(true),A([]);},children:a("dialogs.paragraph.tabClearAll")})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__column",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.spacing")}),ye("spaceBefore",E,P,"spaceBefore"),ye("spaceAfter",D,w,"spaceAfter"),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineRule",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-lineSpacing`,children:a("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${ie}-lineSpacing`,className:"docx-dialog__input",value:Me.lineSpacing?"":S,onChange:$=>{let xe=$.target.value;se("lineSpacing"),L(xe),F(xe===Ht.current?.lineRule?Ht.current.lineValue:xe==="multiple"?1.08:12);},"aria-label":a("dialogs.paragraph.lineSpacing"),children:[Me.lineSpacing?jsxRuntime.jsx("option",{value:"",children:a("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"multiple",children:a("dialogs.paragraph.ruleMultiple")}),jsxRuntime.jsx("option",{value:"atLeast",children:a("dialogs.paragraph.ruleAtLeast")}),jsxRuntime.jsx("option",{value:"exact",children:a("dialogs.paragraph.ruleExactly")})]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"lineValue",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${ie}-at`,children:a("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${ie}-at`,type:"number",className:"docx-dialog__input",min:.01,step:S==="multiple"?.01:1,value:Me.lineSpacing?"":I,disabled:Me.lineSpacing,onChange:$=>{let xe=$.target.value.trim();F(xe===""?S==="multiple"?1.08:12:Number(xe)||0);},"aria-label":a("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:S==="multiple"?"":a("dialogs.paragraph.unitPoints")})]}),nt("contextualSpacing",O,k),jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.paragraph.pagination")}),nt("keepNext",_,U),nt("widowControl",X,ae),nt("keepLines",z,re),nt("pageBreakBefore",K,J)]})]})}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{role:"alert","data-docx-part":"error",className:"docx-dialog__error",children:ot?a("dialogs.paragraph.refused"):null}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!c,"data-docx-part":"apply",onClick:Tn,children:a("dialogs.paragraph.ok")})]})]}),children:r})})}var yo=At();function cD(){return yo.useState()}var Lo=Object.assign(sD,{Header:yo.Header,Title:yo.Title,Body:yo.Body,Footer:yo.Footer,Apply:yo.Apply,Cancel:yo.Cancel,Error:yo.Error,Field:yo.Field});var oo=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var np=["ASAP","CONFIDENTIAL","COPY","DO NOT COPY","DRAFT","ORIGINAL","PERSONAL","SAMPLE","TOP SECRET","URGENT"],rp=[null,.5,1,1.5,2,5],ap=[null,36,40,44,48,54,60,66,72,80,90,96,105,120,144],rb="image/png,image/jpeg,image/gif,image/bmp,image/webp",ip={kind:"none",imageData:null,imageName:null,scale:null,washout:true,text:"DRAFT",fontFamily:"Calibri",fontSizePt:null,bold:false,italic:false,transparency:.5,color:"C0C0C0",layout:"diagonal"},ls=/^[0-9A-Fa-f]{6}$/;function ab(e,t){let o={...ip};return e?e.kind==="image"?{...o,kind:t?.imageData?"picture":"none",imageData:t?.imageData??null,scale:t?.scale??null,washout:e.washout??t?.washout??true}:{...o,kind:"text",text:e.text??o.text,fontFamily:e.fontFamily??o.fontFamily,fontSizePt:e.fontSizePt??null,bold:e.bold??false,italic:e.italic??false,transparency:e.transparency??o.transparency,color:e.color&&ls.test(e.color)?e.color.toUpperCase():o.color,layout:e.layout??o.layout}:o}function ib(e){if(e.kind==="none")return null;if(e.kind==="picture")return e.imageData?{imageData:e.imageData,scale:e.scale,washout:e.washout}:void 0;if(e.text.trim()!=="")return {text:e.text,fontFamily:e.fontFamily,fontSizePt:e.fontSizePt,bold:e.bold,italic:e.italic,color:e.color,transparency:e.transparency,layout:e.layout}}var lb=e=>`#${ls.test(e)?e.toLowerCase():"c0c0c0"}`;function sb(e){let t=e.startsWith("#")?e.slice(1):e;return ls.test(t)?t.toUpperCase():null}var lp=e=>Math.round(Math.min(1,Math.max(0,e))*100);function sp(e,t){let o=Number(e);return e.trim()===""||!Number.isFinite(o)?t:Math.min(100,Math.max(0,Math.round(o)))/100}function cb(e,t){return e===t?true:!e||!t?false:e.kind===t.kind&&e.text===t.text&&e.fontFamily===t.fontFamily&&e.fontSizePt===t.fontSizePt&&e.bold===t.bold&&e.italic===t.italic&&e.color===t.color&&e.transparency===t.transparency&&e.layout===t.layout&&e.washout===t.washout}function db(e,t){return e!==null&&t.kind==="none"?null:t}function ub(e,t){return e.kind!==t.kind?false:e.kind==="none"?true:e.kind==="picture"?e.imageData===t.imageData&&e.scale===t.scale&&e.washout===t.washout:e.text===t.text&&e.fontFamily===t.fontFamily&&e.fontSizePt===t.fontSizePt&&e.bold===t.bold&&e.italic===t.italic&&e.color.toUpperCase()===t.color.toUpperCase()&&e.transparency===t.transparency&&e.layout===t.layout}var pb=(e,t)=>t.includes(e)?e:"",uD={pageWidthTwips:12240,pageHeightTwips:15840,marginsTwips:{top:1440,right:1440,bottom:1440,left:1440}};function ss(e){let t=e&&e.pageWidthTwips>0&&e.pageHeightTwips>0?e:null,{pageWidthTwips:o,pageHeightTwips:n,marginsTwips:r}=t??uD,i=o/20,a=n/20,l=Math.max(72,(o-r.left-r.right)/20),s=Math.max(72,(n-r.top-r.bottom)/20);return {width:i,height:a,area:{x:r.left/20,y:r.top/20,width:l,height:s}}}var eb=12,tb=[.55,1,1,.9,0,1,1,.6,0,1,.95,1,.45];function mb(e){let{area:t}=e,o=36,n=[];for(let r=0,i=t.y;i+eb<=t.y+t.height;r++){let a=tb[r%tb.length];a>0&&n.push({x:t.x,y:i,width:t.width*a,height:eb}),i+=o;}return n}var fb="contrast(0.157068) brightness(1.91)",cp=100,Fo=e=>Math.round(e*100)/100,gb=e=>({cx:e.area.x+e.area.width/2,cy:e.area.y+e.area.height/2});function hb(e,t=ss(null)){if(e.kind!=="text")return null;let o=e.text.trim();if(o==="")return null;let n=editor.watermarkShapeBox({text:o,fontFamily:e.fontFamily,fontSizePt:e.fontSizePt,bold:e.bold,italic:e.italic,layout:e.layout},t.area);if(!n)return null;let{cx:r,cy:i}=gb(t);return {text:o,fontFamily:`"${e.fontFamily.replace(/["\\]/g,"")}", sans-serif`,fontWeight:e.bold?"bold":"normal",fontStyle:e.italic?"italic":"normal",fill:`#${ls.test(e.color)?e.color.toUpperCase():"C0C0C0"}`,opacity:Fo(1-Math.min(1,Math.max(0,e.transparency))),box:{x:Fo(r-n.width/2),y:Fo(i-n.height/2),width:Fo(n.width),height:Fo(n.height)},rotation:e.layout==="diagonal"?-45:0}}var ob=new WeakMap;function pD(e){if(!e)return null;let t=ob.get(e);if(t===void 0){try{t=e.createElement("canvas").getContext("2d");}catch{t=null;}ob.set(e,t);}return t}function bb(e,t){let o=cp,n=pD(t);if(n){n.font=`${e.fontStyle} ${e.fontWeight} ${o}px ${e.fontFamily}`;let r=n.measureText(e.text),i=-(r.actualBoundingBoxLeft??0),a=r.actualBoundingBoxRight??r.width,l=-(r.actualBoundingBoxAscent??0),s=r.actualBoundingBoxDescent??0;if(a>i&&s>l)return {left:i,right:a,top:l,bottom:s}}return {left:0,right:.55*o*Array.from(e.text).length,top:-0.7*o,bottom:0}}function yb(e,t){let{x:o,y:n,width:r,height:i}=e.box,a=r>4*7.2?7.2:0,l=i>4*3.6?3.6:0,s=(r-2*a)/(t.right-t.left),c=(i-2*l)/(t.bottom-t.top),d=o+a-t.left*s,f=n+l-t.top*c,u=p=>String(Math.round(p*1e4)/1e4),g=`matrix(${u(s)} 0 0 ${u(c)} ${u(d)} ${u(f)})`;return e.rotation?`rotate(${e.rotation} ${u(o+r/2)} ${u(n+i/2)}) ${g}`:g}function vb(e,t=ss(null)){if(e.kind!=="picture"||!e.imageData)return null;let o=editor.watermarkShapeBox({imageData:e.imageData,scale:e.scale},t.area);if(!o)return null;let{cx:n,cy:r}=gb(t);return {x:Fo(n-o.width/2),y:Fo(r-o.height/2),width:Fo(o.width),height:Fo(o.height)}}var mD=e=>e.editable,fD={ok:false,code:"unsupported",reason:"editor is not ready"};function up(){let e=H(),t=Lt.useCallback(l=>e?.getWatermark()??null,[e]),o=W(t,cb),n=W(mD),r=Lt.useMemo(()=>n&&e!==null&&e.can({type:"setWatermark",watermark:{text:"DRAFT"}}).ok,[e,n]),i=Lt.useCallback(()=>e?.query({type:"watermark"})??null,[e]),a=Lt.useCallback(l=>e?e.exec({type:"setWatermark",watermark:l}):fD,[e]);return Lt.useMemo(()=>({watermark:o,isEnabled:r,read:i,apply:a}),[o,r,i,a])}var vD=e=>e.pageSetup??null,no=At(),xD=no.part("preview");function Eb(){return no.useState()}var Cb=e=>`${Math.round(e*100)}%`;function CD(e){let[t,o]=Lt.useState(null);return Lt.useEffect(()=>{if(!e||typeof URL.createObjectURL!="function"){o(null);return}let n=URL.createObjectURL(new Blob([e]));return o(n),()=>URL.revokeObjectURL(n)},[e]),t}function TD({className:e,style:t,"data-docx-part":o,...n}){let{values:r}=Eb(),i=H(),a=W(vD),l=Lt.useMemo(()=>ss(a),[a]),s=CD(r.kind==="picture"?r.imageData:null),c=hb(r,l),d=s?vb(r,l):null;return jsxRuntime.jsx("div",{...n,"data-docx-part":"preview","aria-hidden":"true",className:["docx-dialog__preview",e].filter(Boolean).join(" "),style:t,children:jsxRuntime.jsxs("svg",{className:"docx-dialog__preview-page",viewBox:`0 0 ${l.width} ${l.height}`,focusable:"false",children:[jsxRuntime.jsx("rect",{className:"docx-dialog__preview-sheet",x:0,y:0,width:l.width,height:l.height}),c?jsxRuntime.jsx("text",{"data-docx-watermark-preview":"text",x:0,y:0,fontFamily:c.fontFamily,fontSize:cp,fontWeight:c.fontWeight,fontStyle:c.fontStyle,fill:c.fill,fillOpacity:c.opacity,transform:yb(c,bb(c,i?editor.editorHostDocument(i):null)),children:c.text}):null,s&&d?jsxRuntime.jsx("image",{"data-docx-watermark-preview":"picture",className:"docx-dialog__preview-picture",href:s,x:d.x,y:d.y,width:d.width,height:d.height,preserveAspectRatio:"none",style:r.washout?{filter:fb}:void 0}):null,mb(l).map(f=>jsxRuntime.jsx("rect",{className:"docx-dialog__preview-line",x:f.x,y:f.y,width:f.width,height:f.height},f.y))]})})}function ED({open:e,onClose:t,presets:o=np,className:n,style:r,children:i,preset:a=true}){let{t:l}=N(),s=H(),c=Vo(e,t),{isEnabled:d,read:f,apply:u}=up(),g=W(oo),[p,m]=Lt.useState({...ip}),[b,h]=Lt.useState([]),[v,y]=Lt.useState(null),[C,T]=Lt.useState(false),[x,E]=Lt.useState(0),P=Lt.useRef(null),D=Lt.useRef(null),w=Lt.useRef(null),S=Lt.useId(),L=Lt.useRef(false);Lt.useEffect(()=>{if(!e||g||!s){L.current=false;return}if(L.current)return;L.current=true;let M=s.getWatermark(),j=ab(M,f());P.current=db(M,j),m(j),h(s.getAvailableFonts()),y(null),T(false),E(ue=>ue+1);},[e,g,s,f]),Lt.useEffect(()=>{x!==0&&D.current?.querySelector(`input[name="${S}-kind"]:checked`)?.focus({preventScroll:true});},[x,S]);let I=Lt.useCallback((M,j)=>{y(null),m(ue=>({...ue,[M]:j}));},[]),F=ib(p),O=d&&F!==void 0,k=Lt.useCallback(()=>{if(!O||F===void 0)return;if(!c()){t();return}if(P.current&&ub(P.current,p)){t();return}let M=u(F);M.ok?t():y(M.reason);},[O,F,p,c,u,t]),_=Lt.useCallback(M=>{M&&(T(false),M.arrayBuffer().then(j=>{m(ue=>({...ue,kind:"picture",imageData:new Uint8Array(j),imageName:M.name})),y(null);}).catch(()=>T(true)));},[]);if(!e)return null;let U=p.kind==="picture",z=p.kind==="text",re=b.includes(p.fontFamily)?b:[p.fontFamily,...b],X=p.imageData?p.imageName??l("dialogs.watermark.currentPicture"):l("dialogs.watermark.noPictureSelected"),ae=v!==null?l("dialogs.watermark.refused"):null,K=(M,j,ue)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":M,className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"radio",name:`${S}-kind`,checked:p.kind===j,onChange:()=>I("kind",j)}),jsxRuntime.jsx("span",{id:`${S}-${M}-label`,children:ue})]}),J=(M,j,ue)=>jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":M,className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${S}-${M}`,children:j}),ue]}),B=(M,j,ue)=>jsxRuntime.jsxs("label",{"data-docx-part":"field","data-docx-field":M,className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",disabled:!ue,checked:p[M],onChange:de=>I(M,de.target.checked)}),jsxRuntime.jsx("span",{children:j})]}),A={values:p,setValue:I,errors:ae?{form:ae}:{},isEnabled:O,apply:k,cancel:t};return jsxRuntime.jsx(ze,{kind:"watermark",className:n,style:r,panelRef:D,label:l("dialogs.watermark.title"),onClose:t,onKeyDown:M=>{let j=M.target;M.key==="Enter"&&editor.isHTMLElementNode(j)&&j.localName==="input"&&(j.type==="text"||j.type==="number")&&O&&(M.preventDefault(),k());},children:jsxRuntime.jsx(no.Composition,{state:A,preset:a,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:l("dialogs.watermark.title")})}),jsxRuntime.jsx("div",{"data-docx-part":"body",className:"docx-dialog__body",children:jsxRuntime.jsxs("div",{className:"docx-dialog__watermark-layout",children:[jsxRuntime.jsx(TD,{"data-docx-part":"preview"}),jsxRuntime.jsxs("fieldset",{className:"docx-dialog__fieldset",children:[jsxRuntime.jsx("legend",{className:"docx-editor-sr-only",children:l("dialogs.watermark.kind")}),K("noWatermark","none",l("dialogs.watermark.noWatermark")),K("pictureWatermark","picture",l("dialogs.watermark.picture")),jsxRuntime.jsxs("div",{className:"docx-dialog__section docx-dialog__section--indented",role:"group","aria-labelledby":`${S}-pictureWatermark-label`,children:[jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"picture",className:"docx-dialog__row",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>{I("kind","picture"),w.current?.click();},children:l("dialogs.watermark.selectPicture")}),jsxRuntime.jsx("span",{className:"docx-dialog__hint","data-docx-watermark-picture":"",children:C?l("dialogs.watermark.pictureFailed"):X}),jsxRuntime.jsx("input",{ref:w,type:"file",accept:rb,hidden:true,"aria-label":l("dialogs.watermark.selectPicture"),onChange:M=>{let j=M.target.files?.[0];M.target.value="",_(j);}})]}),J("scale",l("dialogs.watermark.scale"),jsxRuntime.jsxs("select",{id:`${S}-scale`,className:"docx-dialog__select",disabled:!U,value:p.scale===null?"auto":String(p.scale),onChange:M=>I("scale",M.target.value==="auto"?null:Number(M.target.value)),children:[rp.map(M=>jsxRuntime.jsx("option",{value:M===null?"auto":String(M),children:M===null?l("dialogs.watermark.auto"):Cb(M)},String(M))),p.scale!==null&&!rp.includes(p.scale)?jsxRuntime.jsx("option",{value:String(p.scale),children:Cb(p.scale)}):null]})),B("washout",l("dialogs.watermark.washout"),U)]}),K("textWatermark","text",l("dialogs.watermark.text")),jsxRuntime.jsxs("div",{className:"docx-dialog__section docx-dialog__section--indented",role:"group","aria-labelledby":`${S}-textWatermark-label`,children:[J("preset",l("dialogs.watermark.preset"),jsxRuntime.jsxs("select",{id:`${S}-preset`,className:"docx-dialog__select",disabled:!z,value:pb(p.text,o),onChange:M=>{M.target.value!==""&&I("text",M.target.value);},children:[jsxRuntime.jsx("option",{value:"",children:l("dialogs.watermark.custom")}),o.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})),J("text",l("dialogs.watermark.textLabel"),jsxRuntime.jsx("input",{id:`${S}-text`,type:"text",className:"docx-dialog__input",disabled:!z,maxLength:256,value:p.text,onChange:M=>I("text",M.target.value)})),J("fontFamily",l("dialogs.watermark.font"),jsxRuntime.jsx("select",{id:`${S}-fontFamily`,className:"docx-dialog__select",disabled:!z,value:p.fontFamily,onChange:M=>I("fontFamily",M.target.value),children:re.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))})),J("fontSizePt",l("dialogs.watermark.size"),jsxRuntime.jsxs("select",{id:`${S}-fontSizePt`,className:"docx-dialog__select",disabled:!z,value:p.fontSizePt===null?"auto":String(p.fontSizePt),onChange:M=>I("fontSizePt",M.target.value==="auto"?null:Number(M.target.value)),children:[ap.map(M=>jsxRuntime.jsx("option",{value:M===null?"auto":String(M),children:M===null?l("dialogs.watermark.auto"):String(M)},String(M))),p.fontSizePt!==null&&!ap.includes(p.fontSizePt)?jsxRuntime.jsx("option",{value:String(p.fontSizePt),children:p.fontSizePt}):null]})),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[B("bold",l("dialogs.watermark.bold"),z),B("italic",l("dialogs.watermark.italic"),z)]}),J("transparency",l("dialogs.watermark.transparency"),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:"range",className:"docx-dialog__range",min:0,max:100,step:1,disabled:!z,"aria-label":l("dialogs.watermark.transparency"),value:lp(p.transparency),onChange:M=>I("transparency",sp(M.target.value,p.transparency))}),jsxRuntime.jsx("input",{id:`${S}-transparency`,type:"number",className:"docx-dialog__input docx-dialog__input--narrow",min:0,max:100,step:1,disabled:!z,value:lp(p.transparency),onChange:M=>I("transparency",sp(M.target.value,p.transparency))}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:"%"})]})),J("color",l("dialogs.watermark.color"),jsxRuntime.jsx("input",{id:`${S}-color`,type:"color",className:"docx-dialog__color",disabled:!z,value:lb(p.color),onChange:M=>{let j=sb(M.target.value);j&&I("color",j);}})),jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"layout",className:"docx-dialog__row",role:"radiogroup","aria-label":l("dialogs.watermark.layout"),children:[jsxRuntime.jsx("span",{className:"docx-dialog__label",children:l("dialogs.watermark.layout")}),["diagonal","horizontal"].map(M=>jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"radio",name:`${S}-layout`,disabled:!z,checked:p.layout===M,onChange:()=>I("layout",M)}),jsxRuntime.jsx("span",{children:l(`dialogs.watermark.${M}`)})]},M))]})]})]})]})}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("span",{"data-docx-part":"error",role:"alert",className:"docx-dialog__error",...v?{title:v}:{},children:ae}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:l("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply",disabled:!O,"data-docx-part":"apply",onClick:k,children:l("common.apply")})]})]}),children:i})})}var zn=Object.assign(ED,{Header:no.Header,Title:no.Title,Body:no.Body,Preview:xD,Footer:no.Footer,Apply:no.Apply,Cancel:no.Cancel,Error:no.Error,Field:no.Field});var ds={ok:false,code:"unsupported",reason:"editor is not ready"},SD=Object.freeze([]);function fp(e,t){return e.length===t.length&&e.every((o,n)=>o.name===t[n].name&&o.order===t[n].order&&o.story===t[n].story&&o.empty===t[n].empty&&o.atSelection===t[n].atSelection&&o.duplicates===t[n].duplicates&&o.hidden===t[n].hidden&&o.place===t[n].place)}function gp(){let e=H(),t=Lt.useCallback(c=>e?.query({type:"bookmarks"})??SD,[e]),o=W(t,fp),n=Lt.useCallback(c=>c.editable&&e!==null&&e.can({type:"insertBookmark",name:"Bookmark"}).ok,[e]),r=W(n),i=Lt.useCallback(c=>e?e.exec({type:"insertBookmark",name:c}):ds,[e]),a=Lt.useCallback(c=>e?e.exec({type:"deleteBookmark",name:c}):ds,[e]),l=Lt.useCallback(c=>e?e.exec({type:"goToBookmark",name:c}):ds,[e]),s=Lt.useCallback(c=>e?e.exec({type:"keepFirstBookmark",name:c}):ds,[e]);return Lt.useMemo(()=>({bookmarks:o,isWritable:r,insert:i,remove:a,goTo:l,keepFirst:s}),[o,r,i,a,l,s])}var Sb={empty:"dialogs.bookmark.nameEmpty",tooLong:"dialogs.bookmark.nameTooLong",invalidStart:"dialogs.bookmark.nameInvalidStart",invalidCharacter:"dialogs.bookmark.nameInvalidCharacter"};function _D(e){return e.open?jsxRuntime.jsx(ID,{...e}):null}function ID({open:e,onClose:t,className:o,style:n,children:r,preset:i=true}){let{t:a}=N(),l=Vo(e,t),{bookmarks:s,isWritable:c,insert:d,remove:f,goTo:u,keepFirst:g}=gp(),[p,m]=Lt.useState(()=>editor.bookmarkDialogInitialName(s)),[b,h]=Lt.useState("name"),[v,y]=Lt.useState(false),[C,T]=Lt.useState(false),[x,E]=Lt.useState(false),[P,D]=Lt.useState(false),w=Lt.useRef(null),S=Lt.useRef(null),L=Lt.useId(),I=Lt.useId(),F=Lt.useId(),O=editor.bookmarkDialogRows(s,{sortBy:b,showHidden:v}),k=editor.bookmarkDialogNameState(s,p,c),_=k.problem&&!k.existing&&(x||p.length>0)?k.problem:null,U=k.existing?.duplicates??0,z=C?a("dialogs.bookmark.refused"):_?a(Sb[_]):U>0?a("dialogs.bookmark.duplicates",{count:U}):k.existing&&k.canAdd?a("dialogs.bookmark.nameExists"):null,re=Lt.useCallback(()=>{if(E(true),!k.canAdd)return;if(!l()){t();return}let A=d(p);T(!A.ok),A.ok&&t();},[k.canAdd,l,d,p,t]),X=Lt.useCallback(()=>{if(!k.canDelete||!k.existing)return;let A=f(k.existing.name);T(!A.ok),A.ok&&m("");},[k,f]),ae=Lt.useCallback(()=>{if(!k.canGoTo||!k.existing)return;let A=u(k.existing.name);T(!A.ok),A.ok&&D(true);},[k,u]),K=Lt.useCallback(()=>{let A=k.existing;!A||!c||T(!g(A.name).ok);},[k.existing,c,g]),J=k.existing?.name??"";Lt.useLayoutEffect(()=>{!J&&S.current&&(S.current.selectedIndex=-1);});let B={values:{name:p,sortBy:b,showHidden:v},setValue(A,M){A==="name"?m(M):A==="sortBy"?h(M):y(M),T(false);},errors:_?{name:a(Sb[_])}:C?{form:a("dialogs.bookmark.refused")}:{},isEnabled:k.canAdd,apply:re,cancel:t,rows:O,canDelete:k.canDelete,canGoTo:k.canGoTo,duplicates:U,remove:X,goTo:ae,keepFirst:K};return jsxRuntime.jsx(ze,{kind:"bookmark",className:o,style:n,panelRef:w,label:a("dialogs.bookmark.title"),onClose:t,onKeyDown:A=>{A.key==="Enter"&&!A.nativeEvent.isComposing&&A.keyCode!==229&&editor.isHTMLElementNode(A.target)&&A.target.localName==="input"&&A.target.getAttribute("type")==="text"&&(A.preventDefault(),re());},children:jsxRuntime.jsx(It.Composition,{state:B,preset:i,defaults:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{"data-docx-part":"header",className:"docx-dialog__header",children:jsxRuntime.jsx("span",{"data-docx-part":"title",className:"docx-dialog__title",children:a("dialogs.bookmark.title")})}),jsxRuntime.jsxs("div",{"data-docx-part":"body",className:"docx-dialog__body",children:[jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"name",className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:L,children:a("dialogs.bookmark.name")}),jsxRuntime.jsx("input",{id:L,type:"text",className:"docx-dialog__input",value:p,maxLength:40,autoComplete:"off",spellCheck:false,"aria-invalid":_?true:void 0,"aria-describedby":I,onChange:A=>B.setValue("name",A.target.value)})]}),jsxRuntime.jsx("div",{"data-docx-part":"field","data-docx-field":"list",className:"docx-dialog__row",children:jsxRuntime.jsx("select",{ref:S,className:"docx-dialog__input docx-dialog__input--full docx-bookmark-dialog__list",size:8,value:J,"aria-label":a("dialogs.bookmark.list"),onChange:A=>B.setValue("name",A.target.value),onDoubleClick:ae,children:O.map(A=>jsxRuntime.jsx("option",{value:A.name,children:A.name},A.name))})}),O.length===0?jsxRuntime.jsx("div",{className:"docx-dialog__hint",children:a("dialogs.bookmark.empty")}):null,jsxRuntime.jsxs("div",{"data-docx-part":"field","data-docx-field":"sortBy",className:"docx-dialog__row",role:"radiogroup","aria-label":a("dialogs.bookmark.sortBy"),children:[jsxRuntime.jsx("span",{className:"docx-dialog__label",children:a("dialogs.bookmark.sortBy")}),["name","location"].map(A=>jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"radio",name:F,checked:b===A,onChange:()=>B.setValue("sortBy",A)}),a(A==="name"?"dialogs.bookmark.sortName":"dialogs.bookmark.sortLocation")]},A))]}),jsxRuntime.jsx("div",{"data-docx-part":"field","data-docx-field":"showHidden",className:"docx-dialog__row",children:jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v,onChange:A=>B.setValue("showHidden",A.target.checked)}),a("dialogs.bookmark.showHidden")]})}),jsxRuntime.jsxs("div",{className:"docx-dialog__row docx-bookmark-dialog__status",children:[jsxRuntime.jsx("span",{id:I,"data-docx-part":"error",role:"status",className:_||C?"docx-dialog__error":"docx-dialog__hint",children:z}),U>0?jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"keepfirst",disabled:!c,onClick:K,children:a("dialogs.bookmark.keepFirst")}):null]})]}),jsxRuntime.jsxs("div",{"data-docx-part":"footer",className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__apply","data-docx-part":"apply",disabled:!k.canAdd,onClick:re,children:a("dialogs.bookmark.add")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"delete",disabled:!k.canDelete,onClick:X,children:a("dialogs.bookmark.delete")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"goto",disabled:!k.canGoTo,onClick:ae,children:a("dialogs.bookmark.goTo")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button","data-docx-part":"cancel",onClick:t,children:a(P?"common.close":"common.cancel")})]})]}),children:r})})}var It=At();function ND(){return It.useState()}var ei=Object.assign(_D,{Header:It.Header,Title:It.Title,Body:It.Body,Footer:It.Footer,Apply:It.Apply,Cancel:It.Cancel,Error:It.Error,Field:It.Field,Delete:It.part("delete"),GoTo:It.part("goto"),KeepFirst:It.part("keepfirst")});var wb=Lt.createContext(null),Ur=()=>Lt.useContext(wb);function Db({popups:e,children:t}){let o=H(),n=ld(),[r,i]=Lt.useState(null),[a,l]=Lt.useState(null),[s,c]=Lt.useState(null),[d,f]=Lt.useState(null),u=Lt.useRef(d);u.current=d;let g=Lt.useRef(e);g.current=e;let p=Lt.useRef(null),m=Lt.useRef(s);m.current=s;let b=()=>l(null);Lt.useEffect(()=>{if(a!==null)return;let T=p.current;p.current=null,T?.isConnected&&T.focus({preventScroll:true});},[a]),Lt.useEffect(()=>{if(o)return o.setTextFormFieldChrome({onRequest(T){if(g.current?.textFormField===false){T.cancel();return}u.current?.cancel(),l(null),c(T),T.signal.addEventListener("abort",()=>c(x=>x===T?null:x),{once:true});}},{fallback:true})},[o]),Lt.useEffect(()=>{if(!o||!r&&e?.revisionMarkup!==false)return;let T=o.setRevisionMarkupChrome({onRequest(x){if(g.current?.revisionMarkup===false){x.cancel();return}m.current?.cancel(),l(null),f(x),x.signal.addEventListener("abort",()=>f(E=>E===x?null:E),{once:true});}},{fallback:true});return ()=>{u.current?.cancel(),T();}},[o,r,e?.revisionMarkup===false]),Lt.useEffect(()=>{l(null),c(null),f(null);},[o,n]);let h=e?.bookmark===false;Lt.useEffect(()=>{if(!(!o||!r||h))return o.setBookmarkChrome({onRequest(){m.current?.cancel(),u.current?.cancel(),p.current=OD(r.ownerDocument.activeElement),l("bookmark");}})},[o,r,h]),Lt.useEffect(()=>{e?.revisionMarkup===false&&u.current?.cancel(),e?.textFormField===false&&m.current?.cancel(),a&&e?.[a]===false&&l(null);},[e,a]);let v=Lt.useMemo(()=>({container:r,setContainer:i,ownsPageSetup:e?.pageSetup!==void 0,open(T,x){m.current?.cancel(),u.current?.cancel(),g.current?.[T]!==false&&(p.current=x??r?.ownerDocument.activeElement,l(T));}}),[r,e?.pageSetup]),y={open:true,onClose:b},C=a==="pageSetup"&&e?.pageSetup!==false?e?.pageSetup?Ee(e.pageSetup,y):jsxRuntime.jsx(Kn,{...y}):a==="paragraph"&&e?.paragraph!==false?e?.paragraph?Ee(e.paragraph,y):jsxRuntime.jsx(Lo,{...y}):a==="watermark"&&e?.watermark!==false?e?.watermark?Ee(e.watermark,y):jsxRuntime.jsx(zn,{...y}):a==="bookmark"&&e?.bookmark!==false?e?.bookmark?Ee(e.bookmark,y):jsxRuntime.jsx(ei,{...y}):d&&e?.revisionMarkup!==false?e?.revisionMarkup?Ee(e.revisionMarkup,{session:d},d):jsxRuntime.jsx(ya,{session:d}):s&&e?.textFormField!==false?e?.textFormField?Ee(e.textFormField,{session:s},s):jsxRuntime.jsx(Qa,{session:s}):null;return jsxRuntime.jsxs(wb.Provider,{value:v,children:[t,r?reactDom.createPortal(C,r):null]})}function OD(e){return e?.closest("[data-menu]")?.querySelector(':scope > [role="menuitem"]')??e}function Rb(){let e=Ur();return jsxRuntime.jsx("div",{className:"docx-dialog-mount",ref:e?.setContainer})}function Mb({children:e}){let t=Ur();return t?.container?reactDom.createPortal(e,t.container):e}var QD=["nw","n","ne","e","se","s","sw","w"],Fb=40,Hb=12;function eR(e){return `imageOverlay.handle.${e}`}function tR(e){switch(e){case "nw":case "se":return "nwse-resize";case "ne":case "sw":return "nesw-resize";case "n":case "s":return "ns-resize";default:return "ew-resize"}}function oR(e){return {nw:{x:"0%",y:"0%"},n:{x:"50%",y:"0%"},ne:{x:"100%",y:"0%"},e:{x:"100%",y:"50%"},se:{x:"100%",y:"100%"},s:{x:"50%",y:"100%"},sw:{x:"0%",y:"100%"},w:{x:"0%",y:"50%"}}[e]}function nR(e,t){return e>0&&t>0?"se":e>0&&t<0?"ne":e<0&&t>0?"sw":e<0&&t<0?"nw":e>0?"e":e<0?"w":t>0?"s":"n"}function yp({containerRef:e,portalRef:t,scrollPort:o}){let n=H(),{t:r}=N(),[i,a]=Lt.useState(null),[l,s]=Lt.useState(null),[c,d]=Lt.useState({left:0,top:0}),f=Lt.useRef(null);f.current=l;let u=Lt.useRef(null),g=Lt.useRef(null),p=Lt.useRef(null),m=Lt.useRef(null),b=Lt.useRef(null);Lt.useEffect(()=>{let P=e.current;if(!P)return;let D=w=>{let S=editor.isElementNode(w.target)?w.target:null;if(S?.closest(".docx-drawing-textbox-content")){m.current=null;return}let L=S?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");m.current=L??null,L&&L===i?.id&&queueMicrotask(()=>p.current?.focus({preventScroll:true}));};return P.addEventListener("pointerdown",D,{capture:true}),()=>P.removeEventListener("pointerdown",D,{capture:true})},[e,i?.id]),Lt.useEffect(()=>{if(!n){a(null);return}let P=()=>{a(editor.selectedDrawingOverlayTargetOf(n.surface));},D=()=>{queueMicrotask(P);};P();let w=[n.on("change",D),n.on("selectionChange",P)];return ()=>{for(let S of w)S();}},[n]);let h=Lt.useCallback(()=>{d(P=>{let D=editor.overlayHostOrigin(e.current);return D.left===P.left&&D.top===P.top?P:D});},[e]);Lt.useEffect(()=>{h();let P=t.current,D=editor.hostWindowOf(P).ResizeObserver;if(!P||typeof D!="function")return;let w=new D(h);w.observe(P);let S=e.current;return S&&w.observe(S),()=>w.disconnect()},[e,t,h,i]),Lt.useEffect(()=>{if(o){b.current=o;return}let P=e.current;if(!P||!n?.surface)return;let D=P.closest(".docx-editor__scroll-container");if(!D)return;let w=n.surface.overlayCoordinates();return b.current=editor.createImageOverlayScrollPort(D,w.paintScale),()=>{b.current=null;}},[e,n,o]);let v=Lt.useCallback(()=>{s(null),u.current=null;let P=g.current;if(g.current=null,P)try{P.releasePointerCapture(P._lastPointerId??0);}catch{}},[]),y=Lt.useCallback((P,D,w,S,L,I,F)=>{if(!n?.surface)return;let O=n.surface.activeScope();if(O.kind==="frame"&&!n.surface.selectDrawing(w.id,O.hostParagraphId))return;let k=n.surface.layout(),_=editor.captureImageMutationPreconditions(n);if(_){u.current=Object.freeze({x:S,y:L}),g.current=I,I._lastPointerId=F;try{I.setPointerCapture(F);}catch{}s({session:Object.freeze({drawingNodeId:w.id,startBounds:Object.freeze({x:w.x,y:w.y,width:w.width,height:w.height}),startWidthEmu:w.widthEmu,startHeightEmu:w.heightEmu,startPosition:w.position,anchorFrameOrigin:w.anchorFrameOrigin,transform:w.transform,mode:P,handle:D,preconditions:_,layoutRevision:k.revision,packageRevision:n.surface.session.packageRevision(),kind:w.kind}),bounds:w,accumulatedScrollPt:0}),p.current?.focus({preventScroll:true});}},[n]),C=Lt.useCallback((P,D,w,S,L)=>{if(!n)return;if(editor.isStaleImageInteractionCommit(n,P)){v();return}P.mode==="resize"?n.exec({type:"setImageProperties",widthEmu:D,heightEmu:w,...L?.mode==="simple"?{horizontalEmu:L.horizontalEmu,verticalEmu:L.verticalEmu}:{},...L?.mode==="frame"?{...L.horizontalEmu!==void 0?{horizontalEmu:L.horizontalEmu}:{},...L.verticalEmu!==void 0?{verticalEmu:L.verticalEmu}:{}}:{}}):P.mode==="move"&&L&&n.exec({type:"setImagePosition",...L}),v();},[v,n]),T=Lt.useCallback(P=>{if(!n)return;let D=f.current?.bounds??editor.selectedDrawingOverlayTargetOf(n.surface);if(!D)return;if(f.current&&P.key==="Escape"){P.preventDefault(),P.stopPropagation(),v();return}if(f.current)return;let w=editor.historyShortcutOf(P);if(w){P.preventDefault(),P.stopPropagation(),n.exec({type:w});return}let S=P.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(P.key==="Delete"||P.key==="Backspace"){P.preventDefault(),P.stopPropagation(),n.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(P.key))return;P.preventDefault(),P.stopPropagation();let L=P.key==="ArrowLeft"?-S:P.key==="ArrowRight"?S:0,I=P.key==="ArrowUp"?-S:P.key==="ArrowDown"?S:0;if(P.altKey){if(!D.canResize)return;let O=nR(L,I),k=editor.computeImageResizeResult({handle:O,startWidthEmu:D.widthEmu,startHeightEmu:D.heightEmu,startBounds:{x:D.x,y:D.y,width:D.width,height:D.height},startPosition:D.position,anchorFrameOrigin:D.anchorFrameOrigin,deltaXPt:L,deltaYPt:I,transform:D.transform,preserveAspect:editor.resizePreservesAspect(O,D.aspectLocked,P.shiftKey,D.textbox),kind:D.kind});n.exec({type:"setImageProperties",widthEmu:k.widthEmu,heightEmu:k.heightEmu,...k.position?.mode==="simple"?{horizontalEmu:k.position.horizontalEmu,verticalEmu:k.position.verticalEmu}:{},...k.position?.mode==="frame"?{...k.position.horizontalEmu!==void 0?{horizontalEmu:k.position.horizontalEmu}:{},...k.position.verticalEmu!==void 0?{verticalEmu:k.position.verticalEmu}:{}}:{}});return}if(D.kind!=="anchored"||!D.canMove||!D.position)return;let F=editor.computeMovedImagePosition(D.position,L,I);n.exec({type:"setImagePosition",...F});},[v,n]);Lt.useEffect(()=>{if(!l||!n?.surface)return;let P=n.surface.overlayCoordinates(),D=L=>{let I=f.current,F=u.current;if(!I||!F)return;let O=editor.cssPixelsToLayoutPoints(L.clientX-F.x,P.paintScale),k=editor.cssPixelsToLayoutPoints(L.clientY-F.y,P.paintScale);if(I.session.mode==="move"){let U=0,z=b.current,re=e.current?.closest(".docx-editor__scroll-container");if(z&&re){let ae=re.getBoundingClientRect();L.clientY>ae.bottom-Fb?U=Hb:L.clientY<ae.top+Fb&&(U=-Hb),U!==0&&(U=z.scrollBy(U));}let X=I.accumulatedScrollPt+U;s({...I,accumulatedScrollPt:X,bounds:Object.freeze({...I.bounds,x:I.session.startBounds.x+O,y:I.session.startBounds.y+k+X})});return}if(!I.session.handle)return;let _=editor.computeImageResizeResult({handle:I.session.handle,startWidthEmu:I.session.startWidthEmu,startHeightEmu:I.session.startHeightEmu,startBounds:I.session.startBounds,startPosition:I.session.startPosition,anchorFrameOrigin:I.session.anchorFrameOrigin,deltaXPt:O,deltaYPt:k,transform:I.session.transform,preserveAspect:editor.resizePreservesAspect(I.session.handle,I.bounds.aspectLocked,L.shiftKey,I.bounds.textbox),kind:I.session.kind});s({...I,bounds:Object.freeze({...I.bounds,x:_.previewBounds.x,y:_.previewBounds.y,width:_.previewBounds.width,height:_.previewBounds.height,widthEmu:_.widthEmu,heightEmu:_.heightEmu})});},w=L=>{let I=f.current;if(I)if(L.type==="pointerup"){let F=editor.cssPixelsToLayoutPoints(L.clientX-(u.current?.x??L.clientX),P.paintScale),O=editor.cssPixelsToLayoutPoints(L.clientY-(u.current?.y??L.clientY),P.paintScale),k=editor.finalizeImageOverlayInteraction({session:I.session,deltaXPt:F,deltaYPt:O,accumulatedScrollPt:I.accumulatedScrollPt,aspectLocked:I.bounds.aspectLocked,textbox:I.bounds.textbox,shiftKey:L.shiftKey,anchorFrameOrigin:I.session.anchorFrameOrigin});C(I.session,k.widthEmu,k.heightEmu,k.previewBounds,k.position);}else v();},S=editor.hostWindowOf(e.current);return S.addEventListener("pointermove",D),S.addEventListener("pointerup",w),S.addEventListener("pointercancel",w),()=>{S.removeEventListener("pointermove",D),S.removeEventListener("pointerup",w),S.removeEventListener("pointercancel",w);}},[v,C,e,n,l]),Lt.useEffect(()=>{!i||m.current!==i.id||(m.current=null,p.current?.focus({preventScroll:true}));},[i]);let x=l?.bounds??i,E=Lt.useMemo(()=>{if(!n?.surface||!x)return null;let P=n.surface.publishedLayout(),D=n.surface.overlayCoordinates(),w=editor.overlayFrameToSheetCssPixels(P,{pageIndex:x.pageIndex,x:x.x,y:x.y,width:x.width,height:x.height},D),S={left:w.left+c.left,top:w.top+c.top,width:w.width,height:w.height},L=x.canResize,I=x.kind==="anchored"&&x.canMove;return jsxRuntime.jsxs("div",{ref:p,className:"docx-image-selection-overlay","data-drawing-node-id":x.id,tabIndex:0,onKeyDown:T,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${I?" docx-editor-one-surface__overlay-control":""}`,"data-textbox":x.textbox?"true":void 0,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${S.left}px`,top:`${S.top}px`,width:`${S.width}px`,height:`${S.height}px`,cursor:I?"move":"default"},onPointerDown:F=>{q(F),!(!I||!x.position)&&F.button===0&&(F.preventDefault(),F.stopPropagation(),y("move",null,x,F.clientX,F.clientY,F.currentTarget,F.pointerId));}}),L?QD.map(F=>{let O=oR(F);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(eR(F)),tabIndex:0,style:{left:`calc(${S.left}px + ${S.width}px * ${parseFloat(O.x)/100} - 5px)`,top:`calc(${S.top}px + ${S.height}px * ${parseFloat(O.y)/100} - 5px)`,cursor:tR(F)},onPointerDown:k=>{q(k),k.button===0&&(k.preventDefault(),k.stopPropagation(),y("resize",F,x,k.clientX,k.clientY,k.currentTarget,k.pointerId));}},F)}):null]})},[x,y,n,T,c.left,c.top,r]);return !E||!t.current?null:reactDom.createPortal(E,t.current)}function xp(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function gs({className:e}){let t=H(),o=Na(),n=Lt.useRef(null),r=Lt.useRef(null);Lt.useLayoutEffect(()=>{let s=n.current;if(!(!t||!s)){try{t.attach(s);}catch(c){if(t.snapshot().openFailure?.code!=="open.failed")throw c;console.error("[docx-editor] The document failed to open.",c);}return ()=>{t.detach();}}},[t]);let i=Lt.useCallback(s=>{if(!o?.isEnabled)return;let c=s.clipboardData;c&&xp(c)&&(editor.clipboardPasteLandsContent(c)||(s.preventDefault(),o.insertFromDataTransfer(c)));},[o]),a=Lt.useCallback(s=>{!o?.isEnabled||!xp(s.dataTransfer)||s.preventDefault();},[o]),l=Lt.useCallback(s=>{if(o?.isEnabled&&xp(s.dataTransfer)){if(editor.clipboardDropLandsText(s.dataTransfer)){if((editor.isElementNode(s.target)?s.target:null)?.closest("[contenteditable]")?.getAttribute("contenteditable")==="true")return;s.preventDefault();return}s.preventDefault(),o.insertFromDataTransfer(s.dataTransfer);}},[o]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:n,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:l}),jsxRuntime.jsx(Rb,{}),jsxRuntime.jsx(uh,{}),jsxRuntime.jsx(Wh,{}),t?jsxRuntime.jsx(yp,{containerRef:n,portalRef:r}):null]})}function Tp({open:e,onClose:t,children:o,url:n,name:r,features:i,title:a,styles:l}){let[s,c]=Lt.useState(null),d=Lt.useRef(t);d.current=t;let f=Lt.useRef({url:n,name:r,features:i,title:a,styles:l});f.current={url:n,name:r,features:i,title:a,styles:l};let u=Lt.useRef(null);return Lt.useEffect(()=>{if(!e)return;let g=u.current;if(g)g.claimed=true;else {let{url:h,name:v,features:y,title:C,styles:T}=f.current;g={claimed:true,promise:editor.openEditorWindow({...h!==void 0?{url:h}:{},...v!==void 0?{name:v}:{},...y!==void 0?{features:y}:{},...C!==void 0?{title:C}:{},...T!==void 0?{styles:T}:{}})},u.current=g;}let p=g,m=true,b;return p.promise.then(h=>{if(m){if(!h){u.current=null,d.current?.();return}b=h.onClose(()=>{m&&(u.current=null,reactDom.flushSync(()=>c(null)),d.current?.());}),c(h);}}),()=>{m=false,b?.(),p.claimed=false,c(null),queueMicrotask(()=>{p.claimed||(u.current===p&&(u.current=null),p.promise.then(h=>h?.close()));});}},[e]),!s||!e?jsxRuntime.jsx(jsxRuntime.Fragment,{children:o}):reactDom.createPortal(jsxRuntime.jsx("div",{className:"docx-editor",style:{height:"100%"},children:o}),s.element)}function Oe(e){return e/1440*96}function hs(e){return e/96*1440}function Et(e){return `${Math.round(e*100)/100}px`}function Ep(e){return e/2}var vR=e=>e.isLoading||e.isOpening===true,xR=e=>({width:Oe(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Oe(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),CR=(e,t)=>e.width===t.width&&e.height===t.height;function Pp({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}var Wb=false;function Zb(){Wb||!mt()||(Wb=true,console.warn("[docx-editor] loadingIndicator is ignored with chrome={false}, which renders no loading screen. Compose <DocxEditor.Loading overlay indicator={...} /> in a positioned box instead."));}function TR(e){let t=H(),[o,n]=Lt.useState(null);return Lt.useEffect(()=>{if(!(!t||!e))return t.setOpeningIndicatorHost({publish:n}),()=>{t.setOpeningIndicatorHost(null),n(null);}},[t,e]),o}function ER({when:e=false,overlay:t=false,className:o,style:n,indicator:r,children:i}){let a=W(vR),l=W(xR,CR),s=TR(t),{t:c}=N();if(!e&&!a)return null;let d=r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pp,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:c("loading.label")})]});if(s)return reactDom.createPortal(d,s);let f=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${o?` ${o}`:""}`;return jsxRuntime.jsx("div",{className:f,style:n,role:"status","aria-live":"polite",children:i??jsxRuntime.jsx("div",{className:"docx-paginated-surface docx-editor__loading-surface",style:{width:l.width,height:l.height},children:jsxRuntime.jsx("div",{className:"docx-pages",children:jsxRuntime.jsx("div",{className:"docx-page docx-editor__loading-page",children:jsxRuntime.jsx("div",{className:"docx-editor__loading-page-status",children:d})})})})})}var bs=Object.assign(ER,{Spinner:Pp});function qb(){let e=new Set,t=new Map,o=new Map,n=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let u=Object.create(null),g=[...t].sort((p,m)=>(o.get(p[0])??0)-(o.get(m[0])??0));for(let[,{author:p,style:m}]of g)u[p]=m;return {authors:u,others:e.size>0?"kind":"author"}}let l=null,s=false;function c(u){if(u===void 0)return "none";if(typeof u=="string")return u;let g=Object.entries(u.authors).map(([p,m])=>`${p}\0${JSON.stringify(m)}`).sort();return `${u.others??"kind"}${g.join("")}`}function d(){if(!r)return;let u=a(),g=c(u);if(g!==l){if(u===void 0){i&&(r.setRevisionStyles("author"),i=false,l=g);return}r.setRevisionStyles(u),i=true,l=g;}}function f(){!r||s||(s=true,queueMicrotask(()=>{s=false,d();}));}return {registerScheme(u){e.add(u),f();},register(u,g,p){o.has(u)||o.set(u,n++),t.set(u,{author:g,style:p}),f();},unregister(u){(e.delete(u)||t.delete(u))&&f();},connect(u){r=u;let g=a();i=u!==null&&g!==void 0,l=u===null?null:c(g),f();},current:a}}var ni=Lt.createContext(null);function $b(){let e=Lt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function Sp(){let e=Lt.useContext(ni),t=$b();return Lt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function kp(e){let{author:t,color:o,background:n,activeBackground:r,spanClassName:i,avatarUrl:a}=e,l=Lt.useContext(ni),s=$b();return Lt.useEffect(()=>{if(l)return l.register(s,t,{...o!==void 0?{color:o}:{},...n!==void 0?{background:n}:{},...r!==void 0?{activeBackground:r}:{},...i!==void 0?{spanClassName:i}:{},...a!==void 0?{avatarUrl:a}:{}}),()=>l.unregister(s)},[l,s,t,o,n,r,i,a]),null}var Ub=false;function Vb(e,t){e===t||Ub||!mt()||(Ub=true,console.warn("[docx-editor] fieldResults changed after the editor was created, so the change is ignored. The editor reads fieldResults once; create a new editor to change it."));}var Gb=false,jb=e=>e?.allowFormattingInLockedContent===true;function Yb(e,t){jb(e)===jb(t)||Gb||!mt()||(Gb=true,console.warn("[docx-editor] contentLockPolicy changed after the editor was created, so the change is ignored. The editor reads contentLockPolicy once; create a new editor to change it."));}var Xb=false;function Jb(e){return e===void 0?"characters":e}function Qb(e,t){Jb(e)===Jb(t)||Xb||!mt()||(Xb=true,console.warn("[docx-editor] lockedControlNavigation changed after the editor was created, so the change is ignored. The editor reads lockedControlNavigation once; create a new editor to change it."));}function LR(e,t){if(e===t)return true;let o=editor.resolveZoomMode(e),n=editor.resolveZoomMode(t);return o!==null&&n!==null&&editor.sameZoomMode(o,n)}function FR(e){let t=Lt.useRef(e);t.current=e;let[o,n]=Lt.useState(null),{onReady:r,onChange:i,onFontError:a,onRevisionMarkupChange:l,...s}=e,c=Lt.useMemo(()=>({onReady:d=>{n(d),t.current.onReady?.(d);},onChange:d=>t.current.onChange?.(d),onFontError:d=>t.current.onFontError?.(d),onRevisionMarkupChange:d=>t.current.onRevisionMarkupChange?.(d)}),[]);return {DocxEditorRoot:ri,rootProps:s,rootListeners:c,editorRef:o}}function ri(e){let{document:t,fonts:o,fontShaping:n,author:r,locale:i,translate:a,mode:l,zoom:s,zoomMode:c,tableInteractionLabel:d,imageDecodePort:f,children:u}=e,{t:g}=N(),p=Lt.useCallback((B,A)=>g(B,A),[g]),m=Lt.useRef(p);m.current=p;let b=Lt.useRef(false),[h,v]=Lt.useState(0),y=Lt.useRef(e);y.current=e;let C=n?.maxFontBytes,[T,x]=Lt.useState(null),E=Lt.useRef(e.fieldResults),P=Lt.useRef(e.contentLockPolicy),D=Lt.useRef(e.lockedControlNavigation),w=Lt.useRef(null);w.current??=qb();let S=w.current;Lt.useEffect(()=>{let B=y.current,A=B.translate??m.current,M=S.current();E.current=B.fieldResults,P.current=B.contentLockPolicy,D.current=B.lockedControlNavigation;let j=editor.createDocxEditor({...B.document!==void 0?{document:B.document}:{},...B.fonts?{fonts:B.fonts}:{},...B.fontShaping?{fontShaping:B.fontShaping}:{},...B.author!==void 0?{author:B.author}:{},...B.locale!==void 0?{locale:B.locale}:{},translate:A,...B.revisionMarkup!==void 0?{revisionMarkup:B.revisionMarkup}:{},...B.reviewDisplayMode!==void 0?{reviewDisplayMode:B.reviewDisplayMode}:{},...B.fieldResults!==void 0?{fieldResults:B.fieldResults}:{},...B.contentLockPolicy!==void 0?{contentLockPolicy:B.contentLockPolicy}:{},...B.lockedControlNavigation!==void 0?{lockedControlNavigation:B.lockedControlNavigation}:{},...B.mode!==void 0?{mode:B.mode}:{},...M!==void 0?{revisionStyles:M}:{},...B.modules!==void 0?{modules:B.modules}:{},...B.zoom!==void 0?{zoom:B.zoom}:{},...B.zoomMode!==void 0?{zoomMode:B.zoomMode}:{},...B.tableInteractionLabel?{tableInteractionLabel:B.tableInteractionLabel}:{},...B.imageDecodePort?{imageDecodePort:B.imageDecodePort}:{},onFontError:ge=>y.current.onFontError?.(ge)}),ue=j.on("revisionMarkupChange",ge=>{b.current||(y.current.onRevisionMarkupChange?.(ge),v(Ye=>Ye+1));}),de=j.on("change",ge=>y.current.onChange?.(ge));return x(j),()=>{ue(),de(),j.destroy(),x(ge=>ge===j?null:ge);}},[t,o,C,f,S]),Lt.useEffect(()=>{if(!T)return;if(!T.snapshot().isOpening){y.current.onReady?.(T);return}let B=T.on("change",()=>{B(),y.current.onReady?.(T);});return B},[T]);let L=Lt.useRef({editor:null,zoom:void 0,mode:void 0});Lt.useEffect(()=>{if(!T)return;L.current.editor!==T&&(L.current={editor:T,zoom:void 0,mode:void 0});let A=false;s!==void 0&&s!==L.current.zoom&&(L.current.zoom=s,T.setZoom(s),A=true);let M=L.current.mode,j=c!==void 0&&(M===void 0||!LR(M,c)),ue=c===void 0?null:editor.resolveZoomMode(c),de=A&&c!==void 0&&ue!==null&&ue.type==="fit";(j||de)&&(L.current.mode=c,T.setZoomMode(c));},[T,s,c]),Lt.useEffect(()=>{if(!T||e.revisionMarkup===void 0)return;let B=editor.resolveRevisionMarkup(e.revisionMarkup);if(JSON.stringify(B)!==JSON.stringify(T.snapshot().revisionMarkup)){b.current=true;try{T.setRevisionMarkup(B);}finally{b.current=false;}}},[T,e.revisionMarkup,h]),Lt.useEffect(()=>{T&&T.setAuthor(r);},[T,r]);let I=Lt.useRef({editor:null,value:void 0});Lt.useEffect(()=>{if(T){if(I.current.editor!==T){I.current={editor:T,value:l};return}I.current.value!==l&&(I.current.value=l,T.setMode(l));}},[T,l]),Lt.useEffect(()=>{T&&T.setTranslate(a??p);},[T,a,p]),Lt.useEffect(()=>{T&&T.setLocale(i);},[T,i]),Lt.useEffect(()=>{T&&Vb(E.current,e.fieldResults);},[T,e.fieldResults]),Lt.useEffect(()=>{T&&Yb(P.current,e.contentLockPolicy);},[T,e.contentLockPolicy]),Lt.useEffect(()=>{T&&Qb(D.current,e.lockedControlNavigation);},[T,e.lockedControlNavigation]),Lt.useEffect(()=>{T&&T.setTableInteractionLabel(d??editor.defaultTableLabel);},[T,d]);let[F,O]=Lt.useState(0),[k,_]=Lt.useState(0),U=Lt.useRef([]),[z,re]=Lt.useState(0),X=z>0,ae=Lt.useRef(T);ae.current=T,Lt.useEffect(()=>{if(!(!T||!X))return T.setCommentDraftChrome({onRequest:()=>U.current.at(-1)?.()})},[T,X]);let K=Lt.useMemo(()=>({mounted:F,register:()=>(O(B=>B+1),()=>O(B=>Math.max(0,B-1))),gutters:k,reserveGutter:()=>(_(B=>B+1),()=>_(B=>Math.max(0,B-1))),registerCommentDraft:B=>(U.current.push(B),re(A=>A+1),()=>{let A=U.current.indexOf(B);A!==-1&&(U.current.splice(A,1),re(M=>Math.max(0,M-1)));}),requestCommentDraft:()=>{let B=ae.current;return B!==null&&editor.runToolbarCommand(B,"review.addComment").ok}}),[F,k]),J=Lt.useMemo(Bf,[]);return Lt.useEffect(()=>(S.connect(T),()=>S.connect(null)),[S,T]),jsxRuntime.jsx(kh,{value:a??p,children:jsxRuntime.jsx(Rt.Provider,{value:K,children:jsxRuntime.jsx(Jc.Provider,{value:T,children:jsxRuntime.jsx(cd.Provider,{value:J,children:jsxRuntime.jsx(ni.Provider,{value:S,children:jsxRuntime.jsx(HR,{children:jsxRuntime.jsx(AR,{children:jsxRuntime.jsx(dh,{value:e.popups,children:jsxRuntime.jsx(kl,{children:jsxRuntime.jsx(Db,{popups:e.popups,children:u})})})})})})})})})})}function HR({children:e}){let t=hl(true);return jsxRuntime.jsx(Ea.Provider,{value:t,children:e})}function AR({children:e}){let t=yl();return jsxRuntime.jsx(Fd.Provider,{value:t,children:e})}var ai=316,Yr=editor.REVIEW_MARKERS_GUTTER_PX,r0=24,ys={inlineStart:0,inlineEnd:ai},e0={inlineStart:Yr,inlineEnd:Yr},KR={inlineStart:0,inlineEnd:0},Rp={inlineStart:r0,inlineEnd:ai};function zR(e){return e.inlineStart===Rp.inlineStart&&e.inlineEnd===Rp.inlineEnd}function a0(e,t){return zR(e)?Math.max(0,t-(ai-Yr)):t}function i0({open:e,viewportWidth:t,pageWidthPx:o,inlineStartReservation:n=0,docked:r=false,scroll:i=false}){if(!e)return e0;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0)return ys;let a=Number.isFinite(n)&&n>0?n:0;return t-a-o-2*r0>=ai?ys:i?Rp:e0}var $R=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:editor.reviewPaneEntitledZoom(t,e.zoom,e.reviewPane.overflow),scroll:e.reviewPane.overflow==="scroll"}},UR=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.scroll===t.scroll&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function l0(){let e=Pe(),[t,o]=Lt.useState(null);return Lt.useEffect(()=>{if(!e){o(null);return}let n=()=>o(e.clientWidth);n();let r=editor.hostWindowOf(e).ResizeObserver;if(typeof r>"u")return;let i=new r(n);return i.observe(e),()=>i.disconnect()},[e]),t}function an(){let e=Lt.useContext(Rt),{pageSetup:t,reviewPaneOpen:o,entitledZoom:n,scroll:r}=W($R,UR),i=Pe(),a=Zf(),l=Lt.useRef(null);t&&(l.current=t.pageWidthTwips);let s=t?.pageWidthTwips??l.current,c=il(e),d=Lt.useCallback(g=>c?i0({open:o,viewportWidth:g??0,pageWidthPx:s===null||n===null?0:Oe(s)*n,inlineStartReservation:a,docked:n===null,scroll:r}):KR,[c,o,s,n,a,r]),[f,u]=Lt.useState(()=>d(i?i.clientWidth:null));return Lt.useEffect(()=>{let g=()=>u(d(i?i.clientWidth:null));g();let p=i?editor.hostWindowOf(i).ResizeObserver:void 0;if(!i||typeof p>"u")return;let m=new p(g);return m.observe(i),()=>m.disconnect()},[i,d]),f}var vs=[.25,.5,.75,1,1.25,1.5,2];function ii(e,t){return t==="in"?vs.find(n=>n>e+.001)??null:[...vs].reverse().find(n=>n<e-.001)??null}function s0(e,t){return e==="0"?1:e==="+"||e==="="?ii(t,"in")??t:e==="-"?ii(t,"out")??t:null}var Mp=Lt.createContext(false);function c0(e){let t=Lt.useContext(Mp),[o,n]=Lt.useState(null);return Lt.useLayoutEffect(()=>{let r=t?e?.parentElement??null:null;n(r?{host:r,scoped:r.closest(".docx-editor")!==null}:null);},[t,e]),{inside:t,host:o?.host??null,hostScoped:o?.scoped??false}}var QR=e=>e.reviewPaneOpen??true,eM=e=>e.zoomMode?.type==="fit";function xs({className:e,style:t,children:o}){let{t:n}=N(),r=Mt(),i=H(),a=W(QR),l=an(),s=W(eM),c=Lt.useContext(Rt),d=il(c),f=Pn(),u=Sn(),g=Lt.useCallback(m=>f?.setViewport(m),[f]),p=Lt.useCallback(m=>{if(!i||!(m.metaKey||m.ctrlKey)||m.altKey)return;let b=m.target;if(editor.isElementNode(b)&&b.closest('input, textarea, select, [role="dialog"]'))return;let h=s0(m.key,i.getZoom());h!==null&&(m.preventDefault(),i.setZoom(h));},[i]);return jsxRuntime.jsx("div",{ref:g,"data-testid":"docx-editor-scroll",tabIndex:0,role:"region","aria-label":n("editor.documentViewport"),onKeyDownCapture:p,...d?{"data-review-pane":a?"open":"closed"}:{},...s?{"data-zoom-fit":""}:{},className:`${r}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...d?{"--docx-review-gutter":`${l.inlineEnd}px`,"--docx-review-gutter-start":`${l.inlineStart}px`,"--docx-review-strip":`${2*Yr}px`}:{}},children:jsxRuntime.jsx(An.Provider,{value:true,children:jsxRuntime.jsx(Mp.Provider,{value:true,children:o})})})}var oM=editor.LOADING_SNAPSHOT;function u0({ref:e,editorRef:t}){Lt.useImperativeHandle(e,()=>({load:o=>t.current?.load(o),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(o,n)=>t.current?.exec(o,n)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:o=>t.current?.snapshot(o)??oM}),[t]);}function Xr(e,t,o,n){let r=Pe(),i=Lt.useRef({close:o,skip:n,viewport:r});i.current={close:o,skip:n,viewport:r},Lt.useEffect(()=>{let a=t.current;if(!e||!a)return;let l=d=>a.contains(d),s=editor.listenForPopupEscape({popup:a,contains:l,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current.viewport],skip:d=>i.current.skip?.(d)===true,close:d=>i.current.close(d)}),c=editor.listenForPopupFocusLeave({popup:a,contains:l,close:()=>i.current.close(false)});return ()=>{s(),c();}},[e,t]);}var pM=e=>e.editingMode??"editing",Np='[role="menuitemradio"]:not([disabled])',mM=(e,t)=>e.length===t.length&&e.every((o,n)=>o===t[n]),fM=e=>e.isLoading||e.isOpening===true,li=[{mode:"editing",labelKey:"editingMode.editing",hintKey:"editingMode.editingHint",path:"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"},{mode:"suggesting",labelKey:"editingMode.suggesting",hintKey:"editingMode.suggestingHint",path:"M240-400h122l40-40H240v40Zm0-100h222l40-40H240v40Zm0-100h322l40-40H240v40ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v320h-80v-320H160v525l46-45h274v80H240L80-80Zm520-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T943-380L723-160H600Zm300-263-37-37 37 37ZM660-220h38l121-122-19-18-18-19-122 121v38Zm140-141-18-19 37 37-19-18Z"},{mode:"viewing",labelKey:"editingMode.viewing",hintKey:"editingMode.viewingHint",path:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Z"}],gM=Object.freeze(li.map(()=>null));function hM(e){return e?li.map(t=>{let o=e.can({type:"setEditingMode",mode:t.mode});return o.ok?null:o.reason}):gM}var bM="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Ts({className:e,hidden:t}){let o=H(),n=W(pM),r=W(fM),i=te(),{t:a}=N(),[l,s]=Lt.useState(false),c=Lt.useRef(null),d=Lt.useRef(null),f=Lt.useRef(null);Lt.useEffect(()=>{if(!l)return;let y=f.current?.querySelectorAll(Np);(f.current?.querySelector(`${Np}[aria-checked="true"]`)??y?.[0]??void 0)?.focus();},[l]);let u=Lt.useCallback(y=>{let C=[...f.current?.querySelectorAll(Np)??[]],T=C.indexOf(editor.hostDocumentOf(f.current).activeElement),x=E=>{y.preventDefault(),C[(E+C.length)%C.length]?.focus();};y.key==="ArrowDown"?x(T+1):y.key==="ArrowUp"?x(T-1):y.key==="Home"?x(0):y.key==="End"&&x(C.length-1);},[]);Lt.useEffect(()=>{if(!l)return;let y=T=>{let x=c.current;x&&editor.isDomNode(T.target)&&x.contains(T.target)||s(false);},C=editor.hostDocumentOf(c.current);return C.addEventListener("mousedown",y,true),()=>{C.removeEventListener("mousedown",y,true);}},[l]),Xr(l,c,y=>{s(false),y&&d.current?.focus();});let g=Lt.useCallback(y=>{s(false),editor.runToolbarCommand(o,"review.editingMode",y),o?.focus();},[o]),p=editor.toolbarCommandState(o,"review.editingMode"),m=i18n.localizeDisabledReason(p.disabledReason,a),b=W(()=>hM(o),mM),h=Lt.useMemo(()=>li.find(y=>y.mode===n)??li[0],[n]);if(t)return null;let v=ee("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":n,"aria-haspopup":"menu","aria-expanded":l,"aria-label":i(v?.labelKey??"editingMode.label"),disabled:r||!p.enabled,...m?{title:m}:{},onMouseDown:q,onClick:()=>s(y=>!y),children:[Lp(h.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsx("div",{ref:f,className:"docx-toolbar__mode-menu",role:"menu","aria-label":i(v?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:li.map((y,C)=>{let T=i18n.localizeDisabledReason(b[C]??null,a);return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":y.mode===n,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${y.mode}`,disabled:T!==null,...T?{title:T}:{},onMouseDown:q,onClick:()=>g(y.mode),children:[Lp(y.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(y.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(y.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:y.mode===n?Lp(bM):null})]},y.mode)})}):null]})}Ts.docxSlot="review.editingMode";function Lp(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}var h0=[],xM=()=>{};function si(){let e=H(),t=Lt.useCallback(o=>{if(!e)return xM;let n=ba(o),r=e.on("change",n),i=e.on("selectionChange",n);return ()=>{r(),i();}},[e]);return Lt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??h0,()=>h0)}var kM=e=>e.hiddenReviewAuthors??[];function Ps({className:e,hidden:t,icon:o}){let n=H(),r=si(),i=W(kM),a=new Set(i),l=r.every(C=>!a.has(C.author)),[s,c]=Lt.useState(false),d=Lt.useRef(null),f=Lt.useRef(null),u=Lt.useRef(null),g=te(),{t:p}=N();Lt.useEffect(()=>{if(!s)return;u.current?.querySelector('[role="menuitemcheckbox"]')?.focus();let C=x=>{d.current?.contains(x.target)||c(false);},T=editor.hostDocumentOf(d.current);return T.addEventListener("mousedown",C,true),()=>{T.removeEventListener("mousedown",C,true);}},[s]),Xr(s,d,C=>{c(false),C&&f.current?.focus();});let m=Lt.useCallback(C=>{let T=[...u.current?.querySelectorAll('[role="menuitemcheckbox"]')??[]],x=T.indexOf(editor.hostDocumentOf(u.current).activeElement),E=P=>{C.preventDefault(),T[(P+T.length)%T.length]?.focus();};C.key==="ArrowDown"?E(x+1):C.key==="ArrowUp"?E(x-1):C.key==="Home"?E(0):C.key==="End"?E(T.length-1):C.key==="Tab"&&c(false);},[]);if(t)return null;let b=ee("review.authors"),h=editor.toolbarCommandState(n,"review.authors"),v=i18n.localizeDisabledReason(h.disabledReason,p),y=g(b?.labelKey??"reviewers.label");return jsxRuntime.jsxs("div",{ref:d,className:`docx-toolbar__reviewers${e?` ${e}`:""}`,"data-slot":"review.authors",children:[jsxRuntime.jsxs("button",{ref:f,type:"button",className:"docx-toolbar__picker","data-testid":"reviewers-trigger","aria-haspopup":"menu","aria-expanded":s,"aria-label":y,disabled:!h.enabled,title:v??y,onMouseDown:q,onClick:()=>c(C=>!C),children:[o??oe(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:y}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s?jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__reviewers-menu",role:"menu","aria-label":y,"data-testid":"reviewers-menu",onKeyDown:m,children:[jsxRuntime.jsx(y0,{checked:l,label:p("reviewers.all"),testId:"reviewer-all",onChoose:()=>n?.setAllReviewAuthorsVisible(!l)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),r.map(C=>jsxRuntime.jsx(y0,{checked:!a.has(C.author),label:C.author||"\u2014",testId:`reviewer-${C.slot}`,color:C.color,onChoose:()=>n?.setReviewAuthorVisible(C.author,a.has(C.author))},C.author))]}):null]})}Ps.docxSlot="review.authors";function y0(e){return jsxRuntime.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,className:"docx-toolbar__reviewer-item","data-testid":e.testId,onMouseDown:q,onClick:e.onChoose,children:[jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:e.checked?"\u2713":""}),e.color?jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-swatch",style:{background:e.color}}):null,jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-name",children:e.label})]})}var x0=Lt.createContext(null);function C0({children:e}){let t=Ur(),[o,n]=Lt.useState(false),r=Lt.useRef(null),i=Pe(),a=Lt.useRef(i);a.current=i;let l=Lt.useMemo(()=>({open:c=>{if(t){t.open("paragraph",c);return}r.current=c??editor.hostDocumentOf(a.current).activeElement,n(true);}}),[t]),s=Lt.useCallback(()=>{n(false);let c=r.current;r.current=null,editor.isHTMLElementNode(c)&&c.isConnected&&c.focus({preventScroll:true});},[]);return jsxRuntime.jsxs(x0.Provider,{value:l,children:[e,jsxRuntime.jsx(Lo,{open:o,onClose:s})]})}function T0(){return Lt.useContext(x0)}var Hp=["M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"],Ap=Lt.createContext({close:()=>{}});function Jr(){return Lt.useContext(Ap).close}function GM(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function k0({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__more-control",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-label",children:e}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-body",children:t})]})}function w0({slot:e}){let t=te(),o=Mo(),{close:n}=Lt.useContext(Ap),{execute:r,isActive:i,isEnabled:a,disabledReason:l,value:s}=ce(e),c=ee(e),d=editor.chromeSlotIsToggle(e),f=o(t(c?.labelKey??e));return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...l?{title:l}:{},...d?{"aria-pressed":i}:{},...i?{"data-active":""}:{},...s!==null?{"data-value":s}:{},onMouseDown:q,onClick:u=>{r(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:oe(c?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:f})]})}function D0({sections:e,className:t}){let o=te(),[n,r]=Lt.useState(false),i=Lt.useRef(null),a=Lt.useRef(null),l=Lt.useRef(null),s=Lt.useRef(false),c=Lt.useId(),d=Pe(),f=Lt.useRef(d);f.current=d;let u=o("formattingBar.more"),g=Lt.useCallback(v=>{r(false),v&&a.current?.focus();},[]),p=Lt.useMemo(()=>({close:g}),[g]);Lt.useEffect(()=>{if(!n)return;let v=P=>{let D=P.target;editor.isDomNode(D)&&i.current?.contains(D)||r(false);},y=i.current,C=P=>i.current?.contains(P)===true||l.current?.contains(P)===true,T=y?editor.listenForPopupEscape({popup:y,contains:C,chromeRoot:()=>i.current?.closest(".docx-editor"),editorElements:()=>[f.current],skip:()=>editor.hasOpenNestedPopup(l.current),close:g}):void 0,x=y?editor.listenForPopupFocusLeave({popup:y,contains:C,close:()=>r(false)}):void 0,E=editor.hostDocumentOf(y);return E.addEventListener("mousedown",v,true),()=>{E.removeEventListener("mousedown",v,true),T?.(),x?.();}},[n,g]);let[m,b]=Lt.useState(null);Lt.useLayoutEffect(()=>{if(!n){b(null);return}let v=()=>{let C=i.current,T=l.current,x=a.current,E=C?.ownerDocument.defaultView;if(!C||!T||!x||!E)return;let P=x.getBoundingClientRect(),D=editor.toolbarPanelPlacement({triggerLeft:P.left,triggerRight:P.right,panelWidth:T.offsetWidth,viewportWidth:E.innerWidth}),w=D.left-C.getBoundingClientRect().left;b(S=>S&&S.left===w&&S.maxWidth===D.maxWidth&&S.anchor===D.anchor?S:{...D,left:w});};v();let y=i.current?.ownerDocument.defaultView;return y?.addEventListener("resize",v),()=>y?.removeEventListener("resize",v)},[n]),Lt.useEffect(()=>{if(!n||!s.current)return;s.current=false;let v=l.current;v&&GM(v);},[n]);let h=v=>{v.key!=="Escape"||v.defaultPrevented||(v.preventDefault(),g(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[_a]:"",children:[jsxRuntime.jsx("button",{ref:a,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?c:void 0,"aria-label":u,title:u,...n?{"data-active":""}:{},onMouseDown:q,onClick:()=>r(v=>!v),onKeyDown:v=>{v.key==="ArrowDown"&&(v.preventDefault(),s.current=true,r(true));},children:oe(Hp)}),n?jsxRuntime.jsx(Ap.Provider,{value:p,children:jsxRuntime.jsx("div",{ref:l,id:c,role:"dialog","aria-label":u,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",...m?{"data-anchor":m.anchor}:{},style:m?{left:m.left,right:"auto",maxInlineSize:m.maxWidth}:void 0,onKeyDown:h,children:e.map(v=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":v.label??o(v.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:v.label??o(v.labelKey)}),v.children]},v.id))})}):null]})}function YM(e){if(!Lt.isValidElement(e))return false;let t=e.type;return (typeof t=="function"||typeof t=="object")&&t.docxToolbarGroup===true}function M0(e,t,o,n){let r=new Map,i=new Map,a=new Map,l=[];for(let s of Lt.Children.toArray(e)){if(YM(s)){a.delete(s.props.id),a.set(s.props.id,s.props);continue}let c=t(s);if(c&&o(c))r.set(c,s);else if(c&&n(c))i.set(c,s);else {if(c&&Lt.isValidElement(s)&&s.props.hidden===true)continue;l.push(s);}}return {overrides:r,tableOverrides:i,groups:[...a.values()],appended:l}}function ks(e,t){return e.label!==void 0?e.label:e.labelKey!==void 0?t(e.labelKey):e.id}function Op(e){let t=te();return e.hidden?null:jsxRuntime.jsx("div",{role:"group","aria-label":ks(e,t),className:`docx-toolbar__group${e.className?` ${e.className}`:""}`,"data-toolbar-host-group":e.id,children:e.children})}Op.docxToolbarGroup=true;function di(e){return e.hidden?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.children})}di.docxToolbarSlot=true;var Bp=Lt.createContext("bar");function _0(){return Lt.useContext(Bp)}var ws="review.addComment";function t1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=Lt.useContext(Rt),a=te(),{isEnabled:l,reason:s}=xl(a),c=Jr();if(t||(i?.mounted??0)===0)return null;let d=ee(ws),f=a(d?.labelKey??ws),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":ws,disabled:!l,...l?{}:{"data-disabled":""},"aria-label":f,title:s??f,onMouseDown:q,onClick:()=>{i?.requestCommentDraft()&&c(false);}};return n?jsxRuntime.jsx(Y,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??oe(d?.paths)})}var Wp=Object.assign(t1,{docxSlot:ws});var L0=new Set;function Ds(e){!mt()||L0.has(e)||(L0.add(e),console.warn(`[docx-editor] ${e}`));}function F0(e,t,o){Ds(`Toolbar.Group "${e}" has after="${t}", but no group has that id. The group is placed after every other group. Known ids: ${o.join(", ")}.`);}function H0(e,t){Ds(`Toolbar.Group "${e}" is a built-in group, so its ${t} is ignored. A built-in group keeps its own label and place in the bar.`);}function A0(e){Ds(`Toolbar.Group "${e}" uses the id of the contextual table group, so it is ignored. Give the group another id.`);}function O0(e,t){Ds(t?`Toolbar slot "${e}" is not part of the preset arrangement, so its content is appended after the groups. Put it in a Toolbar.Group to give it a place.`:`"${e}" is not a toolbar slot id. Its content is appended after the groups. Use a ChromeSlotId such as "text.bold".`);}var qp=[{value:"inline",labelKey:"imageWrap.menu.inLineWithText",iconName:"wrap_text"},{value:"square",labelKey:"imageWrap.square",iconName:"crop_square"},{value:"squareLeft",labelKey:"imageWrap.menu.squareLeft",iconName:"format_image_left"},{value:"squareRight",labelKey:"imageWrap.menu.squareRight",iconName:"format_image_right"},{value:"tight",labelKey:"imageWrap.tight",iconName:"wrap_text"},{value:"through",labelKey:"imageWrap.through",iconName:"wrap_text"},{value:"topAndBottom",labelKey:"imageWrap.topAndBottom",iconName:"vertical_align_center"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function Ms({className:e,hidden:t,asChild:o,children:n}){let{t:r}=N(),i=te(),{execute:a,value:l,isEnabled:s,disabledReason:c}=Ga("image.wrap"),[d,f]=Lt.useState(false),u=Lt.useRef(null),g=Lt.useRef(null),p=Lt.useRef(null),m=Lt.useId(),b=Lt.useMemo(()=>qp.find(x=>x.value===l)??qp[0],[l]),h=ee("image.wrap"),v=i(h?.labelKey??"formattingBar.imageWrap");Lt.useEffect(()=>{if(!d)return;let x=D=>{let w=u.current;w&&editor.isDomNode(D.target)&&w.contains(D.target)||f(false);},E=D=>{D.key==="Escape"&&(D.preventDefault(),f(false),g.current?.focus());},P=editor.hostDocumentOf(u.current);return P.addEventListener("mousedown",x,true),P.addEventListener("keydown",E),()=>{P.removeEventListener("mousedown",x,true),P.removeEventListener("keydown",E);}},[d]);let y=Lt.useCallback(x=>{f(false),a(x);},[a]);if(t)return null;let C=r("imageWrap.tooltipPrefix",{label:r(b.labelKey)}),T={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!s,...s?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?m:void 0,"aria-label":v,title:c??C,onMouseDown:q,onClick:()=>f(x=>!x)};return jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__image-wrap",children:[o?jsxRuntime.jsx(Y,{...T,children:n}):jsxRuntime.jsx("button",{...T,children:n??oe(h?.paths)}),d?jsxRuntime.jsx("div",{ref:p,id:m,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:x=>x.stopPropagation(),children:qp.map(x=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":l===x.value,...l===x.value?{"data-active":""}:{},onMouseDown:q,onClick:()=>y(x.value),children:r(x.labelKey)},x.value))}):null]})}Ms.docxSlot="image.wrap";var ui=Object.assign(Ms,{docxSlot:"image.wrap"});var Qr="table.insert";function g1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=H(),{isEnabled:a,disabledReason:l}=ce(Qr),s=te(),[c,d]=Lt.useState(false),f=Lt.useRef(null),u=Lt.useRef(null),g=Lt.useRef(null),p=Lt.useId(),m=Jr();Lt.useEffect(()=>{let T=f.current?.ownerDocument;if(!c||!T)return;let x=E=>{let P=f.current;P&&editor.isDomNode(E.target)&&P.contains(E.target)||d(false);};return T.addEventListener("mousedown",x,true),()=>T.removeEventListener("mousedown",x,true)},[c]),Lt.useEffect(()=>{c&&f.current?.querySelector('[role="gridcell"][tabindex="0"]')?.focus();},[c]);let b=c&&a;Lt.useLayoutEffect(()=>{let T=g.current,x=f.current,E=x?.ownerDocument.defaultView;if(!b||!T||!x||!E||x.closest(".docx-toolbar__more-panel"))return;let P=x.getBoundingClientRect(),D=editor.toolbarPopupLeft({anchorLeft:P.left,popupWidth:T.offsetWidth,viewportWidth:E.innerWidth});T.style.left=`${D-P.left}px`;},[b]);let h=Lt.useCallback(()=>{d(false),m(false);},[m]);if(t)return null;let v=ee(Qr),y=s(v?.labelKey??Qr),C={ref:u,type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Qr,disabled:!a,...a?{}:{"data-disabled":""},...b?{"data-active":""}:{},"aria-haspopup":"grid","aria-expanded":b,"aria-controls":b?p:void 0,"aria-label":y,title:l??y,onMouseDown:q,onClick:()=>{if(!c){d(true);return}d(false),i?.focus();},onKeyDown:T=>{T.key==="ArrowDown"&&(T.preventDefault(),d(true));}};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__table-insert",children:[n?jsxRuntime.jsx(Y,{...C,children:r}):jsxRuntime.jsx("button",{...C,children:o??r??oe(v?.paths)}),b?jsxRuntime.jsx("div",{ref:g,id:p,className:"docx-toolbar__menu docx-toolbar__table-insert-menu",onBlur:T=>{let x=T.relatedTarget;editor.isDomNode(x)&&!f.current?.contains(x)&&d(false);},onKeyDown:T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),d(false),u.current?.focus());},children:jsxRuntime.jsx(Rl,{slot:Qr,label:s("toolbar.insertTable"),onInserted:h})}):null]})}var zp=Object.assign(g1,{docxSlot:Qr});function Qe(e){return Object.assign(o=>jsxRuntime.jsx(wn,{slotId:e,...o}),{docxSlot:e})}var Z0=Qe("history.undo"),q0=Qe("history.redo"),K0=Qe("text.bold"),z0=Qe("text.italic"),$0=Qe("text.underline"),U0=Qe("text.strike"),V0=Qe("format.clear"),G0=Qe("script.super"),j0=Qe("script.sub"),Y0=Qe("alignment.left"),X0=Qe("alignment.center"),J0=Qe("alignment.right"),Q0=Qe("alignment.justify"),ey=Qe("direction.ltr"),ty=Qe("direction.rtl"),oy=Qe("list.bullet"),ny=Qe("list.numbered"),ry=Qe("list.outdent"),ay=Qe("list.indent");var iy=Qe("review.comments");function x1({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=H(),{openAtCaret:a}=Ed(),l=editor.chromeProbeForSlot("text.link"),s=i&&l?i.can(l):null,c=s?.ok===true,{t:d}=N(),f=i18n.localizeDisabledReason(s&&!s.ok?s.reason:null,d),u=te();if(t)return null;let g=ee("text.link"),p=u(g?.labelKey??"text.link"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!c,...c?{}:{"data-disabled":""},"aria-label":p,title:f??p,onMouseDown:q,onClick:()=>a()};return n?jsxRuntime.jsx(Y,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:o??r??oe(g?.paths)})}var $p=Object.assign(x1,{docxSlot:"text.link"});function C1({className:e,hidden:t}){let o=H(),{onSave:n}=Lt.useContext(kn),r=te();if(t)return null;let i=ee("file.save"),a=r(i?.labelKey??"file.save"),l=!o||!n;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:l,...l?{"data-disabled":""}:{},"aria-label":a,title:a,onMouseDown:q,onClick:()=>n?.(),children:oe(i?.paths)})}var Up=Object.assign(C1,{docxSlot:"file.save"});function Un({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}var P1=e=>({zoom:e.zoom,mode:e.zoomMode}),S1=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,sy={type:"fixed"};function Vp(){let e=H(),{zoom:t,mode:o}=W(P1,S1),n=Lt.useCallback(i=>{e?.setZoom(i);},[e]),r=Lt.useCallback(i=>{e?.setZoomMode(i);},[e]);return Lt.useMemo(()=>{let i=o??sy,a=ii(t,"out"),l=ii(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:n,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(sy),n(1);},zoomIn:()=>l!==null&&n(l),zoomOut:()=>a!==null&&n(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:vs}},[e,t,o,n,r])}var fi=2,gi=3276,mi=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],R1=e=>e.formatting?.fontSizePt??null;function uy(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function py(e,t,o){for(let n=t.length-1;n>=0;n-=1)if(t[n]<e)return t[n];return Math.max(e-1,o)}function hy(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:q,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:q,onClick:e.onIncrease,children:"+"})]})}function M1(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let o=Number(t);if(!Number.isFinite(o))return null;let n=Math.round(o*2);return n<fi||n>gi?null:n}function _1({className:e,hidden:t}){let o=H(),n=W(R1),{isEnabled:r,disabledReason:i}=ce("font.size"),a=te(),[l,s]=Lt.useState(false),[c,d]=Lt.useState(null),f=Lt.useRef(null);Ro(f,l,()=>s(false));let u=Lt.useRef(null),g=Lt.useId(),p=Lt.useCallback(x=>{if(!o)return;let E=editor.commandForSlotValue("font.size",x);E&&o.can(E).ok&&o.exec(E);},[o]),m=Lt.useCallback(x=>{p(Math.min(gi,Math.max(fi,Math.round(x*2))));},[p]),b=Lt.useCallback(x=>{s(false),d(null),u.current?.blur(),x&&o?.focus();},[o]);if(Lt.useEffect(()=>{if(!l)return;let x=P=>{let D=f.current;D&&editor.isDomNode(P.target)&&D.contains(P.target)||(s(false),d(null));},E=editor.hostDocumentOf(f.current);return E.addEventListener("mousedown",x),()=>E.removeEventListener("mousedown",x)},[l]),t)return null;let h=r&&n!==null,v=n===null?"\u2014":String(Math.round(n*2)/2),y=c??v,C=n===null?null:Math.round(n*2)/2,T=()=>{if(c===null)return;let x=M1(c);x!==null&&p(x);};return jsxRuntime.jsxs("span",{ref:f,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(hy,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:u,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:y,disabled:!r,role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),"aria-controls":l?g:void 0,autoComplete:"off",onChange:x=>{d(x.target.value),s(true);},onFocus:x=>{x.target.select(),s(true);},onClick:()=>s(true),onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),T(),b(true)):x.key==="Escape"?(x.preventDefault(),b(true)):(x.key==="ArrowDown"||x.key==="ArrowUp")&&(x.preventDefault(),s(true),n!==null&&m(x.key==="ArrowDown"?py(n,mi,fi/2):uy(n,mi,gi/2)));},onBlur:()=>{T(),d(null);}}),canDecrease:h&&Math.round(n*2)>fi,canIncrease:h&&Math.round(n*2)<gi,onDecrease:()=>m(py(n??0,mi,fi/2)),onIncrease:()=>m(uy(n??0,mi,gi/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox",tabIndex:0,"aria-label":a("fontSize.listLabel"),id:g,children:mi.map(x=>{let E=C===x;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":E,...E?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>{m(x),b(true);},children:x},x)})}):null]})}var Yp=Object.assign(_1,{docxSlot:"font.size"});function I1({className:e,hidden:t}){let o=H(),{zoom:n,isFit:r,mode:i,setZoom:a,setMode:l,zoomIn:s,zoomOut:c,canZoomIn:d,canZoomOut:f,levels:u}=Vp(),g=te(),[p,m]=Lt.useState(false),b=Lt.useRef(null);Ro(b,p,()=>m(false)),Lt.useEffect(()=>{if(!p)return;let x=P=>{let D=b.current;D&&editor.isDomNode(P.target)&&D.contains(P.target)||m(false);},E=editor.hostDocumentOf(b.current);return E.addEventListener("mousedown",x),()=>E.removeEventListener("mousedown",x)},[p]);let h=Lt.useCallback(x=>{b.current?.querySelector("[aria-haspopup]")?.focus(),m(false),a(x);},[a]),v=Lt.useCallback(x=>{b.current?.querySelector("[aria-haspopup]")?.focus(),m(false),l(x==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[l]);if(t)return null;let y=`${Math.round(n*100)}%`,C=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),T=editor.sameZoomMode(i,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:b,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(hy,{className:e,groupLabel:g("zoom.zoomLevel"),decreaseLabel:g("zoom.zoomOut"),increaseLabel:g("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!o,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":`${g("zoom.zoomLevel")}: ${y}`,onMouseDown:q,onClick:()=>m(x=>!x),children:[y,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:f,canIncrease:d,onDecrease:c,onIncrease:s}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox",tabIndex:0,"aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":C,...C?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>v("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":T,...T?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>v("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),u.map(x=>{let E=!r&&Math.abs(x-n)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option",tabIndex:-1,"aria-selected":E,...E?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>h(x),children:`${Math.round(x*100)}%`},x)})]}):null]})}var Xp=Object.assign(I1,{docxSlot:"zoom.level"});function Vn(e,t,o,n=false){let r=Pe(),i=Lt.useRef(r);i.current=r,Lt.useEffect(()=>{e&&n&&t(false);},[e,n,t]),Lt.useEffect(()=>{let a=o.current;if(!e||n||!a)return;let l=a.ownerDocument,s=u=>a.contains(u),c=u=>{u.composedPath().includes(a)||t(false);},d=editor.listenForPopupEscape({popup:a,contains:s,chromeRoot:()=>a.closest(".docx-editor"),editorElements:()=>[i.current],close:u=>{t(false),u&&a.querySelector("[aria-haspopup]")?.focus();}}),f=editor.listenForPopupFocusLeave({popup:a,contains:s,close:()=>t(false)});return l.addEventListener("mousedown",c),()=>{l.removeEventListener("mousedown",c),d(),f();}},[e,n,t,o]);}var xy=10,Cy=0,B1=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),W1=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Z1({className:e,hidden:t}){let o=H(),n=W(B1,W1),{isEnabled:r,disabledReason:i}=ce("list.lineSpacing"),a=ce("paragraph.dialog"),l=T0(),s=te(),{lang:c}=N(),[d,f]=Lt.useState(false),u=Lt.useRef(null),g=Lt.useRef(null);Vn(d,f,u,t);let p=Lt.useCallback(C=>{f(false),!(!o||!C.command)&&o.can(C.command).ok&&o.exec(C.command);},[o]),m=Lt.useCallback((C,T)=>{if(f(false),!o)return;let x={type:"setParagraphSpacing",[C]:T};o.can(x).ok&&o.exec(x);},[o]);if(t)return null;let b=ee("list.lineSpacing"),h=(n.spaceBeforePt??0)>0,v=(n.spaceAfterPt??0)>0,y=editor.lineSpacingMenuRows(n.lineSpacing);return jsxRuntime.jsxs("span",{ref:u,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{ref:g,type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-label":s("lineSpacing.label"),title:i??s("lineSpacing.label"),onMouseDown:q,onClick:()=>f(C=>!C),children:[oe(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),d&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[y.map(C=>{let T=C.selected;return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":T,...T?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>p(C),children:[editor.lineSpacingMenuRowLabel(C,s,c),T?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]},`${C.spacing.rule}:${C.spacing.value}`)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item","data-slot":"paragraph.dialog",disabled:!a.isEnabled,title:a.disabledReason??void 0,onMouseDown:q,onClick:()=>{f(false),l?.open(g.current);},children:s("lineSpacing.options")}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>m("beforePt",h?Cy:xy),children:s(h?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:q,onClick:()=>m("afterPt",v?Cy:xy),children:s(v?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Jp=Object.assign(Z1,{docxSlot:"list.lineSpacing"});var z1=["alignment.left","alignment.center","alignment.right","alignment.justify"];function $1({className:e,hidden:t}){let o=ce("alignment.left"),n=ce("alignment.center"),r=ce("alignment.right"),i=ce("alignment.justify"),a=te(),[l,s]=Lt.useState(false),c=Lt.useRef(null);if(Vn(l,s,c,t),t)return null;let d=[o,n,r,i],f=z1.map((m,b)=>({slot:m,control:ee(m),state:d[b]})),u=f.find(m=>m.state.isActive)??f[0],g=f.some(m=>m.state.isEnabled),p=a(u.control?.labelKey??u.slot);return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":l,"aria-label":p,title:g?p:u.state.disabledReason??p,onMouseDown:q,onClick:()=>s(m=>!m),children:[oe(u.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:f.map(m=>{let b=a(m.control?.labelKey??m.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":m.slot,disabled:!m.state.isEnabled,...m.state.isActive?{"data-active":""}:{},"aria-pressed":m.state.isActive,"aria-label":b,title:m.state.disabledReason??b,onMouseDown:q,onClick:()=>{m.state.execute(),s(false);},children:oe(m.control?.paths)},m.slot)})}):null]})}var Ns=Object.assign($1,{docxSlot:"alignment"});function em(e){let{label:t,icon:o,active:n,disabled:r,disabledReason:i,onSelect:a,asChild:l,className:s,children:c}=e,d=_0(),f=Jr();if(d==="panel"&&!l)return jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__more-command${s?` ${s}`:""}`,disabled:r,...n?{"data-active":""}:{},...n!==void 0?{"aria-pressed":n}:{},...r&&i?{title:i}:{},onMouseDown:g=>q(g),onClick:g=>{a?.(),f(g.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:o??c}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:t})]});let u={type:"button",className:`docx-toolbar__button${s?` ${s}`:""}`,disabled:r,...n?{"data-active":""}:{},...r?{"data-disabled":""}:{},...n!==void 0?{"aria-pressed":n}:{},"aria-label":t,title:r?i??t:t,onMouseDown:g=>q(g),onClick:r?void 0:a};return l?jsxRuntime.jsx(Y,{...u,children:c}):jsxRuntime.jsx("button",{...u,children:o??c})}var e2=Object.freeze([]),t2=e=>e.formatting?.fontFamily??null,o2=e=>e;function Hs(){let e=H(),t=W(t2),o=W(o2),n=Lt.useMemo(()=>e&&!o.isLoading?e.getAvailableFonts():e2,[e,o]),{isEnabled:r}=ce("font.family"),i=Lt.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("font.family",a);l&&e.can(l).ok&&e.exec(l);},[e]);return Lt.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var Sy=Lt.createContext(null);function om(){return Lt.useContext(Sy)}function nm({asChild:e,className:t,children:o}){let n=om(),r=te();if(!n)return null;let i=r(ee("font.family")?.labelKey??"font.family"),a={onClick:()=>n.setOpen(!n.open),onMouseDown:q,disabled:!n.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,"aria-label":o!==void 0?void 0:`${i}: ${n.value??"\u2014"}`,title:i},l=o??jsxRuntime.jsx("span",{children:n.value??"\u2014"});return e?jsxRuntime.jsx(Y,{...a,children:l}):jsxRuntime.jsx("button",{type:"button",...a,children:l})}nm.docxToolbarPart=true;var n2=new Map([["arial","sansSerif"],["calibri","sansSerif"],["helvetica","sansSerif"],["verdana","sansSerif"],["open sans","sansSerif"],["roboto","sansSerif"],["times new roman","serif"],["georgia","serif"],["cambria","serif"],["garamond","serif"],["courier new","monospace"],["consolas","monospace"]]),r2=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function ky({asChild:e,className:t,children:o}){let n=om(),r=te(),[i,a]=Lt.useState("");if(Lt.useEffect(()=>{n?.open||a("");},[n?.open]),!n||!n.open)return null;let l={role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`},s;return o!==void 0?s=o:s=r2.map(d=>({...d,fonts:n.options.filter(f=>f.toLowerCase().includes(i.toLowerCase())&&(n2.get(f.toLowerCase())??"other")===d.category)})).filter(d=>d.fonts.length>0).map((d,f)=>jsxRuntime.jsxs("div",{role:"group",children:[f>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator","aria-hidden":"true"}):null,d.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(d.labelKey)}):null,d.fonts.map(u=>jsxRuntime.jsx(wy,{value:u},u))]},d.category)),e?jsxRuntime.jsx(Y,{...l,children:s}):o!==void 0?jsxRuntime.jsx("div",{...l,children:s}):jsxRuntime.jsxs("div",{className:l.className,children:[jsxRuntime.jsx("input",{type:"search",className:"docx-toolbar__font-search","aria-label":r("font.search"),placeholder:r("font.search"),value:i,onChange:c=>a(c.target.value)}),jsxRuntime.jsx("div",{role:"listbox",tabIndex:0,"aria-label":r("font.selectAriaLabel"),className:"docx-toolbar__font-options",children:s})]})}function wy({value:e,asChild:t,className:o,children:n}){let r=H(),i=om();if(!i)return null;let a=i.value===e,l={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:q,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__font-family-item${o?` ${o}`:""}`},s=n??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(Y,{...l,children:s}):jsxRuntime.jsxs("button",{type:"button",...l,children:[s,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function a2({hidden:e,asChild:t,className:o,children:n}){let r=Hs(),[i,a]=Lt.useState(false),l=Lt.useRef(null);Ro(l,i,()=>a(false)),Lt.useEffect(()=>{if(!i)return;let f=g=>{let p=l.current;p&&editor.isDomNode(g.target)&&p.contains(g.target)||a(false);},u=editor.hostDocumentOf(l.current);return u.addEventListener("mousedown",f),()=>u.removeEventListener("mousedown",f)},[i]);let s=Lt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__font-family${o?` ${o}`:""}`,"data-slot":"font.family"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nm,{}),jsxRuntime.jsx(ky,{})]});return jsxRuntime.jsx(Sy.Provider,{value:s,children:t?jsxRuntime.jsx(Y,{...c,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...c,children:d})})}var rm=Object.assign(a2,{docxSlot:"font.family",Trigger:nm,Content:ky,Item:wy});var l2={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},s2=new Set(["Title","Heading1","Heading2","Heading3"]),c2={Subtitle:"666666"},d2="#4a6c8c";function Dy(e){let t=l2[e.styleId],n={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??s2.has(e.styleId))&&(n.fontWeight="bold"),e.italic&&(n.fontStyle="italic");let r=e.color??c2[e.styleId];return r?n.color=`#${r}`:e.styleId.startsWith("Heading")&&(n.color=d2),n}var u2=/^heading ([1-9])$/;function am(e,t){let o=e||t,n=u2.exec(o);return n?`Heading ${n[1]}`:o}function Ry(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:am(t.name,t.styleId),priority:99}))}function C2(e){let t=e.fontSizePt;return {...e.fontFamily?{fontFamily:e.fontFamily}:{},...t?{fontSize:`${Math.min(Math.max(t,9),20)}px`}:{},...e.bold?{fontWeight:700}:{},...e.italic?{fontStyle:"italic"}:{},...e.color?{color:`#${e.color}`}:{}}}var T2=Object.freeze([]),E2=e=>e.formatting?.styleId??null,P2=e=>e;function As(){let e=H(),t=W(E2),o=W(P2),n=Lt.useMemo(()=>e&&!o.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:am(a.name,a.styleId),preview:a.preview})):T2,[e,o]),{isEnabled:r}=ce("styles.style"),i=Lt.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",a);l&&e.can(l).ok&&e.exec(l);},[e]);return Lt.useMemo(()=>({value:t,setValue:i,options:n,isEnabled:r}),[t,i,n,r])}var My=Lt.createContext(null);function lm(){return Lt.useContext(My)}function sm({asChild:e,className:t,children:o}){let n=lm(),r=te();if(!n)return null;let i=ee("styles.style"),a=r(i?.labelKey??"styles.style"),l={onClick:()=>n.setOpen(!n.open),onMouseDown:q,disabled:!n.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...n.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":n.open,title:a},s=n.options.find(d=>d.styleId===n.value),c=o??(n.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:s?.name??n.value}));return e?jsxRuntime.jsx(Y,{...l,children:c}):jsxRuntime.jsx("button",{type:"button",...l,children:c})}sm.docxToolbarPart=true;function _y({asChild:e,className:t,children:o}){let n=te(),r=lm();if(!r||!r.open)return null;let i={role:"listbox",tabIndex:0,"aria-label":n("styles.selectAriaLabel"),className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`},a=o??r.options.map(l=>jsxRuntime.jsx(Iy,{value:l.styleId},l.styleId));return e?jsxRuntime.jsx(Y,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function Iy({value:e,asChild:t,className:o,children:n}){let r=H(),i=lm();if(!i)return null;let a=i.value===e,l=i.options.find(d=>d.styleId===e),s={role:"option",tabIndex:-1,"aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:q,onClick:()=>{i.setValue(e),i.setOpen(false),r?.focus();},className:`docx-toolbar__style-item${o?` ${o}`:""}`},c=n??jsxRuntime.jsx("span",{style:l?C2(l.preview):void 0,children:l?.name??e});return t?jsxRuntime.jsx(Y,{...s,children:c}):jsxRuntime.jsxs("button",{type:"button",...s,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function S2({hidden:e,asChild:t,className:o,children:n}){let r=As(),[i,a]=Lt.useState(false),l=Lt.useRef(null);Ro(l,i,()=>a(false)),Lt.useEffect(()=>{if(!i)return;let f=g=>{let p=l.current;p&&editor.isDomNode(g.target)&&p.contains(g.target)||a(false);},u=editor.hostDocumentOf(l.current);return u.addEventListener("mousedown",f),()=>u.removeEventListener("mousedown",f)},[i]);let s=Lt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let c={className:`docx-toolbar__style${o?` ${o}`:""}`,"data-slot":"styles.style"},d=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(sm,{}),jsxRuntime.jsx(_y,{})]});return jsxRuntime.jsx(My.Provider,{value:s,children:t?jsxRuntime.jsx(Y,{...c,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...c,children:d})})}var cm=Object.assign(S2,{docxSlot:"styles.style",Trigger:sm,Content:_y,Item:Iy});function Ly(e,t){let o=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:l,children:s})=>{let{isEnabled:c,disabledReason:d}=ce(o),f=fo(),u=t==="showAll"?f.showAll:f.formFill,g=te();if(i)return null;let p=ee(o),m=g(p?.labelKey??e),b={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!c,...c?{}:{"data-disabled":""},...u?{"data-active":""}:{},"aria-pressed":u,"aria-label":m,title:d??m,onMouseDown:q,onClick:()=>{t==="showAll"?f.toggleShowAll():f.toggleFormFill();}};return l?jsxRuntime.jsx(Y,{...b,children:s}):jsxRuntime.jsx("button",{...b,children:a??s??oe(p?.paths)})},{docxSlot:o})}function w2({className:e,hidden:t,icon:o,asChild:n,children:r}){let i=Tt.inspector,{isEnabled:a,disabledReason:l}=ce(i),{inspectorOpen:s,openInspector:c}=fo(),d=te();if(t)return null;let f=ee(i),u=d(f?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Tt.inspector,disabled:!a,...a?{}:{"data-disabled":""},...s?{"data-active":""}:{},"aria-pressed":s,"aria-label":u,title:l??u,onMouseDown:q,onClick:()=>c()};return n?jsxRuntime.jsx(Y,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:o??r??oe(f?.paths)})}function D2({className:e,hidden:t,icon:o,asChild:n,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l}=fo(),s=te();if(t)return null;let c=Tt.remove,d=ee(c),f=s(d?.labelKey??"contentControl.remove"),u={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Tt.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":f,title:a??f,onMouseDown:q,onClick:()=>{l();}};return n?jsxRuntime.jsx(Y,{...u,children:r}):jsxRuntime.jsx("button",{...u,children:o??r??oe(d?.paths)})}var Os=Ly(Tt.showAll,"showAll"),Bs=Ly(Tt.formFill,"formFill"),Ws=Object.assign(D2,{docxSlot:Tt.remove}),Zs=Object.assign(w2,{docxSlot:Tt.inspector}),Fy={[Tt.showAll]:Os,[Tt.formFill]:Bs,[Tt.inspector]:Zs,[Tt.remove]:Ws};function dm(e,t){let o=H(),n=Lt.useRef(t);n.current=t,Lt.useEffect(()=>{if(!o)return;let r=((...i)=>{n.current(...i);});return o.on(e,r)},[o,e]);}var F2=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],pm=Lt.createContext(null);function qy(){let e=Lt.useContext(pm);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function A2(e,t){let o=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=o?`${r}|${o.rows}|${o.columns}|${o.rowIndex}|${o.columnIndex}`:"",a=t.selection,l=a?`${a.from&&"paraId"in a.from?a.from.paraId:""}|${a.to&&"paraId"in a.to?a.to.paraId:""}|${t.selectionCollapsed}`:"",s=e?.getTableCellSelection()??null,c=s?`${s.tableId}|${s.rows.from}-${s.rows.to}|${s.columns.from}-${s.columns.to}|${s.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:l,cellSelectionKey:c,editable:t.editable,editingMode:t.editingMode??"editing"}}function O2(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function B2(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Wy={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function W2(e,t){let o={};for(let n of F2){let r=editor.tableChromeToolbarState(e,n,t);o[n]={enabled:r.enabled,disabledReason:r.disabledReason};}return o}function mm({children:e}){let t=H(),[o,n]=Lt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=Lt.useState(Wy);Lt.useEffect(()=>(()=>{}),[]);let a=W(Lt.useCallback(u=>({table:u.table,editable:u.editable,editingMode:u.editingMode??"editing",headParagraphId:u.selection?.to&&"paraId"in u.selection.to?u.selection.to.paraId:u.selection?.from&&"paraId"in u.selection.from?u.selection.from.paraId:""}),[]),O2,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=Lt.useCallback(()=>{if(!t){i(Wy);return}let u=A2(t,t.snapshot());i(g=>B2(g,u)?g:u);},[t]);Lt.useEffect(()=>{l();},[l,a]),dm("selectionChange",Lt.useCallback(()=>{l();},[l]));let s=r.tableKey!=="",c=Lt.useMemo(()=>t?W2(t,o):{},[t,o,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Lt.useCallback((u,g)=>{if(!t)return;let{result:p,nextDraft:m}=editor.runTableChromeCommand(t,u,g,o);p.ok&&m&&n(m);},[t,o]),f=Lt.useMemo(()=>({visible:s,draft:o,setDraft:n,slotState:u=>c[u]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[s,o,c,d]);return jsxRuntime.jsx(pm.Provider,{value:f,children:e})}function Z2(){let e=Lt.useContext(pm);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function Ks(e){let t=Z2(),o=t.slotState(e);return Lt.useMemo(()=>({visible:t.visible,enabled:o.enabled,disabledReason:o.disabledReason,draft:t.draft,apply:n=>t.apply(e,n)}),[t,e,o])}function $s(e){(editor.editorInstanceScope(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function Us({enabled:e,disabledReason:t,ariaLabel:o}){let{t:n}=N(),r=i18n.localizeDisabledReason(t,n),i=Lt.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:q,"aria-label":o,...a?{"aria-describedby":a}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:a&&r?jsxRuntime.jsx("span",{id:i,className:"docx-editor-sr-only",children:r}):null}}var U2='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function $y(e,t,o,n){Lt.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll(U2)].filter(c=>c.closest('[role="menu"]')===r);queueMicrotask(()=>{let c=a();(c.find(f=>f.hasAttribute("data-selected")||f.hasAttribute("data-active"))??c[0])?.focus();});let s=c=>{if(c.defaultPrevented||c.isComposing||c.keyCode===229)return;let d=a();if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="ArrowDown"){c.preventDefault(),Yt(d,editor.hostDocumentOf(r).activeElement,1);return}if(c.key==="ArrowUp"){c.preventDefault(),Yt(d,editor.hostDocumentOf(r).activeElement,-1);return}if(c.key==="Home"){c.preventDefault(),Xt(d,"first");return}if(c.key==="End"){c.preventDefault(),Xt(d,"last");return}if(c.key==="Enter"||c.key===" "){let f=editor.hostDocumentOf(c.target).activeElement;editor.isHTMLElementNode(f)&&d.includes(f)&&(c.preventDefault(),f.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,o,n]);}function Uy(e,t,o,n){Lt.useEffect(()=>{if(!e)return;let r=o.current,i=n.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(s=>s.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let l=s=>{if(s.key==="Escape"){s.preventDefault(),t(false),i?.focus();return}if(s.key==="Enter"||s.key===" "){let c=editor.hostDocumentOf(s.target).activeElement,d=a();editor.isHTMLElementNode(c)&&d.includes(c)&&(s.preventDefault(),c.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,o,n]);}function Xy(e,t,o){if(e)return n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),o(!t));}}function Q2(e){return oe(editor.tableChromeIconPaths(e))}function Jy(){return Lt.createContext(null)}function Ho(e){let t=Lt.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function gm(e,t,o){let n=Jy();function r({hidden:l,asChild:s,className:c,children:d}){let{visible:f,enabled:u,disabledReason:g,draft:p,apply:m}=Ks(e),[b,h]=Lt.useState(false),v=Lt.useRef(null),y=Lt.useRef(null);Vn(b,h,v,l||!f);let C=Lt.useMemo(()=>({open:b,setOpen:h,enabled:u,disabledReason:g,apply:m,draft:p,triggerRef:y}),[b,u,g,m,p]);if(l||!f)return null;let T={className:`${t}${c?` ${c}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},x=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(n.Provider,{value:C,children:s?jsxRuntime.jsx(Y,{...T,ref:v,children:x}):jsxRuntime.jsx("div",{ref:v,...T,children:x})})}function i({asChild:l,className:s,children:c}){let{open:d,setOpen:f,enabled:u,disabledReason:g,triggerRef:p}=Ho(n),m=te(),b=ee(e),h=m(b?.labelKey??o),{shared:v,reasonNode:y}=Us({enabled:u,disabledReason:g,ariaLabel:h}),C={...v,ref:p,className:`docx-toolbar__button docx-table-chrome__trigger${s?` ${s}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:u?()=>f(!d):void 0,...l?{tabIndex:u?0:-1,role:"button",onKeyDown:Xy(u,d,f)}:{}},T=c??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[oe(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Y,{...C,children:T}),y]}):jsxRuntime.jsxs("button",{...C,children:[T,y]})}i.docxToolbarPart=true;function a({asChild:l,className:s,children:c}){let{open:d,setOpen:f,enabled:u,triggerRef:g}=Ho(n),p=te(),m=Lt.useRef(null);if($y(d&&u,f,m,g),!d||!u)return null;let b=ee(e),h=p(b?.labelKey??o),v={ref:m,role:"menu","aria-label":h,className:`docx-table-chrome__panel${s?` ${s}`:""}`,onMouseDown:q};return l?jsxRuntime.jsx(Y,{...v,children:c}):jsxRuntime.jsx("div",{...v,children:c})}return {Root:r,Trigger:i,Content:a,Ctx:n}}var yi=gm("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function Qy({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Ho(yi.Ctx),l=te(),s=editor.TABLE_BORDER_TARGET_OPTIONS.find(u=>u.value===e);if(!s)return null;let c=s.value==="none"?false:s.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":c,"data-value":s.value,className:`docx-table-chrome__target-btn${o?` ${o}`:""}`,...c?{"data-active":""}:{},"aria-label":l(s.labelKey),title:l(s.labelKey),onMouseDown:q,onClick:()=>{i(false),r(s.value);}},f=n??Q2(s.icon);return t?jsxRuntime.jsx(Y,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function ev(e){let{children:t}=e;return jsxRuntime.jsx(yi.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(o=>jsxRuntime.jsx(Qy,{value:o.value},o.value))})})}function e_(e){let{children:t}=e,o=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(yi.Trigger,{}),jsxRuntime.jsx(ev,{})]});return jsxRuntime.jsx(yi.Root,{...e,children:o})}var Ei=Object.assign(e_,{docxSlot:"table.borderTarget",Trigger:yi.Trigger,Content:ev,Item:Qy}),vi=gm("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function tv({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Ho(vi.Ctx),l=te(),s=editor.TABLE_BORDER_STYLE_OPTIONS.find(u=>u.value===e);if(!s)return null;let c=s.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":c,...c?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:q,onClick:()=>{i(false),r(s.value);}},f=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${s.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(s.labelKey)})]});return t?jsxRuntime.jsx(Y,{...d,children:f}):jsxRuntime.jsx("button",{...d,children:f})}function ov(e){let{children:t}=e;return jsxRuntime.jsx(vi.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(o=>jsxRuntime.jsx(tv,{value:o.value},o.value))})}function t_(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vi.Trigger,{}),jsxRuntime.jsx(ov,{})]});return jsxRuntime.jsx(vi.Root,{...e,children:t})}var Pi=Object.assign(t_,{docxSlot:"table.borderStyle",Trigger:vi.Trigger,Content:ov,Item:tv}),xi=gm("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function nv({value:e,asChild:t,className:o,children:n}){let{apply:r,setOpen:i,draft:a}=Ho(xi.Ctx),l=te(),s=Number(e),c=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===s);if(!c)return null;let d=c.size===a.spec.size,f={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${o?` ${o}`:""}`,onMouseDown:q,onClick:()=>{i(false),r(c.size);}},u=n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${c.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(c.labelKey)})]});return t?jsxRuntime.jsx(Y,{...f,children:u}):jsxRuntime.jsx("button",{...f,children:u})}function rv(e){let{children:t}=e;return jsxRuntime.jsx(xi.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(o=>jsxRuntime.jsx(nv,{value:String(o.size)},o.size))})}function o_(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xi.Trigger,{}),jsxRuntime.jsx(rv,{})]});return jsxRuntime.jsx(xi.Root,{...e,children:t})}var Si=Object.assign(o_,{docxSlot:"table.borderWidth",Trigger:xi.Trigger,Content:rv,Item:nv});function av(e,t,o){let n=o?.defaultHex??"FF0000",r=Jy();function i({hidden:d,asChild:f,className:u,children:g}){let{visible:p,enabled:m,disabledReason:b,draft:h,apply:v}=Ks(e),[y,C]=Lt.useState(false),[T,x]=Lt.useState(n),E=Lt.useRef(null),P=Lt.useRef(null);Vn(y,C,E,d||!p);let D=Lt.useMemo(()=>({open:y,setOpen:C,enabled:m,disabledReason:b,apply:v,draft:h,triggerRef:P,lastHex:T,setLastHex:x}),[y,m,b,v,h,T]);if(d||!p)return null;let w={className:`docx-toolbar__colorsplit docx-table-chrome${u?` ${u}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},S=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(l,{}),jsxRuntime.jsx(s,{clearFill:o?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:D,children:f?jsxRuntime.jsx(Y,{...w,ref:E,children:S}):jsxRuntime.jsx("div",{ref:E,...w,children:S})})}function a({asChild:d,className:f,children:u}){let{enabled:g,disabledReason:p,apply:m,draft:b,lastHex:h}=Ho(r),v=te(),y=ee(e),C=v(y?.labelKey??t),{shared:T,reasonNode:x}=Us({enabled:g,disabledReason:p,ariaLabel:C}),E=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:h??n,P={...T,className:`docx-toolbar__button docx-toolbar__colorsplit-main${f?` ${f}`:""}`,onClick:g?()=>m({kind:"hex",value:E}):void 0},D=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[oe(y?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${E.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Y,{...P,children:D}),x]}):jsxRuntime.jsxs("button",{...P,children:[D,x]})}a.docxToolbarPart=true;function l({asChild:d,className:f,children:u}){let{open:g,setOpen:p,enabled:m,disabledReason:b,triggerRef:h}=Ho(r),v=te(),y=ee(e),C=v(y?.labelKey??t),{shared:T,reasonNode:x}=Us({enabled:m,disabledReason:b,ariaLabel:C}),E={...T,ref:h,className:`docx-toolbar__colorsplit-caret${f?` ${f}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:m?()=>p(!g):void 0,...d?{tabIndex:m?0:-1,role:"button",onKeyDown:Xy(m,g,p)}:{}},P=u??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Y,{...E,children:P}),x]}):jsxRuntime.jsxs("button",{...E,children:[P,x]})}l.docxToolbarPart=true;function s({asChild:d,className:f,children:u,clearFill:g}){let{open:p,setOpen:m,enabled:b,apply:h,draft:v,triggerRef:y,lastHex:C,setLastHex:T}=Ho(r),x=te(),E=Lt.useRef(null);if(Uy(p&&b,m,E,y),!p||!b)return null;let P=x(t),D=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:C??n,w={ref:E,role:"dialog","aria-label":P,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${f?` ${f}`:""}`,onMouseDown:q},S=u??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:q,onClick:()=>{m(false),h(null),$s(y.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),x("table.clearCellFill")]}):null,jsxRuntime.jsx(md,{apply:L=>{m(false),T?.(L),h({kind:"hex",value:L}),$s(y.current);},current:D})]});return d?jsxRuntime.jsx(Y,{...w,children:S}):jsxRuntime.jsx("div",{...w,children:S})}function c({value:d,css:f,labelKey:u,asChild:g,className:p,children:m}){let{apply:b,setOpen:h,setLastHex:v,triggerRef:y}=Ho(r),C=te(),T=f??`#${d.toLowerCase()}`,x=u?C(u):d,E={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${p?` ${p}`:""}`,style:{backgroundColor:T},"data-value":d,"aria-label":x,title:x,onMouseDown:q,onClick:()=>{h(false),v?.(d),b({kind:"hex",value:d}),$s(y.current);}};return g?jsxRuntime.jsx(Y,{...E,children:m}):jsxRuntime.jsx("button",{...E,children:m})}return {Root:i,Main:a,Trigger:l,Content:s,Item:c,Ctx:r}}var Ci=av("table.borderColor","table.borderColor",{defaultHex:"000000"});function n_(e){return jsxRuntime.jsx(Ci.Content,{...e,clearFill:false})}function r_(e){return jsxRuntime.jsx(Ci.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function a_(e){return jsxRuntime.jsx(Ci.Root,{...e})}var ki=Object.assign(a_,{docxSlot:"table.borderColor",Trigger:Ci.Trigger,Content:n_,Item:r_,Main:Ci.Main}),Ti=av("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function i_(e){return jsxRuntime.jsx(Ti.Content,{...e,clearFill:true})}function l_(e){return jsxRuntime.jsx(Ti.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function s_(e){return jsxRuntime.jsx(Ti.Root,{...e})}var wi=Object.assign(s_,{docxSlot:"table.cellFill",Trigger:Ti.Trigger,Content:i_,Item:l_,Main:Ti.Main});function iv({overrides:e=new Map,separator:t=true}){return qy()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(Un,{}):null,[Ei,ki,Pi,Si,wi].map(r=>{let i=e.get(r.docxSlot);return i?jsxRuntime.jsx(Lt.Fragment,{children:i},r.docxSlot):jsxRuntime.jsx(r,{},r.docxSlot)})]}):null}function lv(){let e=te(),{draft:t}=Ks("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var bm=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],na="contextual-table",ym={"zoom.level":Xp,"styles.style":cm,"font.family":rm,"font.size":Yp,"text.color":fd,"text.highlight":gd,"text.link":$p,"list.lineSpacing":Jp,"review.editingMode":Ts,"review.authors":Ps,"file.save":Up,...Fy,"table.borderTarget":Ei,"table.borderColor":ki,"table.borderStyle":Pi,"table.borderWidth":Si,"table.cellFill":wi,"image.insert":La,"image.properties":Wr,"image.wrap":ui,"image.altText":ja},Vs={id:na,labelKey:"formattingBar.groups.table",entries:bm.map(e=>({slot:e,Part:ym[e]}))},sv=new Map;function g_(e){let t=sv.get(e);return t||(t=o=>jsxRuntime.jsx(wn,{slotId:e,...o}),sv.set(e,t)),t}function h_(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:Ns}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(o=>{let n=editor.chromeSlotId(t,o);return {slot:n,Part:ym[n]??g_(n)}})})}var b_=e=>e.image,y_=e=>e.isLoading||e.isOpening===true,v_=e=>e.table!==null;function x_(e){return e==="alignment"||e in ym}function js(e){let t=vr(e,js);if(t!==null)return t;if(!Lt.isValidElement(e))return null;let o=e.type;if(typeof o!="function"&&typeof o!="object")return null;if(typeof o.docxSlot=="string")return o.docxSlot;if(o.docxToolbarSlot===true){let n=e.props.slotId;return typeof n=="string"?n:null}if(o.docxToolbarPart===true){let n=e.props,r=n.slotId??n.slot;if(typeof r=="string")return r}return null}function hm(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(hm);let t=js(e);return t!=null&&bm.includes(t)?true:Lt.isValidElement(e)?Lt.Children.toArray(e.props.children).some(hm):false}function C_(e,t){return t?true:Lt.Children.toArray(e).some(hm)}function T_(e){let t=Mt(),{className:o,t:n,onSave:r,preset:i=true,overflow:a=true,children:l}=e,s=Lt.useMemo(()=>({t:n,onSave:r}),[n,r]),c=dl(n),d=W(b_),f=W(y_),u=W(v_),g=Lt.useMemo(()=>h_(d),[d]),p=Lt.useMemo(()=>new Set(g.flatMap(E=>E.entries.map(P=>P.slot))),[g]),m=Lt.useMemo(()=>i?M0(l,js,E=>p.has(E),E=>bm.includes(E)):null,[i,l,p]),b=Lt.useMemo(()=>m?E_(g,m):[],[g,m]),h=Lt.useMemo(()=>[...b.filter(E=>!E.pinned).map(E=>E.id),...u?[na]:[]],[b,u]),v=Lt.useMemo(()=>{let E=new Map;for(let P of b)P.priority!==void 0&&E.set(P.id,P.priority);return editor.collapseOrder(h,editor.TOOLBAR_COLLAPSE_ORDER,E)},[b,h]),y=i&&a,{attach:C,overflow:T}=El(y,h,v),x;if(!m)x=l;else {let{overrides:E,tableOverrides:P,appended:D}=m,w=k=>{let _=E.get(k.slot);if(_)return _;let U=k.Part;return jsxRuntime.jsx(U,{})},S=k=>{let _=P.get(k.slot);if(_)return _;let U=k.Part;return jsxRuntime.jsx(U,{})},L=[],I=[],F=0;for(let k of b){if(T.has(k.id)){let _=k.entries.flatMap(z=>{let re=cv(z,E,c,k.labelKey,w);return re===null?[]:[jsxRuntime.jsx(Lt.Fragment,{children:re},z.slot)]}),U=S_(k);if(U!==null&&_.push(jsxRuntime.jsx(Lt.Fragment,{children:U},"host")),_.length===0)continue;I.push({id:k.id,labelKey:k.labelKey,...k.heading?{label:ks(k.heading,c)}:{},children:_});continue}F>0&&L.push(jsxRuntime.jsx(Un,{},`separator-${k.id}`)),F+=1,L.push(jsxRuntime.jsxs("div",{className:`docx-toolbar__group${k.className?` ${k.className}`:""}`,...k.heading?{role:"group","aria-label":ks(k.heading,c)}:{},...k.pinned?{[Nn]:""}:{[Jo]:k.id},children:[k.entries.map(_=>jsxRuntime.jsx(Lt.Fragment,{children:w(_)},_.slot)),k.extras.length>0?jsxRuntime.jsx(Lt.Fragment,{children:k.extras},"host"):null]},k.id));}let O=T.has(na);if(u&&O){let k=Vs.entries.flatMap(_=>{let U=cv(_,P,c,Vs.labelKey,S);return U===null?[]:[jsxRuntime.jsx(Lt.Fragment,{children:U},_.slot)]});k.length>0&&I.unshift({id:Vs.id,labelKey:Vs.labelKey,children:k});}x=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[L,u&&!O?jsxRuntime.jsx(Un,{},"separator-contextual-table"):null,O?null:jsxRuntime.jsx("div",{className:"docx-toolbar__contextual",[Jo]:na,children:jsxRuntime.jsx(iv,{overrides:P,separator:false})}),D.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[Nn]:"",children:D}):null,I.length>0?jsxRuntime.jsx(D0,{sections:I}):null]});}return jsxRuntime.jsx(kn.Provider,{value:s,children:jsxRuntime.jsx(C0,{children:jsxRuntime.jsx("fieldset",{ref:C,disabled:f,"aria-label":c("formattingBar.label"),"data-testid":"docx-toolbar",className:`${t}docx-toolbar${o?` ${o}`:""}`,...y?{"data-overflow":""}:{},onMouseDown:q,children:C_(l,i)?jsxRuntime.jsx(mm,{children:x}):x})})})}function vm(e){if(!e)return false;if(e.type===Lt.Fragment){let t=Lt.Children.toArray(e.props.children).find(o=>js(o)!==null);return Lt.isValidElement(t)?vm(t):false}return !!e.props.hidden}function E_(e,t){let o=new Map(t.groups.map(s=>[s.id,s])),n=new Set(e.map(s=>s.id)),r=new Map;for(let s of e){let c=o.get(s.id);if(c&&P_(c),c?.hidden)continue;let d=Lt.Children.toArray(c?.children);!s.entries.some(u=>!vm(t.overrides.get(u.slot)))&&d.length===0||r.set(s.id,{id:s.id,labelKey:s.labelKey,heading:void 0,entries:s.entries,extras:d,pinned:c?.pinned??editor.TOOLBAR_PINNED_GROUPS.has(s.id),priority:c?.priority,overflowContent:c?.overflowContent,className:c?.className,host:false});}for(let s of t.groups)s.id===na&&A0(s.id);let i=t.groups.filter(s=>!n.has(s.id)&&s.id!==na);for(let s of i){let c=Lt.Children.toArray(s.children);s.hidden||c.length===0||r.set(s.id,{id:s.id,labelKey:s.labelKey??s.id,heading:{id:s.id,label:s.label,labelKey:s.labelKey},entries:[],extras:c,pinned:s.pinned===true,priority:s.priority,overflowContent:s.overflowContent,className:s.className,host:true});}let a=[...n,...i.map(s=>s.id)];for(let s of i)s.after!==void 0&&!a.includes(s.after)&&F0(s.id,s.after,a);for(let s of t.appended){if(!Lt.isValidElement(s)||s.type!==di)continue;let c=s.props.slotId;O0(c,ee(c)!==null);}return editor.arrangeToolbarGroups(e.map(s=>s.id),i.map(s=>({id:s.id,after:s.after}))).flatMap(s=>{let c=r.get(s);return c?[c]:[]})}function P_(e){for(let t of ["label","labelKey","after"])e[t]!==void 0&&H0(e.id,t);}function S_(e){return e.overflowContent?e.overflowContent():e.extras.length===0?null:jsxRuntime.jsx(Bp.Provider,{value:"panel",children:jsxRuntime.jsx("div",{className:"docx-toolbar__more-host",children:e.extras})})}function cv(e,t,o,n,r){let i=t.get(e.slot);if(vm(i))return null;let a=i?.type===di?i.props.overflowContent:void 0;return i||x_(e.slot)?jsxRuntime.jsx(k0,{label:k_(o,e,n),children:a?a():r(e)}):jsxRuntime.jsx(w0,{slot:e.slot})}function k_(e,t,o){let n=t.slot==="alignment"?null:ee(t.slot);return e(n?.labelKey??o)}var Ri=Object.assign(T_,{Button:wn,Action:em,Separator:Un,Group:Op,Slot:di,AddComment:Wp,Undo:Z0,Redo:q0,Bold:K0,Italic:z0,Underline:$0,Strike:U0,Link:$p,ClearFormatting:V0,Superscript:G0,Subscript:j0,Alignment:Ns,AlignLeft:Y0,AlignCenter:X0,AlignRight:J0,AlignJustify:Q0,LeftToRight:ey,RightToLeft:ty,LineSpacing:Jp,BulletList:oy,NumberedList:ny,Outdent:ry,Indent:ay,ImageInsert:La,ImageProperties:Wr,ImageWrap:ui,ImageAltText:ja,TableInsert:zp,TableBorderTarget:Ei,TableBorderColor:ki,TableBorderStyle:Pi,TableBorderWidth:Si,TableCellFill:wi,Comments:iy,FontFamily:rm,FontSize:Yp,FontColor:fd,Highlight:gd,Zoom:Xp,StylePicker:cm,EditingMode:Ts,Reviewers:Ps,Save:Up,ContentControlShowAll:Os,ContentControlFormFill:Bs,ContentControlInspector:Zs,ContentControlRemove:Ws});var uv=/^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])$/i,M_=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g,__=200,pv=new TextEncoder;function I_(e,t){if(pv.encode(e).length<=t)return e;let o=0,n="";for(let r of e){let i=pv.encode(r).length;if(o+i>t)break;o+=i,n+=r;}return n}function mv(e){let t=e.length;for(;t>0;){let o=e.charCodeAt(t-1);if(o!==46&&o!==32)break;t-=1;}return e.slice(0,t)}function fv(e){return mv(mv(e).replace(/\.docx$/i,""))}function Ys(e){let t=(e??"").replace(M_," ").replace(/\s+/g," ").trim(),o=fv(t).replace(/^[. ]+/,""),n=I_(o,__),r=n===o?o:fv(n);return !r||uv.test(r)?"document.docx":uv.test(r.split(".",1)[0].trim())?`_${r}.docx`:`${r}.docx`}function Xs(e,t,o="application/vnd.openxmlformats-officedocument.wordprocessingml.document",n){let r=URL.createObjectURL(new Blob([e],{type:o})),i=editor.hostDocumentOf(n).createElement("a");i.href=r,i.download=t,i.click(),editor.hostWindowOf(n).setTimeout(()=>URL.revokeObjectURL(r),0);}function gv(e,t,o){let{t:n}=N(),r=Lt.useRef(false),[i,a]=Lt.useState(false),[l,s]=Lt.useState(""),[c,d]=Lt.useState("pdf"),[f,u]=Lt.useState(false),[g,p]=Lt.useState({});return {pending:i,error:l,format:c,visible:f,session:g,dismiss:()=>u(false),execute:async b=>{if(!(!e||r.current)){r.current=true,p({}),d(b),u(true),a(true),s("");try{let h=await editor.runChromeExport(e,b,t);Xs(h.bytes.slice().buffer,Ys(o).replace(/\.docx$/,`.${h.extension}`),h.mimeType),u(!1);}catch(h){u(true),s(h instanceof editor.ChromeExportError?n(h.format==="markdown"?"toolbar.exportMarkdownMissing":"toolbar.exportPdfMissing"):n("toolbar.exportFailed",{message:h instanceof Error?h.message:String(h)}));}finally{r.current=false,a(false);}}}}}function bv(e,t,o){let{t:n}=N(),r=Lt.useRef({editor:e,exporters:t,feedback:o,t:n});r.current={editor:e,exporters:t,feedback:o,t:n};let i=Lt.useRef(null),a=Lt.useRef(null),[l,s]=Lt.useState(false),[c,d]=Lt.useState(""),[f,u]=Lt.useState(""),[g,p]=Lt.useState(false),[m,b]=Lt.useState(false),[h,v]=Lt.useState({}),y=Lt.useCallback(x=>{let{t:E}=r.current;if(x instanceof editor.ChromeExportError)return E("toolbar.printPdfMissing");if(x instanceof editor.ChromePrintError){if(x.code==="pdf-viewer-unavailable")return E("toolbar.printNoViewer");if(x.code==="pdf-load-failed")return E("toolbar.printLoadFailed");if(x.code==="print-refused")return E("toolbar.printRefused")}return E("toolbar.printFailedMessage",{message:x instanceof Error?x.message:String(x)})},[]),C=Lt.useCallback(()=>{i.current=null,b(false),p(false),s(false);},[]),T=Lt.useCallback(async x=>{let{editor:E,exporters:P}=r.current;if(!E||i.current)return;let D={};i.current=D,a.current?.dispose(),a.current=null,v(D),b(true),p(true),s(true),d(""),u("");try{let w=await editor.runChromePrint(E,P,x??editor.hostDocumentOf(null));if(i.current!==D){w.dispose();return}a.current=w,await w.print({beforePrint:()=>{if(i.current!==D)throw new editor.ChromePrintError("print-ended");reactDom.flushSync(()=>p(!1));}}),i.current===D&&C();}catch(w){if(i.current!==D)return;if(!r.current.feedback){console.error("[docx-editor] print failed",w),C();return}s(false),u(a.current?.url??""),d(y(w)),p(true);}},[C,y]);return Lt.useEffect(()=>()=>{i.current=null,a.current?.dispose(),a.current=null;},[]),{pending:l,error:c,url:f,visible:g,active:m,session:h,execute:T,close:C}}var K_=()=>{};function Tm(){let e=H(),t=Lt.useCallback(n=>e?e.on("hostChange",n):K_,[e]),o=Lt.useCallback(()=>e?editor.editorHostDocument(e):typeof globalThis.document>"u"?null:globalThis.document,[e]);return Lt.useSyncExternalStore(t,o,()=>null)}var z_="https://github.com/eigenpal/docx-editor/issues/new";function $_(){if(typeof globalThis.window>"u")return "";try{let e=new URL(globalThis.window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function vv(e={}){let t=e.userAgent??(typeof globalThis.navigator<"u"?globalThis.navigator.userAgent:"unknown"),o=e.viewport??(typeof globalThis.window<"u"?{width:globalThis.window.innerWidth,height:globalThis.window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??$_()}`,`- Viewport: ${o.width} x ${o.height}`,`- User agent: ${t}`,""].join(`
|
|
2
|
+
`),i=new URLSearchParams({title:"[Bug] ",body:r});return `${z_}?${i.toString()}`}function _i(e){typeof globalThis.window>"u"||globalThis.window.open(vv(e),"_blank","noopener,noreferrer");}function U_({className:e,hidden:t,onSelect:o}){let{setOpenMenu:n,onReportIssue:r,reportIssue:i}=rt(),a=we();if(t||i===false)return null;let l=o??r??_i;return jsxRuntime.jsx(Ie,{slot:"help.reportIssue",onSelect:()=>{l(),n(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var Js=Object.assign(U_,{docxSlot:"help.reportIssue"});function V_({children:e,...t}){let{reportIssue:o}=rt();return e===void 0&&o===false?null:jsxRuntime.jsxs(Qt,{id:"help",...t,children:[jsxRuntime.jsx(Js,{}),e]})}var Em=Object.assign(V_,{docxMenu:"help"});var X_=e=>e.hiddenReviewAuthors??[];function Qs({className:e,hidden:t}){let o=H(),n=si(),r=W(X_),i=we(),{t:a}=N();if(t)return null;let l=i("reviewers.label"),s=editor.toolbarCommandState(o,"review.authors"),c=i18n.localizeDisabledReason(s.disabledReason,a);if(!s.enabled)return jsxRuntime.jsx(Ie,{disabled:true,title:c??void 0,slot:"review.authors",children:l});let d=new Set(r),f=n.every(u=>!d.has(u.author));return jsxRuntime.jsxs(Jt,{labelKey:"reviewers.label",className:e,children:[jsxRuntime.jsx(Cv,{checked:f,label:i("reviewers.all"),slot:"reviewer-all",onChoose:()=>o?.setAllReviewAuthorsVisible(!f)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),n.map(u=>jsxRuntime.jsx(Cv,{checked:!d.has(u.author),label:u.author||"\u2014",slot:`reviewer-${u.slot}`,onChoose:()=>o?.setReviewAuthorVisible(u.author,d.has(u.author))},u.author))]})}function Cv(e){return jsxRuntime.jsx(Ie,{active:e.checked,slot:e.slot,className:"docx-menubar__reviewer-item",icon:jsxRuntime.jsx("span",{className:"docx-menubar__reviewer-check",children:e.checked?"\u2713":""}),onSelect:e.onChoose,children:e.label})}function J_({children:e,...t}){return jsxRuntime.jsxs(Qt,{id:"review",...t,children:[jsxRuntime.jsx(Jt,{labelKey:"reviewers.markupOptions",className:"docx-menubar__markup-options",children:jsxRuntime.jsx(Qs,{className:"docx-menubar__reviewers-submenu"})}),e]})}var ec=Object.assign(J_,{docxMenu:"review"});var tI={file:iu,format:lu,insert:su,review:ec,help:Em};function Ii(e,t=false){if(!Lt.isValidElement(e))return null;if(e.type===Lt.Fragment){let i=Lt.Children.toArray(e.props.children).map(a=>Ii(a,t)).filter(a=>a!==null);return i.length===1?i[0]:null}let o=e.props;if(o.hidden===true&&!t)return null;let n=e.type;return (typeof n=="function"||typeof n=="object")&&typeof n.docxMenu=="string"?n.docxMenu:e.type===Qt&&typeof o.id=="string"?o.id:null}var oI=new Set(editor.CHROME_MENUS.map(e=>e.id));function ac(e){if(!Lt.isValidElement(e))return null;if(e.type===Lt.Fragment){let n=Lt.Children.toArray(e.props.children).map(ac).filter(r=>r!==null);return n.length===1?n[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===Qt){let o=e.props.id;if(typeof o=="string"&&oI.has(o))return o}return null}var nI=e=>e.isOpening===true;function rI(e){let t=Ur(),o=Ct(),n=Mt(),{className:r,t:i,fileName:a,exporters:l,onOpen:s,onOpenFile:c,onSave:d,onPageSetup:f,onReportIssue:u,reportIssue:g,preset:p=true,overflow:m=true,children:b}=e,h=H(),{t:v}=N(),[y,C]=Lt.useState(null),T=W(nI);Lt.useEffect(()=>{T&&C(null);},[T]);let[x,E]=Lt.useState(null),P=gv(h,l,a??x??void 0),{pending:D,execute:w}=P,S=bv(h,l,o?.print!==false),{active:L,execute:I}=S,F=S.visible&&o?.print!==false,[O,k]=Lt.useState(null),[_,U]=Lt.useState(false),[z,re]=Lt.useState(false),[X,ae]=Lt.useState(false),K=Lt.useRef(null),J=Lt.useRef(null);Lt.useEffect(()=>{if(y===null)return;let le=_e=>{let ye=K.current;ye&&editor.isDomNode(_e.target)&&ye.contains(_e.target)||C(null);},se=editor.hostDocumentOf(K.current);return se.addEventListener("mousedown",le),()=>{se.removeEventListener("mousedown",le);}},[y]),Xr(y!==null,K,()=>C(null),le=>editor.isDomNode(le.target)&&K.current?.contains(le.target)===true);let B=Lt.useCallback(le=>{C(le),le!==null&&k(le);},[]),A=Lt.useCallback(()=>J.current?.click(),[]),M=Lt.useCallback(()=>{h&&h.save().then(le=>Xs(le,Ys(a??x??void 0),void 0,K.current)).catch(le=>{console.error("[docx-editor] save failed",le);});},[h,a,x]),j=Lt.useCallback(()=>t?t.open("pageSetup",K.current?.querySelector('[data-menu="file"] > [role="menuitem"]')):U(true),[t]),ue=h?s??A:void 0,de=h?d??M:void 0,ge=!!l?.pdf,Ye=Lt.useMemo(()=>h&&!L?()=>{Ud(K.current),I(editor.editorInstanceScope(K.current)??K.current??void 0);}:void 0,[h,L,I]),yt=h?t?.ownsPageSetup?j:f??j:void 0,Dt=Tm();Lt.useEffect(()=>{let le=ye=>{if(!(ye.metaKey||ye.ctrlKey)||ye.altKey||ye.shiftKey)return;let nt=ye.key.toLowerCase(),Do=editor.isChromePrintShortcut(ye);if(nt!=="s"&&nt!=="o"&&!Do)return;let co=ye.target,jc=editor.editorInstanceScope(K.current)??K.current;if(!(!co||!((jc?.contains(co)??false)||kg(co,editor.hostDocumentOf(K.current),h?editor.editorHostElement(h):null))))if(Do){if(!ge||!h||!Ye&&!F)return;ye.preventDefault(),Ye?.();}else nt==="s"&&de?(ye.preventDefault(),de()):nt==="o"&&ue&&(ye.preventDefault(),ue());},se=editor.hostDocumentOf(K.current),_e=Dt&&Dt!==se?[se,Dt]:[se];for(let ye of _e)ye.addEventListener("keydown",le);return ()=>{for(let ye of _e)ye.removeEventListener("keydown",le);}},[ue,de,Ye,F,ge,h,Dt]);let Me=Lt.useMemo(()=>({t:i,openMenu:y,setOpenMenu:B,activeMenu:O,onOpen:ue,onSave:de,onExport:h&&!D?le=>(Ud(K.current),w(le)):void 0,onPrint:Ye,printShortcut:ge,onPageSetup:yt,onParagraphDialog:()=>t?t.open("paragraph",K.current?.querySelector('[data-menu="format"] > [role="menuitem"]')):re(true),onWatermarkDialog:h?()=>t?t.open("watermark",K.current?.querySelector('[data-menu="insert"] > [role="menuitem"]')):ae(true):void 0,onReportIssue:u,reportIssue:g,opening:T}),[T,h,D,w,Ye,ge,i,y,B,O,ue,de,yt,t,u,g]),vt=Lt.Children.toArray(b),ko=[];if(p){let le=new Map(vt.map(se=>[ac(se),se]));for(let se of editor.CHROME_MENUS){let _e=le.get(se.id);(_e===void 0||Ii(_e)!==null)&&ko.push(se.id);}for(let se of vt){if(ac(se)!==null)continue;let _e=Ii(se);_e!==null&&ko.push(_e);}}else for(let le of vt){let se=Ii(le);se!==null&&ko.push(se);}let wo=[...ko].reverse(),{attach:zo,overflow:Ut}=El(m,ko,wo),ie=Lt.useMemo(()=>({measuring:m,overflow:Ut,inMore:false}),[m,Ut]),ot=Lt.useMemo(()=>({measuring:false,overflow:Ut,inMore:true}),[Ut]),Te=le=>Ii(le,true)!==null,$o=(le,se)=>jsxRuntime.jsx("div",{role:"none",className:"docx-menubar__host",[Nn]:"",children:le},se),so,Ht;if(!p)so=vt.filter(Te),Ht=m?vt.map((le,se)=>Te(le)?le:$o([le],`host-${se}`)):b;else {let le=new Map,se=[];for(let ye of vt){let nt=ac(ye);nt?le.set(nt,ye):se.push(ye);}so=[...editor.CHROME_MENUS.map(ye=>{let nt=le.get(ye.id);if(nt)return jsxRuntime.jsx(Lt.Fragment,{children:nt},ye.id);let Do=tI[ye.id];return jsxRuntime.jsx(Do,{},ye.id)}),...se.filter(Te)];let _e=se.filter(ye=>!Te(ye));Ht=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[so,_e.length>0?$o(_e,"host"):null]});}let Tn=i?.("formattingBar.more")??v("formattingBar.more");return jsxRuntime.jsxs(Ra.Provider,{value:Me,children:[jsxRuntime.jsx("div",{ref:le=>{if(K.current=le,zo(le),le&&O===null){let se=$d(le)[0]?.closest("[data-menu]")?.getAttribute("data-menu");se&&k(se);}},role:"menubar","aria-label":i?.("titleBar.menuBarAriaLabel")??v("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",...m?{"data-overflow":""}:{},className:`${n}docx-menubar${r?` ${r}`:""}`,onMouseDown:q,onKeyDown:le=>{if(le.key!=="ArrowLeft"&&le.key!=="ArrowRight")return;let se=K.current;if(!se)return;let _e=$d(se),ye=_e.indexOf(editor.hostDocumentOf(se).activeElement);if(ye===-1)return;le.preventDefault();let nt=le.key==="ArrowRight"?1:-1,Do=_e[(ye+nt+_e.length)%_e.length],co=Do?.closest("[data-menu]")?.getAttribute("data-menu");co&&(k(co),Do?.focus(),y!==null&&C(co));},children:jsxRuntime.jsxs(Cl.Provider,{value:ie,children:[jsxRuntime.jsx(Cr.Provider,{value:0,children:Ht}),Ut.size>0?jsxRuntime.jsx(Qt,{id:xr,label:Tn,icon:oe(Hp),preset:false,children:jsxRuntime.jsx(Cl.Provider,{value:ot,children:so})}):null]})}),jsxRuntime.jsxs(Mb,{children:[P.visible&&o?.export!==false?o?.export?Ee(o.export,{open:true,format:P.format,pending:P.pending,error:P.error,onClose:P.dismiss},P.session):jsxRuntime.jsx(va,{open:true,format:P.format,pending:P.pending,error:P.error,onClose:P.dismiss}):null,S.visible&&o?.print!==false?o?.print?Ee(o.print,{open:true,pending:S.pending,error:S.error,url:S.url,onClose:S.close},S.session):jsxRuntime.jsx(xa,{open:true,pending:S.pending,error:S.error,url:S.url,onClose:S.close}):null]}),jsxRuntime.jsx("input",{ref:J,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:le=>{let se=le.target.files?.[0];le.target.value="",!(!se||!h)&&(E(se.name),c?.(se),se.arrayBuffer().then(_e=>h.load(new Uint8Array(_e))).catch(_e=>{console.error("[docx-editor] could not open the file",_e);}));}}),jsxRuntime.jsx(Kn,{open:_,onClose:()=>U(false)}),jsxRuntime.jsx(Lo,{open:z,onClose:()=>re(false)}),jsxRuntime.jsx(zn,{open:X,onClose:()=>ae(false)})]})}var Ni=Object.assign(rI,{Menu:Qt,File:iu,Format:lu,Insert:su,Review:ec,Help:Em,Item:Bt,Row:Ie,Group:Ha,Separator:Ln,Submenu:Jt,TableGrid:Pr,Entry:Oa,Open:Jd,Save:Qd,ExportMarkdown:eu,ExportPdf:tu,Print:ou,PageSetup:nu,ImageInsert:ru,Watermark:Ml,Bookmark:_l,Reviewers:Qs,ReportIssue:Js});var cI=12240,Rv=1440,Iv=1440,Nv=567,Yn=20,Rm=6,_m=Yn+Rm+2,dI="var(--doc-text-muted)",uI="var(--doc-text-subtle)",Mv="var(--doc-shadow-subtle)",pI="var(--doc-primary)",mI="var(--doc-primary-hover)",fI="var(--doc-text-subtle)",Fi=5,Li=7,gI={left:0,right:0,firstLine:0};function _v(e,t){return t==="inch"?(e/Iv).toFixed(2)+'"':(e/Nv).toFixed(1)+" cm"}function hI(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function Xn({pageSetup:e,zoom:t=1,editable:o=false,onLeftMarginChange:n,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:l,indentEditable:s=false,onIndentChange:c,onIndentDragEnd:d,unit:f="inch",className:u="",style:g,tabMarks:p,onTabMarkRemove:m}){let{t:b}=N(),[h,v]=Lt.useState(null),[y,C]=Lt.useState(null),[T,x]=Lt.useState(null),[E,P]=Lt.useState(null),D=Lt.useRef(null),w=e?.pageWidthTwips??cI,S=e?.marginsTwips.left??Rv,L=e?.marginsTwips.right??Rv,I=e?.gutterTwips??0,F={pageWidth:w,leftMargin:S,rightMargin:L},O=l??gI,k=Oe(w)*t,_=Oe(S)*t,U=Oe(L)*t,z=Lt.useCallback(M=>{let j=D.current?.getBoundingClientRect();return j?hs((M-j.left)/t):null},[t]),re=Lt.useCallback((M,j,ue)=>{let de=z(j);if(de===null)return;if(P(Oe(de)*t),M==="leftMargin"||M==="rightMargin"){if(M==="leftMargin"){let Ye=w-L-I-720,yt=Math.round(Math.max(0,Math.min(de,Ye)));x(yt),n?.(yt);}else {let Ye=w-de,yt=w-S-I-720,Dt=Math.round(Math.max(0,Math.min(Ye,yt)));x(Dt),r?.(Dt);}return}let ge=editor.dragIndent(M,de,O,F,{unit:f,precise:ue});x(M==="right"?ge.right:M==="firstLine"?ge.firstLine:ge.left),c?.(ge);},[z,t,w,S,L,I,n,r,c,O,F,f]),X=Lt.useCallback(M=>{M==="leftMargin"||M==="rightMargin"?i?.():d?.(),v(null),x(null),P(null);},[i,d]),ae=Lt.useCallback((M,j,ue)=>{let de=editor.handlePosition(M,O,F),ge=editor.dragIndent(M,de+j*hI(f,ue),O,F,{unit:f,precise:true});c?.(ge),d?.();},[O,F,f,c,d]),K=TI(w,t,f),J=a&&s&&c!==void 0,B=M=>Oe(editor.handlePosition(M,O,F))*t,A=(M,j,ue)=>({positionPx:B(M),editable:J,isDragging:h===M,isHovered:y===M,onPointerEnter:()=>C(M),onPointerLeave:()=>C(null),onPointerDown:de=>{J&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),v(M));},onPointerMove:de=>{h===M&&re(M,de.clientX,de.altKey);},onPointerUp:de=>{h===M&&(de.currentTarget.releasePointerCapture(de.pointerId),X(M));},onKeyDown:de=>{J&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),ae(M,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:b(j),valueNow:ue,valueText:_v(ue,f),pageWidthTwips:w});return jsxRuntime.jsxs("div",{ref:D,className:`docx-horizontal-ruler ${u}`,style:{position:"relative",width:Et(k),height:_m,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:h?"ew-resize":"default",flexShrink:0,marginInline:"auto",...g},role:"group","aria-label":b("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:Et(_),height:Yn,backgroundColor:Mv,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&n?M=>{M.preventDefault(),M.currentTarget.setPointerCapture(M.pointerId),v("leftMargin");}:void 0,onPointerMove:M=>h==="leftMargin"&&re("leftMargin",M.clientX,M.altKey),onPointerUp:M=>{h==="leftMargin"&&(M.currentTarget.releasePointerCapture(M.pointerId),X("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:Et(U),height:Yn,backgroundColor:Mv,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:o?"ew-resize":"default",zIndex:1},onPointerDown:o&&r?M=>{M.preventDefault(),M.currentTarget.setPointerCapture(M.pointerId),v("rightMargin");}:void 0,onPointerMove:M=>h==="rightMargin"&&re("rightMargin",M.clientX,M.altKey),onPointerUp:M=>{h==="rightMargin"&&(M.currentTarget.releasePointerCapture(M.pointerId),X("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Yn,pointerEvents:"none"},children:K.map((M,j)=>jsxRuntime.jsx(bI,{tick:M},j))}),p?.map(M=>jsxRuntime.jsx(CI,{tabMark:M,positionPx:Oe(M.position)*t,onDoubleClick:()=>m?.(M.position)},M.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dm,{direction:"down",anchor:"top",...A("firstLine","ruler.firstLineIndent",O.firstLine)}),jsxRuntime.jsx(Dm,{direction:"up",anchor:"strip",...A("hanging","ruler.hangingIndent",O.left)}),jsxRuntime.jsx(yI,{...A("left","ruler.leftIndent",O.left)}),jsxRuntime.jsx(Dm,{direction:"up",anchor:"strip",...A("right","ruler.rightIndent",O.right)})]}),h&&T!==null&&E!==null&&jsxRuntime.jsx(vI,{value:_v(T,f),positionPx:E})]})}function bI({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:Et(e.position),bottom:0,width:1,height:e.height,backgroundColor:uI}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:Et(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:dI,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Lv(e){return e.editable?e.isDragging||e.isHovered?mI:pI:fI}function Fv(e,t,o){return {position:"absolute",left:Et(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...o}}function Hv(e){return {role:"slider","aria-label":e.label,"aria-orientation":"horizontal","aria-valuenow":e.valueNow,"aria-valuemin":-e.pageWidthTwips,"aria-valuemax":e.pageWidthTwips,"aria-valuetext":e.valueText,"aria-disabled":e.editable?void 0:true,tabIndex:e.editable?0:-1}}function Dm({direction:e,anchor:t,...o}){let n=Lv(o),r=t==="top"?{top:0,height:Li+1}:{top:Yn-Li,height:Li};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Fv(o,Fi*2,r),onPointerEnter:o.onPointerEnter,onPointerLeave:o.onPointerLeave,onPointerDown:o.onPointerDown,onPointerMove:o.onPointerMove,onPointerUp:o.onPointerUp,onKeyDown:o.onKeyDown,...Hv(o),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${Fi}px solid transparent`,borderRight:`${Fi}px solid transparent`,...e==="down"?{top:0,borderTop:`${Li}px solid ${n}`}:{bottom:0,borderBottom:`${Li}px solid ${n}`},transition:"border-color 0.1s"}})})}function yI(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Fv(e,Fi*2,{top:Yn+1,height:Rm}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Hv(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:Fi*2-2,height:Rm,backgroundColor:Lv(e),borderRadius:1,transition:"background-color 0.1s"}})})}function vI({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:Et(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var xI={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function CI({tabMark:e,positionPx:t,onDoubleClick:o}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:Et(t-5),top:Yn-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:n=>{n.stopPropagation(),o();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:xI[e.alignment]||"L"})}function TI(e,t,o){let n=[];if(o==="inch"){let r=Iv/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let s=Oe(l)*t;a%8===0?n.push({position:s,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?n.push({position:s,height:5}):a%2===0?n.push({position:s,height:3}):n.push({position:s,height:2});}}else {let r=Nv/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let s=Oe(l)*t;a%10===0?n.push({position:s,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?n.push({position:s,height:5}):n.push({position:s,height:3});}}return n}var kI=15840,Bv=1440,sc=1440,cc=567,ia=20,wI="var(--doc-text-muted)",DI="var(--doc-text-subtle)",RI="var(--doc-primary)",MI="var(--doc-primary)",_I="var(--doc-primary-hover)";function Hi({pageSetup:e,zoom:t=1,editable:o=false,onTopMarginChange:n,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:l="",style:s}){let{t:c}=N(),[d,f]=Lt.useState(null),[u,g]=Lt.useState(null),p=Lt.useRef(null),m=e?.pageHeightTwips??kI,b=e?.marginsTwips.top??Bv,h=e?.marginsTwips.bottom??Bv,v=(S,L)=>{if(!o||S.altKey||S.ctrlKey||S.metaKey||!["ArrowUp","ArrowDown","Home","End"].includes(S.key))return;S.preventDefault();let I=L==="topMargin"?b:h,O=Math.max(0,m-(L==="topMargin"?h:b)-720),k=S.shiftKey?1:Math.round(a==="cm"?cc/10:sc/8),_=S.key==="Home"?0:S.key==="End"?O:Math.max(0,Math.min(O,I+(S.key==="ArrowUp"?k:-k)));_!==I&&((L==="topMargin"?n:r)?.(_),i?.());},y=Oe(m)*t,C=Oe(b)*t,T=Oe(h)*t,x=Lt.useCallback((S,L)=>{o&&(S.preventDefault(),f(L));},[o]),E=Lt.useCallback(S=>{if(!d||!p.current)return;let L=p.current.getBoundingClientRect(),I=S.clientY-L.top,F=hs(I/t);if(d==="topMargin"){let O=m-h-720,k=Math.max(0,Math.min(F,O));n?.(Math.round(k));}else if(d==="bottomMargin"){let O=m-F,k=m-b-720,_=Math.max(0,Math.min(O,k));r?.(Math.round(_));}},[d,t,m,b,h,n,r]),P=Lt.useCallback(()=>{d!==null&&i?.(),f(null);},[d,i]);Lt.useEffect(()=>{if(d){let S=editor.hostDocumentOf(p.current);return S.addEventListener("mousemove",E),S.addEventListener("mouseup",P),()=>{S.removeEventListener("mousemove",E),S.removeEventListener("mouseup",P);}}},[d,E,P]);let D=NI(m,t,a),w={position:"relative",width:ia,height:Et(y),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...s};return jsxRuntime.jsxs("div",{ref:p,className:`docx-vertical-ruler ${l}`,style:w,role:"group","aria-label":c("ruler.vertical"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:D.map((S,L)=>jsxRuntime.jsx(II,{tick:S},L))}),jsxRuntime.jsx(Wv,{type:"topMargin",value:b,maximum:Math.max(0,m-h-720),valueText:b/(a==="cm"?cc:sc),unit:a,onKeyDown:S=>v(S,"topMargin"),position:C,editable:o,isDragging:d==="topMargin",isHovered:u==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:S=>x(S,"topMargin")}),jsxRuntime.jsx(Wv,{type:"bottomMargin",value:h,maximum:Math.max(0,m-b-720),valueText:h/(a==="cm"?cc:sc),unit:a,onKeyDown:S=>v(S,"bottomMargin"),position:y-T,editable:o,isDragging:d==="bottomMargin",isHovered:u==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:S=>x(S,"bottomMargin")})]})}function II({tick:e}){let t={position:"absolute",top:Et(e.position),right:0,height:1,width:e.width,backgroundColor:DI},o={position:"absolute",top:Et(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:wI,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:o,children:e.label})]})}function Wv({type:e,position:t,value:o,maximum:n,valueText:r,unit:i,onKeyDown:a,editable:l,isDragging:s,isHovered:c,onMouseEnter:d,onMouseLeave:f,onMouseDown:u}){let{t:g}=N(),p=s?_I:c?MI:RI,m={position:"absolute",top:Et(t-5),right:0,width:ia,height:10,cursor:l?"ns-resize":"default",zIndex:s?10:1},b={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${p}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:m,onMouseEnter:d,onMouseLeave:f,onMouseDown:u,role:"slider","aria-label":g(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":n,"aria-valuetext":`${r.toFixed(2)} ${i==="cm"?"cm":"in"}`,"aria-disabled":!l,onKeyDown:a,tabIndex:l?0:-1,children:jsxRuntime.jsx("div",{style:b})})}function NI(e,t,o){let n=[];if(o==="inch"){let r=sc/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let s=Oe(l)*t;if(a%8===0){let c=a/8;n.push({position:s,width:10,label:c>0?String(c):void 0});}else a%4===0?n.push({position:s,width:6}):a%2===0?n.push({position:s,width:4}):n.push({position:s,width:2});}}else {let r=cc/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let s=Oe(l)*t;if(a%10===0){let c=a/10;n.push({position:s,width:10,label:c>0?String(c):void 0});}else a%5===0?n.push({position:s,width:6}):n.push({position:s,width:3});}}return n}var HI=e=>e.formatting?.indent??null,AI=e=>e.editable;function Nm(){let e=H(),t=W(HI),o=W(AI),n=Lt.useMemo(()=>o&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,o]),r=Lt.useCallback(i=>e?e.exec({...i.left!==void 0?{left:i.left}:{},...i.right!==void 0?{right:i.right}:{},...i.firstLine!==void 0?{firstLine:i.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Lt.useMemo(()=>({indent:t,isEnabled:n,apply:r}),[t,n,r])}var $v=e=>e.zoom,BI=e=>e.isOpening===true;function Uv(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Vv(){let{apply:e}=qn(),[t,o]=Lt.useState({}),n=Lt.useRef({}),r=Lt.useCallback(a=>l=>{n.current={...n.current,[a]:Math.round(l)},o(n.current);},[]),i=Lt.useCallback(()=>{let a=n.current;n.current={},o({}),Object.keys(a).length!==0&&e({...a.top!==void 0?{marginTopTwips:a.top}:{},...a.right!==void 0?{marginRightTwips:a.right}:{},...a.bottom!==void 0?{marginBottomTwips:a.bottom}:{},...a.left!==void 0?{marginLeftTwips:a.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:i}}function zv(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function WI(){let e=H(),{indent:t,isEnabled:o,apply:n}=Nm(),[r,i]=Lt.useState(null),a=Lt.useRef(null),l=Lt.useRef(null),s=Lt.useCallback(f=>{l.current===null&&(l.current=zv(e)),a.current=f,i(f);},[e]),c=Lt.useCallback(()=>{let f=a.current,u=l.current;a.current=null,l.current=null,i(null),f&&(u!==null&&u!==zv(e)||n({left:f.left,right:f.right,firstLine:f.firstLine}));},[e,n]),d=Lt.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine,...t.rtl?{rtl:true}:{}}:null),[r,t]);return Lt.useMemo(()=>({indent:d,isEnabled:o,preview:s,commit:c}),[d,o,s,c])}function ZI(){let e=Pe(),[t,o]=Lt.useState(0);return Lt.useEffect(()=>{if(!e){o(0);return}let n=()=>o(e.scrollLeft);return n(),e.addEventListener("scroll",n,{passive:true}),()=>e.removeEventListener("scroll",n)},[e]),t}function uc(e){let t=W(oo),o=W(BI),{pageSetup:n,isEnabled:r}=qn(),i=W($v),{pending:a,preview:l,commit:s}=Vv(),c=WI(),d=Sn(),f=an(),u=ZI();return t?null:jsxRuntime.jsx("div",{className:`docx-ruler-frame${o?" docx-ruler-frame--opening":""}`,style:{paddingInlineStart:d+f.inlineStart,paddingRight:f.inlineEnd},children:jsxRuntime.jsx(Xn,{pageSetup:Uv(n,a),zoom:i,editable:r,onLeftMarginChange:l("left"),onRightMarginChange:l("right"),onMarginDragEnd:s,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-u}px)`,clipPath:d>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function pc(e){let t=W(oo),{pageSetup:o,isEnabled:n}=qn(),r=W($v),{pending:i,preview:a,commit:l}=Vv(),s=Sn(),c=an(),d=l0();return t||d!==null&&d>0&&o&&Oe(o.pageWidthTwips)*r>d-s-c.inlineStart-c.inlineEnd?null:jsxRuntime.jsx(Hi,{pageSetup:Uv(o,i),zoom:r,editable:n,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:l,unit:e.unit??"inch",className:e.className??"",style:e.style})}function Z({size:e=20,className:t="",style:o,children:n}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...o},"aria-hidden":"true",children:n})}function Gv(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function jv(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function Yv(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function Xv(e){return jsxRuntime.jsxs(Z,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function Jv(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function Qv(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function ex(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function tx(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function ox(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function nx(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function rx(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function ax(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80Zm-120 480v-400 400Z"})})}function zI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function $I(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function UI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function VI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function GI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function jI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function YI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function XI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function JI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function QI(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function e8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function t8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function o8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"})})}function n8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M40-40v-240h80v-400H40v-240h240v80h400v-80h240v240h-80v400h80v240H680v-80H280v80H40Zm240-160h400v-80h80v-400h-80v-80H280v80h-80v400h80v80Zm32-120 136-360h64l136 360h-62l-32-92H408l-32 92h-64Zm114-144h108l-52-150h-4l-52 150ZM120-760h80v-80h-80v80Zm640 0h80v-80h-80v80Zm0 640h80v-80h-80v80Zm-640 0h80v-80h-80v80Zm80-640Zm560 0Zm0 560Zm-560 0Z"})})}function r8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function a8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function i8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function l8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function s8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Am(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function c8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function d8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function u8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function p8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function m8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function f8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function g8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function h8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function b8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function y8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function v8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function x8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function C8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function ix(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function T8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function E8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function P8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function S8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function k8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function w8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function D8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function R8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function M8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function _8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function I8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function N8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function L8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function F8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function H8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function A8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function O8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function B8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function W8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function Z8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function q8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function K8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function z8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function $8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function U8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function V8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function G8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function j8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function Y8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function X8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function J8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function Q8(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function eN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function tN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function oN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function nN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function rN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function aN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function iN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function lN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function sN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function cN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function dN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function uN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function pN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function mN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function fN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function gN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function hN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function bN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function yN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function vN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function xN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function CN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function TN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z"})})}function EN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M120-40v-640q0-33 23.5-56.5T200-760h400q33 0 56.5 23.5T680-680v640L400-160 120-40Zm80-122 200-86 200 86v-518H200v518Zm560 2v-680H240v-80h520q33 0 56.5 23.5T840-840v680h-80ZM200-680h400-400Z"})})}function PN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function SN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function kN(e){return jsxRuntime.jsx(Z,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var wN={undo:zI,redo:$I,print:UI,file_download:VI,file_upload:GI,format_bold:jI,format_italic:YI,format_underlined:XI,strikethrough_s:JI,superscript:QI,subscript:e8,link:t8,format_clear:r8,format_paragraph:o8,format_shapes:n8,lock:ax,format_align_left:a8,format_align_center:i8,format_align_right:l8,format_align_justify:s8,format_line_spacing:Am,format_list_bulleted:c8,format_list_numbered:d8,format_indent_increase:u8,format_indent_decrease:p8,format_color_text:m8,ink_highlighter:f8,format_color_reset:g8,arrow_drop_down:h8,table:b8,table_chart:y8,grid_on:v8,table_rows:x8,view_column:C8,border_all:ix,select_all:ix,border_outer:T8,border_inner:E8,border_clear:P8,add:S8,remove:k8,delete:w8,delete_sweep:D8,call_merge:R8,call_split:M8,drag_indicator:_8,image:I8,format_image_left:N8,format_image_right:L8,horizontal_rule:F8,flip_to_back:H8,flip_to_front:A8,open_with:O8,tune:B8,rotate_right:W8,rotate_left:Z8,swap_horiz:q8,swap_vert:K8,shapes:z8,format_paint:$8,expand_more:U8,expand_less:V8,border_top:G8,border_bottom:j8,border_left:Y8,border_right:X8,border_horizontal:J8,border_vertical:Q8,padding:eN,text_rotation_none:tN,wrap_text:oN,height:nN,fit_width:rN,settings:aN,border_color:iN,format_color_fill:lN,vertical_align_top:sN,vertical_align_center:cN,vertical_align_bottom:dN,line_weight:uN,keyboard_arrow_up:pN,keyboard_arrow_down:mN,keyboard_arrow_left:fN,keyboard_arrow_right:gN,more_vert:hN,page_break:bN,branding_watermark:yN,arrow_back:vN,search:xN,toc:CN,bookmark:TN,bookmarks:EN,done_all:Gv,check_circle:jv,chat_bubble_outline:Yv,chat_bubble_check:Xv,check:Jv,close:Qv,add_comment:ex,comment:tx,edit_note:ox,rate_review:nx,visibility:rx,format_textdirection_l_to_r:PN,format_textdirection_r_to_l:SN,"agent-sparkle":kN};function V({name:e,size:t=20,className:o="",style:n}){let r=wN[e];return r?jsxRuntime.jsx(r,{size:t,className:o,style:n}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:o,style:{fontSize:t,width:t,height:t,...n},children:e}))}var Ai=12,Om=240,sx=16,NN=24,LN=Ai+Om+sx,la=12,FN=36,HN=la+FN+sx,Oi=Lt__namespace.default.memo(function({headings:t,onHeadingClick:o,onClose:n,topOffset:r=0,scrollLeft:i=0,leftOffset:a=Ai}){let{t:l}=N(),[s,c]=Lt.useState(false),d=Lt.useRef(null),f=t.length?Math.min(...t.map(u=>u.level)):0;return Lt.useEffect(()=>{editor.hostWindowOf(d.current).requestAnimationFrame(()=>c(true));},[]),jsxRuntime.jsxs("nav",{ref:d,className:"docx-outline-nav",role:"navigation","aria-label":l("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:Om,paddingTop:NN,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:s?"translateX(0)":`translateX(-${a+Om}px)`,transition:"transform 0.15s ease-out"},onMouseDown:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":l("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:l("documentOutline.closeTitle"),children:jsxRuntime.jsx(V,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:l("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:l("documentOutline.noHeadings")}):t.map((u,g)=>jsxRuntime.jsx("div",{style:{marginLeft:(u.level-f)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>o(u.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:u.text,children:u.text})},`${u.blockId}-${g}`))})]})});var BN=e=>e,WN=Object.freeze([]),ZN=()=>{};function Bm(e){let t=H(),o=W(BN),n=Lt.useMemo(()=>t&&!o.isLoading?t.getOutline():WN,[t,o]),r=Lt.useCallback(i=>{if(!t)return;t.focus();let a={paragraphId:i,offset:0};t.exec({type:"setSelection",range:{anchor:a,head:a}}),t.scrollToBlock(i);},[t]);return oo(o)?null:jsxRuntime.jsx(Oi,{headings:n,onHeadingClick:r,onClose:e.onClose??ZN,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Wm=Lt.createContext(null);function vo(e){let t=Lt.useContext(Wm);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var VN={ok:false,code:"unsupported",reason:"editor is not ready"},dx=Object.freeze([]);function mc(e={}){let t=e.enabled??true,o=H(),n=Lt.useCallback(D=>t?o?.query({type:"bookmarks"})??dx:dx,[o,t]),r=W(n,fp),[i,a]=Lt.useState(""),[l,s]=Lt.useState("name"),[c,d]=Lt.useState(false),[f,u]=Lt.useState(null),[g,p]=Lt.useState(null),[m,b]=Lt.useState(""),h=Lt.useMemo(()=>editor.goToBookmarkRows(r,{query:i,sortBy:l,showHidden:c}),[r,i,l,c]),v=Lt.useMemo(()=>f===null?-1:h.findIndex(D=>D.name===f),[h,f]),y=Lt.useCallback(D=>{a(D),u(null),p(null);},[]),C=Lt.useCallback(D=>{s(D),u(null),p(null);},[]),T=Lt.useCallback(D=>{d(D),u(null),p(null);},[]),x=Lt.useCallback(D=>{if(h.length===0)return;let w=v<0?D>0?-1:0:v;u(h[(w+D+h.length)%h.length].name);},[h,v]),E=Lt.useCallback(D=>u(h[D]?.name??null),[h]),P=Lt.useCallback(D=>{if(!o)return VN;let w=D??h[v]?.name??editor.goToBookmarkTarget(r,i,h)?.name;if(w===void 0||w.trim().length===0){let L=i.trim();return p(L.length===0?"empty":"notFound"),b(L),{ok:false,code:"notFound",reason:"no bookmark is named that"}}let S=o.exec({type:"goToBookmark",name:w});return p(S.ok?null:S.code==="notFound"?"notFound":"failed"),b(S.ok?"":w),S},[o,h,v,r,i]);return {query:i,setQuery:y,sortBy:l,setSortBy:C,showHidden:c,setShowHidden:T,rows:h,bookmarks:r,activeIndex:v,move:x,setActiveIndex:E,go:P,problem:g,problemName:m}}var ux=(...e)=>e.filter(Boolean).join(" "),QN={header:"navigation.goTo.places.header",footer:"navigation.goTo.places.footer",footnote:"navigation.goTo.places.footnote",endnote:"navigation.goTo.places.endnote"},e5={body:"navigation.goTo.groups.body",header:"navigation.goTo.groups.header",footer:"navigation.goTo.groups.footer",footnote:"navigation.goTo.groups.footnote",endnote:"navigation.goTo.groups.endnote"};function t5(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:"M5.5 2.5h5M5.5 13.5h5M8 2.5v11",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})})}function o5({name:e,query:t}){let o=editor.goToBookmarkMatch(e,t);return o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.slice(0,o.start),jsxRuntime.jsx("span",{className:"docx-nav__goto-match",children:e.slice(o.start,o.end)}),e.slice(o.end)]}):e}function Bi({className:e,style:t}){let{pane:o,intents:n,t:r}=vo("GoTo"),i=H(),a=o.tab!=="goto",l=mc({enabled:o.open&&!a}),s=ce("insert.bookmark"),c=W(oo),d=Lt.useId(),f=`${d}-list`,u=`${d}-label`,g=`${d}-hint`,p=E=>`${d}-option-${E}`,m=Lt.useRef(null);Lt.useEffect(()=>{if(l.activeIndex<0)return;let E=`${d}-option-${l.activeIndex}`;m.current?.querySelector(`[id="${E}"]`)?.scrollIntoView?.({block:"nearest"});},[l.activeIndex,d]);let b=E=>{l.go(E).ok&&(n.picked(),i?.focus());},h=E=>{E.nativeEvent.isComposing||(E.key==="ArrowDown"||E.key==="ArrowUp"?(E.preventDefault(),l.move(E.key==="ArrowDown"?1:-1)):(E.key==="Home"||E.key==="End")&&l.activeIndex>=0?(E.preventDefault(),l.setActiveIndex(E.key==="Home"?0:l.rows.length-1)):E.key==="Enter"?(E.preventDefault(),b()):E.key==="Escape"&&l.query.length>0&&(E.preventDefault(),l.setQuery("")));},v=l.problem==="notFound"?r("navigation.goTo.notFound",{name:l.problemName}):l.problem==="failed"?r("navigation.goTo.failed"):l.problem==="empty"?r("navigation.goTo.typeName"):l.bookmarks.length>0&&l.rows.length===0?r("navigation.goTo.noMatches"):"",y=l.activeIndex>=0?p(l.activeIndex):void 0,C=l.sortBy==="location",T=l.bookmarks.length===0,x=(E,P)=>{let D=P===l.activeIndex;return jsxRuntime.jsxs("li",{id:p(P),role:"option","aria-selected":D,className:ux("docx-nav__goto-row",D&&"docx-nav__goto-row--active"),"data-point":E.empty||void 0,onMouseDown:w=>w.preventDefault(),onClick:()=>b(E.name),children:[jsxRuntime.jsx("span",{className:"docx-nav__goto-icon","aria-hidden":"true",children:E.empty?jsxRuntime.jsx(t5,{}):jsxRuntime.jsx(V,{name:"bookmark",size:16})}),jsxRuntime.jsx("span",{className:"docx-nav__result-text",children:jsxRuntime.jsx(o5,{name:E.name,query:l.query})}),E.atSelection&&jsxRuntime.jsx("span",{className:"docx-nav__goto-here",title:r("navigation.goTo.atCaret"),children:jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:r("navigation.goTo.atCaret")})}),!C&&E.place!=="body"&&jsxRuntime.jsx("span",{className:"docx-nav__goto-place",children:r(QN[E.place])})]},E.name)};return jsxRuntime.jsxs("div",{className:ux("docx-nav__panel docx-nav__panel--goto",e),style:t,role:"tabpanel",id:"docx-nav-panel-goto","aria-labelledby":"docx-nav-tab-goto",hidden:a,children:[jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(V,{name:"bookmark",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"text",role:"combobox",className:"docx-nav__search-input",value:l.query,placeholder:r("navigation.goTo.placeholder"),"aria-label":r("navigation.goTo.label"),"aria-describedby":y?g:void 0,"aria-expanded":l.rows.length>0,"aria-controls":l.rows.length>0?f:void 0,"aria-autocomplete":"list","aria-activedescendant":y,autoComplete:"off",spellCheck:false,onChange:E=>l.setQuery(E.target.value),onKeyDown:h}),y&&jsxRuntime.jsx("kbd",{className:"docx-nav__goto-enter","aria-hidden":"true",children:"\u21B5"}),jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r("navigation.goTo.enterHint")})]}),jsxRuntime.jsxs("div",{className:"docx-nav__goto-controls",children:[jsxRuntime.jsx("div",{className:"docx-nav__segmented",role:"radiogroup","aria-label":r("dialogs.bookmark.sortBy"),children:["name","location"].map(E=>jsxRuntime.jsxs("label",{className:"docx-nav__segment","data-checked":l.sortBy===E||void 0,children:[jsxRuntime.jsx("input",{type:"radio",className:"docx-nav__segment-input",name:`${d}-sort`,checked:l.sortBy===E,onChange:()=>l.setSortBy(E)}),r(E==="name"?"dialogs.bookmark.sortName":"dialogs.bookmark.sortLocation")]},E))}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:l.showHidden,onChange:E=>l.setShowHidden(E.target.checked)}),r("dialogs.bookmark.showHidden")]})]}),T&&!c&&jsxRuntime.jsxs("div",{className:"docx-nav__goto-empty",children:[jsxRuntime.jsx(V,{name:"bookmark",size:24,className:"docx-nav__goto-empty-icon"}),jsxRuntime.jsx("p",{className:"docx-nav__goto-empty-title",children:r("navigation.goTo.empty")}),jsxRuntime.jsx("p",{className:"docx-nav__goto-empty-hint",children:r("navigation.goTo.emptyHint")}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__goto-add",disabled:!s.isEnabled,title:s.disabledReason??void 0,onClick:()=>s.execute(),children:r("navigation.goTo.add")})]}),!T&&jsxRuntime.jsxs("div",{className:"docx-nav__goto-heading",children:[jsxRuntime.jsx("span",{id:u,children:r("navigation.goTo.listAriaLabel")}),jsxRuntime.jsx("span",{className:"docx-nav__goto-count",children:l.query.trim().length>0?r("navigation.goTo.countFiltered",{shown:l.rows.length,total:l.bookmarks.filter(E=>l.showHidden||!E.hidden).length}):l.rows.length})]}),jsxRuntime.jsx("p",{className:"docx-nav__goto-message",role:"status",children:v}),l.rows.length>0&&jsxRuntime.jsx("ul",{ref:m,id:f,className:"docx-nav__list docx-nav__goto-list",role:"listbox","aria-labelledby":u,children:C?editor.goToBookmarkGroups(l.rows).map(E=>jsxRuntime.jsxs("li",{role:"group","aria-labelledby":`${d}-group-${E.place}`,className:"docx-nav__goto-group",children:[jsxRuntime.jsx("div",{id:`${d}-group-${E.place}`,className:"docx-nav__goto-group-label",children:r(e5[E.place])}),jsxRuntime.jsx("ul",{role:"none",className:"docx-nav__goto-sublist",children:E.rows.map(({row:P,index:D})=>x(P,D))})]},E.place)):l.rows.map((E,P)=>x(E,P))})]})}var ca=280,fc=32,px=16;function da(e=280){return 32+e+16}function gc({viewportWidth:e,pageWidthPx:t,reservation:o,inlineEndReservation:n=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(o)||o<=0||!Number.isFinite(n)||n<0||!Number.isFinite(r)||r<0)return 0;let a=(e-n-t)/2,l=a>=o?0:!i&&o<=2*a?2*(o-a):o;return Math.ceil(Math.max(0,l-r))}var Zm=320;function hc(e,t){return !Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0?false:e-t<Zm}var i5=Object.freeze([]),l5=e=>e;function bc(){let e=H(),t=W(l5),[o,n]=Lt.useState(null),r=Lt.useMemo(()=>e&&!t.isLoading?e.getOutline():i5,[e,t]),i=Lt.useMemo(()=>{if(r.length===0)return [];let l=r[0].level;for(let s of r)s.level<l&&(l=s.level);return r.map(s=>({heading:s,depth:s.level-l}))},[r]),a=Lt.useCallback(l=>{if(!e||typeof l!="string"||l.length===0)return;e.focus();let s={paragraphId:l,offset:0};e.exec({type:"setSelection",range:{anchor:s,head:s}}),e.scrollToBlock(l),n(l);},[e]);return {headings:r,items:i,selectedBlockId:o,goTo:a,isEmpty:r.length===0}}var vx=Object.freeze({query:"",matchCase:false,wholeWord:false,matches:Object.freeze([]),truncated:false,activeIndex:-1,activeMatch:null,isPending:false}),u5=()=>()=>{},fx=()=>vx;function yc(e={}){let t=e.highlight??"all",o=H(),n=Lt.useMemo(()=>o?editor.createDocumentSearch(o):null,[o]),r=Lt.useSyncExternalStore(n?n.subscribe:u5,n?n.getState:fx,n?n.getState:fx);Lt.useEffect(()=>{if(!(!n||t==="none"))return n.showHighlights(t)},[n,t]);let i=Lt.useMemo(()=>({setQuery:a=>n?.setQuery(a),find:(a,l)=>n?.find(a,l)??vx.matches,setMatchCase:a=>n?.setMatchCase(a),setWholeWord:a=>n?.setWholeWord(a),goTo:a=>n?.goTo(a)??false,next:()=>n?.next()??false,previous:()=>n?.previous()??false,clear:()=>n?.clear()}),[n]);return Lt.useMemo(()=>({...r,...i}),[r,i])}function Px(e,t=i18n.isApplePlatform()){return e.altKey||e.shiftKey||e.isComposing||(t?!e.metaKey||e.ctrlKey:!e.ctrlKey||e.metaKey)?false:editor.chordLetter(e)==="f"}var Sx=editor.isGoToChord;function kx(e=i18n.isApplePlatform()){return e?"Ctrl+Alt+G":"Ctrl+G"}function wx(e=i18n.isApplePlatform()){return e?"Meta+Alt+G":"Control+G"}function Dx(e){return e.startsWith("Ctrl")?"Control+F":"Meta+F"}function Rx(e,t,o){if(e?.isConnected){o&&e.closest(".docx-pages")?o():e.focus({preventScroll:true});return}if(e&&o){o();return}t?t.focus({preventScroll:true}):o?.();}function Mx(e,t,o){if(!editor.isDomNode(e))return false;if(t?.contains(e))return true;if(!o)return false;if(o.contains(e))return true;let n=editor.isElementNode(e)?e:e.parentElement;if(!n)return false;let r=editor.editorInstanceScope(o);if(r&&r!==o&&r.contains(n))return true;if(!n.closest(".docx-editor")||editor.editorInstanceScope(n)!==null)return false;let i=o.ownerDocument.querySelectorAll(".docx-editor__scroll-container");return i.length===1&&i[0]===o}function zm(e,t){let o=e?.querySelector(`#docx-nav-panel-${t}`);if(!o)return null;if(t==="headings"){let n=o.querySelector(".docx-nav__heading--current")??o.querySelector(".docx-nav__heading");if(n)return n}return o.querySelector(".docx-nav__search-input")}function $m(e){e.focus(),e.localName==="input"&&e.select();}function h5(e){let o=e.querySelector('[role="tab"][aria-selected="true"]')?.id??"",r=zm(e,o==="docx-nav-tab-find"?"find":o==="docx-nav-tab-goto"?"goto":"headings");if(r){$m(r);return}editor.isHTMLElementNode(e)&&(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus());}function b5(e,t){let o=[];if(t.contains(e)){let i=e;for(;i!==t&&i.parentElement;){for(let a of i.parentElement.children)a!==i&&o.push(a);i=i.parentElement;}}else o.push(...t.children);let n=e.ownerDocument.activeElement;n&&o.some(i=>i.contains(n))&&h5(e);let r=[];for(let i of o)i.hasAttribute("inert")||(i.setAttribute("inert",""),r.push(i));return ()=>{for(let i of r)i.removeAttribute("inert");r.length=0;}}function _x(e,t,o){let n=b5(e,t),r=i=>{editor.isDomNode(i.target)&&e.contains(i.target)||o();};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),n();}}function Tx(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Ix(e,t){let o=()=>{let i=editor.hostWindowOf(t).getComputedStyle(t),a=t.clientHeight-Tx(i.paddingTop)-Tx(i.paddingBottom);e.style.setProperty("--docx-nav-block-size",`${Math.max(0,Math.round(a))}px`),e.style.setProperty("--docx-nav-inline-size",`${Math.round(t.clientWidth)}px`);};o();let n=editor.hostWindowOf(t).ResizeObserver;if(typeof n>"u")return ()=>{};let r=new n(o);return r.observe(t),()=>r.disconnect()}function Lx(e,t=true,o=true){let n=H(),r=Pe(),i=Lt.useRef(null),a=Lt.useRef(null),l=Lt.useRef(false),s=Lt.useRef(false),c=Lt.useRef(false),d=Lt.useRef(0),f=Lt.useCallback(()=>{let x=++d.current;editor.hostWindowOf(i.current).setTimeout(()=>{d.current===x&&(l.current=false,s.current=false,c.current=false);},0);},[]),u=Lt.useRef(e);u.current=e;let g=Lt.useCallback(()=>{l.current=false;let x=zm(i.current,u.current.tab);x&&$m(x);},[]),p=Lt.useCallback(()=>{s.current=false;let x=a.current;a.current=null;let E=i.current?.querySelector(".docx-nav__toggle")??null;Rx(x,E,n?()=>n.focus():null);},[n]),m=Lt.useRef(p);m.current=p,Lt.useEffect(()=>()=>{s.current&&m.current();},[]);let b=Lt.useCallback(()=>{l.current=false,s.current=true,u.current.setOpen(false),f();},[f]),h=Lt.useCallback((x,E)=>{E&&!i.current?.contains(E)&&(a.current=E),s.current=false;let P=u.current;if(P.open&&P.tab===x){g();return}l.current=true,P.tab!==x&&P.setTab(x),P.open||P.setOpen(true),f();},[g,f]),v=Lt.useMemo(()=>({openTab:x=>{let E=i.current?.ownerDocument.activeElement;h(x,editor.isHTMLElementNode(E)?E:null);},toggle:()=>{if(u.current.open){b();return}a.current=null,s.current=false,l.current=true,u.current.setOpen(true),f();},close:b,picked:()=>{let x=u.current;if(!x.overlay)return;let E=i.current?.ownerDocument.activeElement;c.current=!!E&&!!i.current?.contains(E),x.setOpen(false),f();}}),[b,f,h]),y=Lt.useRef(v);y.current=v,Lt.useEffect(()=>{let x=i.current?.ownerDocument;if(!x||!t&&!o)return;let E=P=>{if(P.defaultPrevented)return;let D=t&&Px(P)?"find":o&&Sx(P)?"goto":null;if(!D||!Mx(P.target,i.current,r))return;if(D==="goto"&&n?.can({type:"openGoTo"}).ok){n.exec({type:"openGoTo",fromShortcut:true}).ok&&P.preventDefault();return}P.preventDefault();let w=x.activeElement;h(D,editor.isHTMLElementNode(w)?w:null);};return x.addEventListener("keydown",E),()=>x.removeEventListener("keydown",E)},[r,t,o,h,n]),Lt.useEffect(()=>{l.current&&(u.current.open?g():l.current=false),s.current&&(u.current.open?s.current=false:p()),c.current&&(c.current=false,u.current.open||n?.focus());});let C=e.open&&e.overlay;Lt.useEffect(()=>{let x=i.current;if(!(!C||!x||!r))return _x(x,r,()=>y.current.close())},[C,r]),Lt.useEffect(()=>{let x=i.current;if(!(!x||!r||!r.contains(x)))return Ix(x,r)},[r]);let T=Lt.useCallback(x=>{x.key!=="Escape"||x.defaultPrevented||x.nativeEvent.isComposing||u.current.open&&(x.preventDefault(),b());},[b]);return {rootRef:i,intents:v,onKeyDown:T}}var C5=150;function T5(e){return e.source!==void 0?true:(e.created?.length??0)>0||(e.deleted?.length??0)>0}function E5(e){let t=0;for(let o of e)t=Math.max(t,o.box.width);return t>0?t:null}function Fx(e,t,o=()=>null){let n=editor.hostTimers(o),r=null,i=false,a=()=>{r=null,i||t(E5(e.getPageGeometry()));},l=()=>{i||(n.clearTimeout(r),r=n.setTimeout(a,C5));},s=e.on("change",c=>{T5(c)&&l();});return a(),{nudge:l,dispose(){i=true,n.clearTimeout(r),r=null,s();}}}var D5=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,zoom:e.zoom,reviewPaneOpen:e.reviewPaneOpen??true,fitting:t?.type==="fit"&&e.zoom<(t.maxZoom??editor.ZOOM_MAX)&&e.zoom>(t.minZoom??editor.ZOOM_MIN)}},R5=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips,M5=e=>e.page.total;function vc(e={}){let{defaultOpen:t=false,defaultTab:o="headings",paneWidth:n=280}=e,[r,i]=Lt.useState(t),[a,l]=Lt.useState(o),s=e.open??r,c=e.tab??a,{onOpenChange:d,onTabChange:f}=e,u=e.open!==void 0,g=e.tab!==void 0,p=Lt.useCallback(A=>{u||i(A),d?.(A);},[u,d]),m=Lt.useCallback(()=>p(!s),[s,p]),b=Lt.useCallback(A=>{g||l(A),f?.(A);},[g,f]),h=Pn(),v=Pe(),y=Lt.useContext(Rt),{pageSetup:C,zoom:T,reviewPaneOpen:x,fitting:E}=W(D5,R5),P=H(),D=W(M5),[w,S]=Lt.useState(0),[L,I]=Lt.useState(null),[F,O]=Lt.useState(0),[k,_]=Lt.useState(0),U=an();Lt.useEffect(()=>{if(!v){S(0),O(0),_(0);return}let A=()=>{S(v.clientWidth);let ue=editor.hostWindowOf(v).getComputedStyle(v),de=Number.parseFloat(ue.paddingInlineEnd);O(Number.isFinite(de)?de:0);let ge=Number.parseFloat(ue.getPropertyValue("--docx-review-gutter-start"));_(Number.isFinite(ge)?ge:0);};A();let M=editor.hostWindowOf(v).ResizeObserver;if(typeof M>"u")return;let j=new M(A);return j.observe(v),()=>j.disconnect()},[v,s,x,y?.mounted,y?.gutters,U]);let z=Lt.useRef(null);C&&(z.current=C.pageWidthTwips);let re=C?.pageWidthTwips??z.current,X=Lt.useRef(null);Lt.useEffect(()=>{if(!s||!P)return;let A=Fx(P,I,()=>v);return X.current=A,()=>{A.dispose(),X.current===A&&(X.current=null);}},[s,P,v]),Lt.useEffect(()=>X.current?.nudge(),[D,re]);let ae=da(n),K=a0(U,F),J=s&&hc(w-K,ae),B=Lt.useMemo(()=>!s||J||re===null?0:gc({viewportWidth:w,pageWidthPx:Math.max(L??0,Oe(re))*T,reservation:ae,inlineEndReservation:F,inlineStartReservation:k,docked:E}),[s,J,re,L,T,w,ae,F,k,E]);return Lt.useEffect(()=>{if(h)return h.setShift(B),()=>h.setShift(0)},[h,B]),Lt.useEffect(()=>{if(h)return h.setReservation(s&&!J?ae:0),()=>h.setReservation(0)},[h,s,J,ae]),{open:s,setOpen:p,toggle:m,tab:c,setTab:b,paneWidth:n,shift:B,overlay:J}}var qi=["headings","find","goto"],To=(...e)=>e.filter(Boolean).join(" ");function Ki({className:e,style:t,children:o}){return jsxRuntime.jsx("div",{className:To("docx-nav__header",e),style:t,children:o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zi,{}),jsxRuntime.jsx($i,{})]})})}function zi({className:e,style:t,children:o}){let{intents:n,t:r}=vo("Close");return jsxRuntime.jsx("button",{type:"button",className:To("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:n.close,children:o??jsxRuntime.jsx(V,{name:"arrow_back",size:20})})}function $i({className:e,style:t,children:o}){let{t:n}=vo("Title");return jsxRuntime.jsx("h2",{className:To("docx-nav__title",e),style:t,children:o??n("navigation.title")})}function Ui({className:e,style:t,children:o}){let{pane:n,t:r}=vo("Tabs"),i=Lt.useCallback(a=>{let l=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(l===0)return;a.preventDefault();let s=qi.indexOf(n.tab);n.setTab(qi[(s+l+qi.length)%qi.length]);},[n]);return jsxRuntime.jsx("div",{className:To("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:o??qi.map(a=>jsxRuntime.jsx(Vi,{value:a},a))})}function Vi({value:e,className:t,style:o,children:n}){let{pane:r,t:i,goToShortcut:a}=vo("Tab"),l=Mo(),s=r.tab===e,c=e==="goto"&&a?i("navigation.goTo.tabTitle",{shortcut:l(kx())}):void 0;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":s,"aria-controls":`docx-nav-panel-${e}`,tabIndex:s?0:-1,className:To("docx-nav__tab",s&&"docx-nav__tab--selected",t),style:o,...c?{title:c,"aria-keyshortcuts":wx()}:{},onClick:()=>r.setTab(e),children:n??i(`navigation.tabs.${e}`)})}function Ox({value:e,onChange:t,onClear:o,placeholder:n,label:r,clearLabel:i,autoFocus:a,onEnter:l}){let s=Lt.useRef(null);return Lt.useEffect(()=>{a&&s.current?.focus();},[a]),jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(V,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{ref:s,type:"search",className:"docx-nav__search-input",value:e,placeholder:n,"aria-label":r,autoFocus:a,onChange:c=>t(c.target.value),onKeyDown:c=>{!l||c.key!=="Enter"||c.nativeEvent.isComposing||(c.preventDefault(),l(c.shiftKey));}}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:o,children:jsxRuntime.jsx(V,{name:"close",size:16})})]})}function Gi({className:e,style:t}){let{pane:o,outline:n,intents:r,t:i}=vo("Headings"),[a,l]=Lt.useState(""),s=W(oo),c=Lt.useMemo(()=>{let f=a.trim().toLowerCase();return f.length===0?n.items:n.items.filter(u=>u.heading.text.toLowerCase().includes(f))},[n.items,a]),d=o.tab!=="headings";return jsxRuntime.jsxs("div",{className:To("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:d,children:[jsxRuntime.jsx(Ox,{value:a,onChange:l,onClear:()=>l(""),placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel")}),s?null:n.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:i("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((f,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:To("docx-nav__heading",n.selectedBlockId===f.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+f.depth*14}px`},title:f.heading.text,onClick:()=>{n.goTo(f.heading.blockId),r.picked();},children:f.heading.text})},`${f.heading.blockId}-${u}`))})]})}function H5({match:e,active:t,onSelect:o}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:To("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:o,children:jsxRuntime.jsxs("span",{className:"docx-nav__result-text",children:[e.contextBefore,jsxRuntime.jsx("mark",{className:"docx-nav__result-hit",children:e.text}),e.contextAfter]})})})}function ji({className:e,style:t}){let{pane:o,search:n,intents:r,t:i}=vo("Find"),a=o.tab!=="find",l=n.query.trim().length>0,s=o.open&&!a,c=n.matches.length===0?null:n.activeIndex<0?i(n.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:n.matches.length}):i(n.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:n.activeIndex+1,total:n.matches.length});return jsxRuntime.jsxs("div",{className:To("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(Ox,{value:n.query,onChange:n.setQuery,onClear:n.clear,placeholder:i("navigation.find.placeholder"),label:i("navigation.find.inputAriaLabel"),clearLabel:i("navigation.find.clearAriaLabel"),autoFocus:s,onEnter:d=>{n.isPending&&n.find(n.query),d?n.previous():n.next();}}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":i("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.matchCase,onChange:d=>n.setMatchCase(d.target.checked)}),i("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:n.wholeWord,onChange:d=>n.setWholeWord(d.target.checked)}),i("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:l?n.isPending?i("navigation.find.searching"):c??i("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.previousAriaLabel"),disabled:n.matches.length===0,onClick:n.previous,children:jsxRuntime.jsx(V,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":i("navigation.find.nextAriaLabel"),disabled:n.matches.length===0,onClick:n.next,children:jsxRuntime.jsx(V,{name:"keyboard_arrow_down",size:18})})]})]}),n.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":i("navigation.find.resultsAriaLabel"),children:n.matches.map((d,f)=>jsxRuntime.jsx(H5,{match:d,active:f===n.activeIndex,onSelect:()=>{n.goTo(f),r.picked();}},`${d.blockId}-${d.start}-${f}`))})]})}function Yi({className:e,style:t,children:o}){let{pane:n,intents:r,findShortcut:i,t:a}=vo("Toggle"),s=Mo()("Ctrl+F"),c=i?Dx(s):void 0,d=i?a("navigation.openShortcutTitle",{shortcut:s}):a("navigation.openTitle");return jsxRuntime.jsx("button",{type:"button",className:To("docx-nav__toggle",e),style:t,"aria-label":a("navigation.openAriaLabel"),"aria-expanded":n.open,"aria-keyshortcuts":c,title:d,onMouseDown:f=>f.preventDefault(),onClick:r.toggle,children:o??jsxRuntime.jsx(V,{name:"toc",size:20})})}function Vm(e){let t=Mt(),{t:o,toggle:n=true,searchHighlight:r="all",findShortcut:i=true,goToShortcut:a=true,className:l,style:s,children:c,...d}=e,f=vc(d),u=bc(),g=f.open&&f.tab==="find"?r:"none",p=yc({highlight:g}),m=Xe(),b=Lt.useMemo(()=>o??((E,P)=>m(E,P)),[o,m]),h=Lx(f,i,a),v=Lt.useMemo(()=>({pane:f,outline:u,search:p,t:b,intents:h.intents,findShortcut:i,goToShortcut:a}),[f,u,p,b,h.intents,i,a]),y=H(),C=Lt.useRef(h.intents);C.current=h.intents;let T=Lt.useRef(a);T.current=a,Lt.useEffect(()=>{if(y)return y.setGoToChrome({onRequest:()=>C.current.openTab("goto"),get shortcut(){return T.current}})},[y]);let x=e.paneWidth??280;return jsxRuntime.jsx(Wm.Provider,{value:v,children:jsxRuntime.jsxs("div",{ref:h.rootRef,className:`${t}docx-nav${f.open?" docx-nav--open":""}${f.overlay?" docx-nav--overlay":""}${l?` ${l}`:""}`,"data-open":f.open?"true":"false",onKeyDown:h.onKeyDown,style:{"--docx-nav-width":`${x}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${da(x)}px`,...s},children:[n!==false&&!f.open&&jsxRuntime.jsx(Yi,{...typeof n=="object"?n:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":v.t("navigation.ariaLabel"),inert:!f.open,children:c??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ki,{}),jsxRuntime.jsx(Ui,{}),jsxRuntime.jsx(Gi,{}),jsxRuntime.jsx(ji,{}),jsxRuntime.jsx(Bi,{})]})})]})})}var xc=Object.assign(Vm,{Header:Ki,Close:zi,Title:$i,Tabs:Ui,Tab:Vi,Headings:Gi,Find:ji,GoTo:Bi,Toggle:Yi});var $5=600,U5=e=>e.isOpening===true?0:e.page.total,Cc=Lt.createContext(null);function Tc({className:e,style:t}){let o=Mt(),n=H(),r=Pe(),{inside:i,host:a,hostScoped:l}=c0(r),s=W(U5),{t:c}=N(),d=Lt.useContext(Cc),[f,u]=Lt.useState(1),[g,p]=Lt.useState(false);if(Lt.useEffect(()=>{if(p(false),!n||!r||s<=1)return;u(n.getCurrentPage("viewport"));let v=editor.hostWindowOf(r),y=null,C=()=>{u(n.getCurrentPage("viewport")),p(true),y!==null&&v.clearTimeout(y),y=v.setTimeout(()=>p(false),$5);};return r.addEventListener("scroll",C,{passive:true}),()=>{r.removeEventListener("scroll",C),y!==null&&v.clearTimeout(y);}},[n,s,r]),s<=1)return null;let m=a?l?"":"docx-editor ":o,b=d?d("viewer.pageIndicator").replace(/\{current\}/g,String(f)).replace(/\{total\}/g,String(s)):c("viewer.pageIndicator",{current:f,total:s}),h=jsxRuntime.jsx("div",{className:`${m}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":g?"true":"false",role:"status","aria-live":"polite",children:b});return i?a?reactDom.createPortal(h,a):null:h}var j5=[],Y5=e=>e.fontSubstitutions??j5;function Ec({className:e,style:t,t:o}){let n=W(Y5),{t:r}=N(),i=o??r,[a,l]=Lt.useState(null);if(n.length===0)return null;let s=n.join("\0");return a===s?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:i("editor.fontSubstitutionNotice",{fonts:n.join(", ")}).replace("{fonts}",n.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>l(s),children:i("common.dismiss")})]})}var i6={damaged:"openFailure.reasons.damaged","not-docx":"openFailure.reasons.notDocx","too-large":"openFailure.reasons.tooLarge",blocked:"openFailure.reasons.blocked",unknown:"openFailure.reasons.unknown"};function l6(e,t){return typeof e=="object"&&e!==null&&"reason"in e&&e!==t}var s6=e=>e.openFailure??null;function $x(e={}){let t=W(s6),{t:o}=N(),n=e.t??o,[r,i]=Lt.useState(null),a=t!==null&&t!==r?t:null,l=Lt.useCallback(s=>{l6(s,t)||i(t);},[t]);return {failure:a,message:a?n(i6[a.reason]):null,dismiss:l}}var Ux=Lt.createContext(null);function jm({variant:e="secondary",dismiss:t=false,asChild:o=false,className:n,onClick:r,children:i,type:a,...l}){let s=Lt.useContext(Ux),c=`docx-dialog__button${e==="primary"?" docx-dialog__button--primary":""}${n?` ${n}`:""}`,d=f=>{r?.(f),t&&!f.defaultPrevented&&s?.dismiss();};return o?jsxRuntime.jsx(Y,{...l,className:c,onClick:d,children:i}):jsxRuntime.jsx("button",{...l,type:a??"button",className:c,onClick:d,children:i})}var zx=new Set;function Vx(e,t){if(!t||!mt())return;let o=e===false?"disabled":typeof e=="object"&&e.actions?"both":null;o===null||zx.has(o)||(zx.add(o),console.warn(o==="both"?"[docx-editor] renderOpenFailureActions replaces openFailure.actions. Pass only one.":"[docx-editor] renderOpenFailureActions is ignored with openFailure={false}, which renders no dialog."));}function Gx(e){return Lt.Children.toArray(e).some(t=>Lt.isValidElement(t)&&t.type===Lt.Fragment?Gx(t.props.children):true)}function c6({title:e,message:t,showCode:o=true,actions:n,closeLabel:r,showClose:i=true,onDismiss:a,children:l,className:s,style:c,t:d}){let{t:f}=N(),u=d??f,{failure:g,message:p,dismiss:m}=$x({t:u}),b=Lt.useId();if(!g||p===null)return null;let h=()=>{m(g),a?.(g);},v={failure:g,message:p,dismiss:h},y=e??u("openFailure.title"),C=typeof t=="function"?t(g):t??p,T=n?.(v),x=Gx(T);return jsxRuntime.jsx(Ux.Provider,{value:v,children:jsxRuntime.jsx(ze,{kind:"openFailure",role:"alertdialog",label:y,className:s,style:c,onClose:h,dismissOutside:false,...l?{}:{describedBy:b},children:l?l(v):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("header",{className:"docx-dialog__header",children:jsxRuntime.jsx("h2",{className:"docx-dialog__title",children:y})}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[jsxRuntime.jsx("div",{id:b,className:"docx-dialog__message",children:C}),o?jsxRuntime.jsx("p",{className:"docx-dialog__code",children:u("openFailure.code",{code:g.code}).replace("{code}",g.code)}):null]}),x||i?jsxRuntime.jsxs("footer",{className:"docx-dialog__footer",children:[T,i?jsxRuntime.jsx(jm,{variant:x?"secondary":"primary",dismiss:true,children:r??u("common.close")}):null]}):null]})})})}var Pc=Object.assign(c6,{Action:jm});function Ym(e){return Math.round(e/1440*100)/100}function jx(e){return Math.round(e*1440)}function p6(e,t){return e===t?true:!e||!t?false:e.editing===t.editing&&e.sectionIndex===t.sectionIndex&&e.variant===t.variant&&e.rId===t.rId&&e.partName===t.partName&&e.inherited===t.inherited&&e.titlePage===t.titlePage&&e.evenAndOddHeaders===t.evenAndOddHeaders&&e.headerDistanceTwips===t.headerDistanceTwips&&e.footerDistanceTwips===t.footerDistanceTwips}function Xm(){let e=H(),t=Lt.useCallback(o=>e?.getHeaderFooterState()??null,[e]);return W(t,p6)}function h6(e,t){return t==="first"?e==="header"?"headerFooter.firstPageHeader":"headerFooter.firstPageFooter":t==="even"?e==="header"?"headerFooter.evenPageHeader":"headerFooter.evenPageFooter":e==="header"?"headerFooter.header":"headerFooter.footer"}var b6=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Xi(e){let t=H();return Lt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let o=t.can(e);return o.ok?{enabled:true,reason:null}:{enabled:false,reason:o.reason}},[t,e])}function y6(e){let{state:t,onMouseDown:o}=e,{t:n}=N(),r=H(),[i,a]=Lt.useState(false),l=Lt.useRef(null),[s,c]=Lt.useState(""),[d,f]=Lt.useState("");Lt.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(c(String(Ym(t.headerDistanceTwips))),f(String(Ym(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),Lt.useEffect(()=>{if(!i)return;let E=D=>{l.current?.contains(D.target)||a(false);},P=editor.hostDocumentOf(l.current);return P.addEventListener("mousedown",E),()=>P.removeEventListener("mousedown",E)},[i]);let u=Lt.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=Lt.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),p=Lt.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),m=Lt.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),b=Lt.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),h=Xi(u),v=Xi(g),y=Xi(p),C=Xi(m),T=Xi(b),x=(E,P)=>{if(!r)return;let D=Number.parseFloat(P);Number.isFinite(D)&&r.exec({type:"setHeaderFooterOptions",[E]:jx(D)});};return jsxRuntime.jsxs("div",{ref:l,className:"docx-hf-chrome__options",onMouseDown:o,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(E=>!E),onMouseDown:o,children:n("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:o,children:[b6.map(E=>{let P={type:"insertPageField",field:E.field},D=r?.can(P);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!D?.ok,title:D&&!D.ok?D.reason:void 0,onClick:()=>{r?.exec(P),a(false);},onMouseDown:o,children:n(E.labelKey)},E.field)}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.titlePage===true,disabled:!h.enabled,title:h.reason??void 0,onChange:()=>r?.exec(u)}),jsxRuntime.jsx("span",{children:n("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!v.enabled,title:v.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[n("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:n("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>r?.exec(m),onMouseDown:o,children:n("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!y.enabled,title:y.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:o,children:n("headerFooter.linkToPrevious")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.headerDistance"),value:s,onChange:E=>c(E.target.value),onBlur:()=>x("headerDistanceTwips",s)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:n("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":n("headerFooter.footerDistance"),value:d,onChange:E=>f(E.target.value),onBlur:()=>x("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!T.enabled,title:T.reason??void 0,onClick:()=>r?.exec(b),onMouseDown:o,children:t.editing==="header"?n("headerFooter.removeHeader"):n("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),a(false);},onMouseDown:o,children:n("common.close")})]}):null]})}function Sc({className:e}){let{t}=N(),o=Xm(),n=Lt.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=$a(n,"story-label"),i=q;if(!o?.editing)return null;let a=h6(o.editing,o.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:ht.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),o.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(y6,{state:o,onMouseDown:i})]})}var T6={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},E6={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},P6={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},S6={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},k6={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},w6={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:"var(--doc-z-overlay)",backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},D6={padding:"8px 12px"},R6={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},M6={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},_6={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function I6({forwardedRef:e}){let t=H(),o=Lt.useRef(null);return o.current=t,u0({ref:e,editorRef:o}),null}function N6(...e){let t=e.filter(Boolean).join(" ");return t===""?void 0:t}var L6=Lt.forwardRef(function(t,o){let{document:n,fonts:r,fontShaping:i,className:a,t:l,chrome:s=true,title:c,onTitleChange:d,renderTitleBarLeft:f,renderTitleBarRight:u,renderOpenFailureActions:g,loadingIndicator:p,colorMode:m="light",author:b,locale:h,mode:v="edit",modules:y,zoom:C,zoomMode:T,revisionMarkup:x,onRevisionMarkupChange:E,reviewDisplayMode:P,fieldResults:D,contentLockPolicy:w,lockedControlNavigation:S,onReady:L,onChange:I,onFontError:F,onOpen:O,onSave:k,hyperlinkPopup:_,contextMenu:U=true,menu:z=true,navigation:re=true,openFailure:X=true,rulers:ae=true}=t;!s&&p!==void 0&&Zb(),Vx(X,g!==void 0);let[K,J]=Lt.useState(Hh);Lt.useEffect(()=>{if(m==="system")return Oh(J)},[m]);let B=Ah(m,K),{t:A}=N(),M=Lt.useCallback((ge,Ye)=>l?l(ge,Ye):A(ge,Ye),[l,A]),j=jsxRuntime.jsxs(xs,{className:s?B?"dark":void 0:a,style:s?E6:void 0,children:[s?jsxRuntime.jsx(Sc,{}):null,s?jsxRuntime.jsx(zl,{}):null,jsxRuntime.jsx(gs,{}),ae&&s?jsxRuntime.jsx("div",{style:k6,children:jsxRuntime.jsx(pc,{})}):null,t.children]}),ue=s?jsxRuntime.jsxs("div",{className:`docx-editor${B?" dark":""}${a?` ${a}`:""}`,style:T6,children:[jsxRuntime.jsxs("div",{style:w6,children:[jsxRuntime.jsxs("div",{style:R6,children:[f?.(),jsxRuntime.jsxs("div",{style:M6,children:[d?jsxRuntime.jsx("input",{"aria-label":M("titleBar.documentNameAriaLabel"),value:c??"",placeholder:M("titleBar.untitled"),onChange:ge=>d(ge.target.value),style:_6}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??M("titleBar.untitled")}),z!==false?jsxRuntime.jsx(Ni,{t:M,...c!==void 0?{fileName:c}:{},...O?{onOpen:O}:{},...k?{onSave:k}:{},...typeof z=="object"?z:{}}):null]}),u?.()]}),jsxRuntime.jsx("div",{style:D6,children:jsxRuntime.jsx(Ri,{t:M})})]}),ae?jsxRuntime.jsx("div",{style:S6,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(uc,{})}):null,jsxRuntime.jsx(Ec,{t:M}),jsxRuntime.jsxs("div",{style:P6,children:[re===false?null:jsxRuntime.jsx(xc,{t:M,...typeof re=="object"?re:{}}),j,jsxRuntime.jsx(Cc.Provider,{value:M,children:jsxRuntime.jsx(Tc,{})}),jsxRuntime.jsx(bs,{overlay:true,indicator:p})]})]}):j,de=Lt.useCallback(ge=>M(ge),[M]);return jsxRuntime.jsxs(ri,{popups:ph(t.popups,_,U,M),...n!==void 0?{document:n}:{},...r?{fonts:r}:{},...i?{fontShaping:i}:{},...b!==void 0?{author:b}:{},...h!==void 0?{locale:h}:{},translate:M,mode:v,...y!==void 0?{modules:y}:{},...C!==void 0?{zoom:C}:{},revisionMarkup:x,onRevisionMarkupChange:E,reviewDisplayMode:P,...D!==void 0?{fieldResults:D}:{},...w!==void 0?{contentLockPolicy:w}:{},...S!==void 0?{lockedControlNavigation:S}:{},...T!==void 0?{zoomMode:T}:{},tableInteractionLabel:de,...L?{onReady:L}:{},...I?{onChange:I}:{},...F?{onFontError:F}:{},children:[jsxRuntime.jsx(I6,{forwardedRef:o}),jsxRuntime.jsx(An.Provider,{value:s,children:ue}),X===false?null:jsxRuntime.jsx(Pc,{t:M,...typeof X=="object"?X:{},...g?{actions:g}:{},className:N6(B?"dark":void 0,typeof X=="object"?X.className:void 0)})]})}),F6=Lt.forwardRef(function(t,o){return jsxRuntime.jsx(dr,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(L6,{...t,ref:o})})}),H6=Object.assign(F6,{Root:ri,Viewport:xs,Content:gs,Window:Tp,Toolbar:Ri,Menu:Ni,Loading:bs,ColorByChangeType:Sp,RevisionMarkup:vd,RevisionMarkupDialog:ya,AuthorStyle:kp,HorizontalRuler:uc,VerticalRuler:pc,DocumentOutline:Bm,Navigation:xc,ExportDialog:va,PrintDialog:xa,PageSetupDialog:Kn,WatermarkDialog:zn,BookmarkDialog:ei,ParagraphDialog:Lo,TextFormFieldDialog:Qa,PageNumber:Tc,FontNotice:Ec,OpenFailure:Pc,HeaderFooterChrome:Sc,NotesChrome:zl,Equation:Da,HyperLink:Pa,ContextMenu:mu,ContentControlWidget:ju,InvalidTextFormFieldDialog:wu,ImageAltTextPopup:Xl,ImagePropertiesDialog:Va,NotePropertiesDialog:$l,NotePreview:mr,NotesContextMenu:fr,ContentControl:wa});function Z6(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function Qm(e){return Array.isArray(e)?e:[e]}function q6(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function eC(e){return e!==void 0&&Qm(e).some(t=>editor.isFontResolver(t))}async function K6(e){return typeof e!="function"?await e:await e()}function z6(e,t={}){let[o,n]=Lt.useState(void 0),[r,i]=Lt.useState(void 0),[a,l]=Lt.useState(null),[s,c]=Lt.useState(e!=null),d=eC(t.fonts),f=t.fonts===void 0?"absent":d?"on-demand":"eager",[u,g]=Lt.useState(t.fonts===void 0),p=Lt.useRef(t);p.current=t;let m=Lt.useMemo(()=>editor.defineFontResolver(b=>editor.composeFontOrigins(Qm(p.current.fonts??[]).map(q6),b)),[]);return Lt.useEffect(()=>{let b=p.current.fonts;if(b===void 0){i(void 0),g(true);return}if(eC(b)){g(true);return}g(false);let h=true;return (async()=>{try{let v=await Promise.allSettled(Qm(b).map(K6)),y=[];for(let C of v){if(C.status==="rejected"){console.warn("[fonts] font loading failed for one origin; the others still compose",C.reason);continue}C.value!==void 0&&y.push(C.value);}h&&y.length>0&&i(editor.composeFontConfiguration(y[0],...y.slice(1)));}catch(v){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",v);}finally{h&&g(true);}})(),()=>{h=false;}},[f]),Lt.useEffect(()=>{if(e==null){n(void 0),l(null),c(false);return}let b=Z6(e);if(b){n(b),l(null),c(false);return}let h=true,v=new AbortController;return c(true),l(null),(async()=>{try{let y=await fetch(String(e),{...p.current.fetchOptions,signal:v.signal});if(!y.ok)throw new Error(`could not open the document: ${y.status} ${y.statusText}`);let C=new Uint8Array(await y.arrayBuffer());if(!h)return;n(C),c(!1);}catch(y){if(!h||y instanceof Error&&y.name==="AbortError")return;l(y instanceof Error?y:new Error("could not open the document")),c(false);}})(),()=>{h=false,v.abort();}},[e]),{document:u?o:void 0,fonts:d?m:r,error:a,isLoading:s||!u}}function j6(...e){let t=Lt.useRef(e);return t.current=e,Lt.useMemo(()=>editor.defineFontResolver(o=>editor.composeFontOrigins(t.current,o)),[])}function J6(e){let o=e?.surface?.state?.().selection?.head;return o&&typeof o.paragraphId=="string"&&Number.isFinite(o.offset)?o:null}function Q6(){let e=H(),t=Lt.useRef(null),o=Lt.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),n=Lt.useCallback(()=>{let r=J6(e),i=t.current;return (r===null?i===null:i!==null&&eL(i,r))?i:(t.current=r,r)},[e]);return Lt.useSyncExternalStore(o,n,()=>null)}function eL(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function nL(e){let t=H(),o=Lt.useRef(e);o.current=e;let n=typeof e=="function";Lt.useEffect(()=>{if(!(!t||!n))return t.setCommentDraftChrome({onRequest:()=>o.current?.()})},[t,n]);}var aC=Object.freeze({applied:0,unavailable:0});function iC(e){if(!e)return "";let{color:t,activeColor:o,activeIndex:n,className:r,priority:i}=e;return JSON.stringify([t,o,n,r,i])}function lL(e,t,o){let n=H(),[r,i]=Lt.useState(aC),a=Lt.useRef(null),l=Lt.useRef(o);l.current=o;let s=Lt.useRef(t);s.current=t;let c=iC(o);return Lt.useEffect(()=>{if(!n){i(aC);return}let d=editor.watchHighlights(n,e,s.current,{...l.current,onResult:i});return a.current={watch:d,source:s.current,key:iC(l.current)},i(d.result),()=>{d.stop(),a.current=null;}},[n,e]),Lt.useEffect(()=>{let d=a.current;!d||d.source===t&&d.key===c||(d.source=t,d.key=c,d.watch.update(t,l.current??{}));},[t,c]),r}function mL(e,t){return e===t?true:!e||!t?false:e.name===t.name&&e.index===t.index&&e.range===t.range&&e.active===t.active&&e.rect.left===t.rect.left&&e.rect.top===t.rect.top&&e.rect.width===t.rect.width&&e.rect.height===t.rect.height}function fL(e){let t=H(),o=Pe(),[n,r]=Lt.useState(null);return Lt.useEffect(()=>{if(!t){r(null);return}let i=editor.hostDocumentOf(o),a=editor.hostWindowOf(o),l=0,s=null,c=()=>{l=0;let p=s?t.getHighlightsAt(s.x,s.y).find(m=>e===void 0||m.name===e)??null:null;r(m=>mL(m,p)?m:p);},d=()=>{l===0&&(l=a.requestAnimationFrame(c));},f=p=>{let m=p.target;s=editor.isElementNode(m)&&m.closest("[data-page-index]")!==null?{x:p.clientX,y:p.clientY}:null,d();},u=p=>{p.relatedTarget||(s=null,d());};i.addEventListener("pointermove",f,{passive:true}),i.addEventListener("pointerout",u,{passive:true}),i.addEventListener("scroll",d,{passive:true,capture:true});let g=t.on("change",d);return ()=>{i.removeEventListener("pointermove",f),i.removeEventListener("pointerout",u),i.removeEventListener("scroll",d,{capture:true}),g(),l!==0&&a.cancelAnimationFrame(l);}},[t,e,o]),n}function tf({source:e,scale:t,measurer:o,onStateChange:n,onError:r,className:i,documentFontFamily:a,ref:l}){let s=Lt.useRef(null),c=Lt.useRef(null),[d,f]=Lt.useState(null),u=Lt.useRef(n);u.current=n;let g=Lt.useRef(r);return g.current=r,Lt.useEffect(()=>{let p=s.current;if(!p)return;let m=editor.mountPaginatedSurface(p,e,{...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onChange:h=>{f(h),u.current?.(h);}});if(!m.ok){g.current?.(m.reason,m.detail);return}c.current=m.surface;let b=m.surface.state();return f(b),u.current?.(b),()=>{m.surface.destroy(),c.current=null;}},[e,o]),Lt.useImperativeHandle(l,()=>({focus:()=>c.current?.focus(),type:p=>c.current?.type(p),undo:()=>c.current?.undo(),redo:()=>c.current?.redo(),selectAll:()=>c.current?.selectAll(),navigate:(p,m)=>c.current?.navigate(p,m),toggleRunProperty:(p,m)=>c.current?.toggleRunProperty(p,m),setRunProperty:(p,m)=>c.current?.setRunProperty(p,m),setParagraphProperty:(p,m,b)=>c.current?.setParagraphProperty(p,m,b),formatting:()=>c.current?.formatting()??null,sectionProperties:()=>c.current?.sectionProperties()??null,save:()=>c.current?.save()??null}),[]),jsxRuntime.jsx("div",{ref:s,style:{margin:"24px auto",...a?{fontFamily:a}:{}},className:i?`docx-paginated-surface ${i}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Qi=Lt.createContext(null);function lC(){let e=Lt.useContext(Qi);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function SL(e){return "type"in e&&e.type==="separator"}var dC={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},kL={...dC,background:"var(--doc-bg-hover)"},uC={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},wL={...uC,opacity:.4,cursor:"default"},DL={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},RL={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},ML={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function el({label:e,items:t,disabled:o,showChevron:n=false}){let[r,i]=Lt.useState(false),[a,l]=Lt.useState(null),s=Lt.useRef(null),c=Lt.useRef(null),[d,f]=Lt.useState({top:0,left:0}),u=Lt.useCallback(()=>{i(false),l(null);},[]);Lt.useEffect(()=>{if(!r||!s.current)return;let p=s.current.getBoundingClientRect();f({top:p.bottom+2,left:p.left});},[r]),Lt.useEffect(()=>{if(!r)return;function p(y){let C=y.target;s.current&&!s.current.contains(C)&&c.current&&!c.current.contains(C)&&u();}function m(y){y.key==="Escape"&&u();}function b(){u();}let h=editor.hostDocumentOf(s.current),v=editor.hostWindowOf(s.current);return h.addEventListener("mousedown",p),h.addEventListener("keydown",m),v.addEventListener("scroll",b,true),()=>{h.removeEventListener("mousedown",p),h.removeEventListener("keydown",m),v.removeEventListener("scroll",b,true);}},[r,u]);let g=p=>{p.disabled||p.submenuContent||p.onClick&&(p.onClick(),u());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:s,type:"button",onClick:()=>!o&&i(!r),onMouseDown:p=>p.preventDefault(),disabled:o,style:r?kL:dC,children:[e,n&&jsxRuntime.jsx(V,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:c,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:p=>p.preventDefault(),children:t.map((p,m)=>{if(SL(p))return jsxRuntime.jsx("div",{style:DL},`sep-${m}`);let b=p;if(b.customContent)return jsxRuntime.jsx("div",{onMouseDown:y=>y.preventDefault(),children:b.customContent},b.label);let h=!!b.submenuContent,v=a===b.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>h&&l(b.label),onMouseLeave:()=>h&&l(null),children:[jsxRuntime.jsxs("button",{type:"button",style:b.disabled?wL:uC,onClick:()=>g(b),onMouseDown:y=>y.preventDefault(),onMouseOver:y=>{b.disabled||(y.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent";},disabled:b.disabled,children:[b.icon&&jsxRuntime.jsx(V,{name:b.icon,size:18}),jsxRuntime.jsx("span",{children:b.label}),b.shortcut&&jsxRuntime.jsx("span",{style:RL,children:b.shortcut}),h&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(V,{name:"keyboard_arrow_right",size:16})})]}),h&&v&&jsxRuntime.jsx("div",{style:ML,onMouseDown:y=>y.preventDefault(),children:b.submenuContent(u)})]},b.label)})})]})}var rf=18,IL=2,mC={width:rf,height:rf,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},NL={...mC,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},LL={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function fC({onInsert:e,gridRows:t=6,gridColumns:o=6}){let[n,r]=Lt.useState(0),[i,a]=Lt.useState(0),l=Lt.useCallback(()=>{n>0&&i>0&&e(n,i);},[n,i,e]),s=[];for(let d=1;d<=t;d++)for(let f=1;f<=o;f++){let u=d<=n&&f<=i;s.push(jsxRuntime.jsx("div",{style:u?NL:mC,onMouseEnter:()=>{r(d),a(f);},onClick:l,role:"gridcell","aria-selected":u},`${d}-${f}`));}let c=n>0&&i>0?`${i} \xD7 ${n}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:IL,gridTemplateColumns:`repeat(${o}, ${rf}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:s}),jsxRuntime.jsx("div",{style:LL,children:c})]})}function BL({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(o=>{let n=!o.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:n,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:n?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:n?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{n||(o.onClick?.(),t());},onMouseOver:r=>{n||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(V,{name:o.icon,size:18}),jsxRuntime.jsx("span",{children:o.label})]},o.label)})})}function WL(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Dc({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function ZL(e){return e.replace(/\.docx$/i,"")}function lf({value:e,onChange:t,placeholder:o,editable:n=true}){let{t:r}=N(),i=o??r("titleBar.untitled"),a=ZL(e)??"";return n?jsxRuntime.jsx("input",{type:"text",value:a,onChange:l=>{let s=l.target.value;t?.(s.endsWith(".docx")?s:s+".docx");},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function Rc({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function Mc(){let{t:e}=N(),t=lC(),{disabled:o=false,onFormat:n,onPrint:r,onOpen:i,onSave:a,onPageSetup:l,onInsertImage:s,onInsertTable:c,showTableInsert:d=true,showHelpMenu:f=true,onInsertPageBreak:u,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:p,onInsertTOC:m,onWatermark:b,onRefocusEditor:h}=t,v=Lt.useCallback(x=>{!o&&n&&n(x);},[o,n]),y=Lt.useCallback((x,E)=>{!o&&c&&(c(x,E),editor.hostWindowOf(t.editorRef?.current).requestAnimationFrame(()=>h?.()));},[o,c,h,t.editorRef]),C=!!r||!!l,T=C||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[T&&jsxRuntime.jsx(el,{label:e("toolbar.file"),disabled:o,items:[...i?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:i}]:[],...a?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:a}]:[],...(i||a)&&C?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...l?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:l}]:[]]}),jsxRuntime.jsx(el,{label:e("toolbar.format"),disabled:o,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>v("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>v("setRtl")}]}),jsxRuntime.jsx(el,{label:e("toolbar.insert"),disabled:o,items:[...s?[{icon:"image",label:e("toolbar.image"),onClick:s}]:[],...d&&c?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:x=>jsxRuntime.jsx(fC,{onInsert:(E,P)=>{y(E,P),x();}})}]:[],...s||d&&c?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:x=>jsxRuntime.jsx(BL,{closeMenu:x,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:u},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:p}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:m,disabled:!m},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),f&&jsxRuntime.jsx(el,{label:e("toolbar.help"),disabled:o,items:[{label:e("toolbar.reportIssue"),onClick:()=>_i()}]})]})}function sf({children:e}){let t=null,o=null,n=[],r=[];Lt.Children.forEach(e,a=>{Lt.isValidElement(a)&&(a.type===Dc?t=a:a.type===Rc?o=a:a.type===Mc?r.push(a):n.push(a));});let i=Lt.useCallback(a=>{let l=a.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(WL,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:n}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),o&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:o})]})}var _c={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},$L={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},gC={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function UL(e,t){let o=gC[t]??gC[t.toLowerCase()]??t,r=e?.colorScheme?.[o];return typeof r=="string"&&r?r:_c[o]??"000000"}function hC(e){let t=e.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/.test(t))return t;if(/^[0-9A-F]{3}$/.test(t))return t.split("").map(o=>o+o).join("")}function cf(e,t,o="000000"){if(!e||e.kind==="auto")return `#${o}`;if(e.kind==="hex")return `#${hC(e.value)??o}`;let n=Object.entries(t?.colorScheme??_c).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,n);return `#${r.ok?r.hex:UL(t,e.slot)}`}function Wo(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?hC(e.value):cf(e,t).slice(1)}function bC(e){if(!e||e==="none")return "";let t=$L[e];return t?`#${t}`:""}var VL=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],GL=[{type:"base",keep:1,labelSuffix:""},{type:"tint",keep:.2,labelSuffix:", Lighter 80%"},{type:"tint",keep:.4,labelSuffix:", Lighter 60%"},{type:"tint",keep:.6,labelSuffix:", Lighter 40%"},{type:"shade",keep:.75,labelSuffix:", Darker 25%"},{type:"shade",keep:.5,labelSuffix:", Darker 50%"}];function yC(e){let t=e??_c;return GL.map(o=>VL.map(n=>{let r=t[n.slot]??_c[n.slot]??"000000",a={hex:o.type==="base"?r.toUpperCase():o.type==="tint"?editor.applyThemeTint(r,o.keep):editor.applyThemeShade(r,o.keep),themeSlot:n.slot,label:`${n.name}${o.labelSuffix}`};return o.type==="tint"?a.tint=o.keep:o.type==="shade"&&(a.shade=o.keep),a}))}function pe(...e){return clsx.clsx(e)}var XL=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),tt=Lt__namespace.forwardRef(({className:e,variant:t,size:o,...n},r)=>jsxRuntime.jsx("button",{className:pe(XL({variant:t,size:o,className:e})),ref:r,...n}));tt.displayName="Button";function Kt({content:e,children:t,side:o="bottom",delayMs:n=400}){let[r,i]=Lt__namespace.useState(false),[a,l]=Lt__namespace.useState({x:0,y:0}),s=Lt__namespace.useRef(null),c=Lt__namespace.useRef(null),d=Lt__namespace.useCallback(()=>{let p=editor.hostWindowOf(s.current),m=p.setTimeout(()=>{if(s.current){let b=s.current.getBoundingClientRect(),h=b.left+b.width/2,v=o==="top"?b.top-8:b.bottom+8;l({x:h,y:v});}i(true);},n);c.current={win:p,handle:m};},[n,o]),f=Lt__namespace.useCallback(()=>{c.current&&(c.current.win.clearTimeout(c.current.handle),c.current=null),i(false);},[]);Lt__namespace.useEffect(()=>()=>{c.current&&c.current.win.clearTimeout(c.current.handle);},[]);let u=t.props,g=Lt__namespace.cloneElement(t,{ref:s,onMouseEnter:p=>{d(),u.onMouseEnter?.(p);},onMouseLeave:p=>{f(),u.onMouseLeave?.(p);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:a.x,top:a.y,transform:o==="top"?"translate(-50%, -100%)":o==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var df=Lt__namespace.createContext(null);function mn(e){let[t,o]=Lt__namespace.useState(null),n=Lt__namespace.useMemo(()=>({trigger:t,setTrigger:o}),[t]);return jsxRuntime.jsx(df.Provider,{value:n,children:jsxRuntime.jsx(Le__namespace.Root,{...e})})}var fn=Le__namespace.Group,Ic=Le__namespace.Value;function gn({className:e,children:t,onMouseDown:o,...n}){let r=Lt__namespace.useContext(df)?.setTrigger;return jsxRuntime.jsxs(Le__namespace.Trigger,{ref:r,className:pe("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:i=>{i.preventDefault(),o?.(i);},...n,children:[t,jsxRuntime.jsx(Le__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(iF,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function hn({className:e,children:t,position:o="popper",onCloseAutoFocus:n,onKeyDown:r,...i}){let a=Lt__namespace.useContext(df)?.trigger??null,l=typeof globalThis.document>"u"&&!a?null:editor.hostDocumentOf(a),s=!!l?.querySelector(".docx-editor.dark");return jsxRuntime.jsx(Le__namespace.Portal,{...l?.body?{container:l.body}:{},children:jsxRuntime.jsx("div",{className:pe("docx-editor",s&&"dark"),children:jsxRuntime.jsx(Le__namespace.Content,{className:pe("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:o,onCloseAutoFocus:c=>{c.preventDefault(),n?.(c);},onKeyDown:c=>{r?.(c),c.defaultPrevented||aF(c);},...i,children:jsxRuntime.jsx(Le__namespace.Viewport,{className:pe("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:c=>c.preventDefault(),children:t})})})})}var rF=new Set(["ArrowDown","ArrowUp","Home","End"]);function aF(e){let t=e.currentTarget;if(t.ownerDocument===globalThis.document||!rF.has(e.key))return;e.preventDefault();let o=Array.from(t.querySelectorAll('[role="option"]:not([data-disabled])'));if(o.length===0)return;let n=o.indexOf(t.ownerDocument.activeElement),r=n>=0?n:o.findIndex(a=>a.dataset.state==="checked"),i=e.key==="Home"?0:e.key==="End"?o.length-1:e.key==="ArrowDown"?Math.min(o.length-1,r+1):Math.max(0,r<0?0:r-1);o[i].focus({preventScroll:false});}function tr({className:e,...t}){return jsxRuntime.jsx(Le__namespace.Label,{className:pe("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function zt({className:e,children:t,onMouseDown:o,...n}){return jsxRuntime.jsxs(Le__namespace.Item,{className:pe("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),o?.(r);},...n,children:[jsxRuntime.jsx(Le__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(Le__namespace.ItemIndicator,{children:jsxRuntime.jsx(lF,{className:"h-4 w-4"})})})]})}function or({className:e,...t}){return jsxRuntime.jsx(Le__namespace.Separator,{className:pe("-mx-1 my-1 h-px bg-muted",e),...t})}function iF({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function lF({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function uf(e){let t=e.trim();if(!t)return "";let o=null,n="";for(let r of t){if((r==='"'||r==="'")&&o===null){o=r,n+=r;continue}if(r===o){o=null,n+=r;continue}if(r===","&&o===null)break;n+=r;}return n.trim().replace(/^['"]|['"]$/g,"")}var sF=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function CC({value:e,onChange:t,fonts:o=sF,documentFonts:n,disabled:r=false,className:i,placeholder:a="Arial",width:l=120,showPreview:s=true}){let{t:c}=N(),d=Lt__namespace.useMemo(()=>{if(!n)return [];let m=new Set(o.map(b=>b.name.toLowerCase()));return n.filter(b=>!m.has(b.name.toLowerCase()))},[n,o]),f=Lt__namespace.useMemo(()=>[...d,...o],[d,o]),u=Lt__namespace.useMemo(()=>e?f.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase()||uf(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,f,a]),g=Lt__namespace.useCallback(m=>{let b=f.find(h=>h.name===m);b&&t?.(uf(b.fontFamily)||b.name);},[t,f]),p=Lt__namespace.useMemo(()=>{let m={"sans-serif":[],serif:[],monospace:[],other:[]};return o.forEach(b=>{let h=b.category||"other";m[h].push(b);}),m},[o]);return jsxRuntime.jsxs(mn,{value:u,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(gn,{className:pe("h-8 text-sm",i),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":c("font.selectAriaLabel"),children:jsxRuntime.jsx(Ic,{placeholder:a,children:u})}),jsxRuntime.jsxs(hn,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(fn,{children:[jsxRuntime.jsx(tr,{children:c("font.documentFonts")}),d.map(m=>jsxRuntime.jsx(zt,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},`doc-${m.name}`))]}),jsxRuntime.jsx(or,{})]}),p["sans-serif"].length>0&&jsxRuntime.jsxs(fn,{children:[jsxRuntime.jsx(tr,{children:c("font.sansSerif")}),p["sans-serif"].map(m=>jsxRuntime.jsx(zt,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))]}),p.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(or,{}),jsxRuntime.jsxs(fn,{children:[jsxRuntime.jsx(tr,{children:c("font.serif")}),p.serif.map(m=>jsxRuntime.jsx(zt,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))]})]}),p.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(or,{}),jsxRuntime.jsxs(fn,{children:[jsxRuntime.jsx(tr,{children:c("font.monospace")}),p.monospace.map(m=>jsxRuntime.jsx(zt,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))]})]}),p.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(or,{}),jsxRuntime.jsx(fn,{children:p.other.map(m=>jsxRuntime.jsx(zt,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))})]})]})]})}function pf(e){if(e===void 0)return;let t=e.map(o=>typeof o=="string"?{name:o,fontFamily:o,category:"other"}:o);if(mt()){let o=new Set,n=new Set;for(let r of t)n.has(r.name)&&!o.has(r.name)&&(console.warn(`[DocxEditor] Duplicate font name in fontFamilies: "${r.name}"`),o.add(r.name)),n.add(r.name);}return t}function mF(e,t,o,n,r){let a=Math.max(8,e.innerWidth-n-8),l=Math.max(8,e.innerHeight-r-8);return {top:Math.min(Math.max(8,t),l),left:Math.min(Math.max(8,o),a)}}function kt({isOpen:e,onClose:t,align:o="left"}){let n=Lt.useRef(null),r=Lt.useRef(null),[i,a]=Lt.useState({top:0,left:0});Lt.useEffect(()=>{if(!e||!n.current)return;let c=n.current.getBoundingClientRect();if(o==="right"){let d=editor.hostWindowOf(n.current);d.requestAnimationFrame(()=>{if(r.current){let f=r.current.getBoundingClientRect(),u=mF(d,c.bottom+4,c.right-f.width,f.width,f.height);a(u);}else a({top:c.bottom+4,left:c.left});});}else a({top:c.bottom+4,left:c.left});},[e,o]),Lt.useEffect(()=>{if(!e)return;let c=performance.now()+150,d=m=>{let b=m.target;n.current&&!n.current.contains(b)&&r.current&&!r.current.contains(b)&&t();},f=m=>{m.key==="Escape"&&t();},u=m=>{if(performance.now()<c)return;let b=m.target;b&&r.current&&r.current.contains(b)||editor.isElementNode(b)&&b!==b.ownerDocument.documentElement&&b!==b.ownerDocument.body&&n.current&&b.contains(n.current)||t();},g=editor.hostDocumentOf(n.current),p=editor.hostWindowOf(n.current);return g.addEventListener("mousedown",d),g.addEventListener("keydown",f),p.addEventListener("scroll",u,true),()=>{g.removeEventListener("mousedown",d),g.removeEventListener("keydown",f),p.removeEventListener("scroll",u,true);}},[e,t]);let l=Lt.useCallback(c=>{c.preventDefault(),c.stopPropagation();},[]),s={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:n,dropdownRef:r,dropdownStyle:s,handleMouseDown:l}}var bF=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],yF=1,vF=400;function SC(e,t,o){for(let n of t)if(n>e)return n;return Math.min(e+1,o)}function kC(e,t,o){for(let n=t.length-1;n>=0;n--)if(t[n]<e)return t[n];return Math.max(e-1,o)}function wC({value:e,onChange:t,sizes:o=bF,disabled:n=false,className:r,placeholder:i="11",minSize:a=yF,maxSize:l=vF}){let{t:s}=N(),[c,d]=Lt.useState(false),[f,u]=Lt.useState(""),[g,p]=Lt.useState(false),m=Lt.useRef(null),b=Lt.useCallback(()=>{p(false),d(false);},[]),{containerRef:h,dropdownRef:v,dropdownStyle:y}=kt({isOpen:g,onClose:b}),C=e??(parseInt(i,10)||11),T=e!==void 0?e.toString():i,x=Lt.useCallback(F=>{if(F.preventDefault(),n)return;let O=kC(C,o,a);t?.(O);},[C,o,a,n,t]),E=Lt.useCallback(F=>{if(F.preventDefault(),n)return;let O=SC(C,o,l);t?.(O);},[C,o,l,n,t]),P=Lt.useCallback(F=>{F.preventDefault(),!n&&(d(true),u(T),p(true),editor.hostWindowOf(m.current).requestAnimationFrame(()=>{m.current?.focus(),m.current?.select();}));},[n,T]),D=Lt.useCallback(F=>{u(F.target.value);},[]),w=Lt.useCallback(()=>{d(false);let F=parseFloat(f);if(!isNaN(F)&&F>=a&&F<=l){let O=Math.round(F*2)/2;t?.(O);}},[f,a,l,t]),S=Lt.useCallback(F=>{if(F.key==="Enter")F.preventDefault(),w(),p(false);else if(F.key==="Escape")d(false),p(false);else if(F.key==="ArrowUp"){F.preventDefault();let O=SC(C,o,l);u(O.toString()),t?.(O);}else if(F.key==="ArrowDown"){F.preventDefault();let O=kC(C,o,a);u(O.toString()),t?.(O);}},[w,C,o,l,a,t]),L=Lt.useCallback(F=>{t?.(F),p(false),d(false);},[t]),I=Lt.useCallback(F=>{F.target.tagName!=="INPUT"&&F.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:h,className:pe("flex items-center",r),onMouseDown:I,children:[jsxRuntime.jsx(tt,{variant:"ghost",size:"icon-sm",className:pe("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:x,disabled:n||C<=a,"aria-label":s("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(V,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:c?jsxRuntime.jsx("input",{ref:m,type:"text",value:f,onChange:D,onBlur:w,onKeyDown:S,className:pe("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":s("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:P,className:pe("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",n&&"opacity-50 cursor-not-allowed"),disabled:n,"aria-label":s("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:T})}),g&&jsxRuntime.jsx("div",{ref:v,style:{...y,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":s("fontSize.listLabel"),children:o.map(F=>jsxRuntime.jsx("button",{type:"button",onClick:()=>L(F),className:pe("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",F===C&&"bg-muted font-medium"),role:"option","aria-selected":F===C,children:F},F))}),jsxRuntime.jsx(tt,{variant:"ghost",size:"icon-sm",className:pe("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",n&&"opacity-30 cursor-not-allowed"),onMouseDown:E,disabled:n||C>=l,"aria-label":s("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(V,{name:"add",size:18})})]})}var TF=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],Lc=18,EF=2,PF={position:"relative",display:"inline-block"},SF={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)"},kF={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},gf={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},hf={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},MC={display:"grid",gap:`${EF}px`},Fc={width:`${Lc}px`,height:`${Lc}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},_C={...Fc,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},IC={...Fc,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},wF={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},DF={display:"flex",alignItems:"center",gap:"6px"},RF={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},MF={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},DC={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},_F={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},IF={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},NF={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function bf(e,t,o){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let n=bC(e);return n||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return cf(e,o)}function RC(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let o=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (o*299+n*587+r*114)/1e3>230}function NC(e,t,o){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():Wo(e,o))===t.toUpperCase():false}function LF({matrix:e,selectedColor:t,theme:o,onSelect:n}){let[r,i]=Lt.useState(null);return jsxRuntime.jsx("div",{style:{...MC,gridTemplateColumns:`repeat(10, ${Lc}px)`},children:e.flatMap((a,l)=>a.map((s,c)=>{let d=`${l}-${c}`,f=r===d,u=NC(t,s.hex,o);return jsxRuntime.jsx("button",{type:"button",style:{...u?IC:f?_C:Fc,backgroundColor:`#${s.hex}`},title:s.label,"aria-label":s.label,"aria-selected":u,onClick:()=>n(s),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function FF({selectedColor:e,theme:t,onSelect:o}){let[n,r]=Lt.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...MC,gridTemplateColumns:`repeat(10, ${Lc}px)`},children:TF.map((a,l)=>{let s=n===l,c=NC(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...c?IC:s?_C:Fc,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":c,onClick:()=>o(a.hex),onMouseDown:f=>f.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},a.hex)})})}function ar({mode:e,value:t,onChange:o,theme:n,disabled:r=false,className:i,style:a,title:l,icon:s,autoLabel:c,splitButton:d=true,defaultColor:f}){let[u,g]=Lt.useState(false),[p,m]=Lt.useState(false),[b,h]=Lt.useState(false),[v,y]=Lt.useState(false),[C,T]=Lt.useState(""),[x,E]=Lt.useState(()=>f??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:P}=N();Lt.useEffect(()=>{let A=bf(t,e,n).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(A)&&T(A.toUpperCase());},[t,e,n]);let D=Lt.useCallback(()=>g(false),[]),{containerRef:w,dropdownRef:S,dropdownStyle:L}=kt({isOpen:u,onClose:D}),I=n?.colorScheme??null,F=Lt.useMemo(()=>yC(I),[I]),O=Lt.useMemo(()=>bf(t,e,n),[t,e,n]),k=Lt.useMemo(()=>bf(x,e,n),[x,e,n]),_=Lt.useCallback(()=>{r||g(A=>!A);},[r]),U=Lt.useCallback(A=>{let M;e==="highlight"?M=A.hex:M={kind:"theme",slot:A.themeSlot,...A.tint!==void 0?{tint:A.tint}:{},...A.shade!==void 0?{shade:A.shade}:{}},E(M),o?.(M),g(false);},[e,o]),z=Lt.useCallback(A=>{let M=e==="highlight"?A:{kind:"hex",value:A};E(M),o?.(M),g(false);},[e,o]),re=Lt.useCallback(()=>{o?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,o]),X=Lt.useCallback(()=>{let A=C.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(A)){let M=e==="highlight"?A:{kind:"hex",value:A};E(M),o?.(M),g(false),T("");}},[e,C,o]),ae=Lt.useCallback(()=>{r||o?.(x);},[r,x,o]),K={...SF,...r?{cursor:"default",opacity:.38}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:p?{backgroundColor:"var(--doc-bg-hover)"}:{}},J=P(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),B=s??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:w,className:`docx-color-picker ${i||""}`,style:{...PF,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{..._F,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...IF,...r?{cursor:"default"}:b?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:ae,onMouseDown:A=>A.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:l||J,"aria-label":l||J,children:[jsxRuntime.jsx(V,{name:B,size:18}),jsxRuntime.jsx("div",{style:{...DC,backgroundColor:k==="transparent"?"#fff":k,outline:k==="transparent"||RC(k)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...NF,...r?{cursor:"default"}:u?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:_,onMouseDown:A=>A.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:r,title:l||J,"aria-label":l||J,"aria-haspopup":"true","aria-expanded":u,children:jsxRuntime.jsx(V,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:K,onClick:_,onMouseDown:A=>A.preventDefault(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),disabled:r,title:l||J,"aria-label":l||J,"aria-haspopup":"true","aria-expanded":u,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(V,{name:B,size:18}),jsxRuntime.jsx("div",{style:{...DC,backgroundColor:O==="transparent"?"#fff":O,outline:O==="transparent"||RC(O)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(V,{name:"arrow_drop_down",size:14})]}),u&&jsxRuntime.jsx("div",{ref:S,className:"docx-color-picker-dropdown",style:{...L,...kF},role:"dialog","aria-label":`${J} picker`,onMouseDown:A=>{A.target.tagName!=="INPUT"&&A.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:wF,onClick:re,onMouseDown:A=>A.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),c??P(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:hf}),jsxRuntime.jsx("div",{style:gf,children:P("colorPicker.themeColors")}),jsxRuntime.jsx(LF,{matrix:F,selectedColor:t,theme:n,onSelect:U}),jsxRuntime.jsx("div",{style:hf}),jsxRuntime.jsx("div",{style:gf,children:P("colorPicker.standardColors")}),jsxRuntime.jsx(FF,{selectedColor:t,theme:n,onSelect:z}),jsxRuntime.jsx("div",{style:hf}),jsxRuntime.jsx("div",{style:gf,children:P("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:DF,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:RF,value:C,onChange:A=>T(A.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:A=>{A.key==="Enter"&&X();},onMouseDown:A=>{A.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...MF,opacity:/^[0-9A-Fa-f]{6}$/.test(C)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(C)?"pointer":"default"},onClick:X,onMouseDown:A=>A.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(C),children:P("common.apply")})]})]})})]})}var ol=20,yf=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(V,{name:"format_align_left",size:ol}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(V,{name:"format_align_center",size:ol}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(V,{name:"format_align_right",size:ol}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(V,{name:"format_align_justify",size:ol}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function HC({value:e="left",onChange:t,disabled:o=false}){let{t:n}=N(),[r,i]=Lt.useState(false),a=Lt.useCallback(()=>i(false),[]),{containerRef:l,dropdownRef:s,dropdownStyle:c,handleMouseDown:d}=kt({isOpen:r,onClose:a}),f=Lt.useCallback(h=>{o||t?.(h),i(false);},[o,t]),u=yf.find(h=>h.value===e)||yf[0],g=n(u.labelKey),p=u.shortcutKey?n(u.shortcutKey):void 0,m=`${g}${p?` (${p})`:""}`,b=jsxRuntime.jsxs(tt,{variant:"ghost",size:"icon-sm",className:pe("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",o&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!o&&i(h=>!h),disabled:o,"aria-label":m,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(V,{name:u.iconName,size:ol}),jsxRuntime.jsx(V,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(Kt,{content:m,children:b}),r&&!o&&jsxRuntime.jsx("div",{ref:s,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:h=>h.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:yf.map(h=>{let v=e===h.value,y=n(h.labelKey),C=h.shortcutKey?n(h.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${y}${C?` (${C})`:""}`,"data-testid":`alignment-${h.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:v?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:v?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:T=>T.preventDefault(),onMouseEnter:T=>{v||(T.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=v?"var(--doc-primary-light)":"transparent";},onClick:()=>f(h.value),children:jsxRuntime.jsx(V,{name:h.iconName,size:18})},h.value)})})})]})}function Hc(){return {type:"none",level:0,isInList:false}}var WF={display:"inline-flex",alignItems:"center",gap:"4px"},AC={display:"inline-flex",alignItems:"center",gap:"4px"},Wc={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},ZF={...Wc,backgroundColor:"var(--doc-bg-hover)"},qF={...Wc,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},KF={...Wc,cursor:"default",opacity:.38},zF={width:"28px",height:"28px",padding:"2px"},$F={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Ac=20;function Oc({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,style:a}){let[l,s]=Lt.useState(false),c={...t?KF:e?qF:l?ZF:Wc,...a},d=f=>{f.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:t?void 0:n,onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:o,"aria-label":o,"aria-pressed":e,role:"button",children:r})}function OC({listState:e,onBulletList:t,onNumberedList:o,onIndent:n,onOutdent:r,disabled:i=false,className:a,style:l,showIndentButtons:s=true,compact:c=false,hasIndent:d=false}){let{t:f}=N(),u=Lt.useCallback(()=>c?{...zF}:{},[c]),g=e?.type==="bullet",p=e?.type==="numbered",b=(e?.isInList||g||p)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...WF,...l},role:"group","aria-label":f("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:AC,role:"group","aria-label":f("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Oc,{active:g,disabled:i,title:f("lists.bulletList"),onClick:t,style:u(),children:jsxRuntime.jsx(V,{name:"format_list_bulleted",size:Ac})}),jsxRuntime.jsx(Oc,{active:p,disabled:i,title:f("lists.numberedList"),onClick:o,style:u(),children:jsxRuntime.jsx(V,{name:"format_list_numbered",size:Ac})})]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:$F,role:"separator"}),jsxRuntime.jsxs("div",{style:AC,role:"group","aria-label":f("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Oc,{active:false,disabled:i||!b,title:f("lists.decreaseIndent"),onClick:r,style:u(),children:jsxRuntime.jsx(V,{name:"format_indent_decrease",size:Ac})}),jsxRuntime.jsx(Oc,{active:false,disabled:i,title:f("lists.increaseIndent"),onClick:n,style:u(),children:jsxRuntime.jsx(V,{name:"format_indent_increase",size:Ac})})]})]})]})}var VF=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function WC({value:e,onChange:t,options:o=VF,disabled:n=false,className:r}){let{t:i}=N(),a=Lt__namespace.useMemo(()=>e===void 0?o[0]:o.find(c=>c.twipsValue===e)||o[0],[e,o]),l=Lt__namespace.useCallback(c=>{let d=parseInt(c,10);isNaN(d)||t?.(d);},[t]),s=c=>c.labelKey?i(c.labelKey):c.label;return jsxRuntime.jsxs(mn,{value:a.twipsValue.toString(),onValueChange:l,disabled:n,children:[jsxRuntime.jsx(gn,{className:pe("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:s(a)}),children:jsxRuntime.jsx(Am,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(hn,{children:[o.map(c=>jsxRuntime.jsx(zt,{value:c.twipsValue.toString(),children:s(c)},c.twipsValue)),jsxRuntime.jsx(or,{}),jsxRuntime.jsx(fn,{children:jsxRuntime.jsx(tr,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var ZC=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function qC({value:e,onChange:t,styles:o,disabled:n=false,className:r,width:i=120}){let{t:a}=N(),l=Lt__namespace.useMemo(()=>{let g=Ry(o);return g.length===0?ZC:g.map(p=>({...p,type:"paragraph",nameKey:ZC.find(m=>m.styleId===p.styleId)?.nameKey}))},[o]),s=Lt__namespace.useCallback(g=>{t?.(g);},[t]),c=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",f=l.find(g=>g.styleId===d),u=f?c(f):d;return jsxRuntime.jsxs(mn,{value:d,onValueChange:s,disabled:n,children:[jsxRuntime.jsx(gn,{className:pe("h-8 text-sm",r),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":a("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:u})}),jsxRuntime.jsx(hn,{className:"min-w-[260px] max-h-[400px]",children:l.map(g=>jsxRuntime.jsx(zt,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:Dy(g),children:c(g)})},g.styleId))})]})}var jF=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function zC({value:e=1,onChange:t,levels:o=jF,disabled:n=false,className:r,compact:i=false}){let{t:a}=N(),l=Lt__namespace.useMemo(()=>{let g=o.find(p=>Math.abs(p.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[o,e]),s=Lt__namespace.useCallback(g=>{let p=parseFloat(g);isNaN(p)||t?.(p);},[t]),c=Lt__namespace.useMemo(()=>[...o].sort((g,p)=>g.value-p.value),[o]),d=Lt__namespace.useMemo(()=>[...c].reverse().find(g=>g.value<e-.001),[c,e]),f=Lt__namespace.useMemo(()=>c.find(g=>g.value>e+.001),[c,e]),u=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(tt,{variant:"ghost",size:"icon-sm",className:pe(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(n||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:n||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx(V,{name:"remove",size:18})}),jsxRuntime.jsxs(mn,{value:e.toString(),onValueChange:s,disabled:n,children:[jsxRuntime.jsx(gn,{className:pe(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":a("zoom.ariaLabel",{label:l}),children:jsxRuntime.jsx(Ic,{placeholder:"100%",children:l})}),jsxRuntime.jsx(hn,{children:o.map(g=>jsxRuntime.jsx(zt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(tt,{variant:"ghost",size:"icon-sm",className:pe(u,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(n||!f)&&"opacity-30 cursor-not-allowed"),onClick:()=>f&&t?.(f.value),disabled:n||!f,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(V,{name:"add",size:18})})]})}var XF=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function VC({onAction:e,disabled:t=false}){let{t:o}=N(),[n,r]=Lt.useState(false),i=Lt.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:s,handleMouseDown:c}=kt({isOpen:n,onClose:i}),d=Lt.useCallback(u=>{e(u),r(false);},[e]),f=jsxRuntime.jsxs(tt,{variant:"ghost",size:"icon-sm",className:pe("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&r(u=>!u),disabled:t,"aria-label":o("table.borders.styleAriaLabel"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(V,{name:"border_all",size:20}),jsxRuntime.jsx(V,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?f:jsxRuntime.jsx(Kt,{content:o("table.borders.tooltip"),children:f}),n&&!t&&jsxRuntime.jsx("div",{ref:l,style:{...s,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:u=>u.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:XF.map(({action:u,icon:g,labelKey:p})=>jsxRuntime.jsx("button",{type:"button",title:o(p),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:m=>m.preventDefault(),onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:jsxRuntime.jsx(V,{name:g,size:18})},typeof u=="string"?u:u.type))})})]})}function GC({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Lt.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let l=a.kind==="auto"?"000000":Wo(a,o);l&&e({type:"borderColor",color:l});},[e,o]);return jsxRuntime.jsx(ar,{mode:"border",value:n,onChange:i,theme:o,disabled:t,title:r("table.borderColor")})}var t4=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function YC({onAction:e,disabled:t=false}){let[o,n]=Lt.useState(false),{t:r}=N(),i=Lt.useCallback(()=>n(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:s,handleMouseDown:c}=kt({isOpen:o,onClose:i}),d=Lt.useCallback(u=>{e({type:"borderWidth",size:u}),n(false);},[e]),f=jsxRuntime.jsxs(tt,{variant:"ghost",size:"icon-sm",className:pe("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!t&&n(u=>!u),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(V,{name:"line_weight",size:20}),jsxRuntime.jsx(V,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?f:jsxRuntime.jsx(Kt,{content:r("table.borderWidth"),children:f}),o&&!t&&jsxRuntime.jsx("div",{ref:l,style:{...s,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:u=>u.stopPropagation(),children:t4.map(({size:u,label:g,thickness:p})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:m=>m.preventDefault(),onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(u),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(p,1),backgroundColor:"#000",borderRadius:p>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},u))})]})}function JC({onAction:e,disabled:t=false,theme:o,value:n}){let{t:r}=N(),i=Lt.useCallback(a=>{typeof a=="string"&&e(a==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:a.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(ar,{mode:"highlight",value:n,onChange:i,theme:o,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var n4={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},sr={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},tT={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function oT({onAction:e,disabled:t=false,tableContext:o}){let{t:n}=N(),[r,i]=Lt.useState(false),[a,l]=Lt.useState(null),s=Lt.useCallback(()=>i(false),[]),{containerRef:c,dropdownRef:d,dropdownStyle:f,handleMouseDown:u}=kt({isOpen:r,onClose:s,align:"right"}),g=o?.table?.attrs?.justification??"left",p=Lt.useCallback(h=>{e(h),i(false);},[e]),m=(h,v,y,C,T)=>{let x=t||T?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...n4,backgroundColor:a===h&&!x?"var(--doc-bg-hover)":"transparent",color:x?"var(--doc-text-muted)":T?.danger?"var(--doc-error)":"var(--doc-text)",cursor:x?"not-allowed":"pointer"},onClick:()=>!x&&p(C),onMouseEnter:()=>l(h),onMouseLeave:()=>l(null),disabled:x,children:[jsxRuntime.jsx(V,{name:v,size:16,className:T?.danger&&!x?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:y})]},h)},b=jsxRuntime.jsx(tt,{variant:"ghost",size:"icon-sm",className:pe("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!t&&i(h=>!h),disabled:t,"aria-label":n("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(V,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(Kt,{content:n("table.moreOptions"),children:b}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...f,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:h=>h.stopPropagation(),children:[m("addRowAbove","add",n("table.insertRowAbove"),"addRowAbove"),m("addRowBelow","add",n("table.insertRowBelow"),"addRowBelow"),m("addColumnLeft","add",n("table.insertColumnLeft"),"addColumnLeft"),m("addColumnRight","add",n("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:sr,role:"separator"}),m("mergeCells","call_merge",n("table.mergeCells"),"mergeCells",{itemDisabled:!o?.hasMultiCellSelection}),m("splitCell","call_split",n("table.splitCell"),"splitCell",{itemDisabled:!o?.canSplitCell}),jsxRuntime.jsx("div",{style:sr,role:"separator"}),m("selectTable","select_all",n("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:sr,role:"separator"}),m("deleteRow","delete",n("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(o?.rowCount??0)<=1}),m("deleteColumn","delete",n("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(o?.columnCount??0)<=1}),m("deleteTable","delete",n("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:sr,role:"separator"}),jsxRuntime.jsx("div",{style:tT,children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(h=>{let v={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:n({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[h]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},onClick:()=>p({type:"cellVerticalAlign",align:h}),children:jsxRuntime.jsx(V,{name:v[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:sr,role:"separator"}),jsxRuntime.jsx("div",{style:tT,children:n("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(h=>{let v={left:"format_align_left",center:"format_align_center",right:"format_align_right"},y=g===h;return jsxRuntime.jsx("button",{type:"button",title:n({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[h]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",borderColor:y?"var(--doc-primary)":"var(--doc-border)",color:y?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onClick:()=>p({type:"tableProperties",props:{justification:h}}),children:jsxRuntime.jsx(V,{name:v[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:sr,role:"separator"}),m("headerRow","table_rows",n("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),m("distribute","view_column",n("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),m("autoFit","fit_width",n("tableAdvanced.autoFit"),{type:"autoFitContents"}),m("noWrap","wrap_text",n("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:sr,role:"separator"}),m("properties","settings",n("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var a4=20;function Kc({options:e,activeValue:t,triggerIcon:o,tooltipContent:n,onSelect:r,disabled:i=false,ariaLabel:a,testId:l,showLabels:s=false}){let[c,d]=Lt.useState(false),f=Lt.useCallback(()=>d(false),[]),{containerRef:u,dropdownRef:g,dropdownStyle:p,handleMouseDown:m}=kt({isOpen:c,onClose:f}),b=Lt.useCallback(v=>{i||r(v),d(false);},[i,r]),h=jsxRuntime.jsxs(tt,{variant:"ghost",size:"icon-sm",className:pe("text-muted-foreground hover:text-foreground hover:bg-muted/80",c&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:m,onClick:()=>!i&&d(v=>!v),disabled:i,"aria-label":a??n,"aria-expanded":c,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(V,{name:o,size:a4}),jsxRuntime.jsx(V,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:u,style:{position:"relative",display:"inline-block"},children:[c?h:jsxRuntime.jsx(Kt,{content:n,children:h}),c&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...p,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:s?"column":"row",gap:s?1:2,minWidth:s?200:void 0},children:e.map(v=>{let y=t===v.value;return jsxRuntime.jsxs("button",{type:"button",title:v.label,"data-testid":l?`${l}-${v.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:y?"var(--doc-primary)":"var(--doc-text)",...s?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{y||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=y?"var(--doc-primary-light)":"transparent";},onClick:()=>b(v.value),children:[jsxRuntime.jsx(V,{name:v.iconName,size:18}),s&&jsxRuntime.jsx("span",{style:{flex:1},children:v.label})]},v.value)})})})]})}var i4=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function l4(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function rT({imageContext:e,onChange:t,disabled:o=false}){let{t:n}=N(),r=i4.map(l=>({...l,label:n(l.labelKey)})),i=l4(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(Kc,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:o,testId:"toolbar-image-wrap",showLabels:true})}var c4=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function aT({onTransform:e,disabled:t=false}){let{t:o}=N(),n=c4.map(r=>({...r,label:o(r.labelKey)}));return jsxRuntime.jsx(Kc,{options:n,triggerIcon:"rotate_right",tooltipContent:o("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ao=18;function $t({active:e=false,disabled:t=false,title:o,onClick:n,children:r,className:i,ariaLabel:a}){let l=a?.toLowerCase().replace(/\s+/g,"-")||o?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),s=d=>{d.preventDefault();},c=jsxRuntime.jsx(tt,{variant:"ghost",size:"icon-sm",className:pe("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:s,onClick:t?void 0:n,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||o,"data-testid":l?`toolbar-${l}`:void 0,children:r});return o?jsxRuntime.jsx(Kt,{content:o,children:c}):c}function io({label:e,children:t,className:o}){return jsxRuntime.jsx("div",{className:pe("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",o),role:"group","aria-label":e,children:t})}function f4(e){let t=Lt__namespace.default.useContext(Qi);return t?{...t,...g4(e)}:e}function g4(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function Ef(e){let{t}=N(),o=f4(e),{currentFormatting:n={},onFormat:r,onUndo:i,onRedo:a,canUndo:l=false,canRedo:s=false,disabled:c=false,className:d,style:f,enableShortcuts:u=true,editorRef:g,children:p,showFontPicker:m=true,fontFamilies:b,documentFonts:h,showFontSizePicker:v=true,showTextColorPicker:y=true,showHighlightColorPicker:C=true,showAlignmentButtons:T=true,showListButtons:x=true,showLineSpacingPicker:E=true,showStylePicker:P=true,documentStyles:D,theme:w,showZoomControl:S=true,zoom:L,onZoomChange:I,onRefocusEditor:F,imageContext:O,onImageWrapType:k,onImageTransform:_,onOpenImageProperties:U,tableContext:z,onTableAction:re,inline:X=false}=o,ae=Lt.useRef(null),K=Lt.useCallback(ie=>{!c&&r&&r(ie);},[c,r]),J=Lt.useCallback(()=>{!c&&l&&i&&i();},[c,l,i]),B=Lt.useCallback(()=>{!c&&s&&a&&a();},[c,s,a]),A=Lt.useCallback(ie=>{!c&&r&&r({type:"fontFamily",value:ie});},[c,r]),M=Lt__namespace.default.useMemo(()=>pf(b),[b]),j=Lt.useCallback(ie=>{!c&&r&&r({type:"fontSize",value:ie});},[c,r]),ue=Lt.useCallback(ie=>{!c&&r&&r({type:"textColor",value:ie});},[c,r]),de=Lt.useCallback(ie=>{!c&&r&&r({type:"highlightColor",value:typeof ie=="string"?ie:""});},[c,r]),ge=Lt.useCallback(ie=>{!c&&r&&r({type:"alignment",value:ie});},[c,r]),Ye=Lt.useCallback(()=>{!c&&r&&r("bulletList");},[c,r]),yt=Lt.useCallback(()=>{!c&&r&&r("numberedList");},[c,r]),Dt=Lt.useCallback(()=>{!c&&r&&r("indent");},[c,r]),Me=Lt.useCallback(()=>{!c&&r&&r("outdent");},[c,r]),vt=Lt.useCallback(ie=>{!c&&r&&(r({type:"lineSpacing",value:ie}),editor.hostWindowOf(ae.current).requestAnimationFrame(()=>F?.()));},[c,r,F]),ko=Lt.useCallback(ie=>{!c&&r&&r({type:"applyStyle",value:ie});},[c,r]),wo=Lt.useCallback(ie=>{!c&&re&&(re(ie),editor.hostWindowOf(ae.current).requestAnimationFrame(()=>F?.()));},[c,re,F]);Lt.useEffect(()=>{if(!u)return;let ie=Te=>{if(Te.defaultPrevented)return;let $o=Te.target,so=g?.current,Ht=ae.current,Tn=so?.contains($o),le=Ht?.contains($o);if(!Tn&&!le)return;if((Te.ctrlKey||Te.metaKey)&&!Te.altKey)switch(Te.key.toLowerCase()){case "b":Te.preventDefault(),K("bold");break;case "i":Te.preventDefault(),K("italic");break;case "u":Te.preventDefault(),K("underline");break;case "=":Te.shiftKey?(Te.preventDefault(),K("superscript")):(Te.preventDefault(),K("subscript"));break;case "l":Te.preventDefault(),ge("left");break;case "e":Te.preventDefault(),ge("center");break;case "r":Te.preventDefault(),ge("right");break;case "j":Te.preventDefault(),ge("both");break;case "k":Te.preventDefault(),K("insertLink");break}},ot=editor.hostDocumentOf(g?.current??ae.current);return ot.addEventListener("keydown",ie),()=>{ot.removeEventListener("keydown",ie);}},[u,K,ge,g]);let zo=Lt.useCallback(ie=>{let ot=ie.target;ot.tagName==="INPUT"||ot.tagName==="TEXTAREA"||ot.tagName==="SELECT"||ot.tagName==="OPTION"||ie.preventDefault();},[]),Ut=Lt.useCallback(ie=>{let ot=ie.target,Te=editor.hostDocumentOf(ot).activeElement;ot.tagName==="SELECT"||ot.tagName==="OPTION"||Te?.tagName==="SELECT"||editor.hostWindowOf(ot).requestAnimationFrame(()=>{F?.();});},[F]);return jsxRuntime.jsxs("div",{ref:ae,className:pe(!X&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:X?{display:"contents",...f}:f,role:X?void 0:"toolbar","aria-label":X?void 0:t("toolbar.ariaLabel"),"data-testid":X?void 0:"formatting-bar",onMouseDown:X?void 0:zo,onMouseUp:X?void 0:Ut,children:[jsxRuntime.jsxs(io,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx($t,{onClick:J,disabled:c||!l,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(V,{name:"undo",size:ao})}),jsxRuntime.jsx($t,{onClick:B,disabled:c||!s,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(V,{name:"redo",size:ao})})]}),S&&jsxRuntime.jsx(io,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(zC,{value:L,onChange:I,disabled:c,compact:true})}),P&&jsxRuntime.jsx(io,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(qC,{value:n.styleId||"Normal",onChange:ko,styles:D,theme:w,disabled:c,width:120})}),(m||v)&&jsxRuntime.jsxs(io,{label:t("formattingBar.groups.font"),children:[m&&jsxRuntime.jsx(CC,{value:n.fontFamily||"Arial",onChange:A,fonts:M,documentFonts:h,disabled:c,width:60,placeholder:"Arial"}),v&&jsxRuntime.jsx(wC,{value:n.fontSize!==void 0?Ep(n.fontSize):11,onChange:j,disabled:c,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(io,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx($t,{onClick:()=>K("bold"),active:n.bold,disabled:c,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(V,{name:"format_bold",size:ao})}),jsxRuntime.jsx($t,{onClick:()=>K("italic"),active:n.italic,disabled:c,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(V,{name:"format_italic",size:ao})}),jsxRuntime.jsx($t,{onClick:()=>K("underline"),active:n.underline,disabled:c,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(V,{name:"format_underlined",size:ao})}),jsxRuntime.jsx($t,{onClick:()=>K("strikethrough"),active:n.strike,disabled:c,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(V,{name:"strikethrough_s",size:ao})}),y&&jsxRuntime.jsx(ar,{mode:"text",value:n.color?.replace(/^#/,""),onChange:ue,theme:w,disabled:c,title:t("formattingBar.fontColor")}),C&&jsxRuntime.jsx(ar,{mode:"highlight",value:n.highlight,onChange:de,theme:w,disabled:c,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx($t,{onClick:()=>K("insertLink"),disabled:c,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(V,{name:"link",size:ao})})]}),jsxRuntime.jsxs(io,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx($t,{onClick:()=>K("superscript"),active:n.superscript,disabled:c,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(V,{name:"superscript",size:ao})}),jsxRuntime.jsx($t,{onClick:()=>K("subscript"),active:n.subscript,disabled:c,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(V,{name:"subscript",size:ao})})]}),T&&jsxRuntime.jsx(io,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(HC,{value:n.alignment||"left",onChange:ge,disabled:c})}),(x||E)&&jsxRuntime.jsxs(io,{label:t("formattingBar.groups.listFormatting"),children:[x&&jsxRuntime.jsx(OC,{listState:n.listState||Hc(),onBulletList:Ye,onNumberedList:yt,onIndent:Dt,onOutdent:Me,disabled:c,showIndentButtons:true,compact:true,hasIndent:(n.indentLeft??0)>0}),E&&jsxRuntime.jsx(WC,{value:n.lineSpacing,onChange:vt,disabled:c})]}),O&&k&&jsxRuntime.jsxs(io,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(rT,{imageContext:O,onChange:k,disabled:c}),_&&jsxRuntime.jsx(aT,{onTransform:_,disabled:c}),U&&jsxRuntime.jsx($t,{onClick:U,disabled:c,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(V,{name:"tune",size:ao})})]}),z?.isInTable&&re&&jsxRuntime.jsxs(io,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(VC,{onAction:wo,disabled:c}),jsxRuntime.jsx(GC,{onAction:wo,disabled:c,theme:w,value:Wo(z?.cellBorderColor,w)}),jsxRuntime.jsx(YC,{onAction:wo,disabled:c}),jsxRuntime.jsx(JC,{onAction:wo,disabled:c,theme:w,value:z?.cellBackgroundColor}),jsxRuntime.jsx(oT,{onAction:wo,disabled:c,tableContext:z})]}),jsxRuntime.jsx($t,{onClick:()=>K("clearFormatting"),disabled:c,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(V,{name:"format_clear",size:ao})}),p]})}function h4({children:e,className:t,style:o,...n}){return jsxRuntime.jsx(Qi.Provider,{value:n,children:jsxRuntime.jsx("div",{className:pe("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:ht.toolbar,...o},"data-testid":"editor-toolbar",children:e})})}var wt=h4;wt.TitleBar=sf;wt.Logo=Dc;wt.DocumentName=lf;wt.MenuBar=Mc;wt.TitleBarRight=Rc;wt.Toolbar=Ef;var v4=new Map([["#ffff00","yellow"],["#00ff00","green"],["#00ffff","cyan"],["#ff00ff","magenta"],["#0000ff","blue"],["#ff0000","red"],["#000080","darkBlue"],["#008080","darkCyan"],["#008000","darkGreen"],["#800080","darkMagenta"],["#800000","darkRed"],["#808000","darkYellow"],["#808080","darkGray"],["#c0c0c0","lightGray"],["#ffffff","white"]]),x4=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function C4({source:e,scale:t,measurer:o,documentName:n,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:l,renderTitleBarRight:s,ref:c,colorMode:d,onZoomChange:f,documentFontFamily:u,className:g}){let p=Lt.useRef(null),[m,b]=Lt.useState(null),[h,v]=Lt.useState({}),[y,C]=Lt.useState(null),T=Lt.useCallback(D=>{b(D);let w=p.current?.formatting();w&&v({bold:w.bold,italic:w.italic,underline:w.underline,strike:w.strikethrough,superscript:w.superscript,subscript:w.subscript,...w.fontFamily?{fontFamily:w.fontFamily}:{},...w.fontSizeHalfPoints?{fontSize:w.fontSizeHalfPoints}:{},...w.alignment?{alignment:w.alignment}:{},...w.styleId?{styleId:w.styleId}:{},...w.color?{color:`#${w.color}`}:{},...w.highlight?{highlight:w.highlight}:{}}),C(p.current?.sectionProperties()??null),r?.(D);},[r]),x=Lt.useCallback(D=>{let w=p.current;if(w){if(typeof D=="string")switch(D){case "bold":return w.toggleRunProperty("b");case "italic":return w.toggleRunProperty("i");case "underline":return w.toggleRunProperty("u",{val:"single"});case "strikethrough":return w.toggleRunProperty("strike");case "superscript":return w.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return w.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":w.setRunProperty("b",{val:"0"}),w.setRunProperty("i",{val:"0"}),w.setRunProperty("u",{val:"none"}),w.setRunProperty("strike",{val:"0"}),w.setRunProperty("vertAlign",{val:"baseline"});return;case "setRtl":case "setLtr":return w.setParagraphProperty("bidi",void 0,{paragraphDirection:D==="setRtl"?"rtl":"ltr"});default:return}switch(D.type){case "fontFamily":return w.setRunProperty("rFonts",{ascii:D.value,hAnsi:D.value});case "fontSize":return w.setRunProperty("sz",{val:String(Math.round(D.value*2))});case "textColor":{let S=D.value,L=typeof S=="string"?x4(S):Wo(S,null)??null;return L?w.setRunProperty("color",{val:L}):void 0}case "highlightColor":{let S=D.value.trim().toLowerCase();if(S==="none"||S==="")return w.setRunProperty("highlight",{val:"none"});let L=v4.get(S.startsWith("#")?S:`#${S}`);return L?w.setRunProperty("highlight",{val:L}):void 0}case "alignment":return w.setParagraphProperty("jc",{val:String(D.value)},{physicalAlignment:true});case "lineSpacing":return w.setParagraphProperty("spacing",{line:String(Math.round(D.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return w.setParagraphProperty("pStyle",{val:D.value});default:return}}},[]);Lt.useImperativeHandle(c,()=>p.current,[]);let E=t===void 0?1:t/(96/72),P=y?{pageWidthTwips:y.pageSize.widthTwips,pageHeightTwips:y.pageSize.heightTwips,orientation:y.landscape?"landscape":"portrait",marginsTwips:{top:y.margins.topTwips,right:y.margins.rightTwips,bottom:y.margins.bottomTwips,left:y.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",g??""].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:"var(--doc-bg)",color:"var(--doc-text)"},"data-testid":"paginated-shell",children:[jsxRuntime.jsxs(wt,{currentFormatting:h,onFormat:x,onUndo:()=>p.current?.undo(),onRedo:()=>p.current?.redo(),canUndo:m?.canUndo??false,canRedo:m?.canRedo??false,zoom:E,onZoomChange:f,onSave:()=>{let D=p.current?.save();D&&a?.(D);},children:[jsxRuntime.jsxs(wt.TitleBar,{children:[l&&jsxRuntime.jsx(wt.Logo,{children:l()}),jsxRuntime.jsx(wt.DocumentName,{value:n??"Document",editable:false}),s&&jsxRuntime.jsx(wt.TitleBarRight,{children:s()}),jsxRuntime.jsx(wt.MenuBar,{})]}),jsxRuntime.jsx(wt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[P?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Xn,{pageSetup:P,zoom:E})}):null,jsxRuntime.jsx(tf,{ref:p,source:e,...u?{documentFontFamily:u}:{},...t===void 0?{}:{scale:t},...o?{measurer:o}:{},onStateChange:T,...i?{onError:i}:{}})]})]})}var $c=class{listeners=new Set;snapshot;constructor(t){this.snapshot=t;}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t);});getSnapshot=()=>this.snapshot;setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var Uc=class extends $c{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,o){return this.addNotification(t,"error",o)}showWarning(t,o){return this.addNotification(t,"warning",o)}showInfo(t,o){return this.addNotification(t,"info",o)}dismiss(t){this.notifications=this.notifications.map(n=>n.id===t?{...n,dismissed:true}:n),this.emitSnapshot();let o=globalThis.setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(n=>n.id!==t),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let t of this.timers)globalThis.clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)globalThis.clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,o,n){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:o,details:n,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let a=globalThis.setTimeout(()=>{this.timers.delete(a),this.dismiss(r);},5e3);this.timers.add(a);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var w4=Lt.createContext(null);function uT({children:e}){let t=Lt.useMemo(()=>new Uc,[]),o=Lt.useSyncExternalStore(t.subscribe,t.getSnapshot),n=Lt.useCallback((c,d)=>{t.showError(c,d);},[t]),r=Lt.useCallback((c,d)=>{t.showWarning(c,d);},[t]),i=Lt.useCallback((c,d)=>{t.showInfo(c,d);},[t]),a=Lt.useCallback(c=>{t.dismiss(c);},[t]),l=Lt.useCallback(()=>{t.clearAll();},[t]),s=Lt.useMemo(()=>({notifications:o.notifications,showError:n,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:l}),[o.notifications,n,r,i,a,l]);return jsxRuntime.jsxs(w4.Provider,{value:s,children:[e,jsxRuntime.jsx(D4,{notifications:o.notifications,onDismiss:a})]})}function D4({notifications:e,onDismiss:t}){let o=e.filter(r=>!r.dismissed);return o.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:o.map(r=>jsxRuntime.jsx(R4,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function R4({notification:e,onDismiss:t}){let{t:o}=N(),[n,r]=Lt.useState(false),a=(m=>{switch(m){case "error":return {bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case "info":return {bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(e.severity),l={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"docx-notification-slide-in 0.3s ease-out"},s={display:"flex",alignItems:"flex-start",gap:"8px"},c={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},f={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},u={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},p=m=>{switch(m){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsx("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:l,children:jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("span",{style:c,children:p(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:f,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!n),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:o(n?"errors.hideDetails":"errors.showDetails")}),n&&jsxRuntime.jsx("div",{style:u,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:o("common.dismiss"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})})}var Vc=class extends Lt.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",t,o),this.props.onError&&this.props.onError(t,o);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:o=true}=this.props,{error:n,errorInfo:r}=this.state;return t?typeof t=="function"?t(n,this.resetError):t:jsxRuntime.jsx(M4,{error:n,errorInfo:r,showDetails:o,onReset:this.resetError})}return this.props.children}};function M4({error:e,errorInfo:t,showDetails:o,onReset:n}){let{t:r}=N(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},a={color:"var(--doc-error)",marginBottom:"16px"},l={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},s={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},c={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:i,children:[jsxRuntime.jsx("div",{style:a,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:l,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:s,children:r("errors.errorDescription")}),o&&jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
|
|
3
3
|
|
|
4
|
-
`,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:n,style:d,children:r("errors.tryAgain")})]})}function Vy({onClick:e,topPx:t,scrollLeft:o=0,leftOffset:n=Hr}){let{t:r}=N();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:i=>i.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:n-o,top:t,zIndex:ct.outline},children:jsxRuntime.jsx($,{name:"format_list_bulleted",size:20})})}function pm({currentPage:e,totalPages:t,visible:o}){let{t:n}=N();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:o?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:n("viewer.pageIndicator",{current:e,total:t})})}function A5({i18n:e,isDark:t,onEditorError:o,containerRef:n,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:s,mainContentStyle:l,editorContainerStyle:c,showRuler:d,readOnlyProp:f,showOutline:u,showOutlineButton:g,sidebarOpen:m,minLayoutWidth:p,toolbarHeight:v,editorScrollLeft:y,onScrollContainerMouseDown:x,onEditorBgMouseDown:b,onEditorContextMenu:h,horizontalRulerProps:C,verticalRulerProps:T,outlineProps:S,onToggleOutline:P,scrollPageInfo:k,toolbar:w,pagedArea:E,overlays:D,dialogs:A,fileInputs:_}){let F=d&&!f;return jsxRuntime.jsx(vn.Provider,{value:true,children:jsxRuntime.jsx(Un,{i18n:e,children:jsxRuntime.jsx(zy,{children:jsxRuntime.jsx(sc,{onError:o,children:jsxRuntime.jsxs("div",{ref:n,className:le("docx-editor",t&&"dark",a),style:s,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:l,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[w,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:c,onMouseDown:x,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:ct.ruler,paddingLeft:20,paddingRight:20+(m?352:0),minWidth:p,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(Dn,{...C})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:p},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:b,onContextMenu:h,children:[F&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:ct.ruler,paddingTop:48},children:jsxRuntime.jsx(pi,{...T})}),E]})})]}),k.totalPages>1&&jsxRuntime.jsx(pm,{currentPage:k.currentPage,totalPages:k.totalPages,visible:k.visible}),u&&jsxRuntime.jsx(fi,{...S,leftOffset:mi+(F?Fr:0)}),g&&!u&&jsxRuntime.jsx(Vy,{onClick:P,topPx:v+(d?Sp+8:0)+48,scrollLeft:y,leftOffset:Hr+(F?Fr:0)})]})}),D,A,_]})})})})})}function z5(e){let[t,o]=Et.useState(0);return Et.useEffect(()=>{if(!e)return;let n=()=>o(a=>a+1),r=e.on("change",n),i=e.on("selectionChange",n);return n(),()=>{r(),i();}},[e]),t}function Y5({kind:e}){let t=H(),[o,n]=Et.useState(null),r=Et.useRef(null);Et.useLayoutEffect(()=>{if(!t||!o)return;let a=editor.bindHistoryGroup(t,o,{kind:e});return r.current=a,()=>{a.dispose(),r.current=null;}},[t,o,e]);let i=Et.useCallback(()=>{if(!r.current)throw new Error("history group control is not mounted");return r.current.options()},[]);return {ref:n,options:i}}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return editor.CHROME_GROUPS}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return editor.CHROME_MENUS}});Object.defineProperty(exports,"DEFAULT_FONT",{enumerable:true,get:function(){return editor.DEFAULT_FONT}});Object.defineProperty(exports,"DocumentRefreshError",{enumerable:true,get:function(){return editor.DocumentRefreshError}});Object.defineProperty(exports,"HIGHLIGHT_REFRESH_MS",{enumerable:true,get:function(){return editor.HIGHLIGHT_REFRESH_MS}});Object.defineProperty(exports,"LOADING_SNAPSHOT",{enumerable:true,get:function(){return editor.LOADING_SNAPSHOT}});Object.defineProperty(exports,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"SEARCH_DEBOUNCE_MS",{enumerable:true,get:function(){return editor.SEARCH_DEBOUNCE_MS}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_PRIORITY",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_PRIORITY}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_SET",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_SET}});Object.defineProperty(exports,"SEARCH_MATCH_LIMIT",{enumerable:true,get:function(){return editor.SEARCH_MATCH_LIMIT}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"composeFontOrigins",{enumerable:true,get:function(){return editor.composeFontOrigins}});Object.defineProperty(exports,"createDocumentRefresh",{enumerable:true,get:function(){return editor.createDocumentRefresh}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return editor.defineFontResolver}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return editor.isFontResolver}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=gt;exports.ContextMenuCellVerticalAlignment=bn;exports.ContextMenuCopy=fa;exports.ContextMenuCopyFormatting=al;exports.ContextMenuCut=ma;exports.ContextMenuDelete=ga;exports.ContextMenuDeleteTable=br;exports.ContextMenuDeleteTableColumn=hr;exports.ContextMenuDeleteTableRow=gr;exports.ContextMenuInsertColumnLeft=mr;exports.ContextMenuInsertColumnRight=fr;exports.ContextMenuInsertRowAbove=ur;exports.ContextMenuInsertRowBelow=pr;exports.ContextMenuItem=sl;exports.ContextMenuPaste=cr;exports.ContextMenuPasteFormatting=il;exports.ContextMenuPasteWithoutFormatting=dr;exports.ContextMenuRefreshToc=vr;exports.ContextMenuRefreshTocPageNumbers=yr;exports.ContextMenuSelectAll=ha;exports.DocumentName=Yp;exports.DocumentOutline=fi;exports.DocxEditor=nI;exports.DocxEditorAuthorStyle=yu;exports.DocxEditorColorByChangeType=vu;exports.DocxEditorContent=Ll;exports.DocxEditorContentControl=ta;exports.DocxEditorContentControlWidget=ru;exports.DocxEditorContextMenu=va;exports.DocxEditorDocumentOutline=_p;exports.DocxEditorEquation=oa;exports.DocxEditorExportDialog=Vr;exports.DocxEditorFontNotice=Bs;exports.DocxEditorHeaderFooterChrome=Zs;exports.DocxEditorHorizontalRuler=Rs;exports.DocxEditorHyperLink=Jr;exports.DocxEditorImageAltTextPopup=Cl;exports.DocxEditorImagePropertiesDialog=Ca;exports.DocxEditorInvalidTextFormFieldDialog=Hd;exports.DocxEditorLoading=Hl;exports.DocxEditorLoadingSpinner=bu;exports.DocxEditorMenu=ci;exports.DocxEditorNavigation=Bp;exports.DocxEditorNotePreview=jn;exports.DocxEditorNotePropertiesDialog=gl;exports.DocxEditorNotesChrome=fl;exports.DocxEditorNotesContextMenu=Yn;exports.DocxEditorPageNumber=Os;exports.DocxEditorPageSetupDialog=Sn;exports.DocxEditorParagraphDialog=xo;exports.DocxEditorPrintDialog=Gr;exports.DocxEditorRevisionMarkup=Nc;exports.DocxEditorRevisionMarkupDialog=Ur;exports.DocxEditorRoot=Na;exports.DocxEditorShell=A5;exports.DocxEditorTextFormFieldDialog=Ma;exports.DocxEditorToolbar=ri;exports.DocxEditorVerticalRuler=ks;exports.DocxEditorViewport=Zl;exports.HorizontalRuler=Dn;exports.ImageAltText=xl;exports.ImageInsertProvider=Qi;exports.ImageInsertTrigger=el;exports.ImagePropertiesTrigger=yl;exports.ImageWrap=Yl;exports.LocaleProvider=Un;exports.Logo=Ws;exports.MenuBar=$s;exports.NAVIGATION_PANE_GAP=iv;exports.NAVIGATION_PANE_INSET=Ds;exports.NAVIGATION_PANE_MIN_PAGE_ROOM=Lp;exports.NAVIGATION_PANE_WIDTH=Ar;exports.NavigationClose=xi;exports.NavigationFind=Ei;exports.NavigationHeader=yi;exports.NavigationHeadings=Si;exports.NavigationTab=Pi;exports.NavigationTabs=Ti;exports.NavigationTitle=Ci;exports.NavigationToggle=wi;exports.OUTLINE_BUTTON_LEFT_OFFSET=Hr;exports.OUTLINE_BUTTON_RESERVED_SPACE=O2;exports.OUTLINE_LEFT_OFFSET=mi;exports.OUTLINE_RESERVED_SPACE=H2;exports.PageIndicator=pm;exports.PageNumberTranslationContext=As;exports.PaginatedDocxEditor=$p;exports.PaginatedDocxEditorShell=w5;exports.REVIEW_MARKERS_GUTTER=wr;exports.REVIEW_PANE_GUTTER=La;exports.RULER_WIDTH=Fr;exports.ReviewRailContext=Ct;exports.Slot=G;exports.TitleBar=Xp;exports.TitleBarRight=zs;exports.Toolbar=dm;exports.ToolbarButton=Nt;exports.ToolbarContext=ln;exports.ToolbarGroup=Gt;exports.ToolbarImageProperties=Cr;exports.VERSION=Qy;exports.VerticalRuler=pi;exports.definePopup=FC;exports.editorStateActiveSubscriptionCount=sx;exports.isFieldLink=Yr;exports.navigationPaneOverlays=_s;exports.navigationPaneReservation=Or;exports.navigationShift=Is;exports.normalizeImageBytes=Ji;exports.notificationYieldsToTask=xm;exports.provideDocxEditor=lw;exports.reviewGutter=ph;exports.useChromeTranslate=vm;exports.useContentControl=eo;exports.useContentControlInstance=Ui;exports.useContentControlWidget=Qe;exports.useContextMenuTarget=_f;exports.useDocumentOutline=Ns;exports.useDocumentSearch=Ls;exports.useDocxEditor=H;exports.useDocxSource=uI;exports.useEditorCaret=xI;exports.useEditorCommand=se;exports.useEditorEvent=rp;exports.useEditorSnapshot=z5;exports.useEditorState=B;exports.useEditorValueCommand=Ta;exports.useFontFamily=ts;exports.useFonts=hI;exports.useHeaderFooterState=qp;exports.useHighlightAt=kI;exports.useHighlights=EI;exports.useHistoryGroup=Y5;exports.useHyperlinkPopup=Fc;exports.useHyperlinkPopupInstance=zi;exports.useNavigationPane=Fs;exports.useNavigationShift=an;exports.useNotePropertiesState=Ed;exports.useNoteScopeState=Sd;exports.usePageSetup=Pn;exports.usePageSetupDialog=nE;exports.useParagraphDialog=hE;exports.useParagraphFormat=cu;exports.useParagraphIndent=wp;exports.useParagraphStyle=os;exports.useReviewAuthors=Aa;exports.useReviewGutter=qo;exports.useRevisionMarkupDialog=EC;exports.useScopeClassName=Tt;exports.useScopedChromeAnchor=ya;exports.useTableBorderTargetLabel=ib;exports.useTextFormFieldDialog=KS;exports.useToolbarContext=Ox;exports.useToolbarLabel=Q;exports.useToolbarLabelFor=Oi;exports.useTranslation=N;exports.useZoom=Zu;
|
|
4
|
+
`,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:n,style:d,children:r("errors.tryAgain")})]})}function fT({onClick:e,topPx:t,scrollLeft:o=0,leftOffset:n=la}){let{t:r}=N();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:i=>i.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:n-o,top:t,zIndex:ht.outline},children:jsxRuntime.jsx(V,{name:"format_list_bulleted",size:20})})}function Sf({currentPage:e,totalPages:t,visible:o}){let{t:n}=N();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:o?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:n("viewer.pageIndicator",{current:e,total:t})})}function I4({i18n:e,isDark:t,onEditorError:o,containerRef:n,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:l,mainContentStyle:s,editorContainerStyle:c,showRuler:d,readOnlyProp:f,showOutline:u,showOutlineButton:g,sidebarOpen:p,minLayoutWidth:m,toolbarHeight:b,editorScrollLeft:h,onScrollContainerMouseDown:v,onEditorBgMouseDown:y,onEditorContextMenu:C,horizontalRulerProps:T,verticalRulerProps:x,outlineProps:E,onToggleOutline:P,scrollPageInfo:D,toolbar:w,pagedArea:S,overlays:L,dialogs:I,fileInputs:F}){let O=d&&!f;return jsxRuntime.jsx(An.Provider,{value:true,children:jsxRuntime.jsx(dr,{i18n:e,children:jsxRuntime.jsx(uT,{children:jsxRuntime.jsx(Vc,{onError:o,children:jsxRuntime.jsxs("div",{ref:n,className:pe("docx-editor",t&&"dark",a),style:l,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:s,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[w,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:c,onMouseDown:v,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:ht.ruler,paddingLeft:20,paddingRight:20+(p?352:0),minWidth:m,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(Xn,{...T})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:m},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:y,onContextMenu:C,children:[O&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:ht.ruler,paddingTop:48},children:jsxRuntime.jsx(Hi,{...x})}),S]})})]}),D.totalPages>1&&jsxRuntime.jsx(Sf,{currentPage:D.currentPage,totalPages:D.totalPages,visible:D.visible}),u&&jsxRuntime.jsx(Oi,{...E,leftOffset:Ai+(O?ia:0)}),g&&!u&&jsxRuntime.jsx(fT,{onClick:P,topPx:b+(d?_m+8:0)+48,scrollLeft:h,leftOffset:la+(O?ia:0)})]})}),L,I,F]})})})})})}function B4(e){let[t,o]=Lt.useState(0);return Lt.useEffect(()=>{if(!e)return;let n=()=>o(a=>a+1),r=e.on("change",n),i=e.on("selectionChange",n);return n(),()=>{r(),i();}},[e]),t}function $4({kind:e}){let t=H(),[o,n]=Lt.useState(null),r=Lt.useRef(null);Lt.useLayoutEffect(()=>{if(!t||!o)return;let a=editor.bindHistoryGroup(t,o,{kind:e});return r.current=a,()=>{a.dispose(),r.current=null;}},[t,o,e]);let i=Lt.useCallback(()=>{if(!r.current)throw new Error("history group control is not mounted");return r.current.options()},[]);return {ref:n,options:i}}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return editor.CHROME_GROUPS}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return editor.CHROME_MENUS}});Object.defineProperty(exports,"DEFAULT_FONT",{enumerable:true,get:function(){return editor.DEFAULT_FONT}});Object.defineProperty(exports,"DocumentRefreshError",{enumerable:true,get:function(){return editor.DocumentRefreshError}});Object.defineProperty(exports,"HIGHLIGHT_REFRESH_MS",{enumerable:true,get:function(){return editor.HIGHLIGHT_REFRESH_MS}});Object.defineProperty(exports,"LOADING_SNAPSHOT",{enumerable:true,get:function(){return editor.LOADING_SNAPSHOT}});Object.defineProperty(exports,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"SEARCH_DEBOUNCE_MS",{enumerable:true,get:function(){return editor.SEARCH_DEBOUNCE_MS}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_PRIORITY",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_PRIORITY}});Object.defineProperty(exports,"SEARCH_HIGHLIGHT_SET",{enumerable:true,get:function(){return editor.SEARCH_HIGHLIGHT_SET}});Object.defineProperty(exports,"SEARCH_MATCH_LIMIT",{enumerable:true,get:function(){return editor.SEARCH_MATCH_LIMIT}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"composeFontOrigins",{enumerable:true,get:function(){return editor.composeFontOrigins}});Object.defineProperty(exports,"createDocumentRefresh",{enumerable:true,get:function(){return editor.createDocumentRefresh}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return editor.defineFontResolver}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return editor.isFontResolver}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=Tt;exports.ContextMenuCellVerticalAlignment=Hn;exports.ContextMenuCopy=Wa;exports.ContextMenuCopyFormatting=Fl;exports.ContextMenuCut=Ba;exports.ContextMenuDelete=Za;exports.ContextMenuDeleteTable=Hr;exports.ContextMenuDeleteTableColumn=Fr;exports.ContextMenuDeleteTableRow=Lr;exports.ContextMenuInsertColumnLeft=Ir;exports.ContextMenuInsertColumnRight=Nr;exports.ContextMenuInsertRowAbove=Mr;exports.ContextMenuInsertRowBelow=_r;exports.ContextMenuItem=Ol;exports.ContextMenuPaste=Dr;exports.ContextMenuPasteFormatting=Hl;exports.ContextMenuPasteWithoutFormatting=Rr;exports.ContextMenuRefreshToc=Ar;exports.ContextMenuRefreshTocPageNumbers=Or;exports.ContextMenuSelectAll=qa;exports.DEFAULT_WATERMARK_PRESETS=np;exports.DocumentName=lf;exports.DocumentOutline=Oi;exports.DocxEditor=H6;exports.DocxEditorAuthorStyle=kp;exports.DocxEditorBookmarkDialog=ei;exports.DocxEditorColorByChangeType=Sp;exports.DocxEditorContent=gs;exports.DocxEditorContentControl=wa;exports.DocxEditorContentControlWidget=ju;exports.DocxEditorContextMenu=za;exports.DocxEditorDocumentOutline=Bm;exports.DocxEditorEquation=Da;exports.DocxEditorExportDialog=va;exports.DocxEditorFontNotice=Ec;exports.DocxEditorHeaderFooterChrome=Sc;exports.DocxEditorHorizontalRuler=uc;exports.DocxEditorHyperLink=Pa;exports.DocxEditorImageAltTextPopup=Xl;exports.DocxEditorImageInsertErrorDialog=Vd;exports.DocxEditorImagePropertiesDialog=Va;exports.DocxEditorInvalidTextFormFieldDialog=wu;exports.DocxEditorLoading=bs;exports.DocxEditorLoadingSpinner=Pp;exports.DocxEditorMenu=Ni;exports.DocxEditorNavigation=Vm;exports.DocxEditorNotePreview=mr;exports.DocxEditorNotePropertiesDialog=$l;exports.DocxEditorNotesChrome=zl;exports.DocxEditorNotesContextMenu=fr;exports.DocxEditorOpenFailure=Pc;exports.DocxEditorOpenFailureAction=jm;exports.DocxEditorPageNumber=Tc;exports.DocxEditorPageSetupDialog=Kn;exports.DocxEditorParagraphDialog=Lo;exports.DocxEditorPrintDialog=xa;exports.DocxEditorRevisionMarkup=vd;exports.DocxEditorRevisionMarkupDialog=ya;exports.DocxEditorRoot=ri;exports.DocxEditorShell=I4;exports.DocxEditorTextFormFieldDialog=Qa;exports.DocxEditorToolbar=Ri;exports.DocxEditorVerticalRuler=pc;exports.DocxEditorViewport=xs;exports.DocxEditorWatermarkDialog=zn;exports.DocxEditorWindow=Tp;exports.HorizontalRuler=Xn;exports.ImageAltText=Yl;exports.ImageInsertProvider=kl;exports.ImageInsertTrigger=wl;exports.ImagePropertiesTrigger=jl;exports.ImageWrap=Ms;exports.LocaleProvider=dr;exports.Logo=Dc;exports.MenuBar=Mc;exports.NAVIGATION_PANE_GAP=px;exports.NAVIGATION_PANE_INSET=fc;exports.NAVIGATION_PANE_MIN_PAGE_ROOM=Zm;exports.NAVIGATION_PANE_WIDTH=ca;exports.NavigationClose=zi;exports.NavigationFind=ji;exports.NavigationGoTo=Bi;exports.NavigationHeader=Ki;exports.NavigationHeadings=Gi;exports.NavigationTab=Vi;exports.NavigationTabs=Ui;exports.NavigationTitle=$i;exports.NavigationToggle=Yi;exports.OUTLINE_BUTTON_LEFT_OFFSET=la;exports.OUTLINE_BUTTON_RESERVED_SPACE=HN;exports.OUTLINE_LEFT_OFFSET=Ai;exports.OUTLINE_RESERVED_SPACE=LN;exports.PageIndicator=Sf;exports.PageNumberTranslationContext=Cc;exports.PaginatedDocxEditor=tf;exports.PaginatedDocxEditorShell=C4;exports.REVIEW_MARKERS_GUTTER=Yr;exports.REVIEW_PANE_GUTTER=ai;exports.RULER_WIDTH=ia;exports.ReviewRailContext=Rt;exports.Slot=Y;exports.TitleBar=sf;exports.TitleBarRight=Rc;exports.Toolbar=Ef;exports.ToolbarButton=$t;exports.ToolbarContext=kn;exports.ToolbarGroup=io;exports.ToolbarImageProperties=Wr;exports.VERSION=bT;exports.VerticalRuler=Hi;exports.definePopup=rP;exports.editorStateActiveSubscriptionCount=kT;exports.isFieldLink=Ta;exports.navigationPaneOverlays=hc;exports.navigationPaneReservation=da;exports.navigationShift=gc;exports.normalizeImageBytes=Pl;exports.notificationYieldsToTask=Lf;exports.provideDocxEditor=FR;exports.reviewGutter=i0;exports.useBookmarkDialog=ND;exports.useBookmarks=gp;exports.useChromeTranslate=_f;exports.useCommentDraftRequest=nL;exports.useContentControl=fo;exports.useContentControlInstance=yl;exports.useContentControlWidget=at;exports.useContextMenuTarget=Gg;exports.useDocumentOutline=bc;exports.useDocumentSearch=yc;exports.useDocxEditor=H;exports.useDocxSource=z6;exports.useEditorCaret=Q6;exports.useEditorCommand=ce;exports.useEditorEvent=dm;exports.useEditorHostDocument=Tm;exports.useEditorSnapshot=B4;exports.useEditorState=W;exports.useEditorValueCommand=Ga;exports.useFontFamily=Hs;exports.useFonts=j6;exports.useGoToBookmark=mc;exports.useHeaderFooterState=Xm;exports.useHighlightAt=fL;exports.useHighlights=lL;exports.useHistoryGroup=$4;exports.useHyperlinkPopup=Ed;exports.useHyperlinkPopupInstance=hl;exports.useNavigationPane=vc;exports.useNavigationShift=Sn;exports.useNotePropertiesState=gu;exports.useNoteScopeState=fu;exports.useOpenFailure=$x;exports.usePageSetup=qn;exports.usePageSetupDialog=Yw;exports.useParagraphDialog=cD;exports.useParagraphFormat=ep;exports.useParagraphIndent=Nm;exports.useParagraphStyle=As;exports.useReviewAuthors=si;exports.useReviewGutter=an;exports.useRevisionMarkupDialog=GE;exports.useScopeClassName=Mt;exports.useScopedChromeAnchor=$a;exports.useTableBorderTargetLabel=lv;exports.useTextFormFieldDialog=Lw;exports.useToolbarContext=aE;exports.useToolbarLabel=te;exports.useToolbarLabelFor=dl;exports.useTranslation=N;exports.useWatermark=up;exports.useWatermarkDialog=Eb;exports.useZoom=Vp;
|