@docx-editor.dev/react 2.5.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- 'use strict';var Ye=require('react'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),pe=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 Ye__namespace=/*#__PURE__*/_interopNamespace(Ye);var pe__namespace=/*#__PURE__*/_interopNamespace(pe);var zf=Object.defineProperty;var Vf=(e,t,n)=>t in e?zf(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var nt=(e,t,n)=>Vf(e,typeof t!="symbol"?t+"":t,n);var mc="(prefers-color-scheme: dark)";function fc(){return typeof window<"u"&&typeof window.matchMedia=="function"}function gc(){return fc()?window.matchMedia(mc).matches:false}function bc(e,t){return e==="dark"||e==="system"&&t}function hc(e){if(!fc())return ()=>{};let t=window.matchMedia(mc);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var ki=Ye.createContext(null);function A(){return Ye.useContext(ki)}var St=Ye.createContext(null);var Ii=Ye.createContext(i18n.en),Ri=Ye.createContext("en");function wo({i18n:e,children:t}){let n=Ye.useContext(Ii),o=Ye.useContext(Ri),r=typeof e?._lang=="string"?e._lang:o,a=Ye.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Ri.Provider,{value:r,children:jsxRuntime.jsx(Ii.Provider,{value:a,children:t})})}function _(){let e=Ye.useContext(Ii),t=Ye.useContext(Ri);return {t:Ye.useMemo(()=>i18n.createT(e,t),[e,t])}}function Sc(e){let{t}=_();return Ye.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var sn=Object.freeze({scope:Object.freeze({kind:"body"}),isLoading:true,isOpening:false,parseError:null,editable:false,zoom:1,selection:null,selectionCollapsed:true,formatting:null,table:null,tocContext:null,image:null,page:Object.freeze({current:0,total:0}),canUndo:false,canRedo:false});var Qf=()=>{};function Jf(e){let t=false;return ()=>{if(t)return;t=true;let n=globalThis.navigator?.scheduling,o=()=>{t=false,e();};n?.isInputPending?.({includeContinuous:true})?setTimeout(o,0):queueMicrotask(o);}}function q(e,t=Object.is,n){let o=A(),r=n?.onSubscribe,a=n?.onUnsubscribe,i=Ye.useCallback(d=>{if(!o)return Qf;let p=false;r?.();let g=Jf(()=>{p||d();}),m=[o.on("change",g),o.on("selectionChange",g),o.on("error",g)];return ()=>{p=true,a?.();for(let f of m)f();}},[o,r,a]),s=Ye.useMemo(()=>{let d=false,p,g;return m=>{if(d&&m===p)return g;let f=e(m);return d&&t(g,f)?(p=m,g):(d=true,p=m,g=f,f)}},[o,e,t]),c=Ye.useCallback(()=>s(o?o.snapshot():sn),[o,s]),l=Ye.useCallback(()=>s(sn),[s]);return Ye.useSyncExternalStore(i,c,l)}var Ec=12700,Pc=96;function n0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function r0(e,t,n,o){let r=e*72/n,a=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(a*100)/100)}}function Ir(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 n=editor.sniffImageMime(e);if(!n0(n))return n==="image/svg+xml"||n==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let o=editor.validateRasterHeader(e,n);if(!o)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(o.pixelWidth*o.pixelHeight>t.maxPixels||o.pixelWidth>t.maxDimension||o.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:a,heightPoints:i}=r0(o.pixelWidth,o.pixelHeight,Pc,Pc);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:a,heightPoints:i})}function It(e){return Math.round(e/Ec*100)/100}function cn(e){return Math.round(e*Ec)}var dn=Ye.createContext({t:void 0,onSave:void 0});function Ni(e){let{t}=_();return n=>e?.(n)??t(n)}function Y(){let{t:e}=Ye.useContext(dn);return Ni(e)}function u0(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function Di(e){return typeof e=="string"}function p0(e){return JSON.stringify(e,Object.keys(e).sort())}function ne(e){let t=A(),n=Di(e)?e:p0(e),o=Ye.useRef(e);o.current=e;let r=Ye.useCallback(s=>{let c=o.current;if(Di(c)){let d=editor.toolbarCommandState(t,c);return {active:d.active,enabled:d.enabled,disabledReason:d.disabledReason}}if(!t)return {active:false,enabled:false,disabledReason:null};let l=t.can(c);return {active:t.isActive(c),enabled:l.ok,disabledReason:l.ok?null:l.reason??null}},[t,n]),a=q(r,u0),i=Ye.useCallback(()=>{let s=o.current;return Di(s)?editor.runToolbarCommand(t,s).ok:t?t.exec(s).ok:false},[t,n]);return Ye.useMemo(()=>({execute:i,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason}),[i,a])}function b0(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function h0(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=b0(t[o],e[o]):o==="className"?n[o]=[e[o],t[o]].filter(Boolean).join(" "):o==="style"&&(n[o]={...e[o],...t[o]});return n}function W({children:e,...t}){let n=Ye.Children.only(e);if(!Ye.isValidElement(n))return null;let o=n.props,r=h0(t,o),a=n.ref,i=t.ref;return (a||i)&&(r.ref=s=>{for(let c of [a,i])typeof c=="function"?c(s):c&&typeof c=="object"&&(c.current=s);}),Ye.cloneElement(n,r)}function ee(e){for(let t of editor.CHROME_GROUPS)for(let n of t.controls)if(editor.chromeSlotId(t,n)===e)return n;return null}function te(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 O(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Xt(e){let{slot:t,icon:n,asChild:o,className:r,children:a,hidden:i}=e,{execute:s,isActive:c,isEnabled:l,disabledReason:d}=ne(t),p=Y();if(i)return null;let g=ee(t),m=p(g?.labelKey??t),f=editor.commandForSlot(t),u=f?.type==="toggleMark"||f?.type==="setAlignment",h={onClick:()=>s(),onMouseDown:O,disabled:!l,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...l?{}:{"data-disabled":""},...u?{"aria-pressed":c}:{},"aria-label":m,title:d??m};return o?jsxRuntime.jsx(W,{...h,children:a}):jsxRuntime.jsx("button",{type:"button",...h,children:n??a??te(g?.paths)})}Xt.docxToolbarPart=true;var E0="image/png,image/jpeg,image/gif",Hi=Ye.createContext(null);function _r(){let e=Ye.useContext(Hi);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function Fi(){return Ye.useContext(Hi)}function Nr({children:e}){let t=A(),{t:n}=_(),o=Ye.useRef(null),r=Ye.useRef(false),a=Ye.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),i=q(a,(u,h)=>u.enabled===h.enabled&&u.disabledReason===h.disabledReason),s=i.enabled,c=i.disabledReason,l=Ye.useCallback(async u=>{if(!t||r.current)return;let h=Ir(u);if(!h.ok){window.alert(n(h.reasonKey));return}let b={type:"insertImage",data:h.bytes,mime:h.mime,widthPoints:h.widthPoints,heightPoints:h.heightPoints},v=t.canExecuteImageCommand?.(b);if(v&&!v.ok){window.alert(v.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let C=await editor.executeImageCommand(t,b);C.ok?t.focus():window.alert(C.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=Ye.useCallback(async u=>{let h=u?.[0];if(!h)return;let b=await h.arrayBuffer();await l(new Uint8Array(b));},[l]),p=Ye.useCallback(async u=>{if(!u)return;let h=[...u.files].find(b=>b.type.startsWith("image/"));if(h){await d([h]);return}for(let b of u.items){if(b.kind!=="file"||!b.type.startsWith("image/"))continue;let v=b.getAsFile();if(!v)continue;let C=await v.arrayBuffer();await l(new Uint8Array(C));return}},[l,d]),g=Ye.useCallback(()=>{s&&o.current?.click();},[s]),m=Ye.useCallback(async u=>{let h=u.currentTarget;await d(h.files),h.value="";},[d]),f=Ye.useMemo(()=>({openFilePicker:g,insertFromFileList:d,insertFromDataTransfer:p,isEnabled:s,disabledReason:c,inputRef:o,onInputChange:m}),[g,d,p,s,c,m]);return jsxRuntime.jsxs(Hi.Provider,{value:f,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:E0,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:m,onMouseDown:u=>u.stopPropagation()}),e]})}function Dr({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:a,disabledReason:i}=_r(),s=Y();if(t)return null;let c=ee("image.insert"),l=s(c?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":l,title:i??l,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx(W,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??te(c?.paths)})}Dr.docxSlot="image.insert";var un=Object.assign(Dr,{docxSlot:"image.insert"});var A0=["nw","n","ne","e","se","s","sw","w"],Dc=40,Lc=12;function O0(e){return `imageOverlay.handle.${e}`}function Z0(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 B0(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 q0(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 Ai({containerRef:e,portalRef:t,scrollPort:n}){let o=A(),{t:r}=_(),[a,i]=Ye.useState(null),[s,c]=Ye.useState(null),l=Ye.useRef(null);l.current=s;let d=Ye.useRef(null),p=Ye.useRef(null),g=Ye.useRef(null),m=Ye.useRef(null),f=Ye.useRef(null);Ye.useEffect(()=>{let S=e.current;if(!S)return;let y=x=>{let E=(x.target instanceof Element?x.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");m.current=E??null,E&&E===a?.id&&queueMicrotask(()=>g.current?.focus({preventScroll:true}));};return S.addEventListener("pointerdown",y,{capture:true}),()=>S.removeEventListener("pointerdown",y,{capture:true})},[e,a?.id]),Ye.useEffect(()=>{if(!o){i(null);return}let S=()=>{i(editor.selectedDrawingOverlayTargetOf(o.surface));},y=()=>{queueMicrotask(S);};S();let x=[o.on("change",y),o.on("selectionChange",S)];return ()=>{for(let M of x)M();}},[o]),Ye.useEffect(()=>{if(n){f.current=n;return}let S=e.current;if(!S||!o?.surface)return;let y=S.closest(".docx-editor__scroll-container");if(!y)return;let x=o.surface.overlayCoordinates();return f.current=editor.createImageOverlayScrollPort(y,x.paintScale),()=>{f.current=null;}},[e,o,n]);let u=Ye.useCallback(()=>{c(null),d.current=null;let S=p.current;if(p.current=null,S)try{S.releasePointerCapture(S._lastPointerId??0);}catch{}},[]),h=Ye.useCallback((S,y,x,M,E,w,N)=>{if(!o?.surface)return;let F=editor.captureImageMutationPreconditions(o);if(!F)return;let H=o.surface.publishedLayout();d.current=Object.freeze({x:M,y:E}),p.current=w,w._lastPointerId=N;try{w.setPointerCapture(N);}catch{}c({session:Object.freeze({drawingNodeId:x.id,startBounds:Object.freeze({x:x.x,y:x.y,width:x.width,height:x.height}),startWidthEmu:x.widthEmu,startHeightEmu:x.heightEmu,startPosition:x.position,anchorFrameOrigin:x.anchorFrameOrigin,transform:x.transform,mode:S,handle:y,preconditions:F,layoutRevision:H.revision,packageRevision:o.surface.session.packageRevision(),kind:x.kind}),bounds:x,accumulatedScrollPt:0}),g.current?.focus({preventScroll:true});},[o]),b=Ye.useCallback((S,y,x,M,E)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,S)){u();return}S.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:y,heightEmu:x,...E?.mode==="simple"?{horizontalEmu:E.horizontalEmu,verticalEmu:E.verticalEmu}:{},...E?.mode==="frame"?{...E.horizontalEmu!==void 0?{horizontalEmu:E.horizontalEmu}:{},...E.verticalEmu!==void 0?{verticalEmu:E.verticalEmu}:{}}:{}}):S.mode==="move"&&E&&o.exec({type:"setImagePosition",...E}),u();},[u,o]),v=Ye.useCallback(S=>{if(!o)return;let y=l.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!y)return;if(l.current&&S.key==="Escape"){S.preventDefault(),S.stopPropagation(),u();return}if(l.current)return;let x=S.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(S.key==="Delete"||S.key==="Backspace"){S.preventDefault(),S.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(S.key))return;S.preventDefault(),S.stopPropagation();let M=S.key==="ArrowLeft"?-x:S.key==="ArrowRight"?x:0,E=S.key==="ArrowUp"?-x:S.key==="ArrowDown"?x:0;if(S.altKey){if(!y.canResize)return;let N=q0(M,E),F=editor.computeImageResizeResult({handle:N,startWidthEmu:y.widthEmu,startHeightEmu:y.heightEmu,startBounds:{x:y.x,y:y.y,width:y.width,height:y.height},startPosition:y.position,anchorFrameOrigin:y.anchorFrameOrigin,deltaXPt:M,deltaYPt:E,transform:y.transform,preserveAspect:editor.resizePreservesAspect(N,y.aspectLocked,S.shiftKey),kind:y.kind});o.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(y.kind!=="anchored"||!y.canMove||!y.position)return;let w=editor.computeMovedImagePosition(y.position,M,E);o.exec({type:"setImagePosition",...w});},[u,o]);Ye.useEffect(()=>{if(!s||!o?.surface)return;let S=o.surface.overlayCoordinates(),y=M=>{let E=l.current,w=d.current;if(!E||!w)return;let N=editor.cssPixelsToLayoutPoints(M.clientX-w.x,S.paintScale),F=editor.cssPixelsToLayoutPoints(M.clientY-w.y,S.paintScale);if(E.session.mode==="move"){let I=0,D=f.current,k=e.current?.closest(".docx-editor__scroll-container");if(D&&k){let z=k.getBoundingClientRect();M.clientY>z.bottom-Dc?I=Lc:M.clientY<z.top+Dc&&(I=-Lc),I!==0&&(I=D.scrollBy(I));}let R=E.accumulatedScrollPt+I;c({...E,accumulatedScrollPt:R,bounds:Object.freeze({...E.bounds,x:E.session.startBounds.x+N,y:E.session.startBounds.y+F+R})});return}if(!E.session.handle)return;let H=editor.computeImageResizeResult({handle:E.session.handle,startWidthEmu:E.session.startWidthEmu,startHeightEmu:E.session.startHeightEmu,startBounds:E.session.startBounds,startPosition:E.session.startPosition,anchorFrameOrigin:E.session.anchorFrameOrigin,deltaXPt:N,deltaYPt:F,transform:E.session.transform,preserveAspect:editor.resizePreservesAspect(E.session.handle,E.bounds.aspectLocked,M.shiftKey),kind:E.session.kind});c({...E,bounds:Object.freeze({...E.bounds,x:H.previewBounds.x,y:H.previewBounds.y,width:H.previewBounds.width,height:H.previewBounds.height,widthEmu:H.widthEmu,heightEmu:H.heightEmu})});},x=M=>{let E=l.current;if(E)if(M.type==="pointerup"){let w=editor.cssPixelsToLayoutPoints(M.clientX-(d.current?.x??M.clientX),S.paintScale),N=editor.cssPixelsToLayoutPoints(M.clientY-(d.current?.y??M.clientY),S.paintScale),F=editor.finalizeImageOverlayInteraction({session:E.session,deltaXPt:w,deltaYPt:N,accumulatedScrollPt:E.accumulatedScrollPt,aspectLocked:E.bounds.aspectLocked,shiftKey:M.shiftKey,anchorFrameOrigin:E.session.anchorFrameOrigin});b(E.session,F.widthEmu,F.heightEmu,F.previewBounds,F.position);}else u();};return window.addEventListener("pointermove",y),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x),()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x);}},[u,b,e,o,s]),Ye.useEffect(()=>{!a||m.current!==a.id||(m.current=null,g.current?.focus({preventScroll:true}));},[a]);let C=s?.bounds??a,P=Ye.useMemo(()=>{if(!o?.surface||!C)return null;let S=o.surface.publishedLayout(),y=o.surface.overlayCoordinates(),x=editor.overlayFrameToSheetCssPixels(S,{pageIndex:C.pageIndex,x:C.x,y:C.y,width:C.width,height:C.height},y),M=C.canResize,E=C.kind==="anchored"&&C.canMove;return jsxRuntime.jsxs("div",{ref:g,className:"docx-image-selection-overlay docx-editor-one-surface__overlay-control","data-drawing-node-id":C.id,tabIndex:0,onKeyDown:v,children:[jsxRuntime.jsx("div",{className:"docx-image-selection-overlay__frame",role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${x.left}px`,top:`${x.top}px`,width:`${x.width}px`,height:`${x.height}px`,cursor:E?"move":"default"},onPointerDown:w=>{O(w),!(!E||!C.position)&&w.button===0&&(w.preventDefault(),w.stopPropagation(),h("move",null,C,w.clientX,w.clientY,w.currentTarget,w.pointerId));}}),M?A0.map(w=>{let N=B0(w);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(O0(w)),tabIndex:0,style:{left:`calc(${x.left}px + ${x.width}px * ${parseFloat(N.x)/100} - 5px)`,top:`calc(${x.top}px + ${x.height}px * ${parseFloat(N.y)/100} - 5px)`,cursor:Z0(w)},onPointerDown:F=>{O(F),F.button===0&&(F.preventDefault(),F.stopPropagation(),h("resize",w,C,F.clientX,F.clientY,F.currentTarget,F.pointerId));}},w)}):null]})},[C,h,o,v,r]);return !P||!t.current?null:reactDom.createPortal(P,t.current)}function Fr({className:e}){let t=A(),n=Fi(),o=Ye.useRef(null),r=Ye.useRef(null);Ye.useLayoutEffect(()=>{let s=o.current;if(!(!t||!s))return t.attach(s),()=>{t.detach();}},[t]);let a=Ye.useCallback(s=>{if(!n?.isEnabled)return;let c=s.clipboardData;!c||![...c.items].some(d=>d.kind==="file"&&d.type.startsWith("image/"))||(s.preventDefault(),n.insertFromDataTransfer(c));},[n]),i=Ye.useCallback(s=>{!n?.isEnabled||![...s.dataTransfer.items].some(l=>l.kind==="file"&&l.type.startsWith("image/"))||(s.preventDefault(),n.insertFromDataTransfer(s.dataTransfer));},[n]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:o,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:a,onDrop:i}),t?jsxRuntime.jsx(Ai,{containerRef:o,portalRef:r}):null]})}var $0=e=>e.isLoading||e.isOpening===true;function Oi({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function W0({when:e=false,overlay:t=false,className:n,style:o,children:r}){let a=q($0),{t:i}=_();if(!e&&!a)return null;let s=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:s,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Oi,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:i("loading.label")})]})})}var Or=Object.assign(W0,{Spinner:Oi});function Zr(e){return e.paragraphId===""}var jt=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),eg=e=>e;function tg(){let e=n=>!!n&&(n.width>0||n.height>0);if(typeof document<"u"){let o=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0),o=n.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom};let r=n.startContainer,i=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(i))return {left:i.left,top:i.bottom}}return null}var mn=Ye.createContext(null);function Bi(){let e=Ye.useContext(mn),t=Br(e===null);return e??t}function Br(e=true){let t=A(),[n,o]=Ye.useState(jt),r=Ye.useRef(n);r.current=n;let a=q(eg),i=t?t.can({type:"insertText",text:""}).ok:false,s=Ye.useCallback((b,v)=>{o({mode:b?"reading":"editing",link:b??null,anchor:v??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]),c=Ye.useCallback(()=>{t?.surface?.releaseSelection(),o(jt);},[t]),l=Ye.useCallback(()=>{let b=tg(),v=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(v&&Zr(v)){s(v,b);return}if(v){o({mode:"editing",link:v,anchor:b,text:v.text,url:v.kind==="internal"?`#${v.anchor??""}`:v.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let C=t?.query({type:"selectedText"})??"";t?.surface?.retainSelection(),o({mode:"editing",link:null,anchor:b,text:C,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s]);Ye.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:b=>s(b.link,{left:b.rect.left,top:b.rect.bottom}),onRequest:l})},[t,e,s,l]),Ye.useEffect(()=>{let b=r.current;if(b.mode!=="reading"||!b.link)return;let v=Zr(b.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;v&&v.id===b.link.id||o(jt);},[a,t]),Ye.useEffect(()=>{let b=r.current;if(b.mode!=="editing"||b.link)return;let v=t?.surface;!v||v.retainedSelection()||o(jt);},[a,t]);let d=Ye.useCallback(async()=>{let b=r.current.link?.href;if(!b)return false;try{await navigator.clipboard.writeText(b);}catch{return false}return o(v=>({...v,copied:true})),true},[]),p=Ye.useCallback(()=>{o(b=>({...b,mode:"editing",copied:false,error:false}));},[]),g=Ye.useCallback(b=>{o(v=>({...v,text:b,copied:false,error:false}));},[]),m=Ye.useCallback(b=>{o(v=>({...v,url:b,copied:false,error:false}));},[]),f=Ye.useCallback(()=>{let b=r.current,v=t?.surface?.hyperlinks;if(!v)return false;let C=b.url.trim();if(C.length===0)return o(y=>({...y,error:true})),false;let P=C.startsWith("#");return v.applyHyperlink({...P?{anchor:C.slice(1)}:{url:C},...b.text.trim().length>0?{text:b.text}:{}})?(c(),true):(o(y=>({...y,error:true})),false)},[t,c]),u=Ye.useCallback(()=>{let b=t?.surface?.hyperlinks,v=r.current.link;if(!b)return false;let C=b.removeHyperlink(v?.id);return C&&c(),C},[t,c]),h=Ye.useCallback(()=>{let b=t?.surface?.navigation,v=r.current.link;if(!b||!v)return false;if(v.kind==="internal"){let P=v.anchor?b.goToBookmark(v.anchor):false;return P&&o(jt),P}let C=b.openExternal(v.href);return C&&o(jt),C},[t]);return Ye.useMemo(()=>({state:n.mode==="closed"?jt:{...n,canEdit:i},open:s,openAtCaret:l,close:c,copy:d,beginEdit:p,setText:g,setUrl:m,commitEdit:f,unlink:u,openTarget:h}),[n,i,s,l,c,d,p,g,m,f,u,h])}var Be={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function ag(e){return e==="sdtLocked"||e==="sdtContentLocked"}function ig(e){return e==="contentLocked"||e==="sdtContentLocked"}function Ki(e,t){return !e.ok&&e.code===t}function pt(){let e=Ye.useContext(zi),t=qr();return e??t}function qr(){let e=A(),[t,n]=Ye.useState(false),[o,r]=Ye.useState(false),[a,i]=Ye.useState(false),s=q(x=>x),c=e?.surface??null,l=c?.contentControls;Ye.useEffect(()=>{r(l?.showAll()??c?.state().contentControls.showAll??false),i(l?.formFill()??c?.state().contentControls.formFill??false);},[s,l,c]);let d=Ye.useMemo(()=>{if(!e)return null;let x=l?.atCaret()??null;if(x){let k=l?.disabledReason(x.id,"edit")??null,R=l?.disabledReason(x.id,"remove")??null;return {id:x.id,tag:x.tag??null,alias:x.alias??null,controlType:x.controlType,locked:ig(x.effectiveLock)||k==="locked",removalLocked:ag(x.effectiveLock)||R==="locked",placeholder:x.placeholder,bound:x.bound||k==="bound",effectiveLock:x.effectiveLock}}let M=e.query({type:"contentControlAt"});if(!M)return null;let E=l?.disabledReason(M.id,"edit")??null,w=l?.disabledReason(M.id,"remove")??null,N=e.can({type:"setContentControlValue",value:""}),F=e.can({type:"removeContentControl"}),H=M.locked===true||E==="locked"||Ki(N,"locked"),I=E==="bound"||Ki(N,"bound"),D=w==="locked"||Ki(F,"locked");return {id:M.id,tag:M.tag??null,alias:M.alias??null,controlType:M.controlType,locked:H,removalLocked:D,placeholder:false,bound:I,effectiveLock:null}},[e,s,l]),p=Ye.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,s]),g=Ye.useCallback(x=>{l?.setShowAll(x),r(x);},[l]),m=Ye.useCallback(x=>{l?.setFormFill(x),i(x);},[l]),f=Ye.useCallback(()=>g(!o),[g,o]),u=Ye.useCallback(()=>m(!a),[m,a]),h=Ye.useCallback(()=>n(true),[]),b=Ye.useCallback(()=>n(false),[]),v=Ye.useCallback(()=>n(x=>!x),[]),C=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(l){let M=l.disabledReason(d.id,"edit");return M==="locked"?"the content control is locked":M==="bound"?"the content control is bound to external data":M==="notFound"?"the content control was not found":M}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 x=e.can({type:"setContentControlValue",value:""});return x.ok?null:x.reason},[d,l,e]),P=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(l){let M=l.disabledReason(d.id,"remove");return M==="locked"?"the content control is locked":M==="notFound"?"the content control was not found":M}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let x=e.can({type:"removeContentControl"});return x.ok?null:x.reason},[d,l,e]),S=Ye.useCallback(x=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(l&&d){let M=l.disabledReason(d.id,"edit");if(M)return {ok:false,code:M==="bound"?"bound":M==="locked"?"locked":"notFound",reason:M==="bound"?"the content control is bound to external data":M==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:x})},[e,l,d]),y=Ye.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(l){let x=d?.id;if(!x)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let M=l.disabledReason(x,"remove");return M?{ok:false,code:M==="locked"?"locked":"notFound",reason:M==="locked"?"the content control is locked":"the content control was not found"}:l.remove(x)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,l,d]);return Ye.useMemo(()=>({control:d,controls:p,showAll:o,formFill:a,inspectorOpen:t,canSetValue:C===null&&d!==null,canRemove:P===null&&d!==null,setValueDisabledReason:C,removeDisabledReason:P,setShowAll:g,toggleShowAll:f,setFormFill:m,toggleFormFill:u,openInspector:h,closeInspector:b,toggleInspector:v,remove:y,setValue:S}),[d,p,o,a,t,C,P,g,f,m,u,h,b,v,y,S])}var zi=Ye.createContext(null);function Bc(){let e=0,t=null,n=new Set,o=new Set,r=a=>{for(let i of [...a])i();};return {getShift:()=>e,setShift(a){let i=Math.max(0,Math.round(a));i!==e&&(e=i,r(n));},subscribeShift(a){return n.add(a),()=>n.delete(a)},getViewport:()=>t,setViewport(a){a!==t&&(t=a,r(o));},subscribeViewport(a){return o.add(a),()=>o.delete(a)}}}var Vi=Ye.createContext(null);function Io(){return Ye.useContext(Vi)}var cg=()=>0,qc=()=>()=>{};function Ro(){let e=Io(),t=Ye.useCallback(o=>e?e.subscribeShift(o):qc(),[e]),n=Ye.useCallback(()=>e?e.getShift():0,[e]);return Ye.useSyncExternalStore(t,n,cg)}function _o(){let e=Io(),t=Ye.useCallback(r=>e?e.subscribeViewport(r):qc(),[e]),n=Ye.useCallback(()=>e?e.getViewport():null,[e]),o=Ye.useCallback(()=>null,[]);return Ye.useSyncExternalStore(t,n,o)}function fg(e,t){if(e===t)return true;let n=editor.resolveZoomMode(e),o=editor.resolveZoomMode(t);return n!==null&&o!==null&&editor.sameZoomMode(n,o)}function zr(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:a,imageDecodePort:i,children:s}=e,{t:c}=_(),l=Ye.useCallback((v,C)=>c(v,C),[c]),d=Ye.useRef(e);d.current=e;let[p,g]=Ye.useState(null);Ye.useEffect(()=>{let v=d.current,C=v.translate??l,P=editor.createDocxEditor({...v.document!==void 0?{document:v.document}:{},...v.fonts?{fonts:v.fonts}:{},...v.author!==void 0?{author:v.author}:{},...v.locale!==void 0?{locale:v.locale}:{},translate:C,...v.mode!==void 0?{mode:v.mode}:{},...v.modules!==void 0?{modules:v.modules}:{},...v.zoom!==void 0?{zoom:v.zoom}:{},...v.zoomMode!==void 0?{zoomMode:v.zoomMode}:{},...v.tableInteractionLabel?{tableInteractionLabel:v.tableInteractionLabel}:{},...v.imageDecodePort?{imageDecodePort:v.imageDecodePort}:{},onFontError:y=>d.current.onFontError?.(y)}),S=P.on("change",y=>d.current.onChange?.(y));return g(P),()=>{S(),P.destroy(),g(y=>y===P?null:y);}},[t,n,l,i]),Ye.useEffect(()=>{if(!p)return;if(!p.snapshot().isOpening){d.current.onReady?.(p);return}let v=p.on("change",()=>{v(),d.current.onReady?.(p);});return v},[p]);let m=Ye.useRef({editor:null,zoom:void 0,mode:void 0});Ye.useEffect(()=>{if(!p)return;m.current.editor!==p&&(m.current={editor:p,zoom:void 0,mode:void 0});let C=false;o!==void 0&&o!==m.current.zoom&&(m.current.zoom=o,p.setZoom(o),C=true);let P=m.current.mode,S=r!==void 0&&(P===void 0||!fg(P,r)),y=r===void 0?null:editor.resolveZoomMode(r),x=C&&r!==void 0&&y!==null&&y.type==="fit";(S||x)&&(m.current.mode=r,p.setZoomMode(r));},[p,o,r]),Ye.useEffect(()=>{p&&p.setTableInteractionLabel(a??editor.defaultTableLabel);},[p,a]);let[f,u]=Ye.useState(0),h=Ye.useMemo(()=>({mounted:f,register:()=>(u(v=>v+1),()=>u(v=>Math.max(0,v-1)))}),[f]),b=Ye.useMemo(Bc,[]);return jsxRuntime.jsx(St.Provider,{value:h,children:jsxRuntime.jsx(ki.Provider,{value:p,children:jsxRuntime.jsx(Vi.Provider,{value:b,children:jsxRuntime.jsx(gg,{children:jsxRuntime.jsx(bg,{children:jsxRuntime.jsx(Nr,{children:s})})})})})})}function gg({children:e}){let t=Br(true);return jsxRuntime.jsx(mn.Provider,{value:t,children:e})}function bg({children:e}){let t=qr();return jsxRuntime.jsx(zi.Provider,{value:t,children:e})}var Vr=[.25,.5,.75,1,1.25,1.5,2];function bn(e,t){return t==="in"?Vr.find(o=>o>e+.001)??null:[...Vr].reverse().find(o=>o<e-.001)??null}function $c(e,t){return e==="0"?1:e==="+"||e==="="?bn(t,"in")??t:e==="-"?bn(t,"out")??t:null}var Qt=Ye.createContext(false);function Xe(){return Ye.useContext(Qt)?"":"docx-editor "}var xg=e=>e.reviewPaneOpen??true,Tg=e=>e.zoomMode?.type==="fit";function $r({className:e,style:t,children:n}){let o=Xe(),r=A(),a=q(xg),i=q(Tg),c=(Ye.useContext(St)?.mounted??0)>0,l=Io(),d=Ro(),p=Ye.useCallback(m=>l?.setViewport(m),[l]),g=Ye.useCallback(m=>{if(!r||!(m.metaKey||m.ctrlKey)||m.altKey)return;let f=m.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let u=$c(m.key,r.getZoom());u!==null&&(m.preventDefault(),r.setZoom(u));},[r]);return jsxRuntime.jsx("div",{ref:p,"data-testid":"docx-editor-scroll",onKeyDownCapture:g,...c?{"data-review-pane":a?"open":"closed"}:{},...i?{"data-zoom-fit":""}:{},className:`${o}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${d}px`},children:jsxRuntime.jsx(Qt.Provider,{value:true,children:n})})}var Cg=sn;function Gc({ref:e,editorRef:t}){Ye.useImperativeHandle(e,()=>({load:n=>t.current?.load(n),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(n,o)=>t.current?.exec(n,o)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:n=>t.current?.snapshot(n)??Cg}),[t]);}var kg=e=>e.editingMode??"editing",Ui=[{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"}],Ig="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Ur({className:e,hidden:t}){let n=A(),o=q(kg),r=Y(),[a,i]=Ye.useState(false),s=Ye.useRef(null),c=Ye.useRef(null),l=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let u=l.current?.querySelectorAll('[role="menuitemradio"]');(l.current?.querySelector('[aria-checked="true"]')??u?.[0]??void 0)?.focus();},[a]);let d=Ye.useCallback(u=>{let h=[...l.current?.querySelectorAll('[role="menuitemradio"]')??[]],b=h.indexOf(document.activeElement),v=C=>{u.preventDefault(),h[(C+h.length)%h.length]?.focus();};u.key==="ArrowDown"?v(b+1):u.key==="ArrowUp"?v(b-1):u.key==="Home"?v(0):u.key==="End"&&v(h.length-1);},[]);Ye.useEffect(()=>{if(!a)return;let u=b=>{let v=s.current;v&&b.target instanceof Node&&v.contains(b.target)||i(false);},h=b=>{b.key==="Escape"&&(b.preventDefault(),i(false));};return document.addEventListener("mousedown",u,true),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u,true),document.removeEventListener("keydown",h);}},[a]);let p=Ye.useCallback(u=>{i(false),editor.runToolbarCommand(n,"review.editingMode",u),n?.focus();},[n]),g=editor.toolbarCommandState(n,"review.editingMode"),m=Ye.useMemo(()=>Ui.find(u=>u.mode===o)??Ui[0],[o]);if(t)return null;let f=ee("review.editingMode");return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:c,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r(f?.labelKey??"editingMode.label"),disabled:!g.enabled,...g.disabledReason?{title:g.disabledReason}:{},onMouseDown:O,onClick:()=>i(u=>!u),children:[Gi(m.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:r(m.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),a?jsxRuntime.jsx("div",{ref:l,className:"docx-toolbar__mode-menu",role:"menu","aria-label":r(f?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:d,children:Ui.map(u=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${u.mode}`,onMouseDown:O,onClick:()=>p(u.mode),children:[Gi(u.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:r(u.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:r(u.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:u.mode===o?Gi(Ig):null})]},u.mode))}):null]})}Ur.docxSlot="review.editingMode";function Gi(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"})})}function No(e,t){if(!Ye.isValidElement(e)||e.type!==Ye.Fragment)return null;let o=Ye.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function Yr({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:a}){if(!n)return t;let i=new Map,s=[];for(let p of Ye.Children.toArray(t)){let g=r(p);g?i.set(g,p):s.push(p);}let c=e.map((p,g)=>{let m=o(p,g),f=i.get(m);return f?jsxRuntime.jsx(Ye.Fragment,{children:f},m):jsxRuntime.jsx(Ye.Fragment,{children:a(p,g)},m)}),l=new Set(e.map(o)),d=[...i.entries()].filter(([p])=>!l.has(p)).map(([p,g])=>jsxRuntime.jsx(Ye.Fragment,{children:g},p));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,s]})}var Dg=["zoom","script","format","list","alignment","styles","font","text","history"],Xi=new Set(["review"]),ji=24,Jc=new Set;function ed(e,t=Dg){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Qc(e,t){let{widths:n,groups:o,order:r,fixed:a,more:i}=e,s=a;for(let l of o)s+=n.get(l)??0;if(s<=t)return Jc;s+=i;let c=new Set;for(let l of r){if(s<=t)break;let d=n.get(l);d===void 0||c.has(l)||(c.add(l),s-=d);}return c}function td(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}var od=td;function nd(e){if(!(e.available>0))return Jc;let t=Qc(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Qc(e,e.available-(e.hysteresis));return td(o,n)?n:o}function rd(e,t,n,o){return e+t+n+o*2}function ad(e,t){return e+t}function Ji(e,t){return e+t}function id(e){let t=Number.parseFloat(e.marginInlineStart||e.marginLeft),n=Number.parseFloat(e.marginInlineEnd||e.marginRight);return {start:Number.isFinite(t)?t:0,end:Number.isFinite(n)?n:0}}function Qi(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function ld(e){return Qi(e.columnGap)}function sd(e,t){return e.clientWidth-Qi(t.paddingLeft)-Qi(t.paddingRight)}var vn="data-toolbar-group",yn="data-toolbar-fixed",tl="data-toolbar-more",Ag=34,el=new Set;function dd(e,t,n){let o=Ye.useRef(null),r=Ye.useRef(new Map),a=Ye.useRef(Ag),[i,s]=Ye.useState(el),c=Ye.useRef(i);c.current=i;let l=Ye.useRef({groups:t,order:n});l.current={groups:t,order:n};let d=Ye.useCallback(()=>{let g=o.current;if(!g||!e)return;let m=getComputedStyle(g),f=ld(m),u=sd(g,m),h=g.querySelector(".docx-toolbar__separator"),b=f*2;if(h){let y=getComputedStyle(h),x=id(y);b=rd(h.offsetWidth,x.start,x.end,f);}for(let y of g.querySelectorAll(`[${vn}]`)){let x=y.getAttribute(vn);x&&y.offsetWidth>0&&r.current.set(x,ad(y.offsetWidth,b));}let v=0;for(let y of g.querySelectorAll(`[${yn}]`))y.offsetWidth>0&&(v+=Ji(y.offsetWidth,f));let C=g.querySelector(`[${tl}]`);C&&C.offsetWidth>0&&(a.current=Ji(C.offsetWidth,f));let P={available:u,widths:r.current,groups:l.current.groups,order:l.current.order,fixed:v,more:a.current,previous:c.current,hysteresis:ji},S=nd(P);od(S,c.current)||(c.current=S,s(S));},[e]),p=Ye.useCallback(g=>{o.current=g;},[]);return Ye.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=el,s(el));return}d();},[e,d]),Ye.useEffect(()=>{let g=o.current;if(!e||!g||typeof ResizeObserver>"u")return;let m=0,f=new ResizeObserver(()=>{m===0&&(m=requestAnimationFrame(()=>{m=0,d();}));});f.observe(g);for(let u of g.querySelectorAll(`[${vn}], [${yn}]`))f.observe(u);return ()=>{m!==0&&cancelAnimationFrame(m),f.disconnect();}},[e,d,i]),{attach:p,overflow:i}}var $g=["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"],pd=Ye.createContext({close:()=>{}});function Wg(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function md({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 fd({slot:e}){let t=Y(),{close:n}=Ye.useContext(pd),{execute:o,isActive:r,isEnabled:a,disabledReason:i}=ne(e),s=ee(e),c=editor.commandForSlot(e),l=c?.type==="toggleMark"||c?.type==="setAlignment",d=t(s?.labelKey??e);return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...i?{title:i}:{},...l?{"aria-pressed":r}:{},...r?{"data-active":""}:{},onMouseDown:O,onClick:p=>{o(),n(p.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:te(s?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:d})]})}function gd({sections:e,className:t}){let n=Y(),[o,r]=Ye.useState(false),a=Ye.useRef(null),i=Ye.useRef(null),s=Ye.useRef(null),c=Ye.useRef(false),l=Ye.useId(),d=n("formattingBar.more"),p=Ye.useCallback(f=>{r(false),f&&i.current?.focus();},[]),g=Ye.useMemo(()=>({close:p}),[p]);Ye.useEffect(()=>{if(!o)return;let f=u=>{let h=u.target;h instanceof Node&&a.current?.contains(h)||r(false);};return document.addEventListener("mousedown",f,true),()=>document.removeEventListener("mousedown",f,true)},[o]),Ye.useEffect(()=>{if(!o||!c.current)return;c.current=false;let f=s.current;f&&Wg(f);},[o]);let m=f=>{f.key!=="Escape"||f.defaultPrevented||(f.preventDefault(),p(true));};return jsxRuntime.jsxs("div",{ref:a,className:`docx-toolbar__more${t?` ${t}`:""}`,[tl]:"",children:[jsxRuntime.jsx("button",{ref:i,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?l:void 0,"aria-label":d,title:d,...o?{"data-active":""}:{},onMouseDown:O,onClick:()=>r(f=>!f),onKeyDown:f=>{f.key==="ArrowDown"&&(f.preventDefault(),c.current=true,r(true));},children:te($g)}),o?jsxRuntime.jsx(pd.Provider,{value:g,children:jsxRuntime.jsx("div",{ref:s,id:l,role:"dialog","aria-label":d,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",onKeyDown:m,children:e.map(f=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(f.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(f.labelKey)}),f.children]},f.id))})}):null]})}function jg(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function xn(e){let t=A(),n=Ye.useRef(e);n.current=e;let o=Ye.useCallback(s=>{let c=n.current,l=editor.toolbarCommandState(t,c);return {value:l.value??null,enabled:l.enabled,disabledReason:l.disabledReason}},[t,e]),r=q(o,jg),a=Ye.useMemo(()=>({execute:s=>editor.runToolbarCommand(t,"image.wrap",s),value:r.value??null,options:editor.IMAGE_WRAP_TARGETS,isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]),i=Ye.useMemo(()=>({execute:s=>editor.runToolbarCommand(t,"image.altText",s),value:r.value,options:[],isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]);return e==="image.wrap"?a:i}var nl=[{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 Jr({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:s,isEnabled:c,disabledReason:l}=xn("image.wrap"),[d,p]=Ye.useState(false),g=Ye.useRef(null),m=Ye.useRef(null),f=Ye.useRef(null),u=Ye.useId(),h=Ye.useMemo(()=>nl.find(y=>y.value===s)??nl[0],[s]),b=ee("image.wrap"),v=a(b?.labelKey??"formattingBar.imageWrap");Ye.useEffect(()=>{if(!d)return;let y=M=>{let E=g.current;E&&M.target instanceof Node&&E.contains(M.target)||p(false);},x=M=>{M.key==="Escape"&&(M.preventDefault(),p(false),m.current?.focus());};return document.addEventListener("mousedown",y,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",y,true),document.removeEventListener("keydown",x);}},[d]);let C=Ye.useCallback(y=>{p(false),i(y);},[i]);if(t)return null;let P=r("imageWrap.tooltipPrefix",{label:r(h.labelKey)}),S={type:"button",ref:m,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?u:void 0,"aria-label":v,title:l??P,onMouseDown:O,onClick:()=>p(y=>!y)};return jsxRuntime.jsxs("div",{ref:g,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(W,{...S,children:o}):jsxRuntime.jsx("button",{...S,children:o??te(b?.paths)}),d?jsxRuntime.jsx("div",{ref:f,id:u,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:y=>y.stopPropagation(),children:nl.map(y=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":s===y.value,...s===y.value?{"data-active":""}:{},onMouseDown:O,onClick:()=>C(y.value),children:r(y.labelKey)},y.value))}):null]})}Jr.docxSlot="image.wrap";var Tn=Object.assign(Jr,{docxSlot:"image.wrap"});function ea({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:s,isEnabled:c,disabledReason:l}=xn("image.altText"),[d,p]=Ye.useState(false),[g,m]=Ye.useState(""),f=Ye.useRef(null),u=Ye.useRef(null),h=Ye.useId();Ye.useEffect(()=>{d&&m(s??"");},[d,s]),Ye.useEffect(()=>{if(!d)return;let S=x=>{let M=f.current;M&&x.target instanceof Node&&M.contains(x.target)||p(false);},y=x=>{x.key==="Escape"&&(x.preventDefault(),p(false),u.current?.focus());};return document.addEventListener("mousedown",S,true),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",S,true),document.removeEventListener("keydown",y);}},[d]);let b=Ye.useCallback(()=>{i(g),p(false);},[g,i]);if(t)return null;let v=ee("image.altText"),C=a(v?.labelKey??"formattingBar.altText"),P={type:"button",ref:u,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?h:void 0,"aria-label":C,title:l??C,onMouseDown:O,onClick:()=>p(S=>!S)};return jsxRuntime.jsxs("div",{ref:f,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(W,{...P,children:o}):jsxRuntime.jsx("button",{...P,children:o??C}),d?jsxRuntime.jsxs("div",{id:h,role:"dialog","aria-label":r("imageAltText.panelTitle"),className:"docx-toolbar__alt-text-panel",onMouseDown:S=>S.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${h}-description`,children:r("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${h}-description`,className:"docx-dialog__textarea",value:g,onChange:S=>m(S.target.value),placeholder:r("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>p(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:b,children:r("common.apply")})]})]}):null]})}ea.docxSlot="image.altText";var Sn=Object.assign(ea,{docxSlot:"image.altText"});var Cd=e=>e.image;function Sd(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 pb(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function sl(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(It(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(It(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(It(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(It(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function mb(e,t){let n=sl(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function ta(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=cn(t);return Number.isInteger(n)?n:null}function fb(e,t){let n=sl(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let l=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,p=l?ta(e.horizontalPoints):t.position?.horizontalEmu,g=d?ta(e.verticalPoints):t.position?.verticalEmu;return l&&p===null?{ok:false}:d&&g===null?{ok:false}:p===void 0||g===void 0?{ok:false}:{ok:true,value:{horizontalEmu:p,verticalEmu:g}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,a=e.relativeToH!==n.relativeToH,i=e.relativeToV!==n.relativeToV,s=o?ta(e.horizontalPoints):t.position?.horizontalEmu,c=r?ta(e.verticalPoints):t.position?.verticalEmu;return o&&s===null?{ok:false}:r&&c===null?{ok:false}:{ok:true,value:{...typeof s=="number"?{horizontalEmu:s}:{},...typeof c=="number"?{verticalEmu:c}:{},...a||o||r?{relativeToH:e.relativeToH}:{},...i||o||r?{relativeToV:e.relativeToV}:{}}}}function oa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function na(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function cl({open:e,onClose:t,className:n,triggerRef:o}){let r=A(),{t:a}=_(),i=q(Cd),s=Ye.useId(),c=Ye.useId(),l=Ye.useId(),d=Ye.useRef(null),p=Ye.useRef(null),g=Ye.useRef(null),m=Ye.useRef(null),[f,u]=Ye.useState(null),[h,b]=Ye.useState(null),v=p.current,C=v?.canCrop===false,P=v?.canResize===false,S=v?.locks.changeAspect===true,y=v?.kind==="anchored"&&v.canMove===true,x=v?.kind==="inline",M=v?.kind==="anchored"&&v.canMove===false;Ye.useEffect(()=>{if(!e){p.current=null,g.current=null,m.current=null;return}if(!i)return;if(p.current=i,r?.surface){let{anchor:z}=r.surface.state().selection;g.current={paragraphId:z.paragraphId,offset:z.offset},m.current=r.surface.session.packageRevision();}b(null);let k=sl(i),R=i.crop;u({widthPoints:String(It(i.widthEmu)),heightPoints:String(It(i.heightEmu)),cropLeft:String(R.left),cropTop:String(R.top),cropRight:String(R.right),cropBottom:String(R.bottom),title:i.title,description:i.description,hyperlink:i.hyperlink??"",wrap:i.wrap,lockAspect:i.locks.changeAspect,...k});},[e,i?.id,i?.widthEmu,i?.heightEmu,r]);let E=Ye.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),w=Ye.useCallback(()=>{t(),E();},[t,E]);Ye.useEffect(()=>{if(!e)return;let k=d.current;if(!k)return;let R=Sd(k);(R.find($=>$.id==="image-prop-width"&&!$.hasAttribute("disabled"))??R.find($=>!$.hasAttribute("disabled"))??k).focus();let Z=$=>{if($.key==="Escape"){$.preventDefault(),w();return}if($.key!=="Tab")return;let Q=Sd(k);if(Q.length===0)return;let Me=document.activeElement,se=Q.findIndex(Ce=>Ce===Me);if(se===-1)return;$.preventDefault();let Te=$.shiftKey?(se-1+Q.length)%Q.length:(se+1)%Q.length;Q[Te]?.focus();};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[e,w]);let N=Ye.useMemo(()=>{let k=v??i;return !k||k.widthEmu<=0?1:k.widthEmu/k.heightEmu},[i,v]),F=Ye.useCallback(k=>{u(R=>{if(!R)return R;if(!R.lockAspect)return {...R,widthPoints:k};let z=na(k);if(z===null)return {...R,widthPoints:k};let Z=Math.round(z/N*100)/100;return {...R,widthPoints:k,heightPoints:String(Z)}});},[N]),H=Ye.useCallback(k=>{u(R=>{if(!R)return R;if(!R.lockAspect)return {...R,heightPoints:k};let z=na(k);if(z===null)return {...R,heightPoints:k};let Z=Math.round(z*N*100)/100;return {...R,widthPoints:String(Z),heightPoints:k}});},[N]),I=Ye.useCallback(()=>{let k=p.current;if(!k?.intrinsic)return;let R=k.intrinsic.pixelWidth*72/k.intrinsic.dpiX,z=k.intrinsic.pixelHeight*72/k.intrinsic.dpiY;u(Z=>Z&&{...Z,widthPoints:String(Math.round(R*100)/100),heightPoints:String(Math.round(z*100)/100)});},[i]),D=Ye.useCallback(()=>{let k=p.current,R=g.current,z=m.current;if(!r||!k||!f||!R||z===null)return;let Z={type:"setImageProperties",drawingNodeId:k.id,expectedPackageRevision:z,selectionParagraphId:R.paragraphId,selectionOffset:R.offset};if(!P){let Ce=na(f.widthPoints),G=na(f.heightPoints);if(Ce===null||G===null){b("imageProperties.errors.invalidDimensions");return}let B=cn(Ce),Pe=cn(G);B!==k.widthEmu&&(Z.widthEmu=B),Pe!==k.heightEmu&&(Z.heightEmu=Pe);}if(k.canCrop&&!C){let Ce=oa(f.cropLeft),G=oa(f.cropTop),B=oa(f.cropRight),Pe=oa(f.cropBottom);if(Ce===null||G===null||B===null||Pe===null){b("imageProperties.errors.invalidCrop");return}let Ue=k.crop;(Ce!==Ue.left||G!==Ue.top||B!==Ue.right||Pe!==Ue.bottom)&&(Z.crop={left:Ce,top:G,right:B,bottom:Pe});}f.title!==k.title&&(Z.title=f.title),f.description!==k.description&&(Z.description=f.description);let $=f.hyperlink.trim();if($!==(k.hyperlink??"")&&(Z.hyperlink=$===""?null:$),k.canChangeWrap&&f.wrap!==k.wrap&&(Z.wrap=f.wrap),k.kind==="anchored"&&k.canMove&&mb(f,k)){let Ce=fb(f,k);if(!Ce.ok){b("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(Ce.value,k))){b("imageProperties.errors.invalidPosition");return}Object.assign(Z,Ce.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){b("imageProperties.errors.refused");return}if(!r.exec(Z).ok){b("imageProperties.errors.refused");return}w();},[r,f,C,P,w]);return !e||!f?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:w,onMouseDown:k=>{k.stopPropagation(),pb(k);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":s,className:"docx-dialog docx-image-properties-dialog",onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),children:[jsxRuntime.jsx("div",{id:s,className:"docx-dialog__header",children:a("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[h?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:a(h)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:a("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:f.widthPoints,disabled:P,onChange:k=>F(k.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:a("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:f.heightPoints,disabled:P,onChange:k=>H(k.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.lockAspect,disabled:S,onChange:k=>u(R=>R&&{...R,lockAspect:k.target.checked})}),a("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:C||!v?.intrinsic,onClick:I,children:a("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.position")}),x?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionUnavailable")}):null,M?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionLocked")}):null,y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f.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:a("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:f.relativeToH??"page",onChange:k=>u(R=>R&&{...R,relativeToH:k.target.value}),children:editor.DRAWING_REL_FROM_H.map(k=>jsxRuntime.jsx("option",{value:k,children:a(`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:a("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:f.relativeToV??"line",onChange:k=>u(R=>R&&{...R,relativeToV:k.target.value}),children:editor.DRAWING_REL_FROM_V.map(k=>jsxRuntime.jsx("option",{value:k,children:a(`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:a("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:f.horizontalPoints,onChange:k=>u(R=>R&&{...R,horizontalPoints:k.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:a("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:f.verticalPoints,onChange:k=>u(R=>R&&{...R,verticalPoints:k.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:a("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:f.title,onChange:k=>u(R=>R&&{...R,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:a("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:f.description,onChange:k=>u(R=>R&&{...R,description:k.target.value}),placeholder:a("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:l,children:a("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:l,className:"docx-dialog__input docx-dialog__input--full",value:f.hyperlink,onChange:k=>u(R=>R&&{...R,hyperlink:k.target.value}),placeholder:a("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:a("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:f.wrap,disabled:v?.canChangeWrap===false,onChange:k=>u(R=>R&&{...R,wrap:k.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(k=>jsxRuntime.jsx("option",{value:k,children:a(`imageWrap.targets.${k}`)},k))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:a("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:C,value:f.cropLeft,onChange:k=>u(R=>R&&{...R,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:a("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:C,value:f.cropTop,onChange:k=>u(R=>R&&{...R,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:a("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:C,value:f.cropRight,onChange:k=>u(R=>R&&{...R,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:a("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:C,value:f.cropBottom,onChange:k=>u(R=>R&&{...R,cropBottom:k.target.value})})]}),C?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:w,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:D,children:a("common.apply")})]})]})})}function ra({className:e,hidden:t,asChild:n,children:o}){let r=A(),{t:a}=_(),i=q(Cd),[s,c]=Ye.useState(false),l=Ye.useRef(null),d={type:"setImageProperties",description:"probe"},p=r&&i?r.can(d):null,g=p?.ok===true,m=p&&!p.ok?p.reason:null;if(t)return null;let f=ee("image.properties"),u={type:"button",ref:l,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:O,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(W,{...u,children:o}):jsxRuntime.jsx("button",{...u,children:o??te(f?.paths)}),jsxRuntime.jsx(cl,{open:s,onClose:()=>c(false),triggerRef:l})]})}ra.docxSlot="image.properties";var Pn=Object.assign(ra,{docxSlot:"image.properties"});function Ee(e){return Object.assign(n=>jsxRuntime.jsx(Xt,{slot:e,...n}),{docxSlot:e})}var Pd=Ee("history.undo"),Ed=Ee("history.redo"),wd=Ee("text.bold"),Md=Ee("text.italic"),kd=Ee("text.underline"),Id=Ee("text.strike"),Rd=Ee("format.clear"),_d=Ee("script.super"),Nd=Ee("script.sub"),Dd=Ee("alignment.left"),Ld=Ee("alignment.center"),Hd=Ee("alignment.right"),Fd=Ee("alignment.justify"),Ad=Ee("list.bullet"),Od=Ee("list.numbered"),Zd=Ee("list.outdent"),Bd=Ee("list.indent");var qd=Ee("table.insert"),Kd=Ee("review.comments");function hb({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=A(),{openAtCaret:i}=Bi(),s=editor.chromeProbeForSlot("text.link"),c=a&&s?a.can(s):null,l=c?.ok===true,d=c&&!c.ok?c.reason:null,p=Y();if(t)return null;let g=ee("text.link"),m=p(g?.labelKey??"text.link"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!l,...l?{}:{"data-disabled":""},"aria-label":m,title:d??m,onMouseDown:O,onClick:()=>i()};return o?jsxRuntime.jsx(W,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??te(g?.paths)})}var dl=Object.assign(hb,{docxSlot:"text.link"});function vb({className:e,hidden:t}){let n=A(),{onSave:o}=Ye.useContext(dn),r=Y();if(t)return null;let a=ee("file.save"),i=r(a?.labelKey??"file.save"),s=!n||!o;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:s,...s?{"data-disabled":""}:{},"aria-label":i,title:i,onMouseDown:O,onClick:()=>o?.(),children:te(a?.paths)})}var ul=Object.assign(vb,{docxSlot:"file.save"});function Ho({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function Fo(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var Tb=e=>({zoom:e.zoom,mode:e.zoomMode}),Sb=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,Vd={type:"fixed"};function pl(){let e=A(),{zoom:t,mode:n}=q(Tb,Sb),o=Ye.useCallback(a=>{e?.setZoom(a);},[e]),r=Ye.useCallback(a=>{e?.setZoomMode(a);},[e]);return Ye.useMemo(()=>{let a=n??Vd,i=bn(t,"out"),s=bn(t,"in");return {zoom:t,mode:a,isFit:a.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(Vd),o(1);},zoomIn:()=>s!==null&&o(s),zoomOut:()=>i!==null&&o(i),canZoomIn:!!e&&s!==null,canZoomOut:!!e&&i!==null,levels:Vr}},[e,t,n,o,r])}var Mn=2,kn=3276,wn=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Eb=e=>e.formatting?.fontSizePt??null;function Ud(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Gd(e,t,n){for(let o=t.length-1;o>=0;o-=1)if(t[o]<e)return t[o];return Math.max(e-1,n)}function Xd(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:O,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:O,onClick:e.onIncrease,children:"+"})]})}function wb(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let n=Number(t);if(!Number.isFinite(n))return null;let o=Math.round(n*2);return o<Mn||o>kn?null:o}function Mb({className:e,hidden:t}){let n=A(),o=q(Eb),{isEnabled:r,disabledReason:a}=ne("font.size"),i=Y(),[s,c]=Ye.useState(false),[l,d]=Ye.useState(null),p=Ye.useRef(null),g=Ye.useRef(null),m=Ye.useCallback(S=>{if(!n)return;let y=editor.commandForSlotValue("font.size",S);y&&n.can(y).ok&&n.exec(y);},[n]),f=Ye.useCallback(S=>{m(Math.min(kn,Math.max(Mn,Math.round(S*2))));},[m]),u=Ye.useCallback(S=>{c(false),d(null),g.current?.blur(),S&&kb(p.current);},[]);if(Ye.useEffect(()=>{if(!s)return;let S=y=>{let x=p.current;x&&y.target instanceof Node&&x.contains(y.target)||(c(false),d(null));};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[s]),t)return null;let h=r&&o!==null,b=o===null?"\u2014":String(Math.round(o*2)/2),v=l??b,C=o===null?null:Math.round(o*2)/2,P=()=>{if(l===null)return;let S=wb(l);S!==null&&m(S);};return jsxRuntime.jsxs("span",{ref:p,className:"docx-toolbar__font-size","data-slot":"font.size",title:a??void 0,children:[jsxRuntime.jsx(Xd,{className:e,groupLabel:i("fontSize.label"),decreaseLabel:i("fontSize.decrease"),increaseLabel:i("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:g,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:v,disabled:!r,role:"combobox","aria-expanded":s,"aria-haspopup":"listbox","aria-label":i("fontSize.label"),autoComplete:"off",onChange:S=>{d(S.target.value),c(true);},onFocus:S=>{S.target.select(),c(true);},onClick:()=>c(true),onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),P(),u(true)):S.key==="Escape"?(S.preventDefault(),u(true)):(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),c(true),o!==null&&f(S.key==="ArrowDown"?Gd(o,wn,Mn/2):Ud(o,wn,kn/2)));},onBlur:()=>{P(),d(null);}}),canDecrease:h&&Math.round(o*2)>Mn,canIncrease:h&&Math.round(o*2)<kn,onDecrease:()=>f(Gd(o??0,wn,Mn/2)),onIncrease:()=>f(Ud(o??0,wn,kn/2))}),s&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":i("fontSize.listLabel"),children:wn.map(S=>{let y=C===S;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":y,...y?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>{f(S),u(true);},children:S},S)})}):null]})}function kb(e){(Fo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var gl=Object.assign(Mb,{docxSlot:"font.size"});function Ib({className:e,hidden:t}){let n=A(),{zoom:o,isFit:r,mode:a,setZoom:i,setMode:s,zoomIn:c,zoomOut:l,canZoomIn:d,canZoomOut:p,levels:g}=pl(),m=Y(),[f,u]=Ye.useState(false),h=Ye.useRef(null);Ye.useEffect(()=>{if(!f)return;let y=x=>{let M=h.current;M&&x.target instanceof Node&&M.contains(x.target)||u(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[f]);let b=Ye.useCallback(y=>{u(false),i(y);},[i]),v=Ye.useCallback(y=>{u(false),s(y==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[s]);if(t)return null;let C=`${Math.round(o*100)}%`,P=editor.sameZoomMode(a,editor.AUTO_ZOOM_MODE),S=editor.sameZoomMode(a,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:h,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(Xd,{className:e,groupLabel:m("zoom.zoomLevel"),decreaseLabel:m("zoom.zoomOut"),increaseLabel:m("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!n,"aria-haspopup":"listbox","aria-expanded":f,"aria-label":m("zoom.zoomLevel"),onMouseDown:O,onClick:()=>u(y=>!y),children:[C,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:p,canIncrease:d,onDecrease:l,onIncrease:c}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox","aria-label":m("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":P,...P?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v("auto"),children:m("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v("fit-width"),children:m("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),g.map(y=>{let x=!r&&Math.abs(y-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":x,...x?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>b(y),children:`${Math.round(y*100)}%`},y)})]}):null]})}var bl=Object.assign(Ib,{docxSlot:"zoom.level"});var Lb=[1,1.15,1.5,2,2.5,3],Qd=10,Hb=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Fb=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Ab({className:e,hidden:t}){let n=A(),o=q(Hb,Fb),{isEnabled:r,disabledReason:a}=ne("list.lineSpacing"),i=Y(),[s,c]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!s)return;let h=b=>{let v=l.current;v&&b.target instanceof Node&&v.contains(b.target)||c(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let d=Ye.useCallback(h=>{if(c(false),!n)return;let b=editor.commandForSlotValue("list.lineSpacing",h);b&&n.can(b).ok&&n.exec(b);},[n]),p=Ye.useCallback((h,b)=>{if(c(false),!n)return;let v={type:"setParagraphSpacing",[h]:b};n.can(v).ok&&n.exec(v);},[n]);if(t)return null;let g=ee("list.lineSpacing"),m=(o.spaceBeforePt??0)>0,f=(o.spaceAfterPt??0)>0,u=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:l,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":s,"aria-label":i("lineSpacing.label"),title:a??i("lineSpacing.label"),onMouseDown:O,onClick:()=>c(h=>!h),children:[te(g?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[Lb.map(h=>{let b=u===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":b,...b?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>d(h),children:Number.isInteger(h*10)?h.toFixed(1):h.toFixed(2)},h)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>p("beforePt",m?null:Qd),children:i(m?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>p("afterPt",f?null:Qd),children:i(f?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var vl=Object.assign(Ab,{docxSlot:"list.lineSpacing"});var zb=[{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"}],Jd=[{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"}],eu=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],aa=["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"],Dt=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Qe=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function Vb(e){let t=[0,2,4].map(o=>parseInt(e.slice(o,o+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[Qe(5),Qe(15),Qe(25),Qe(35),Qe(50)]:n===0?[Dt(50),Dt(35),Dt(25),Dt(15),Dt(5)]:n>=.8?[Qe(10),Qe(25),Qe(50),Qe(75),Qe(90)]:[Dt(80),Dt(60),Dt(40),Qe(25),Qe(50)]}var $b=/^[0-9A-Fa-f]{6}$/;function Wb(e,t){let n="";for(let o=0;o<6;o+=2){let r=Math.round(t(parseInt(e.slice(o,o+2),16)));n+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return n.toUpperCase()}function Ub(e){let t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return .299*t+.587*n+.114*o>230}function ia({value:e,css:t,title:n,selected:o,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":n,title:n,"data-value":e,...o?{"data-selected":""}:{},...Ub(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function Gb({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Vb),a=[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:[o.map((i,s)=>jsxRuntime.jsx(ia,{value:i,css:`#${i.toLowerCase()}`,title:t(aa[s]),selected:n===i,apply:e},`base-${s}`)),a.map(i=>o.map((s,c)=>{let l=r[c][i],d=Wb(s,l.apply);return jsxRuntime.jsx(ia,{value:d,css:`#${d.toLowerCase()}`,title:`${t(aa[c])}, ${t(l.labelKey)}`,selected:n===d,apply:e},`${i}-${c}`)}))]})]})}function Yb(e){let{apply:t,label:n,current:o}=e,[r,a]=Ye.useState(""),i=$b.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gb,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:zb.map(s=>jsxRuntime.jsx(ia,{value:s.value,css:s.css,title:n(s.labelKey),selected:o===s.value,apply:t},s.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("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":n("colorPicker.customColor"),onChange:s=>a(s.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:s=>{s.key==="Enter"&&i&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!i,onMouseDown:O,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function xl({apply:e,current:t}){let n=A(),o=Y(),r=n?.getDocumentThemeColors()??[],a=r.length===aa.length?r.map(s=>s.hex):eu,i=t?.toUpperCase()??null;return jsxRuntime.jsx(Yb,{apply:e,label:o,current:i,themeHexes:a})}var Xb=Jd.filter(e=>e.value!=="white");function jb({apply:e,label:t,current:n}){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:Xb.map(o=>jsxRuntime.jsx(ia,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function tu(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:a}=e,i=t==="text.color";return Object.assign(({className:c,hidden:l,icon:d})=>{let p=A(),{isEnabled:g,disabledReason:m}=ne(t),f=Y(),[u,h]=Ye.useState(false),[b,v]=Ye.useState(n),C=Ye.useRef(null),P=q(w=>{if(i){let N=w.formatting?.color;return N&&N.kind==="hex"?N.value.toUpperCase():null}return w.formatting?.highlight??null}),S=p?.getDocumentThemeColors()??[],y=S.length===aa.length?S.map(w=>w.hex):eu;Ye.useEffect(()=>{if(!u)return;let w=N=>{let F=C.current;F&&N.target instanceof Node&&F.contains(N.target)||h(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);let x=Ye.useCallback(w=>{if(h(false),!p)return;let N=editor.commandForSlotValue(t,w);N&&p.can(N).ok&&(p.exec(N),w!==r.value&&v(w));},[p]),M=Ye.useMemo(()=>ee(t),[]);if(l)return null;let E=f(M?.labelKey??t);return jsxRuntime.jsxs("div",{ref:C,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!g,...g?{}:{"data-disabled":""},"aria-label":E,title:m??E,onMouseDown:O,onClick:()=>x(b),children:[d??te(M?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(b)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":u,"aria-label":E,title:m??E,onMouseDown:O,onClick:()=>h(w=>!w),children:"\u25BE"}),u?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":E,onMouseDown:O,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>x(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),f(r.labelKey)]}),a({apply:x,label:f,current:P,themeHexes:y})]}):null]})},{docxSlot:t})}var Qb=new Map(Jd.map(e=>[e.value,e.css])),Tl=tu({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(xl,{apply:e.apply,current:e.current})}),Sl=tu({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Qb.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(jb,{...e})});var nh=["alignment.left","alignment.center","alignment.right","alignment.justify"];function rh({className:e,hidden:t}){let n=ne("alignment.left"),o=ne("alignment.center"),r=ne("alignment.right"),a=ne("alignment.justify"),i=Y(),[s,c]=Ye.useState(false),l=Ye.useRef(null);if(Ye.useEffect(()=>{if(!s)return;let u=h=>{let b=l.current;b&&h.target instanceof Node&&b.contains(h.target)||c(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),t)return null;let d=[n,o,r,a],p=nh.map((u,h)=>({slot:u,control:ee(u),state:d[h]})),g=p.find(u=>u.state.isActive)??p[0],m=p.some(u=>u.state.isEnabled),f=i(g.control?.labelKey??g.slot);return jsxRuntime.jsxs("div",{ref:l,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!m,...m?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":s,"aria-label":f,title:m?f:g.state.disabledReason??f,onMouseDown:O,onClick:()=>c(u=>!u),children:[te(g.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:p.map(u=>{let h=i(u.control?.labelKey??u.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":u.slot,disabled:!u.state.isEnabled,...u.state.isActive?{"data-active":""}:{},"aria-pressed":u.state.isActive,"aria-label":h,title:u.state.disabledReason??h,onMouseDown:O,onClick:()=>{u.state.execute(),c(false);},children:te(u.control?.paths)},u.slot)})}):null]})}var la=Object.assign(rh,{docxSlot:"alignment"});function Pl(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:a,onSelect:i,asChild:s,className:c,children:l}=e,d={type:"button",className:`docx-toolbar__button${c?` ${c}`:""}`,disabled:r,...o?{"data-active":""}:{},...r?{"data-disabled":""}:{},...o!==void 0?{"aria-pressed":o}:{},"aria-label":t,title:r?a??t:t,onMouseDown:p=>O(p),onClick:r?void 0:i};return s?jsxRuntime.jsx(W,{...d,children:l}):jsxRuntime.jsx("button",{...d,children:n??l})}var ph=Object.freeze([]),mh=e=>e.formatting?.fontFamily??null,fh=e=>e;function sa(){let e=A(),t=q(mh),n=q(fh),o=Ye.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():ph,[e,n]),{isEnabled:r}=ne("font.family"),a=Ye.useCallback(i=>{if(!e)return;let s=editor.commandForSlotValue("font.family",i);s&&e.can(s).ok&&e.exec(s);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var ru=Ye.createContext(null);function wl(){return Ye.useContext(ru)}function Ml({asChild:e,className:t,children:n}){let o=wl(),r=Y();if(!o)return null;let a=r(ee("font.family")?.labelKey??"font.family"),i={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},s=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsx("button",{type:"button",...i,children:s})}Ml.docxToolbarPart=true;var gh=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"]]),bh=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function au({asChild:e,className:t,children:n}){let o=wl(),r=Y();if(!o||!o.open)return null;let a={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},i;return n!==void 0?i=n:i=bh.map(c=>({...c,fonts:o.options.filter(l=>(gh.get(l.toLowerCase())??"other")===c.category)})).filter(c=>c.fonts.length>0).map((c,l)=>jsxRuntime.jsxs("div",{role:"group",children:[l>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}):null,c.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(c.labelKey)}):null,c.fonts.map(d=>jsxRuntime.jsx(iu,{value:d},d))]},c.category)),e?jsxRuntime.jsx(W,{...a,children:i}):jsxRuntime.jsx("div",{...a,children:i})}function iu({value:e,asChild:t,className:n,children:o}){let r=wl();if(!r)return null;let a=r.value===e,i={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__font-family-item${n?` ${n}`:""}`},s=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsxs("button",{type:"button",...i,children:[s,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function hh({hidden:e,asChild:t,className:n,children:o}){let r=sa(),[a,i]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let p=g=>{let m=s.current;m&&g.target instanceof Node&&m.contains(g.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let l={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ml,{}),jsxRuntime.jsx(au,{})]});return jsxRuntime.jsx(ru.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...l,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...l,children:d})})}var kl=Object.assign(hh,{docxSlot:"font.family",Trigger:Ml,Content:au,Item:iu});function wh(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 Mh=Object.freeze([]),kh=e=>e.formatting?.styleId??null,Ih=e=>e;function ca(){let e=A(),t=q(kh),n=q(Ih),o=Ye.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(i=>i.type==="paragraph").map(i=>({styleId:i.styleId,name:i.name,preview:i.preview})):Mh,[e,n]),{isEnabled:r}=ne("styles.style"),a=Ye.useCallback(i=>{if(!e)return;let s=editor.commandForSlotValue("styles.style",i);s&&e.can(s).ok&&e.exec(s);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var lu=Ye.createContext(null);function _l(){return Ye.useContext(lu)}function Nl({asChild:e,className:t,children:n}){let o=_l(),r=Y();if(!o)return null;let a=ee("styles.style"),i=r(a?.labelKey??"styles.style"),s={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},c=o.options.find(d=>d.styleId===o.value),l=n??(o.value===null?jsxRuntime.jsx("span",{children:a?.valueKey?r(a.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:c?.name??o.value}));return e?jsxRuntime.jsx(W,{...s,children:l}):jsxRuntime.jsx("button",{type:"button",...s,children:l})}Nl.docxToolbarPart=true;function su({asChild:e,className:t,children:n}){let o=_l();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},a=n??o.options.map(i=>jsxRuntime.jsx(cu,{value:i.styleId},i.styleId));return e?jsxRuntime.jsx(W,{...r,children:a}):jsxRuntime.jsx("div",{...r,children:a})}function cu({value:e,asChild:t,className:n,children:o}){let r=_l();if(!r)return null;let a=r.value===e,i=r.options.find(l=>l.styleId===e),s={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:i?wh(i.preview):void 0,children:i?.name??e});return t?jsxRuntime.jsx(W,{...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 Rh({hidden:e,asChild:t,className:n,children:o}){let r=ca(),[a,i]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let p=g=>{let m=s.current;m&&g.target instanceof Node&&m.contains(g.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let l={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nl,{}),jsxRuntime.jsx(su,{})]});return jsxRuntime.jsx(lu.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...l,ref:s,children:d}):jsxRuntime.jsx("div",{ref:s,...l,children:d})})}var Dl=Object.assign(Rh,{docxSlot:"styles.style",Trigger:Nl,Content:su,Item:cu});function uu(e,t){let n=e;return Object.assign(({className:r,hidden:a,icon:i,asChild:s,children:c})=>{let{isEnabled:l,disabledReason:d}=ne(n),p=pt(),g=t==="showAll"?p.showAll:p.formFill,m=Y();if(a)return null;let f=ee(n),u=m(f?.labelKey??e),h={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!l,...l?{}:{"data-disabled":""},...g?{"data-active":""}:{},"aria-pressed":g,"aria-label":u,title:d??u,onMouseDown:O,onClick:()=>{t==="showAll"?p.toggleShowAll():p.toggleFormFill();}};return s?jsxRuntime.jsx(W,{...h,children:c}):jsxRuntime.jsx("button",{...h,children:i??c??te(f?.paths)})},{docxSlot:n})}function Nh({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=Be.inspector,{isEnabled:i,disabledReason:s}=ne(a),{inspectorOpen:c,openInspector:l}=pt(),d=Y();if(t)return null;let p=ee(a),g=d(p?.labelKey??"contentControl.inspector"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.inspector,disabled:!i,...i?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":g,title:s??g,onMouseDown:O,onClick:()=>l()};return o?jsxRuntime.jsx(W,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??te(p?.paths)})}function Dh({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:s}=pt(),c=Y();if(t)return null;let l=Be.remove,d=ee(l),p=c(d?.labelKey??"contentControl.remove"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.remove,disabled:!a,...a?{}:{"data-disabled":""},"aria-label":p,title:i??p,onMouseDown:O,onClick:()=>{s();}};return o?jsxRuntime.jsx(W,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??te(d?.paths)})}var da=uu(Be.showAll,"showAll"),ua=uu(Be.formFill,"formFill"),pa=Object.assign(Dh,{docxSlot:Be.remove}),ma=Object.assign(Nh,{docxSlot:Be.inspector}),pu={[Be.showAll]:da,[Be.formFill]:ua,[Be.inspector]:ma,[Be.remove]:pa};function Ll(e,t){let n=A(),o=Ye.useRef(t);o.current=t,Ye.useEffect(()=>{if(!n)return;let r=((...a)=>{o.current(...a);});return n.on(e,r)},[n,e]);}var Bh=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Fl=Ye.createContext(null);function yu(){let e=Ye.useContext(Fl);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Kh(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",a=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.columnIndex}`:"",i=t.selection,s=i?`${i.from&&"paraId"in i.from?i.from.paraId:""}|${i.to&&"paraId"in i.to?i.to.paraId:""}|${t.selectionCollapsed}`:"",c=e?.getTableCellSelection()??null,l=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:a,selectionKey:s,cellSelectionKey:l,editable:t.editable,editingMode:t.editingMode??"editing"}}function zh(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Vh(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var hu={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function $h(e,t){let n={};for(let o of Bh){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Al({children:e}){let t=A(),[n,o]=Ye.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,a]=Ye.useState(hu);Ye.useEffect(()=>(()=>{}),[]);let i=q(Ye.useCallback(g=>({table:g.table,editable:g.editable,editingMode:g.editingMode??"editing",headParagraphId:g.selection?.to&&"paraId"in g.selection.to?g.selection.to.paraId:g.selection?.from&&"paraId"in g.selection.from?g.selection.from.paraId:""}),[]),zh,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),s=Ye.useCallback(()=>{if(!t){a(hu);return}let g=Kh(t,t.snapshot());a(m=>Vh(m,g)?m:g);},[t]);Ye.useEffect(()=>{s();},[s,i]),Ll("selectionChange",Ye.useCallback(()=>{s();},[s]));let c=r.tableKey!=="",l=Ye.useMemo(()=>t?$h(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Ye.useCallback((g,m)=>{if(!t)return;let{result:f,nextDraft:u}=editor.runTableChromeCommand(t,g,m,n);f.ok&&u&&o(u);},[t,n]),p=Ye.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:g=>l[g]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,l,d]);return jsxRuntime.jsx(Fl.Provider,{value:p,children:e})}function Wh(){let e=Ye.useContext(Fl);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ga(e){let t=Wh(),n=t.slotState(e);return Ye.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Gh='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Jt(e){return [...e.querySelectorAll(Gh)].filter(t=>t.closest('[role="menu"]')===e)}function Ol(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function at(e,t,n){if(e.length===0)return false;let o=t?e.indexOf(t):-1,r=o===-1?n>0?0:e.length-1:(o+n+e.length)%e.length;return e[r]?.focus(),true}function it(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function ba(e){(Fo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function Bl(e,t,n){Ye.useEffect(()=>{if(!e)return;let o=r=>{let a=n.current;a&&r.target instanceof Node&&a.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function ha({enabled:e,disabledReason:t,ariaLabel:n}){let o=Ye.useId(),r=!e&&t?o:void 0;return {reasonId:o,shared:{type:"button",onMouseDown:O,"aria-label":n,...r?{"aria-describedby":r}:{},...t?{title:t}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:r&&t?jsxRuntime.jsx("span",{id:o,className:"docx-editor-sr-only",children:t}):null}}var Xh='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function xu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll(Xh)].filter(l=>l.closest('[role="menu"]')===r);queueMicrotask(()=>{let l=i();(l.find(p=>p.hasAttribute("data-selected")||p.hasAttribute("data-active"))??l[0])?.focus();});let c=l=>{let d=i();if(l.key==="Escape"){l.preventDefault(),t(false),a?.focus();return}if(l.key==="ArrowDown"){l.preventDefault(),at(d,document.activeElement,1);return}if(l.key==="ArrowUp"){l.preventDefault(),at(d,document.activeElement,-1);return}if(l.key==="Home"){l.preventDefault(),it(d,"first");return}if(l.key==="End"){l.preventDefault(),it(d,"last");return}if(l.key==="Enter"||l.key===" "){let p=document.activeElement;p instanceof HTMLElement&&d.includes(p)&&(l.preventDefault(),p.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function Tu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{i()[0]?.focus();});let s=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),a?.focus();return}if(c.key==="Enter"||c.key===" "){let l=document.activeElement,d=i();l instanceof HTMLElement&&d.includes(l)&&(c.preventDefault(),l.click());}};return r.addEventListener("keydown",s),()=>r.removeEventListener("keydown",s)},[e,t,n,o]);}function wu(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function nv(e){return te(editor.tableChromeIconPaths(e))}function Mu(){return Ye.createContext(null)}function Pt(e){let t=Ye.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function Kl(e,t,n){let o=Mu();function r({hidden:s,asChild:c,className:l,children:d}){let{visible:p,enabled:g,disabledReason:m,draft:f,apply:u}=ga(e),[h,b]=Ye.useState(false),v=Ye.useRef(null),C=Ye.useRef(null);Bl(h,b,v);let P=Ye.useMemo(()=>({open:h,setOpen:b,enabled:g,disabledReason:m,apply:u,draft:f,triggerRef:C}),[h,g,m,u,f]);if(s||!p)return null;let S={className:`${t}${l?` ${l}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},y=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(i,{})]});return jsxRuntime.jsx(o.Provider,{value:P,children:c?jsxRuntime.jsx(W,{...S,ref:v,children:y}):jsxRuntime.jsx("div",{ref:v,...S,children:y})})}function a({asChild:s,className:c,children:l}){let{open:d,setOpen:p,enabled:g,disabledReason:m,triggerRef:f}=Pt(o),u=Y(),h=ee(e),b=u(h?.labelKey??n),{shared:v,reasonNode:C}=ha({enabled:g,disabledReason:m,ariaLabel:b}),P={...v,ref:f,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:g?()=>p(!d):void 0,...s?{tabIndex:g?0:-1,role:"button",onKeyDown:wu(g,d,p)}:{}},S=l??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...P,children:S}),C]}):jsxRuntime.jsxs("button",{...P,children:[S,C]})}a.docxToolbarPart=true;function i({asChild:s,className:c,children:l}){let{open:d,setOpen:p,enabled:g,triggerRef:m}=Pt(o),f=Y(),u=Ye.useRef(null);if(xu(d&&g,p,u,m),!d||!g)return null;let h=ee(e),b=f(h?.labelKey??n),v={ref:u,role:"menu","aria-label":b,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:O};return s?jsxRuntime.jsx(W,{...v,children:l}):jsxRuntime.jsx("div",{...v,children:l})}return {Root:r,Trigger:a,Content:i,Ctx:o}}var Nn=Kl("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function ku({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Nn.Ctx),s=Y(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(g=>g.value===e);if(!c)return null;let l=c.value==="none"?false:c.value===i.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":l,"data-value":c.value,className:`docx-table-chrome__target-btn${n?` ${n}`:""}`,...l?{"data-active":""}:{},"aria-label":s(c.labelKey),title:s(c.labelKey),onMouseDown:O,onClick:()=>{a(false),r(c.value);}},p=o??nv(c.icon);return t?jsxRuntime.jsx(W,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function Iu(e){let{children:t}=e;return jsxRuntime.jsx(Nn.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(ku,{value:n.value},n.value))})})}function rv(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nn.Trigger,{}),jsxRuntime.jsx(Iu,{})]});return jsxRuntime.jsx(Nn.Root,{...e,children:n})}var An=Object.assign(rv,{docxSlot:"table.borderTarget",Trigger:Nn.Trigger,Content:Iu,Item:ku}),Dn=Kl("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Ru({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Dn.Ctx),s=Y(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(g=>g.value===e);if(!c)return null;let l=c.value===i.spec.style,d={type:"button",role:"menuitemradio","aria-checked":l,...l?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(false),r(c.value);}},p=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${c.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(c.labelKey)})]});return t?jsxRuntime.jsx(W,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function _u(e){let{children:t}=e;return jsxRuntime.jsx(Dn.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Ru,{value:n.value},n.value))})}function av(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Dn.Trigger,{}),jsxRuntime.jsx(_u,{})]});return jsxRuntime.jsx(Dn.Root,{...e,children:t})}var On=Object.assign(av,{docxSlot:"table.borderStyle",Trigger:Dn.Trigger,Content:_u,Item:Ru}),Ln=Kl("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Nu({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Pt(Ln.Ctx),s=Y(),c=Number(e),l=editor.TABLE_BORDER_WIDTH_OPTIONS.find(m=>m.size===c);if(!l)return null;let d=l.size===i.spec.size,p={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(false),r(l.size);}},g=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${l.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:s(l.labelKey)})]});return t?jsxRuntime.jsx(W,{...p,children:g}):jsxRuntime.jsx("button",{...p,children:g})}function Du(e){let{children:t}=e;return jsxRuntime.jsx(Ln.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(Nu,{value:String(n.size)},n.size))})}function iv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ln.Trigger,{}),jsxRuntime.jsx(Du,{})]});return jsxRuntime.jsx(Ln.Root,{...e,children:t})}var Zn=Object.assign(iv,{docxSlot:"table.borderWidth",Trigger:Ln.Trigger,Content:Du,Item:Nu});function Lu(e,t,n){let o=n?.defaultHex??"FF0000",r=Mu();function a({hidden:d,asChild:p,className:g,children:m}){let{visible:f,enabled:u,disabledReason:h,draft:b,apply:v}=ga(e),[C,P]=Ye.useState(false),[S,y]=Ye.useState(o),x=Ye.useRef(null),M=Ye.useRef(null);Bl(C,P,x);let E=Ye.useMemo(()=>({open:C,setOpen:P,enabled:u,disabledReason:h,apply:v,draft:b,triggerRef:M,lastHex:S,setLastHex:y}),[C,u,h,v,b,S]);if(d||!f)return null;let w={className:`docx-toolbar__colorsplit docx-table-chrome${g?` ${g}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},N=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(s,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:E,children:p?jsxRuntime.jsx(W,{...w,ref:x,children:N}):jsxRuntime.jsx("div",{ref:x,...w,children:N})})}function i({asChild:d,className:p,children:g}){let{enabled:m,disabledReason:f,apply:u,draft:h,lastHex:b}=Pt(r),v=Y(),C=ee(e),P=v(C?.labelKey??t),{shared:S,reasonNode:y}=ha({enabled:m,disabledReason:f,ariaLabel:P}),x=e==="table.borderColor"&&h.spec.color.kind==="hex"?h.spec.color.value:b??o,M={...S,className:`docx-toolbar__button docx-toolbar__colorsplit-main${p?` ${p}`:""}`,onClick:m?()=>u({kind:"hex",value:x}):void 0},E=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(C?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${x.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...M,children:E}),y]}):jsxRuntime.jsxs("button",{...M,children:[E,y]})}i.docxToolbarPart=true;function s({asChild:d,className:p,children:g}){let{open:m,setOpen:f,enabled:u,disabledReason:h,triggerRef:b}=Pt(r),v=Y(),C=ee(e),P=v(C?.labelKey??t),{shared:S,reasonNode:y}=ha({enabled:u,disabledReason:h,ariaLabel:P}),x={...S,ref:b,className:`docx-toolbar__colorsplit-caret${p?` ${p}`:""}`,"aria-haspopup":"dialog","aria-expanded":m,onClick:u?()=>f(!m):void 0,...d?{tabIndex:u?0:-1,role:"button",onKeyDown:wu(u,m,f)}:{}},M=g??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...x,children:M}),y]}):jsxRuntime.jsxs("button",{...x,children:[M,y]})}s.docxToolbarPart=true;function c({asChild:d,className:p,children:g,clearFill:m}){let{open:f,setOpen:u,enabled:h,apply:b,draft:v,triggerRef:C,lastHex:P,setLastHex:S}=Pt(r),y=Y(),x=Ye.useRef(null);if(Tu(f&&h,u,x,C),!f||!h)return null;let M=y(t),E=e==="table.borderColor"&&v.spec.color.kind==="hex"?v.spec.color.value:P??o,w={ref:x,role:"dialog","aria-label":M,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${p?` ${p}`:""}`,onMouseDown:O},N=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>{u(false),b(null),ba(C.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),y("table.clearCellFill")]}):null,jsxRuntime.jsx(xl,{apply:F=>{u(false),S?.(F),b({kind:"hex",value:F}),ba(C.current);},current:E})]});return d?jsxRuntime.jsx(W,{...w,children:N}):jsxRuntime.jsx("div",{...w,children:N})}function l({value:d,css:p,labelKey:g,asChild:m,className:f,children:u}){let{apply:h,setOpen:b,setLastHex:v,triggerRef:C}=Pt(r),P=Y(),S=p??`#${d.toLowerCase()}`,y=g?P(g):d,x={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${f?` ${f}`:""}`,style:{backgroundColor:S},"data-value":d,"aria-label":y,title:y,onMouseDown:O,onClick:()=>{b(false),v?.(d),h({kind:"hex",value:d}),ba(C.current);}};return m?jsxRuntime.jsx(W,{...x,children:u}):jsxRuntime.jsx("button",{...x,children:u})}return {Root:a,Main:i,Trigger:s,Content:c,Item:l,Ctx:r}}var Hn=Lu("table.borderColor","table.borderColor",{defaultHex:"000000"});function lv(e){return jsxRuntime.jsx(Hn.Content,{...e,clearFill:false})}function sv(e){return jsxRuntime.jsx(Hn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function cv(e){return jsxRuntime.jsx(Hn.Root,{...e})}var Bn=Object.assign(cv,{docxSlot:"table.borderColor",Trigger:Hn.Trigger,Content:lv,Item:sv,Main:Hn.Main}),Fn=Lu("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function dv(e){return jsxRuntime.jsx(Fn.Content,{...e,clearFill:true})}function uv(e){return jsxRuntime.jsx(Fn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function pv(e){return jsxRuntime.jsx(Fn.Root,{...e})}var qn=Object.assign(pv,{docxSlot:"table.cellFill",Trigger:Fn.Trigger,Content:dv,Item:uv,Main:Fn.Main});function Hu({overrides:e=new Map}){return yu()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ho,{}),[An,Bn,On,Zn,qn].map(o=>{let r=e.get(o.docxSlot);return r?jsxRuntime.jsx(Ye.Fragment,{children:r},o.docxSlot):jsxRuntime.jsx(o,{},o.docxSlot)})]}):null}function Fu(){let e=Y(),{draft:t}=ga("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var Bu=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],qu={"zoom.level":bl,"styles.style":Dl,"font.family":kl,"font.size":gl,"text.color":Tl,"text.highlight":Sl,"text.link":dl,"list.lineSpacing":vl,"review.editingMode":Ur,"file.save":ul,...pu,"table.borderTarget":An,"table.borderColor":Bn,"table.borderStyle":On,"table.borderWidth":Zn,"table.cellFill":qn,"image.insert":un,"image.properties":Pn,"image.wrap":Tn,"image.altText":Sn},Ou=new Map;function gv(e){let t=Ou.get(e);return t||(t=n=>jsxRuntime.jsx(Xt,{slot:e,...n}),Ou.set(e,t)),t}function bv(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:la}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:qu[o]??gv(o)}})})}var hv=e=>e.image;function vv(e){return e==="alignment"||e in qu}function $l(e){let t=No(e,$l);if(t!==null)return t;if(!Ye.isValidElement(e))return null;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxToolbarPart===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function zl(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(zl);let t=$l(e);return t!=null&&Bu.includes(t)?true:Ye.isValidElement(e)?Ye.Children.toArray(e.props.children).some(zl):false}function yv(e,t){return t?true:Ye.Children.toArray(e).some(zl)}function xv(e){let t=Xe(),{className:n,t:o,onSave:r,preset:a=true,overflow:i=true,children:s}=e,c=Ye.useMemo(()=>({t:o,onSave:r}),[o,r]),l=Ni(o),d=q(hv),p=Ye.useMemo(()=>bv(d),[d]),g=Ye.useMemo(()=>new Set(p.flatMap(C=>C.entries.map(P=>P.slot))),[p]),m=Ye.useMemo(()=>p.map(C=>C.id).filter(C=>!Xi.has(C)),[p]),f=Ye.useMemo(()=>ed(m),[m]),u=a&&i,{attach:h,overflow:b}=dd(u,m,f),v;if(!a)v=s;else {let C=Ye.Children.toArray(s),P=new Map,S=new Map,y=[];for(let N of C){let F=$l(N);F&&g.has(F)?P.set(F,N):F&&Bu.includes(F)?S.set(F,N):y.push(N);}let x=N=>{let F=P.get(N.slot);if(F)return F;let H=N.Part;return jsxRuntime.jsx(H,{})},M=[],E=[],w=0;for(let N of p){if(b.has(N.id)){let H=N.entries.flatMap(I=>{let D=Sv(I,P,l,N.labelKey,x);return D===null?[]:[jsxRuntime.jsx(Ye.Fragment,{children:D},I.slot)]});if(H.length===0)continue;E.push({id:N.id,labelKey:N.labelKey,children:H});continue}w>0&&M.push(jsxRuntime.jsx(Ho,{},`separator-${N.id}`)),w+=1;let F=Xi.has(N.id);M.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...F?{[yn]:""}:{[vn]:N.id},children:N.entries.map(H=>jsxRuntime.jsx(Ye.Fragment,{children:x(H)},H.slot))},N.id));}v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M,jsxRuntime.jsx(Hu,{overrides:S}),y.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[yn]:"",children:y}):null,E.length>0?jsxRuntime.jsx(gd,{sections:E}):null]});}return jsxRuntime.jsx(dn.Provider,{value:c,children:jsxRuntime.jsx("div",{ref:h,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...u?{"data-overflow":""}:{},onMouseDown:O,children:yv(s,a)?jsxRuntime.jsx(Al,{children:v}):v})})}function Tv(e){return e?!!e.props.hidden:false}function Sv(e,t,n,o,r){let a=t.get(e.slot);return Tv(a)?null:a||vv(e.slot)?jsxRuntime.jsx(md,{label:Cv(n,e,o),children:r(e)}):jsxRuntime.jsx(fd,{slot:e.slot})}function Cv(e,t,n){let o=t.slot==="alignment"?null:ee(t.slot);return e(o?.labelKey??n)}var zn=Object.assign(xv,{Button:Xt,Action:Pl,Separator:Ho,Undo:Pd,Redo:Ed,Bold:wd,Italic:Md,Underline:kd,Strike:Id,Link:dl,ClearFormatting:Rd,Superscript:_d,Subscript:Nd,Alignment:la,AlignLeft:Dd,AlignCenter:Ld,AlignRight:Hd,AlignJustify:Fd,LineSpacing:vl,BulletList:Ad,NumberedList:Od,Outdent:Zd,Indent:Bd,ImageInsert:un,ImageProperties:Pn,ImageWrap:Tn,ImageAltText:Sn,TableInsert:qd,TableBorderTarget:An,TableBorderColor:Bn,TableBorderStyle:On,TableBorderWidth:Zn,TableCellFill:qn,Comments:Kd,FontFamily:kl,FontSize:gl,FontColor:Tl,Highlight:Sl,Zoom:bl,StylePicker:Dl,EditingMode:Ur,Save:ul,ContentControlShowAll:da,ContentControlFormFill:ua,ContentControlInspector:ma,ContentControlRemove:pa});var Mv=e=>e.pageSetup??null,kv=e=>e.editable;function eo(){let e=A(),t=q(Mv),n=q(kv),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=Ye.useCallback(a=>e?e.exec({...a.pageWidthTwips!==void 0?{pageWidth:a.pageWidthTwips}:{},...a.pageHeightTwips!==void 0?{pageHeight:a.pageHeightTwips}:{},...a.orientation!==void 0?{orientation:a.orientation}:{},...a.marginTopTwips!==void 0?{marginTop:a.marginTopTwips}:{},...a.marginRightTwips!==void 0?{marginRight:a.marginRightTwips}:{},...a.marginBottomTwips!==void 0?{marginBottom:a.marginBottomTwips}:{},...a.marginLeftTwips!==void 0?{marginLeft:a.marginLeftTwips}:{},...a.scope!==void 0?{scope:a.scope}:{},type:"setPageSetup"}).ok:false,[e]);return Ye.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var Ul=[{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}],Yu=1440,Iv=e=>Math.round(e/Yu*100)/100,Rv=e=>Math.round(e*Yu);function _v(e,t){let n=Math.min(e,t),o=Math.max(e,t);return Ul.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var Nv={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Dv={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},Lv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},Hv={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},$u={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},va={display:"flex",alignItems:"center",gap:12},ya={width:80,fontSize:13,color:"var(--doc-text-muted)"},xa={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Fv={fontSize:11,color:"var(--doc-text-muted)",width:16},Av={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Wu={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Uu=12240,Gu=15840,Ht=1440;function Vn({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:a,apply:i}=eo(),[s,c]=Ye.useState(Uu),[l,d]=Ye.useState(Gu),[p,g]=Ye.useState("portrait"),[m,f]=Ye.useState(Ht),[u,h]=Ye.useState(Ht),[b,v]=Ye.useState(Ht),[C,P]=Ye.useState(Ht),[S,y]=Ye.useState("document"),x=Ye.useRef(null),M=Ye.useRef("no");Ye.useEffect(()=>{if(!e){M.current="no";return}if(M.current==="yes"&&r===null){M.current="no";return}M.current==="yes"||M.current==="loading"&&r===null||(c(r?.pageWidthTwips??Uu),d(r?.pageHeightTwips??Gu),g(r?.orientation??"portrait"),f(r?.marginsTwips.top??Ht),h(r?.marginsTwips.bottom??Ht),v(r?.marginsTwips.left??Ht),P(r?.marginsTwips.right??Ht),y("document"),M.current=r===null?"loading":"yes");},[e,r]),Ye.useEffect(()=>{e&&x.current?.focus();},[e]);let E=Ye.useCallback(I=>{let D=Ul[I];D&&(c(p==="landscape"?D.height:D.width),d(p==="landscape"?D.width:D.height));},[p]),w=Ye.useCallback(I=>{I!==p&&(g(I),c(l),d(s));},[p,s,l]),N=Ye.useCallback(()=>{i({pageWidthTwips:s,pageHeightTwips:l,orientation:p,marginTopTwips:m,marginRightTwips:C,marginBottomTwips:u,marginLeftTwips:b,scope:S})&&t();},[i,s,l,p,m,C,u,b,S,t]);if(!e)return null;let F=_v(s,l),H=(I,D,k)=>jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("input",{type:"number",style:xa,min:0,max:22,step:.1,value:Iv(D),onChange:R=>k(Math.max(0,Rv(Number(R.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("span",{style:Fv,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:Nv,onClick:t,onKeyDown:I=>{I.key==="Escape"&&t(),I.key==="Enter"&&N();},children:jsxRuntime.jsxs("div",{ref:x,tabIndex:-1,style:Dv,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:Lv,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:Hv,children:[jsxRuntime.jsx("div",{style:$u,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:xa,value:F,onChange:I=>E(Number(I.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[Ul.map((I,D)=>jsxRuntime.jsx("option",{value:D,children:o(I.labelKey)},I.labelKey)),F<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:xa,value:p,onChange:I=>w(I.target.value),"aria-label":o("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:o("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:o("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...$u,marginTop:4},children:o("dialogs.pageSetup.margins")}),H("top",m,f),H("bottom",u,h),H("left",b,v),H("right",C,P),jsxRuntime.jsxs("div",{style:va,children:[jsxRuntime.jsx("label",{style:ya,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:xa,value:S,onChange:I=>y(I.target.value),"aria-label":o("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:o("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:o("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{style:Av,children:[jsxRuntime.jsx("button",{type:"button",style:Wu,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Wu,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:a?1:.5},disabled:!a,onClick:N,children:o("common.apply")})]})]})})}var $n=Ye.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0});function ft(){return Ye.useContext($n)}function Oe(){let{t:e}=ft(),{t}=_();return n=>e?.(n)??t(n)}var Bv=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,qv=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Xu=new TextEncoder;function Kv(e,t){if(Xu.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let a=Xu.encode(r).length;if(n+a>t)break;n+=a,o+=r;}return o}function ju(e){let t=Kv((e??"").replace(/\.docx$/i,"").replace(qv," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||Bv.test(t)?"document.docx":`${t}.docx`}function Qu(e,t){let n=URL.createObjectURL(new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})),o=document.createElement("a");o.href=n,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}var zv="https://github.com/eigenpal/docx-editor/issues/new";function Vv(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Ju(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),n=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??Vv()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
- `),a=new URLSearchParams({title:"[Bug] ",body:r});return `${zv}?${a.toString()}`}function Wn(e){typeof window>"u"||window.open(Ju(e),"_blank","noopener,noreferrer");}var Ta=6,Gl=6;function Le(e){let{icon:t,shortcut:n,disabled:o,title:r,active:a,selected:i,slot:s,onSelect:c,className:l,children:d}=e,p=Ye.useId(),g=o&&r?p:void 0;return jsxRuntime.jsxs("button",{type:"button",role:a===void 0?"menuitem":i===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${l?` ${l}`:""}`,tabIndex:-1,...s?{"data-slot":s}:{},...a?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...a!==void 0?{"aria-checked":a}:{},...g?{"aria-describedby":g}:{},...r?{title:r}:{},onMouseDown:O,onClick:o?void 0:c,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),n?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:n}):null,g?jsxRuntime.jsx("span",{id:p,className:"docx-editor-sr-only",children:r}):null]})}function Gn({label:e,labelKey:t,className:n,hidden:o,children:r}){let a=Oe();if(o)return null;let i=e??(t===void 0?void 0:a(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...i?{"aria-label":i}:{},children:[i?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:i}):null,r]})}function gt({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:a,isActive:i,isEnabled:s,disabledReason:c}=ne(e),{setOpenMenu:l}=ft(),d=Oe();if(r)return null;let p=ee(e),g=d(t??p?.labelKey??e),m=editor.commandForSlot(e),f=m?.type==="toggleMark"||m?.type==="setAlignment",u=m?.type==="setAlignment";return jsxRuntime.jsx(Le,{slot:e,icon:te(p?.paths),...n?{shortcut:d(n)}:{},disabled:!s,...c?{title:c}:{},...f?{active:i}:{},...u?{selected:true}:{},onSelect:()=>{a(),l(null);},...o?{className:o}:{},children:g})}gt.docxMenuRow=true;function tp(e,t,n,o){return Object.assign(({className:a,hidden:i})=>{let s=ft(),c=Oe(),l=o(s);if(i)return null;let d=ee(e),p=c(t??d?.labelKey??e);return jsxRuntime.jsx(Le,{slot:e,icon:te(d?.paths),...n?{shortcut:c(n)}:{},disabled:!l,onSelect:()=>{l?.(),s.setOpenMenu(null);},...a?{className:a}:{},children:p})},{docxSlot:e})}var Xl=tp("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),jl=tp("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function Xv({className:e,hidden:t}){let n=A(),o=ft(),r=Oe(),a=editor.chromeProbeForSlot("file.pageSetup"),i=n&&a?n.can(a):null,s=i?.ok===true,c=i&&!i.ok?i.reason:null;if(t)return null;let l=ee("file.pageSetup"),d=r(l?.labelKey??"file.pageSetup"),p=s&&!!o.onPageSetup;return jsxRuntime.jsx(Le,{slot:"file.pageSetup",icon:te(l?.paths),disabled:!p,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var Ql=Object.assign(Xv,{docxSlot:"file.pageSetup"});function jv({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=_r(),a=ft(),i=Oe();if(t)return null;let s=ee("image.insert"),c=i(s?.labelKey??"toolbar.image");return jsxRuntime.jsx(Le,{slot:"image.insert",icon:te(s?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),a.setOpenMenu(null);},...e?{className:e}:{},children:c})}var Qv=Object.assign(jv,{docxSlot:"image.insert"}),Un=8;function oo({labelKey:e,paths:t,className:n,children:o}){let r=Oe(),[a,i]=Ye.useState(false),s=Ye.useRef(null),c=Ye.useRef(null),l=Ye.useId(),d=r(e),[p,g]=Ye.useState(null);return Ye.useLayoutEffect(()=>{if(!a){g(null);return}let m=s.current,f=c.current,u=m?.ownerDocument.defaultView;if(!m||!f||!u)return;let h=m.getBoundingClientRect(),b=f.offsetWidth,v=f.offsetHeight,C=h.right+b>u.innerWidth-Un;g({left:C?Math.max(Un,h.left-b):Math.min(h.right,u.innerWidth-b-Un),top:Math.max(Un,Math.min(h.top-4,u.innerHeight-v-Un))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onKeyDown:m=>{m.key==="ArrowRight"&&document.activeElement===s.current?(m.preventDefault(),i(true),queueMicrotask(()=>{c.current&&it(Jt(c.current),"first");})):(m.key==="ArrowLeft"||m.key==="Escape")&&a&&(m.preventDefault(),m.stopPropagation(),i(false),s.current?.focus());},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||i(false);},children:[jsxRuntime.jsxs("button",{ref:s,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?l:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:O,onFocus:()=>i(true),onClick:()=>i(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:te(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:l,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:p?{position:"fixed",left:p.left,top:p.top}:{position:"fixed",visibility:"hidden"},onKeyDown:m=>{let f=c.current;if(!f)return;let u=Jt(f);m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),at(u,document.activeElement,1)):m.key==="ArrowUp"&&(m.preventDefault(),m.stopPropagation(),at(u,document.activeElement,-1));},children:o}):null]})}function Ca({slot:e="table.insert",className:t}){let n=A(),{isEnabled:o}=ne(e),{setOpenMenu:r}=ft(),[a,i]=Ye.useState(null),[s,c]=Ye.useState({rows:1,cols:1}),l=Ye.useRef(null),d=Ye.useCallback((m,f)=>{if(!n||!o)return;let u={type:"insertTable",rows:m,cols:f};n.can(u).ok&&(n.exec(u),r(null),n.focus());},[n,o,r]),p=Ye.useCallback(m=>{c(f=>{let u={rows:Math.min(Gl,Math.max(1,f.rows+(m.rows??0))),cols:Math.min(Ta,Math.max(1,m.toCol??f.cols+(m.cols??0)))};return i(u),queueMicrotask(()=>l.current?.querySelector(`[data-cell="${u.rows}x${u.cols}"]`)?.focus()),u});},[]),g=[];for(let m=1;m<=Gl;m+=1){let f=[];for(let u=1;u<=Ta;u+=1){let h=!!a&&m<=a.rows&&u<=a.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${m}x${u}`,className:"docx-menubar__grid-cell",tabIndex:s.rows===m&&s.cols===u?0:-1,...h?{"data-filled":""}:{},"aria-label":`${u} \xD7 ${m}`,onMouseDown:O,onMouseEnter:()=>i({rows:m,cols:u}),onFocus:()=>i({rows:m,cols:u}),onClick:()=>d(m,u)},u));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},m));}return jsxRuntime.jsxs("div",{ref:l,role:"grid","aria-label":`${Ta} \xD7 ${Gl}`,className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>i(null),onKeyDown:m=>{if(m.key==="ArrowRight")p({cols:1});else if(m.key==="ArrowLeft")p({cols:-1});else if(m.key==="ArrowDown")p({rows:1});else if(m.key==="ArrowUp")p({rows:-1});else if(m.key==="Home")p({toCol:1});else if(m.key==="End")p({toCol:Ta});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 Jv({entry:e}){let{isEnabled:t}=ne(e.slot),n=ee(e.slot);return t?jsxRuntime.jsx(oo,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(Ca,{slot:e.slot})}):jsxRuntime.jsx(gt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function no({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function Yn({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(no,{}):e.kind==="submenu"?jsxRuntime.jsx(oo,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(Yn,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(Xl,{}):e.slot==="file.save"?jsxRuntime.jsx(jl,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(Ql,{}):e.slot==="image.insert"?jsxRuntime.jsx(Qv,{}):e.picker==="tableGrid"?jsxRuntime.jsx(Jv,{entry:e}):jsxRuntime.jsx(gt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function op(e){if(!Ye.isValidElement(e))return null;let t=No(e,op);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function ey(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function ty(e,t,n){return Yr({entries:e??[],children:t,preset:n,keyOfEntry:ey,keyOfChild:op,renderEntry:o=>jsxRuntime.jsx(Yn,{entry:o})})}function Zo({id:e,labelKey:t,label:n,icon:o,className:r,hidden:a,preset:i=true,children:s}){let{openMenu:c,setOpenMenu:l,activeMenu:d}=ft(),p=Oe(),g=Ye.useId(),m=Ye.useRef(null),f=Ye.useRef(null),u=Ye.useRef(false),h=Ye.useRef(false),b=editor.CHROME_MENUS.find(y=>y.id===e),v=c===e;if(a)return null;let C=n??p(t??b?.labelKey??e),P=ty(b?.entries,s,i),S=()=>{l(null),m.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,children:[jsxRuntime.jsxs("button",{ref:m,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":v,"aria-controls":v?g:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...v?{"data-open":""}:{},onMouseDown:O,onKeyDown:y=>{y.key==="ArrowDown"||y.key==="Enter"||y.key===" "||y.key==="ArrowUp"?(y.preventDefault(),u.current=true,l(e)):y.key==="Escape"&&v&&(y.preventDefault(),S());},onClick:()=>{if(h.current){h.current=false;return}l(v?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(h.current=true,l(e));},onMouseLeave:()=>{h.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,C]}),v?jsxRuntime.jsx("div",{ref:y=>{f.current=y,y&&u.current&&(u.current=false,it(Jt(y),"first"));},id:g,role:"menu","aria-label":C,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:y=>{let x=f.current;if(!x)return;let M=Jt(x),E=document.activeElement;y.key==="ArrowDown"?(y.preventDefault(),at(M,E,1)):y.key==="ArrowUp"?(y.preventDefault(),at(M,E,-1)):y.key==="Home"?(y.preventDefault(),it(M,"first")):y.key==="End"?(y.preventDefault(),it(M,"last")):y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),S()):y.key==="Tab"&&l(null);},children:P}):null]})}function Jl(e){return Object.assign(n=>jsxRuntime.jsx(Zo,{id:e,...n}),{docxMenu:e})}var es=Jl("file"),ts=Jl("format"),os=Jl("insert");function oy({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:a}=ft(),i=Oe();if(t||a===false)return null;let s=n??r??Wn;return jsxRuntime.jsx(Le,{slot:"help.reportIssue",onSelect:()=>{s(),o(null);},...e?{className:e}:{},children:i("toolbar.reportIssue")})}var Pa=Object.assign(oy,{docxSlot:"help.reportIssue"});function ny({children:e,...t}){let{reportIssue:n}=ft();return e===void 0&&n===false?null:jsxRuntime.jsxs(Zo,{id:"help",...t,children:[jsxRuntime.jsx(Pa,{}),e]})}var ns=Object.assign(ny,{docxMenu:"help"});var iy={file:es,format:ts,insert:os,help:ns},ly=new Set(editor.CHROME_MENUS.map(e=>e.id));function cp(e){if(!Ye.isValidElement(e))return null;if(e.type===Ye.Fragment){let o=Ye.Children.toArray(e.props.children).map(cp).filter(r=>r!==null);return o.length===1?o[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===Zo){let n=e.props.id;if(typeof n=="string"&&ly.has(n))return n}return null}function sy(e){let t=Xe(),{className:n,t:o,fileName:r,onOpen:a,onOpenFile:i,onSave:s,onPageSetup:c,onReportIssue:l,reportIssue:d,preset:p=true,children:g}=e,m=A(),{t:f}=_(),[u,h]=Ye.useState(null),[b,v]=Ye.useState(null),[C,P]=Ye.useState(null),[S,y]=Ye.useState(false),x=Ye.useRef(null),M=Ye.useRef(null);Ye.useEffect(()=>{if(u===null)return;let z=$=>{let Q=x.current;Q&&$.target instanceof Node&&Q.contains($.target)||h(null);},Z=$=>{$.key==="Escape"&&h(null);};return document.addEventListener("mousedown",z),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",Z);}},[u]);let E=Ye.useCallback(z=>{h(z),z!==null&&P(z);},[]),w=Ye.useCallback(()=>M.current?.click(),[]),N=Ye.useCallback(()=>{m&&m.save().then(z=>Qu(z,ju(r??b??void 0))).catch(z=>{console.error("[docx-editor] save failed",z);});},[m,r,b]),F=Ye.useCallback(()=>y(true),[]),H=m?a??w:void 0,I=m?s??N:void 0,D=m?c??F:void 0;Ye.useEffect(()=>{let z=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.altKey||Z.shiftKey)return;let $=Z.key.toLowerCase();if($!=="s"&&$!=="o")return;let Q=Z.target,Me=Fo(x.current)??x.current;!Q||!Me?.contains(Q)||($==="s"&&I?(Z.preventDefault(),I()):$==="o"&&H&&(Z.preventDefault(),H()));};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[H,I]);let k=Ye.useMemo(()=>({t:o,openMenu:u,setOpenMenu:E,activeMenu:C,onOpen:H,onSave:I,onPageSetup:D,onReportIssue:l,reportIssue:d}),[o,u,E,C,H,I,D,l,d]),R;if(!p)R=g;else {let z=new Map,Z=[];for(let $ of Ye.Children.toArray(g)){let Q=cp($);Q?z.set(Q,$):Z.push($);}R=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map($=>{let Q=z.get($.id);if(Q)return jsxRuntime.jsx(Ye.Fragment,{children:Q},$.id);let Me=iy[$.id];return jsxRuntime.jsx(Me,{},$.id)}),Z]});}return jsxRuntime.jsxs($n.Provider,{value:k,children:[jsxRuntime.jsx("div",{ref:z=>{if(x.current=z,z&&C===null){let Z=Ol(z)[0]?.closest("[data-menu]")?.getAttribute("data-menu");Z&&P(Z);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??f("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:O,onKeyDown:z=>{if(z.key!=="ArrowLeft"&&z.key!=="ArrowRight")return;let Z=x.current;if(!Z)return;let $=Ol(Z),Q=$.indexOf(document.activeElement);if(Q===-1)return;z.preventDefault();let Me=z.key==="ArrowRight"?1:-1,se=$[(Q+Me+$.length)%$.length],Te=se?.closest("[data-menu]")?.getAttribute("data-menu");Te&&(P(Te),se?.focus(),u!==null&&h(Te));},children:R}),jsxRuntime.jsx("input",{ref:M,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:z=>{let Z=z.target.files?.[0];z.target.value="",!(!Z||!m)&&(v(Z.name),i?.(Z),Z.arrayBuffer().then($=>m.load(new Uint8Array($))).catch($=>{console.error("[docx-editor] could not open the file",$);}));}}),jsxRuntime.jsx(Vn,{open:S,onClose:()=>y(false)})]})}var jn=Object.assign(sy,{Menu:Zo,File:es,Format:ts,Insert:os,Help:ns,Item:gt,Row:Le,Group:Gn,Separator:no,Submenu:oo,TableGrid:Ca,Entry:Yn,Open:Xl,Save:jl,PageSetup:Ql,ReportIssue:Pa});function _e(e){return e/1440*96}function Ma(e){return e/96*1440}function ze(e){return `${Math.round(e*100)/100}px`}function rs(e){return e/2}var my=12240,pp=1440,gp=1440,bp=567,ro=20,is=6,fy=ro+is+2,gy="var(--doc-text-muted)",by="var(--doc-text-subtle)",mp="var(--doc-shadow-subtle)",hy="var(--doc-primary)",vy="var(--doc-primary-hover)",yy="var(--doc-text-subtle)",Jn=5,Qn=7,xy={left:0,right:0,firstLine:0};function fp(e,t){return t==="inch"?(e/gp).toFixed(2)+'"':(e/bp).toFixed(1)+" cm"}function Ty(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function ao({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:a,showIndentHandles:i=false,indent:s,indentEditable:c=false,onIndentChange:l,onIndentDragEnd:d,unit:p="inch",className:g="",style:m,tabMarks:f,onTabMarkRemove:u}){let{t:h}=_(),[b,v]=Ye.useState(null),[C,P]=Ye.useState(null),[S,y]=Ye.useState(null),[x,M]=Ye.useState(null),E=Ye.useRef(null),w=e?.pageWidthTwips??my,N=e?.marginsTwips.left??pp,F=e?.marginsTwips.right??pp,H=e?.gutterTwips??0,I={pageWidth:w,leftMargin:N,rightMargin:F},D=s??xy,k=_e(w)*t,R=_e(N)*t,z=_e(F)*t,Z=Ye.useCallback(B=>{let Pe=E.current?.getBoundingClientRect();return Pe?Ma((B-Pe.left)/t):null},[t]),$=Ye.useCallback((B,Pe,Ue)=>{let ce=Z(Pe);if(ce===null)return;if(M(_e(ce)*t),B==="leftMargin"||B==="rightMargin"){if(B==="leftMargin"){let rn=w-F-H-720,Eo=Math.round(Math.max(0,Math.min(ce,rn)));y(Eo),o?.(Eo);}else {let rn=w-ce,Eo=w-N-H-720,Mr=Math.round(Math.max(0,Math.min(rn,Eo)));y(Mr),r?.(Mr);}return}let Ge=editor.dragIndent(B,ce,D,I,{unit:p,precise:Ue});y(B==="right"?Ge.right:B==="firstLine"?Ge.firstLine:Ge.left),l?.(Ge);},[Z,t,w,N,F,H,o,r,l,D,I,p]),Q=Ye.useCallback(B=>{B==="leftMargin"||B==="rightMargin"?a?.():d?.(),v(null),y(null),M(null);},[a,d]),Me=Ye.useCallback((B,Pe,Ue)=>{let ce=editor.handlePosition(B,D,I),Ge=editor.dragIndent(B,ce+Pe*Ty(p,Ue),D,I,{unit:p,precise:true});l?.(Ge),d?.();},[D,I,p,l,d]),se=My(w,t,p),Te=i&&c&&l!==void 0,Ce=B=>_e(editor.handlePosition(B,D,I))*t,G=(B,Pe,Ue)=>({positionPx:Ce(B),editable:Te,isDragging:b===B,isHovered:C===B,onPointerEnter:()=>P(B),onPointerLeave:()=>P(null),onPointerDown:ce=>{Te&&(ce.preventDefault(),ce.stopPropagation(),ce.currentTarget.setPointerCapture(ce.pointerId),v(B));},onPointerMove:ce=>{b===B&&$(B,ce.clientX,ce.altKey);},onPointerUp:ce=>{b===B&&(ce.currentTarget.releasePointerCapture(ce.pointerId),Q(B));},onKeyDown:ce=>{Te&&(ce.key!=="ArrowLeft"&&ce.key!=="ArrowRight"||(ce.preventDefault(),Me(B,ce.key==="ArrowLeft"?-1:1,ce.shiftKey)));},label:h(Pe),valueNow:Ue,valueText:fp(Ue,p),pageWidthTwips:w});return jsxRuntime.jsxs("div",{ref:E,className:`docx-horizontal-ruler ${g}`,style:{position:"relative",width:ze(k),height:fy,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:b?"ew-resize":"default",...m},role:"group","aria-label":h("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:ze(R),height:ro,backgroundColor:mp,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),v("leftMargin");}:void 0,onPointerMove:B=>b==="leftMargin"&&$("leftMargin",B.clientX,B.altKey),onPointerUp:B=>{b==="leftMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),Q("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:ze(z),height:ro,backgroundColor:mp,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),v("rightMargin");}:void 0,onPointerMove:B=>b==="rightMargin"&&$("rightMargin",B.clientX,B.altKey),onPointerUp:B=>{b==="rightMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),Q("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:ro,pointerEvents:"none"},children:se.map((B,Pe)=>jsxRuntime.jsx(Sy,{tick:B},Pe))}),f?.map(B=>jsxRuntime.jsx(wy,{tabMark:B,positionPx:_e(B.position)*t,onDoubleClick:()=>u?.(B.position)},B.position)),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(as,{direction:"down",anchor:"top",...G("firstLine","ruler.firstLineIndent",D.firstLine)}),jsxRuntime.jsx(as,{direction:"up",anchor:"strip",...G("hanging","ruler.hangingIndent",D.left)}),jsxRuntime.jsx(Cy,{...G("left","ruler.leftIndent",D.left)}),jsxRuntime.jsx(as,{direction:"up",anchor:"strip",...G("right","ruler.rightIndent",D.right)})]}),b&&S!==null&&x!==null&&jsxRuntime.jsx(Py,{value:fp(S,p),positionPx:x})]})}function Sy({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(e.position),bottom:0,width:1,height:e.height,backgroundColor:by}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:gy,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function hp(e){return e.editable?e.isDragging||e.isHovered?vy:hy:yy}function vp(e,t,n){return {position:"absolute",left:ze(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function yp(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 as({direction:e,anchor:t,...n}){let o=hp(n),r=t==="top"?{top:0,height:Qn+1}:{top:ro-Qn,height:Qn};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:vp(n,Jn*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...yp(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${Jn}px solid transparent`,borderRight:`${Jn}px solid transparent`,...e==="down"?{top:0,borderTop:`${Qn}px solid ${o}`}:{bottom:0,borderBottom:`${Qn}px solid ${o}`},transition:"border-color 0.1s"}})})}function Cy(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:vp(e,Jn*2,{top:ro+1,height:is}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...yp(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:Jn*2-2,height:is,backgroundColor:hp(e),borderRadius:1,transition:"background-color 0.1s"}})})}function Py({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(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 Ey={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function wy({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:ze(t-5),top:ro-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:o=>{o.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:Ey[e.alignment]||"L"})}function My(e,t,n){let o=[];if(n==="inch"){let r=gp/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;i%8===0?o.push({position:c,height:8,label:i/8>0?String(i/8):void 0}):i%4===0?o.push({position:c,height:5}):i%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=bp/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;i%10===0?o.push({position:c,height:8,label:i/10>0?String(i/10):void 0}):i%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var Ry=15840,Sp=1440,_y=1440,Ny=567,Bo=20,Dy="var(--doc-text-muted)",Ly="var(--doc-text-subtle)",Hy="var(--doc-primary)",Fy="var(--doc-primary)",Ay="var(--doc-primary-hover)";function er({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:a,unit:i="inch",className:s="",style:c}){let{t:l}=_(),[d,p]=Ye.useState(null),[g,m]=Ye.useState(null),f=Ye.useRef(null),u=e?.pageHeightTwips??Ry,h=e?.marginsTwips.top??Sp,b=e?.marginsTwips.bottom??Sp,v=_e(u)*t,C=_e(h)*t,P=_e(b)*t,S=Ye.useCallback((w,N)=>{n&&(w.preventDefault(),p(N));},[n]),y=Ye.useCallback(w=>{if(!d||!f.current)return;let N=f.current.getBoundingClientRect(),F=w.clientY-N.top,H=Ma(F/t);if(d==="topMargin"){let I=u-b-720,D=Math.max(0,Math.min(H,I));o?.(Math.round(D));}else if(d==="bottomMargin"){let I=u-H,D=u-h-720,k=Math.max(0,Math.min(I,D));r?.(Math.round(k));}},[d,t,u,h,b,o,r]),x=Ye.useCallback(()=>{d!==null&&a?.(),p(null);},[d,a]);Ye.useEffect(()=>{if(d)return document.addEventListener("mousemove",y),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x);}},[d,y,x]);let M=Zy(u,t,i),E={position:"relative",width:Bo,height:ze(v),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:f,className:`docx-vertical-ruler ${s}`,style:E,role:"slider","aria-label":l("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:M.map((w,N)=>jsxRuntime.jsx(Oy,{tick:w},N))}),jsxRuntime.jsx(Cp,{type:"topMargin",position:C,editable:n,isDragging:d==="topMargin",isHovered:g==="topMargin",onMouseEnter:()=>m("topMargin"),onMouseLeave:()=>m(null),onMouseDown:w=>S(w,"topMargin")}),jsxRuntime.jsx(Cp,{type:"bottomMargin",position:v-P,editable:n,isDragging:d==="bottomMargin",isHovered:g==="bottomMargin",onMouseEnter:()=>m("bottomMargin"),onMouseLeave:()=>m(null),onMouseDown:w=>S(w,"bottomMargin")})]})}function Oy({tick:e}){let t={position:"absolute",top:ze(e.position),right:0,height:1,width:e.width,backgroundColor:Ly},n={position:"absolute",top:ze(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Dy,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Cp({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:a,onMouseLeave:i,onMouseDown:s}){let{t:c}=_(),l=o?Ay:r?Fy:Hy,d={position:"absolute",top:ze(t-5),right:0,width:Bo,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},p={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${l}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:d,onMouseEnter:a,onMouseLeave:i,onMouseDown:s,role:"slider","aria-label":c(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:p})})}function Zy(e,t,n){let o=[];if(n==="inch"){let r=_y/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;if(i%8===0){let l=i/8;o.push({position:c,width:10,label:l>0?String(l):void 0});}else i%4===0?o.push({position:c,width:6}):i%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=Ny/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let s=i*r;if(s>e)break;let c=_e(s)*t;if(i%10===0){let l=i/10;o.push({position:c,width:10,label:l>0?String(l):void 0});}else i%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var io=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var Ky=e=>e.formatting?.indent??null,zy=e=>e.editable;function cs(){let e=A(),t=q(Ky),n=q(zy),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=Ye.useCallback(a=>e?e.exec({...a.left!==void 0?{left:a.left}:{},...a.right!==void 0?{right:a.right}:{},...a.firstLine!==void 0?{firstLine:a.firstLine}:{},type:"setIndent"}).ok:false,[e]);return Ye.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var kp=e=>e.zoom;function Ip(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Rp(){let{apply:e}=eo(),[t,n]=Ye.useState({}),o=Ye.useRef({}),r=Ye.useCallback(i=>s=>{o.current={...o.current,[i]:Math.round(s)},n(o.current);},[]),a=Ye.useCallback(()=>{let i=o.current;o.current={},n({}),Object.keys(i).length!==0&&e({...i.top!==void 0?{marginTopTwips:i.top}:{},...i.right!==void 0?{marginRightTwips:i.right}:{},...i.bottom!==void 0?{marginBottomTwips:i.bottom}:{},...i.left!==void 0?{marginLeftTwips:i.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:a}}function Mp(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function Wy(){let e=A(),{indent:t,isEnabled:n,apply:o}=cs(),[r,a]=Ye.useState(null),i=Ye.useRef(null),s=Ye.useRef(null),c=Ye.useCallback(p=>{s.current===null&&(s.current=Mp(e)),i.current=p,a(p);},[e]),l=Ye.useCallback(()=>{let p=i.current,g=s.current;i.current=null,s.current=null,a(null),p&&(g!==null&&g!==Mp(e)||o({left:p.left,right:p.right,firstLine:p.firstLine}));},[e,o]),d=Ye.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return Ye.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:l}),[d,n,c,l])}function Uy(){let e=_o(),[t,n]=Ye.useState(0);return Ye.useEffect(()=>{if(!e){n(0);return}let o=()=>n(e.scrollLeft);return o(),e.addEventListener("scroll",o,{passive:true}),()=>e.removeEventListener("scroll",o)},[e]),t}function _a(e){let t=q(io),{pageSetup:n,isEnabled:o}=eo(),r=q(kp),{pending:a,preview:i,commit:s}=Rp(),c=Wy(),l=Ro(),d=Gy(),p=Uy();return t?null:jsxRuntime.jsx(ao,{pageSetup:Ip(n,a),zoom:r,editable:o,onLeftMarginChange:i("left"),onRightMarginChange:i("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:{flexShrink:0,marginRight:d,...e.style,marginInlineStart:l,transition:"margin 0.2s ease",transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-p}px)`,clipPath:l>0&&p>0?`inset(0 0 0 ${p}px)`:e.style?.clipPath}})}function Gy(){let e=q(Yy);return (Ye.useContext(St)?.mounted??0)===0?0:e?Xy:jy}var Yy=e=>e.reviewPaneOpen??true,Xy=316,jy=44;function Na(e){let t=q(io),{pageSetup:n,isEnabled:o}=eo(),r=q(kp),{pending:a,preview:i,commit:s}=Rp();return t?null:jsxRuntime.jsx(er,{pageSetup:Ip(n,a),zoom:r,editable:o,onTopMarginChange:i("top"),onBottomMarginChange:i("bottom"),onMarginDragEnd:s,unit:e.unit??"inch",className:e.className??"",style:e.style})}function L({size:e=20,className:t="",style:n,children:o}){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,...n},"aria-hidden":"true",children:o})}function Jy(e){return jsxRuntime.jsx(L,{...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 ex(e){return jsxRuntime.jsx(L,{...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 tx(e){return jsxRuntime.jsx(L,{...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 ox(e){return jsxRuntime.jsx(L,{...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 nx(e){return jsxRuntime.jsx(L,{...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 rx(e){return jsxRuntime.jsx(L,{...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 ax(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function ix(e){return jsxRuntime.jsx(L,{...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 lx(e){return jsxRuntime.jsx(L,{...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 sx(e){return jsxRuntime.jsx(L,{...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 cx(e){return jsxRuntime.jsx(L,{...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 dx(e){return jsxRuntime.jsx(L,{...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 ux(e){return jsxRuntime.jsx(L,{...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 px(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function mx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function fx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function gx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function ps(e){return jsxRuntime.jsx(L,{...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 bx(e){return jsxRuntime.jsx(L,{...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 hx(e){return jsxRuntime.jsx(L,{...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 vx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function yx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function xx(e){return jsxRuntime.jsx(L,{...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 Tx(e){return jsxRuntime.jsx(L,{...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 Sx(e){return jsxRuntime.jsx(L,{...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 Cx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function Px(e){return jsxRuntime.jsx(L,{...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 Ex(e){return jsxRuntime.jsx(L,{...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 wx(e){return jsxRuntime.jsx(L,{...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 Mx(e){return jsxRuntime.jsx(L,{...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 kx(e){return jsxRuntime.jsx(L,{...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 Np(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function Ix(e){return jsxRuntime.jsx(L,{...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 Rx(e){return jsxRuntime.jsx(L,{...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 _x(e){return jsxRuntime.jsx(L,{...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 Nx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function Dx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function Lx(e){return jsxRuntime.jsx(L,{...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 Hx(e){return jsxRuntime.jsx(L,{...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 Fx(e){return jsxRuntime.jsx(L,{...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 Ax(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function Ox(e){return jsxRuntime.jsx(L,{...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 Zx(e){return jsxRuntime.jsx(L,{...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 Bx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function qx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function Kx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function zx(e){return jsxRuntime.jsx(L,{...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 Vx(e){return jsxRuntime.jsx(L,{...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 $x(e){return jsxRuntime.jsx(L,{...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 Wx(e){return jsxRuntime.jsx(L,{...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 Ux(e){return jsxRuntime.jsx(L,{...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 Gx(e){return jsxRuntime.jsx(L,{...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 Yx(e){return jsxRuntime.jsx(L,{...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 Xx(e){return jsxRuntime.jsx(L,{...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 jx(e){return jsxRuntime.jsx(L,{...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 Qx(e){return jsxRuntime.jsx(L,{...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 Jx(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function eT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function tT(e){return jsxRuntime.jsx(L,{...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 oT(e){return jsxRuntime.jsx(L,{...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 nT(e){return jsxRuntime.jsx(L,{...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 rT(e){return jsxRuntime.jsx(L,{...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 aT(e){return jsxRuntime.jsx(L,{...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 iT(e){return jsxRuntime.jsx(L,{...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 lT(e){return jsxRuntime.jsx(L,{...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 sT(e){return jsxRuntime.jsx(L,{...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 cT(e){return jsxRuntime.jsx(L,{...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 dT(e){return jsxRuntime.jsx(L,{...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 uT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function pT(e){return jsxRuntime.jsx(L,{...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 mT(e){return jsxRuntime.jsx(L,{...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 fT(e){return jsxRuntime.jsx(L,{...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 gT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function bT(e){return jsxRuntime.jsx(L,{...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 hT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function vT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function yT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function xT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function TT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function ST(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function CT(e){return jsxRuntime.jsx(L,{...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 PT(e){return jsxRuntime.jsx(L,{...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 ET(e){return jsxRuntime.jsx(L,{...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 wT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function MT(e){return jsxRuntime.jsx(L,{...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 kT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function IT(e){return jsxRuntime.jsx(L,{...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 RT(e){return jsxRuntime.jsx(L,{...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 _T(e){return jsxRuntime.jsx(L,{...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 NT(e){return jsxRuntime.jsxs(L,{...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 DT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function LT(e){return jsxRuntime.jsx(L,{...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 HT(e){return jsxRuntime.jsx(L,{...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 FT(e){return jsxRuntime.jsx(L,{...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 AT(e){return jsxRuntime.jsx(L,{...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 OT(e){return jsxRuntime.jsx(L,{...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 ZT(e){return jsxRuntime.jsx(L,{...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 BT(e){return jsxRuntime.jsx(L,{...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 qT(e){return jsxRuntime.jsx(L,{...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 KT(e){return jsxRuntime.jsx(L,{...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 zT={undo:Jy,redo:ex,print:tx,file_download:ox,file_upload:nx,format_bold:rx,format_italic:ax,format_underlined:ix,strikethrough_s:lx,superscript:sx,subscript:cx,link:dx,format_clear:ux,format_align_left:px,format_align_center:mx,format_align_right:fx,format_align_justify:gx,format_line_spacing:ps,format_list_bulleted:bx,format_list_numbered:hx,format_indent_increase:vx,format_indent_decrease:yx,format_color_text:xx,ink_highlighter:Tx,format_color_reset:Sx,arrow_drop_down:Cx,table:Px,table_chart:Ex,grid_on:wx,table_rows:Mx,view_column:kx,border_all:Np,select_all:Np,border_outer:Ix,border_inner:Rx,border_clear:_x,add:Nx,remove:Dx,delete:Lx,delete_sweep:Hx,call_merge:Fx,call_split:Ax,drag_indicator:Ox,image:Zx,format_image_left:Bx,format_image_right:qx,horizontal_rule:Kx,flip_to_back:zx,flip_to_front:Vx,open_with:$x,tune:Wx,rotate_right:Ux,rotate_left:Gx,swap_horiz:Yx,swap_vert:Xx,shapes:jx,format_paint:Qx,expand_more:Jx,expand_less:eT,border_top:tT,border_bottom:oT,border_left:nT,border_right:rT,border_horizontal:aT,border_vertical:iT,padding:lT,text_rotation_none:sT,wrap_text:cT,height:dT,fit_width:uT,settings:pT,border_color:mT,format_color_fill:fT,vertical_align_top:gT,vertical_align_center:bT,vertical_align_bottom:hT,line_weight:vT,keyboard_arrow_up:yT,keyboard_arrow_down:xT,keyboard_arrow_left:TT,keyboard_arrow_right:ST,more_vert:CT,page_break:PT,branding_watermark:ET,arrow_back:wT,search:MT,toc:kT,done_all:IT,check_circle:RT,chat_bubble_outline:_T,chat_bubble_check:NT,check:DT,close:LT,add_comment:HT,comment:FT,edit_note:AT,rate_review:OT,visibility:ZT,format_textdirection_l_to_r:BT,format_textdirection_r_to_l:qT,"agent-sparkle":KT};function K({name:e,size:t=20,className:n="",style:o}){let r=zT[e];return r?jsxRuntime.jsx(r,{size:t,className:n,style:o}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:n,style:{fontSize:t,width:t,height:t,...o},children:e}))}var Da=12,ms=240,GT=24,tr=12,La=Ye__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:a=0,leftOffset:i=Da}){let{t:s}=_(),[c,l]=Ye.useState(false),d=t.length?Math.min(...t.map(p=>p.level)):0;return Ye.useEffect(()=>{requestAnimationFrame(()=>l(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":s("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:i-a,bottom:0,width:ms,paddingTop:GT,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${i+ms}px)`,transition:"transform 0.15s ease-out"},onMouseDown:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:o,"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(K,{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((p,g)=>jsxRuntime.jsx("div",{style:{marginLeft:(p.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(p.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:p.text,children:p.text})},`${p.blockId}-${g}`))})]})});var QT=e=>e,JT=Object.freeze([]),eS=()=>{};function fs(e){let t=A(),n=q(QT),o=Ye.useMemo(()=>t&&!n.isLoading?t.getOutline():JT,[t,n]),r=Ye.useCallback(a=>{if(!t)return;t.focus();let i={paragraphId:a,offset:0};t.exec({type:"setSelection",range:{anchor:i,head:i}}),t.scrollToBlock(a);},[t]);return io(n)?null:jsxRuntime.jsx(La,{headings:o,onHeadingClick:r,onClose:e.onClose??eS,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var gs=Ye.createContext(null);function Ot(e){let t=Ye.useContext(gs);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var qo=280,Ha=32,Hp=16;function Ko(e=280){return 32+e+16}function Fa({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,docked:r=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0||!Number.isFinite(o)||o<0)return 0;let a=(e-o-t)/2;return a>=n?0:!r&&n<=2*a?Math.ceil(2*(n-a)):Math.ceil(n)}var iS=Object.freeze([]),lS=e=>e;function Aa(){let e=A(),t=q(lS),[n,o]=Ye.useState(null),r=Ye.useMemo(()=>e&&!t.isLoading?e.getOutline():iS,[e,t]),a=Ye.useMemo(()=>{if(r.length===0)return [];let s=r[0].level;for(let c of r)c.level<s&&(s=c.level);return r.map(c=>({heading:c,depth:c.level-s}))},[r]),i=Ye.useCallback(s=>{if(!e||typeof s!="string"||s.length===0)return;e.focus();let c={paragraphId:s,offset:0};e.exec({type:"setSelection",range:{anchor:c,head:c}}),e.scrollToBlock(s),o(s);},[e]);return {headings:r,items:a,selectedBlockId:n,goTo:i,isEmpty:r.length===0}}var vs=150,ys=2e3,hs=Object.freeze([]),dS=e=>e;function Oa(){let e=A(),t=q(dS),[n,o]=Ye.useState(""),[r,a]=Ye.useState(""),[i,s]=Ye.useState(false),[c,l]=Ye.useState(false),[d,p]=Ye.useState(hs),[g,m]=Ye.useState(-1);Ye.useEffect(()=>{if(n===r)return;let y=setTimeout(()=>a(n),vs);return ()=>clearTimeout(y)},[n,r]);let f=Ye.useMemo(()=>({matchCase:i,wholeWord:c}),[i,c]);Ye.useEffect(()=>{if(!e||r.length===0){p(hs),m(-1);return}let y=e.findMatches(r,f);p(x=>x===y?x:y);},[e,r,f,t]);let u=Ye.useRef(d);Ye.useEffect(()=>{u.current!==d&&(u.current=d,m(y=>y>=0&&y<d.length?y:-1));},[d]);let h=Ye.useCallback(y=>{if(!e)return;let x=d[y];if(!x)return;e.focus(),e.selectMatch(x).ok&&m(y);},[e,d]),b=Ye.useCallback(y=>{if(d.length===0)return;let M=((g<0?y>0?-1:0:g)+y+d.length)%d.length;h(M);},[g,h,d.length]),v=Ye.useCallback(()=>b(1),[b]),C=Ye.useCallback(()=>b(-1),[b]),P=Ye.useCallback(y=>o(y),[]),S=Ye.useCallback(()=>{o(""),a(""),p(hs),m(-1);},[]);return {query:n,setQuery:P,matchCase:i,setMatchCase:s,wholeWord:c,setWholeWord:l,matches:d,truncated:d.length>=ys,activeIndex:g,goTo:h,next:v,previous:C,clear:S,isPending:n!==r}}var bS=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)}},hS=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ba(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,a]=Ye.useState(t),[i,s]=Ye.useState(n),c=e.open??r,l=e.tab??i,{onOpenChange:d,onTabChange:p}=e,g=e.open!==void 0,m=e.tab!==void 0,f=Ye.useCallback(D=>{g||a(D),d?.(D);},[g,d]),u=Ye.useCallback(()=>f(!c),[c,f]),h=Ye.useCallback(D=>{m||s(D),p?.(D);},[m,p]),b=Io(),v=_o(),C=Ye.useContext(St),{pageSetup:P,zoom:S,reviewPaneOpen:y,fitting:x}=q(bS,hS),[M,E]=Ye.useState(0),[w,N]=Ye.useState(0);Ye.useEffect(()=>{if(!v){E(0),N(0);return}let D=()=>{E(v.clientWidth);let R=Number.parseFloat(getComputedStyle(v).paddingInlineEnd);N(Number.isFinite(R)?R:0);};if(D(),typeof ResizeObserver>"u")return;let k=new ResizeObserver(D);return k.observe(v),()=>k.disconnect()},[v,c,y,C?.mounted]);let F=Ye.useRef(null);P&&(F.current=P.pageWidthTwips);let H=P?.pageWidthTwips??F.current,I=Ye.useMemo(()=>!c||H===null?0:Fa({viewportWidth:M,pageWidthPx:_e(H)*S,reservation:Ko(o),inlineEndReservation:w,docked:x}),[c,H,S,M,o,w,x]);return Ye.useEffect(()=>{if(b)return b.setShift(I),()=>b.setShift(0)},[b,I]),{open:c,setOpen:f,toggle:u,tab:l,setTab:h,paneWidth:o,shift:I}}var or=["headings","find"],ht=(...e)=>e.filter(Boolean).join(" ");function nr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:ht("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(rr,{}),jsxRuntime.jsx(ar,{})]})})}function rr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Close");return jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:()=>o.setOpen(false),children:n??jsxRuntime.jsx(K,{name:"arrow_back",size:20})})}function ar({className:e,style:t,children:n}){let{t:o}=Ot("Title");return jsxRuntime.jsx("h2",{className:ht("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function ir({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Tabs"),a=Ye.useCallback(i=>{let s=i.key==="ArrowRight"?1:i.key==="ArrowLeft"?-1:0;if(s===0)return;i.preventDefault();let c=or.indexOf(o.tab);o.setTab(or[(c+s+or.length)%or.length]);},[o]);return jsxRuntime.jsx("div",{className:ht("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:a,children:n??or.map(i=>jsxRuntime.jsx(lr,{value:i},i))})}function lr({value:e,className:t,style:n,children:o}){let{pane:r,t:a}=Ot("Tab"),i=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":i,"aria-controls":`docx-nav-panel-${e}`,tabIndex:i?0:-1,className:ht("docx-nav__tab",i&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??a(`navigation.tabs.${e}`)})}function Op({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:a,autoFocus:i}){return jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(K,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"search",className:"docx-nav__search-input",value:e,placeholder:o,"aria-label":r,autoFocus:i,onChange:s=>t(s.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":a,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function sr({className:e,style:t}){let{pane:n,outline:o,t:r}=Ot("Headings"),[a,i]=Ye.useState(""),s=q(io),c=Ye.useMemo(()=>{let d=a.trim().toLowerCase();return d.length===0?o.items:o.items.filter(p=>p.heading.text.toLowerCase().includes(d))},[o.items,a]),l=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:ht("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:l,children:[jsxRuntime.jsx(Op,{value:a,onChange:i,onClear:()=>i(""),placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),s?null:o.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((d,p)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__heading",o.selectedBlockId===d.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+d.depth*14}px`},title:d.heading.text,onClick:()=>o.goTo(d.heading.blockId),children:d.heading.text})},`${d.heading.blockId}-${p}`))})]})}function TS({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:n,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 cr({className:e,style:t}){let{pane:n,search:o,t:r}=Ot("Find"),a=n.tab!=="find",i=o.query.trim().length>0,s=o.matches.length===0?null:o.activeIndex<0?r(o.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:o.matches.length}):r(o.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:o.activeIndex+1,total:o.matches.length});return jsxRuntime.jsxs("div",{className:ht("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(Op,{value:o.query,onChange:o.setQuery,onClear:o.clear,placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":r("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.matchCase,onChange:c=>o.setMatchCase(c.target.checked)}),r("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.wholeWord,onChange:c=>o.setWholeWord(c.target.checked)}),r("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:i?o.isPending?r("navigation.find.searching"):s??r("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.previousAriaLabel"),disabled:o.matches.length===0,onClick:o.previous,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.nextAriaLabel"),disabled:o.matches.length===0,onClick:o.next,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_down",size:18})})]})]}),o.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":r("navigation.find.resultsAriaLabel"),children:o.matches.map((c,l)=>jsxRuntime.jsx(TS,{match:c,active:l===o.activeIndex,onSelect:()=>o.goTo(l)},`${c.blockId}-${c.start}-${l}`))})]})}function dr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Toggle");return jsxRuntime.jsx("button",{type:"button",className:ht("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:a=>a.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function Ts(e){let t=Xe(),{t:n,toggle:o=true,className:r,style:a,children:i,...s}=e,c=Ba(s),l=Aa(),d=Oa(),{t:p}=_(),g=Ye.useMemo(()=>({pane:c,outline:l,search:d,t:n??((f,u)=>p(f,u))}),[c,l,d,n,p]),m=e.paneWidth??280;return jsxRuntime.jsx(gs.Provider,{value:g,children:jsxRuntime.jsxs("div",{className:`${t}docx-nav${c.open?" docx-nav--open":""}${r?` ${r}`:""}`,"data-open":c.open?"true":"false",style:{"--docx-nav-width":`${m}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Ko(m)}px`,...a},children:[o!==false&&!c.open&&jsxRuntime.jsx(dr,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":g.t("navigation.ariaLabel"),inert:!c.open,children:i??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nr,{}),jsxRuntime.jsx(ir,{}),jsxRuntime.jsx(sr,{}),jsxRuntime.jsx(cr,{})]})})]})})}var qa=Object.assign(Ts,{Header:nr,Close:rr,Title:ar,Tabs:ir,Tab:lr,Headings:sr,Find:cr,Toggle:dr});var kS=600,IS=e=>e.page.total,Ss=Ye.createContext(null);function Cs({className:e,style:t}){let n=Xe(),o=A(),r=_o(),a=q(IS),{t:i}=_(),s=Ye.useContext(Ss),[c,l]=Ye.useState(1),[d,p]=Ye.useState(false);if(Ye.useEffect(()=>{if(p(false),!o||!r||a<=1)return;l(o.getCurrentPage("viewport"));let m=null,f=()=>{l(o.getCurrentPage("viewport")),p(true),m&&clearTimeout(m),m=setTimeout(()=>p(false),kS);};return r.addEventListener("scroll",f,{passive:true}),()=>{r.removeEventListener("scroll",f),m&&clearTimeout(m);}},[o,a,r]),a<=1)return null;let g=s?s("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(a)):i("viewer.pageIndicator",{current:c,total:a});return jsxRuntime.jsx("div",{className:`${n}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":d?"true":"false",role:"status","aria-live":"polite",children:g})}var NS=[],DS=e=>e.fontSubstitutions??NS;function Ka({className:e,style:t,t:n}){let o=q(DS),{t:r}=_(),a=n??r,[i,s]=Ye.useState(null);if(o.length===0)return null;let c=o.join("\0");return i===c?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:a("editor.fontSubstitutionNotice",{fonts:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>s(c),children:a("common.dismiss")})]})}var Ve={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function Ps(e){return Math.round(e/1440*100)/100}function Kp(e){return Math.round(e*1440)}function FS(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 Es(){let e=A(),t=Ye.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return q(t,FS)}function za(e,t,n){let o=e.getBoundingClientRect();return {left:t-o.left-e.clientLeft+e.scrollLeft,top:n-o.top-e.clientTop+e.scrollTop}}function Va(e,t){let[n,o]=Ye.useState(null),r=Ye.useCallback(s=>o(s),[]),[a,i]=Ye.useState({visibility:"hidden"});return Ye.useLayoutEffect(()=>{let s=n?.closest(".docx-editor__scroll-container"),c=s??n?.parentElement?.querySelector(".docx-editor__scroll-container");if(!n||!c)return;let l=0,d=null,p=new ResizeObserver(()=>m()),g=()=>{l=0;let u=e(c);if(u!==d&&(p.disconnect(),p.observe(c),p.observe(n),u&&p.observe(u),d=u),!u||!u.isConnected){i({visibility:"hidden"});return}let h=u.getBoundingClientRect(),b=Math.max(n.offsetHeight,28),v=6,C=s===c,P=h.top-b-v,S=C?za(c,h.left,P):{left:h.left,top:P},y=S.left,x=S.top;C?c.scrollLeft+8:8;i({position:C?"absolute":"fixed",left:y,top:x,...{width:Math.max(240,Math.min(h.width,c.clientWidth-16))},visibility:"visible"});},m=()=>{l||(l=requestAnimationFrame(g));};p.observe(c),p.observe(n);let f=new MutationObserver(m);return f.observe(c,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),c.addEventListener("scroll",m,{passive:true}),window.addEventListener("resize",m),g(),()=>{l&&cancelAnimationFrame(l),p.disconnect(),f.disconnect(),c.removeEventListener("scroll",m),window.removeEventListener("resize",m);}},[n,e,t]),{ref:r,style:a}}function qS(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 KS=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function ur(e){let t=A();return Ye.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function zS(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=A(),[a,i]=Ye.useState(false),s=Ye.useRef(null),[c,l]=Ye.useState(""),[d,p]=Ye.useState("");Ye.useEffect(()=>{a&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(l(String(Ps(t.headerDistanceTwips))),p(String(Ps(t.footerDistanceTwips)))));},[a,t.headerDistanceTwips,t.footerDistanceTwips]),Ye.useEffect(()=>{if(!a)return;let x=M=>{s.current?.contains(M.target)||i(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[a]);let g=Ye.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),m=Ye.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),f=Ye.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),u=Ye.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),h=Ye.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),b=ur(g),v=ur(m),C=ur(f),P=ur(u),S=ur(h),y=(x,M)=>{if(!r)return;let E=Number.parseFloat(M);Number.isFinite(E)&&r.exec({type:"setHeaderFooterOptions",[x]:Kp(E)});};return jsxRuntime.jsxs("div",{ref:s,className:"docx-hf-chrome__options",onMouseDown:n,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":a,"aria-haspopup":"menu",onClick:()=>i(x=>!x),onMouseDown:n,children:o("headerFooter.options")}),a?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[KS.map(x=>{let M={type:"insertPageField",field:x.field},E=r?.can(M);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!E?.ok,title:E&&!E.ok?E.reason:void 0,onClick:()=>{r?.exec(M),i(false);},onMouseDown:n,children:o(x.labelKey)},x.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:!b.enabled,title:b.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsx("span",{children:o("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(m)}),jsxRuntime.jsxs("span",{children:[o("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:o("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:!P.enabled,title:P.reason??void 0,onClick:()=>r?.exec(u),onMouseDown:n,children:o("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>r?.exec(f),onMouseDown:n,children:o("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:o("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.headerDistance"),value:c,onChange:x=>l(x.target.value),onBlur:()=>y("headerDistanceTwips",c)}),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:o("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.footerDistance"),value:d,onChange:x=>p(x.target.value),onBlur:()=>y("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:!S.enabled,title:S.reason??void 0,onClick:()=>r?.exec(h),onMouseDown:n,children:t.editing==="header"?o("headerFooter.removeHeader"):o("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"}),i(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function $a({className:e}){let{t}=_(),n=Es(),o=Ye.useCallback(s=>s.querySelector("[data-docx-hf-active]"),[]),r=Va(o,"story-label"),a=O;if(!n?.editing)return null;let i=qS(n.editing,n.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:a,style:{...r.style,zIndex:Ve.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(i)}),n.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(zS,{state:n,onMouseDown:a})]})}function uo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Wa=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"})}),XS="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",jS="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",QS="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",JS="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 eC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=vt(),i=Ye.useRef(null),{state:s,close:c}=a;Ye.useEffect(()=>{if(s.mode==="closed")return;let u=b=>{b.key==="Escape"&&(b.preventDefault(),c());},h=b=>{let v=i.current;v&&b.target instanceof Node&&v.contains(b.target)||c();};return document.addEventListener("keydown",u),document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",h,true);}},[s.mode,c]);let[l,d]=Ye.useState(null);Ye.useLayoutEffect(()=>{let u=s.anchor,h=i.current;if(!u||!h){d(null);return}let b=h.offsetParent;if(!b){d(null);return}let{left:v,top:C}=za(b,u.left,u.top),P=Math.max(0,b.scrollWidth-h.offsetWidth);d({left:Math.max(0,Math.min(v,P)),top:C});},[s.anchor]);let{t:p}=_(),g=s.mode==="editing"?p(s.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):p("hyperlinkPopup.editLink"),m=r?jsxRuntime.jsx(tC,{children:o}):o;if(n)return s.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let f={ref:i,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":s.mode,role:"dialog","aria-modal":false,onMouseDown:uo,style:l??void 0,"aria-label":g};return s.mode==="closed"?null:t?jsxRuntime.jsx(W,{...f,children:o}):jsxRuntime.jsx("div",{...f,children:m})}function tC({children:e}){let{state:t}=vt(),n=Ye.useMemo(()=>oC(e),[e]),o=(a,i)=>a in n?n[a]:i;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(Ns,{})),o("Error",jsxRuntime.jsx(Ls,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Ds,{})),o("Cancel",jsxRuntime.jsx(Hs,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Zr(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(ks,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Is,{})),r?o("Edit",jsxRuntime.jsx(Rs,{})):null,r?o("Unlink",jsxRuntime.jsx(_s,{})):null]}),n.__extra]})}function oC(e){let t={},n=[],o=r=>{if(Array.isArray(r)){r.forEach(o);return}if(!r||typeof r!="object"||!("type"in r)){r&&n.push(r);return}if(r.type===Ye.Fragment){o(r.props.children);return}let a=r.type.docxHyperLinkPart;a?t[a]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function vt(){return Ye.useContext(mn)??nC}var nC={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 ks({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:a}=vt(),{t:i}=_();if(n||!r.link)return null;let s=!r.link.href,c=r.link.kind==="internal",l=c?`#${r.link.anchor??""}`:r.link.authored,d=i(s?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),p={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...s?{"data-inert":""}:{},title:d,onMouseDown:uo,...s?{}:{onClick:()=>a(),type:"button"}};return t?jsxRuntime.jsx(W,{...p,children:o}):s?jsxRuntime.jsxs("span",{...p,children:[o??l,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...p,children:[o??l,Wa(JS)]})}ks.docxHyperLinkPart="Url";function Is({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:a,copy:i}=vt(),{t:s}=_();if(n||!a.link?.href)return null;let c=a.copied?s("editor.linkCopied"):s("hyperlinkPopup.copyLink"),l={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...a.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:uo,onClick:()=>{i();}};return t?jsxRuntime.jsx(W,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:r??o??Wa(XS)})}Is.docxHyperLinkPart="Copy";function Rs({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":s,title:s,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Wa(jS)})}Rs.docxHyperLinkPart="Edit";function _s({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":s,title:s,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Wa(QS)})}_s.docxHyperLinkPart="Unlink";function Ns({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:a,close:i}=vt(),{t:s}=_(),c=Ye.useRef(null),l=Ye.useId(),d=Ye.useId();Ye.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let p=Ye.useCallback(g=>{if(g.key==="Enter"){g.preventDefault(),a();return}g.key==="Escape"&&(g.preventDefault(),i());},[a,i]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:l,children:s("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:l,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:n.text,placeholder:s("hyperlinkPopup.displayTextPlaceholder"),onChange:g=>o(g.target.value),onKeyDown:p}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:s("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:c,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:n.url,placeholder:s("hyperlinkPopup.urlPlaceholder"),onChange:g=>r(g.target.value),onKeyDown:p})]})}Ns.docxHyperLinkPart="Fields";function Ds({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:a}=vt(),{t:i}=_();if(n)return null;let s=i("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:uo,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??s})}function Ls({className:e,hidden:t}){let{state:n}=vt(),{t:o}=_();return t||!n.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:o("hyperlinkPopup.refused")})}Ls.docxHyperLinkPart="Error";Ds.docxHyperLinkPart="Apply";function Hs({className:e,asChild:t,hidden:n,children:o}){let{close:r}=vt(),{t:a}=_();if(n)return null;let i=a("hyperlinkPopup.cancel"),s={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:uo,onClick:()=>r()};return t?jsxRuntime.jsx(W,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:o??i})}Hs.docxHyperLinkPart="Cancel";var Ua=Object.assign(eC,{Url:ks,Copy:Is,Edit:Rs,Unlink:_s,Fields:Ns,Error:Ls,Apply:Ds,Cancel:Hs});function rC(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 Fs(){let e=A(),t=Ye.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=q(t,rC);return n?.kind==="note"?n:null}function Gp(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 Yp(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&&Gp(e.documentAuthored,t.documentAuthored)&&Gp(e.sectionAuthored,t.sectionAuthored)}function aC(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Yp(e.footnote,t.footnote)&&Yp(e.endnote,t.endnote)}function As(){let e=A(),t=Ye.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return q(t,aC)}var iC=/^(footnote|endnote):(-?\d{1,10})$/;function jp(e){let t=iC.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function lC(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Zs(e){let t=A();return Ye.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function sC(e){let{t}=_(),[n,o]=Ye.useState(false),r=Ye.useRef(null);return Ye.useEffect(()=>{if(!n)return;let a=i=>{r.current?.contains(i.target)||o(false);};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]),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":n,"aria-haspopup":"menu",onMouseDown:O,onClick:()=>o(a=>!a),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),o(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(),o(false);},children:t("common.close")})]}):null]})}function Ga({className:e}){let{t}=_(),n=A(),o=Fs(),[r,a]=Ye.useState(null),[i,s]=Ye.useState(null),[c,l]=Ye.useState(false),d=Ye.useRef(null),p=Ye.useCallback(E=>{if(!o)return null;let N=[...E.querySelectorAll("[data-docx-note-scope]")].find(F=>F.matches("[data-docx-note]")&&F.dataset.docxNoteScope===o.id)??null;return N?.closest("[data-docx-notes]")??N},[o]),g=Va(p,"story-label"),m=Ye.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,a(null);},[]);Ye.useEffect(()=>{if(!n)return;let E=document.querySelector(".docx-pages");if(!E)return;let w=H=>{let I=H.target;if(!I)return;let D=I.closest("[data-docx-note-ref]");if(D?.dataset.docxNoteScope){H.preventDefault(),m(),s(null),n.setActiveScope({kind:"note",id:D.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(H.preventDefault(),m(),s(null),n.setActiveScope({kind:"body"}));},N=H=>{let I=H,k=I.target?.closest("[data-docx-note-scope]");k?.dataset.docxNoteScope&&(I.preventDefault(),s({scopeId:k.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},F=H=>{if(lC())return;let D=H.target?.closest("[data-docx-note-ref]");if(!D?.dataset.docxNoteScope){m();return}let k=D.dataset.docxNoteScope,z=n.getNotePreviewText(k)??D.getAttribute("aria-description")??t("notes.previewFallback"),Z=D.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{a({scopeId:k,text:z,x:Z.left,y:Z.bottom+4});},400);};return E.addEventListener("click",w),E.addEventListener("contextmenu",N),E.addEventListener("pointerover",F),E.addEventListener("scroll",m,true),()=>{E.removeEventListener("click",w),E.removeEventListener("contextmenu",N),E.removeEventListener("pointerover",F),E.removeEventListener("scroll",m,true),m();}},[n,m,t]);let f=Ye.useCallback(E=>{n&&(n.exec(E),s(null));},[n]),u=i?jp(i.scopeId):null,h=Ye.useMemo(()=>u?{type:"deleteNote",noteKind:u.noteKind,noteId:u.noteId}:null,[u]),b=Ye.useMemo(()=>u?{type:"convertNote",fromKind:u.noteKind,noteId:u.noteId}:null,[u]),v=Ye.useMemo(()=>u?{type:"convertAllNotes",fromKind:u.noteKind}:null,[u]),C=Zs(h??{type:"deleteNote",noteKind:"footnote",noteId:0}),P=Zs(b??{type:"convertNote",fromKind:"footnote",noteId:0}),S=Zs(v??{type:"convertAllNotes",fromKind:"footnote"}),y=Ye.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Ve.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),x=o?jp(o.id):null,M=x?t("notes.editingRegion",{kind:x.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:x.noteId}):null;return n?jsxRuntime.jsxs("div",{className:e,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":o?void 0:true,children:[o&&x?jsxRuntime.jsxs("div",{ref:g.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":t("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":o.id,style:{...g.style,zIndex:Ve.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:M}),jsxRuntime.jsx(sC,{onOpenProperties:()=>l(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:y,onMouseDown:E=>{E.preventDefault(),E.stopPropagation();},children:r.text}):null,i&&u?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:i.x,top:i.y,zIndex:Ve.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>h&&f(h),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!P.enabled,title:P.reason??void 0,onClick:()=>b&&f(b),children:u.noteKind==="footnote"?t("notes.convertToEndnote"):t("notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>v&&f(v),children:u.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>l(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(cC,{onClose:()=>l(false),onApply:E=>{f(E),l(false);}}):null]}):null}function cC(e){let{t}=_(),n=A(),o=As(),[r,a]=Ye.useState("document"),[i,s]=Ye.useState("decimal"),[c,l]=Ye.useState("continuous"),[d,p]=Ye.useState("pageBottom"),[g,m]=Ye.useState("decimal"),[f,u]=Ye.useState("continuous"),[h,b]=Ye.useState("docEnd");Ye.useEffect(()=>{o&&(s(o.footnote.resolved.numFmt),l(o.footnote.resolved.numRestart),p(o.footnote.resolved.pos),m(o.endnote.resolved.numFmt),u(o.endnote.resolved.numRestart),b(o.endnote.resolved.pos));},[o]);let v=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,C=!o?.endnote.documentAuthored&&!o?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:Ve.modal},onClick:e.onClose,onKeyDown:P=>{P.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:P=>P.stopPropagation(),onMouseDown:P=>P.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:P=>a(P.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:i,onChange:P=>s(P.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:c,onChange:P=>l(P.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:P=>p(P.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")}),C?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:g,onChange:P=>m(P.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:f,onChange:P=>u(P.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:h,"data-testid":"docx-notes-endnote-position",onChange:P=>b(P.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(!n)return;let P={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:i,numRestart:c,position:d},endnote:{numFmt:g,numRestart:f,position:h}};n.can(P).ok&&e.onApply(P);},children:t("common.apply")})]})]})})}var Ya=Ye.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function po(){return Ye.useContext(Ya)}function em(){return Ye.useContext(Ya).target}var tm=["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"],om=["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"],nm=["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"],rm=["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"],am=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],im=["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"],lm=["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 Xa(e,t,n){return Object.assign(({icon:r,labelKey:a,shortcutKey:i,className:s,hidden:c})=>{let l=A(),{close:d}=po(),p=Oe(),{isEnabled:g,disabledReason:m}=ne(t);return c?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),shortcut:p(i??n.shortcutKey),disabled:!g,...m?{title:m}:{},onSelect:()=>{l?.exec(t),d(true);},...s?{className:s}:{},children:p(a??n.labelKey)})},{docxRow:e})}var mr=Xa("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:tm}),fr=Xa("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:om}),gr=Xa("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:rm}),br=Xa("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:lm});function Wo({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let a=A(),{close:i,clipboardRefusal:s,reportClipboardRefusal:c}=po(),l=Oe(),d=Ye.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:p,disabledReason:g}=ne(d);if(r)return null;let m=s!==null;return jsxRuntime.jsx(Le,{slot:"edit.paste",icon:e??te(nm),shortcut:l(n??"contextMenu.pasteShortcut"),disabled:!p||m,...s??g?{title:s??g??""}:{},onSelect:()=>{(async()=>{try{let f=await navigator.clipboard.readText();f&&a?.exec({type:"paste",text:f});}catch(f){c(f instanceof Error?f.message:"the clipboard is not readable");}finally{i(true);}})();},...o?{className:o}:{},children:l(t??"contextMenu.paste")})}Wo.docxRow="edit.paste";function mo(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:s,destructive:c})=>{let{close:l}=po(),d=Oe(),p=Ja(),{isEnabled:g,disabledReason:m,execute:f}=ne(t);return s||!p?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),disabled:!g,...m?{title:m}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${i?` ${i}`:""}`,onSelect:()=>{f()&&l(true);},children:d(a??n.labelKey)})},{docxRow:e})}var Uo=mo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),Go=mo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),Yo=mo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Xo=mo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),jo=mo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),Qo=mo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),Jo=mo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),pC=[{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 fo({hidden:e}){let{close:t}=po(),n=Oe(),o=Ja(),r=ne({type:"setTableCellVerticalAlignment",alignment:"top"}),a=ne({type:"setTableCellVerticalAlignment",alignment:"center"}),i=ne({type:"setTableCellVerticalAlignment",alignment:"bottom"}),s=[r,a,i];return e||!o?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":n("tableAdvanced.verticalAlignment"),children:pC.map((c,l)=>{let d=s[l];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":n(c.labelKey),title:d.disabledReason??n(c.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:p=>{p.preventDefault(),p.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:te(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}fo.docxRow="table.cellVerticalAlignment";function cm(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:s})=>{let c=A(),{close:l,tocId:d}=po(),p=Oe(),g=Ye.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:m,disabledReason:f}=ne(g);return s||d===null?null:jsxRuntime.jsx(Le,{slot:e,icon:r??te(n.paths),disabled:!m,...f?{title:f}:{},onSelect:()=>{c?.exec(g),l(true);},...i?{className:i}:{},children:p(a??n.labelKey)})},{docxRow:e})}var ja=cm("toc.refresh","entire",{labelKey:"toc.refresh",paths:am}),Qa=cm("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:im});function Ja(){return q(Ye.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function ei({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:a,onSelect:i,className:s}){let{close:c}=po();return jsxRuntime.jsx(Le,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...a!==void 0?{active:a}:{},onSelect:()=>{i?.(),c(true);},...s?{className:s}:{},children:e})}var ni=8,gC=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(mr,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(fr,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Wo,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(gr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(br,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(gt,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(gt,{slot:"review.comments",labelKey:"comments.addComment"})}];function bC(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Uo.docxRow,render:()=>jsxRuntime.jsx(Uo,{})},{kind:"row",id:Go.docxRow,render:()=>jsxRuntime.jsx(Go,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:Yo.docxRow,render:()=>jsxRuntime.jsx(Yo,{})},{kind:"row",id:Xo.docxRow,render:()=>jsxRuntime.jsx(Xo,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:jo.docxRow,render:()=>jsxRuntime.jsx(jo,{})},{kind:"row",id:Qo.docxRow,render:()=>jsxRuntime.jsx(Qo,{})},{kind:"row",id:Jo.docxRow,render:()=>jsxRuntime.jsx(Jo,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:fo.docxRow,render:()=>jsxRuntime.jsx(fo,{})}]}function hC(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:ja.docxRow,render:()=>jsxRuntime.jsx(ja,{})},{kind:"row",id:Qa.docxRow,render:()=>jsxRuntime.jsx(Qa,{})}]}function vC(e,t=false){return [...gC,...e?bC():[],...t?hC():[]]}function fm(e){if(!Ye.isValidElement(e))return null;let t=No(e,fm);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxRow=="string")return n.docxRow;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function pm(e){if(!Ye.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function yC(e){return e?.closest(".docx-editor__scroll-container")??null}function vr({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:a}){let i=Xe(),s=A(),{t:c}=_(),l=Ja(),d=Ye.useRef(null),p=Ye.useRef(null),[g,m]=Ye.useState(null),[f,u]=Ye.useState(null),[h,b]=Ye.useState(null),v=Ye.useMemo(()=>vC(l,f!==null),[l,f]),[C,P]=Ye.useState(null),S=Ye.useCallback((H=false)=>{m(null),P(null),u(null),b(null),H&&s?.focus();},[s]);Ye.useEffect(()=>{if(o)return;let H=yC(d.current);if(!H)return;let I=D=>{D.preventDefault();let k=D.button===-1||D.clientX===0&&D.clientY===0,R=H.getBoundingClientRect();u(s?.snapshot().tocContext?.id??null),b(k||!(D.target instanceof HTMLElement)?null:D.target),m(k?{x:R.left+16,y:R.top+16}:{x:D.clientX,y:D.clientY});};return H.addEventListener("contextmenu",I),()=>H.removeEventListener("contextmenu",I)},[o,s]),Ye.useEffect(()=>{o&&S();},[o,S]),Ye.useEffect(()=>{if(!g)return;let H=k=>{p.current?.contains(k.target)||S();},I=k=>{k.key==="Escape"?(k.preventDefault(),S(true)):k.key==="Tab"&&S();},D=()=>S();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",I),document.addEventListener("scroll",D,{capture:true,passive:true}),window.addEventListener("blur",D),window.addEventListener("resize",D),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",I),document.removeEventListener("scroll",D,true),window.removeEventListener("blur",D),window.removeEventListener("resize",D);}},[g,S]),Ye.useLayoutEffect(()=>{let H=p.current;if(!g||!H)return;let{width:I,height:D}=H.getBoundingClientRect(),k=window.innerWidth-I-ni,R=window.innerHeight-D-ni,z=Math.max(ni,g.x>k?g.x-I:g.x),Z=Math.max(ni,g.y>R?g.y-D:g.y);P({x:z,y:Z});},[g]),Ye.useLayoutEffect(()=>{C&&p.current?.focus({preventScroll:true});},[C]);let y=Ye.useRef(r);y.current=r;let x=Ye.useRef(false);Ye.useEffect(()=>{let H=g!==null;H!==x.current&&(x.current=H,y.current?.(H));},[g]);let M=Ye.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>S(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,S]),[E,w]=Ye.useState(null),N=Ye.useMemo(()=>({close:S,anchor:g,tocId:f,target:h,clipboardRefusal:E,reportClipboardRefusal:w}),[S,g,f,h,E]),F={position:"fixed",left:(C??g)?.x??0,top:(C??g)?.y??0,visibility:C?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:g?jsxRuntime.jsx($n.Provider,{value:M,children:jsxRuntime.jsx(Ya.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:p,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${i}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:F,onKeyDown:H=>{let I=p.current;if(!I)return;let D=Jt(I);H.key==="ArrowDown"?(H.preventDefault(),at(D,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),at(D,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),it(D,"first")):H.key==="End"&&(H.preventDefault(),it(D,"last"));},children:[Ye.Children.toArray(a).filter(pm),Yr({entries:v,children:Ye.Children.toArray(a).filter(H=>!pm(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:fm,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(no,{}):H.render()})]})})}):null})}var Ks=Object.assign(vr,{Cut:mr,Copy:fr,Paste:Wo,Delete:gr,SelectAll:br,InsertRowAbove:Uo,InsertRowBelow:Go,InsertColumnLeft:Yo,InsertColumnRight:Xo,DeleteTableRow:jo,DeleteTableColumn:Qo,DeleteTable:Jo,CellVerticalAlignment:fo,RefreshToc:ja,RefreshTocPageNumbers:Qa,Item:ei,Slot:gt,Row:Le,Group:Gn,Separator:no,Submenu:oo});function zs(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var bm=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"})}),CC="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",PC="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",EC={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},wC={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},MC={color:"var(--doc-text-muted)",flexShrink:0},kC={textAlign:"right",wordBreak:"break-word"},IC={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},RC={display:"flex",gap:8,marginTop:4},hm={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 _C(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 "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function NC(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 en({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:wC,"data-testid":n,children:[jsxRuntime.jsx("span",{style:MC,children:e}),jsxRuntime.jsx("span",{style:kC,children:t})]})}function DC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=pt(),i=Ye.useRef(null),s=Ye.useId(),{t:c}=_(),{control:l,inspectorOpen:d,closeInspector:p}=a;if(Ye.useEffect(()=>{if(!d)return;let u=b=>{b.key==="Escape"&&(b.preventDefault(),p());},h=b=>{let v=i.current;v&&b.target instanceof Node&&v.contains(b.target)||p();};return document.addEventListener("keydown",u),document.addEventListener("mousedown",h,true),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",h,true);}},[d,p]),Ye.useEffect(()=>{d&&!l&&p();},[d,l,p]),n||!d||!l)return null;let g=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vm,{}),jsxRuntime.jsx(ym,{}),jsxRuntime.jsx("div",{style:RC,children:jsxRuntime.jsx(xm,{})}),o]}):o,m={ref:i,role:"dialog","aria-modal":false,"aria-labelledby":s,"data-testid":"content-control-inspector","data-control-id":l.id,"data-control-type":l.controlType,...l.locked?{"data-locked":""}:{},...l.bound?{"data-bound":""}:{},...l.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:EC,onMouseDown:u=>{zs(u),u.stopPropagation();}},f=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:s,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),g]});return t?jsxRuntime.jsx(W,{...m,children:f}):jsxRuntime.jsx("div",{...m,children:f})}function vm({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=pt(),{t:a}=_();if(n)return null;let i={style:IC,className:e??void 0,"data-testid":"content-control-inspector-header"},s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??a("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":a("common.close"),title:a("common.close"),style:{...hm,padding:4,border:"none",background:"transparent"},onMouseDown:zs,onClick:()=>r(),children:bm(CC)})]});return t?jsxRuntime.jsx(W,{...i,children:s}):jsxRuntime.jsx("div",{...i,children:s})}function ym({className:e,asChild:t,hidden:n,children:o}){let{control:r}=pt(),{t:a}=_();if(n||!r)return null;let i=a("contentControl.inspectorPanel.empty"),s=a("contentControl.inspectorPanel.yes"),c=a("contentControl.inspectorPanel.no"),l=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.alias"),value:r.alias??i,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.tag"),value:r.tag??i,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.type"),value:a(_C(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.lock"),value:a(NC(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.placeholder"),value:r.placeholder?s:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(en,{label:a("contentControl.inspectorPanel.bound"),value:r.bound?s:c,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:a("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:a("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(W,{...d,children:l}):jsxRuntime.jsx("div",{...d,children:l})}function xm({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:s,closeInspector:c}=pt(),{t:l}=_();if(n)return null;let d=l("contentControl.remove"),p={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":d,title:i??d,style:hm,onMouseDown:zs,onClick:()=>{s().ok&&c();}},g=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??bm(PC),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(W,{...p,children:g}):jsxRuntime.jsx("button",{...p,children:g})}var ri=Object.assign(DC,{Header:vm,Fields:ym,Remove:xm});var AC={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},OC={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},ZC={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},BC={display:"flex",justifyContent:"center",flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",backgroundColor:"var(--doc-bg)"},qC={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},KC={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:30,backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},zC={padding:"8px 12px"},VC={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},$C={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},WC={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function UC({forwardedRef:e}){let t=A(),n=Ye.useRef(null);return n.current=t,Gc({ref:e,editorRef:n}),null}var GC=Ye.forwardRef(function(t,n){let{document:o,fonts:r,className:a,t:i,chrome:s=true,title:c,onTitleChange:l,renderTitleBarLeft:d,renderTitleBarRight:p,colorMode:g="light",author:m,locale:f,mode:u="edit",modules:h,zoom:b,zoomMode:v,onReady:C,onChange:P,onFontError:S,onOpen:y,onSave:x,hyperlinkPopup:M,contextMenu:E=true,menu:w=true,navigation:N=true,rulers:F=true}=t,[H,I]=Ye.useState(gc);Ye.useEffect(()=>{if(g==="system")return hc(I)},[g]);let D=bc(g,H),{t:k}=_(),R=Ye.useCallback((Q,Me)=>i?i(Q,Me):k(Q,Me),[i,k]),z=jsxRuntime.jsxs($r,{className:s?D?"dark":void 0:a,style:s?OC:void 0,children:[s?jsxRuntime.jsx($a,{}):null,s?jsxRuntime.jsx(Ga,{}):null,jsxRuntime.jsx(Fr,{}),jsxRuntime.jsx(Ua,{hidden:M===false}),E===false?null:jsxRuntime.jsx(vr,{t:R,...typeof E=="object"?E:{}}),jsxRuntime.jsx(ri,{}),F&&s?jsxRuntime.jsx("div",{style:qC,"aria-hidden":"true",children:jsxRuntime.jsx(Na,{})}):null,t.children]}),Z=s?jsxRuntime.jsxs("div",{className:`docx-editor${D?" dark":""}${a?` ${a}`:""}`,style:AC,children:[jsxRuntime.jsxs("div",{style:KC,children:[jsxRuntime.jsxs("div",{style:VC,children:[d?.(),jsxRuntime.jsxs("div",{style:$C,children:[l?jsxRuntime.jsx("input",{"aria-label":R("titleBar.documentNameAriaLabel"),value:c??"",placeholder:R("titleBar.untitled"),onChange:Q=>l(Q.target.value),style:WC}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??R("titleBar.untitled")}),w!==false?jsxRuntime.jsx(jn,{t:R,...c!==void 0?{fileName:c}:{},...y?{onOpen:y}:{},...x?{onSave:x}:{},...typeof w=="object"?w:{}}):null]}),p?.()]}),jsxRuntime.jsx("div",{style:zC,children:jsxRuntime.jsx(zn,{t:R})})]}),F?jsxRuntime.jsx("div",{style:BC,children:jsxRuntime.jsx(_a,{})}):null,jsxRuntime.jsx(Ka,{t:R}),jsxRuntime.jsxs("div",{style:ZC,children:[N?jsxRuntime.jsx(qa,{t:R}):null,z,jsxRuntime.jsx(Ss.Provider,{value:R,children:jsxRuntime.jsx(Cs,{})}),jsxRuntime.jsx(Or,{overlay:true})]})]}):z,$=Ye.useCallback(Q=>R(Q),[R]);return jsxRuntime.jsxs(zr,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...m!==void 0?{author:m}:{},...f!==void 0?{locale:f}:{},translate:R,mode:u,...h!==void 0?{modules:h}:{},...b!==void 0?{zoom:b}:{},...v!==void 0?{zoomMode:v}:{},tableInteractionLabel:$,...C?{onReady:C}:{},...P?{onChange:P}:{},...S?{onFontError:S}:{},children:[jsxRuntime.jsx(UC,{forwardedRef:n}),jsxRuntime.jsx(Qt.Provider,{value:s,children:Z})]})}),YC=Ye.forwardRef(function(t,n){return jsxRuntime.jsx(wo,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(GC,{...t,ref:n})})}),XC=Object.assign(YC,{Root:zr,Viewport:$r,Content:Fr,Toolbar:zn,Menu:jn,Loading:Or,HorizontalRuler:_a,VerticalRuler:Na,DocumentOutline:fs,Navigation:qa,PageSetupDialog:Vn,PageNumber:Cs,FontNotice:Ka,HeaderFooterChrome:$a,NotesChrome:Ga,HyperLink:Ua,ContextMenu:Ks,ContentControl:ri});function JC(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function eP(e){return typeof e=="function"?e():e}function tP(e,t={}){let[n,o]=Ye.useState(void 0),[r,a]=Ye.useState(void 0),[i,s]=Ye.useState(null),[c,l]=Ye.useState(e!=null),[d,p]=Ye.useState(t.fonts===void 0),g=Ye.useRef(t);return g.current=t,Ye.useEffect(()=>{let m=g.current.fonts;if(m===void 0)return;let f=true;return (async()=>{try{let u=await eP(m);f&&a(editor.composeFontConfiguration(u));}catch{}finally{f&&p(true);}})(),()=>{f=false;}},[]),Ye.useEffect(()=>{if(e==null){o(void 0),s(null),l(false);return}let m=JC(e);if(m){o(m),s(null),l(false);return}let f=true,u=new AbortController;return l(true),s(null),(async()=>{try{let h=await fetch(String(e),{...g.current.fetchOptions,signal:u.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let b=new Uint8Array(await h.arrayBuffer());if(!f)return;o(b),l(!1);}catch(h){if(!f||h instanceof Error&&h.name==="AbortError")return;s(h instanceof Error?h:new Error("could not open the document")),l(false);}})(),()=>{f=false,u.abort();}},[e]),{document:d?n:void 0,fonts:r,error:i,isLoading:c||!d}}function aP(e,...t){let n=Ye.useRef({source:e,fragments:t});return n.current={source:e,fragments:t},Ye.useMemo(()=>async o=>{let r=n.current,i=[typeof r.source=="function"?await r.source(o):await r.source,...r.fragments].filter(l=>l!==void 0);if(i.length===0)return;let{epoch:s,...c}=editor.composeFontConfiguration(i[0],...i.slice(1));return c},[])}function sP(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function cP(){let e=A(),t=Ye.useRef(null),n=Ye.useCallback(r=>{if(!e)return ()=>{};let a=e.on("selectionChange",r),i=e.on("change",r);return ()=>{a(),i();}},[e]),o=Ye.useCallback(()=>{let r=sP(e),a=t.current;return (r===null?a===null:a!==null&&dP(a,r))?a:(t.current=r,r)},[e]);return Ye.useSyncExternalStore(n,o,()=>null)}function dP(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function Vs({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:a,documentFontFamily:i,ref:s}){let c=Ye.useRef(null),l=Ye.useRef(null),[d,p]=Ye.useState(null),g=Ye.useRef(o);g.current=o;let m=Ye.useRef(r);return m.current=r,Ye.useEffect(()=>{let f=c.current;if(!f)return;let u=editor.mountPaginatedSurface(f,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:b=>{p(b),g.current?.(b);}});if(!u.ok){m.current?.(u.reason,u.detail);return}l.current=u.surface;let h=u.surface.state();return p(h),g.current?.(h),()=>{u.surface.destroy(),l.current=null;}},[e,n]),Ye.useImperativeHandle(s,()=>({focus:()=>l.current?.focus(),type:f=>l.current?.type(f),undo:()=>l.current?.undo(),redo:()=>l.current?.redo(),selectAll:()=>l.current?.selectAll(),navigate:(f,u)=>l.current?.navigate(f,u),toggleRunProperty:(f,u)=>l.current?.toggleRunProperty(f,u),setRunProperty:(f,u)=>l.current?.setRunProperty(f,u),setParagraphProperty:(f,u)=>l.current?.setParagraphProperty(f,u),formatting:()=>l.current?.formatting()??null,sectionProperties:()=>l.current?.sectionProperties()??null,save:()=>{let f=l.current;return f?(f.flushPendingInput(),f.session.save()):null}}),[]),jsxRuntime.jsx("div",{ref:c,style:{margin:"24px auto",...i?{fontFamily:i}:{}},className:a?`docx-paginated-surface ${a}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Tr=Ye.createContext(null);function Em(){let e=Ye.useContext(Tr);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function yP(e){return "type"in e&&e.type==="separator"}var km={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"},xP={...km,background:"var(--doc-bg-hover)"},Im={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"},TP={...Im,opacity:.4,cursor:"default"},SP={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},CP={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},PP={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 Sr({label:e,items:t,disabled:n,showChevron:o=false}){let[r,a]=Ye.useState(false),[i,s]=Ye.useState(null),c=Ye.useRef(null),l=Ye.useRef(null),[d,p]=Ye.useState({top:0,left:0}),g=Ye.useCallback(()=>{a(false),s(null);},[]);Ye.useEffect(()=>{if(!r||!c.current)return;let f=c.current.getBoundingClientRect();p({top:f.bottom+2,left:f.left});},[r]),Ye.useEffect(()=>{if(!r)return;function f(b){let v=b.target;c.current&&!c.current.contains(v)&&l.current&&!l.current.contains(v)&&g();}function u(b){b.key==="Escape"&&g();}function h(){g();}return document.addEventListener("mousedown",f),document.addEventListener("keydown",u),window.addEventListener("scroll",h,true),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",u),window.removeEventListener("scroll",h,true);}},[r,g]);let m=f=>{f.disabled||f.submenuContent||f.onClick&&(f.onClick(),g());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&a(!r),onMouseDown:f=>f.preventDefault(),disabled:n,style:r?xP:km,children:[e,o&&jsxRuntime.jsx(K,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:l,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:f=>f.preventDefault(),children:t.map((f,u)=>{if(yP(f))return jsxRuntime.jsx("div",{style:SP},`sep-${u}`);let h=f;if(h.customContent)return jsxRuntime.jsx("div",{onMouseDown:C=>C.preventDefault(),children:h.customContent},h.label);let b=!!h.submenuContent,v=i===h.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>b&&s(h.label),onMouseLeave:()=>b&&s(null),children:[jsxRuntime.jsxs("button",{type:"button",style:h.disabled?TP:Im,onClick:()=>m(h),onMouseDown:C=>C.preventDefault(),onMouseOver:C=>{h.disabled||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:C=>{C.currentTarget.style.backgroundColor="transparent";},disabled:h.disabled,children:[h.icon&&jsxRuntime.jsx(K,{name:h.icon,size:18}),jsxRuntime.jsx("span",{children:h.label}),h.shortcut&&jsxRuntime.jsx("span",{style:CP,children:h.shortcut}),b&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),b&&v&&jsxRuntime.jsx("div",{style:PP,onMouseDown:C=>C.preventDefault(),children:h.submenuContent(g)})]},h.label)})})]})}var Us=18,wP=2,_m={width:Us,height:Us,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},MP={..._m,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},kP={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Nm({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=Ye.useState(0),[a,i]=Ye.useState(0),s=Ye.useCallback(()=>{o>0&&a>0&&e(o,a);},[o,a,e]),c=[];for(let d=1;d<=t;d++)for(let p=1;p<=n;p++){let g=d<=o&&p<=a;c.push(jsxRuntime.jsx("div",{style:g?MP:_m,onMouseEnter:()=>{r(d),i(p);},onClick:s,role:"gridcell","aria-selected":g},`${d}-${p}`));}let l=o>0&&a>0?`${a} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:wP,gridTemplateColumns:`repeat(${n}, ${Us}px)`},onMouseLeave:()=>{r(0),i(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:kP,children:l})]})}function NP({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(n=>{let o=!n.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:o,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:o?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:o?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{o||(n.onClick?.(),t());},onMouseOver:r=>{o||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(K,{name:n.icon,size:18}),jsxRuntime.jsx("span",{children:n.label})]},n.label)})})}function DP(){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 li({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function LP(e){return e.replace(/\.docx$/i,"")}function Ys({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),a=n??r("titleBar.untitled"),i=LP(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:i,onChange:s=>{let c=s.target.value;t?.(c.endsWith(".docx")?c:c+".docx");},placeholder:a,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:i||a})}function si({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function ci(){let{t:e}=_(),t=Em(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:a,onSave:i,onPageSetup:s,onInsertImage:c,onInsertTable:l,showTableInsert:d=true,showHelpMenu:p=true,onInsertPageBreak:g,onInsertSectionBreakNextPage:m,onInsertSectionBreakContinuous:f,onInsertTOC:u,onWatermark:h,onRefocusEditor:b}=t,v=Ye.useCallback(y=>{!n&&o&&o(y);},[n,o]),C=Ye.useCallback((y,x)=>{!n&&l&&(l(y,x),requestAnimationFrame(()=>b?.()));},[n,l,b]),P=!!r||!!s,S=P||a||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[S&&jsxRuntime.jsx(Sr,{label:e("toolbar.file"),disabled:n,items:[...a?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:a}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(a||i)&&P?[{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(Sr,{label:e("toolbar.format"),disabled:n,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(Sr,{label:e("toolbar.insert"),disabled:n,items:[...c?[{icon:"image",label:e("toolbar.image"),onClick:c}]:[],...d&&l?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsxRuntime.jsx(Nm,{onInsert:(x,M)=>{C(x,M),y();}})}]:[],...c||d&&l?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:y=>jsxRuntime.jsx(NP,{closeMenu:y,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:g},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:m},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:f}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:u,disabled:!u},...h?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:h}]:[]]}),p&&jsxRuntime.jsx(Sr,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Wn()}]})]})}function Xs({children:e}){let t=null,n=null,o=[],r=[];Ye.Children.forEach(e,i=>{Ye.isValidElement(i)&&(i.type===li?t=i:i.type===si?n=i:i.type===ci?r.push(i):o.push(i));});let a=Ye.useCallback(i=>{let s=i.target;s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.tagName==="SELECT"||s.tagName==="OPTION"||i.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:a,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(DP,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[o.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:o}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),n&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:n})]})}var di={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},OP={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:""},Dm={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 ZP(e,t){let n=Dm[t]??Dm[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:di[n]??"000000"}function Lm(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(n=>n+n).join("")}function js(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${Lm(e.value)??n}`;let o=Object.entries(t?.colorScheme??di).map(([a,i])=>({slot:a,hex:String(i)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:ZP(t,e.slot)}`}function wt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?Lm(e.value):js(e,t).slice(1)}function Hm(e){if(!e||e==="none")return "";let t=OP[e];return t?`#${t}`:""}var BP=[{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"}],qP=[{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 Fm(e){let t=e??di;return qP.map(n=>BP.map(o=>{let r=t[o.slot]??di[o.slot]??"000000",i={hex:n.type==="base"?r.toUpperCase():n.type==="tint"?editor.applyThemeTint(r,n.keep):editor.applyThemeShade(r,n.keep),themeSlot:o.slot,label:`${o.name}${n.labelSuffix}`};return n.type==="tint"?i.tint=n.keep:n.type==="shade"&&(i.shade=n.keep),i}))}function j(...e){return clsx.clsx(e)}var VP=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"}}),we=Ye__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:j(VP({variant:t,size:n,className:e})),ref:r,...o}));we.displayName="Button";function Je({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,a]=Ye__namespace.useState(false),[i,s]=Ye__namespace.useState({x:0,y:0}),c=Ye__namespace.useRef(null),l=Ye__namespace.useRef(null),d=Ye__namespace.useCallback(()=>{l.current=setTimeout(()=>{if(c.current){let f=c.current.getBoundingClientRect(),u=f.left+f.width/2,h=n==="top"?f.top-8:f.bottom+8;s({x:u,y:h});}a(true);},o);},[o,n]),p=Ye__namespace.useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null),a(false);},[]);Ye__namespace.useEffect(()=>()=>{l.current&&clearTimeout(l.current);},[]);let g=t.props,m=Ye__namespace.cloneElement(t,{ref:c,onMouseEnter:f=>{d(),g.onMouseEnter?.(f);},onMouseLeave:f=>{p(),g.onMouseLeave?.(f);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m,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:i.x,top:i.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var qt=pe__namespace.Root,Kt=pe__namespace.Group,ui=pe__namespace.Value;function zt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Trigger,{className:j("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(),n?.(r);},...o,children:[t,jsxRuntime.jsx(pe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(YP,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Vt({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let a=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(pe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:j("docx-editor",a&&"dark"),children:jsxRuntime.jsx(pe__namespace.Content,{className:j("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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:i=>{i.preventDefault(),o?.(i);},...r,children:jsxRuntime.jsx(pe__namespace.Viewport,{className:j("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:i=>i.preventDefault(),children:t})})})})}function bo({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Label,{className:j("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function et({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Item,{className:j("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(),n?.(r);},...o,children:[jsxRuntime.jsx(pe__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(pe__namespace.ItemIndicator,{children:jsxRuntime.jsx(XP,{className:"h-4 w-4"})})})]})}function ho({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Separator,{className:j("-mx-1 my-1 h-px bg-muted",e),...t})}function YP({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 XP({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 Qs(e){let t=e.trim();if(!t)return "";let n=null,o="";for(let r of t){if((r==='"'||r==="'")&&n===null){n=r,o+=r;continue}if(r===n){n=null,o+=r;continue}if(r===","&&n===null)break;o+=r;}return o.trim().replace(/^['"]|['"]$/g,"")}var jP=[{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 Zm({value:e,onChange:t,fonts:n=jP,documentFonts:o,disabled:r=false,className:a,placeholder:i="Arial",width:s=120,showPreview:c=true}){let{t:l}=_(),d=Ye__namespace.useMemo(()=>{if(!o)return [];let u=new Set(n.map(h=>h.name.toLowerCase()));return o.filter(h=>!u.has(h.name.toLowerCase()))},[o,n]),p=Ye__namespace.useMemo(()=>[...d,...n],[d,n]),g=Ye__namespace.useMemo(()=>e?p.find(h=>h.fontFamily===e||h.name.toLowerCase()===e.toLowerCase()||Qs(h.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:i,[e,p,i]),m=Ye__namespace.useCallback(u=>{let h=p.find(b=>b.name===u);h&&t?.(Qs(h.fontFamily)||h.name);},[t,p]),f=Ye__namespace.useMemo(()=>{let u={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(h=>{let b=h.category||"other";u[b].push(h);}),u},[n]);return jsxRuntime.jsxs(qt,{value:g,onValueChange:m,disabled:r,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm",a),style:{minWidth:typeof s=="number"?`${s}px`:s},"aria-label":l("font.selectAriaLabel"),children:jsxRuntime.jsx(ui,{placeholder:i,children:g})}),jsxRuntime.jsxs(Vt,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.documentFonts")}),d.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},`doc-${u.name}`))]}),jsxRuntime.jsx(ho,{})]}),f["sans-serif"].length>0&&jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.sansSerif")}),f["sans-serif"].map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]}),f.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.serif")}),f.serif.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),f.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(bo,{children:l("font.monospace")}),f.monospace.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))]})]}),f.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{}),jsxRuntime.jsx(Kt,{children:f.other.map(u=>jsxRuntime.jsx(et,{value:u.name,style:c?{fontFamily:u.fontFamily}:void 0,children:u.name},u.name))})]})]})]})}function Js(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function t1(e,t,n,o){let a=Math.max(8,window.innerWidth-n-8),i=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),i),left:Math.min(Math.max(8,t),a)}}function $e({isOpen:e,onClose:t,align:n="left"}){let o=Ye.useRef(null),r=Ye.useRef(null),[a,i]=Ye.useState({top:0,left:0});Ye.useEffect(()=>{if(!e||!o.current)return;let l=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),p=t1(l.bottom+4,l.right-d.width,d.width,d.height);i(p);}else i({top:l.bottom+4,left:l.left});}):i({top:l.bottom+4,left:l.left});},[e,n]),Ye.useEffect(()=>{if(!e)return;let l=performance.now()+150,d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&r.current&&!r.current.contains(f)&&t();},p=m=>{m.key==="Escape"&&t();},g=m=>{if(performance.now()<l)return;let f=m.target;f&&r.current&&r.current.contains(f)||f instanceof Element&&f!==document.documentElement&&f!==document.body&&o.current&&f.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),window.addEventListener("scroll",g,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p),window.removeEventListener("scroll",g,true);}},[e,t]);let s=Ye.useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),c={position:"fixed",top:a.top,left:a.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:s}}var r1=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],a1=1,i1=400;function Km(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function zm(e,t,n){for(let o=t.length-1;o>=0;o--)if(t[o]<e)return t[o];return Math.max(e-1,n)}function Vm({value:e,onChange:t,sizes:n=r1,disabled:o=false,className:r,placeholder:a="11",minSize:i=a1,maxSize:s=i1}){let{t:c}=_(),[l,d]=Ye.useState(false),[p,g]=Ye.useState(""),[m,f]=Ye.useState(false),u=Ye.useRef(null),h=Ye.useCallback(()=>{f(false),d(false);},[]),{containerRef:b,dropdownRef:v,dropdownStyle:C}=$e({isOpen:m,onClose:h}),P=e??(parseInt(a,10)||11),S=e!==void 0?e.toString():a,y=Ye.useCallback(I=>{if(I.preventDefault(),o)return;let D=zm(P,n,i);t?.(D);},[P,n,i,o,t]),x=Ye.useCallback(I=>{if(I.preventDefault(),o)return;let D=Km(P,n,s);t?.(D);},[P,n,s,o,t]),M=Ye.useCallback(I=>{I.preventDefault(),!o&&(d(true),g(S),f(true),requestAnimationFrame(()=>{u.current?.focus(),u.current?.select();}));},[o,S]),E=Ye.useCallback(I=>{g(I.target.value);},[]),w=Ye.useCallback(()=>{d(false);let I=parseFloat(p);if(!isNaN(I)&&I>=i&&I<=s){let D=Math.round(I*2)/2;t?.(D);}},[p,i,s,t]),N=Ye.useCallback(I=>{if(I.key==="Enter")I.preventDefault(),w(),f(false);else if(I.key==="Escape")d(false),f(false);else if(I.key==="ArrowUp"){I.preventDefault();let D=Km(P,n,s);g(D.toString()),t?.(D);}else if(I.key==="ArrowDown"){I.preventDefault();let D=zm(P,n,i);g(D.toString()),t?.(D);}},[w,P,n,s,i,t]),F=Ye.useCallback(I=>{t?.(I),f(false),d(false);},[t]),H=Ye.useCallback(I=>{I.target.tagName!=="INPUT"&&I.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:b,className:j("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:y,disabled:o||P<=i,"aria-label":c("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:l?jsxRuntime.jsx("input",{ref:u,type:"text",value:p,onChange:E,onBlur:w,onKeyDown:N,className:j("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":c("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:M,className:j("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",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":c("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":m,"data-testid":"font-size-display",children:S})}),m&&jsxRuntime.jsx("div",{ref:v,style:{...C,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":c("fontSize.listLabel"),children:n.map(I=>jsxRuntime.jsx("button",{type:"button",onClick:()=>F(I),className:j("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",I===P&&"bg-muted font-medium"),role:"option","aria-selected":I===P,children:I},I))}),jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:x,disabled:o||P>=s,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var c1=[{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"}],mi=18,d1=2,u1={position:"relative",display:"inline-block"},p1={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)"},m1={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},oc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},nc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Um={display:"grid",gap:`${d1}px`},fi={width:`${mi}px`,height:`${mi}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Gm={...fi,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},Ym={...fi,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},f1={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)"},g1={display:"flex",alignItems:"center",gap:"6px"},b1={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},h1={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},$m={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},v1={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},y1={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)"},x1={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 rc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Hm(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return js(e,n)}function Wm(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (n*299+o*587+r*114)/1e3>230}function Xm(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():wt(e,n))===t.toUpperCase():false}function T1({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,a]=Ye.useState(null);return jsxRuntime.jsx("div",{style:{...Um,gridTemplateColumns:`repeat(10, ${mi}px)`},children:e.flatMap((i,s)=>i.map((c,l)=>{let d=`${s}-${l}`,p=r===d,g=Xm(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...g?Ym:p?Gm:fi,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":g,onClick:()=>o(c),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(d),onMouseLeave:()=>a(null)},d)}))})}function S1({selectedColor:e,theme:t,onSelect:n}){let[o,r]=Ye.useState(null),{t:a}=_();return jsxRuntime.jsx("div",{style:{...Um,gridTemplateColumns:`repeat(10, ${mi}px)`},children:c1.map((i,s)=>{let c=o===s,l=Xm(e,i.hex,t),d=a(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...l?Ym:c?Gm:fi,backgroundColor:`#${i.hex}`},title:d,"aria-label":d,"aria-selected":l,onClick:()=>n(i.hex),onMouseDown:p=>p.preventDefault(),onMouseEnter:()=>r(s),onMouseLeave:()=>r(null)},i.hex)})})}function xo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:a,style:i,title:s,icon:c,autoLabel:l,splitButton:d=true,defaultColor:p}){let[g,m]=Ye.useState(false),[f,u]=Ye.useState(false),[h,b]=Ye.useState(false),[v,C]=Ye.useState(false),[P,S]=Ye.useState(""),[y,x]=Ye.useState(()=>p??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:M}=_();Ye.useEffect(()=>{let G=rc(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(G)&&S(G.toUpperCase());},[t,e,o]);let E=Ye.useCallback(()=>m(false),[]),{containerRef:w,dropdownRef:N,dropdownStyle:F}=$e({isOpen:g,onClose:E}),H=o?.colorScheme??null,I=Ye.useMemo(()=>Fm(H),[H]),D=Ye.useMemo(()=>rc(t,e,o),[t,e,o]),k=Ye.useMemo(()=>rc(y,e,o),[y,e,o]),R=Ye.useCallback(()=>{r||m(G=>!G);},[r]),z=Ye.useCallback(G=>{let B;e==="highlight"?B=G.hex:B={kind:"theme",slot:G.themeSlot,...G.tint!==void 0?{tint:G.tint}:{},...G.shade!==void 0?{shade:G.shade}:{}},x(B),n?.(B),m(false);},[e,n]),Z=Ye.useCallback(G=>{let B=e==="highlight"?G:{kind:"hex",value:G};x(B),n?.(B),m(false);},[e,n]),$=Ye.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),m(false);},[e,n]),Q=Ye.useCallback(()=>{let G=P.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(G)){let B=e==="highlight"?G:{kind:"hex",value:G};x(B),n?.(B),m(false),S("");}},[e,P,n]),Me=Ye.useCallback(()=>{r||n?.(y);},[r,y,n]),se={...p1,...r?{cursor:"default",opacity:.38}:g?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:f?{backgroundColor:"var(--doc-bg-hover)"}:{}},Te=M(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),Ce=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:w,className:`docx-color-picker ${a||""}`,style:{...u1,...i},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...v1,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...y1,...r?{cursor:"default"}:h?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:Me,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),disabled:r,title:s||Te,"aria-label":s||Te,children:[jsxRuntime.jsx(K,{name:Ce,size:18}),jsxRuntime.jsx("div",{style:{...$m,backgroundColor:k==="transparent"?"#fff":k,outline:k==="transparent"||Wm(k)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...x1,...r?{cursor:"default"}:g?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:v?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:R,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>C(true),onMouseLeave:()=>C(false),disabled:r,title:s||Te,"aria-label":s||Te,"aria-haspopup":"true","aria-expanded":g,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:se,onClick:R,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>u(true),onMouseLeave:()=>u(false),disabled:r,title:s||Te,"aria-label":s||Te,"aria-haspopup":"true","aria-expanded":g,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:Ce,size:18}),jsxRuntime.jsx("div",{style:{...$m,backgroundColor:D==="transparent"?"#fff":D,outline:D==="transparent"||Wm(D)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),g&&jsxRuntime.jsx("div",{ref:N,className:"docx-color-picker-dropdown",style:{...F,...m1},role:"dialog","aria-label":`${Te} picker`,onMouseDown:G=>{G.target.tagName!=="INPUT"&&G.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:f1,onClick:$,onMouseDown:G=>G.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"}}),l??M(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:nc}),jsxRuntime.jsx("div",{style:oc,children:M("colorPicker.themeColors")}),jsxRuntime.jsx(T1,{matrix:I,selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:nc}),jsxRuntime.jsx("div",{style:oc,children:M("colorPicker.standardColors")}),jsxRuntime.jsx(S1,{selectedColor:t,theme:o,onSelect:Z}),jsxRuntime.jsx("div",{style:nc}),jsxRuntime.jsx("div",{style:oc,children:M("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:g1,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:b1,value:P,onChange:G=>S(G.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:G=>{G.key==="Enter"&&Q();},onMouseDown:G=>{G.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...h1,opacity:/^[0-9A-Fa-f]{6}$/.test(P)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(P)?"pointer":"default"},onClick:Q,onMouseDown:G=>G.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(P),children:M("common.apply")})]})]})})]})}var Pr=20,ac=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:Pr}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_center",size:Pr}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_right",size:Pr}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_justify",size:Pr}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function Jm({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,a]=Ye.useState(false),i=Ye.useCallback(()=>a(false),[]),{containerRef:s,dropdownRef:c,dropdownStyle:l,handleMouseDown:d}=$e({isOpen:r,onClose:i}),p=Ye.useCallback(b=>{n||t?.(b),a(false);},[n,t]),g=ac.find(b=>b.value===e)||ac[0],m=o(g.labelKey),f=g.shortcutKey?o(g.shortcutKey):void 0,u=`${m}${f?` (${f})`:""}`,h=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&a(b=>!b),disabled:n,"aria-label":u,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:g.iconName,size:Pr}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?h:jsxRuntime.jsx(Je,{content:u,children:h}),r&&!n&&jsxRuntime.jsx("div",{ref:c,style:{...l,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:b=>b.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:ac.map(b=>{let v=e===b.value,C=o(b.labelKey),P=b.shortcutKey?o(b.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${C}${P?` (${P})`:""}`,"data-testid":`alignment-${b.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:S=>S.preventDefault(),onMouseEnter:S=>{v||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=v?"var(--doc-primary-light)":"transparent";},onClick:()=>p(b.value),children:jsxRuntime.jsx(K,{name:b.iconName,size:18})},b.value)})})})]})}function gi(){return {type:"none",level:0,isInList:false}}var M1={display:"inline-flex",alignItems:"center",gap:"4px"},ef={display:"inline-flex",alignItems:"center",gap:"4px"},yi={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)"},k1={...yi,backgroundColor:"var(--doc-bg-hover)"},I1={...yi,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},R1={...yi,cursor:"default",opacity:.38},_1={width:"28px",height:"28px",padding:"2px"},N1={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},bi=20;function hi({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,style:i}){let[s,c]=Ye.useState(false),l={...t?R1:e?I1:s?k1:yi,...i},d=p=>{p.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${a||""}`,style:l,onMouseDown:d,onClick:t?void 0:o,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function tf({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:a=false,className:i,style:s,showIndentButtons:c=true,compact:l=false,hasIndent:d=false}){let{t:p}=_(),g=Ye.useCallback(()=>l?{..._1}:{},[l]),m=e?.type==="bullet",f=e?.type==="numbered",h=(e?.isInList||m||f)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...M1,...s},role:"group","aria-label":p("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:ef,role:"group","aria-label":p("lists.typeAriaLabel"),children:[jsxRuntime.jsx(hi,{active:m,disabled:a,title:p("lists.bulletList"),onClick:t,style:g(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:bi})}),jsxRuntime.jsx(hi,{active:f,disabled:a,title:p("lists.numberedList"),onClick:n,style:g(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:bi})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:N1,role:"separator"}),jsxRuntime.jsxs("div",{style:ef,role:"group","aria-label":p("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(hi,{active:false,disabled:a||!h,title:p("lists.decreaseIndent"),onClick:r,style:g(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:bi})}),jsxRuntime.jsx(hi,{active:false,disabled:a,title:p("lists.increaseIndent"),onClick:o,style:g(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:bi})})]})]})]})}var L1=[{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 nf({value:e,onChange:t,options:n=L1,disabled:o=false,className:r}){let{t:a}=_(),i=Ye__namespace.useMemo(()=>e===void 0?n[0]:n.find(l=>l.twipsValue===e)||n[0],[e,n]),s=Ye__namespace.useCallback(l=>{let d=parseInt(l,10);isNaN(d)||t?.(d);},[t]),c=l=>l.labelKey?a(l.labelKey):l.label;return jsxRuntime.jsxs(qt,{value:i.twipsValue.toString(),onValueChange:s,disabled:o,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":a("lineSpacing.label"),title:a("lineSpacing.lineSpacingTitle",{label:c(i)}),children:jsxRuntime.jsx(ps,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Vt,{children:[n.map(l=>jsxRuntime.jsx(et,{value:l.twipsValue.toString(),children:c(l)},l.twipsValue)),jsxRuntime.jsx(ho,{}),jsxRuntime.jsx(Kt,{children:jsxRuntime.jsx(bo,{children:a("lineSpacing.blockSpacingRules")})})]})]})}var H1={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},F1=new Set(["Title","Heading1","Heading2","Heading3"]),A1={Subtitle:"666666"},O1="#4a6c8c";function rf(e){let t=H1[e.styleId],o={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??F1.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??A1[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=O1),o}function af(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:t.name||t.styleId,priority:99}))}var lf=[{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 sf({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:a=120}){let{t:i}=_(),s=Ye__namespace.useMemo(()=>{let m=af(n);return m.length===0?lf:m.map(f=>({...f,type:"paragraph",nameKey:lf.find(u=>u.styleId===f.styleId)?.nameKey}))},[n]),c=Ye__namespace.useCallback(m=>{t?.(m);},[t]),l=m=>m.nameKey?i(m.nameKey):m.name,d=e||"Normal",p=s.find(m=>m.styleId===d),g=p?l(p):d;return jsxRuntime.jsxs(qt,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:j("h-8 text-sm",r),style:{width:typeof a=="number"?`${a}px`:a},"aria-label":i("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:g})}),jsxRuntime.jsx(Vt,{className:"min-w-[260px] max-h-[400px]",children:s.map(m=>jsxRuntime.jsx(et,{value:m.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:rf(m),children:l(m)})},m.styleId))})]})}var B1=[{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 df({value:e=1,onChange:t,levels:n=B1,disabled:o=false,className:r,compact:a=false}){let{t:i}=_(),s=Ye__namespace.useMemo(()=>{let m=n.find(f=>Math.abs(f.value-e)<.001);return m?m.label:`${Math.round(e*100)}%`},[n,e]),c=Ye__namespace.useCallback(m=>{let f=parseFloat(m);isNaN(f)||t?.(f);},[t]),l=Ye__namespace.useMemo(()=>[...n].sort((m,f)=>m.value-f.value),[n]),d=Ye__namespace.useMemo(()=>[...l].reverse().find(m=>m.value<e-.001),[l,e]),p=Ye__namespace.useMemo(()=>l.find(m=>m.value>e+.001),[l,e]),g=a?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j(g,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(o||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:o||!d,"aria-label":i("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(qt,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:j(a?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":i("zoom.ariaLabel",{label:s}),children:jsxRuntime.jsx(ui,{placeholder:"100%",children:s})}),jsxRuntime.jsx(Vt,{children:n.map(m=>jsxRuntime.jsx(et,{value:m.value.toString(),children:m.label},m.value))})]}),jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j(g,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!p)&&"opacity-30 cursor-not-allowed"),onClick:()=>p&&t?.(p.value),disabled:o||!p,"aria-label":i("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var K1=[{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 mf({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=Ye.useState(false),a=Ye.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:s,dropdownStyle:c,handleMouseDown:l}=$e({isOpen:o,onClose:a}),d=Ye.useCallback(g=>{e(g),r(false);},[e]),p=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&r(g=>!g),disabled:t,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(K,{name:"border_all",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[o?p:jsxRuntime.jsx(Je,{content:n("table.borders.tooltip"),children:p}),o&&!t&&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:g=>g.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:K1.map(({action:g,icon:m,labelKey:f})=>jsxRuntime.jsx("button",{type:"button",title:n(f),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:u=>u.preventDefault(),onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(g),children:jsxRuntime.jsx(K,{name:m,size:18})},typeof g=="string"?g:g.type))})})]})}function ff({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),a=Ye.useCallback(i=>{if(typeof i=="string"){e({type:"borderColor",color:i.replace(/^#/,"")});return}let s=i.kind==="auto"?"000000":wt(i,n);s&&e({type:"borderColor",color:s});},[e,n]);return jsxRuntime.jsx(xo,{mode:"border",value:o,onChange:a,theme:n,disabled:t,title:r("table.borderColor")})}var W1=[{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 bf({onAction:e,disabled:t=false}){let[n,o]=Ye.useState(false),{t:r}=_(),a=Ye.useCallback(()=>o(false),[]),{containerRef:i,dropdownRef:s,dropdownStyle:c,handleMouseDown:l}=$e({isOpen:n,onClose:a}),d=Ye.useCallback(g=>{e({type:"borderWidth",size:g}),o(false);},[e]),p=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:l,onClick:()=>!t&&o(g=>!g),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(K,{name:"line_weight",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",display:"inline-block"},children:[n?p:jsxRuntime.jsx(Je,{content:r("table.borderWidth"),children:p}),n&&!t&&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:"4px 0",minWidth:120},onMouseDown:g=>g.stopPropagation(),children:W1.map(({size:g,label:m,thickness:f})=>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:u=>u.preventDefault(),onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(g),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(f,1),backgroundColor:"#000",borderRadius:f>2?1:0}}),jsxRuntime.jsx("span",{children:m})]},g))})]})}function vf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),a=Ye.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(xo,{mode:"highlight",value:o,onChange:a,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var G1={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"},Co={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Tf={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Sf({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,a]=Ye.useState(false),[i,s]=Ye.useState(null),c=Ye.useCallback(()=>a(false),[]),{containerRef:l,dropdownRef:d,dropdownStyle:p,handleMouseDown:g}=$e({isOpen:r,onClose:c,align:"right"}),m=n?.table?.attrs?.justification??"left",f=Ye.useCallback(b=>{e(b),a(false);},[e]),u=(b,v,C,P,S)=>{let y=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...G1,backgroundColor:i===b&&!y?"var(--doc-bg-hover)":"transparent",color:y?"var(--doc-text-muted)":S?.danger?"var(--doc-error)":"var(--doc-text)",cursor:y?"not-allowed":"pointer"},onClick:()=>!y&&f(P),onMouseEnter:()=>s(b),onMouseLeave:()=>s(null),disabled:y,children:[jsxRuntime.jsx(K,{name:v,size:16,className:S?.danger&&!y?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:C})]},b)},h=jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:g,onClick:()=>!t&&a(b=>!b),disabled:t,"aria-label":o("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(K,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[r?h:jsxRuntime.jsx(Je,{content:o("table.moreOptions"),children:h}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...p,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:b=>b.stopPropagation(),children:[u("addRowAbove","add",o("table.insertRowAbove"),"addRowAbove"),u("addRowBelow","add",o("table.insertRowBelow"),"addRowBelow"),u("addColumnLeft","add",o("table.insertColumnLeft"),"addColumnLeft"),u("addColumnRight","add",o("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("mergeCells","call_merge",o("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),u("splitCell","call_split",o("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("deleteRow","delete",o("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(n?.rowCount??0)<=1}),u("deleteColumn","delete",o("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(n?.columnCount??0)<=1}),u("deleteTable","delete",o("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),jsxRuntime.jsx("div",{style:Tf,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(b=>{let v={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:o({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[b]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:P=>P.preventDefault(),onMouseEnter:P=>{P.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},onClick:()=>f({type:"cellVerticalAlign",align:b}),children:jsxRuntime.jsx(K,{name:v[b],size:16})},b)})}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),jsxRuntime.jsx("div",{style:Tf,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(b=>{let v={left:"format_align_left",center:"format_align_center",right:"format_align_right"},C=m===b;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[b]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",borderColor:C?"var(--doc-primary)":"var(--doc-border)",color:C?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:P=>P.preventDefault(),onClick:()=>f({type:"tableProperties",props:{justification:b}}),children:jsxRuntime.jsx(K,{name:v[b],size:16})},b)})}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("headerRow","table_rows",o("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),u("distribute","view_column",o("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),u("autoFit","fit_width",o("tableAdvanced.autoFit"),{type:"autoFitContents"}),u("noWrap","wrap_text",o("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Co,role:"separator"}),u("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var X1=20;function Si({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:a=false,ariaLabel:i,testId:s,showLabels:c=false}){let[l,d]=Ye.useState(false),p=Ye.useCallback(()=>d(false),[]),{containerRef:g,dropdownRef:m,dropdownStyle:f,handleMouseDown:u}=$e({isOpen:l,onClose:p}),h=Ye.useCallback(v=>{a||r(v),d(false);},[a,r]),b=jsxRuntime.jsxs(we,{variant:"ghost",size:"icon-sm",className:j("text-muted-foreground hover:text-foreground hover:bg-muted/80",l&&"bg-muted",a&&"opacity-30 cursor-not-allowed"),onMouseDown:u,onClick:()=>!a&&d(v=>!v),disabled:a,"aria-label":i??o,"aria-expanded":l,"aria-haspopup":"true","data-testid":s,children:[jsxRuntime.jsx(K,{name:n,size:X1}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:g,style:{position:"relative",display:"inline-block"},children:[l?b:jsxRuntime.jsx(Je,{content:o,children:b}),l&&!a&&jsxRuntime.jsx("div",{ref:m,style:{...f,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:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(v=>{let C=t===v.value;return jsxRuntime.jsxs("button",{type:"button",title:v.label,"data-testid":s?`${s}-${v.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:C?"var(--doc-primary)":"var(--doc-text)",...c?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:P=>P.preventDefault(),onMouseEnter:P=>{C||(P.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:P=>{P.currentTarget.style.backgroundColor=C?"var(--doc-primary-light)":"transparent";},onClick:()=>h(v.value),children:[jsxRuntime.jsx(K,{name:v.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:v.label})]},v.value)})})})]})}var j1=[{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 Q1(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Pf({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=j1.map(s=>({...s,label:o(s.labelKey)})),a=Q1(e),i=r.find(s=>s.value===a)||r[0];return jsxRuntime.jsx(Si,{options:r,activeValue:a,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var e2=[{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 Ef({onTransform:e,disabled:t=false}){let{t:n}=_(),o=e2.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(Si,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ct=18;function tt({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,ariaLabel:i}){let s=i?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},l=jsxRuntime.jsx(we,{variant:"ghost",size:"icon-sm",className:j("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",a),"data-active":e?"true":void 0,onMouseDown:c,onClick:t?void 0:o,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":i||n,"data-testid":s?`toolbar-${s}`:void 0,children:r});return n?jsxRuntime.jsx(Je,{content:n,children:l}):l}function dt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:j("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":e,children:t})}function a2(e){let t=Ye__namespace.default.useContext(Tr);return t?{...t,...i2(e)}:e}function i2(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function cc(e){let{t}=_(),n=a2(e),{currentFormatting:o={},onFormat:r,onUndo:a,onRedo:i,canUndo:s=false,canRedo:c=false,disabled:l=false,className:d,style:p,enableShortcuts:g=true,editorRef:m,children:f,showFontPicker:u=true,fontFamilies:h,documentFonts:b,showFontSizePicker:v=true,showTextColorPicker:C=true,showHighlightColorPicker:P=true,showAlignmentButtons:S=true,showListButtons:y=true,showLineSpacingPicker:x=true,showStylePicker:M=true,documentStyles:E,theme:w,showZoomControl:N=true,zoom:F,onZoomChange:H,onRefocusEditor:I,imageContext:D,onImageWrapType:k,onImageTransform:R,onOpenImageProperties:z,tableContext:Z,onTableAction:$,inline:Q=false}=n,Me=Ye.useRef(null),se=Ye.useCallback(de=>{!l&&r&&r(de);},[l,r]),Te=Ye.useCallback(()=>{!l&&s&&a&&a();},[l,s,a]),Ce=Ye.useCallback(()=>{!l&&c&&i&&i();},[l,c,i]),G=Ye.useCallback(de=>{!l&&r&&r({type:"fontFamily",value:de});},[l,r]),B=Ye__namespace.default.useMemo(()=>Js(h),[h]),Pe=Ye.useCallback(de=>{!l&&r&&r({type:"fontSize",value:de});},[l,r]),Ue=Ye.useCallback(de=>{!l&&r&&r({type:"textColor",value:de});},[l,r]),ce=Ye.useCallback(de=>{!l&&r&&r({type:"highlightColor",value:typeof de=="string"?de:""});},[l,r]),Ge=Ye.useCallback(de=>{!l&&r&&r({type:"alignment",value:de});},[l,r]),rn=Ye.useCallback(()=>{!l&&r&&r("bulletList");},[l,r]),Eo=Ye.useCallback(()=>{!l&&r&&r("numberedList");},[l,r]),Mr=Ye.useCallback(()=>{!l&&r&&r("indent");},[l,r]),Hf=Ye.useCallback(()=>{!l&&r&&r("outdent");},[l,r]),Ff=Ye.useCallback(de=>{!l&&r&&(r({type:"lineSpacing",value:de}),requestAnimationFrame(()=>I?.()));},[l,r,I]),Af=Ye.useCallback(de=>{!l&&r&&r({type:"applyStyle",value:de});},[l,r]),an=Ye.useCallback(de=>{!l&&$&&($(de),requestAnimationFrame(()=>I?.()));},[l,$,I]);Ye.useEffect(()=>{if(!g)return;let de=ue=>{if(ue.defaultPrevented)return;let ln=ue.target,pc=m?.current,Bf=Me.current,qf=pc?.contains(ln),Kf=Bf?.contains(ln);if(!qf&&!Kf)return;if((ue.ctrlKey||ue.metaKey)&&!ue.altKey)switch(ue.key.toLowerCase()){case "b":ue.preventDefault(),se("bold");break;case "i":ue.preventDefault(),se("italic");break;case "u":ue.preventDefault(),se("underline");break;case "=":ue.shiftKey?(ue.preventDefault(),se("superscript")):(ue.preventDefault(),se("subscript"));break;case "l":ue.preventDefault(),Ge("left");break;case "e":ue.preventDefault(),Ge("center");break;case "r":ue.preventDefault(),Ge("right");break;case "j":ue.preventDefault(),Ge("both");break;case "k":ue.preventDefault(),se("insertLink");break}};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de);}},[g,se,Ge,m]);let Of=Ye.useCallback(de=>{let ue=de.target;ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.tagName==="OPTION"||de.preventDefault();},[]),Zf=Ye.useCallback(de=>{let ue=de.target,ln=document.activeElement;ue.tagName==="SELECT"||ue.tagName==="OPTION"||ln?.tagName==="SELECT"||requestAnimationFrame(()=>{I?.();});},[I]);return jsxRuntime.jsxs("div",{ref:Me,className:j(!Q&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:Q?{display:"contents",...p}:p,role:Q?void 0:"toolbar","aria-label":Q?void 0:t("toolbar.ariaLabel"),"data-testid":Q?void 0:"formatting-bar",onMouseDown:Q?void 0:Of,onMouseUp:Q?void 0:Zf,children:[jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(tt,{onClick:Te,disabled:l||!s,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:ct})}),jsxRuntime.jsx(tt,{onClick:Ce,disabled:l||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:ct})})]}),N&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(df,{value:F,onChange:H,disabled:l,compact:true})}),M&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(sf,{value:o.styleId||"Normal",onChange:Af,styles:E,theme:w,disabled:l,width:120})}),(u||v)&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.font"),children:[u&&jsxRuntime.jsx(Zm,{value:o.fontFamily||"Arial",onChange:G,fonts:B,documentFonts:b,disabled:l,width:60,placeholder:"Arial"}),v&&jsxRuntime.jsx(Vm,{value:o.fontSize!==void 0?rs(o.fontSize):11,onChange:Pe,disabled:l,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(tt,{onClick:()=>se("bold"),active:o.bold,disabled:l,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("italic"),active:o.italic,disabled:l,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("underline"),active:o.underline,disabled:l,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("strikethrough"),active:o.strike,disabled:l,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:ct})}),C&&jsxRuntime.jsx(xo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:Ue,theme:w,disabled:l,title:t("formattingBar.fontColor")}),P&&jsxRuntime.jsx(xo,{mode:"highlight",value:o.highlight,onChange:ce,theme:w,disabled:l,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(tt,{onClick:()=>se("insertLink"),disabled:l,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:ct})})]}),jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(tt,{onClick:()=>se("superscript"),active:o.superscript,disabled:l,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:ct})}),jsxRuntime.jsx(tt,{onClick:()=>se("subscript"),active:o.subscript,disabled:l,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:ct})})]}),S&&jsxRuntime.jsx(dt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(Jm,{value:o.alignment||"left",onChange:Ge,disabled:l})}),(y||x)&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.listFormatting"),children:[y&&jsxRuntime.jsx(tf,{listState:o.listState||gi(),onBulletList:rn,onNumberedList:Eo,onIndent:Mr,onOutdent:Hf,disabled:l,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),x&&jsxRuntime.jsx(nf,{value:o.lineSpacing,onChange:Ff,disabled:l})]}),D&&k&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Pf,{imageContext:D,onChange:k,disabled:l}),R&&jsxRuntime.jsx(Ef,{onTransform:R,disabled:l}),z&&jsxRuntime.jsx(tt,{onClick:z,disabled:l,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(K,{name:"tune",size:ct})})]}),Z?.isInTable&&$&&jsxRuntime.jsxs(dt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(mf,{onAction:an,disabled:l}),jsxRuntime.jsx(ff,{onAction:an,disabled:l,theme:w,value:wt(Z?.cellBorderColor,w)}),jsxRuntime.jsx(bf,{onAction:an,disabled:l}),jsxRuntime.jsx(vf,{onAction:an,disabled:l,theme:w,value:Z?.cellBackgroundColor}),jsxRuntime.jsx(Sf,{onAction:an,disabled:l,tableContext:Z})]}),jsxRuntime.jsx(tt,{onClick:()=>se("clearFormatting"),disabled:l,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:ct})}),f]})}function l2({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(Tr.Provider,{value:o,children:jsxRuntime.jsx("div",{className:j("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Ve.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var We=l2;We.TitleBar=Xs;We.Logo=li;We.DocumentName=Ys;We.MenuBar=ci;We.TitleBarRight=si;We.Toolbar=cc;var d2=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"]]),u2=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function p2({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:a,onSave:i,renderTitleBarLeft:s,renderTitleBarRight:c,ref:l,colorMode:d,onZoomChange:p,documentFontFamily:g,className:m}){let f=Ye.useRef(null),[u,h]=Ye.useState(null),[b,v]=Ye.useState({}),[C,P]=Ye.useState(null),S=Ye.useCallback(E=>{h(E);let w=f.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}:{}}),P(f.current?.sectionProperties()??null),r?.(E);},[r]),y=Ye.useCallback(E=>{let w=f.current;if(w){if(typeof E=="string")switch(E){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;default:return}switch(E.type){case "fontFamily":return w.setRunProperty("rFonts",{ascii:E.value,hAnsi:E.value});case "fontSize":return w.setRunProperty("sz",{val:String(Math.round(E.value*2))});case "textColor":{let N=E.value,F=typeof N=="string"?u2(N):wt(N,null)??null;return F?w.setRunProperty("color",{val:F}):void 0}case "highlightColor":{let N=E.value.trim().toLowerCase();if(N==="none"||N==="")return w.setRunProperty("highlight",{val:"none"});let F=d2.get(N.startsWith("#")?N:`#${N}`);return F?w.setRunProperty("highlight",{val:F}):void 0}case "alignment":return w.setParagraphProperty("jc",{val:String(E.value)});case "lineSpacing":return w.setParagraphProperty("spacing",{line:String(Math.round(E.value)),lineRule:"auto"});case "applyStyle":return w.setParagraphProperty("pStyle",{val:E.value});default:return}}},[]);Ye.useImperativeHandle(l,()=>f.current,[]);let x=t===void 0?1:t/(96/72),M=C?{pageWidthTwips:C.pageSize.widthTwips,pageHeightTwips:C.pageSize.heightTwips,orientation:C.landscape?"landscape":"portrait",marginsTwips:{top:C.margins.topTwips,right:C.margins.rightTwips,bottom:C.margins.bottomTwips,left:C.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",m??""].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(We,{currentFormatting:b,onFormat:y,onUndo:()=>f.current?.undo(),onRedo:()=>f.current?.redo(),canUndo:u?.canUndo??false,canRedo:u?.canRedo??false,zoom:x,onZoomChange:p,onSave:()=>{let E=f.current?.save();E&&i?.(E);},children:[jsxRuntime.jsxs(We.TitleBar,{children:[s&&jsxRuntime.jsx(We.Logo,{children:s()}),jsxRuntime.jsx(We.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(We.TitleBarRight,{children:c()}),jsxRuntime.jsx(We.MenuBar,{})]}),jsxRuntime.jsx(We.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[M?jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px 0"},children:jsxRuntime.jsx(ao,{pageSetup:M,zoom:x})}):null,jsxRuntime.jsx(Vs,{ref:f,source:e,...g?{documentFontFamily:g}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:S,...a?{onError:a}:{}})]})]})}var Pi=class{constructor(t){nt(this,"listeners",new Set);nt(this,"snapshot");nt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t);}));nt(this,"getSnapshot",()=>this.snapshot);this.snapshot=t;}setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var Ei=class extends Pi{constructor(){super({notifications:[]});nt(this,"notifications",[]);nt(this,"idCounter",0);nt(this,"timers",new Set);}showError(n,o){return this.addNotification(n,"error",o)}showWarning(n,o){return this.addNotification(n,"warning",o)}showInfo(n,o){return this.addNotification(n,"info",o)}dismiss(n){this.notifications=this.notifications.map(r=>r.id===n?{...r,dismissed:true}:r),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(r=>r.id!==n),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.emitSnapshot();}destroy(){for(let n of this.timers)clearTimeout(n);this.timers.clear(),this.notifications=[];}addNotification(n,o,r){let a=`error-${++this.idCounter}-${Date.now()}`,i={id:a,message:n,severity:o,details:r,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),o!=="error"){let s=setTimeout(()=>{this.timers.delete(s),this.dismiss(a);},5e3);this.timers.add(s);}return a}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var v2=Ye.createContext(null);function Rf({children:e}){let t=Ye.useMemo(()=>new Ei,[]),n=Ye.useSyncExternalStore(t.subscribe,t.getSnapshot),o=Ye.useCallback((l,d)=>{t.showError(l,d);},[t]),r=Ye.useCallback((l,d)=>{t.showWarning(l,d);},[t]),a=Ye.useCallback((l,d)=>{t.showInfo(l,d);},[t]),i=Ye.useCallback(l=>{t.dismiss(l);},[t]),s=Ye.useCallback(()=>{t.clearAll();},[t]),c=Ye.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:a,dismissNotification:i,clearNotifications:s}),[n.notifications,o,r,a,i,s]);return jsxRuntime.jsxs(v2.Provider,{value:c,children:[e,jsxRuntime.jsx(y2,{notifications:n.notifications,onDismiss:i})]})}function y2({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.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:n.map(r=>jsxRuntime.jsx(x2,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function x2({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=Ye.useState(false),i=(u=>{switch(u){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:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"slideIn 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},l={color:i.icon,flexShrink:0},d={flex:1,minWidth:0},p={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},g={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},m={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},f=u=>{switch(u){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.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:s,children:[jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var Ye=require('react'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),pe=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 Ye__namespace=/*#__PURE__*/_interopNamespace(Ye);var pe__namespace=/*#__PURE__*/_interopNamespace(pe);var Ic={version:"2.6.1"};var f0=Ic.version;var kc="(prefers-color-scheme: dark)";function _c(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Dc(){return _c()?window.matchMedia(kc).matches:false}function Nc(e,t){return e==="dark"||e==="system"&&t}function Lc(e){if(!_c())return ()=>{};let t=window.matchMedia(kc);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var Li=Ye.createContext(null);function A(){return Ye.useContext(Li)}var rt=Ye.createContext(null);var Hi=Ye.createContext(i18n.en),Fi=Ye.createContext("en");function _o({i18n:e,children:t}){let n=Ye.useContext(Hi),o=Ye.useContext(Fi),r=typeof e?._lang=="string"?e._lang:o,i=Ye.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Fi.Provider,{value:r,children:jsxRuntime.jsx(Hi.Provider,{value:i,children:t})})}function _(){let e=Ye.useContext(Hi),t=Ye.useContext(Fi);return {t:Ye.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function Zc(e){let{t}=_();return Ye.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var S0=()=>{},Oi=0;function C0(){return Oi}function Zi(e){let t=false;return ()=>{if(t)return;t=true;let n=globalThis.navigator?.scheduling,o=()=>{t=false,e();};n?.isInputPending?.({includeContinuous:true})?setTimeout(o,0):queueMicrotask(o);}}function B(e,t=Object.is,n){let o=A(),r=n?.onSubscribe,i=n?.onUnsubscribe,a=Ye.useCallback(d=>{if(!o)return S0;let u=false;Oi++,r?.();let m=Zi(()=>{u||d();}),g=[o.on("change",m),o.on("selectionChange",m),o.on("error",m)];return ()=>{u=true,Oi--,i?.();for(let p of g)p();}},[o,r,i]),l=Ye.useMemo(()=>{let d=false,u,m;return g=>{if(d&&g===u)return m;let p=e(g);return d&&t(m,p)?(u=g,m):(d=true,u=g,m=p,p)}},[o,e,t]),c=Ye.useCallback(()=>l(o?o.snapshot():editor.LOADING_SNAPSHOT),[o,l]),s=Ye.useCallback(()=>l(editor.LOADING_SNAPSHOT),[l]);return Ye.useSyncExternalStore(a,c,s)}var qc=12700,Bc=96;function M0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function R0(e,t,n,o){let r=e*72/n,i=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function Br(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 n=editor.sniffImageMime(e);if(!M0(n))return n==="image/svg+xml"||n==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let o=editor.validateRasterHeader(e,n);if(!o)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(o.pixelWidth*o.pixelHeight>t.maxPixels||o.pixelWidth>t.maxDimension||o.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=R0(o.pixelWidth,o.pixelHeight,Bc,Bc);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:i,heightPoints:a})}function kt(e){return Math.round(e/qc*100)/100}function gn(e){return Math.round(e*qc)}var Yt=Ye.createContext({t:void 0,onSave:void 0});function k0(){return Ye.useContext(Yt)}function qr(e){let{t}=_();return n=>e?.(n)??t(n)}function Y(){let{t:e}=Ye.useContext(Yt);return qr(e)}function F0(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function Bi(e){return typeof e=="string"}function ne(e){let t=A(),{t:n}=_(),o=Bi(e)?e:editor.editorCommandKey(e),r=Ye.useRef(e);r.current=e;let i=Ye.useCallback(c=>{let s=r.current;if(Bi(s)){let u=editor.toolbarCommandState(t,s);return {active:u.active,enabled:u.enabled,disabledReason:i18n.localizeDisabledReason(u.disabledReason,n)}}if(!t)return {active:false,enabled:false,disabledReason:null};let d=t.can(s);return {active:t.isActive(s),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,n)}},[t,o,n]),a=B(i,F0),l=Ye.useCallback(()=>{let c=r.current;return Bi(c)?editor.runToolbarCommand(t,c).ok:t?t.exec(c).ok:false},[t,o]);return Ye.useMemo(()=>({execute:l,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason}),[l,a])}function B0(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function q0(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=B0(t[o],e[o]):o==="className"?n[o]=[e[o],t[o]].filter(Boolean).join(" "):o==="style"&&(n[o]={...e[o],...t[o]});return n}function W({children:e,...t}){let n=Ye.Children.only(e);if(!Ye.isValidElement(n))return null;let o=n.props,r=q0(t,o),i=n.ref,a=t.ref;return (i||a)&&(r.ref=l=>{for(let c of [i,a])typeof c=="function"?c(l):c&&typeof c=="object"&&(c.current=l);}),Ye.cloneElement(n,r)}function X(e){for(let t of editor.CHROME_GROUPS)for(let n of t.controls)if(editor.chromeSlotId(t,n)===e)return n;return null}function te(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 O(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Xt(e){let{slot:t,icon:n,asChild:o,className:r,children:i,hidden:a}=e,{execute:l,isActive:c,isEnabled:s,disabledReason:d}=ne(t),u=Y();if(a)return null;let m=X(t),g=u(m?.labelKey??t),p=editor.commandForSlot(t),f=p?.type==="toggleMark"||p?.type==="setAlignment",b={onClick:()=>l(),onMouseDown:O,disabled:!s,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...s?{}:{"data-disabled":""},...f?{"aria-pressed":c}:{},"aria-label":g,title:d??g};return o?jsxRuntime.jsx(W,{...b,children:i}):jsxRuntime.jsx("button",{type:"button",...b,children:n??i??te(m?.paths)})}Xt.docxToolbarPart=true;var Y0="image/png,image/jpeg,image/gif",Ki=Ye.createContext(null);function zr(){let e=Ye.useContext(Ki);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function zi(){return Ye.useContext(Ki)}function Vr({children:e}){let t=A(),{t:n}=_(),o=Ye.useRef(null),r=Ye.useRef(false),i=Ye.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=B(i,(f,b)=>f.enabled===b.enabled&&f.disabledReason===b.disabledReason),l=a.enabled,c=i18n.localizeDisabledReason(a.disabledReason,n),s=Ye.useCallback(async f=>{if(!t||r.current)return;let b=Br(f);if(!b.ok){window.alert(n(b.reasonKey));return}let h={type:"insertImage",data:b.bytes,mime:b.mime,widthPoints:b.widthPoints,heightPoints:b.heightPoints},P=t.canExecuteImageCommand?.(h);if(P&&!P.ok){window.alert(P.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let x=await editor.executeImageCommand(t,h);x.ok?t.focus():window.alert(x.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=Ye.useCallback(async f=>{let b=f?.[0];if(!b)return;let h=await b.arrayBuffer();await s(new Uint8Array(h));},[s]),u=Ye.useCallback(async f=>{if(!f)return;let b=[...f.files].find(h=>h.type.startsWith("image/"));if(b){await d([b]);return}for(let h of f.items){if(h.kind!=="file"||!h.type.startsWith("image/"))continue;let P=h.getAsFile();if(!P)continue;let x=await P.arrayBuffer();await s(new Uint8Array(x));return}},[s,d]),m=Ye.useCallback(()=>{l&&o.current?.click();},[l]),g=Ye.useCallback(async f=>{let b=f.currentTarget;await d(b.files),b.value="";},[d]),p=Ye.useMemo(()=>({openFilePicker:m,insertFromFileList:d,insertFromDataTransfer:u,isEnabled:l,disabledReason:c,inputRef:o,onInputChange:g}),[m,d,u,l,c,g]);return jsxRuntime.jsxs(Ki.Provider,{value:p,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:Y0,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function $r({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=zr(),l=Y();if(t)return null;let c=X("image.insert"),s=l(c?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":s,title:a??s,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx(W,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??te(c?.paths)})}$r.docxSlot="image.insert";var bn=Object.assign($r,{docxSlot:"image.insert"});var sg=["nw","n","ne","e","se","s","sw","w"],Xc=40,Qc=12;function cg(e){return `imageOverlay.handle.${e}`}function dg(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 ug(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 pg(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 Vi({containerRef:e,portalRef:t,scrollPort:n}){let o=A(),{t:r}=_(),[i,a]=Ye.useState(null),[l,c]=Ye.useState(null),s=Ye.useRef(null);s.current=l;let d=Ye.useRef(null),u=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useRef(null),p=Ye.useRef(null);Ye.useEffect(()=>{let v=e.current;if(!v)return;let y=T=>{let w=(T.target instanceof Element?T.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");g.current=w??null,w&&w===i?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return v.addEventListener("pointerdown",y,{capture:true}),()=>v.removeEventListener("pointerdown",y,{capture:true})},[e,i?.id]),Ye.useEffect(()=>{if(!o){a(null);return}let v=()=>{a(editor.selectedDrawingOverlayTargetOf(o.surface));},y=()=>{queueMicrotask(v);};v();let T=[o.on("change",y),o.on("selectionChange",v)];return ()=>{for(let M of T)M();}},[o]),Ye.useEffect(()=>{if(n){p.current=n;return}let v=e.current;if(!v||!o?.surface)return;let y=v.closest(".docx-editor__scroll-container");if(!y)return;let T=o.surface.overlayCoordinates();return p.current=editor.createImageOverlayScrollPort(y,T.paintScale),()=>{p.current=null;}},[e,o,n]);let f=Ye.useCallback(()=>{c(null),d.current=null;let v=u.current;if(u.current=null,v)try{v.releasePointerCapture(v._lastPointerId??0);}catch{}},[]),b=Ye.useCallback((v,y,T,M,w,E,D)=>{if(!o?.surface)return;let F=editor.captureImageMutationPreconditions(o);if(!F)return;let H=o.surface.publishedLayout();d.current=Object.freeze({x:M,y:w}),u.current=E,E._lastPointerId=D;try{E.setPointerCapture(D);}catch{}c({session:Object.freeze({drawingNodeId:T.id,startBounds:Object.freeze({x:T.x,y:T.y,width:T.width,height:T.height}),startWidthEmu:T.widthEmu,startHeightEmu:T.heightEmu,startPosition:T.position,anchorFrameOrigin:T.anchorFrameOrigin,transform:T.transform,mode:v,handle:y,preconditions:F,layoutRevision:H.revision,packageRevision:o.surface.session.packageRevision(),kind:T.kind}),bounds:T,accumulatedScrollPt:0}),m.current?.focus({preventScroll:true});},[o]),h=Ye.useCallback((v,y,T,M,w)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,v)){f();return}v.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:y,heightEmu:T,...w?.mode==="simple"?{horizontalEmu:w.horizontalEmu,verticalEmu:w.verticalEmu}:{},...w?.mode==="frame"?{...w.horizontalEmu!==void 0?{horizontalEmu:w.horizontalEmu}:{},...w.verticalEmu!==void 0?{verticalEmu:w.verticalEmu}:{}}:{}}):v.mode==="move"&&w&&o.exec({type:"setImagePosition",...w}),f();},[f,o]),P=Ye.useCallback(v=>{if(!o)return;let y=s.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!y)return;if(s.current&&v.key==="Escape"){v.preventDefault(),v.stopPropagation(),f();return}if(s.current)return;let T=v.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(v.key==="Delete"||v.key==="Backspace"){v.preventDefault(),v.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(v.key))return;v.preventDefault(),v.stopPropagation();let M=v.key==="ArrowLeft"?-T:v.key==="ArrowRight"?T:0,w=v.key==="ArrowUp"?-T:v.key==="ArrowDown"?T:0;if(v.altKey){if(!y.canResize)return;let D=pg(M,w),F=editor.computeImageResizeResult({handle:D,startWidthEmu:y.widthEmu,startHeightEmu:y.heightEmu,startBounds:{x:y.x,y:y.y,width:y.width,height:y.height},startPosition:y.position,anchorFrameOrigin:y.anchorFrameOrigin,deltaXPt:M,deltaYPt:w,transform:y.transform,preserveAspect:editor.resizePreservesAspect(D,y.aspectLocked,v.shiftKey),kind:y.kind});o.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(y.kind!=="anchored"||!y.canMove||!y.position)return;let E=editor.computeMovedImagePosition(y.position,M,w);o.exec({type:"setImagePosition",...E});},[f,o]);Ye.useEffect(()=>{if(!l||!o?.surface)return;let v=o.surface.overlayCoordinates(),y=M=>{let w=s.current,E=d.current;if(!w||!E)return;let D=editor.cssPixelsToLayoutPoints(M.clientX-E.x,v.paintScale),F=editor.cssPixelsToLayoutPoints(M.clientY-E.y,v.paintScale);if(w.session.mode==="move"){let k=0,L=p.current,R=e.current?.closest(".docx-editor__scroll-container");if(L&&R){let z=R.getBoundingClientRect();M.clientY>z.bottom-Xc?k=Qc:M.clientY<z.top+Xc&&(k=-Qc),k!==0&&(k=L.scrollBy(k));}let I=w.accumulatedScrollPt+k;c({...w,accumulatedScrollPt:I,bounds:Object.freeze({...w.bounds,x:w.session.startBounds.x+D,y:w.session.startBounds.y+F+I})});return}if(!w.session.handle)return;let H=editor.computeImageResizeResult({handle:w.session.handle,startWidthEmu:w.session.startWidthEmu,startHeightEmu:w.session.startHeightEmu,startBounds:w.session.startBounds,startPosition:w.session.startPosition,anchorFrameOrigin:w.session.anchorFrameOrigin,deltaXPt:D,deltaYPt:F,transform:w.session.transform,preserveAspect:editor.resizePreservesAspect(w.session.handle,w.bounds.aspectLocked,M.shiftKey),kind:w.session.kind});c({...w,bounds:Object.freeze({...w.bounds,x:H.previewBounds.x,y:H.previewBounds.y,width:H.previewBounds.width,height:H.previewBounds.height,widthEmu:H.widthEmu,heightEmu:H.heightEmu})});},T=M=>{let w=s.current;if(w)if(M.type==="pointerup"){let E=editor.cssPixelsToLayoutPoints(M.clientX-(d.current?.x??M.clientX),v.paintScale),D=editor.cssPixelsToLayoutPoints(M.clientY-(d.current?.y??M.clientY),v.paintScale),F=editor.finalizeImageOverlayInteraction({session:w.session,deltaXPt:E,deltaYPt:D,accumulatedScrollPt:w.accumulatedScrollPt,aspectLocked:w.bounds.aspectLocked,shiftKey:M.shiftKey,anchorFrameOrigin:w.session.anchorFrameOrigin});h(w.session,F.widthEmu,F.heightEmu,F.previewBounds,F.position);}else f();};return window.addEventListener("pointermove",y),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T);}},[f,h,e,o,l]),Ye.useEffect(()=>{!i||g.current!==i.id||(g.current=null,m.current?.focus({preventScroll:true}));},[i]);let x=l?.bounds??i,C=Ye.useMemo(()=>{if(!o?.surface||!x)return null;let v=o.surface.publishedLayout(),y=o.surface.overlayCoordinates(),T=editor.overlayFrameToSheetCssPixels(v,{pageIndex:x.pageIndex,x:x.x,y:x.y,width:x.width,height:x.height},y),M=x.canResize,w=x.kind==="anchored"&&x.canMove;return jsxRuntime.jsxs("div",{ref:m,className:"docx-image-selection-overlay","data-drawing-node-id":x.id,tabIndex:0,onKeyDown:P,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${w?" docx-editor-one-surface__overlay-control":""}`,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${T.left}px`,top:`${T.top}px`,width:`${T.width}px`,height:`${T.height}px`,cursor:w?"move":"default"},onPointerDown:E=>{O(E),!(!w||!x.position)&&E.button===0&&(E.preventDefault(),E.stopPropagation(),b("move",null,x,E.clientX,E.clientY,E.currentTarget,E.pointerId));}}),M?sg.map(E=>{let D=ug(E);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(cg(E)),tabIndex:0,style:{left:`calc(${T.left}px + ${T.width}px * ${parseFloat(D.x)/100} - 5px)`,top:`calc(${T.top}px + ${T.height}px * ${parseFloat(D.y)/100} - 5px)`,cursor:dg(E)},onPointerDown:F=>{O(F),F.button===0&&(F.preventDefault(),F.stopPropagation(),b("resize",E,x,F.clientX,F.clientY,F.currentTarget,F.pointerId));}},E)}):null]})},[x,b,o,P,r]);return !C||!t.current?null:reactDom.createPortal(C,t.current)}function Wi(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Gr({className:e}){let t=A(),n=zi(),o=Ye.useRef(null),r=Ye.useRef(null);Ye.useLayoutEffect(()=>{let c=o.current;if(!(!t||!c))return t.attach(c),()=>{t.detach();}},[t]);let i=Ye.useCallback(c=>{if(!n?.isEnabled)return;let s=c.clipboardData;s&&Wi(s)&&(c.preventDefault(),n.insertFromDataTransfer(s));},[n]),a=Ye.useCallback(c=>{!n?.isEnabled||!Wi(c.dataTransfer)||c.preventDefault();},[n]),l=Ye.useCallback(c=>{n?.isEnabled&&Wi(c.dataTransfer)&&(c.preventDefault(),n.insertFromDataTransfer(c.dataTransfer));},[n]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:o,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:l}),t?jsxRuntime.jsx(Vi,{containerRef:o,portalRef:r}):null]})}var bg=e=>e.isLoading||e.isOpening===true;function Ui({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function hg({when:e=false,overlay:t=false,className:n,style:o,children:r}){let i=B(bg),{t:a}=_();if(!e&&!i)return null;let l=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:l,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ui,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:a("loading.label")})]})})}var Yr=Object.assign(hg,{Spinner:Ui});function od(){let e=new Set,t=new Map,n=new Map,o=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let m=Object.create(null),g=[...t].sort((p,f)=>(n.get(p[0])??0)-(n.get(f[0])??0));for(let[,{author:p,style:f}]of g)m[p]=f;return {authors:m,others:e.size>0?"kind":"author"}}let l=null,c=false;function s(m){if(m===void 0)return "none";if(typeof m=="string")return m;let g=Object.entries(m.authors).map(([p,f])=>`${p}\0${JSON.stringify(f)}`).sort();return `${m.others??"kind"}${g.join("")}`}function d(){if(!r)return;let m=a(),g=s(m);if(g!==l){if(m===void 0){i&&(r.setRevisionStyles("author"),i=false,l=g);return}r.setRevisionStyles(m),i=true,l=g;}}function u(){!r||c||(c=true,queueMicrotask(()=>{c=false,d();}));}return {registerScheme(m){e.add(m),u();},register(m,g,p){n.has(m)||n.set(m,o++),t.set(m,{author:g,style:p}),u();},unregister(m){(e.delete(m)||t.delete(m))&&u();},connect(m){r=m;let g=a();i=m!==null&&g!==void 0,l=m===null?null:s(g),u();},current:a}}var vn=Ye.createContext(null);function ad(){let e=Ye.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function Gi(){let e=Ye.useContext(vn),t=ad();return Ye.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function ji(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:i}=e,a=Ye.useContext(vn),l=ad();return Ye.useEffect(()=>{if(a)return a.register(l,t,{...n!==void 0?{color:n}:{},...o!==void 0?{background:o}:{},...r!==void 0?{spanClassName:r}:{},...i!==void 0?{avatarUrl:i}:{}}),()=>a.unregister(l)},[a,l,t,n,o,r,i]),null}function yn(e){return e.paragraphId===""}var Qt=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),wg=e=>e;function Mg(){let e=n=>!!n&&(n.width>0||n.height>0);if(typeof document<"u"){let o=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0),o=n.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom};let r=n.startContainer,a=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(a))return {left:a.left,top:a.bottom}}return null}var xn=Ye.createContext(null);function Yi(){let e=Ye.useContext(xn),t=Qr(e===null);return e??t}function Qr(e=true){let t=A(),[n,o]=Ye.useState(Qt),r=Ye.useRef(null),i=Ye.useRef(n);i.current=n;let a=B(wg),l=t?t.can({type:"insertText",text:""}).ok:false,c=Ye.useCallback(()=>{let x=r.current;x&&(x.editor.releaseSelection(x.pin),r.current=null);},[]),s=Ye.useCallback((x,C)=>{c(),o({mode:x?"reading":"editing",link:x??null,anchor:C??null,text:x?.text??"",url:x?x.kind==="internal"?`#${x.anchor??""}`:x.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c]),d=Ye.useCallback(()=>{c(),o(Qt);},[c]);Ye.useEffect(()=>c,[c]);let u=Ye.useCallback(()=>{let x=Mg();c();let C=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(C&&yn(C)){s(C,x);return}if(C){o({mode:"editing",link:C,anchor:x,text:C.text,url:C.kind==="internal"?`#${C.anchor??""}`:C.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let v=t?.query({type:"selectedText"})??"",y=t?.retainSelection()??null;t&&y&&(r.current={editor:t,pin:y}),o({mode:"editing",link:null,anchor:x,text:v,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s,c]);Ye.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:x=>s(x.link,{left:x.rect.left,top:x.rect.bottom}),onRequest:u})},[t,e,s,u]),Ye.useEffect(()=>{let x=i.current;if(x.mode!=="reading"||!x.link)return;let C=yn(x.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;C&&C.id===x.link.id||o(Qt);},[a,t]),Ye.useEffect(()=>{let x=i.current;if(x.mode!=="editing"||x.link)return;let C=t?.surface;!C||C.retainedSelection()||o(Qt);},[a,t]);let m=Ye.useCallback(async()=>{let x=i.current.link?.href;if(!x)return false;try{await navigator.clipboard.writeText(x);}catch{return false}return o(C=>({...C,copied:true})),true},[]),g=Ye.useCallback(()=>{o(x=>({...x,mode:"editing",copied:false,error:false}));},[]),p=Ye.useCallback(x=>{o(C=>({...C,text:x,copied:false,error:false}));},[]),f=Ye.useCallback(x=>{o(C=>({...C,url:x,copied:false,error:false}));},[]),b=Ye.useCallback(()=>{let x=i.current,C=t?.surface?.hyperlinks;if(!C)return false;let v=x.url.trim();if(v.length===0)return o(M=>({...M,error:true})),false;let y=v.startsWith("#");return C.applyHyperlink({...y?{anchor:v.slice(1)}:{url:v},...x.text.trim().length>0?{text:x.text}:{}})?(d(),true):(o(M=>({...M,error:true})),false)},[t,d]),h=Ye.useCallback(()=>{let x=t?.surface?.hyperlinks,C=i.current.link;if(!x)return false;let v=x.removeHyperlink(C?.id);return v&&d(),v},[t,d]),P=Ye.useCallback(()=>{let x=t?.surface?.navigation,C=i.current.link;if(!x||!C)return false;if(C.kind==="internal"){let y=C.anchor?x.goToBookmark(C.anchor):false;return y&&o(Qt),y}let v=x.openExternal(C.href);return v&&o(Qt),v},[t]);return Ye.useMemo(()=>({state:n.mode==="closed"?Qt:{...n,canEdit:l},open:s,openAtCaret:u,close:d,copy:m,beginEdit:g,setText:p,setUrl:f,commitEdit:b,unlink:h,openTarget:P}),[n,l,s,u,d,m,g,p,f,b,h,P])}var Be={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function _g(e){return e==="sdtLocked"||e==="sdtContentLocked"}function Dg(e){return e==="contentLocked"||e==="sdtContentLocked"}function Qi(e,t){return !e.ok&&e.code===t}function mt(){let e=Ye.useContext(Ji),t=Jr();return e??t}function Jr(){let e=A(),[t,n]=Ye.useState(false),[o,r]=Ye.useState(false),[i,a]=Ye.useState(false),l=B(T=>T),c=e?.surface??null,s=c?.contentControls;Ye.useEffect(()=>{r(s?.showAll()??c?.state().contentControls.showAll??false),a(s?.formFill()??c?.state().contentControls.formFill??false);},[l,s,c]);let d=Ye.useMemo(()=>{if(!e)return null;let T=s?.atCaret()??null;if(T){let R=s?.disabledReason(T.id,"edit")??null,I=s?.disabledReason(T.id,"remove")??null;return {id:T.id,tag:T.tag??null,alias:T.alias??null,controlType:T.controlType,locked:Dg(T.effectiveLock)||R==="locked",removalLocked:_g(T.effectiveLock)||I==="locked",placeholder:T.placeholder,bound:T.bound||R==="bound",effectiveLock:T.effectiveLock}}let M=e.query({type:"contentControlAt"});if(!M)return null;let w=s?.disabledReason(M.id,"edit")??null,E=s?.disabledReason(M.id,"remove")??null,D=e.can({type:"setContentControlValue",value:""}),F=e.can({type:"removeContentControl"}),H=M.locked===true||w==="locked"||Qi(D,"locked"),k=w==="bound"||Qi(D,"bound"),L=E==="locked"||Qi(F,"locked");return {id:M.id,tag:M.tag??null,alias:M.alias??null,controlType:M.controlType,locked:H,removalLocked:L,placeholder:false,bound:k,effectiveLock:null}},[e,l,s]),u=Ye.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,l]),m=Ye.useCallback(T=>{s?.setShowAll(T),r(T);},[s]),g=Ye.useCallback(T=>{s?.setFormFill(T),a(T);},[s]),p=Ye.useCallback(()=>m(!o),[m,o]),f=Ye.useCallback(()=>g(!i),[g,i]),b=Ye.useCallback(()=>n(true),[]),h=Ye.useCallback(()=>n(false),[]),P=Ye.useCallback(()=>n(T=>!T),[]),x=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let M=s.disabledReason(d.id,"edit");return M==="locked"?"the content control is locked":M==="bound"?"the content control is bound to external data":M==="notFound"?"the content control was not found":M}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 T=e.can({type:"setContentControlValue",value:""});return T.ok?null:T.reason},[d,s,e]),C=Ye.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let M=s.disabledReason(d.id,"remove");return M==="locked"?"the content control is locked":M==="notFound"?"the content control was not found":M}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let T=e.can({type:"removeContentControl"});return T.ok?null:T.reason},[d,s,e]),v=Ye.useCallback(T=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s&&d){let M=s.disabledReason(d.id,"edit");if(M)return {ok:false,code:M==="bound"?"bound":M==="locked"?"locked":"notFound",reason:M==="bound"?"the content control is bound to external data":M==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:T})},[e,s,d]),y=Ye.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s){let T=d?.id;if(!T)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let M=s.disabledReason(T,"remove");return M?{ok:false,code:M==="locked"?"locked":"notFound",reason:M==="locked"?"the content control is locked":"the content control was not found"}:s.remove(T)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,s,d]);return Ye.useMemo(()=>({control:d,controls:u,showAll:o,formFill:i,inspectorOpen:t,canSetValue:x===null&&d!==null,canRemove:C===null&&d!==null,setValueDisabledReason:x,removeDisabledReason:C,setShowAll:m,toggleShowAll:p,setFormFill:g,toggleFormFill:f,openInspector:b,closeInspector:h,toggleInspector:P,remove:y,setValue:v}),[d,u,o,i,t,x,C,m,p,g,f,b,h,P,y,v])}var Ji=Ye.createContext(null);function ld(){let e=0,t=0,n=null,o=new Set,r=new Set,i=new Set,a=l=>{for(let c of [...l])c();};return {getShift:()=>e,setShift(l){let c=Math.max(0,Math.round(l));c!==e&&(e=c,a(o));},subscribeShift(l){return o.add(l),()=>o.delete(l)},getReservation:()=>t,setReservation(l){let c=Math.max(0,Math.round(l));c!==t&&(t=c,a(r));},subscribeReservation(l){return r.add(l),()=>r.delete(l)},getViewport:()=>n,setViewport(l){l!==n&&(n=l,a(i));},subscribeViewport(l){return i.add(l),()=>i.delete(l)}}}var tl=Ye.createContext(null);function eo(){return Ye.useContext(tl)}var sd=()=>0,ol=()=>()=>{};function to(){let e=eo(),t=Ye.useCallback(o=>e?e.subscribeShift(o):ol(),[e]),n=Ye.useCallback(()=>e?e.getShift():0,[e]);return Ye.useSyncExternalStore(t,n,sd)}function cd(){let e=eo(),t=Ye.useCallback(o=>e?e.subscribeReservation(o):ol(),[e]),n=Ye.useCallback(()=>e?e.getReservation():0,[e]);return Ye.useSyncExternalStore(t,n,sd)}function St(){let e=eo(),t=Ye.useCallback(r=>e?e.subscribeViewport(r):ol(),[e]),n=Ye.useCallback(()=>e?e.getViewport():null,[e]),o=Ye.useCallback(()=>null,[]);return Ye.useSyncExternalStore(t,n,o)}function Zg(e,t){if(e===t)return true;let n=editor.resolveZoomMode(e),o=editor.resolveZoomMode(t);return n!==null&&o!==null&&editor.sameZoomMode(n,o)}function Bg(e){let t=Ye.useRef(e);t.current=e;let[n,o]=Ye.useState(null),{onReady:r,onChange:i,onFontError:a,...l}=e,c=Ye.useMemo(()=>({onReady:s=>{o(s),t.current.onReady?.(s);},onChange:s=>t.current.onChange?.(s),onFontError:s=>t.current.onFontError?.(s)}),[]);return {DocxEditorRoot:Pn,rootProps:l,rootListeners:c,editorRef:n}}function Pn(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:i,imageDecodePort:a,children:l}=e,{t:c}=_(),s=Ye.useCallback((v,y)=>c(v,y),[c]),d=Ye.useRef(e);d.current=e;let[u,m]=Ye.useState(null),g=Ye.useRef(null);g.current??=od();let p=g.current;Ye.useEffect(()=>{let v=d.current,y=v.translate??s,T=p.current(),M=editor.createDocxEditor({...v.document!==void 0?{document:v.document}:{},...v.fonts?{fonts:v.fonts}:{},...v.author!==void 0?{author:v.author}:{},...v.locale!==void 0?{locale:v.locale}:{},translate:y,...v.mode!==void 0?{mode:v.mode}:{},...T!==void 0?{revisionStyles:T}:{},...v.modules!==void 0?{modules:v.modules}:{},...v.zoom!==void 0?{zoom:v.zoom}:{},...v.zoomMode!==void 0?{zoomMode:v.zoomMode}:{},...v.tableInteractionLabel?{tableInteractionLabel:v.tableInteractionLabel}:{},...v.imageDecodePort?{imageDecodePort:v.imageDecodePort}:{},onFontError:E=>d.current.onFontError?.(E)}),w=M.on("change",E=>d.current.onChange?.(E));return m(M),()=>{w(),M.destroy(),m(E=>E===M?null:E);}},[t,n,s,a,p]),Ye.useEffect(()=>{if(!u)return;if(!u.snapshot().isOpening){d.current.onReady?.(u);return}let v=u.on("change",()=>{v(),d.current.onReady?.(u);});return v},[u]);let f=Ye.useRef({editor:null,zoom:void 0,mode:void 0});Ye.useEffect(()=>{if(!u)return;f.current.editor!==u&&(f.current={editor:u,zoom:void 0,mode:void 0});let y=false;o!==void 0&&o!==f.current.zoom&&(f.current.zoom=o,u.setZoom(o),y=true);let T=f.current.mode,M=r!==void 0&&(T===void 0||!Zg(T,r)),w=r===void 0?null:editor.resolveZoomMode(r),E=y&&r!==void 0&&w!==null&&w.type==="fit";(M||E)&&(f.current.mode=r,u.setZoomMode(r));},[u,o,r]),Ye.useEffect(()=>{u&&u.setTableInteractionLabel(i??editor.defaultTableLabel);},[u,i]);let[b,h]=Ye.useState(0),P=Ye.useRef([]),x=Ye.useMemo(()=>({mounted:b,register:()=>(h(v=>v+1),()=>h(v=>Math.max(0,v-1))),registerCommentDraft:v=>(P.current.push(v),()=>{let y=P.current.indexOf(v);y!==-1&&P.current.splice(y,1);}),requestCommentDraft:()=>{let v=P.current.at(-1);return v?(v(),true):false}}),[b]),C=Ye.useMemo(ld,[]);return Ye.useEffect(()=>(p.connect(u),()=>p.connect(null)),[p,u]),jsxRuntime.jsx(rt.Provider,{value:x,children:jsxRuntime.jsx(Li.Provider,{value:u,children:jsxRuntime.jsx(tl.Provider,{value:C,children:jsxRuntime.jsx(vn.Provider,{value:p,children:jsxRuntime.jsx(qg,{children:jsxRuntime.jsx(Kg,{children:jsxRuntime.jsx(Vr,{children:l})})})})})})})}function qg({children:e}){let t=Qr(true);return jsxRuntime.jsx(xn.Provider,{value:t,children:e})}function Kg({children:e}){let t=Jr();return jsxRuntime.jsx(Ji.Provider,{value:t,children:e})}function xe(e){return e/1440*96}function ea(e){return e/96*1440}function qe(e){return `${Math.round(e*100)/100}px`}function il(e){return e/2}var sl=316,ll=44,Ug=24,ta={inlineStart:0,inlineEnd:sl},dd={inlineStart:ll,inlineEnd:ll},Gg={inlineStart:0,inlineEnd:0};function md({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return dd;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return ta;let i=Number.isFinite(o)&&o>0?o:0;return t-i-n-2*Ug>=sl?ta:dd}var jg=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:t?.type==="fit"?t.maxZoom!==void 0&&t.maxZoom<editor.ZOOM_MAX?t.maxZoom:null:e.zoom}},Yg=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function fd(){let e=St(),[t,n]=Ye.useState(null);return Ye.useEffect(()=>{if(!e){n(null);return}let o=()=>n(e.clientWidth);if(o(),typeof ResizeObserver>"u")return;let r=new ResizeObserver(o);return r.observe(e),()=>r.disconnect()},[e]),t}function Ho(){let e=Ye.useContext(rt),{pageSetup:t,reviewPaneOpen:n,entitledZoom:o}=B(jg,Yg),r=St(),i=cd(),a=Ye.useRef(null);t&&(a.current=t.pageWidthTwips);let l=t?.pageWidthTwips??a.current,c=(e?.mounted??0)>0,s=Ye.useCallback(m=>c?md({open:n,viewportWidth:m??0,pageWidthPx:l===null||o===null?0:xe(l)*o,inlineStartReservation:i,docked:o===null}):Gg,[c,n,l,o,i]),[d,u]=Ye.useState(()=>s(r?r.clientWidth:null));return Ye.useEffect(()=>{let m=()=>u(s(r?r.clientWidth:null));if(m(),!r||typeof ResizeObserver>"u")return;let g=new ResizeObserver(m);return g.observe(r),()=>g.disconnect()},[r,s]),d}var oa=[.25,.5,.75,1,1.25,1.5,2];function En(e,t){return t==="in"?oa.find(o=>o>e+.001)??null:[...oa].reverse().find(o=>o<e-.001)??null}function gd(e,t){return e==="0"?1:e==="+"||e==="="?En(t,"in")??t:e==="-"?En(t,"out")??t:null}var oo=Ye.createContext(false);function je(){return Ye.useContext(oo)?"":"docx-editor "}var eb=e=>e.reviewPaneOpen??true,tb=e=>e.zoomMode?.type==="fit";function na({className:e,style:t,children:n}){let o=je(),r=A(),i=B(eb),a=Ho(),l=B(tb),s=(Ye.useContext(rt)?.mounted??0)>0,d=eo(),u=to(),m=Ye.useCallback(p=>d?.setViewport(p),[d]),g=Ye.useCallback(p=>{if(!r||!(p.metaKey||p.ctrlKey)||p.altKey)return;let f=p.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let b=gd(p.key,r.getZoom());b!==null&&(p.preventDefault(),r.setZoom(b));},[r]);return jsxRuntime.jsx("div",{ref:m,"data-testid":"docx-editor-scroll",onKeyDownCapture:g,...s?{"data-review-pane":i?"open":"closed"}:{},...l?{"data-zoom-fit":""}:{},className:`${o}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...s?{"--docx-review-gutter":`${a.inlineEnd}px`,"--docx-review-gutter-start":`${a.inlineStart}px`}:{}},children:jsxRuntime.jsx(oo.Provider,{value:true,children:n})})}var nb=editor.LOADING_SNAPSHOT;function vd({ref:e,editorRef:t}){Ye.useImperativeHandle(e,()=>({load:n=>t.current?.load(n),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(n,o)=>t.current?.exec(n,o)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:n=>t.current?.snapshot(n)??nb}),[t]);}var cb=e=>e.editingMode??"editing",dl=[{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"}],db="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function aa({className:e,hidden:t}){let n=A(),o=B(cb),r=Y(),{t:i}=_(),[a,l]=Ye.useState(false),c=Ye.useRef(null),s=Ye.useRef(null),d=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let h=d.current?.querySelectorAll('[role="menuitemradio"]');(d.current?.querySelector('[aria-checked="true"]')??h?.[0]??void 0)?.focus();},[a]);let u=Ye.useCallback(h=>{let P=[...d.current?.querySelectorAll('[role="menuitemradio"]')??[]],x=P.indexOf(document.activeElement),C=v=>{h.preventDefault(),P[(v+P.length)%P.length]?.focus();};h.key==="ArrowDown"?C(x+1):h.key==="ArrowUp"?C(x-1):h.key==="Home"?C(0):h.key==="End"&&C(P.length-1);},[]);Ye.useEffect(()=>{if(!a)return;let h=x=>{let C=c.current;C&&x.target instanceof Node&&C.contains(x.target)||l(false);},P=x=>{x.key==="Escape"&&(x.preventDefault(),l(false));};return document.addEventListener("mousedown",h,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",h,true),document.removeEventListener("keydown",P);}},[a]);let m=Ye.useCallback(h=>{l(false),editor.runToolbarCommand(n,"review.editingMode",h),n?.focus();},[n]),g=editor.toolbarCommandState(n,"review.editingMode"),p=i18n.localizeDisabledReason(g.disabledReason,i),f=Ye.useMemo(()=>dl.find(h=>h.mode===o)??dl[0],[o]);if(t)return null;let b=X("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:s,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r(b?.labelKey??"editingMode.label"),disabled:!g.enabled,...p?{title:p}:{},onMouseDown:O,onClick:()=>l(h=>!h),children:[ul(f.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:r(f.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),a?jsxRuntime.jsx("div",{ref:d,className:"docx-toolbar__mode-menu",role:"menu","aria-label":r(b?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:dl.map(h=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${h.mode}`,onMouseDown:O,onClick:()=>m(h.mode),children:[ul(h.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:r(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:r(h.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:h.mode===o?ul(db):null})]},h.mode))}):null]})}aa.docxSlot="review.editingMode";function ul(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"})})}function Fo(e,t){if(!Ye.isValidElement(e)||e.type!==Ye.Fragment)return null;let o=Ye.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function la({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:i}){if(!n)return t;let a=new Map,l=[];for(let u of Ye.Children.toArray(t)){let m=r(u);m?a.set(m,u):l.push(u);}let c=e.map((u,m)=>{let g=o(u,m),p=a.get(g);return p?jsxRuntime.jsx(Ye.Fragment,{children:p},g):jsxRuntime.jsx(Ye.Fragment,{children:i(u,m)},g)}),s=new Set(e.map(o)),d=[...a.entries()].filter(([u])=>!s.has(u)).map(([u,m])=>jsxRuntime.jsx(Ye.Fragment,{children:m},u));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,l]})}var fb=["zoom","script","format","list","alignment","styles","font","text","history"],ml=new Set(["review"]),fl=24,Cd=new Set;function Pd(e,t=fb){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Sd(e,t){let{widths:n,groups:o,order:r,fixed:i,more:a}=e,l=i;for(let s of o)l+=n.get(s)??0;if(l<=t)return Cd;l+=a;let c=new Set;for(let s of r){if(l<=t)break;let d=n.get(s);d===void 0||c.has(s)||(c.add(s),l-=d);}return c}function Ed(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}var wd=Ed;function Md(e){if(!(e.available>0))return Cd;let t=Sd(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Sd(e,e.available-(e.hysteresis));return Ed(o,n)?n:o}function Rd(e,t,n,o){return e+t+n+o*2}function Id(e,t){return e+t}function bl(e,t){return e+t}function kd(e){let t=Number.parseFloat(e.marginInlineStart||e.marginLeft),n=Number.parseFloat(e.marginInlineEnd||e.marginRight);return {start:Number.isFinite(t)?t:0,end:Number.isFinite(n)?n:0}}function gl(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function _d(e){return gl(e.columnGap)}function Dd(e,t){return e.clientWidth-gl(t.paddingLeft)-gl(t.paddingRight)}var Mn="data-toolbar-group",Rn="data-toolbar-fixed",vl="data-toolbar-more",vb=34,hl=new Set;function Ld(e,t,n){let o=Ye.useRef(null),r=Ye.useRef(new Map),i=Ye.useRef(vb),[a,l]=Ye.useState(hl),c=Ye.useRef(a);c.current=a;let s=Ye.useRef({groups:t,order:n});s.current={groups:t,order:n};let d=Ye.useCallback(()=>{let m=o.current;if(!m||!e)return;let g=getComputedStyle(m),p=_d(g),f=Dd(m,g),b=m.querySelector(".docx-toolbar__separator"),h=p*2;if(b){let y=getComputedStyle(b),T=kd(y);h=Rd(b.offsetWidth,T.start,T.end,p);}for(let y of m.querySelectorAll(`[${Mn}]`)){let T=y.getAttribute(Mn);T&&y.offsetWidth>0&&r.current.set(T,Id(y.offsetWidth,h));}let P=0;for(let y of m.querySelectorAll(`[${Rn}]`))y.offsetWidth>0&&(P+=bl(y.offsetWidth,p));let x=m.querySelector(`[${vl}]`);x&&x.offsetWidth>0&&(i.current=bl(x.offsetWidth,p));let C={available:f,widths:r.current,groups:s.current.groups,order:s.current.order,fixed:P,more:i.current,previous:c.current,hysteresis:fl},v=Md(C);wd(v,c.current)||(c.current=v,l(v));},[e]),u=Ye.useCallback(m=>{o.current=m;},[]);return Ye.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=hl,l(hl));return}d();},[e,d]),Ye.useEffect(()=>{let m=o.current;if(!e||!m||typeof ResizeObserver>"u")return;let g=0,p=new ResizeObserver(()=>{g===0&&(g=requestAnimationFrame(()=>{g=0,d();}));});p.observe(m);for(let f of m.querySelectorAll(`[${Mn}], [${Rn}]`))p.observe(f);return ()=>{g!==0&&cancelAnimationFrame(g),p.disconnect();}},[e,d,a]),{attach:u,overflow:a}}var wb=["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"],Fd=Ye.createContext({close:()=>{}});function Mb(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function Ad({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 Od({slot:e}){let t=Y(),{close:n}=Ye.useContext(Fd),{execute:o,isActive:r,isEnabled:i,disabledReason:a}=ne(e),l=X(e),c=editor.commandForSlot(e),s=c?.type==="toggleMark"||c?.type==="setAlignment",d=t(l?.labelKey??e);return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!i,...a?{title:a}:{},...s?{"aria-pressed":r}:{},...r?{"data-active":""}:{},onMouseDown:O,onClick:u=>{o(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:te(l?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:d})]})}function Zd({sections:e,className:t}){let n=Y(),[o,r]=Ye.useState(false),i=Ye.useRef(null),a=Ye.useRef(null),l=Ye.useRef(null),c=Ye.useRef(false),s=Ye.useId(),d=n("formattingBar.more"),u=Ye.useCallback(p=>{r(false),p&&a.current?.focus();},[]),m=Ye.useMemo(()=>({close:u}),[u]);Ye.useEffect(()=>{if(!o)return;let p=f=>{let b=f.target;b instanceof Node&&i.current?.contains(b)||r(false);};return document.addEventListener("mousedown",p,true),()=>document.removeEventListener("mousedown",p,true)},[o]),Ye.useEffect(()=>{if(!o||!c.current)return;c.current=false;let p=l.current;p&&Mb(p);},[o]);let g=p=>{p.key!=="Escape"||p.defaultPrevented||(p.preventDefault(),u(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[vl]:"",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":o,"aria-controls":o?s:void 0,"aria-label":d,title:d,...o?{"data-active":""}:{},onMouseDown:O,onClick:()=>r(p=>!p),onKeyDown:p=>{p.key==="ArrowDown"&&(p.preventDefault(),c.current=true,r(true));},children:te(wb)}),o?jsxRuntime.jsx(Fd.Provider,{value:m,children:jsxRuntime.jsx("div",{ref:l,id:s,role:"dialog","aria-label":d,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",onKeyDown:g,children:e.map(p=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(p.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(p.labelKey)}),p.children]},p.id))})}):null]})}function Db(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function In(e){let t=A(),n=Ye.useRef(e);n.current=e;let o=Ye.useCallback(l=>{let c=n.current,s=editor.toolbarCommandState(t,c);return {value:s.value??null,enabled:s.enabled,disabledReason:s.disabledReason}},[t,e]),r=B(o,Db),i=Ye.useMemo(()=>({execute:l=>editor.runToolbarCommand(t,"image.wrap",l),value:r.value??null,options:editor.IMAGE_WRAP_TARGETS,isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]),a=Ye.useMemo(()=>({execute:l=>editor.runToolbarCommand(t,"image.altText",l),value:r.value,options:[],isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]);return e==="image.wrap"?i:a}var xl=[{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 ua({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),i=Y(),{execute:a,value:l,isEnabled:c,disabledReason:s}=In("image.wrap"),[d,u]=Ye.useState(false),m=Ye.useRef(null),g=Ye.useRef(null),p=Ye.useRef(null),f=Ye.useId(),b=Ye.useMemo(()=>xl.find(y=>y.value===l)??xl[0],[l]),h=X("image.wrap"),P=i(h?.labelKey??"formattingBar.imageWrap");Ye.useEffect(()=>{if(!d)return;let y=M=>{let w=m.current;w&&M.target instanceof Node&&w.contains(M.target)||u(false);},T=M=>{M.key==="Escape"&&(M.preventDefault(),u(false),g.current?.focus());};return document.addEventListener("mousedown",y,true),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",y,true),document.removeEventListener("keydown",T);}},[d]);let x=Ye.useCallback(y=>{u(false),a(y);},[a]);if(t)return null;let C=r("imageWrap.tooltipPrefix",{label:r(b.labelKey)}),v={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?f:void 0,"aria-label":P,title:s??C,onMouseDown:O,onClick:()=>u(y=>!y)};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(W,{...v,children:o}):jsxRuntime.jsx("button",{...v,children:o??te(h?.paths)}),d?jsxRuntime.jsx("div",{ref:p,id:f,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:y=>y.stopPropagation(),children:xl.map(y=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":l===y.value,...l===y.value?{"data-active":""}:{},onMouseDown:O,onClick:()=>x(y.value),children:r(y.labelKey)},y.value))}):null]})}ua.docxSlot="image.wrap";var kn=Object.assign(ua,{docxSlot:"image.wrap"});function pa({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),i=Y(),{execute:a,value:l,isEnabled:c,disabledReason:s}=In("image.altText"),[d,u]=Ye.useState(false),[m,g]=Ye.useState(""),p=Ye.useRef(null),f=Ye.useRef(null),b=Ye.useId();Ye.useEffect(()=>{d&&g(l??"");},[d,l]),Ye.useEffect(()=>{if(!d)return;let v=T=>{let M=p.current;M&&T.target instanceof Node&&M.contains(T.target)||u(false);},y=T=>{T.key==="Escape"&&(T.preventDefault(),u(false),f.current?.focus());};return document.addEventListener("mousedown",v,true),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",v,true),document.removeEventListener("keydown",y);}},[d]);let h=Ye.useCallback(()=>{a(m),u(false);},[m,a]);if(t)return null;let P=X("image.altText"),x=i(P?.labelKey??"formattingBar.altText"),C={type:"button",ref:f,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?b:void 0,"aria-label":x,title:s??x,onMouseDown:O,onClick:()=>u(v=>!v)};return jsxRuntime.jsxs("div",{ref:p,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(W,{...C,children:o}):jsxRuntime.jsx("button",{...C,children:o??x}),d?jsxRuntime.jsxs("div",{id:b,role:"dialog","aria-label":r("imageAltText.panelTitle"),className:"docx-toolbar__alt-text-panel",onMouseDown:v=>v.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${b}-description`,children:r("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${b}-description`,className:"docx-dialog__textarea",value:m,onChange:v=>g(v.target.value),placeholder:r("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>u(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:h,children:r("common.apply")})]})]}):null]})}pa.docxSlot="image.altText";var _n=Object.assign(pa,{docxSlot:"image.altText"});var Ud=e=>e.image;function Wd(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 Ub(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function El(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(kt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(kt(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(kt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(kt(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function Gb(e,t){let n=El(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function ma(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=gn(t);return Number.isInteger(n)?n:null}function jb(e,t){let n=El(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,u=s?ma(e.horizontalPoints):t.position?.horizontalEmu,m=d?ma(e.verticalPoints):t.position?.verticalEmu;return s&&u===null?{ok:false}:d&&m===null?{ok:false}:u===void 0||m===void 0?{ok:false}:{ok:true,value:{horizontalEmu:u,verticalEmu:m}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,i=e.relativeToH!==n.relativeToH,a=e.relativeToV!==n.relativeToV,l=o?ma(e.horizontalPoints):t.position?.horizontalEmu,c=r?ma(e.verticalPoints):t.position?.verticalEmu;return o&&l===null?{ok:false}:r&&c===null?{ok:false}:{ok:true,value:{...typeof l=="number"?{horizontalEmu:l}:{},...typeof c=="number"?{verticalEmu:c}:{},...i||o||r?{relativeToH:e.relativeToH}:{},...a||o||r?{relativeToV:e.relativeToV}:{}}}}function fa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function ga(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function wl({open:e,onClose:t,className:n,triggerRef:o}){let r=A(),{t:i}=_(),a=B(Ud),l=Ye.useId(),c=Ye.useId(),s=Ye.useId(),d=Ye.useRef(null),u=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useRef(null),[p,f]=Ye.useState(null),[b,h]=Ye.useState(null),P=u.current,x=P?.canCrop===false,C=P?.canResize===false,v=P?.locks.changeAspect===true,y=P?.kind==="anchored"&&P.canMove===true,T=P?.kind==="inline",M=P?.kind==="anchored"&&P.canMove===false;Ye.useEffect(()=>{if(!e){u.current=null,m.current=null,g.current=null;return}if(!a)return;if(u.current=a,r?.surface){let{anchor:z}=r.surface.state().selection;m.current={paragraphId:z.paragraphId,offset:z.offset},g.current=r.surface.session.packageRevision();}h(null);let R=El(a),I=a.crop;f({widthPoints:String(kt(a.widthEmu)),heightPoints:String(kt(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,...R});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let w=Ye.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),E=Ye.useCallback(()=>{t(),w();},[t,w]);Ye.useEffect(()=>{if(!e)return;let R=d.current;if(!R)return;let I=Wd(R);(I.find(V=>V.id==="image-prop-width"&&!V.hasAttribute("disabled"))??I.find(V=>!V.hasAttribute("disabled"))??R).focus();let Z=V=>{if(V.key==="Escape"){V.preventDefault(),E();return}if(V.key!=="Tab")return;let j=Wd(R);if(j.length===0)return;let Re=document.activeElement,se=j.findIndex(Pe=>Pe===Re);if(se===-1)return;V.preventDefault();let Se=V.shiftKey?(se-1+j.length)%j.length:(se+1)%j.length;j[Se]?.focus();};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[e,E]);let D=Ye.useMemo(()=>{let R=P??a;return !R||R.widthEmu<=0?1:R.widthEmu/R.heightEmu},[a,P]),F=Ye.useCallback(R=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:R};let z=ga(R);if(z===null)return {...I,widthPoints:R};let Z=Math.round(z/D*100)/100;return {...I,widthPoints:R,heightPoints:String(Z)}});},[D]),H=Ye.useCallback(R=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,heightPoints:R};let z=ga(R);if(z===null)return {...I,heightPoints:R};let Z=Math.round(z*D*100)/100;return {...I,widthPoints:String(Z),heightPoints:R}});},[D]),k=Ye.useCallback(()=>{let R=u.current;if(!R?.intrinsic)return;let I=R.intrinsic.pixelWidth*72/R.intrinsic.dpiX,z=R.intrinsic.pixelHeight*72/R.intrinsic.dpiY;f(Z=>Z&&{...Z,widthPoints:String(Math.round(I*100)/100),heightPoints:String(Math.round(z*100)/100)});},[a]),L=Ye.useCallback(()=>{let R=u.current,I=m.current,z=g.current;if(!r||!R||!p||!I||z===null)return;let Z={type:"setImageProperties",drawingNodeId:R.id,expectedPackageRevision:z,selectionParagraphId:I.paragraphId,selectionOffset:I.offset};if(!C){let Pe=ga(p.widthPoints),G=ga(p.heightPoints);if(Pe===null||G===null){h("imageProperties.errors.invalidDimensions");return}let q=gn(Pe),Ee=gn(G);q!==R.widthEmu&&(Z.widthEmu=q),Ee!==R.heightEmu&&(Z.heightEmu=Ee);}if(R.canCrop&&!x){let Pe=fa(p.cropLeft),G=fa(p.cropTop),q=fa(p.cropRight),Ee=fa(p.cropBottom);if(Pe===null||G===null||q===null||Ee===null){h("imageProperties.errors.invalidCrop");return}let Ue=R.crop;(Pe!==Ue.left||G!==Ue.top||q!==Ue.right||Ee!==Ue.bottom)&&(Z.crop={left:Pe,top:G,right:q,bottom:Ee});}p.title!==R.title&&(Z.title=p.title),p.description!==R.description&&(Z.description=p.description);let V=p.hyperlink.trim();if(V!==(R.hyperlink??"")&&(Z.hyperlink=V===""?null:V),R.canChangeWrap&&p.wrap!==R.wrap&&(Z.wrap=p.wrap),R.kind==="anchored"&&R.canMove&&Gb(p,R)){let Pe=jb(p,R);if(!Pe.ok){h("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(Pe.value,R))){h("imageProperties.errors.invalidPosition");return}Object.assign(Z,Pe.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)){E();return}if(!r.can(Z).ok){h("imageProperties.errors.refused");return}if(!r.exec(Z).ok){h("imageProperties.errors.refused");return}E();},[r,p,x,C,E]);return !e||!p?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:E,onMouseDown:R=>{R.stopPropagation(),Ub(R);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":l,className:"docx-dialog docx-image-properties-dialog",onClick:R=>R.stopPropagation(),onMouseDown:R=>R.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:R=>F(R.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:R=>H(R.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:v,onChange:R=>f(I=>I&&{...I,lockAspect:R.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:x||!P?.intrinsic,onClick:k,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),T?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,M?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,y?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:R=>f(I=>I&&{...I,relativeToH:R.target.value}),children:editor.DRAWING_REL_FROM_H.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`dialogs.imagePosition.relativeOptions.${R}`)},R))})]}),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:R=>f(I=>I&&{...I,relativeToV:R.target.value}),children:editor.DRAWING_REL_FROM_V.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`dialogs.imagePosition.relativeOptions.${R}`)},R))})]})]}):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:R=>f(I=>I&&{...I,horizontalPoints:R.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:R=>f(I=>I&&{...I,verticalPoints:R.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:R=>f(I=>I&&{...I,title:R.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:R=>f(I=>I&&{...I,description:R.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:s,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:s,className:"docx-dialog__input docx-dialog__input--full",value:p.hyperlink,onChange:R=>f(I=>I&&{...I,hyperlink:R.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:c,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:p.wrap,disabled:P?.canChangeWrap===false,onChange:R=>f(I=>I&&{...I,wrap:R.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`imageWrap.targets.${R}`)},R))})]}),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:x,value:p.cropLeft,onChange:R=>f(I=>I&&{...I,cropLeft:R.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:x,value:p.cropTop,onChange:R=>f(I=>I&&{...I,cropTop:R.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:x,value:p.cropRight,onChange:R=>f(I=>I&&{...I,cropRight:R.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:x,value:p.cropBottom,onChange:R=>f(I=>I&&{...I,cropBottom:R.target.value})})]}),x?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:E,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:L,children:i("common.apply")})]})]})})}function ba({className:e,hidden:t,asChild:n,children:o}){let r=A(),{t:i}=_(),a=B(Ud),[l,c]=Ye.useState(false),s=Ye.useRef(null),d={type:"setImageProperties",description:"probe"},u=r&&a?r.can(d):null,m=u?.ok===true,g=u&&!u.ok?u.reason:null;if(t)return null;let p=X("image.properties"),f={type:"button",ref:s,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!m,...m?{}:{"data-disabled":""},"aria-label":i("formattingBar.imagePropertiesShortcut"),title:g??i("formattingBar.imagePropertiesShortcut"),onMouseDown:O,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(W,{...f,children:o}):jsxRuntime.jsx("button",{...f,children:o??te(p?.paths)}),jsxRuntime.jsx(wl,{open:l,onClose:()=>c(false),triggerRef:s})]})}ba.docxSlot="image.properties";var Zo=Object.assign(ba,{docxSlot:"image.properties"});function we(e){return Object.assign(n=>jsxRuntime.jsx(Xt,{slot:e,...n}),{docxSlot:e})}var Gd=we("history.undo"),jd=we("history.redo"),Yd=we("text.bold"),Xd=we("text.italic"),Qd=we("text.underline"),Jd=we("text.strike"),eu=we("format.clear"),tu=we("script.super"),ou=we("script.sub"),nu=we("alignment.left"),ru=we("alignment.center"),au=we("alignment.right"),iu=we("alignment.justify"),lu=we("list.bullet"),su=we("list.numbered"),cu=we("list.outdent"),du=we("list.indent");var uu=we("table.insert"),pu=we("review.comments");function Jb({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=A(),{openAtCaret:a}=Yi(),l=editor.chromeProbeForSlot("text.link"),c=i&&l?i.can(l):null,s=c?.ok===true,{t:d}=_(),u=i18n.localizeDisabledReason(c&&!c.ok?c.reason:null,d),m=Y();if(t)return null;let g=X("text.link"),p=m(g?.labelKey??"text.link"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!s,...s?{}:{"data-disabled":""},"aria-label":p,title:u??p,onMouseDown:O,onClick:()=>a()};return o?jsxRuntime.jsx(W,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??te(g?.paths)})}var Ml=Object.assign(Jb,{docxSlot:"text.link"});function eh({className:e,hidden:t}){let n=A(),{onSave:o}=Ye.useContext(Yt),r=Y();if(t)return null;let i=X("file.save"),a=r(i?.labelKey??"file.save"),l=!n||!o;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:O,onClick:()=>o?.(),children:te(i?.paths)})}var Rl=Object.assign(eh,{docxSlot:"file.save"});function Bo({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function qo(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var nh=e=>({zoom:e.zoom,mode:e.zoomMode}),rh=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,fu={type:"fixed"};function Il(){let e=A(),{zoom:t,mode:n}=B(nh,rh),o=Ye.useCallback(i=>{e?.setZoom(i);},[e]),r=Ye.useCallback(i=>{e?.setZoomMode(i);},[e]);return Ye.useMemo(()=>{let i=n??fu,a=En(t,"out"),l=En(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(fu),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>a!==null&&o(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:oa}},[e,t,n,o,r])}var Hn=2,Fn=3276,Ln=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],lh=e=>e.formatting?.fontSizePt??null;function hu(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function vu(e,t,n){for(let o=t.length-1;o>=0;o-=1)if(t[o]<e)return t[o];return Math.max(e-1,n)}function xu(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:O,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:O,onClick:e.onIncrease,children:"+"})]})}function sh(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let n=Number(t);if(!Number.isFinite(n))return null;let o=Math.round(n*2);return o<Hn||o>Fn?null:o}function ch({className:e,hidden:t}){let n=A(),o=B(lh),{isEnabled:r,disabledReason:i}=ne("font.size"),a=Y(),[l,c]=Ye.useState(false),[s,d]=Ye.useState(null),u=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useCallback(v=>{if(!n)return;let y=editor.commandForSlotValue("font.size",v);y&&n.can(y).ok&&n.exec(y);},[n]),p=Ye.useCallback(v=>{g(Math.min(Fn,Math.max(Hn,Math.round(v*2))));},[g]),f=Ye.useCallback(v=>{c(false),d(null),m.current?.blur(),v&&dh(u.current);},[]);if(Ye.useEffect(()=>{if(!l)return;let v=y=>{let T=u.current;T&&y.target instanceof Node&&T.contains(y.target)||(c(false),d(null));};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]),t)return null;let b=r&&o!==null,h=o===null?"\u2014":String(Math.round(o*2)/2),P=s??h,x=o===null?null:Math.round(o*2)/2,C=()=>{if(s===null)return;let v=sh(s);v!==null&&g(v);};return jsxRuntime.jsxs("span",{ref:u,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(xu,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:m,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:P,disabled:!r,role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),autoComplete:"off",onChange:v=>{d(v.target.value),c(true);},onFocus:v=>{v.target.select(),c(true);},onClick:()=>c(true),onKeyDown:v=>{v.key==="Enter"?(v.preventDefault(),C(),f(true)):v.key==="Escape"?(v.preventDefault(),f(true)):(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),c(true),o!==null&&p(v.key==="ArrowDown"?vu(o,Ln,Hn/2):hu(o,Ln,Fn/2)));},onBlur:()=>{C(),d(null);}}),canDecrease:b&&Math.round(o*2)>Hn,canIncrease:b&&Math.round(o*2)<Fn,onDecrease:()=>p(vu(o??0,Ln,Hn/2)),onIncrease:()=>p(hu(o??0,Ln,Fn/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":a("fontSize.listLabel"),children:Ln.map(v=>{let y=x===v;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":y,...y?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>{p(v),f(true);},children:v},v)})}):null]})}function dh(e){(qo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Dl=Object.assign(ch,{docxSlot:"font.size"});function uh({className:e,hidden:t}){let n=A(),{zoom:o,isFit:r,mode:i,setZoom:a,setMode:l,zoomIn:c,zoomOut:s,canZoomIn:d,canZoomOut:u,levels:m}=Il(),g=Y(),[p,f]=Ye.useState(false),b=Ye.useRef(null);Ye.useEffect(()=>{if(!p)return;let y=T=>{let M=b.current;M&&T.target instanceof Node&&M.contains(T.target)||f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let h=Ye.useCallback(y=>{f(false),a(y);},[a]),P=Ye.useCallback(y=>{f(false),l(y==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[l]);if(t)return null;let x=`${Math.round(o*100)}%`,C=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),v=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(xu,{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:!n,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":g("zoom.zoomLevel"),onMouseDown:O,onClick:()=>f(y=>!y),children:[x,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:u,canIncrease:d,onDecrease:s,onIncrease:c}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox","aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":C,...C?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>P("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":v,...v?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>P("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),m.map(y=>{let T=!r&&Math.abs(y-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":T,...T?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>h(y),children:`${Math.round(y*100)}%`},y)})]}):null]})}var Nl=Object.assign(uh,{docxSlot:"zoom.level"});var bh=[1,1.15,1.5,2,2.5,3],Su=10,hh=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),vh=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function yh({className:e,hidden:t}){let n=A(),o=B(hh,vh),{isEnabled:r,disabledReason:i}=ne("list.lineSpacing"),a=Y(),[l,c]=Ye.useState(false),s=Ye.useRef(null);Ye.useEffect(()=>{if(!l)return;let b=h=>{let P=s.current;P&&h.target instanceof Node&&P.contains(h.target)||c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]);let d=Ye.useCallback(b=>{if(c(false),!n)return;let h=editor.commandForSlotValue("list.lineSpacing",b);h&&n.can(h).ok&&n.exec(h);},[n]),u=Ye.useCallback((b,h)=>{if(c(false),!n)return;let P={type:"setParagraphSpacing",[b]:h};n.can(P).ok&&n.exec(P);},[n]);if(t)return null;let m=X("list.lineSpacing"),g=(o.spaceBeforePt??0)>0,p=(o.spaceAfterPt??0)>0,f=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:s,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":l,"aria-label":a("lineSpacing.label"),title:i??a("lineSpacing.label"),onMouseDown:O,onClick:()=>c(b=>!b),children:[te(m?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[bh.map(b=>{let h=f===b;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":h,...h?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>d(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",onMouseDown:O,onClick:()=>u("beforePt",g?null:Su),children:a(g?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>u("afterPt",p?null:Su),children:a(p?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Hl=Object.assign(yh,{docxSlot:"list.lineSpacing"});var Eh=[{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"}],Cu=[{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"}],Pu=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],ha=["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"],Nt=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Qe=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function wh(e){let t=[0,2,4].map(o=>parseInt(e.slice(o,o+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[Qe(5),Qe(15),Qe(25),Qe(35),Qe(50)]:n===0?[Nt(50),Nt(35),Nt(25),Nt(15),Nt(5)]:n>=.8?[Qe(10),Qe(25),Qe(50),Qe(75),Qe(90)]:[Nt(80),Nt(60),Nt(40),Qe(25),Qe(50)]}var Mh=/^[0-9A-Fa-f]{6}$/;function Rh(e,t){let n="";for(let o=0;o<6;o+=2){let r=Math.round(t(parseInt(e.slice(o,o+2),16)));n+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return n.toUpperCase()}function Ih(e){let t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return .299*t+.587*n+.114*o>230}function va({value:e,css:t,title:n,selected:o,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":n,title:n,"data-value":e,...o?{"data-selected":""}:{},...Ih(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function kh({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(wh),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:[o.map((a,l)=>jsxRuntime.jsx(va,{value:a,css:`#${a.toLowerCase()}`,title:t(ha[l]),selected:n===a,apply:e},`base-${l}`)),i.map(a=>o.map((l,c)=>{let s=r[c][a],d=Rh(l,s.apply);return jsxRuntime.jsx(va,{value:d,css:`#${d.toLowerCase()}`,title:`${t(ha[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${a}-${c}`)}))]})]})}function _h(e){let{apply:t,label:n,current:o}=e,[r,i]=Ye.useState(""),a=Mh.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(kh,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:Eh.map(l=>jsxRuntime.jsx(va,{value:l.value,css:l.css,title:n(l.labelKey),selected:o===l.value,apply:t},l.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("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":n("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:O,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function Al({apply:e,current:t}){let n=A(),o=Y(),r=n?.getDocumentThemeColors()??[],i=r.length===ha.length?r.map(l=>l.hex):Pu,a=t?.toUpperCase()??null;return jsxRuntime.jsx(_h,{apply:e,label:o,current:a,themeHexes:i})}var Dh=Cu.filter(e=>e.value!=="white");function Nh({apply:e,label:t,current:n}){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:Dh.map(o=>jsxRuntime.jsx(va,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function Eu(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:c,hidden:s,icon:d})=>{let u=A(),{isEnabled:m,disabledReason:g}=ne(t),p=Y(),[f,b]=Ye.useState(false),[h,P]=Ye.useState(n),x=Ye.useRef(null),C=B(E=>{if(a){let D=E.formatting?.color;return D&&D.kind==="hex"?D.value.toUpperCase():null}return E.formatting?.highlight??null}),v=u?.getDocumentThemeColors()??[],y=v.length===ha.length?v.map(E=>E.hex):Pu;Ye.useEffect(()=>{if(!f)return;let E=D=>{let F=x.current;F&&D.target instanceof Node&&F.contains(D.target)||b(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[f]);let T=Ye.useCallback(E=>{if(b(false),!u)return;let D=editor.commandForSlotValue(t,E);D&&u.can(D).ok&&(u.exec(D),E!==r.value&&P(E));},[u]),M=Ye.useMemo(()=>X(t),[]);if(s)return null;let w=p(M?.labelKey??t);return jsxRuntime.jsxs("div",{ref:x,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!m,...m?{}:{"data-disabled":""},"aria-label":w,title:g??w,onMouseDown:O,onClick:()=>T(h),children:[d??te(M?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(h)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!m,...m?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":f,"aria-label":w,title:g??w,onMouseDown:O,onClick:()=>b(E=>!E),children:"\u25BE"}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":w,onMouseDown:O,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>T(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:T,label:p,current:C,themeHexes:y})]}):null]})},{docxSlot:t})}var Lh=new Map(Cu.map(e=>[e.value,e.css])),Ol=Eu({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Al,{apply:e.apply,current:e.current})}),Zl=Eu({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Lh.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Nh,{...e})});var Zh=["alignment.left","alignment.center","alignment.right","alignment.justify"];function Bh({className:e,hidden:t}){let n=ne("alignment.left"),o=ne("alignment.center"),r=ne("alignment.right"),i=ne("alignment.justify"),a=Y(),[l,c]=Ye.useState(false),s=Ye.useRef(null);if(Ye.useEffect(()=>{if(!l)return;let f=b=>{let h=s.current;h&&b.target instanceof Node&&h.contains(b.target)||c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),t)return null;let d=[n,o,r,i],u=Zh.map((f,b)=>({slot:f,control:X(f),state:d[b]})),m=u.find(f=>f.state.isActive)??u[0],g=u.some(f=>f.state.isEnabled),p=a(m.control?.labelKey??m.slot);return jsxRuntime.jsxs("div",{ref:s,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:m.state.disabledReason??p,onMouseDown:O,onClick:()=>c(f=>!f),children:[te(m.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:u.map(f=>{let b=a(f.control?.labelKey??f.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":f.slot,disabled:!f.state.isEnabled,...f.state.isActive?{"data-active":""}:{},"aria-pressed":f.state.isActive,"aria-label":b,title:f.state.disabledReason??b,onMouseDown:O,onClick:()=>{f.state.execute(),c(false);},children:te(f.control?.paths)},f.slot)})}):null]})}var ya=Object.assign(Bh,{docxSlot:"alignment"});function ql(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:i,onSelect:a,asChild:l,className:c,children:s}=e,d={type:"button",className:`docx-toolbar__button${c?` ${c}`:""}`,disabled:r,...o?{"data-active":""}:{},...r?{"data-disabled":""}:{},...o!==void 0?{"aria-pressed":o}:{},"aria-label":t,title:r?i??t:t,onMouseDown:u=>O(u),onClick:r?void 0:a};return l?jsxRuntime.jsx(W,{...d,children:s}):jsxRuntime.jsx("button",{...d,children:n??s})}var Gh=Object.freeze([]),jh=e=>e.formatting?.fontFamily??null,Yh=e=>e;function xa(){let e=A(),t=B(jh),n=B(Yh),o=Ye.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():Gh,[e,n]),{isEnabled:r}=ne("font.family"),i=Ye.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("font.family",a);l&&e.can(l).ok&&e.exec(l);},[e]);return Ye.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var Ru=Ye.createContext(null);function zl(){return Ye.useContext(Ru)}function Vl({asChild:e,className:t,children:n}){let o=zl(),r=Y();if(!o)return null;let i=r(X("font.family")?.labelKey??"font.family"),a={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},l=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(W,{...a,children:l}):jsxRuntime.jsx("button",{type:"button",...a,children:l})}Vl.docxToolbarPart=true;var Xh=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"]]),Qh=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function Iu({asChild:e,className:t,children:n}){let o=zl(),r=Y();if(!o||!o.open)return null;let i={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},a;return n!==void 0?a=n:a=Qh.map(c=>({...c,fonts:o.options.filter(s=>(Xh.get(s.toLowerCase())??"other")===c.category)})).filter(c=>c.fonts.length>0).map((c,s)=>jsxRuntime.jsxs("div",{role:"group",children:[s>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}):null,c.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(c.labelKey)}):null,c.fonts.map(d=>jsxRuntime.jsx(ku,{value:d},d))]},c.category)),e?jsxRuntime.jsx(W,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function ku({value:e,asChild:t,className:n,children:o}){let r=zl();if(!r)return null;let i=r.value===e,a={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__font-family-item${n?` ${n}`:""}`},l=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(W,{...a,children:l}):jsxRuntime.jsxs("button",{type:"button",...a,children:[l,i?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function Jh({hidden:e,asChild:t,className:n,children:o}){let r=xa(),[i,a]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!i)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||a(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);let c=Ye.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Vl,{}),jsxRuntime.jsx(Iu,{})]});return jsxRuntime.jsx(Ru.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var $l=Object.assign(Jh,{docxSlot:"font.family",Trigger:Vl,Content:Iu,Item:ku});function sv(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 cv=Object.freeze([]),dv=e=>e.formatting?.styleId??null,uv=e=>e;function Ta(){let e=A(),t=B(dv),n=B(uv),o=Ye.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:a.name,preview:a.preview})):cv,[e,n]),{isEnabled:r}=ne("styles.style"),i=Ye.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",a);l&&e.can(l).ok&&e.exec(l);},[e]);return Ye.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var _u=Ye.createContext(null);function Gl(){return Ye.useContext(_u)}function jl({asChild:e,className:t,children:n}){let o=Gl(),r=Y();if(!o)return null;let i=X("styles.style"),a=r(i?.labelKey??"styles.style"),l={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},c=o.options.find(d=>d.styleId===o.value),s=n??(o.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:c?.name??o.value}));return e?jsxRuntime.jsx(W,{...l,children:s}):jsxRuntime.jsx("button",{type:"button",...l,children:s})}jl.docxToolbarPart=true;function Du({asChild:e,className:t,children:n}){let o=Gl();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},i=n??o.options.map(a=>jsxRuntime.jsx(Nu,{value:a.styleId},a.styleId));return e?jsxRuntime.jsx(W,{...r,children:i}):jsxRuntime.jsx("div",{...r,children:i})}function Nu({value:e,asChild:t,className:n,children:o}){let r=Gl();if(!r)return null;let i=r.value===e,a=r.options.find(s=>s.styleId===e),l={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:a?sv(a.preview):void 0,children:a?.name??e});return t?jsxRuntime.jsx(W,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,i?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function pv({hidden:e,asChild:t,className:n,children:o}){let r=Ta(),[i,a]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!i)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||a(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);let c=Ye.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jl,{}),jsxRuntime.jsx(Du,{})]});return jsxRuntime.jsx(_u.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Yl=Object.assign(pv,{docxSlot:"styles.style",Trigger:jl,Content:Du,Item:Nu});function Hu(e,t){let n=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:l,children:c})=>{let{isEnabled:s,disabledReason:d}=ne(n),u=mt(),m=t==="showAll"?u.showAll:u.formFill,g=Y();if(i)return null;let p=X(n),f=g(p?.labelKey??e),b={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!s,...s?{}:{"data-disabled":""},...m?{"data-active":""}:{},"aria-pressed":m,"aria-label":f,title:d??f,onMouseDown:O,onClick:()=>{t==="showAll"?u.toggleShowAll():u.toggleFormFill();}};return l?jsxRuntime.jsx(W,{...b,children:c}):jsxRuntime.jsx("button",{...b,children:a??c??te(p?.paths)})},{docxSlot:n})}function fv({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=Be.inspector,{isEnabled:a,disabledReason:l}=ne(i),{inspectorOpen:c,openInspector:s}=mt(),d=Y();if(t)return null;let u=X(i),m=d(u?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.inspector,disabled:!a,...a?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":m,title:l??m,onMouseDown:O,onClick:()=>s()};return o?jsxRuntime.jsx(W,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??te(u?.paths)})}function gv({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l}=mt(),c=Y();if(t)return null;let s=Be.remove,d=X(s),u=c(d?.labelKey??"contentControl.remove"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":u,title:a??u,onMouseDown:O,onClick:()=>{l();}};return o?jsxRuntime.jsx(W,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??te(d?.paths)})}var Sa=Hu(Be.showAll,"showAll"),Ca=Hu(Be.formFill,"formFill"),Pa=Object.assign(gv,{docxSlot:Be.remove}),Ea=Object.assign(fv,{docxSlot:Be.inspector}),Fu={[Be.showAll]:Sa,[Be.formFill]:Ca,[Be.inspector]:Ea,[Be.remove]:Pa};function Xl(e,t){let n=A(),o=Ye.useRef(t);o.current=t,Ye.useEffect(()=>{if(!n)return;let r=((...i)=>{o.current(...i);});return n.on(e,r)},[n,e]);}var Sv=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Jl=Ye.createContext(null);function zu(){let e=Ye.useContext(Jl);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Pv(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.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}`:"",c=e?.getTableCellSelection()??null,s=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:l,cellSelectionKey:s,editable:t.editable,editingMode:t.editingMode??"editing"}}function Ev(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function wv(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var qu={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function Mv(e,t){let n={};for(let o of Sv){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function es({children:e}){let t=A(),[n,o]=Ye.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=Ye.useState(qu);Ye.useEffect(()=>(()=>{}),[]);let a=B(Ye.useCallback(m=>({table:m.table,editable:m.editable,editingMode:m.editingMode??"editing",headParagraphId:m.selection?.to&&"paraId"in m.selection.to?m.selection.to.paraId:m.selection?.from&&"paraId"in m.selection.from?m.selection.from.paraId:""}),[]),Ev,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=Ye.useCallback(()=>{if(!t){i(qu);return}let m=Pv(t,t.snapshot());i(g=>wv(g,m)?g:m);},[t]);Ye.useEffect(()=>{l();},[l,a]),Xl("selectionChange",Ye.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=Ye.useMemo(()=>t?Mv(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=Ye.useCallback((m,g)=>{if(!t)return;let{result:p,nextDraft:f}=editor.runTableChromeCommand(t,m,g,n);p.ok&&f&&o(f);},[t,n]),u=Ye.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:m=>s[m]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,s,d]);return jsxRuntime.jsx(Jl.Provider,{value:u,children:e})}function Rv(){let e=Ye.useContext(Jl);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function Ma(e){let t=Rv(),n=t.slotState(e);return Ye.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var kv='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function no(e){return [...e.querySelectorAll(kv)].filter(t=>t.closest('[role="menu"]')===e)}function ts(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function lt(e,t,n){if(e.length===0)return false;let o=t?e.indexOf(t):-1,r=o===-1?n>0?0:e.length-1:(o+n+e.length)%e.length;return e[r]?.focus(),true}function st(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function Ra(e){(qo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function ns(e,t,n){Ye.useEffect(()=>{if(!e)return;let o=r=>{let i=n.current;i&&r.target instanceof Node&&i.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function Ia({enabled:e,disabledReason:t,ariaLabel:n}){let{t:o}=_(),r=i18n.localizeDisabledReason(t,o),i=Ye.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:O,"aria-label":n,...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 Nv='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function Vu(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll(Nv)].filter(s=>s.closest('[role="menu"]')===r);queueMicrotask(()=>{let s=a();(s.find(u=>u.hasAttribute("data-selected")||u.hasAttribute("data-active"))??s[0])?.focus();});let c=s=>{let d=a();if(s.key==="Escape"){s.preventDefault(),t(false),i?.focus();return}if(s.key==="ArrowDown"){s.preventDefault(),lt(d,document.activeElement,1);return}if(s.key==="ArrowUp"){s.preventDefault(),lt(d,document.activeElement,-1);return}if(s.key==="Home"){s.preventDefault(),st(d,"first");return}if(s.key==="End"){s.preventDefault(),st(d,"last");return}if(s.key==="Enter"||s.key===" "){let u=document.activeElement;u instanceof HTMLElement&&d.includes(u)&&(s.preventDefault(),u.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function $u(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let l=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="Enter"||c.key===" "){let s=document.activeElement,d=a();s instanceof HTMLElement&&d.includes(s)&&(c.preventDefault(),s.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,n,o]);}function Yu(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function Bv(e){return te(editor.tableChromeIconPaths(e))}function Xu(){return Ye.createContext(null)}function Pt(e){let t=Ye.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function as(e,t,n){let o=Xu();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:u,enabled:m,disabledReason:g,draft:p,apply:f}=Ma(e),[b,h]=Ye.useState(false),P=Ye.useRef(null),x=Ye.useRef(null);ns(b,h,P);let C=Ye.useMemo(()=>({open:b,setOpen:h,enabled:m,disabledReason:g,apply:f,draft:p,triggerRef:x}),[b,m,g,f,p]);if(l||!u)return null;let v={className:`${t}${s?` ${s}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},y=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(o.Provider,{value:C,children:c?jsxRuntime.jsx(W,{...v,ref:P,children:y}):jsxRuntime.jsx("div",{ref:P,...v,children:y})})}function i({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,disabledReason:g,triggerRef:p}=Pt(o),f=Y(),b=X(e),h=f(b?.labelKey??n),{shared:P,reasonNode:x}=Ia({enabled:m,disabledReason:g,ariaLabel:h}),C={...P,ref:p,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:m?()=>u(!d):void 0,...l?{tabIndex:m?0:-1,role:"button",onKeyDown:Yu(m,d,u)}:{}},v=s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...C,children:v}),x]}):jsxRuntime.jsxs("button",{...C,children:[v,x]})}i.docxToolbarPart=true;function a({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,triggerRef:g}=Pt(o),p=Y(),f=Ye.useRef(null);if(Vu(d&&m,u,f,g),!d||!m)return null;let b=X(e),h=p(b?.labelKey??n),P={ref:f,role:"menu","aria-label":h,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:O};return l?jsxRuntime.jsx(W,{...P,children:s}):jsxRuntime.jsx("div",{...P,children:s})}return {Root:r,Trigger:i,Content:a,Ctx:o}}var Bn=as("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function Qu({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Pt(Bn.Ctx),l=Y(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value==="none"?false:c.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":s,"data-value":c.value,className:`docx-table-chrome__target-btn${n?` ${n}`:""}`,...s?{"data-active":""}:{},"aria-label":l(c.labelKey),title:l(c.labelKey),onMouseDown:O,onClick:()=>{i(false),r(c.value);}},u=o??Bv(c.icon);return t?jsxRuntime.jsx(W,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function Ju(e){let{children:t}=e;return jsxRuntime.jsx(Bn.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(Qu,{value:n.value},n.value))})})}function qv(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bn.Trigger,{}),jsxRuntime.jsx(Ju,{})]});return jsxRuntime.jsx(Bn.Root,{...e,children:n})}var $n=Object.assign(qv,{docxSlot:"table.borderTarget",Trigger:Bn.Trigger,Content:Ju,Item:Qu}),qn=as("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function ep({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Pt(qn.Ctx),l=Y(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":s,...s?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{i(false),r(c.value);}},u=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${c.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(c.labelKey)})]});return t?jsxRuntime.jsx(W,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function tp(e){let{children:t}=e;return jsxRuntime.jsx(qn.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(ep,{value:n.value},n.value))})}function Kv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qn.Trigger,{}),jsxRuntime.jsx(tp,{})]});return jsxRuntime.jsx(qn.Root,{...e,children:t})}var Wn=Object.assign(Kv,{docxSlot:"table.borderStyle",Trigger:qn.Trigger,Content:tp,Item:ep}),Kn=as("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function op({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Pt(Kn.Ctx),l=Y(),c=Number(e),s=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===c);if(!s)return null;let d=s.size===a.spec.size,u={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{i(false),r(s.size);}},m=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${s.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(s.labelKey)})]});return t?jsxRuntime.jsx(W,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}function np(e){let{children:t}=e;return jsxRuntime.jsx(Kn.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(op,{value:String(n.size)},n.size))})}function zv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kn.Trigger,{}),jsxRuntime.jsx(np,{})]});return jsxRuntime.jsx(Kn.Root,{...e,children:t})}var Un=Object.assign(zv,{docxSlot:"table.borderWidth",Trigger:Kn.Trigger,Content:np,Item:op});function rp(e,t,n){let o=n?.defaultHex??"FF0000",r=Xu();function i({hidden:d,asChild:u,className:m,children:g}){let{visible:p,enabled:f,disabledReason:b,draft:h,apply:P}=Ma(e),[x,C]=Ye.useState(false),[v,y]=Ye.useState(o),T=Ye.useRef(null),M=Ye.useRef(null);ns(x,C,T);let w=Ye.useMemo(()=>({open:x,setOpen:C,enabled:f,disabledReason:b,apply:P,draft:h,triggerRef:M,lastHex:v,setLastHex:y}),[x,f,b,P,h,v]);if(d||!p)return null;let E={className:`docx-toolbar__colorsplit docx-table-chrome${m?` ${m}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},D=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(l,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:w,children:u?jsxRuntime.jsx(W,{...E,ref:T,children:D}):jsxRuntime.jsx("div",{ref:T,...E,children:D})})}function a({asChild:d,className:u,children:m}){let{enabled:g,disabledReason:p,apply:f,draft:b,lastHex:h}=Pt(r),P=Y(),x=X(e),C=P(x?.labelKey??t),{shared:v,reasonNode:y}=Ia({enabled:g,disabledReason:p,ariaLabel:C}),T=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:h??o,M={...v,className:`docx-toolbar__button docx-toolbar__colorsplit-main${u?` ${u}`:""}`,onClick:g?()=>f({kind:"hex",value:T}):void 0},w=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(x?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${T.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...M,children:w}),y]}):jsxRuntime.jsxs("button",{...M,children:[w,y]})}a.docxToolbarPart=true;function l({asChild:d,className:u,children:m}){let{open:g,setOpen:p,enabled:f,disabledReason:b,triggerRef:h}=Pt(r),P=Y(),x=X(e),C=P(x?.labelKey??t),{shared:v,reasonNode:y}=Ia({enabled:f,disabledReason:b,ariaLabel:C}),T={...v,ref:h,className:`docx-toolbar__colorsplit-caret${u?` ${u}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:f?()=>p(!g):void 0,...d?{tabIndex:f?0:-1,role:"button",onKeyDown:Yu(f,g,p)}:{}},M=m??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(W,{...T,children:M}),y]}):jsxRuntime.jsxs("button",{...T,children:[M,y]})}l.docxToolbarPart=true;function c({asChild:d,className:u,children:m,clearFill:g}){let{open:p,setOpen:f,enabled:b,apply:h,draft:P,triggerRef:x,lastHex:C,setLastHex:v}=Pt(r),y=Y(),T=Ye.useRef(null);if($u(p&&b,f,T,x),!p||!b)return null;let M=y(t),w=e==="table.borderColor"&&P.spec.color.kind==="hex"?P.spec.color.value:C??o,E={ref:T,role:"dialog","aria-label":M,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${u?` ${u}`:""}`,onMouseDown:O},D=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>{f(false),h(null),Ra(x.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),y("table.clearCellFill")]}):null,jsxRuntime.jsx(Al,{apply:F=>{f(false),v?.(F),h({kind:"hex",value:F}),Ra(x.current);},current:w})]});return d?jsxRuntime.jsx(W,{...E,children:D}):jsxRuntime.jsx("div",{...E,children:D})}function s({value:d,css:u,labelKey:m,asChild:g,className:p,children:f}){let{apply:b,setOpen:h,setLastHex:P,triggerRef:x}=Pt(r),C=Y(),v=u??`#${d.toLowerCase()}`,y=m?C(m):d,T={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${p?` ${p}`:""}`,style:{backgroundColor:v},"data-value":d,"aria-label":y,title:y,onMouseDown:O,onClick:()=>{h(false),P?.(d),b({kind:"hex",value:d}),Ra(x.current);}};return g?jsxRuntime.jsx(W,{...T,children:f}):jsxRuntime.jsx("button",{...T,children:f})}return {Root:i,Main:a,Trigger:l,Content:c,Item:s,Ctx:r}}var zn=rp("table.borderColor","table.borderColor",{defaultHex:"000000"});function Vv(e){return jsxRuntime.jsx(zn.Content,{...e,clearFill:false})}function $v(e){return jsxRuntime.jsx(zn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function Wv(e){return jsxRuntime.jsx(zn.Root,{...e})}var Gn=Object.assign(Wv,{docxSlot:"table.borderColor",Trigger:zn.Trigger,Content:Vv,Item:$v,Main:zn.Main}),Vn=rp("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function Uv(e){return jsxRuntime.jsx(Vn.Content,{...e,clearFill:true})}function Gv(e){return jsxRuntime.jsx(Vn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function jv(e){return jsxRuntime.jsx(Vn.Root,{...e})}var jn=Object.assign(jv,{docxSlot:"table.cellFill",Trigger:Vn.Trigger,Content:Uv,Item:Gv,Main:Vn.Main});function ap({overrides:e=new Map}){return zu()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bo,{}),[$n,Gn,Wn,Un,jn].map(o=>{let r=e.get(o.docxSlot);return r?jsxRuntime.jsx(Ye.Fragment,{children:r},o.docxSlot):jsxRuntime.jsx(o,{},o.docxSlot)})]}):null}function ip(){let e=Y(),{draft:t}=Ma("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var dp=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],up={"zoom.level":Nl,"styles.style":Yl,"font.family":$l,"font.size":Dl,"text.color":Ol,"text.highlight":Zl,"text.link":Ml,"list.lineSpacing":Hl,"review.editingMode":aa,"file.save":Rl,...Fu,"table.borderTarget":$n,"table.borderColor":Gn,"table.borderStyle":Wn,"table.borderWidth":Un,"table.cellFill":jn,"image.insert":bn,"image.properties":Zo,"image.wrap":kn,"image.altText":_n},sp=new Map;function Qv(e){let t=sp.get(e);return t||(t=n=>jsxRuntime.jsx(Xt,{slot:e,...n}),sp.set(e,t)),t}function Jv(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:ya}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:up[o]??Qv(o)}})})}var ey=e=>e.image;function ty(e){return e==="alignment"||e in up}function ss(e){let t=Fo(e,ss);if(t!==null)return t;if(!Ye.isValidElement(e))return null;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxToolbarPart===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function is(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(is);let t=ss(e);return t!=null&&dp.includes(t)?true:Ye.isValidElement(e)?Ye.Children.toArray(e.props.children).some(is):false}function oy(e,t){return t?true:Ye.Children.toArray(e).some(is)}function ny(e){let t=je(),{className:n,t:o,onSave:r,preset:i=true,overflow:a=true,children:l}=e,c=Ye.useMemo(()=>({t:o,onSave:r}),[o,r]),s=qr(o),d=B(ey),u=Ye.useMemo(()=>Jv(d),[d]),m=Ye.useMemo(()=>new Set(u.flatMap(x=>x.entries.map(C=>C.slot))),[u]),g=Ye.useMemo(()=>u.map(x=>x.id).filter(x=>!ml.has(x)),[u]),p=Ye.useMemo(()=>Pd(g),[g]),f=i&&a,{attach:b,overflow:h}=Ld(f,g,p),P;if(!i)P=l;else {let x=Ye.Children.toArray(l),C=new Map,v=new Map,y=[];for(let D of x){let F=ss(D);F&&m.has(F)?C.set(F,D):F&&dp.includes(F)?v.set(F,D):y.push(D);}let T=D=>{let F=C.get(D.slot);if(F)return F;let H=D.Part;return jsxRuntime.jsx(H,{})},M=[],w=[],E=0;for(let D of u){if(h.has(D.id)){let H=D.entries.flatMap(k=>{let L=ay(k,C,s,D.labelKey,T);return L===null?[]:[jsxRuntime.jsx(Ye.Fragment,{children:L},k.slot)]});if(H.length===0)continue;w.push({id:D.id,labelKey:D.labelKey,children:H});continue}E>0&&M.push(jsxRuntime.jsx(Bo,{},`separator-${D.id}`)),E+=1;let F=ml.has(D.id);M.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...F?{[Rn]:""}:{[Mn]:D.id},children:D.entries.map(H=>jsxRuntime.jsx(Ye.Fragment,{children:T(H)},H.slot))},D.id));}P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M,jsxRuntime.jsx(ap,{overrides:v}),y.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[Rn]:"",children:y}):null,w.length>0?jsxRuntime.jsx(Zd,{sections:w}):null]});}return jsxRuntime.jsx(Yt.Provider,{value:c,children:jsxRuntime.jsx("div",{ref:b,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...f?{"data-overflow":""}:{},onMouseDown:O,children:oy(l,i)?jsxRuntime.jsx(es,{children:P}):P})})}function ry(e){return e?!!e.props.hidden:false}function ay(e,t,n,o,r){let i=t.get(e.slot);return ry(i)?null:i||ty(e.slot)?jsxRuntime.jsx(Ad,{label:iy(n,e,o),children:r(e)}):jsxRuntime.jsx(Od,{slot:e.slot})}function iy(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Xn=Object.assign(ny,{Button:Xt,Action:ql,Separator:Bo,Undo:Gd,Redo:jd,Bold:Yd,Italic:Xd,Underline:Qd,Strike:Jd,Link:Ml,ClearFormatting:eu,Superscript:tu,Subscript:ou,Alignment:ya,AlignLeft:nu,AlignCenter:ru,AlignRight:au,AlignJustify:iu,LineSpacing:Hl,BulletList:lu,NumberedList:su,Outdent:cu,Indent:du,ImageInsert:bn,ImageProperties:Zo,ImageWrap:kn,ImageAltText:_n,TableInsert:uu,TableBorderTarget:$n,TableBorderColor:Gn,TableBorderStyle:Wn,TableBorderWidth:Un,TableCellFill:jn,Comments:pu,FontFamily:$l,FontSize:Dl,FontColor:Ol,Highlight:Zl,Zoom:Nl,StylePicker:Yl,EditingMode:aa,Save:Rl,ContentControlShowAll:Sa,ContentControlFormFill:Ca,ContentControlInspector:Ea,ContentControlRemove:Pa});var dy=e=>e.pageSetup??null,uy=e=>e.editable;function ro(){let e=A(),t=B(dy),n=B(uy),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=Ye.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 Ye.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var ds=[{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}],yp=1440,py=e=>Math.round(e/yp*100)/100,my=e=>Math.round(e*yp);function fy(e,t){let n=Math.min(e,t),o=Math.max(e,t);return ds.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var gy={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},by={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},hy={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},vy={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},gp={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},ka={display:"flex",alignItems:"center",gap:12},_a={width:80,fontSize:13,color:"var(--doc-text-muted)"},Da={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},yy={fontSize:11,color:"var(--doc-text-muted)",width:16},xy={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},bp={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},hp=12240,vp=15840,Ht=1440;function Qn({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:i,apply:a}=ro(),[l,c]=Ye.useState(hp),[s,d]=Ye.useState(vp),[u,m]=Ye.useState("portrait"),[g,p]=Ye.useState(Ht),[f,b]=Ye.useState(Ht),[h,P]=Ye.useState(Ht),[x,C]=Ye.useState(Ht),[v,y]=Ye.useState("document"),T=Ye.useRef(null),M=Ye.useRef("no");Ye.useEffect(()=>{if(!e){M.current="no";return}if(M.current==="yes"&&r===null){M.current="no";return}M.current==="yes"||M.current==="loading"&&r===null||(c(r?.pageWidthTwips??hp),d(r?.pageHeightTwips??vp),m(r?.orientation??"portrait"),p(r?.marginsTwips.top??Ht),b(r?.marginsTwips.bottom??Ht),P(r?.marginsTwips.left??Ht),C(r?.marginsTwips.right??Ht),y("document"),M.current=r===null?"loading":"yes");},[e,r]),Ye.useEffect(()=>{e&&T.current?.focus();},[e]);let w=Ye.useCallback(k=>{let L=ds[k];L&&(c(u==="landscape"?L.height:L.width),d(u==="landscape"?L.width:L.height));},[u]),E=Ye.useCallback(k=>{k!==u&&(m(k),c(s),d(l));},[u,l,s]),D=Ye.useCallback(()=>{a({pageWidthTwips:l,pageHeightTwips:s,orientation:u,marginTopTwips:g,marginRightTwips:x,marginBottomTwips:f,marginLeftTwips:h,scope:v})&&t();},[a,l,s,u,g,x,f,h,v,t]);if(!e)return null;let F=fy(l,s),H=(k,L,R)=>jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("input",{type:"number",style:Da,min:0,max:22,step:.1,value:py(L),onChange:I=>R(Math.max(0,my(Number(I.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("span",{style:yy,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:gy,onClick:t,onKeyDown:k=>{k.key==="Escape"&&t(),k.key==="Enter"&&D();},children:jsxRuntime.jsxs("div",{ref:T,tabIndex:-1,style:by,onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:hy,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:vy,children:[jsxRuntime.jsx("div",{style:gp,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:Da,value:F,onChange:k=>w(Number(k.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[ds.map((k,L)=>jsxRuntime.jsx("option",{value:L,children:o(k.labelKey)},k.labelKey)),F<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:Da,value:u,onChange:k=>E(k.target.value),"aria-label":o("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:o("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:o("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...gp,marginTop:4},children:o("dialogs.pageSetup.margins")}),H("top",g,p),H("bottom",f,b),H("left",h,P),H("right",x,C),jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:Da,value:v,onChange:k=>y(k.target.value),"aria-label":o("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:o("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:o("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{style:xy,children:[jsxRuntime.jsx("button",{type:"button",style:bp,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...bp,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:i?1:.5},disabled:!i,onClick:D,children:o("common.apply")})]})]})})}var Jn=Ye.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0});function Je(){return Ye.useContext(Jn)}function _e(){let{t:e}=Je(),{t}=_();return n=>e?.(n)??t(n)}var Cy=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,Py=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var xp=new TextEncoder;function Ey(e,t){if(xp.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let i=xp.encode(r).length;if(n+i>t)break;n+=i,o+=r;}return o}function Tp(e){let t=Ey((e??"").replace(/\.docx$/i,"").replace(Py," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||Cy.test(t)?"document.docx":`${t}.docx`}function Sp(e,t){let n=URL.createObjectURL(new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})),o=document.createElement("a");o.href=n,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}var wy="https://github.com/eigenpal/docx-editor/issues/new";function My(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Cp(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),n=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??My()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
+ `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${wy}?${i.toString()}`}function er(e){typeof window>"u"||window.open(Cp(e),"_blank","noopener,noreferrer");}var us=6,Ep=6;function Ne(e){let{icon:t,shortcut:n,disabled:o,title:r,active:i,selected:a,slot:l,onSelect:c,className:s,children:d}=e,u=Ye.useId(),m=o&&r?u: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${s?` ${s}`:""}`,tabIndex:-1,...l?{"data-slot":l}:{},...i?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...m?{"aria-describedby":m}:{},...r?{title:r}:{},onMouseDown:O,onClick:o?void 0:c,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),n?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:n}):null,m?jsxRuntime.jsx("span",{id:u,className:"docx-editor-sr-only",children:r}):null]})}function or({label:e,labelKey:t,className:n,hidden:o,children:r}){let i=_e();if(o)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function Et({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:i,isActive:a,isEnabled:l,disabledReason:c}=ne(e),{setOpenMenu:s}=Je(),d=_e();if(r)return null;let u=X(e),m=d(t??u?.labelKey??e),g=editor.commandForSlot(e),p=g?.type==="toggleMark"||g?.type==="setAlignment",f=g?.type==="setAlignment";return jsxRuntime.jsx(Ne,{slot:e,icon:te(u?.paths),...n?{shortcut:d(n)}:{},disabled:!l,...c?{title:c}:{},...p?{active:a}:{},...f?{selected:true}:{},onSelect:()=>{i(),s(null);},...o?{className:o}:{},children:m})}Et.docxMenuRow=true;function wp(e,t,n,o){return Object.assign(({className:i,hidden:a})=>{let l=Je(),c=_e(),s=o(l);if(a)return null;let d=X(e),u=c(t??d?.labelKey??e);return jsxRuntime.jsx(Ne,{slot:e,icon:te(d?.paths),...n?{shortcut:c(n)}:{},disabled:!s,onSelect:()=>{s?.(),l.setOpenMenu(null);},...i?{className:i}:{},children:u})},{docxSlot:e})}var ms=wp("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),fs=wp("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function Ny({className:e,hidden:t}){let n=A(),o=Je(),r=_e(),i=editor.chromeProbeForSlot("file.pageSetup"),a=n&&i?n.can(i):null,l=a?.ok===true,c=a&&!a.ok?a.reason:null;if(t)return null;let s=X("file.pageSetup"),d=r(s?.labelKey??"file.pageSetup"),u=l&&!!o.onPageSetup;return jsxRuntime.jsx(Ne,{slot:"file.pageSetup",icon:te(s?.paths),disabled:!u,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var gs=Object.assign(Ny,{docxSlot:"file.pageSetup"});function Ly({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=zr(),i=Je(),a=_e();if(t)return null;let l=X("image.insert"),c=a(l?.labelKey??"toolbar.image");return jsxRuntime.jsx(Ne,{slot:"image.insert",icon:te(l?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),i.setOpenMenu(null);},...e?{className:e}:{},children:c})}var Hy=Object.assign(Ly,{docxSlot:"image.insert"}),tr=8;function io({labelKey:e,paths:t,className:n,children:o}){let r=_e(),[i,a]=Ye.useState(false),l=Ye.useRef(null),c=Ye.useRef(null),s=Ye.useId(),d=r(e),[u,m]=Ye.useState(null);return Ye.useLayoutEffect(()=>{if(!i){m(null);return}let g=l.current,p=c.current,f=g?.ownerDocument.defaultView;if(!g||!p||!f)return;let b=g.getBoundingClientRect(),h=p.offsetWidth,P=p.offsetHeight,x=b.right+h>f.innerWidth-tr;m({left:x?Math.max(tr,b.left-h):Math.min(b.right,f.innerWidth-h-tr),top:Math.max(tr,Math.min(b.top-4,f.innerHeight-P-tr))});},[i]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>a(true),onMouseLeave:()=>a(false),onKeyDown:g=>{g.key==="ArrowRight"&&document.activeElement===l.current?(g.preventDefault(),a(true),queueMicrotask(()=>{c.current&&st(no(c.current),"first");})):(g.key==="ArrowLeft"||g.key==="Escape")&&i&&(g.preventDefault(),g.stopPropagation(),a(false),l.current?.focus());},onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||a(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?s:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...i?{"data-open":""}:{},onMouseDown:O,onFocus:()=>a(true),onClick:()=>a(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:te(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),i?jsxRuntime.jsx("div",{ref:c,id:s,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:g=>{let p=c.current;if(!p)return;let f=no(p);g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),lt(f,document.activeElement,1)):g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),lt(f,document.activeElement,-1));},children:o}):null]})}function La({slot:e="table.insert",className:t}){let n=A(),{isEnabled:o}=ne(e),{setOpenMenu:r}=Je(),i=_e(),[a,l]=Ye.useState(null),[c,s]=Ye.useState({rows:1,cols:1}),d=Ye.useRef(null),u=Ye.useCallback((p,f)=>{if(!n||!o)return;let b={type:"insertTable",rows:p,cols:f};n.can(b).ok&&(n.exec(b),r(null),n.focus());},[n,o,r]),m=Ye.useCallback(p=>{s(f=>{let b={rows:Math.min(Ep,Math.max(1,f.rows+(p.rows??0))),cols:Math.min(us,Math.max(1,p.toCol??f.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<=Ep;p+=1){let f=[];for(let b=1;b<=us;b+=1){let h=!!a&&p<=a.rows&&b<=a.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${p}x${b}`,className:"docx-menubar__grid-cell",tabIndex:c.rows===p&&c.cols===b?0:-1,...h?{"data-filled":""}:{},"aria-label":`${b} \xD7 ${p}`,onMouseDown:O,onMouseEnter:()=>l({rows:p,cols:b}),onFocus:()=>l({rows:p,cols:b}),onClick:()=>u(p,b)},b));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},p));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":i("toolbar.insertTable"),className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>l(null),onKeyDown:p=>{if(p.key==="ArrowRight")m({cols:1});else if(p.key==="ArrowLeft")m({cols:-1});else if(p.key==="ArrowDown")m({rows:1});else if(p.key==="ArrowUp")m({rows:-1});else if(p.key==="Home")m({toCol:1});else if(p.key==="End")m({toCol:us});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 Fy({entry:e}){let{isEnabled:t}=ne(e.slot),n=X(e.slot);return t?jsxRuntime.jsx(io,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(La,{slot:e.slot})}):jsxRuntime.jsx(Et,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function lo({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function nr({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(lo,{}):e.kind==="submenu"?jsxRuntime.jsx(io,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(nr,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(ms,{}):e.slot==="file.save"?jsxRuntime.jsx(fs,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(gs,{}):e.slot==="image.insert"?jsxRuntime.jsx(Hy,{}):e.picker==="tableGrid"?jsxRuntime.jsx(Fy,{entry:e}):jsxRuntime.jsx(Et,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function Mp(e){if(!Ye.isValidElement(e))return null;let t=Fo(e,Mp);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function Ay(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function Oy(e,t,n){return la({entries:e??[],children:t,preset:n,keyOfEntry:Ay,keyOfChild:Mp,renderEntry:o=>jsxRuntime.jsx(nr,{entry:o})})}function Vo({id:e,labelKey:t,label:n,icon:o,className:r,hidden:i,preset:a=true,children:l}){let{openMenu:c,setOpenMenu:s,activeMenu:d}=Je(),u=_e(),m=Ye.useId(),g=Ye.useRef(null),p=Ye.useRef(null),f=Ye.useRef(false),b=Ye.useRef(false),h=editor.CHROME_MENUS.find(y=>y.id===e),P=c===e;if(i)return null;let x=n??u(t??h?.labelKey??e),C=Oy(h?.entries,l,a),v=()=>{s(null),g.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,children:[jsxRuntime.jsxs("button",{ref:g,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":P,"aria-controls":P?m:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...P?{"data-open":""}:{},onMouseDown:O,onKeyDown:y=>{y.key==="ArrowDown"||y.key==="Enter"||y.key===" "||y.key==="ArrowUp"?(y.preventDefault(),f.current=true,s(e)):y.key==="Escape"&&P&&(y.preventDefault(),v());},onClick:()=>{if(b.current){b.current=false;return}s(P?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(b.current=true,s(e));},onMouseLeave:()=>{b.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,x]}),P?jsxRuntime.jsx("div",{ref:y=>{p.current=y,y&&f.current&&(f.current=false,st(no(y),"first"));},id:m,role:"menu","aria-label":x,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:y=>{let T=p.current;if(!T)return;let M=no(T),w=document.activeElement;y.key==="ArrowDown"?(y.preventDefault(),lt(M,w,1)):y.key==="ArrowUp"?(y.preventDefault(),lt(M,w,-1)):y.key==="Home"?(y.preventDefault(),st(M,"first")):y.key==="End"?(y.preventDefault(),st(M,"last")):y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),v()):y.key==="Tab"&&s(null);},children:C}):null]})}function bs(e){return Object.assign(n=>jsxRuntime.jsx(Vo,{id:e,...n}),{docxMenu:e})}var hs=bs("file"),vs=bs("format"),ys=bs("insert");function Zy({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:i}=Je(),a=_e();if(t||i===false)return null;let l=n??r??er;return jsxRuntime.jsx(Ne,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var Ha=Object.assign(Zy,{docxSlot:"help.reportIssue"});function By({children:e,...t}){let{reportIssue:n}=Je();return e===void 0&&n===false?null:jsxRuntime.jsxs(Vo,{id:"help",...t,children:[jsxRuntime.jsx(Ha,{}),e]})}var xs=Object.assign(By,{docxMenu:"help"});var zy={file:hs,format:vs,insert:ys,help:xs},Vy=new Set(editor.CHROME_MENUS.map(e=>e.id));function Lp(e){if(!Ye.isValidElement(e))return null;if(e.type===Ye.Fragment){let o=Ye.Children.toArray(e.props.children).map(Lp).filter(r=>r!==null);return o.length===1?o[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===Vo){let n=e.props.id;if(typeof n=="string"&&Vy.has(n))return n}return null}function $y(e){let t=je(),{className:n,t:o,fileName:r,onOpen:i,onOpenFile:a,onSave:l,onPageSetup:c,onReportIssue:s,reportIssue:d,preset:u=true,children:m}=e,g=A(),{t:p}=_(),[f,b]=Ye.useState(null),[h,P]=Ye.useState(null),[x,C]=Ye.useState(null),[v,y]=Ye.useState(false),T=Ye.useRef(null),M=Ye.useRef(null);Ye.useEffect(()=>{if(f===null)return;let z=V=>{let j=T.current;j&&V.target instanceof Node&&j.contains(V.target)||b(null);},Z=V=>{V.key==="Escape"&&b(null);};return document.addEventListener("mousedown",z),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",Z);}},[f]);let w=Ye.useCallback(z=>{b(z),z!==null&&C(z);},[]),E=Ye.useCallback(()=>M.current?.click(),[]),D=Ye.useCallback(()=>{g&&g.save().then(z=>Sp(z,Tp(r??h??void 0))).catch(z=>{console.error("[docx-editor] save failed",z);});},[g,r,h]),F=Ye.useCallback(()=>y(true),[]),H=g?i??E:void 0,k=g?l??D:void 0,L=g?c??F:void 0;Ye.useEffect(()=>{let z=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.altKey||Z.shiftKey)return;let V=Z.key.toLowerCase();if(V!=="s"&&V!=="o")return;let j=Z.target,Re=qo(T.current)??T.current;!j||!Re?.contains(j)||(V==="s"&&k?(Z.preventDefault(),k()):V==="o"&&H&&(Z.preventDefault(),H()));};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[H,k]);let R=Ye.useMemo(()=>({t:o,openMenu:f,setOpenMenu:w,activeMenu:x,onOpen:H,onSave:k,onPageSetup:L,onReportIssue:s,reportIssue:d}),[o,f,w,x,H,k,L,s,d]),I;if(!u)I=m;else {let z=new Map,Z=[];for(let V of Ye.Children.toArray(m)){let j=Lp(V);j?z.set(j,V):Z.push(V);}I=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map(V=>{let j=z.get(V.id);if(j)return jsxRuntime.jsx(Ye.Fragment,{children:j},V.id);let Re=zy[V.id];return jsxRuntime.jsx(Re,{},V.id)}),Z]});}return jsxRuntime.jsxs(Jn.Provider,{value:R,children:[jsxRuntime.jsx("div",{ref:z=>{if(T.current=z,z&&x===null){let Z=ts(z)[0]?.closest("[data-menu]")?.getAttribute("data-menu");Z&&C(Z);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??p("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:O,onKeyDown:z=>{if(z.key!=="ArrowLeft"&&z.key!=="ArrowRight")return;let Z=T.current;if(!Z)return;let V=ts(Z),j=V.indexOf(document.activeElement);if(j===-1)return;z.preventDefault();let Re=z.key==="ArrowRight"?1:-1,se=V[(j+Re+V.length)%V.length],Se=se?.closest("[data-menu]")?.getAttribute("data-menu");Se&&(C(Se),se?.focus(),f!==null&&b(Se));},children:I}),jsxRuntime.jsx("input",{ref:M,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:z=>{let Z=z.target.files?.[0];z.target.value="",!(!Z||!g)&&(P(Z.name),a?.(Z),Z.arrayBuffer().then(V=>g.load(new Uint8Array(V))).catch(V=>{console.error("[docx-editor] could not open the file",V);}));}}),jsxRuntime.jsx(Qn,{open:v,onClose:()=>y(false)})]})}var ar=Object.assign($y,{Menu:Vo,File:hs,Format:vs,Insert:ys,Help:xs,Item:Et,Row:Ne,Group:or,Separator:lo,Submenu:io,TableGrid:La,Entry:nr,Open:ms,Save:fs,PageSetup:gs,ReportIssue:Ha});var Yy=12240,Ap=1440,Bp=1440,qp=567,so=20,Ss=6,Xy=so+Ss+2,Qy="var(--doc-text-muted)",Jy="var(--doc-text-subtle)",Op="var(--doc-shadow-subtle)",ex="var(--doc-primary)",tx="var(--doc-primary-hover)",ox="var(--doc-text-subtle)",lr=5,ir=7,nx={left:0,right:0,firstLine:0};function Zp(e,t){return t==="inch"?(e/Bp).toFixed(2)+'"':(e/qp).toFixed(1)+" cm"}function rx(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function co({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:l,indentEditable:c=false,onIndentChange:s,onIndentDragEnd:d,unit:u="inch",className:m="",style:g,tabMarks:p,onTabMarkRemove:f}){let{t:b}=_(),[h,P]=Ye.useState(null),[x,C]=Ye.useState(null),[v,y]=Ye.useState(null),[T,M]=Ye.useState(null),w=Ye.useRef(null),E=e?.pageWidthTwips??Yy,D=e?.marginsTwips.left??Ap,F=e?.marginsTwips.right??Ap,H=e?.gutterTwips??0,k={pageWidth:E,leftMargin:D,rightMargin:F},L=l??nx,R=xe(E)*t,I=xe(D)*t,z=xe(F)*t,Z=Ye.useCallback(q=>{let Ee=w.current?.getBoundingClientRect();return Ee?ea((q-Ee.left)/t):null},[t]),V=Ye.useCallback((q,Ee,Ue)=>{let ce=Z(Ee);if(ce===null)return;if(M(xe(ce)*t),q==="leftMargin"||q==="rightMargin"){if(q==="leftMargin"){let pn=E-F-H-720,ko=Math.round(Math.max(0,Math.min(ce,pn)));y(ko),o?.(ko);}else {let pn=E-ce,ko=E-D-H-720,Or=Math.round(Math.max(0,Math.min(pn,ko)));y(Or),r?.(Or);}return}let Ge=editor.dragIndent(q,ce,L,k,{unit:u,precise:Ue});y(q==="right"?Ge.right:q==="firstLine"?Ge.firstLine:Ge.left),s?.(Ge);},[Z,t,E,D,F,H,o,r,s,L,k,u]),j=Ye.useCallback(q=>{q==="leftMargin"||q==="rightMargin"?i?.():d?.(),P(null),y(null),M(null);},[i,d]),Re=Ye.useCallback((q,Ee,Ue)=>{let ce=editor.handlePosition(q,L,k),Ge=editor.dragIndent(q,ce+Ee*rx(u,Ue),L,k,{unit:u,precise:true});s?.(Ge),d?.();},[L,k,u,s,d]),se=dx(E,t,u),Se=a&&c&&s!==void 0,Pe=q=>xe(editor.handlePosition(q,L,k))*t,G=(q,Ee,Ue)=>({positionPx:Pe(q),editable:Se,isDragging:h===q,isHovered:x===q,onPointerEnter:()=>C(q),onPointerLeave:()=>C(null),onPointerDown:ce=>{Se&&(ce.preventDefault(),ce.stopPropagation(),ce.currentTarget.setPointerCapture(ce.pointerId),P(q));},onPointerMove:ce=>{h===q&&V(q,ce.clientX,ce.altKey);},onPointerUp:ce=>{h===q&&(ce.currentTarget.releasePointerCapture(ce.pointerId),j(q));},onKeyDown:ce=>{Se&&(ce.key!=="ArrowLeft"&&ce.key!=="ArrowRight"||(ce.preventDefault(),Re(q,ce.key==="ArrowLeft"?-1:1,ce.shiftKey)));},label:b(Ee),valueNow:Ue,valueText:Zp(Ue,u),pageWidthTwips:E});return jsxRuntime.jsxs("div",{ref:w,className:`docx-horizontal-ruler ${m}`,style:{position:"relative",width:qe(R),height:Xy,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:qe(I),height:so,backgroundColor:Op,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?q=>{q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),P("leftMargin");}:void 0,onPointerMove:q=>h==="leftMargin"&&V("leftMargin",q.clientX,q.altKey),onPointerUp:q=>{h==="leftMargin"&&(q.currentTarget.releasePointerCapture(q.pointerId),j("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:qe(z),height:so,backgroundColor:Op,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?q=>{q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),P("rightMargin");}:void 0,onPointerMove:q=>h==="rightMargin"&&V("rightMargin",q.clientX,q.altKey),onPointerUp:q=>{h==="rightMargin"&&(q.currentTarget.releasePointerCapture(q.pointerId),j("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:so,pointerEvents:"none"},children:se.map((q,Ee)=>jsxRuntime.jsx(ax,{tick:q},Ee))}),p?.map(q=>jsxRuntime.jsx(cx,{tabMark:q,positionPx:xe(q.position)*t,onDoubleClick:()=>f?.(q.position)},q.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ts,{direction:"down",anchor:"top",...G("firstLine","ruler.firstLineIndent",L.firstLine)}),jsxRuntime.jsx(Ts,{direction:"up",anchor:"strip",...G("hanging","ruler.hangingIndent",L.left)}),jsxRuntime.jsx(ix,{...G("left","ruler.leftIndent",L.left)}),jsxRuntime.jsx(Ts,{direction:"up",anchor:"strip",...G("right","ruler.rightIndent",L.right)})]}),h&&v!==null&&T!==null&&jsxRuntime.jsx(lx,{value:Zp(v,u),positionPx:T})]})}function ax({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(e.position),bottom:0,width:1,height:e.height,backgroundColor:Jy}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:Qy,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Kp(e){return e.editable?e.isDragging||e.isHovered?tx:ex:ox}function zp(e,t,n){return {position:"absolute",left:qe(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function Vp(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 Ts({direction:e,anchor:t,...n}){let o=Kp(n),r=t==="top"?{top:0,height:ir+1}:{top:so-ir,height:ir};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:zp(n,lr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...Vp(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${lr}px solid transparent`,borderRight:`${lr}px solid transparent`,...e==="down"?{top:0,borderTop:`${ir}px solid ${o}`}:{bottom:0,borderBottom:`${ir}px solid ${o}`},transition:"border-color 0.1s"}})})}function ix(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:zp(e,lr*2,{top:so+1,height:Ss}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Vp(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:lr*2-2,height:Ss,backgroundColor:Kp(e),borderRadius:1,transition:"background-color 0.1s"}})})}function lx({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(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 sx={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function cx({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(t-5),top:so-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:o=>{o.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:sx[e.alignment]||"L"})}function dx(e,t,n){let o=[];if(n==="inch"){let r=Bp/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;a%8===0?o.push({position:c,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?o.push({position:c,height:5}):a%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=qp/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;a%10===0?o.push({position:c,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var mx=15840,Up=1440,fx=1440,gx=567,$o=20,bx="var(--doc-text-muted)",hx="var(--doc-text-subtle)",vx="var(--doc-primary)",yx="var(--doc-primary)",xx="var(--doc-primary-hover)";function sr({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:l="",style:c}){let{t:s}=_(),[d,u]=Ye.useState(null),[m,g]=Ye.useState(null),p=Ye.useRef(null),f=e?.pageHeightTwips??mx,b=e?.marginsTwips.top??Up,h=e?.marginsTwips.bottom??Up,P=xe(f)*t,x=xe(b)*t,C=xe(h)*t,v=Ye.useCallback((E,D)=>{n&&(E.preventDefault(),u(D));},[n]),y=Ye.useCallback(E=>{if(!d||!p.current)return;let D=p.current.getBoundingClientRect(),F=E.clientY-D.top,H=ea(F/t);if(d==="topMargin"){let k=f-h-720,L=Math.max(0,Math.min(H,k));o?.(Math.round(L));}else if(d==="bottomMargin"){let k=f-H,L=f-b-720,R=Math.max(0,Math.min(k,L));r?.(Math.round(R));}},[d,t,f,b,h,o,r]),T=Ye.useCallback(()=>{d!==null&&i?.(),u(null);},[d,i]);Ye.useEffect(()=>{if(d)return document.addEventListener("mousemove",y),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",T);}},[d,y,T]);let M=Sx(f,t,a),w={position:"relative",width:$o,height:qe(P),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:p,className:`docx-vertical-ruler ${l}`,style:w,role:"slider","aria-label":s("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:M.map((E,D)=>jsxRuntime.jsx(Tx,{tick:E},D))}),jsxRuntime.jsx(Gp,{type:"topMargin",position:x,editable:n,isDragging:d==="topMargin",isHovered:m==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>v(E,"topMargin")}),jsxRuntime.jsx(Gp,{type:"bottomMargin",position:P-C,editable:n,isDragging:d==="bottomMargin",isHovered:m==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>v(E,"bottomMargin")})]})}function Tx({tick:e}){let t={position:"absolute",top:qe(e.position),right:0,height:1,width:e.width,backgroundColor:hx},n={position:"absolute",top:qe(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:bx,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Gp({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:l}){let{t:c}=_(),s=o?xx:r?yx:vx,d={position:"absolute",top:qe(t-5),right:0,width:$o,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},u={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${s}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:d,onMouseEnter:i,onMouseLeave:a,onMouseDown:l,role:"slider","aria-label":c(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:u})})}function Sx(e,t,n){let o=[];if(n==="inch"){let r=fx/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;if(a%8===0){let s=a/8;o.push({position:c,width:10,label:s>0?String(s):void 0});}else a%4===0?o.push({position:c,width:6}):a%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=gx/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;if(a%10===0){let s=a/10;o.push({position:c,width:10,label:s>0?String(s):void 0});}else a%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var uo=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var Ex=e=>e.formatting?.indent??null,wx=e=>e.editable;function Es(){let e=A(),t=B(Ex),n=B(wx),o=Ye.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=Ye.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 Ye.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var Jp=e=>e.zoom;function em(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function tm(){let{apply:e}=ro(),[t,n]=Ye.useState({}),o=Ye.useRef({}),r=Ye.useCallback(a=>l=>{o.current={...o.current,[a]:Math.round(l)},n(o.current);},[]),i=Ye.useCallback(()=>{let a=o.current;o.current={},n({}),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 Qp(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function Rx(){let e=A(),{indent:t,isEnabled:n,apply:o}=Es(),[r,i]=Ye.useState(null),a=Ye.useRef(null),l=Ye.useRef(null),c=Ye.useCallback(u=>{l.current===null&&(l.current=Qp(e)),a.current=u,i(u);},[e]),s=Ye.useCallback(()=>{let u=a.current,m=l.current;a.current=null,l.current=null,i(null),u&&(m!==null&&m!==Qp(e)||o({left:u.left,right:u.right,firstLine:u.firstLine}));},[e,o]),d=Ye.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return Ye.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:s}),[d,n,c,s])}function Ix(){let e=St(),[t,n]=Ye.useState(0);return Ye.useEffect(()=>{if(!e){n(0);return}let o=()=>n(e.scrollLeft);return o(),e.addEventListener("scroll",o,{passive:true}),()=>e.removeEventListener("scroll",o)},[e]),t}function qa(e){let t=B(uo),{pageSetup:n,isEnabled:o}=ro(),r=B(Jp),{pending:i,preview:a,commit:l}=tm(),c=Rx(),s=to(),d=Ho(),u=Ix();return t?null:jsxRuntime.jsx("div",{className:"docx-ruler-frame",style:{paddingInlineStart:s+d.inlineStart,paddingRight:d.inlineEnd},children:jsxRuntime.jsx(co,{pageSetup:em(n,i),zoom:r,editable:o,onLeftMarginChange:a("left"),onRightMarginChange:a("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:s>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function Ka(e){let t=B(uo),{pageSetup:n,isEnabled:o}=ro(),r=B(Jp),{pending:i,preview:a,commit:l}=tm(),c=to(),s=Ho(),d=fd();return t||d!==null&&d>0&&n&&xe(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(sr,{pageSetup:em(n,i),zoom:r,editable:o,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:l,unit:e.unit??"inch",className:e.className??"",style:e.style})}function N({size:e=20,className:t="",style:n,children:o}){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,...n},"aria-hidden":"true",children:o})}function _x(e){return jsxRuntime.jsx(N,{...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 Dx(e){return jsxRuntime.jsx(N,{...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 Nx(e){return jsxRuntime.jsx(N,{...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 Lx(e){return jsxRuntime.jsx(N,{...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 Hx(e){return jsxRuntime.jsx(N,{...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 Fx(e){return jsxRuntime.jsx(N,{...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 Ax(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function Ox(e){return jsxRuntime.jsx(N,{...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 Zx(e){return jsxRuntime.jsx(N,{...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 Bx(e){return jsxRuntime.jsx(N,{...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 qx(e){return jsxRuntime.jsx(N,{...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 Kx(e){return jsxRuntime.jsx(N,{...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 zx(e){return jsxRuntime.jsx(N,{...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 Vx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function $x(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function Wx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function Ux(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Is(e){return jsxRuntime.jsx(N,{...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 Gx(e){return jsxRuntime.jsx(N,{...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 jx(e){return jsxRuntime.jsx(N,{...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 Yx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function Xx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function Qx(e){return jsxRuntime.jsx(N,{...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 Jx(e){return jsxRuntime.jsx(N,{...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 eT(e){return jsxRuntime.jsx(N,{...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 tT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function oT(e){return jsxRuntime.jsx(N,{...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 nT(e){return jsxRuntime.jsx(N,{...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 rT(e){return jsxRuntime.jsx(N,{...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 aT(e){return jsxRuntime.jsx(N,{...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 iT(e){return jsxRuntime.jsx(N,{...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 om(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function lT(e){return jsxRuntime.jsx(N,{...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 sT(e){return jsxRuntime.jsx(N,{...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 cT(e){return jsxRuntime.jsx(N,{...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 dT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function uT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function pT(e){return jsxRuntime.jsx(N,{...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 mT(e){return jsxRuntime.jsx(N,{...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 fT(e){return jsxRuntime.jsx(N,{...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 gT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function bT(e){return jsxRuntime.jsx(N,{...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 hT(e){return jsxRuntime.jsx(N,{...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 vT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function yT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function xT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function TT(e){return jsxRuntime.jsx(N,{...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 ST(e){return jsxRuntime.jsx(N,{...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 CT(e){return jsxRuntime.jsx(N,{...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 PT(e){return jsxRuntime.jsx(N,{...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 ET(e){return jsxRuntime.jsx(N,{...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 wT(e){return jsxRuntime.jsx(N,{...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 MT(e){return jsxRuntime.jsx(N,{...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 RT(e){return jsxRuntime.jsx(N,{...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 IT(e){return jsxRuntime.jsx(N,{...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 kT(e){return jsxRuntime.jsx(N,{...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 _T(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function DT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function NT(e){return jsxRuntime.jsx(N,{...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 LT(e){return jsxRuntime.jsx(N,{...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 HT(e){return jsxRuntime.jsx(N,{...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 FT(e){return jsxRuntime.jsx(N,{...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 AT(e){return jsxRuntime.jsx(N,{...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 OT(e){return jsxRuntime.jsx(N,{...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 ZT(e){return jsxRuntime.jsx(N,{...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 BT(e){return jsxRuntime.jsx(N,{...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 qT(e){return jsxRuntime.jsx(N,{...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 KT(e){return jsxRuntime.jsx(N,{...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 zT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function VT(e){return jsxRuntime.jsx(N,{...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 $T(e){return jsxRuntime.jsx(N,{...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 WT(e){return jsxRuntime.jsx(N,{...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 UT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function GT(e){return jsxRuntime.jsx(N,{...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 jT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function YT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function XT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function QT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function JT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function eS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function tS(e){return jsxRuntime.jsx(N,{...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 oS(e){return jsxRuntime.jsx(N,{...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 nS(e){return jsxRuntime.jsx(N,{...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 rS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function aS(e){return jsxRuntime.jsx(N,{...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 iS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function lS(e){return jsxRuntime.jsx(N,{...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 sS(e){return jsxRuntime.jsx(N,{...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 cS(e){return jsxRuntime.jsx(N,{...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 dS(e){return jsxRuntime.jsxs(N,{...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 uS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function pS(e){return jsxRuntime.jsx(N,{...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 mS(e){return jsxRuntime.jsx(N,{...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 fS(e){return jsxRuntime.jsx(N,{...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 gS(e){return jsxRuntime.jsx(N,{...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 bS(e){return jsxRuntime.jsx(N,{...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 hS(e){return jsxRuntime.jsx(N,{...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 vS(e){return jsxRuntime.jsx(N,{...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 yS(e){return jsxRuntime.jsx(N,{...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 xS(e){return jsxRuntime.jsx(N,{...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 TS={undo:_x,redo:Dx,print:Nx,file_download:Lx,file_upload:Hx,format_bold:Fx,format_italic:Ax,format_underlined:Ox,strikethrough_s:Zx,superscript:Bx,subscript:qx,link:Kx,format_clear:zx,format_align_left:Vx,format_align_center:$x,format_align_right:Wx,format_align_justify:Ux,format_line_spacing:Is,format_list_bulleted:Gx,format_list_numbered:jx,format_indent_increase:Yx,format_indent_decrease:Xx,format_color_text:Qx,ink_highlighter:Jx,format_color_reset:eT,arrow_drop_down:tT,table:oT,table_chart:nT,grid_on:rT,table_rows:aT,view_column:iT,border_all:om,select_all:om,border_outer:lT,border_inner:sT,border_clear:cT,add:dT,remove:uT,delete:pT,delete_sweep:mT,call_merge:fT,call_split:gT,drag_indicator:bT,image:hT,format_image_left:vT,format_image_right:yT,horizontal_rule:xT,flip_to_back:TT,flip_to_front:ST,open_with:CT,tune:PT,rotate_right:ET,rotate_left:wT,swap_horiz:MT,swap_vert:RT,shapes:IT,format_paint:kT,expand_more:_T,expand_less:DT,border_top:NT,border_bottom:LT,border_left:HT,border_right:FT,border_horizontal:AT,border_vertical:OT,padding:ZT,text_rotation_none:BT,wrap_text:qT,height:KT,fit_width:zT,settings:VT,border_color:$T,format_color_fill:WT,vertical_align_top:UT,vertical_align_center:GT,vertical_align_bottom:jT,line_weight:YT,keyboard_arrow_up:XT,keyboard_arrow_down:QT,keyboard_arrow_left:JT,keyboard_arrow_right:eS,more_vert:tS,page_break:oS,branding_watermark:nS,arrow_back:rS,search:aS,toc:iS,done_all:lS,check_circle:sS,chat_bubble_outline:cS,chat_bubble_check:dS,check:uS,close:pS,add_comment:mS,comment:fS,edit_note:gS,rate_review:bS,visibility:hS,format_textdirection_l_to_r:vS,format_textdirection_r_to_l:yS,"agent-sparkle":xS};function K({name:e,size:t=20,className:n="",style:o}){let r=TS[e];return r?jsxRuntime.jsx(r,{size:t,className:n,style:o}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:n,style:{fontSize:t,width:t,height:t,...o},children:e}))}var cr=12,ks=240,rm=16,wS=24,MS=cr+ks+rm,Wo=12,RS=36,IS=Wo+RS+rm,dr=Ye__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:i=0,leftOffset:a=cr}){let{t:l}=_(),[c,s]=Ye.useState(false),d=t.length?Math.min(...t.map(u=>u.level)):0;return Ye.useEffect(()=>{requestAnimationFrame(()=>s(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":l("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:ks,paddingTop:wS,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${a+ks}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:o,"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(K,{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,m)=>jsxRuntime.jsx("div",{style:{marginLeft:(u.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(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}-${m}`))})]})});var DS=e=>e,NS=Object.freeze([]),LS=()=>{};function _s(e){let t=A(),n=B(DS),o=Ye.useMemo(()=>t&&!n.isLoading?t.getOutline():NS,[t,n]),r=Ye.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 uo(n)?null:jsxRuntime.jsx(dr,{headings:o,onHeadingClick:r,onClose:e.onClose??LS,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Ds=Ye.createContext(null);function Ot(e){let t=Ye.useContext(Ds);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Uo=280,za=32,am=16;function mo(e=280){return 32+e+16}function Va({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0||!Number.isFinite(o)||o<0||!Number.isFinite(r)||r<0)return 0;let a=(e-o-t)/2,l=a>=n?0:!i&&n<=2*a?2*(n-a):n;return Math.ceil(Math.max(0,l-r))}var BS=Object.freeze([]),qS=e=>e;function $a(){let e=A(),t=B(qS),[n,o]=Ye.useState(null),r=Ye.useMemo(()=>e&&!t.isLoading?e.getOutline():BS,[e,t]),i=Ye.useMemo(()=>{if(r.length===0)return [];let l=r[0].level;for(let c of r)c.level<l&&(l=c.level);return r.map(c=>({heading:c,depth:c.level-l}))},[r]),a=Ye.useCallback(l=>{if(!e||typeof l!="string"||l.length===0)return;e.focus();let c={paragraphId:l,offset:0};e.exec({type:"setSelection",range:{anchor:c,head:c}}),e.scrollToBlock(l),o(l);},[e]);return {headings:r,items:i,selectedBlockId:n,goTo:a,isEmpty:r.length===0}}var Hs=150,Fs=2e3,Ls=Object.freeze([]),VS=e=>e;function Wa(){let e=A(),t=B(VS),[n,o]=Ye.useState(""),[r,i]=Ye.useState(""),[a,l]=Ye.useState(false),[c,s]=Ye.useState(false),[d,u]=Ye.useState(Ls),[m,g]=Ye.useState(-1);Ye.useEffect(()=>{if(n===r)return;let y=setTimeout(()=>i(n),Hs);return ()=>clearTimeout(y)},[n,r]);let p=Ye.useMemo(()=>({matchCase:a,wholeWord:c}),[a,c]);Ye.useEffect(()=>{if(!e||r.length===0){u(Ls),g(-1);return}let y=e.findMatches(r,p);u(T=>T===y?T:y);},[e,r,p,t]);let f=Ye.useRef(d);Ye.useEffect(()=>{f.current!==d&&(f.current=d,g(y=>y>=0&&y<d.length?y:-1));},[d]);let b=Ye.useCallback(y=>{if(!e)return;let T=d[y];if(!T)return;e.focus(),e.selectMatch(T).ok&&g(y);},[e,d]),h=Ye.useCallback(y=>{if(d.length===0)return;let M=((m<0?y>0?-1:0:m)+y+d.length)%d.length;b(M);},[m,b,d.length]),P=Ye.useCallback(()=>h(1),[h]),x=Ye.useCallback(()=>h(-1),[h]),C=Ye.useCallback(y=>o(y),[]),v=Ye.useCallback(()=>{o(""),i(""),u(Ls),g(-1);},[]);return {query:n,setQuery:C,matchCase:a,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=Fs,activeIndex:m,goTo:b,next:P,previous:x,clear:v,isPending:n!==r}}var YS=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)}},XS=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ua(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,i]=Ye.useState(t),[a,l]=Ye.useState(n),c=e.open??r,s=e.tab??a,{onOpenChange:d,onTabChange:u}=e,m=e.open!==void 0,g=e.tab!==void 0,p=Ye.useCallback(I=>{m||i(I),d?.(I);},[m,d]),f=Ye.useCallback(()=>p(!c),[c,p]),b=Ye.useCallback(I=>{g||l(I),u?.(I);},[g,u]),h=eo(),P=St(),x=Ye.useContext(rt),{pageSetup:C,zoom:v,reviewPaneOpen:y,fitting:T}=B(YS,XS),[M,w]=Ye.useState(0),[E,D]=Ye.useState(0),[F,H]=Ye.useState(0);Ye.useEffect(()=>{if(!P){w(0),D(0),H(0);return}let I=()=>{w(P.clientWidth);let Z=getComputedStyle(P),V=Number.parseFloat(Z.paddingInlineEnd);D(Number.isFinite(V)?V:0);let j=Number.parseFloat(Z.getPropertyValue("--docx-review-gutter-start"));H(Number.isFinite(j)?j:0);};if(I(),typeof ResizeObserver>"u")return;let z=new ResizeObserver(I);return z.observe(P),()=>z.disconnect()},[P,c,y,x?.mounted]);let k=Ye.useRef(null);C&&(k.current=C.pageWidthTwips);let L=C?.pageWidthTwips??k.current,R=Ye.useMemo(()=>!c||L===null?0:Va({viewportWidth:M,pageWidthPx:xe(L)*v,reservation:mo(o),inlineEndReservation:E,inlineStartReservation:F,docked:T}),[c,L,v,M,o,E,F,T]);return Ye.useEffect(()=>{if(h)return h.setShift(R),()=>h.setShift(0)},[h,R]),Ye.useEffect(()=>{if(h)return h.setReservation(c?mo(o):0),()=>h.setReservation(0)},[h,c,o]),{open:c,setOpen:p,toggle:f,tab:s,setTab:b,paneWidth:o,shift:R}}var pr=["headings","find"],bt=(...e)=>e.filter(Boolean).join(" ");function mr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:bt("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fr,{}),jsxRuntime.jsx(gr,{})]})})}function fr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Close");return jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:()=>o.setOpen(false),children:n??jsxRuntime.jsx(K,{name:"arrow_back",size:20})})}function gr({className:e,style:t,children:n}){let{t:o}=Ot("Title");return jsxRuntime.jsx("h2",{className:bt("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function br({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Tabs"),i=Ye.useCallback(a=>{let l=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(l===0)return;a.preventDefault();let c=pr.indexOf(o.tab);o.setTab(pr[(c+l+pr.length)%pr.length]);},[o]);return jsxRuntime.jsx("div",{className:bt("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:n??pr.map(a=>jsxRuntime.jsx(hr,{value:a},a))})}function hr({value:e,className:t,style:n,children:o}){let{pane:r,t:i}=Ot("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:bt("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??i(`navigation.tabs.${e}`)})}function lm({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:i,autoFocus:a}){return jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(K,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"search",className:"docx-nav__search-input",value:e,placeholder:o,"aria-label":r,autoFocus:a,onChange:l=>t(l.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function vr({className:e,style:t}){let{pane:n,outline:o,t:r}=Ot("Headings"),[i,a]=Ye.useState(""),l=B(uo),c=Ye.useMemo(()=>{let d=i.trim().toLowerCase();return d.length===0?o.items:o.items.filter(u=>u.heading.text.toLowerCase().includes(d))},[o.items,i]),s=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:bt("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:s,children:[jsxRuntime.jsx(lm,{value:i,onChange:a,onClear:()=>a(""),placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),l?null:o.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((d,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__heading",o.selectedBlockId===d.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+d.depth*14}px`},title:d.heading.text,onClick:()=>o.goTo(d.heading.blockId),children:d.heading.text})},`${d.heading.blockId}-${u}`))})]})}function tC({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:n,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 yr({className:e,style:t}){let{pane:n,search:o,t:r}=Ot("Find"),i=n.tab!=="find",a=o.query.trim().length>0,l=o.matches.length===0?null:o.activeIndex<0?r(o.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:o.matches.length}):r(o.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:o.activeIndex+1,total:o.matches.length});return jsxRuntime.jsxs("div",{className:bt("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:i,children:[jsxRuntime.jsx(lm,{value:o.query,onChange:o.setQuery,onClear:o.clear,placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":r("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.matchCase,onChange:c=>o.setMatchCase(c.target.checked)}),r("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.wholeWord,onChange:c=>o.setWholeWord(c.target.checked)}),r("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:a?o.isPending?r("navigation.find.searching"):l??r("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.previousAriaLabel"),disabled:o.matches.length===0,onClick:o.previous,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.nextAriaLabel"),disabled:o.matches.length===0,onClick:o.next,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_down",size:18})})]})]}),o.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":r("navigation.find.resultsAriaLabel"),children:o.matches.map((c,s)=>jsxRuntime.jsx(tC,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function xr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Toggle");return jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:i=>i.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function Zs(e){let t=je(),{t:n,toggle:o=true,className:r,style:i,children:a,...l}=e,c=Ua(l),s=$a(),d=Wa(),{t:u}=_(),m=Ye.useMemo(()=>({pane:c,outline:s,search:d,t:n??((p,f)=>u(p,f))}),[c,s,d,n,u]),g=e.paneWidth??280;return jsxRuntime.jsx(Ds.Provider,{value:m,children:jsxRuntime.jsxs("div",{className:`${t}docx-nav${c.open?" docx-nav--open":""}${r?` ${r}`:""}`,"data-open":c.open?"true":"false",style:{"--docx-nav-width":`${g}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${mo(g)}px`,...i},children:[o!==false&&!c.open&&jsxRuntime.jsx(xr,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":m.t("navigation.ariaLabel"),inert:!c.open,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mr,{}),jsxRuntime.jsx(br,{}),jsxRuntime.jsx(vr,{}),jsxRuntime.jsx(yr,{})]})})]})})}var Ga=Object.assign(Zs,{Header:mr,Close:fr,Title:gr,Tabs:br,Tab:hr,Headings:vr,Find:yr,Toggle:xr});var sC=600,cC=e=>e.page.total,ja=Ye.createContext(null);function Ya({className:e,style:t}){let n=je(),o=A(),r=St(),i=B(cC),{t:a}=_(),l=Ye.useContext(ja),[c,s]=Ye.useState(1),[d,u]=Ye.useState(false);if(Ye.useEffect(()=>{if(u(false),!o||!r||i<=1)return;s(o.getCurrentPage("viewport"));let g=null,p=()=>{s(o.getCurrentPage("viewport")),u(true),g&&clearTimeout(g),g=setTimeout(()=>u(false),sC);};return r.addEventListener("scroll",p,{passive:true}),()=>{r.removeEventListener("scroll",p),g&&clearTimeout(g);}},[o,i,r]),i<=1)return null;let m=l?l("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(i)):a("viewer.pageIndicator",{current:c,total:i});return jsxRuntime.jsx("div",{className:`${n}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":d?"true":"false",role:"status","aria-live":"polite",children:m})}var pC=[],mC=e=>e.fontSubstitutions??pC;function Xa({className:e,style:t,t:n}){let o=B(mC),{t:r}=_(),i=n??r,[a,l]=Ye.useState(null);if(o.length===0)return null;let c=o.join("\0");return a===c?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:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>l(c),children:i("common.dismiss")})]})}var Ve={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function Bs(e){return Math.round(e/1440*100)/100}function um(e){return Math.round(e*1440)}function bC(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 qs(){let e=A(),t=Ye.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return B(t,bC)}function Qa(e,t,n){let o=e.getBoundingClientRect();return {left:t-o.left-e.clientLeft+e.scrollLeft,top:n-o.top-e.clientTop+e.scrollTop}}function Tr(e,t){let[n,o]=Ye.useState(null),r=Ye.useCallback(l=>o(l),[]),[i,a]=Ye.useState({visibility:"hidden"});return Ye.useLayoutEffect(()=>{let l=n?.closest(".docx-editor__scroll-container"),c=l??n?.parentElement?.querySelector(".docx-editor__scroll-container");if(!n||!c)return;let s=0,d=null,u=new ResizeObserver(()=>g()),m=()=>{s=0;let f=e(c);if(f!==d&&(u.disconnect(),u.observe(c),u.observe(n),f&&u.observe(f),d=f),!f||!f.isConnected){a({visibility:"hidden"});return}let b=f.getBoundingClientRect(),h=t==="story-label"?Math.max(n.offsetHeight,28):n.offsetHeight,P=t==="story-label"?6:4,x=l===c,C=t==="after"?b.bottom+6:b.top-h-P,v=x?Qa(c,b.left,C):{left:b.left,top:C},y=v.left,T=v.top,M=x?c.scrollLeft+8:8;a({position:x?"absolute":"fixed",left:t==="story-label"?y:Math.max(M,y+8),top:t==="story-label"?T:Math.max(x?c.scrollTop+8:8,T),...t==="story-label"?{width:Math.max(240,Math.min(b.width,c.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(b.width-16,c.clientWidth-16))},visibility:"visible"});},g=()=>{s||(s=requestAnimationFrame(m));};u.observe(c),u.observe(n);let p=new MutationObserver(g);return p.observe(c,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),c.addEventListener("scroll",g,{passive:true}),window.addEventListener("resize",g),m(),()=>{s&&cancelAnimationFrame(s),u.disconnect(),p.disconnect(),c.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[n,e,t]),{ref:r,style:i}}function TC(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 SC=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Sr(e){let t=A();return Ye.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function CC(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=A(),[i,a]=Ye.useState(false),l=Ye.useRef(null),[c,s]=Ye.useState(""),[d,u]=Ye.useState("");Ye.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(s(String(Bs(t.headerDistanceTwips))),u(String(Bs(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),Ye.useEffect(()=>{if(!i)return;let T=M=>{l.current?.contains(M.target)||a(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]);let m=Ye.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=Ye.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),p=Ye.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),f=Ye.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),b=Ye.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),h=Sr(m),P=Sr(g),x=Sr(p),C=Sr(f),v=Sr(b),y=(T,M)=>{if(!r)return;let w=Number.parseFloat(M);Number.isFinite(w)&&r.exec({type:"setHeaderFooterOptions",[T]:um(w)});};return jsxRuntime.jsxs("div",{ref:l,className:"docx-hf-chrome__options",onMouseDown:n,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(T=>!T),onMouseDown:n,children:o("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[SC.map(T=>{let M={type:"insertPageField",field:T.field},w=r?.can(M);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!w?.ok,title:w&&!w.ok?w.reason:void 0,onClick:()=>{r?.exec(M),a(false);},onMouseDown:n,children:o(T.labelKey)},T.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(m)}),jsxRuntime.jsx("span",{children:o("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!P.enabled,title:P.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[o("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:o("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(f),onMouseDown:n,children:o("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!x.enabled,title:x.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:n,children:o("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:o("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.headerDistance"),value:c,onChange:T=>s(T.target.value),onBlur:()=>y("headerDistanceTwips",c)}),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:o("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.footerDistance"),value:d,onChange:T=>u(T.target.value),onBlur:()=>y("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:!v.enabled,title:v.reason??void 0,onClick:()=>r?.exec(b),onMouseDown:n,children:t.editing==="header"?o("headerFooter.removeHeader"):o("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:n,children:o("common.close")})]}):null]})}function Ja({className:e}){let{t}=_(),n=qs(),o=Ye.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=Tr(o,"story-label"),i=O;if(!n?.editing)return null;let a=TC(n.editing,n.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:Ve.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),n.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(CC,{state:n,onMouseDown:i})]})}function bo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var ei=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"})}),kC="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",_C="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",DC="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",NC="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 LC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=ht(),a=Ye.useRef(null),{state:l,close:c}=i;Ye.useEffect(()=>{if(l.mode==="closed")return;let f=h=>{h.key==="Escape"&&(h.preventDefault(),c());},b=h=>{let P=a.current;P&&h.target instanceof Node&&P.contains(h.target)||c();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[l.mode,c]);let[s,d]=Ye.useState(null);Ye.useLayoutEffect(()=>{let f=l.anchor,b=a.current;if(!f||!b){d(null);return}let h=b.offsetParent;if(!h){d(null);return}let{left:P,top:x}=Qa(h,f.left,f.top),C=Math.max(0,h.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(P,C)),top:x});},[l.anchor]);let{t:u}=_(),m=l.mode==="editing"?u(l.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):u("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(HC,{children:o}):o;if(n)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let p={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:bo,style:s??void 0,"aria-label":m};return l.mode==="closed"?null:t?jsxRuntime.jsx(W,{...p,children:o}):jsxRuntime.jsx("div",{...p,children:g})}function HC({children:e}){let{state:t}=ht(),n=Ye.useMemo(()=>FC(e),[e]),o=(i,a)=>i in n?n[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(Gs,{})),o("Error",jsxRuntime.jsx(Ys,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(js,{})),o("Cancel",jsxRuntime.jsx(Xs,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&yn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(Vs,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx($s,{})),r?o("Edit",jsxRuntime.jsx(Ws,{})):null,r?o("Unlink",jsxRuntime.jsx(Us,{})):null]}),n.__extra]})}function FC(e){let t={},n=[],o=r=>{if(Array.isArray(r)){r.forEach(o);return}if(!r||typeof r!="object"||!("type"in r)){r&&n.push(r);return}if(r.type===Ye.Fragment){o(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function ht(){return Ye.useContext(xn)??AC}var AC={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 Vs({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:i}=ht(),{t:a}=_();if(n||!r.link)return null;let l=!r.link.href,c=r.link.kind==="internal",s=c?`#${r.link.anchor??""}`:r.link.authored,d=a(l?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),u={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...l?{"data-inert":""}:{},title:d,onMouseDown:bo,...l?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(W,{...u,children:o}):l?jsxRuntime.jsxs("span",{...u,children:[o??s,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...u,children:[o??s,ei(NC)]})}Vs.docxHyperLinkPart="Url";function $s({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:i,copy:a}=ht(),{t:l}=_();if(n||!i.link?.href)return null;let c=i.copied?l("editor.linkCopied"):l("hyperlinkPopup.copyLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:bo,onClick:()=>{a();}};return t?jsxRuntime.jsx(W,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:r??o??ei(kC)})}$s.docxHyperLinkPart="Copy";function Ws({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:i}=ht(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":l,title:l,onMouseDown:bo,onClick:()=>i()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??ei(_C)})}Ws.docxHyperLinkPart="Edit";function Us({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:i}=ht(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":l,title:l,onMouseDown:bo,onClick:()=>i()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??ei(DC)})}Us.docxHyperLinkPart="Unlink";function Gs({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:i,close:a}=ht(),{t:l}=_(),c=Ye.useRef(null),s=Ye.useId(),d=Ye.useId();Ye.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let u=Ye.useCallback(m=>{if(m.key==="Enter"){m.preventDefault(),i();return}m.key==="Escape"&&(m.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:s,children:l("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:s,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:n.text,placeholder:l("hyperlinkPopup.displayTextPlaceholder"),onChange:m=>o(m.target.value),onKeyDown:u}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:l("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:c,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:n.url,placeholder:l("hyperlinkPopup.urlPlaceholder"),onChange:m=>r(m.target.value),onKeyDown:u})]})}Gs.docxHyperLinkPart="Fields";function js({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:i}=ht(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:bo,onClick:()=>i()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??l})}function Ys({className:e,hidden:t}){let{state:n}=ht(),{t:o}=_();return t||!n.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:o("hyperlinkPopup.refused")})}Ys.docxHyperLinkPart="Error";js.docxHyperLinkPart="Apply";function Xs({className:e,asChild:t,hidden:n,children:o}){let{close:r}=ht(),{t:i}=_();if(n)return null;let a=i("hyperlinkPopup.cancel"),l={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:bo,onClick:()=>r()};return t?jsxRuntime.jsx(W,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:o??a})}Xs.docxHyperLinkPart="Cancel";var ti=Object.assign(LC,{Url:Vs,Copy:$s,Edit:Ws,Unlink:Us,Fields:Gs,Error:Ys,Apply:js,Cancel:Xs});function OC(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 Qs(){let e=A(),t=Ye.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=B(t,OC);return n?.kind==="note"?n:null}function hm(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 vm(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&&hm(e.documentAuthored,t.documentAuthored)&&hm(e.sectionAuthored,t.sectionAuthored)}function ZC(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&vm(e.footnote,t.footnote)&&vm(e.endnote,t.endnote)}function Js(){let e=A(),t=Ye.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return B(t,ZC)}var BC=/^(footnote|endnote):(-?\d{1,10})$/;function xm(e){let t=BC.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function qC(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function tc(e){let t=A();return Ye.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function KC(e){let{t}=_(),[n,o]=Ye.useState(false),r=Ye.useRef(null);return Ye.useEffect(()=>{if(!n)return;let i=a=>{r.current?.contains(a.target)||o(false);};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),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":n,"aria-haspopup":"menu",onMouseDown:O,onClick:()=>o(i=>!i),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),o(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(),o(false);},children:t("common.close")})]}):null]})}function oi({className:e}){let{t}=_(),n=A(),o=Qs(),[r,i]=Ye.useState(null),[a,l]=Ye.useState(null),[c,s]=Ye.useState(false),d=Ye.useRef(null),u=Ye.useCallback(w=>{if(!o)return null;let D=[...w.querySelectorAll("[data-docx-note-scope]")].find(F=>F.matches("[data-docx-note]")&&F.dataset.docxNoteScope===o.id)??null;return D?.closest("[data-docx-notes]")??D},[o]),m=Tr(u,"story-label"),g=Ye.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,i(null);},[]);Ye.useEffect(()=>{if(!n)return;let w=document.querySelector(".docx-pages");if(!w)return;let E=H=>{let k=H.target;if(!k)return;let L=k.closest("[data-docx-note-ref]");if(L?.dataset.docxNoteScope){H.preventDefault(),g(),l(null),n.setActiveScope({kind:"note",id:L.dataset.docxNoteScope});return}k.closest("[data-docx-note-mark-back]")&&(H.preventDefault(),g(),l(null),n.setActiveScope({kind:"body"}));},D=H=>{let k=H,R=k.target?.closest("[data-docx-note-scope]");R?.dataset.docxNoteScope&&(k.preventDefault(),l({scopeId:R.dataset.docxNoteScope,x:k.clientX,y:k.clientY}));},F=H=>{if(qC())return;let L=H.target?.closest("[data-docx-note-ref]");if(!L?.dataset.docxNoteScope){g();return}let R=L.dataset.docxNoteScope,z=n.getNotePreviewText(R)??L.getAttribute("aria-description")??t("notes.previewFallback"),Z=L.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{i({scopeId:R,text:z,x:Z.left,y:Z.bottom+4});},400);};return w.addEventListener("click",E),w.addEventListener("contextmenu",D),w.addEventListener("pointerover",F),w.addEventListener("scroll",g,true),()=>{w.removeEventListener("click",E),w.removeEventListener("contextmenu",D),w.removeEventListener("pointerover",F),w.removeEventListener("scroll",g,true),g();}},[n,g,t]);let p=Ye.useCallback(w=>{n&&(n.exec(w),l(null));},[n]),f=a?xm(a.scopeId):null,b=Ye.useMemo(()=>f?{type:"deleteNote",noteKind:f.noteKind,noteId:f.noteId}:null,[f]),h=Ye.useMemo(()=>f?{type:"convertNote",fromKind:f.noteKind,noteId:f.noteId}:null,[f]),P=Ye.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),x=tc(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),C=tc(h??{type:"convertNote",fromKind:"footnote",noteId:0}),v=tc(P??{type:"convertAllNotes",fromKind:"footnote"}),y=Ye.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Ve.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),T=o?xm(o.id):null,M=T?t("notes.editingRegion",{kind:T.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:T.noteId}):null;return n?jsxRuntime.jsxs("div",{className:e,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":o?void 0:true,children:[o&&T?jsxRuntime.jsxs("div",{ref:m.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":t("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":o.id,style:{...m.style,zIndex:Ve.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:M}),jsxRuntime.jsx(KC,{onOpenProperties:()=>s(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:y,onMouseDown:w=>{w.preventDefault(),w.stopPropagation();},children:r.text}):null,a&&f?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:a.x,top:a.y,zIndex:Ve.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!x.enabled,title:x.reason??void 0,onClick:()=>b&&p(b),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>h&&p(h),children:f.noteKind==="footnote"?t("notes.convertToEndnote"):t("notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!v.enabled,title:v.reason??void 0,onClick:()=>P&&p(P),children:f.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>s(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(zC,{onClose:()=>s(false),onApply:w=>{p(w),s(false);}}):null]}):null}function zC(e){let{t}=_(),n=A(),o=Js(),[r,i]=Ye.useState("document"),[a,l]=Ye.useState("decimal"),[c,s]=Ye.useState("continuous"),[d,u]=Ye.useState("pageBottom"),[m,g]=Ye.useState("decimal"),[p,f]=Ye.useState("continuous"),[b,h]=Ye.useState("docEnd");Ye.useEffect(()=>{o&&(l(o.footnote.resolved.numFmt),s(o.footnote.resolved.numRestart),u(o.footnote.resolved.pos),g(o.endnote.resolved.numFmt),f(o.endnote.resolved.numRestart),h(o.endnote.resolved.pos));},[o]);let P=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,x=!o?.endnote.documentAuthored&&!o?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:Ve.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")}),P?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:c,onChange:C=>s(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=>u(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")}),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:m,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=>f(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(!n)return;let C={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:c,position:d},endnote:{numFmt:m,numRestart:p,position:b}};n.can(C).ok&&e.onApply(C);},children:t("common.apply")})]})]})})}var ni=Ye.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function ho(){return Ye.useContext(ni)}function Cm(){return Ye.useContext(ni).target}var Pm=["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"],Em=["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"],wm=["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"],Mm=["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"],Rm=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Im=["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"],km=["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 ri(e,t,n){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:l,hidden:c})=>{let s=A(),{close:d}=ho(),u=_e(),{isEnabled:m,disabledReason:g}=ne(t);return c?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),shortcut:u(a??n.shortcutKey),disabled:!m,...g?{title:g}:{},onSelect:()=>{s?.exec(t),d(true);},...l?{className:l}:{},children:u(i??n.labelKey)})},{docxRow:e})}var Pr=ri("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:Pm}),Er=ri("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:Em}),wr=ri("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Mm}),Mr=ri("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:km});function Xo({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=A(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=ho(),s=_e(),d=Ye.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:u,disabledReason:m}=ne(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ne,{slot:"edit.paste",icon:e??te(wm),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!u||g,...l??m?{title:l??m??""}:{},onSelect:()=>{(async()=>{try{let p=await navigator.clipboard.readText();p&&i?.exec({type:"paste",text:p});}catch(p){c(p instanceof Error?p.message:"the clipboard is not readable");}finally{a(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.paste")})}Xo.docxRow="edit.paste";function vo(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:c})=>{let{close:s}=ho(),d=_e(),u=ai(),{isEnabled:m,disabledReason:g,execute:p}=ne(t);return l||!u?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),disabled:!m,...g?{title:g}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{p()&&s(true);},children:d(i??n.labelKey)})},{docxRow:e})}var Qo=vo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),Jo=vo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),en=vo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),tn=vo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),on=vo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),nn=vo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),rn=vo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),WC=[{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 yo({hidden:e}){let{close:t}=ho(),n=_e(),o=ai(),r=ne({type:"setTableCellVerticalAlignment",alignment:"top"}),i=ne({type:"setTableCellVerticalAlignment",alignment:"center"}),a=ne({type:"setTableCellVerticalAlignment",alignment:"bottom"}),l=[r,i,a];return e||!o?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":n("tableAdvanced.verticalAlignment"),children:WC.map((c,s)=>{let d=l[s];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":n(c.labelKey),title:d.disabledReason??n(c.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:u=>{u.preventDefault(),u.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:te(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}yo.docxRow="table.cellVerticalAlignment";function Dm(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let c=A(),{close:s,tocId:d}=ho(),u=_e(),m=Ye.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:p}=ne(m);return l||d===null?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),disabled:!g,...p?{title:p}:{},onSelect:()=>{c?.exec(m),s(true);},...a?{className:a}:{},children:u(i??n.labelKey)})},{docxRow:e})}var an=Dm("toc.refresh","entire",{labelKey:"toc.refresh",paths:Rm}),ln=Dm("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Im});function ai(){return B(Ye.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function ii({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:i,onSelect:a,className:l}){let{close:c}=ho();return jsxRuntime.jsx(Ne,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),c(true);},...l?{className:l}:{},children:e})}var ci=8,YC=e=>e.editingMode==="viewing";function XC(){let e=A(),t=Ye.useContext(rt),n=Je(),o=_e(),r=e?.can({type:"toggleReviewPane"}),i=B(YC),a=!r?.ok||i||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ne,{icon:te(l?.paths),slot:"review.comments",disabled:a,title:r&&!r.ok?r.reason:i?o("editingMode.viewingHint"):void 0,onSelect:()=>{t?.requestCommentDraft()&&n.setOpenMenu(null);},children:o("comments.addComment")})}var QC=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(Pr,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(Er,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Xo,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(wr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(Mr,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(Et,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(XC,{})}];function JC(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Qo.docxRow,render:()=>jsxRuntime.jsx(Qo,{})},{kind:"row",id:Jo.docxRow,render:()=>jsxRuntime.jsx(Jo,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:en.docxRow,render:()=>jsxRuntime.jsx(en,{})},{kind:"row",id:tn.docxRow,render:()=>jsxRuntime.jsx(tn,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:on.docxRow,render:()=>jsxRuntime.jsx(on,{})},{kind:"row",id:nn.docxRow,render:()=>jsxRuntime.jsx(nn,{})},{kind:"row",id:rn.docxRow,render:()=>jsxRuntime.jsx(rn,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:yo.docxRow,render:()=>jsxRuntime.jsx(yo,{})}]}function eP(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:an.docxRow,render:()=>jsxRuntime.jsx(an,{})},{kind:"row",id:ln.docxRow,render:()=>jsxRuntime.jsx(ln,{})}]}function tP(e,t=false){return [...QC,...e?JC():[],...t?eP():[]]}function Am(e){if(!Ye.isValidElement(e))return null;let t=Fo(e,Am);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxRow=="string")return n.docxRow;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function Hm(e){if(!Ye.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function oP(e){return e?.closest(".docx-editor__scroll-container")??null}function Ir({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:i}){let a=je(),l=A(),{t:c}=_(),s=ai(),d=Ye.useRef(null),u=Ye.useRef(null),[m,g]=Ye.useState(null),[p,f]=Ye.useState(null),[b,h]=Ye.useState(null),P=Ye.useMemo(()=>tP(s,p!==null),[s,p]),[x,C]=Ye.useState(null),v=Ye.useCallback((H=false)=>{g(null),C(null),f(null),h(null),H&&l?.focus();},[l]);Ye.useEffect(()=>{if(o)return;let H=oP(d.current);if(!H)return;let k=L=>{L.preventDefault();let R=L.button===-1||L.clientX===0&&L.clientY===0,I=H.getBoundingClientRect();f(l?.snapshot().tocContext?.id??null),h(R||!(L.target instanceof HTMLElement)?null:L.target),g(R?{x:I.left+16,y:I.top+16}:{x:L.clientX,y:L.clientY});};return H.addEventListener("contextmenu",k),()=>H.removeEventListener("contextmenu",k)},[o,l]),Ye.useEffect(()=>{o&&v();},[o,v]),Ye.useEffect(()=>{if(!m)return;let H=R=>{u.current?.contains(R.target)||v();},k=R=>{R.key==="Escape"?(R.preventDefault(),v(true)):R.key==="Tab"&&v();},L=()=>v();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",k),document.addEventListener("scroll",L,{capture:true,passive:true}),window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",k),document.removeEventListener("scroll",L,true),window.removeEventListener("blur",L),window.removeEventListener("resize",L);}},[m,v]),Ye.useLayoutEffect(()=>{let H=u.current;if(!m||!H)return;let{width:k,height:L}=H.getBoundingClientRect(),R=window.innerWidth-k-ci,I=window.innerHeight-L-ci,z=Math.max(ci,m.x>R?m.x-k:m.x),Z=Math.max(ci,m.y>I?m.y-L:m.y);C({x:z,y:Z});},[m]),Ye.useLayoutEffect(()=>{x&&u.current?.focus({preventScroll:true});},[x]);let y=Ye.useRef(r);y.current=r;let T=Ye.useRef(false);Ye.useEffect(()=>{let H=m!==null;H!==T.current&&(T.current=H,y.current?.(H));},[m]);let M=Ye.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>v(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,v]),[w,E]=Ye.useState(null),D=Ye.useMemo(()=>({close:v,anchor:m,tocId:p,target:b,clipboardRefusal:w,reportClipboardRefusal:E}),[v,m,p,b,w]),F={position:"fixed",left:(x??m)?.x??0,top:(x??m)?.y??0,visibility:x?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:m?jsxRuntime.jsx(Jn.Provider,{value:M,children:jsxRuntime.jsx(ni.Provider,{value:D,children:jsxRuntime.jsxs("div",{ref:u,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:F,onKeyDown:H=>{let k=u.current;if(!k)return;let L=no(k);H.key==="ArrowDown"?(H.preventDefault(),lt(L,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),lt(L,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),st(L,"first")):H.key==="End"&&(H.preventDefault(),st(L,"last"));},children:[Ye.Children.toArray(i).filter(Hm),la({entries:P,children:Ye.Children.toArray(i).filter(H=>!Hm(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:Am,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(lo,{}):H.render()})]})})}):null})}var rc=Object.assign(Ir,{Cut:Pr,Copy:Er,Paste:Xo,Delete:wr,SelectAll:Mr,InsertRowAbove:Qo,InsertRowBelow:Jo,InsertColumnLeft:en,InsertColumnRight:tn,DeleteTableRow:on,DeleteTableColumn:nn,DeleteTable:rn,CellVerticalAlignment:yo,RefreshToc:an,RefreshTocPageNumbers:ln,Item:ii,Slot:Et,Row:Ne,Group:or,Separator:lo,Submenu:io});function ac(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Zm=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"})}),iP="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",lP="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",sP={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},cP={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},dP={color:"var(--doc-text-muted)",flexShrink:0},uP={textAlign:"right",wordBreak:"break-word"},pP={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},mP={display:"flex",gap:8,marginTop:4},Bm={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 fP(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 "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function gP(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 sn({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:cP,"data-testid":n,children:[jsxRuntime.jsx("span",{style:dP,children:e}),jsxRuntime.jsx("span",{style:uP,children:t})]})}function bP({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=mt(),a=Ye.useRef(null),l=Ye.useId(),{t:c}=_(),{control:s,inspectorOpen:d,closeInspector:u}=i;if(Ye.useEffect(()=>{if(!d)return;let f=h=>{h.key==="Escape"&&(h.preventDefault(),u());},b=h=>{let P=a.current;P&&h.target instanceof Node&&P.contains(h.target)||u();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[d,u]),Ye.useEffect(()=>{d&&!s&&u();},[d,s,u]),n||!d||!s)return null;let m=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qm,{}),jsxRuntime.jsx(Km,{}),jsxRuntime.jsx("div",{style:mP,children:jsxRuntime.jsx(zm,{})}),o]}):o,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":l,"data-testid":"content-control-inspector","data-control-id":s.id,"data-control-type":s.controlType,...s.locked?{"data-locked":""}:{},...s.bound?{"data-bound":""}:{},...s.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:sP,onMouseDown:f=>{ac(f),f.stopPropagation();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:l,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),m]});return t?jsxRuntime.jsx(W,{...g,children:p}):jsxRuntime.jsx("div",{...g,children:p})}function qm({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=mt(),{t:i}=_();if(n)return null;let a={style:pP,className:e??void 0,"data-testid":"content-control-inspector-header"},l=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??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:{...Bm,padding:4,border:"none",background:"transparent"},onMouseDown:ac,onClick:()=>r(),children:Zm(iP)})]});return t?jsxRuntime.jsx(W,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function Km({className:e,asChild:t,hidden:n,children:o}){let{control:r}=mt(),{t:i}=_();if(n||!r)return null;let a=i("contentControl.inspectorPanel.empty"),l=i("contentControl.inspectorPanel.yes"),c=i("contentControl.inspectorPanel.no"),s=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.type"),value:i(fP(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.lock"),value:i(gP(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?l:c,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(W,{...d,children:s}):jsxRuntime.jsx("div",{...d,children:s})}function zm({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l,closeInspector:c}=mt(),{t:s}=_();if(n)return null;let d=s("contentControl.remove"),u={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:Bm,onMouseDown:ac,onClick:()=>{l().ok&&c();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??Zm(lP),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(W,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}var di=Object.assign(bP,{Header:qm,Fields:Km,Remove:zm});var xP={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},TP={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},SP={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},CP={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},PP={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},EP={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:30,backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},wP={padding:"8px 12px"},MP={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},RP={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},IP={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function kP({forwardedRef:e}){let t=A(),n=Ye.useRef(null);return n.current=t,vd({ref:e,editorRef:n}),null}var _P=Ye.forwardRef(function(t,n){let{document:o,fonts:r,className:i,t:a,chrome:l=true,title:c,onTitleChange:s,renderTitleBarLeft:d,renderTitleBarRight:u,colorMode:m="light",author:g,locale:p,mode:f="edit",modules:b,zoom:h,zoomMode:P,onReady:x,onChange:C,onFontError:v,onOpen:y,onSave:T,hyperlinkPopup:M,contextMenu:w=true,menu:E=true,navigation:D=true,rulers:F=true}=t,[H,k]=Ye.useState(Dc);Ye.useEffect(()=>{if(m==="system")return Lc(k)},[m]);let L=Nc(m,H),{t:R}=_(),I=Ye.useCallback((j,Re)=>a?a(j,Re):R(j,Re),[a,R]),z=jsxRuntime.jsxs(na,{className:l?L?"dark":void 0:i,style:l?TP:void 0,children:[l?jsxRuntime.jsx(Ja,{}):null,l?jsxRuntime.jsx(oi,{}):null,jsxRuntime.jsx(Gr,{}),jsxRuntime.jsx(ti,{hidden:M===false}),w===false?null:jsxRuntime.jsx(Ir,{t:I,...typeof w=="object"?w:{}}),jsxRuntime.jsx(di,{}),F&&l?jsxRuntime.jsx("div",{style:PP,"aria-hidden":"true",children:jsxRuntime.jsx(Ka,{})}):null,t.children]}),Z=l?jsxRuntime.jsxs("div",{className:`docx-editor${L?" dark":""}${i?` ${i}`:""}`,style:xP,children:[jsxRuntime.jsxs("div",{style:EP,children:[jsxRuntime.jsxs("div",{style:MP,children:[d?.(),jsxRuntime.jsxs("div",{style:RP,children:[s?jsxRuntime.jsx("input",{"aria-label":I("titleBar.documentNameAriaLabel"),value:c??"",placeholder:I("titleBar.untitled"),onChange:j=>s(j.target.value),style:IP}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??I("titleBar.untitled")}),E!==false?jsxRuntime.jsx(ar,{t:I,...c!==void 0?{fileName:c}:{},...y?{onOpen:y}:{},...T?{onSave:T}:{},...typeof E=="object"?E:{}}):null]}),u?.()]}),jsxRuntime.jsx("div",{style:wP,children:jsxRuntime.jsx(Xn,{t:I})})]}),F?jsxRuntime.jsx("div",{style:CP,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(qa,{})}):null,jsxRuntime.jsx(Xa,{t:I}),jsxRuntime.jsxs("div",{style:SP,children:[D?jsxRuntime.jsx(Ga,{t:I}):null,z,jsxRuntime.jsx(ja.Provider,{value:I,children:jsxRuntime.jsx(Ya,{})}),jsxRuntime.jsx(Yr,{overlay:true})]})]}):z,V=Ye.useCallback(j=>I(j),[I]);return jsxRuntime.jsxs(Pn,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...g!==void 0?{author:g}:{},...p!==void 0?{locale:p}:{},translate:I,mode:f,...b!==void 0?{modules:b}:{},...h!==void 0?{zoom:h}:{},...P!==void 0?{zoomMode:P}:{},tableInteractionLabel:V,...x?{onReady:x}:{},...C?{onChange:C}:{},...v?{onFontError:v}:{},children:[jsxRuntime.jsx(kP,{forwardedRef:n}),jsxRuntime.jsx(oo.Provider,{value:l,children:Z})]})}),DP=Ye.forwardRef(function(t,n){return jsxRuntime.jsx(_o,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(_P,{...t,ref:n})})}),NP=Object.assign(DP,{Root:Pn,Viewport:na,Content:Gr,Toolbar:Xn,Menu:ar,Loading:Yr,ColorByChangeType:Gi,AuthorStyle:ji,HorizontalRuler:qa,VerticalRuler:Ka,DocumentOutline:_s,Navigation:Ga,PageSetupDialog:Qn,PageNumber:Ya,FontNotice:Xa,HeaderFooterChrome:Ja,NotesChrome:oi,HyperLink:ti,ContextMenu:rc,ContentControl:di});function FP(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function AP(e){return typeof e=="function"?e():e}function OP(e,t={}){let[n,o]=Ye.useState(void 0),[r,i]=Ye.useState(void 0),[a,l]=Ye.useState(null),[c,s]=Ye.useState(e!=null),[d,u]=Ye.useState(t.fonts===void 0),m=Ye.useRef(t);return m.current=t,Ye.useEffect(()=>{let g=m.current.fonts;if(g===void 0)return;let p=true;return (async()=>{try{let f=await AP(g);p&&i(editor.composeFontConfiguration(f));}catch{}finally{p&&u(true);}})(),()=>{p=false;}},[]),Ye.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let g=FP(e);if(g){o(g),l(null),s(false);return}let p=true,f=new AbortController;return s(true),l(null),(async()=>{try{let b=await fetch(String(e),{...m.current.fetchOptions,signal:f.signal});if(!b.ok)throw new Error(`could not open the document: ${b.status} ${b.statusText}`);let h=new Uint8Array(await b.arrayBuffer());if(!p)return;o(h),s(!1);}catch(b){if(!p||b instanceof Error&&b.name==="AbortError")return;l(b instanceof Error?b:new Error("could not open the document")),s(false);}})(),()=>{p=false,f.abort();}},[e]),{document:d?n:void 0,fonts:r,error:a,isLoading:c||!d}}function KP(e,...t){let n=Ye.useRef({source:e,fragments:t});return n.current={source:e,fragments:t},Ye.useMemo(()=>async o=>{let r=n.current,a=[typeof r.source=="function"?await r.source(o):await r.source,...r.fragments].filter(s=>s!==void 0);if(a.length===0)return;let{epoch:l,...c}=editor.composeFontConfiguration(a[0],...a.slice(1));return c},[])}var Um=[],$P=()=>{};function WP(){let e=A(),t=Ye.useCallback(n=>{if(!e)return $P;let o=Zi(n),r=e.on("change",o),i=e.on("selectionChange",o);return ()=>{r(),i();}},[e]);return Ye.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Um,()=>Um)}function jP(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function YP(){let e=A(),t=Ye.useRef(null),n=Ye.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),o=Ye.useCallback(()=>{let r=jP(e),i=t.current;return (r===null?i===null:i!==null&&XP(i,r))?i:(t.current=r,r)},[e]);return Ye.useSyncExternalStore(n,o,()=>null)}function XP(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function ic({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:i,documentFontFamily:a,ref:l}){let c=Ye.useRef(null),s=Ye.useRef(null),[d,u]=Ye.useState(null),m=Ye.useRef(o);m.current=o;let g=Ye.useRef(r);return g.current=r,Ye.useEffect(()=>{let p=c.current;if(!p)return;let f=editor.mountPaginatedSurface(p,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:h=>{u(h),m.current?.(h);}});if(!f.ok){g.current?.(f.reason,f.detail);return}s.current=f.surface;let b=f.surface.state();return u(b),m.current?.(b),()=>{f.surface.destroy(),s.current=null;}},[e,n]),Ye.useImperativeHandle(l,()=>({focus:()=>s.current?.focus(),type:p=>s.current?.type(p),undo:()=>s.current?.undo(),redo:()=>s.current?.redo(),selectAll:()=>s.current?.selectAll(),navigate:(p,f)=>s.current?.navigate(p,f),toggleRunProperty:(p,f)=>s.current?.toggleRunProperty(p,f),setRunProperty:(p,f)=>s.current?.setRunProperty(p,f),setParagraphProperty:(p,f)=>s.current?.setParagraphProperty(p,f),formatting:()=>s.current?.formatting()??null,sectionProperties:()=>s.current?.sectionProperties()??null,save:()=>{let p=s.current;return p?(p.flushPendingInput(),p.session.save()):null}}),[]),jsxRuntime.jsx("div",{ref:c,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 Dr=Ye.createContext(null);function jm(){let e=Ye.useContext(Dr);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function i1(e){return "type"in e&&e.type==="separator"}var Qm={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"},l1={...Qm,background:"var(--doc-bg-hover)"},Jm={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"},s1={...Jm,opacity:.4,cursor:"default"},c1={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},d1={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},u1={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 Nr({label:e,items:t,disabled:n,showChevron:o=false}){let[r,i]=Ye.useState(false),[a,l]=Ye.useState(null),c=Ye.useRef(null),s=Ye.useRef(null),[d,u]=Ye.useState({top:0,left:0}),m=Ye.useCallback(()=>{i(false),l(null);},[]);Ye.useEffect(()=>{if(!r||!c.current)return;let p=c.current.getBoundingClientRect();u({top:p.bottom+2,left:p.left});},[r]),Ye.useEffect(()=>{if(!r)return;function p(h){let P=h.target;c.current&&!c.current.contains(P)&&s.current&&!s.current.contains(P)&&m();}function f(h){h.key==="Escape"&&m();}function b(){m();}return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),window.addEventListener("scroll",b,true),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f),window.removeEventListener("scroll",b,true);}},[r,m]);let g=p=>{p.disabled||p.submenuContent||p.onClick&&(p.onClick(),m());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&i(!r),onMouseDown:p=>p.preventDefault(),disabled:n,style:r?l1:Qm,children:[e,o&&jsxRuntime.jsx(K,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:s,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,f)=>{if(i1(p))return jsxRuntime.jsx("div",{style:c1},`sep-${f}`);let b=p;if(b.customContent)return jsxRuntime.jsx("div",{onMouseDown:x=>x.preventDefault(),children:b.customContent},b.label);let h=!!b.submenuContent,P=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?s1:Jm,onClick:()=>g(b),onMouseDown:x=>x.preventDefault(),onMouseOver:x=>{b.disabled||(x.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent";},disabled:b.disabled,children:[b.icon&&jsxRuntime.jsx(K,{name:b.icon,size:18}),jsxRuntime.jsx("span",{children:b.label}),b.shortcut&&jsxRuntime.jsx("span",{style:d1,children:b.shortcut}),h&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),h&&P&&jsxRuntime.jsx("div",{style:u1,onMouseDown:x=>x.preventDefault(),children:b.submenuContent(m)})]},b.label)})})]})}var cc=18,m1=2,tf={width:cc,height:cc,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},f1={...tf,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},g1={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function of({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=Ye.useState(0),[i,a]=Ye.useState(0),l=Ye.useCallback(()=>{o>0&&i>0&&e(o,i);},[o,i,e]),c=[];for(let d=1;d<=t;d++)for(let u=1;u<=n;u++){let m=d<=o&&u<=i;c.push(jsxRuntime.jsx("div",{style:m?f1:tf,onMouseEnter:()=>{r(d),a(u);},onClick:l,role:"gridcell","aria-selected":m},`${d}-${u}`));}let s=o>0&&i>0?`${i} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:m1,gridTemplateColumns:`repeat(${n}, ${cc}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:g1,children:s})]})}function y1({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(n=>{let o=!n.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:o,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:o?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:o?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{o||(n.onClick?.(),t());},onMouseOver:r=>{o||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(K,{name:n.icon,size:18}),jsxRuntime.jsx("span",{children:n.label})]},n.label)})})}function x1(){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 mi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function T1(e){return e.replace(/\.docx$/i,"")}function uc({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),i=n??r("titleBar.untitled"),a=T1(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:a,onChange:l=>{let c=l.target.value;t?.(c.endsWith(".docx")?c:c+".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 fi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function gi(){let{t:e}=_(),t=jm(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:i,onSave:a,onPageSetup:l,onInsertImage:c,onInsertTable:s,showTableInsert:d=true,showHelpMenu:u=true,onInsertPageBreak:m,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:p,onInsertTOC:f,onWatermark:b,onRefocusEditor:h}=t,P=Ye.useCallback(y=>{!n&&o&&o(y);},[n,o]),x=Ye.useCallback((y,T)=>{!n&&s&&(s(y,T),requestAnimationFrame(()=>h?.()));},[n,s,h]),C=!!r||!!l,v=C||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[v&&jsxRuntime.jsx(Nr,{label:e("toolbar.file"),disabled:n,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(Nr,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>P("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>P("setRtl")}]}),jsxRuntime.jsx(Nr,{label:e("toolbar.insert"),disabled:n,items:[...c?[{icon:"image",label:e("toolbar.image"),onClick:c}]:[],...d&&s?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsxRuntime.jsx(of,{onInsert:(T,M)=>{x(T,M),y();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:y=>jsxRuntime.jsx(y1,{closeMenu:y,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:m},{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:f,disabled:!f},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),u&&jsxRuntime.jsx(Nr,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>er()}]})]})}function pc({children:e}){let t=null,n=null,o=[],r=[];Ye.Children.forEach(e,a=>{Ye.isValidElement(a)&&(a.type===mi?t=a:a.type===fi?n=a:a.type===gi?r.push(a):o.push(a));});let i=Ye.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(x1,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[o.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:o}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),n&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:n})]})}var bi={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},E1={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:""},nf={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 w1(e,t){let n=nf[t]??nf[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:bi[n]??"000000"}function rf(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(n=>n+n).join("")}function mc(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${rf(e.value)??n}`;let o=Object.entries(t?.colorScheme??bi).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:w1(t,e.slot)}`}function Mt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?rf(e.value):mc(e,t).slice(1)}function af(e){if(!e||e==="none")return "";let t=E1[e];return t?`#${t}`:""}var M1=[{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"}],R1=[{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 lf(e){let t=e??bi;return R1.map(n=>M1.map(o=>{let r=t[o.slot]??bi[o.slot]??"000000",a={hex:n.type==="base"?r.toUpperCase():n.type==="tint"?editor.applyThemeTint(r,n.keep):editor.applyThemeShade(r,n.keep),themeSlot:o.slot,label:`${o.name}${n.labelSuffix}`};return n.type==="tint"?a.tint=n.keep:n.type==="shade"&&(a.shade=n.keep),a}))}function J(...e){return clsx.clsx(e)}var _1=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"}}),Me=Ye__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:J(_1({variant:t,size:n,className:e})),ref:r,...o}));Me.displayName="Button";function et({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,i]=Ye__namespace.useState(false),[a,l]=Ye__namespace.useState({x:0,y:0}),c=Ye__namespace.useRef(null),s=Ye__namespace.useRef(null),d=Ye__namespace.useCallback(()=>{s.current=setTimeout(()=>{if(c.current){let p=c.current.getBoundingClientRect(),f=p.left+p.width/2,b=n==="top"?p.top-8:p.bottom+8;l({x:f,y:b});}i(true);},o);},[o,n]),u=Ye__namespace.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),i(false);},[]);Ye__namespace.useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]);let m=t.props,g=Ye__namespace.cloneElement(t,{ref:c,onMouseEnter:p=>{d(),m.onMouseEnter?.(p);},onMouseLeave:p=>{u(),m.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:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var qt=pe__namespace.Root,Kt=pe__namespace.Group,hi=pe__namespace.Value;function zt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Trigger,{className:J("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(),n?.(r);},...o,children:[t,jsxRuntime.jsx(pe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(F1,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Vt({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let i=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(pe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:J("docx-editor",i&&"dark"),children:jsxRuntime.jsx(pe__namespace.Content,{className:J("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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:a=>{a.preventDefault(),o?.(a);},...r,children:jsxRuntime.jsx(pe__namespace.Viewport,{className:J("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:a=>a.preventDefault(),children:t})})})})}function To({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Label,{className:J("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function tt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Item,{className:J("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(),n?.(r);},...o,children:[jsxRuntime.jsx(pe__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(pe__namespace.ItemIndicator,{children:jsxRuntime.jsx(A1,{className:"h-4 w-4"})})})]})}function So({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Separator,{className:J("-mx-1 my-1 h-px bg-muted",e),...t})}function F1({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 A1({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 fc(e){let t=e.trim();if(!t)return "";let n=null,o="";for(let r of t){if((r==='"'||r==="'")&&n===null){n=r,o+=r;continue}if(r===n){n=null,o+=r;continue}if(r===","&&n===null)break;o+=r;}return o.trim().replace(/^['"]|['"]$/g,"")}var O1=[{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 df({value:e,onChange:t,fonts:n=O1,documentFonts:o,disabled:r=false,className:i,placeholder:a="Arial",width:l=120,showPreview:c=true}){let{t:s}=_(),d=Ye__namespace.useMemo(()=>{if(!o)return [];let f=new Set(n.map(b=>b.name.toLowerCase()));return o.filter(b=>!f.has(b.name.toLowerCase()))},[o,n]),u=Ye__namespace.useMemo(()=>[...d,...n],[d,n]),m=Ye__namespace.useMemo(()=>e?u.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase()||fc(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,u,a]),g=Ye__namespace.useCallback(f=>{let b=u.find(h=>h.name===f);b&&t?.(fc(b.fontFamily)||b.name);},[t,u]),p=Ye__namespace.useMemo(()=>{let f={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(b=>{let h=b.category||"other";f[h].push(b);}),f},[n]);return jsxRuntime.jsxs(qt,{value:m,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(zt,{className:J("h-8 text-sm",i),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":s("font.selectAriaLabel"),children:jsxRuntime.jsx(hi,{placeholder:a,children:m})}),jsxRuntime.jsxs(Vt,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.documentFonts")}),d.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},`doc-${f.name}`))]}),jsxRuntime.jsx(So,{})]}),p["sans-serif"].length>0&&jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.sansSerif")}),p["sans-serif"].map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]}),p.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(So,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.serif")}),p.serif.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),p.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(So,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.monospace")}),p.monospace.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),p.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(So,{}),jsxRuntime.jsx(Kt,{children:p.other.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))})]})]})]})}function gc(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function K1(e,t,n,o){let i=Math.max(8,window.innerWidth-n-8),a=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function $e({isOpen:e,onClose:t,align:n="left"}){let o=Ye.useRef(null),r=Ye.useRef(null),[i,a]=Ye.useState({top:0,left:0});Ye.useEffect(()=>{if(!e||!o.current)return;let s=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),u=K1(s.bottom+4,s.right-d.width,d.width,d.height);a(u);}else a({top:s.bottom+4,left:s.left});}):a({top:s.bottom+4,left:s.left});},[e,n]),Ye.useEffect(()=>{if(!e)return;let s=performance.now()+150,d=g=>{let p=g.target;o.current&&!o.current.contains(p)&&r.current&&!r.current.contains(p)&&t();},u=g=>{g.key==="Escape"&&t();},m=g=>{if(performance.now()<s)return;let p=g.target;p&&r.current&&r.current.contains(p)||p instanceof Element&&p!==document.documentElement&&p!==document.body&&o.current&&p.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),window.addEventListener("scroll",m,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u),window.removeEventListener("scroll",m,true);}},[e,t]);let l=Ye.useCallback(s=>{s.preventDefault(),s.stopPropagation();},[]),c={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:l}}var $1=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],W1=1,U1=400;function mf(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function ff(e,t,n){for(let o=t.length-1;o>=0;o--)if(t[o]<e)return t[o];return Math.max(e-1,n)}function gf({value:e,onChange:t,sizes:n=$1,disabled:o=false,className:r,placeholder:i="11",minSize:a=W1,maxSize:l=U1}){let{t:c}=_(),[s,d]=Ye.useState(false),[u,m]=Ye.useState(""),[g,p]=Ye.useState(false),f=Ye.useRef(null),b=Ye.useCallback(()=>{p(false),d(false);},[]),{containerRef:h,dropdownRef:P,dropdownStyle:x}=$e({isOpen:g,onClose:b}),C=e??(parseInt(i,10)||11),v=e!==void 0?e.toString():i,y=Ye.useCallback(k=>{if(k.preventDefault(),o)return;let L=ff(C,n,a);t?.(L);},[C,n,a,o,t]),T=Ye.useCallback(k=>{if(k.preventDefault(),o)return;let L=mf(C,n,l);t?.(L);},[C,n,l,o,t]),M=Ye.useCallback(k=>{k.preventDefault(),!o&&(d(true),m(v),p(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[o,v]),w=Ye.useCallback(k=>{m(k.target.value);},[]),E=Ye.useCallback(()=>{d(false);let k=parseFloat(u);if(!isNaN(k)&&k>=a&&k<=l){let L=Math.round(k*2)/2;t?.(L);}},[u,a,l,t]),D=Ye.useCallback(k=>{if(k.key==="Enter")k.preventDefault(),E(),p(false);else if(k.key==="Escape")d(false),p(false);else if(k.key==="ArrowUp"){k.preventDefault();let L=mf(C,n,l);m(L.toString()),t?.(L);}else if(k.key==="ArrowDown"){k.preventDefault();let L=ff(C,n,a);m(L.toString()),t?.(L);}},[E,C,n,l,a,t]),F=Ye.useCallback(k=>{t?.(k),p(false),d(false);},[t]),H=Ye.useCallback(k=>{k.target.tagName!=="INPUT"&&k.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:h,className:J("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:y,disabled:o||C<=a,"aria-label":c("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:s?jsxRuntime.jsx("input",{ref:f,type:"text",value:u,onChange:w,onBlur:E,onKeyDown:D,className:J("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":c("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:M,className:J("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",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":c("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:v})}),g&&jsxRuntime.jsx("div",{ref:P,style:{...x,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":c("fontSize.listLabel"),children:n.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>F(k),className:J("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",k===C&&"bg-muted font-medium"),role:"option","aria-selected":k===C,children:k},k))}),jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:T,disabled:o||C>=l,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var Y1=[{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"}],yi=18,X1=2,Q1={position:"relative",display:"inline-block"},J1={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)"},eE={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},vc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},yc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},vf={display:"grid",gap:`${X1}px`},xi={width:`${yi}px`,height:`${yi}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},yf={...xi,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},xf={...xi,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},tE={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)"},oE={display:"flex",alignItems:"center",gap:"6px"},nE={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},rE={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},bf={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},aE={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},iE={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)"},lE={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 xc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=af(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return mc(e,n)}function hf(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (n*299+o*587+r*114)/1e3>230}function Tf(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():Mt(e,n))===t.toUpperCase():false}function sE({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,i]=Ye.useState(null);return jsxRuntime.jsx("div",{style:{...vf,gridTemplateColumns:`repeat(10, ${yi}px)`},children:e.flatMap((a,l)=>a.map((c,s)=>{let d=`${l}-${s}`,u=r===d,m=Tf(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...m?xf:u?yf:xi,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":m,onClick:()=>o(c),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function cE({selectedColor:e,theme:t,onSelect:n}){let[o,r]=Ye.useState(null),{t:i}=_();return jsxRuntime.jsx("div",{style:{...vf,gridTemplateColumns:`repeat(10, ${yi}px)`},children:Y1.map((a,l)=>{let c=o===l,s=Tf(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?xf:c?yf:xi,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":s,onClick:()=>n(a.hex),onMouseDown:u=>u.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},a.hex)})})}function Eo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:i,style:a,title:l,icon:c,autoLabel:s,splitButton:d=true,defaultColor:u}){let[m,g]=Ye.useState(false),[p,f]=Ye.useState(false),[b,h]=Ye.useState(false),[P,x]=Ye.useState(false),[C,v]=Ye.useState(""),[y,T]=Ye.useState(()=>u??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:M}=_();Ye.useEffect(()=>{let G=xc(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(G)&&v(G.toUpperCase());},[t,e,o]);let w=Ye.useCallback(()=>g(false),[]),{containerRef:E,dropdownRef:D,dropdownStyle:F}=$e({isOpen:m,onClose:w}),H=o?.colorScheme??null,k=Ye.useMemo(()=>lf(H),[H]),L=Ye.useMemo(()=>xc(t,e,o),[t,e,o]),R=Ye.useMemo(()=>xc(y,e,o),[y,e,o]),I=Ye.useCallback(()=>{r||g(G=>!G);},[r]),z=Ye.useCallback(G=>{let q;e==="highlight"?q=G.hex:q={kind:"theme",slot:G.themeSlot,...G.tint!==void 0?{tint:G.tint}:{},...G.shade!==void 0?{shade:G.shade}:{}},T(q),n?.(q),g(false);},[e,n]),Z=Ye.useCallback(G=>{let q=e==="highlight"?G:{kind:"hex",value:G};T(q),n?.(q),g(false);},[e,n]),V=Ye.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,n]),j=Ye.useCallback(()=>{let G=C.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(G)){let q=e==="highlight"?G:{kind:"hex",value:G};T(q),n?.(q),g(false),v("");}},[e,C,n]),Re=Ye.useCallback(()=>{r||n?.(y);},[r,y,n]),se={...J1,...r?{cursor:"default",opacity:.38}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:p?{backgroundColor:"var(--doc-bg-hover)"}:{}},Se=M(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),Pe=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:E,className:`docx-color-picker ${i||""}`,style:{...Q1,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...aE,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...iE,...r?{cursor:"default"}:b?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:Re,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:l||Se,"aria-label":l||Se,children:[jsxRuntime.jsx(K,{name:Pe,size:18}),jsxRuntime.jsx("div",{style:{...bf,backgroundColor:R==="transparent"?"#fff":R,outline:R==="transparent"||hf(R)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...lE,...r?{cursor:"default"}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:P?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:I,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),disabled:r,title:l||Se,"aria-label":l||Se,"aria-haspopup":"true","aria-expanded":m,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:se,onClick:I,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:r,title:l||Se,"aria-label":l||Se,"aria-haspopup":"true","aria-expanded":m,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:Pe,size:18}),jsxRuntime.jsx("div",{style:{...bf,backgroundColor:L==="transparent"?"#fff":L,outline:L==="transparent"||hf(L)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),m&&jsxRuntime.jsx("div",{ref:D,className:"docx-color-picker-dropdown",style:{...F,...eE},role:"dialog","aria-label":`${Se} picker`,onMouseDown:G=>{G.target.tagName!=="INPUT"&&G.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:tE,onClick:V,onMouseDown:G=>G.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"}}),s??M(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:yc}),jsxRuntime.jsx("div",{style:vc,children:M("colorPicker.themeColors")}),jsxRuntime.jsx(sE,{matrix:k,selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:yc}),jsxRuntime.jsx("div",{style:vc,children:M("colorPicker.standardColors")}),jsxRuntime.jsx(cE,{selectedColor:t,theme:o,onSelect:Z}),jsxRuntime.jsx("div",{style:yc}),jsxRuntime.jsx("div",{style:vc,children:M("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:oE,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:nE,value:C,onChange:G=>v(G.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:G=>{G.key==="Enter"&&j();},onMouseDown:G=>{G.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...rE,opacity:/^[0-9A-Fa-f]{6}$/.test(C)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(C)?"pointer":"default"},onClick:j,onMouseDown:G=>G.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(C),children:M("common.apply")})]})]})})]})}var Hr=20,Tc=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:Hr}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_center",size:Hr}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_right",size:Hr}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_justify",size:Hr}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function Pf({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,i]=Ye.useState(false),a=Ye.useCallback(()=>i(false),[]),{containerRef:l,dropdownRef:c,dropdownStyle:s,handleMouseDown:d}=$e({isOpen:r,onClose:a}),u=Ye.useCallback(h=>{n||t?.(h),i(false);},[n,t]),m=Tc.find(h=>h.value===e)||Tc[0],g=o(m.labelKey),p=m.shortcutKey?o(m.shortcutKey):void 0,f=`${g}${p?` (${p})`:""}`,b=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&i(h=>!h),disabled:n,"aria-label":f,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:m.iconName,size:Hr}),jsxRuntime.jsx(K,{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(et,{content:f,children:b}),r&&!n&&jsxRuntime.jsx("div",{ref:c,style:{...s,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:Tc.map(h=>{let P=e===h.value,x=o(h.labelKey),C=h.shortcutKey?o(h.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${x}${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:P?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:P?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{P||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=P?"var(--doc-primary-light)":"transparent";},onClick:()=>u(h.value),children:jsxRuntime.jsx(K,{name:h.iconName,size:18})},h.value)})})})]})}function Ti(){return {type:"none",level:0,isInList:false}}var fE={display:"inline-flex",alignItems:"center",gap:"4px"},Ef={display:"inline-flex",alignItems:"center",gap:"4px"},Ei={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)"},gE={...Ei,backgroundColor:"var(--doc-bg-hover)"},bE={...Ei,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},hE={...Ei,cursor:"default",opacity:.38},vE={width:"28px",height:"28px",padding:"2px"},yE={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Si=20;function Ci({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[l,c]=Ye.useState(false),s={...t?hE:e?bE:l?gE:Ei,...a},d=u=>{u.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:s,onMouseDown:d,onClick:t?void 0:o,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function wf({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:i=false,className:a,style:l,showIndentButtons:c=true,compact:s=false,hasIndent:d=false}){let{t:u}=_(),m=Ye.useCallback(()=>s?{...vE}:{},[s]),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:{...fE,...l},role:"group","aria-label":u("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:Ef,role:"group","aria-label":u("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Ci,{active:g,disabled:i,title:u("lists.bulletList"),onClick:t,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:Si})}),jsxRuntime.jsx(Ci,{active:p,disabled:i,title:u("lists.numberedList"),onClick:n,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:Si})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:yE,role:"separator"}),jsxRuntime.jsxs("div",{style:Ef,role:"group","aria-label":u("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Ci,{active:false,disabled:i||!b,title:u("lists.decreaseIndent"),onClick:r,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:Si})}),jsxRuntime.jsx(Ci,{active:false,disabled:i,title:u("lists.increaseIndent"),onClick:o,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:Si})})]})]})]})}var TE=[{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 Rf({value:e,onChange:t,options:n=TE,disabled:o=false,className:r}){let{t:i}=_(),a=Ye__namespace.useMemo(()=>e===void 0?n[0]:n.find(s=>s.twipsValue===e)||n[0],[e,n]),l=Ye__namespace.useCallback(s=>{let d=parseInt(s,10);isNaN(d)||t?.(d);},[t]),c=s=>s.labelKey?i(s.labelKey):s.label;return jsxRuntime.jsxs(qt,{value:a.twipsValue.toString(),onValueChange:l,disabled:o,children:[jsxRuntime.jsx(zt,{className:J("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:c(a)}),children:jsxRuntime.jsx(Is,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Vt,{children:[n.map(s=>jsxRuntime.jsx(tt,{value:s.twipsValue.toString(),children:c(s)},s.twipsValue)),jsxRuntime.jsx(So,{}),jsxRuntime.jsx(Kt,{children:jsxRuntime.jsx(To,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var SE={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},CE=new Set(["Title","Heading1","Heading2","Heading3"]),PE={Subtitle:"666666"},EE="#4a6c8c";function If(e){let t=SE[e.styleId],o={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??CE.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??PE[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=EE),o}function kf(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:t.name||t.styleId,priority:99}))}var _f=[{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 Df({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:i=120}){let{t:a}=_(),l=Ye__namespace.useMemo(()=>{let g=kf(n);return g.length===0?_f:g.map(p=>({...p,type:"paragraph",nameKey:_f.find(f=>f.styleId===p.styleId)?.nameKey}))},[n]),c=Ye__namespace.useCallback(g=>{t?.(g);},[t]),s=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",u=l.find(g=>g.styleId===d),m=u?s(u):d;return jsxRuntime.jsxs(qt,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:J("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:m})}),jsxRuntime.jsx(Vt,{className:"min-w-[260px] max-h-[400px]",children:l.map(g=>jsxRuntime.jsx(tt,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:If(g),children:s(g)})},g.styleId))})]})}var ME=[{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 Lf({value:e=1,onChange:t,levels:n=ME,disabled:o=false,className:r,compact:i=false}){let{t:a}=_(),l=Ye__namespace.useMemo(()=>{let g=n.find(p=>Math.abs(p.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[n,e]),c=Ye__namespace.useCallback(g=>{let p=parseFloat(g);isNaN(p)||t?.(p);},[t]),s=Ye__namespace.useMemo(()=>[...n].sort((g,p)=>g.value-p.value),[n]),d=Ye__namespace.useMemo(()=>[...s].reverse().find(g=>g.value<e-.001),[s,e]),u=Ye__namespace.useMemo(()=>s.find(g=>g.value>e+.001),[s,e]),m=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(o||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:o||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(qt,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:J(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(hi,{placeholder:"100%",children:l})}),jsxRuntime.jsx(Vt,{children:n.map(g=>jsxRuntime.jsx(tt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!u)&&"opacity-30 cursor-not-allowed"),onClick:()=>u&&t?.(u.value),disabled:o||!u,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var IE=[{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 Af({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=Ye.useState(false),i=Ye.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=$e({isOpen:o,onClose:i}),d=Ye.useCallback(m=>{e(m),r(false);},[e]),u=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&r(m=>!m),disabled:t,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(K,{name:"border_all",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?u:jsxRuntime.jsx(et,{content:n("table.borders.tooltip"),children:u}),o&&!t&&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:m=>m.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:IE.map(({action:m,icon:g,labelKey:p})=>jsxRuntime.jsx("button",{type:"button",title:n(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:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(m),children:jsxRuntime.jsx(K,{name:g,size:18})},typeof m=="string"?m:m.type))})})]})}function Of({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),i=Ye.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let l=a.kind==="auto"?"000000":Mt(a,n);l&&e({type:"borderColor",color:l});},[e,n]);return jsxRuntime.jsx(Eo,{mode:"border",value:o,onChange:i,theme:n,disabled:t,title:r("table.borderColor")})}var NE=[{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 Bf({onAction:e,disabled:t=false}){let[n,o]=Ye.useState(false),{t:r}=_(),i=Ye.useCallback(()=>o(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=$e({isOpen:n,onClose:i}),d=Ye.useCallback(m=>{e({type:"borderWidth",size:m}),o(false);},[e]),u=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&o(m=>!m),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(K,{name:"line_weight",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?u:jsxRuntime.jsx(et,{content:r("table.borderWidth"),children:u}),n&&!t&&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:"4px 0",minWidth:120},onMouseDown:m=>m.stopPropagation(),children:NE.map(({size:m,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:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(m),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(p,1),backgroundColor:"#000",borderRadius:p>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},m))})]})}function Kf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),i=Ye.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(Eo,{mode:"highlight",value:o,onChange:i,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var HE={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"},Ro={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},$f={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Wf({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,i]=Ye.useState(false),[a,l]=Ye.useState(null),c=Ye.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:d,dropdownStyle:u,handleMouseDown:m}=$e({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",p=Ye.useCallback(h=>{e(h),i(false);},[e]),f=(h,P,x,C,v)=>{let y=t||v?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...HE,backgroundColor:a===h&&!y?"var(--doc-bg-hover)":"transparent",color:y?"var(--doc-text-muted)":v?.danger?"var(--doc-error)":"var(--doc-text)",cursor:y?"not-allowed":"pointer"},onClick:()=>!y&&p(C),onMouseEnter:()=>l(h),onMouseLeave:()=>l(null),disabled:y,children:[jsxRuntime.jsx(K,{name:P,size:16,className:v?.danger&&!y?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:x})]},h)},b=jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:m,onClick:()=>!t&&i(h=>!h),disabled:t,"aria-label":o("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(K,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(et,{content:o("table.moreOptions"),children:b}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...u,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:[f("addRowAbove","add",o("table.insertRowAbove"),"addRowAbove"),f("addRowBelow","add",o("table.insertRowBelow"),"addRowBelow"),f("addColumnLeft","add",o("table.insertColumnLeft"),"addColumnLeft"),f("addColumnRight","add",o("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("mergeCells","call_merge",o("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),f("splitCell","call_split",o("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("deleteRow","delete",o("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(n?.rowCount??0)<=1}),f("deleteColumn","delete",o("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(n?.columnCount??0)<=1}),f("deleteTable","delete",o("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),jsxRuntime.jsx("div",{style:$f,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(h=>{let P={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:o({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(K,{name:P[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),jsxRuntime.jsx("div",{style:$f,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(h=>{let P={left:"format_align_left",center:"format_align_center",right:"format_align_right"},x=g===h;return jsxRuntime.jsx("button",{type:"button",title:o({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:x?"var(--doc-primary-light)":"transparent",borderColor:x?"var(--doc-primary)":"var(--doc-border)",color:x?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onClick:()=>p({type:"tableProperties",props:{justification:h}}),children:jsxRuntime.jsx(K,{name:P[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("headerRow","table_rows",o("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),f("distribute","view_column",o("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),f("autoFit","fit_width",o("tableAdvanced.autoFit"),{type:"autoFitContents"}),f("noWrap","wrap_text",o("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var AE=20;function Ri({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:i=false,ariaLabel:a,testId:l,showLabels:c=false}){let[s,d]=Ye.useState(false),u=Ye.useCallback(()=>d(false),[]),{containerRef:m,dropdownRef:g,dropdownStyle:p,handleMouseDown:f}=$e({isOpen:s,onClose:u}),b=Ye.useCallback(P=>{i||r(P),d(false);},[i,r]),h=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",s&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!i&&d(P=>!P),disabled:i,"aria-label":a??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:AE}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:m,style:{position:"relative",display:"inline-block"},children:[s?h:jsxRuntime.jsx(et,{content:o,children:h}),s&&!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:P=>P.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(P=>{let x=t===P.value;return jsxRuntime.jsxs("button",{type:"button",title:P.label,"data-testid":l?`${l}-${P.value}`:void 0,style:{display:"flex",alignItems:"center",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)",...c?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},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:()=>b(P.value),children:[jsxRuntime.jsx(K,{name:P.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:P.label})]},P.value)})})})]})}var OE=[{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 ZE(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function Gf({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=OE.map(l=>({...l,label:o(l.labelKey)})),i=ZE(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(Ri,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var qE=[{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 jf({onTransform:e,disabled:t=false}){let{t:n}=_(),o=qE.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(Ri,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ut=18;function ot({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,ariaLabel:a}){let l=a?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},s=jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:c,onClick:t?void 0:o,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||n,"data-testid":l?`toolbar-${l}`:void 0,children:r});return n?jsxRuntime.jsx(et,{content:n,children:s}):s}function pt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:J("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":e,children:t})}function WE(e){let t=Ye__namespace.default.useContext(Dr);return t?{...t,...UE(e)}:e}function UE(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Ec(e){let{t}=_(),n=WE(e),{currentFormatting:o={},onFormat:r,onUndo:i,onRedo:a,canUndo:l=false,canRedo:c=false,disabled:s=false,className:d,style:u,enableShortcuts:m=true,editorRef:g,children:p,showFontPicker:f=true,fontFamilies:b,documentFonts:h,showFontSizePicker:P=true,showTextColorPicker:x=true,showHighlightColorPicker:C=true,showAlignmentButtons:v=true,showListButtons:y=true,showLineSpacingPicker:T=true,showStylePicker:M=true,documentStyles:w,theme:E,showZoomControl:D=true,zoom:F,onZoomChange:H,onRefocusEditor:k,imageContext:L,onImageWrapType:R,onImageTransform:I,onOpenImageProperties:z,tableContext:Z,onTableAction:V,inline:j=false}=n,Re=Ye.useRef(null),se=Ye.useCallback(de=>{!s&&r&&r(de);},[s,r]),Se=Ye.useCallback(()=>{!s&&l&&i&&i();},[s,l,i]),Pe=Ye.useCallback(()=>{!s&&c&&a&&a();},[s,c,a]),G=Ye.useCallback(de=>{!s&&r&&r({type:"fontFamily",value:de});},[s,r]),q=Ye__namespace.default.useMemo(()=>gc(b),[b]),Ee=Ye.useCallback(de=>{!s&&r&&r({type:"fontSize",value:de});},[s,r]),Ue=Ye.useCallback(de=>{!s&&r&&r({type:"textColor",value:de});},[s,r]),ce=Ye.useCallback(de=>{!s&&r&&r({type:"highlightColor",value:typeof de=="string"?de:""});},[s,r]),Ge=Ye.useCallback(de=>{!s&&r&&r({type:"alignment",value:de});},[s,r]),pn=Ye.useCallback(()=>{!s&&r&&r("bulletList");},[s,r]),ko=Ye.useCallback(()=>{!s&&r&&r("numberedList");},[s,r]),Or=Ye.useCallback(()=>{!s&&r&&r("indent");},[s,r]),a0=Ye.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),i0=Ye.useCallback(de=>{!s&&r&&(r({type:"lineSpacing",value:de}),requestAnimationFrame(()=>k?.()));},[s,r,k]),l0=Ye.useCallback(de=>{!s&&r&&r({type:"applyStyle",value:de});},[s,r]),mn=Ye.useCallback(de=>{!s&&V&&(V(de),requestAnimationFrame(()=>k?.()));},[s,V,k]);Ye.useEffect(()=>{if(!m)return;let de=ue=>{if(ue.defaultPrevented)return;let fn=ue.target,Rc=g?.current,d0=Re.current,u0=Rc?.contains(fn),p0=d0?.contains(fn);if(!u0&&!p0)return;if((ue.ctrlKey||ue.metaKey)&&!ue.altKey)switch(ue.key.toLowerCase()){case "b":ue.preventDefault(),se("bold");break;case "i":ue.preventDefault(),se("italic");break;case "u":ue.preventDefault(),se("underline");break;case "=":ue.shiftKey?(ue.preventDefault(),se("superscript")):(ue.preventDefault(),se("subscript"));break;case "l":ue.preventDefault(),Ge("left");break;case "e":ue.preventDefault(),Ge("center");break;case "r":ue.preventDefault(),Ge("right");break;case "j":ue.preventDefault(),Ge("both");break;case "k":ue.preventDefault(),se("insertLink");break}};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de);}},[m,se,Ge,g]);let s0=Ye.useCallback(de=>{let ue=de.target;ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.tagName==="OPTION"||de.preventDefault();},[]),c0=Ye.useCallback(de=>{let ue=de.target,fn=document.activeElement;ue.tagName==="SELECT"||ue.tagName==="OPTION"||fn?.tagName==="SELECT"||requestAnimationFrame(()=>{k?.();});},[k]);return jsxRuntime.jsxs("div",{ref:Re,className:J(!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",...u}:u,role:j?void 0:"toolbar","aria-label":j?void 0:t("toolbar.ariaLabel"),"data-testid":j?void 0:"formatting-bar",onMouseDown:j?void 0:s0,onMouseUp:j?void 0:c0,children:[jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(ot,{onClick:Se,disabled:s||!l,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:ut})}),jsxRuntime.jsx(ot,{onClick:Pe,disabled:s||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:ut})})]}),D&&jsxRuntime.jsx(pt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(Lf,{value:F,onChange:H,disabled:s,compact:true})}),M&&jsxRuntime.jsx(pt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(Df,{value:o.styleId||"Normal",onChange:l0,styles:w,theme:E,disabled:s,width:120})}),(f||P)&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(df,{value:o.fontFamily||"Arial",onChange:G,fonts:q,documentFonts:h,disabled:s,width:60,placeholder:"Arial"}),P&&jsxRuntime.jsx(gf,{value:o.fontSize!==void 0?il(o.fontSize):11,onChange:Ee,disabled:s,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(ot,{onClick:()=>se("bold"),active:o.bold,disabled:s,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("italic"),active:o.italic,disabled:s,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("underline"),active:o.underline,disabled:s,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("strikethrough"),active:o.strike,disabled:s,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:ut})}),x&&jsxRuntime.jsx(Eo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:Ue,theme:E,disabled:s,title:t("formattingBar.fontColor")}),C&&jsxRuntime.jsx(Eo,{mode:"highlight",value:o.highlight,onChange:ce,theme:E,disabled:s,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(ot,{onClick:()=>se("insertLink"),disabled:s,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:ut})})]}),jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(ot,{onClick:()=>se("superscript"),active:o.superscript,disabled:s,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("subscript"),active:o.subscript,disabled:s,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:ut})})]}),v&&jsxRuntime.jsx(pt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(Pf,{value:o.alignment||"left",onChange:Ge,disabled:s})}),(y||T)&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.listFormatting"),children:[y&&jsxRuntime.jsx(wf,{listState:o.listState||Ti(),onBulletList:pn,onNumberedList:ko,onIndent:Or,onOutdent:a0,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),T&&jsxRuntime.jsx(Rf,{value:o.lineSpacing,onChange:i0,disabled:s})]}),L&&R&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(Gf,{imageContext:L,onChange:R,disabled:s}),I&&jsxRuntime.jsx(jf,{onTransform:I,disabled:s}),z&&jsxRuntime.jsx(ot,{onClick:z,disabled:s,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(K,{name:"tune",size:ut})})]}),Z?.isInTable&&V&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(Af,{onAction:mn,disabled:s}),jsxRuntime.jsx(Of,{onAction:mn,disabled:s,theme:E,value:Mt(Z?.cellBorderColor,E)}),jsxRuntime.jsx(Bf,{onAction:mn,disabled:s}),jsxRuntime.jsx(Kf,{onAction:mn,disabled:s,theme:E,value:Z?.cellBackgroundColor}),jsxRuntime.jsx(Wf,{onAction:mn,disabled:s,tableContext:Z})]}),jsxRuntime.jsx(ot,{onClick:()=>se("clearFormatting"),disabled:s,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:ut})}),p]})}function GE({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(Dr.Provider,{value:o,children:jsxRuntime.jsx("div",{className:J("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Ve.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var We=GE;We.TitleBar=pc;We.Logo=mi;We.DocumentName=uc;We.MenuBar=gi;We.TitleBarRight=fi;We.Toolbar=Ec;var XE=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"]]),QE=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function JE({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:l,renderTitleBarRight:c,ref:s,colorMode:d,onZoomChange:u,documentFontFamily:m,className:g}){let p=Ye.useRef(null),[f,b]=Ye.useState(null),[h,P]=Ye.useState({}),[x,C]=Ye.useState(null),v=Ye.useCallback(w=>{b(w);let E=p.current?.formatting();E&&P({bold:E.bold,italic:E.italic,underline:E.underline,strike:E.strikethrough,superscript:E.superscript,subscript:E.subscript,...E.fontFamily?{fontFamily:E.fontFamily}:{},...E.fontSizeHalfPoints?{fontSize:E.fontSizeHalfPoints}:{},...E.alignment?{alignment:E.alignment}:{},...E.styleId?{styleId:E.styleId}:{},...E.color?{color:`#${E.color}`}:{},...E.highlight?{highlight:E.highlight}:{}}),C(p.current?.sectionProperties()??null),r?.(w);},[r]),y=Ye.useCallback(w=>{let E=p.current;if(E){if(typeof w=="string")switch(w){case "bold":return E.toggleRunProperty("b");case "italic":return E.toggleRunProperty("i");case "underline":return E.toggleRunProperty("u",{val:"single"});case "strikethrough":return E.toggleRunProperty("strike");case "superscript":return E.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return E.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":E.setRunProperty("b",{val:"0"}),E.setRunProperty("i",{val:"0"}),E.setRunProperty("u",{val:"none"}),E.setRunProperty("strike",{val:"0"}),E.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(w.type){case "fontFamily":return E.setRunProperty("rFonts",{ascii:w.value,hAnsi:w.value});case "fontSize":return E.setRunProperty("sz",{val:String(Math.round(w.value*2))});case "textColor":{let D=w.value,F=typeof D=="string"?QE(D):Mt(D,null)??null;return F?E.setRunProperty("color",{val:F}):void 0}case "highlightColor":{let D=w.value.trim().toLowerCase();if(D==="none"||D==="")return E.setRunProperty("highlight",{val:"none"});let F=XE.get(D.startsWith("#")?D:`#${D}`);return F?E.setRunProperty("highlight",{val:F}):void 0}case "alignment":return E.setParagraphProperty("jc",{val:String(w.value)});case "lineSpacing":return E.setParagraphProperty("spacing",{line:String(Math.round(w.value)),lineRule:"auto"});case "applyStyle":return E.setParagraphProperty("pStyle",{val:w.value});default:return}}},[]);Ye.useImperativeHandle(s,()=>p.current,[]);let T=t===void 0?1:t/(96/72),M=x?{pageWidthTwips:x.pageSize.widthTwips,pageHeightTwips:x.pageSize.heightTwips,orientation:x.landscape?"landscape":"portrait",marginsTwips:{top:x.margins.topTwips,right:x.margins.rightTwips,bottom:x.margins.bottomTwips,left:x.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(We,{currentFormatting:h,onFormat:y,onUndo:()=>p.current?.undo(),onRedo:()=>p.current?.redo(),canUndo:f?.canUndo??false,canRedo:f?.canRedo??false,zoom:T,onZoomChange:u,onSave:()=>{let w=p.current?.save();w&&a?.(w);},children:[jsxRuntime.jsxs(We.TitleBar,{children:[l&&jsxRuntime.jsx(We.Logo,{children:l()}),jsxRuntime.jsx(We.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(We.TitleBarRight,{children:c()}),jsxRuntime.jsx(We.MenuBar,{})]}),jsxRuntime.jsx(We.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[M?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(co,{pageSetup:M,zoom:T})}):null,jsxRuntime.jsx(ic,{ref:p,source:e,...m?{documentFontFamily:m}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:v,...i?{onError:i}:{}})]})]})}var ki=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 _i=class extends ki{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,n){return this.addNotification(t,"error",n)}showWarning(t,n){return this.addNotification(t,"warning",n)}showInfo(t,n){return this.addNotification(t,"info",n)}dismiss(t){this.notifications=this.notifications.map(o=>o.id===t?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==t),this.emitSnapshot();},300);this.timers.add(n);}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,n,o){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),n!=="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 a2=Ye.createContext(null);function e0({children:e}){let t=Ye.useMemo(()=>new _i,[]),n=Ye.useSyncExternalStore(t.subscribe,t.getSnapshot),o=Ye.useCallback((s,d)=>{t.showError(s,d);},[t]),r=Ye.useCallback((s,d)=>{t.showWarning(s,d);},[t]),i=Ye.useCallback((s,d)=>{t.showInfo(s,d);},[t]),a=Ye.useCallback(s=>{t.dismiss(s);},[t]),l=Ye.useCallback(()=>{t.clearAll();},[t]),c=Ye.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:l}),[n.notifications,o,r,i,a,l]);return jsxRuntime.jsxs(a2.Provider,{value:c,children:[e,jsxRuntime.jsx(i2,{notifications:n.notifications,onDismiss:a})]})}function i2({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.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:n.map(r=>jsxRuntime.jsx(l2,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function l2({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=Ye.useState(false),a=(f=>{switch(f){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:"slideIn 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},s={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},u={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},m={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=f=>{switch(f){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.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:l,children:[jsxRuntime.jsx("style",{children:`
3
3
  @keyframes slideIn {
4
4
  from {
5
5
  opacity: 0;
@@ -10,9 +10,9 @@
10
10
  transform: translateX(0);
11
11
  }
12
12
  }
13
- `}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:l,children:f(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:p,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!o),style:{...m,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:g,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:m,title:n("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 wi=class extends Ye.Component{constructor(n){super(n);nt(this,"resetError",()=>{this.setState({hasError:false,error:null,errorInfo:null});});this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(n){return {hasError:true,error:n}}componentDidCatch(n,o){this.setState({errorInfo:o}),console.error("ErrorBoundary caught an error:",n,o),this.props.onError&&this.props.onError(n,o);}render(){if(this.state.hasError){let{fallback:n,showDetails:o=true}=this.props,{error:r,errorInfo:a}=this.state;return n?typeof n=="function"?n(r,this.resetError):n:jsxRuntime.jsx(T2,{error:r,errorInfo:a,showDetails:o,onReset:this.resetError})}return this.props.children}};function T2({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=_(),a={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"},i={color:"var(--doc-error)",marginBottom:"16px"},s={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},c={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},l={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:a,children:[jsxRuntime.jsx("div",{style:i,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:c,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:l,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
13
+ `}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:s,children:p(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:u,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!o),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:m,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:n("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 Di=class extends Ye.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,n){this.setState({errorInfo:n}),console.error("ErrorBoundary caught an error:",t,n),this.props.onError&&this.props.onError(t,n);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:n=true}=this.props,{error:o,errorInfo:r}=this.state;return t?typeof t=="function"?t(o,this.resetError):t:jsxRuntime.jsx(s2,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function s2({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=_(),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"},c={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},s={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:c,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
14
14
 
15
- `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function Df({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=tr}){let{t:r}=_();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:a=>a.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:o-n,top:t,zIndex:Ve.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function uc({currentPage:e,totalPages:t,visible:n}){let{t:o}=_();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:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:o("viewer.pageIndicator",{current:e,total:t})})}function C2({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:a,className:i,containerStyle:s,mainContentStyle:c,editorContainerStyle:l,showRuler:d,readOnlyProp:p,showOutline:g,showOutlineButton:m,sidebarOpen:f,minLayoutWidth:u,toolbarHeight:h,editorScrollLeft:b,expandedSidebarItem:v,trackedChanges:C,onScrollContainerMouseDown:P,onEditorBgMouseDown:S,onEditorContextMenu:y,horizontalRulerProps:x,verticalRulerProps:M,outlineProps:E,onToggleOutline:w,scrollPageInfo:N,toolbar:F,pagedArea:H,overlays:I,dialogs:D,fileInputs:k}){return jsxRuntime.jsx(Qt.Provider,{value:true,children:jsxRuntime.jsx(wo,{i18n:e,children:jsxRuntime.jsx(Rf,{children:jsxRuntime.jsx(wi,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:j("docx-editor",t&&"dark",i),style:s,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:c,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[F,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:l,onMouseDown:P,children:[d&&jsxRuntime.jsx("div",{className:"flex justify-center py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Ve.ruler,paddingLeft:20,paddingRight:20+(f?352:0),minWidth:u,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(ao,{...x})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:u},children:jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",flex:1,minWidth:0},onMouseDown:S,onContextMenu:y,children:[d&&!p&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Ve.ruler,paddingTop:48},children:jsxRuntime.jsx(er,{...M})}),v&&v.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${v.replace("comment-","")}"] { background-color: var(--doc-comment-active-bg) !important; border-bottom-width: 2px !important; border-bottom-style: solid !important; border-bottom-color: var(--doc-comment-active-border) !important; }`}),v?.startsWith("tc-")&&(()=>{let R=v.split("-")[1],Z=C.find($=>String($.id)===R)?.id??R;return jsxRuntime.jsx("style",{children:`
15
+ `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function n0({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=Wo}){let{t:r}=_();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:o-n,top:t,zIndex:Ve.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function Mc({currentPage:e,totalPages:t,visible:n}){let{t:o}=_();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:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:o("viewer.pageIndicator",{current:e,total:t})})}function d2({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:l,mainContentStyle:c,editorContainerStyle:s,showRuler:d,readOnlyProp:u,showOutline:m,showOutlineButton:g,sidebarOpen:p,minLayoutWidth:f,toolbarHeight:b,editorScrollLeft:h,expandedSidebarItem:P,trackedChanges:x,onScrollContainerMouseDown:C,onEditorBgMouseDown:v,onEditorContextMenu:y,horizontalRulerProps:T,verticalRulerProps:M,outlineProps:w,onToggleOutline:E,scrollPageInfo:D,toolbar:F,pagedArea:H,overlays:k,dialogs:L,fileInputs:R}){return jsxRuntime.jsx(oo.Provider,{value:true,children:jsxRuntime.jsx(_o,{i18n:e,children:jsxRuntime.jsx(e0,{children:jsxRuntime.jsx(Di,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:J("docx-editor",t&&"dark",a),style:l,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:c,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[F,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:s,onMouseDown:C,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Ve.ruler,paddingLeft:20,paddingRight:20+(p?352:0),minWidth:f,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(co,{...T})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:f},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:v,onContextMenu:y,children:[d&&!u&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Ve.ruler,paddingTop:48},children:jsxRuntime.jsx(sr,{...M})}),P&&P.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${P.replace("comment-","")}"] { background-color: var(--doc-comment-active-bg) !important; border-bottom-width: 2px !important; border-bottom-style: solid !important; border-bottom-color: var(--doc-comment-active-border) !important; }`}),P?.startsWith("tc-")&&(()=>{let I=P.split("-")[1],Z=x.find(V=>String(V.id)===I)?.id??I;return jsxRuntime.jsx("style",{children:`
16
16
  .paged-editor__pages .docx-insertion[data-revision-id="${Z}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
17
17
  .paged-editor__pages .docx-deletion[data-revision-id="${Z}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
18
- `})})(),H]})})]}),N.totalPages>1&&jsxRuntime.jsx(uc,{currentPage:N.currentPage,totalPages:N.totalPages,visible:N.visible}),g&&jsxRuntime.jsx(La,{...E,leftOffset:Da+(d?Bo:0)}),m&&!g&&jsxRuntime.jsx(Df,{onClick:w,topPx:h+(d?30:0)+48,scrollLeft:b,leftOffset:tr+(d?Bo:0)})]})}),I,D,k]})})})})})}function R2(e){let[t,n]=Ye.useState(0);return Ye.useEffect(()=>{if(!e)return;let o=()=>n(i=>i+1),r=e.on("change",o),a=e.on("selectionChange",o);return o(),()=>{r(),a();}},[e]),t}var cH="0.0.2";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,"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,"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,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});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=Be;exports.ContextMenuCellVerticalAlignment=fo;exports.ContextMenuCopy=fr;exports.ContextMenuCut=mr;exports.ContextMenuDelete=gr;exports.ContextMenuDeleteTable=Jo;exports.ContextMenuDeleteTableColumn=Qo;exports.ContextMenuDeleteTableRow=jo;exports.ContextMenuInsertColumnLeft=Yo;exports.ContextMenuInsertColumnRight=Xo;exports.ContextMenuInsertRowAbove=Uo;exports.ContextMenuInsertRowBelow=Go;exports.ContextMenuItem=ei;exports.ContextMenuPaste=Wo;exports.ContextMenuSelectAll=br;exports.DocumentName=Ys;exports.DocxEditor=XC;exports.DocxEditorContent=Fr;exports.DocxEditorContentControl=ri;exports.DocxEditorContextMenu=vr;exports.DocxEditorDocumentOutline=fs;exports.DocxEditorFontNotice=Ka;exports.DocxEditorHeaderFooterChrome=$a;exports.DocxEditorHorizontalRuler=_a;exports.DocxEditorHyperLink=Ua;exports.DocxEditorImagePropertiesDialog=cl;exports.DocxEditorLoading=Or;exports.DocxEditorLoadingSpinner=Oi;exports.DocxEditorMenu=jn;exports.DocxEditorNavigation=Ts;exports.DocxEditorNotesChrome=Ga;exports.DocxEditorPageSetupDialog=Vn;exports.DocxEditorRoot=zr;exports.DocxEditorShell=C2;exports.DocxEditorToolbar=zn;exports.DocxEditorVerticalRuler=Na;exports.DocxEditorViewport=$r;exports.HorizontalRuler=ao;exports.ImageAltText=ea;exports.ImageInsertProvider=Nr;exports.ImageInsertTrigger=Dr;exports.ImagePropertiesTrigger=ra;exports.ImageWrap=Jr;exports.LocaleProvider=wo;exports.Logo=li;exports.MenuBar=ci;exports.NAVIGATION_PANE_GAP=Hp;exports.NAVIGATION_PANE_INSET=Ha;exports.NAVIGATION_PANE_WIDTH=qo;exports.NavigationClose=rr;exports.NavigationFind=cr;exports.NavigationHeader=nr;exports.NavigationHeadings=sr;exports.NavigationTab=lr;exports.NavigationTabs=ir;exports.NavigationTitle=ar;exports.NavigationToggle=dr;exports.PageIndicator=uc;exports.PaginatedDocxEditor=Vs;exports.PaginatedDocxEditorShell=p2;exports.RULER_WIDTH=Bo;exports.ReviewRailContext=St;exports.SEARCH_DEBOUNCE_MS=vs;exports.SEARCH_MATCH_LIMIT=ys;exports.Slot=W;exports.TitleBar=Xs;exports.TitleBarRight=si;exports.Toolbar=cc;exports.ToolbarButton=tt;exports.ToolbarGroup=dt;exports.VERSION=cH;exports.VerticalRuler=er;exports.navigationPaneReservation=Ko;exports.navigationShift=Fa;exports.normalizeImageBytes=Ir;exports.useChromeTranslate=Sc;exports.useContentControl=pt;exports.useContentControlInstance=qr;exports.useContextMenuTarget=em;exports.useDocumentOutline=Aa;exports.useDocumentSearch=Oa;exports.useDocxEditor=A;exports.useDocxSource=tP;exports.useEditorCaret=cP;exports.useEditorCommand=ne;exports.useEditorEvent=Ll;exports.useEditorSnapshot=R2;exports.useEditorState=q;exports.useEditorValueCommand=xn;exports.useFontFamily=sa;exports.useFonts=aP;exports.useHeaderFooterState=Es;exports.useHyperlinkPopup=Bi;exports.useHyperlinkPopupInstance=Br;exports.useNavigationPane=Ba;exports.useNavigationShift=Ro;exports.useNotePropertiesState=As;exports.useNoteScopeState=Fs;exports.usePageSetup=eo;exports.useParagraphIndent=cs;exports.useParagraphStyle=ca;exports.useTableBorderTargetLabel=Fu;exports.useTranslation=_;exports.useZoom=pl;
18
+ `})})(),H]})})]}),D.totalPages>1&&jsxRuntime.jsx(Mc,{currentPage:D.currentPage,totalPages:D.totalPages,visible:D.visible}),m&&jsxRuntime.jsx(dr,{...w,leftOffset:cr+(d?$o:0)}),g&&!m&&jsxRuntime.jsx(n0,{onClick:E,topPx:b+(d?30:0)+48,scrollLeft:h,leftOffset:Wo+(d?$o:0)})]})}),k,L,R]})})})})})}function h2(e){let[t,n]=Ye.useState(0);return Ye.useEffect(()=>{if(!e)return;let o=()=>n(a=>a+1),r=e.on("change",o),i=e.on("selectionChange",o);return o(),()=>{r(),i();}},[e]),t}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,"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,"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,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});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=Be;exports.ContextMenuCellVerticalAlignment=yo;exports.ContextMenuCopy=Er;exports.ContextMenuCut=Pr;exports.ContextMenuDelete=wr;exports.ContextMenuDeleteTable=rn;exports.ContextMenuDeleteTableColumn=nn;exports.ContextMenuDeleteTableRow=on;exports.ContextMenuInsertColumnLeft=en;exports.ContextMenuInsertColumnRight=tn;exports.ContextMenuInsertRowAbove=Qo;exports.ContextMenuInsertRowBelow=Jo;exports.ContextMenuItem=ii;exports.ContextMenuPaste=Xo;exports.ContextMenuRefreshToc=an;exports.ContextMenuRefreshTocPageNumbers=ln;exports.ContextMenuSelectAll=Mr;exports.DocumentName=uc;exports.DocumentOutline=dr;exports.DocxEditor=NP;exports.DocxEditorAuthorStyle=ji;exports.DocxEditorColorByChangeType=Gi;exports.DocxEditorContent=Gr;exports.DocxEditorContentControl=di;exports.DocxEditorContextMenu=Ir;exports.DocxEditorDocumentOutline=_s;exports.DocxEditorFontNotice=Xa;exports.DocxEditorHeaderFooterChrome=Ja;exports.DocxEditorHorizontalRuler=qa;exports.DocxEditorHyperLink=ti;exports.DocxEditorImagePropertiesDialog=wl;exports.DocxEditorLoading=Yr;exports.DocxEditorLoadingSpinner=Ui;exports.DocxEditorMenu=ar;exports.DocxEditorNavigation=Zs;exports.DocxEditorNotesChrome=oi;exports.DocxEditorPageNumber=Ya;exports.DocxEditorPageSetupDialog=Qn;exports.DocxEditorRoot=Pn;exports.DocxEditorShell=d2;exports.DocxEditorToolbar=Xn;exports.DocxEditorVerticalRuler=Ka;exports.DocxEditorViewport=na;exports.HorizontalRuler=co;exports.ImageAltText=pa;exports.ImageInsertProvider=Vr;exports.ImageInsertTrigger=$r;exports.ImagePropertiesTrigger=ba;exports.ImageWrap=ua;exports.LocaleProvider=_o;exports.Logo=mi;exports.MenuBar=gi;exports.NAVIGATION_PANE_GAP=am;exports.NAVIGATION_PANE_INSET=za;exports.NAVIGATION_PANE_WIDTH=Uo;exports.NavigationClose=fr;exports.NavigationFind=yr;exports.NavigationHeader=mr;exports.NavigationHeadings=vr;exports.NavigationTab=hr;exports.NavigationTabs=br;exports.NavigationTitle=gr;exports.NavigationToggle=xr;exports.OUTLINE_BUTTON_LEFT_OFFSET=Wo;exports.OUTLINE_BUTTON_RESERVED_SPACE=IS;exports.OUTLINE_LEFT_OFFSET=cr;exports.OUTLINE_RESERVED_SPACE=MS;exports.PageIndicator=Mc;exports.PageNumberTranslationContext=ja;exports.PaginatedDocxEditor=ic;exports.PaginatedDocxEditorShell=JE;exports.REVIEW_MARKERS_GUTTER=ll;exports.REVIEW_PANE_GUTTER=sl;exports.RULER_WIDTH=$o;exports.ReviewRailContext=rt;exports.SEARCH_DEBOUNCE_MS=Hs;exports.SEARCH_MATCH_LIMIT=Fs;exports.Slot=W;exports.TitleBar=pc;exports.TitleBarRight=fi;exports.Toolbar=Ec;exports.ToolbarButton=ot;exports.ToolbarContext=Yt;exports.ToolbarGroup=pt;exports.ToolbarImageProperties=Zo;exports.VERSION=f0;exports.VerticalRuler=sr;exports.editorStateActiveSubscriptionCount=C0;exports.isFieldLink=yn;exports.navigationPaneReservation=mo;exports.navigationShift=Va;exports.normalizeImageBytes=Br;exports.provideDocxEditor=Bg;exports.reviewGutter=md;exports.useChromeTranslate=Zc;exports.useContentControl=mt;exports.useContentControlInstance=Jr;exports.useContextMenuTarget=Cm;exports.useDocumentOutline=$a;exports.useDocumentSearch=Wa;exports.useDocxEditor=A;exports.useDocxSource=OP;exports.useEditorCaret=YP;exports.useEditorCommand=ne;exports.useEditorEvent=Xl;exports.useEditorSnapshot=h2;exports.useEditorState=B;exports.useEditorValueCommand=In;exports.useFontFamily=xa;exports.useFonts=KP;exports.useHeaderFooterState=qs;exports.useHyperlinkPopup=Yi;exports.useHyperlinkPopupInstance=Qr;exports.useNavigationPane=Ua;exports.useNavigationShift=to;exports.useNotePropertiesState=Js;exports.useNoteScopeState=Qs;exports.usePageSetup=ro;exports.useParagraphIndent=Es;exports.useParagraphStyle=Ta;exports.useReviewAuthors=WP;exports.useReviewGutter=Ho;exports.useScopeClassName=je;exports.useScopedChromeAnchor=Tr;exports.useTableBorderTargetLabel=ip;exports.useToolbarContext=k0;exports.useToolbarLabel=Y;exports.useToolbarLabelFor=qr;exports.useTranslation=_;exports.useZoom=Il;