@docx-editor.dev/react 2.6.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 +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +2 -2
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 f0=Object.defineProperty;var g0=(e,t,n)=>t in e?f0(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var rt=(e,t,n)=>g0(e,typeof t!="symbol"?t+"":t,n);var kc={version:"2.6.0"};var h0=kc.version;var _c="(prefers-color-scheme: dark)";function Dc(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Nc(){return Dc()?window.matchMedia(_c).matches:false}function Lc(e,t){return e==="dark"||e==="system"&&t}function Hc(e){if(!Dc())return ()=>{};let t=window.matchMedia(_c);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var Hi=Ye.createContext(null);function A(){return Ye.useContext(Hi)}var at=Ye.createContext(null);var Fi=Ye.createContext(i18n.en),Ai=Ye.createContext("en");function Do({i18n:e,children:t}){let n=Ye.useContext(Fi),o=Ye.useContext(Ai),r=typeof e?._lang=="string"?e._lang:o,a=Ye.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Ai.Provider,{value:r,children:jsxRuntime.jsx(Fi.Provider,{value:a,children:t})})}function _(){let e=Ye.useContext(Fi),t=Ye.useContext(Ai);return {t:Ye.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function Bc(e){let{t}=_();return Ye.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var E0=()=>{},Zi=0;function w0(){return Zi}function Bi(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,a=n?.onUnsubscribe,i=Ye.useCallback(d=>{if(!o)return E0;let u=false;Zi++,r?.();let m=Bi(()=>{u||d();}),g=[o.on("change",m),o.on("selectionChange",m),o.on("error",m)];return ()=>{u=true,Zi--,a?.();for(let p of g)p();}},[o,r,a]),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(i,c,s)}var Kc=12700,qc=96;function k0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function _0(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 qr(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(!k0(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}=_0(o.pixelWidth,o.pixelHeight,qc,qc);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:a,heightPoints:i})}function _t(e){return Math.round(e/Kc*100)/100}function bn(e){return Math.round(e*Kc)}var Xt=Ye.createContext({t:void 0,onSave:void 0});function N0(){return Ye.useContext(Xt)}function Kr(e){let{t}=_();return n=>e?.(n)??t(n)}function Y(){let{t:e}=Ye.useContext(Xt);return Kr(e)}function Z0(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function qi(e){return typeof e=="string"}function ne(e){let t=A(),{t:n}=_(),o=qi(e)?e:editor.editorCommandKey(e),r=Ye.useRef(e);r.current=e;let a=Ye.useCallback(c=>{let s=r.current;if(qi(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]),i=B(a,Z0),l=Ye.useCallback(()=>{let c=r.current;return qi(c)?editor.runToolbarCommand(t,c).ok:t?t.exec(c).ok:false},[t,o]);return Ye.useMemo(()=>({execute:l,isActive:i.active,isEnabled:i.enabled,disabledReason:i.disabledReason}),[l,i])}function z0(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function V0(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=z0(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=V0(t,o),a=n.ref,i=t.ref;return (a||i)&&(r.ref=l=>{for(let c of [a,i])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 Qt(e){let{slot:t,icon:n,asChild:o,className:r,children:a,hidden:i}=e,{execute:l,isActive:c,isEnabled:s,disabledReason:d}=ne(t),u=Y();if(i)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:a}):jsxRuntime.jsx("button",{type:"button",...b,children:n??a??te(m?.paths)})}Qt.docxToolbarPart=true;var J0="image/png,image/jpeg,image/gif",zi=Ye.createContext(null);function Vr(){let e=Ye.useContext(zi);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function Vi(){return Ye.useContext(zi)}function $r({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=B(a,(f,b)=>f.enabled===b.enabled&&f.disabledReason===b.disabledReason),l=i.enabled,c=i18n.localizeDisabledReason(i.disabledReason,n),s=Ye.useCallback(async f=>{if(!t||r.current)return;let b=qr(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(zi.Provider,{value:p,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:J0,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function Wr({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:a,disabledReason:i}=Vr(),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:!a,...a?{}:{"data-disabled":""},"aria-label":s,title:i??s,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx(W,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??te(c?.paths)})}Wr.docxSlot="image.insert";var hn=Object.assign(Wr,{docxSlot:"image.insert"});var ug=["nw","n","ne","e","se","s","sw","w"],Qc=40,Jc=12;function pg(e){return `imageOverlay.handle.${e}`}function mg(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 fg(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 gg(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 $i({containerRef:e,portalRef:t,scrollPort:n}){let o=A(),{t:r}=_(),[a,i]=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===a?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return v.addEventListener("pointerdown",y,{capture:true}),()=>v.removeEventListener("pointerdown",y,{capture:true})},[e,a?.id]),Ye.useEffect(()=>{if(!o){i(null);return}let v=()=>{i(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=gg(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-Qc?k=Jc:M.clientY<z.top+Qc&&(k=-Jc),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(()=>{!a||g.current!==a.id||(g.current=null,m.current?.focus({preventScroll:true}));},[a]);let x=l?.bounds??a,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?ug.map(E=>{let D=fg(E);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(pg(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:mg(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 Ui(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function jr({className:e}){let t=A(),n=Vi(),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 a=Ye.useCallback(c=>{if(!n?.isEnabled)return;let s=c.clipboardData;s&&Ui(s)&&(c.preventDefault(),n.insertFromDataTransfer(s));},[n]),i=Ye.useCallback(c=>{!n?.isEnabled||!Ui(c.dataTransfer)||c.preventDefault();},[n]),l=Ye.useCallback(c=>{n?.isEnabled&&Ui(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:a,onDragOver:i,onDrop:l}),t?jsxRuntime.jsx($i,{containerRef:o,portalRef:r}):null]})}var yg=e=>e.isLoading||e.isOpening===true;function Gi({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function xg({when:e=false,overlay:t=false,className:n,style:o,children:r}){let a=B(yg),{t:i}=_();if(!e&&!a)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(Gi,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:i("loading.label")})]})})}var Xr=Object.assign(xg,{Spinner:Gi});function nd(){let e=new Set,t=new Map,n=new Map,o=0,r=null,a=false;function i(){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=i(),g=s(m);if(g!==l){if(m===void 0){a&&(r.setRevisionStyles("author"),a=false,l=g);return}r.setRevisionStyles(m),a=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=i();a=m!==null&&g!==void 0,l=m===null?null:s(g),u();},current:i}}var yn=Ye.createContext(null);function id(){let e=Ye.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function ji(){let e=Ye.useContext(yn),t=id();return Ye.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function Yi(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:a}=e,i=Ye.useContext(yn),l=id();return Ye.useEffect(()=>{if(i)return i.register(l,t,{...n!==void 0?{color:n}:{},...o!==void 0?{background:o}:{},...r!==void 0?{spanClassName:r}:{},...a!==void 0?{avatarUrl:a}:{}}),()=>i.unregister(l)},[i,l,t,n,o,r,a]),null}function xn(e){return e.paragraphId===""}var Jt=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),Ig=e=>e;function kg(){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 Tn=Ye.createContext(null);function Xi(){let e=Ye.useContext(Tn),t=Jr(e===null);return e??t}function Jr(e=true){let t=A(),[n,o]=Ye.useState(Jt),r=Ye.useRef(null),a=Ye.useRef(n);a.current=n;let i=B(Ig),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(Jt);},[c]);Ye.useEffect(()=>c,[c]);let u=Ye.useCallback(()=>{let x=kg();c();let C=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(C&&xn(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=a.current;if(x.mode!=="reading"||!x.link)return;let C=xn(x.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;C&&C.id===x.link.id||o(Jt);},[i,t]),Ye.useEffect(()=>{let x=a.current;if(x.mode!=="editing"||x.link)return;let C=t?.surface;!C||C.retainedSelection()||o(Jt);},[i,t]);let m=Ye.useCallback(async()=>{let x=a.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=a.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=a.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=a.current.link;if(!x||!C)return false;if(C.kind==="internal"){let y=C.anchor?x.goToBookmark(C.anchor):false;return y&&o(Jt),y}let v=x.openExternal(C.href);return v&&o(Jt),v},[t]);return Ye.useMemo(()=>({state:n.mode==="closed"?Jt:{...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 Lg(e){return e==="sdtLocked"||e==="sdtContentLocked"}function Hg(e){return e==="contentLocked"||e==="sdtContentLocked"}function Ji(e,t){return !e.ok&&e.code===t}function ft(){let e=Ye.useContext(el),t=ea();return e??t}function ea(){let e=A(),[t,n]=Ye.useState(false),[o,r]=Ye.useState(false),[a,i]=Ye.useState(false),l=B(T=>T),c=e?.surface??null,s=c?.contentControls;Ye.useEffect(()=>{r(s?.showAll()??c?.state().contentControls.showAll??false),i(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:Hg(T.effectiveLock)||R==="locked",removalLocked:Lg(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"||Ji(D,"locked"),k=w==="bound"||Ji(D,"bound"),L=E==="locked"||Ji(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),i(T);},[s]),p=Ye.useCallback(()=>m(!o),[m,o]),f=Ye.useCallback(()=>g(!a),[g,a]),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:a,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,a,t,x,C,m,p,g,f,b,h,P,y,v])}var el=Ye.createContext(null);function sd(){let e=0,t=0,n=null,o=new Set,r=new Set,a=new Set,i=l=>{for(let c of [...l])c();};return {getShift:()=>e,setShift(l){let c=Math.max(0,Math.round(l));c!==e&&(e=c,i(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,i(r));},subscribeReservation(l){return r.add(l),()=>r.delete(l)},getViewport:()=>n,setViewport(l){l!==n&&(n=l,i(a));},subscribeViewport(l){return a.add(l),()=>a.delete(l)}}}var ol=Ye.createContext(null);function to(){return Ye.useContext(ol)}var cd=()=>0,nl=()=>()=>{};function oo(){let e=to(),t=Ye.useCallback(o=>e?e.subscribeShift(o):nl(),[e]),n=Ye.useCallback(()=>e?e.getShift():0,[e]);return Ye.useSyncExternalStore(t,n,cd)}function dd(){let e=to(),t=Ye.useCallback(o=>e?e.subscribeReservation(o):nl(),[e]),n=Ye.useCallback(()=>e?e.getReservation():0,[e]);return Ye.useSyncExternalStore(t,n,cd)}function Ct(){let e=to(),t=Ye.useCallback(r=>e?e.subscribeViewport(r):nl(),[e]),n=Ye.useCallback(()=>e?e.getViewport():null,[e]),o=Ye.useCallback(()=>null,[]);return Ye.useSyncExternalStore(t,n,o)}function Kg(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 zg(e){let t=Ye.useRef(e);t.current=e;let[n,o]=Ye.useState(null),{onReady:r,onChange:a,onFontError:i,...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:En,rootProps:l,rootListeners:c,editorRef:n}}function En(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:a,imageDecodePort:i,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??(g.current=nd());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,i,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||!Kg(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(a??editor.defaultTableLabel);},[u,a]);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(sd,[]);return Ye.useEffect(()=>(p.connect(u),()=>p.connect(null)),[p,u]),jsxRuntime.jsx(at.Provider,{value:x,children:jsxRuntime.jsx(Hi.Provider,{value:u,children:jsxRuntime.jsx(ol.Provider,{value:C,children:jsxRuntime.jsx(yn.Provider,{value:p,children:jsxRuntime.jsx(Vg,{children:jsxRuntime.jsx($g,{children:jsxRuntime.jsx($r,{children:l})})})})})})})}function Vg({children:e}){let t=Jr(true);return jsxRuntime.jsx(Tn.Provider,{value:t,children:e})}function $g({children:e}){let t=ea();return jsxRuntime.jsx(el.Provider,{value:t,children:e})}function xe(e){return e/1440*96}function ta(e){return e/96*1440}function qe(e){return `${Math.round(e*100)/100}px`}function ll(e){return e/2}var cl=316,sl=44,Yg=24,oa={inlineStart:0,inlineEnd:cl},ud={inlineStart:sl,inlineEnd:sl},Xg={inlineStart:0,inlineEnd:0};function fd({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return ud;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return oa;let a=Number.isFinite(o)&&o>0?o:0;return t-a-n-2*Yg>=cl?oa:ud}var Qg=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}},Jg=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function gd(){let e=Ct(),[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 Fo(){let e=Ye.useContext(at),{pageSetup:t,reviewPaneOpen:n,entitledZoom:o}=B(Qg,Jg),r=Ct(),a=dd(),i=Ye.useRef(null);t&&(i.current=t.pageWidthTwips);let l=t?.pageWidthTwips??i.current,c=(e?.mounted??0)>0,s=Ye.useCallback(m=>c?fd({open:n,viewportWidth:m??0,pageWidthPx:l===null||o===null?0:xe(l)*o,inlineStartReservation:a,docked:o===null}):Xg,[c,n,l,o,a]),[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 na=[.25,.5,.75,1,1.25,1.5,2];function wn(e,t){return t==="in"?na.find(o=>o>e+.001)??null:[...na].reverse().find(o=>o<e-.001)??null}function bd(e,t){return e==="0"?1:e==="+"||e==="="?wn(t,"in")??t:e==="-"?wn(t,"out")??t:null}var no=Ye.createContext(false);function je(){return Ye.useContext(no)?"":"docx-editor "}var nb=e=>e.reviewPaneOpen??true,rb=e=>e.zoomMode?.type==="fit";function ra({className:e,style:t,children:n}){let o=je(),r=A(),a=B(nb),i=Fo(),l=B(rb),s=(Ye.useContext(at)?.mounted??0)>0,d=to(),u=oo(),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=bd(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":a?"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":`${i.inlineEnd}px`,"--docx-review-gutter-start":`${i.inlineStart}px`}:{}},children:jsxRuntime.jsx(no.Provider,{value:true,children:n})})}var ib=editor.LOADING_SNAPSHOT;function yd({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)??ib}),[t]);}var pb=e=>e.editingMode??"editing",ul=[{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"}],mb="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function ia({className:e,hidden:t}){let n=A(),o=B(pb),r=Y(),{t:a}=_(),[i,l]=Ye.useState(false),c=Ye.useRef(null),s=Ye.useRef(null),d=Ye.useRef(null);Ye.useEffect(()=>{if(!i)return;let h=d.current?.querySelectorAll('[role="menuitemradio"]');(d.current?.querySelector('[aria-checked="true"]')??h?.[0]??void 0)?.focus();},[i]);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(!i)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);}},[i]);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,a),f=Ye.useMemo(()=>ul.find(h=>h.mode===o)??ul[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":i,"aria-label":r(b?.labelKey??"editingMode.label"),disabled:!g.enabled,...p?{title:p}:{},onMouseDown:O,onClick:()=>l(h=>!h),children:[pl(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"})]}),i?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:ul.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:[pl(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?pl(mb):null})]},h.mode))}):null]})}ia.docxSlot="review.editingMode";function pl(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 Ao(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 sa({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:a}){if(!n)return t;let i=new Map,l=[];for(let u of Ye.Children.toArray(t)){let m=r(u);m?i.set(m,u):l.push(u);}let c=e.map((u,m)=>{let g=o(u,m),p=i.get(g);return p?jsxRuntime.jsx(Ye.Fragment,{children:p},g):jsxRuntime.jsx(Ye.Fragment,{children:a(u,m)},g)}),s=new Set(e.map(o)),d=[...i.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 hb=["zoom","script","format","list","alignment","styles","font","text","history"],fl=new Set(["review"]),gl=24,Pd=new Set;function Ed(e,t=hb){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Cd(e,t){let{widths:n,groups:o,order:r,fixed:a,more:i}=e,l=a;for(let s of o)l+=n.get(s)??0;if(l<=t)return Pd;l+=i;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 wd(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 Md=wd;function Rd(e){if(!(e.available>0))return Pd;let t=Cd(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Cd(e,e.available-(e.hysteresis));return wd(o,n)?n:o}function Id(e,t,n,o){return e+t+n+o*2}function kd(e,t){return e+t}function hl(e,t){return e+t}function _d(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 bl(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Dd(e){return bl(e.columnGap)}function Nd(e,t){return e.clientWidth-bl(t.paddingLeft)-bl(t.paddingRight)}var Rn="data-toolbar-group",In="data-toolbar-fixed",yl="data-toolbar-more",Tb=34,vl=new Set;function Hd(e,t,n){let o=Ye.useRef(null),r=Ye.useRef(new Map),a=Ye.useRef(Tb),[i,l]=Ye.useState(vl),c=Ye.useRef(i);c.current=i;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=Dd(g),f=Nd(m,g),b=m.querySelector(".docx-toolbar__separator"),h=p*2;if(b){let y=getComputedStyle(b),T=_d(y);h=Id(b.offsetWidth,T.start,T.end,p);}for(let y of m.querySelectorAll(`[${Rn}]`)){let T=y.getAttribute(Rn);T&&y.offsetWidth>0&&r.current.set(T,kd(y.offsetWidth,h));}let P=0;for(let y of m.querySelectorAll(`[${In}]`))y.offsetWidth>0&&(P+=hl(y.offsetWidth,p));let x=m.querySelector(`[${yl}]`);x&&x.offsetWidth>0&&(a.current=hl(x.offsetWidth,p));let C={available:f,widths:r.current,groups:s.current.groups,order:s.current.order,fixed:P,more:a.current,previous:c.current,hysteresis:gl},v=Rd(C);Md(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=vl,l(vl));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(`[${Rn}], [${In}]`))p.observe(f);return ()=>{g!==0&&cancelAnimationFrame(g),p.disconnect();}},[e,d,i]),{attach:u,overflow:i}}var Ib=["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"],Ad=Ye.createContext({close:()=>{}});function kb(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function Od({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 Zd({slot:e}){let t=Y(),{close:n}=Ye.useContext(Ad),{execute:o,isActive:r,isEnabled:a,disabledReason:i}=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:!a,...i?{title:i}:{},...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 Bd({sections:e,className:t}){let n=Y(),[o,r]=Ye.useState(false),a=Ye.useRef(null),i=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&&i.current?.focus();},[]),m=Ye.useMemo(()=>({close:u}),[u]);Ye.useEffect(()=>{if(!o)return;let p=f=>{let b=f.target;b instanceof Node&&a.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&&kb(p);},[o]);let g=p=>{p.key!=="Escape"||p.defaultPrevented||(p.preventDefault(),u(true));};return jsxRuntime.jsxs("div",{ref:a,className:`docx-toolbar__more${t?` ${t}`:""}`,[yl]:"",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?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(Ib)}),o?jsxRuntime.jsx(Ad.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 Hb(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function kn(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,Hb),a=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]),i=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"?a:i}var Tl=[{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 pa({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:l,isEnabled:c,disabledReason:s}=kn("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(()=>Tl.find(y=>y.value===l)??Tl[0],[l]),h=X("image.wrap"),P=a(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),i(y);},[i]);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:Tl.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]})}pa.docxSlot="image.wrap";var _n=Object.assign(pa,{docxSlot:"image.wrap"});function ma({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),a=Y(),{execute:i,value:l,isEnabled:c,disabledReason:s}=kn("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(()=>{i(m),u(false);},[m,i]);if(t)return null;let P=X("image.altText"),x=a(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]})}ma.docxSlot="image.altText";var Dn=Object.assign(ma,{docxSlot:"image.altText"});var Gd=e=>e.image;function Ud(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 Yb(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function wl(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(_t(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(_t(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(_t(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(_t(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function Xb(e,t){let n=wl(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function fa(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=bn(t);return Number.isInteger(n)?n:null}function Qb(e,t){let n=wl(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,u=s?fa(e.horizontalPoints):t.position?.horizontalEmu,m=d?fa(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,a=e.relativeToH!==n.relativeToH,i=e.relativeToV!==n.relativeToV,l=o?fa(e.horizontalPoints):t.position?.horizontalEmu,c=r?fa(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}:{},...a||o||r?{relativeToH:e.relativeToH}:{},...i||o||r?{relativeToV:e.relativeToV}:{}}}}function ga(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function ba(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Ml({open:e,onClose:t,className:n,triggerRef:o}){let r=A(),{t:a}=_(),i=B(Gd),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(!i)return;if(u.current=i,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=wl(i),I=i.crop;f({widthPoints:String(_t(i.widthEmu)),heightPoints:String(_t(i.heightEmu)),cropLeft:String(I.left),cropTop:String(I.top),cropRight:String(I.right),cropBottom:String(I.bottom),title:i.title,description:i.description,hyperlink:i.hyperlink??"",wrap:i.wrap,lockAspect:i.locks.changeAspect,...R});},[e,i?.id,i?.widthEmu,i?.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=Ud(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=Ud(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??i;return !R||R.widthEmu<=0?1:R.widthEmu/R.heightEmu},[i,P]),F=Ye.useCallback(R=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:R};let z=ba(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=ba(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)});},[i]),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=ba(p.widthPoints),G=ba(p.heightPoints);if(Pe===null||G===null){h("imageProperties.errors.invalidDimensions");return}let q=bn(Pe),Ee=bn(G);q!==R.widthEmu&&(Z.widthEmu=q),Ee!==R.heightEmu&&(Z.heightEmu=Ee);}if(R.canCrop&&!x){let Pe=ga(p.cropLeft),G=ga(p.cropTop),q=ga(p.cropRight),Ee=ga(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&&Xb(p,R)){let Pe=Qb(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(),Yb(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:a("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[b?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:a(b)}):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:p.widthPoints,disabled:C,onChange:R=>F(R.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:p.heightPoints,disabled:C,onChange:R=>H(R.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:p.lockAspect,disabled:v,onChange:R=>f(I=>I&&{...I,lockAspect:R.target.checked})}),a("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:x||!P?.intrinsic,onClick:k,children:a("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.position")}),T?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:[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:a("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:a(`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:a("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:a(`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:a("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: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:p.verticalPoints,onChange:R=>f(I=>I&&{...I,verticalPoints:R.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: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:a("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: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:s,children:a("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: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: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:a(`imageWrap.targets.${R}`)},R))})]}),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: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:a("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:a("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:a("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:a("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:E,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:L,children:a("common.apply")})]})]})})}function ha({className:e,hidden:t,asChild:n,children:o}){let r=A(),{t:a}=_(),i=B(Gd),[l,c]=Ye.useState(false),s=Ye.useRef(null),d={type:"setImageProperties",description:"probe"},u=r&&i?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":a("formattingBar.imagePropertiesShortcut"),title:g??a("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(Ml,{open:l,onClose:()=>c(false),triggerRef:s})]})}ha.docxSlot="image.properties";var Bo=Object.assign(ha,{docxSlot:"image.properties"});function we(e){return Object.assign(n=>jsxRuntime.jsx(Qt,{slot:e,...n}),{docxSlot:e})}var jd=we("history.undo"),Yd=we("history.redo"),Xd=we("text.bold"),Qd=we("text.italic"),Jd=we("text.underline"),eu=we("text.strike"),tu=we("format.clear"),ou=we("script.super"),nu=we("script.sub"),ru=we("alignment.left"),au=we("alignment.center"),iu=we("alignment.right"),lu=we("alignment.justify"),su=we("list.bullet"),cu=we("list.numbered"),du=we("list.outdent"),uu=we("list.indent");var pu=we("table.insert"),mu=we("review.comments");function oh({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=A(),{openAtCaret:i}=Xi(),l=editor.chromeProbeForSlot("text.link"),c=a&&l?a.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:()=>i()};return o?jsxRuntime.jsx(W,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??te(g?.paths)})}var Rl=Object.assign(oh,{docxSlot:"text.link"});function nh({className:e,hidden:t}){let n=A(),{onSave:o}=Ye.useContext(Xt),r=Y();if(t)return null;let a=X("file.save"),i=r(a?.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":i,title:i,onMouseDown:O,onClick:()=>o?.(),children:te(a?.paths)})}var Il=Object.assign(nh,{docxSlot:"file.save"});function qo({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function Ko(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var ih=e=>({zoom:e.zoom,mode:e.zoomMode}),lh=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,gu={type:"fixed"};function kl(){let e=A(),{zoom:t,mode:n}=B(ih,lh),o=Ye.useCallback(a=>{e?.setZoom(a);},[e]),r=Ye.useCallback(a=>{e?.setZoomMode(a);},[e]);return Ye.useMemo(()=>{let a=n??gu,i=wn(t,"out"),l=wn(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(gu),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>i!==null&&o(i),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&i!==null,levels:na}},[e,t,n,o,r])}var Fn=2,An=3276,Hn=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],dh=e=>e.formatting?.fontSizePt??null;function vu(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function yu(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 Tu(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 uh(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<Fn||o>An?null:o}function ph({className:e,hidden:t}){let n=A(),o=B(dh),{isEnabled:r,disabledReason:a}=ne("font.size"),i=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(An,Math.max(Fn,Math.round(v*2))));},[g]),f=Ye.useCallback(v=>{c(false),d(null),m.current?.blur(),v&&mh(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=uh(s);v!==null&&g(v);};return jsxRuntime.jsxs("span",{ref:u,className:"docx-toolbar__font-size","data-slot":"font.size",title:a??void 0,children:[jsxRuntime.jsx(Tu,{className:e,groupLabel:i("fontSize.label"),decreaseLabel:i("fontSize.decrease"),increaseLabel:i("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":i("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"?yu(o,Hn,Fn/2):vu(o,Hn,An/2)));},onBlur:()=>{C(),d(null);}}),canDecrease:b&&Math.round(o*2)>Fn,canIncrease:b&&Math.round(o*2)<An,onDecrease:()=>p(yu(o??0,Hn,Fn/2)),onIncrease:()=>p(vu(o??0,Hn,An/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":i("fontSize.listLabel"),children:Hn.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 mh(e){(Ko(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Nl=Object.assign(ph,{docxSlot:"font.size"});function fh({className:e,hidden:t}){let n=A(),{zoom:o,isFit:r,mode:a,setZoom:i,setMode:l,zoomIn:c,zoomOut:s,canZoomIn:d,canZoomOut:u,levels:m}=kl(),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),i(y);},[i]),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(a,editor.AUTO_ZOOM_MODE),v=editor.sameZoomMode(a,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:b,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(Tu,{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 Ll=Object.assign(fh,{docxSlot:"zoom.level"});var yh=[1,1.15,1.5,2,2.5,3],Cu=10,xh=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Th=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Sh({className:e,hidden:t}){let n=A(),o=B(xh,Th),{isEnabled:r,disabledReason:a}=ne("list.lineSpacing"),i=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":i("lineSpacing.label"),title:a??i("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:[yh.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:Cu),children:i(g?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>u("afterPt",p?null:Cu),children:i(p?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Fl=Object.assign(Sh,{docxSlot:"list.lineSpacing"});var Rh=[{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"}],Pu=[{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"],va=["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"],Lt=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 Ih(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?[Lt(50),Lt(35),Lt(25),Lt(15),Lt(5)]:n>=.8?[Qe(10),Qe(25),Qe(50),Qe(75),Qe(90)]:[Lt(80),Lt(60),Lt(40),Qe(25),Qe(50)]}var kh=/^[0-9A-Fa-f]{6}$/;function _h(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 Dh(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 ya({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":""}:{},...Dh(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function Nh({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Ih),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,l)=>jsxRuntime.jsx(ya,{value:i,css:`#${i.toLowerCase()}`,title:t(va[l]),selected:n===i,apply:e},`base-${l}`)),a.map(i=>o.map((l,c)=>{let s=r[c][i],d=_h(l,s.apply);return jsxRuntime.jsx(ya,{value:d,css:`#${d.toLowerCase()}`,title:`${t(va[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${i}-${c}`)}))]})]})}function Lh(e){let{apply:t,label:n,current:o}=e,[r,a]=Ye.useState(""),i=kh.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Nh,{...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:Rh.map(l=>jsxRuntime.jsx(ya,{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=>a(l.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:l=>{l.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 Ol({apply:e,current:t}){let n=A(),o=Y(),r=n?.getDocumentThemeColors()??[],a=r.length===va.length?r.map(l=>l.hex):Eu,i=t?.toUpperCase()??null;return jsxRuntime.jsx(Lh,{apply:e,label:o,current:i,themeHexes:a})}var Hh=Pu.filter(e=>e.value!=="white");function Fh({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:Hh.map(o=>jsxRuntime.jsx(ya,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function wu(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:a}=e,i=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(i){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===va.length?v.map(E=>E.hex):Eu;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)]}),a({apply:T,label:p,current:C,themeHexes:y})]}):null]})},{docxSlot:t})}var Ah=new Map(Pu.map(e=>[e.value,e.css])),Zl=wu({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Ol,{apply:e.apply,current:e.current})}),Bl=wu({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Ah.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Fh,{...e})});var Kh=["alignment.left","alignment.center","alignment.right","alignment.justify"];function zh({className:e,hidden:t}){let n=ne("alignment.left"),o=ne("alignment.center"),r=ne("alignment.right"),a=ne("alignment.justify"),i=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,a],u=Kh.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=i(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=i(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 xa=Object.assign(zh,{docxSlot:"alignment"});function Kl(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:a,onSelect:i,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?a??t:t,onMouseDown:u=>O(u),onClick:r?void 0:i};return l?jsxRuntime.jsx(W,{...d,children:s}):jsxRuntime.jsx("button",{...d,children:n??s})}var Xh=Object.freeze([]),Qh=e=>e.formatting?.fontFamily??null,Jh=e=>e;function Ta(){let e=A(),t=B(Qh),n=B(Jh),o=Ye.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():Xh,[e,n]),{isEnabled:r}=ne("font.family"),a=Ye.useCallback(i=>{if(!e)return;let l=editor.commandForSlotValue("font.family",i);l&&e.can(l).ok&&e.exec(l);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var Iu=Ye.createContext(null);function Vl(){return Ye.useContext(Iu)}function $l({asChild:e,className:t,children:n}){let o=Vl(),r=Y();if(!o)return null;let a=r(X("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},l=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(W,{...i,children:l}):jsxRuntime.jsx("button",{type:"button",...i,children:l})}$l.docxToolbarPart=true;var ev=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"]]),tv=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function ku({asChild:e,className:t,children:n}){let o=Vl(),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=tv.map(c=>({...c,fonts:o.options.filter(s=>(ev.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(_u,{value:d},d))]},c.category)),e?jsxRuntime.jsx(W,{...a,children:i}):jsxRuntime.jsx("div",{...a,children:i})}function _u({value:e,asChild:t,className:n,children:o}){let r=Vl();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}`:""}`},l=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(W,{...i,children:l}):jsxRuntime.jsxs("button",{type:"button",...i,children:[l,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function ov({hidden:e,asChild:t,className:n,children:o}){let r=Ta(),[a,i]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||i(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);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($l,{}),jsxRuntime.jsx(ku,{})]});return jsxRuntime.jsx(Iu.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Wl=Object.assign(ov,{docxSlot:"font.family",Trigger:$l,Content:ku,Item:_u});function uv(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 pv=Object.freeze([]),mv=e=>e.formatting?.styleId??null,fv=e=>e;function Sa(){let e=A(),t=B(mv),n=B(fv),o=Ye.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(i=>i.type==="paragraph").map(i=>({styleId:i.styleId,name:i.name,preview:i.preview})):pv,[e,n]),{isEnabled:r}=ne("styles.style"),a=Ye.useCallback(i=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",i);l&&e.can(l).ok&&e.exec(l);},[e]);return Ye.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var Du=Ye.createContext(null);function jl(){return Ye.useContext(Du)}function Yl({asChild:e,className:t,children:n}){let o=jl(),r=Y();if(!o)return null;let a=X("styles.style"),i=r(a?.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":i,title:i},c=o.options.find(d=>d.styleId===o.value),s=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,{...l,children:s}):jsxRuntime.jsx("button",{type:"button",...l,children:s})}Yl.docxToolbarPart=true;function Nu({asChild:e,className:t,children:n}){let o=jl();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(Lu,{value:i.styleId},i.styleId));return e?jsxRuntime.jsx(W,{...r,children:a}):jsxRuntime.jsx("div",{...r,children:a})}function Lu({value:e,asChild:t,className:n,children:o}){let r=jl();if(!r)return null;let a=r.value===e,i=r.options.find(s=>s.styleId===e),l={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?uv(i.preview):void 0,children:i?.name??e});return t?jsxRuntime.jsx(W,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function gv({hidden:e,asChild:t,className:n,children:o}){let r=Sa(),[a,i]=Ye.useState(false),l=Ye.useRef(null);Ye.useEffect(()=>{if(!a)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||i(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let c=Ye.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);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(Yl,{}),jsxRuntime.jsx(Nu,{})]});return jsxRuntime.jsx(Du.Provider,{value:c,children:t?jsxRuntime.jsx(W,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Xl=Object.assign(gv,{docxSlot:"styles.style",Trigger:Yl,Content:Nu,Item:Lu});function Fu(e,t){let n=e;return Object.assign(({className:r,hidden:a,icon:i,asChild:l,children:c})=>{let{isEnabled:s,disabledReason:d}=ne(n),u=ft(),m=t==="showAll"?u.showAll:u.formFill,g=Y();if(a)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:i??c??te(p?.paths)})},{docxSlot:n})}function hv({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=Be.inspector,{isEnabled:i,disabledReason:l}=ne(a),{inspectorOpen:c,openInspector:s}=ft(),d=Y();if(t)return null;let u=X(a),m=d(u?.labelKey??"contentControl.inspector"),g={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":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 vv({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:l}=ft(),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:!a,...a?{}:{"data-disabled":""},"aria-label":u,title:i??u,onMouseDown:O,onClick:()=>{l();}};return o?jsxRuntime.jsx(W,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??te(d?.paths)})}var Ca=Fu(Be.showAll,"showAll"),Pa=Fu(Be.formFill,"formFill"),Ea=Object.assign(vv,{docxSlot:Be.remove}),wa=Object.assign(hv,{docxSlot:Be.inspector}),Au={[Be.showAll]:Ca,[Be.formFill]:Pa,[Be.inspector]:wa,[Be.remove]:Ea};function Ql(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 Ev=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],es=Ye.createContext(null);function Vu(){let e=Ye.useContext(es);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Mv(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,l=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,s=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:a,selectionKey:l,cellSelectionKey:s,editable:t.editable,editingMode:t.editingMode??"editing"}}function Rv(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Iv(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Ku={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function kv(e,t){let n={};for(let o of Ev){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function ts({children:e}){let t=A(),[n,o]=Ye.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,a]=Ye.useState(Ku);Ye.useEffect(()=>(()=>{}),[]);let i=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:""}),[]),Rv,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=Ye.useCallback(()=>{if(!t){a(Ku);return}let m=Mv(t,t.snapshot());a(g=>Iv(g,m)?g:m);},[t]);Ye.useEffect(()=>{l();},[l,i]),Ql("selectionChange",Ye.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=Ye.useMemo(()=>t?kv(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(es.Provider,{value:u,children:e})}function _v(){let e=Ye.useContext(es);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function Ra(e){let t=_v(),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 Nv='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function ro(e){return [...e.querySelectorAll(Nv)].filter(t=>t.closest('[role="menu"]')===e)}function os(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function st(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 ct(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function Ia(e){(Ko(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function rs(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 ka({enabled:e,disabledReason:t,ariaLabel:n}){let{t:o}=_(),r=i18n.localizeDisabledReason(t,o),a=Ye.useId(),i=!e&&r?a:void 0;return {reasonId:a,shared:{type:"button",onMouseDown:O,"aria-label":n,...i?{"aria-describedby":i}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:i&&r?jsxRuntime.jsx("span",{id:a,className:"docx-editor-sr-only",children:r}):null}}var Fv='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function $u(e,t,n,o){Ye.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll(Fv)].filter(s=>s.closest('[role="menu"]')===r);queueMicrotask(()=>{let s=i();(s.find(u=>u.hasAttribute("data-selected")||u.hasAttribute("data-active"))??s[0])?.focus();});let c=s=>{let d=i();if(s.key==="Escape"){s.preventDefault(),t(false),a?.focus();return}if(s.key==="ArrowDown"){s.preventDefault(),st(d,document.activeElement,1);return}if(s.key==="ArrowUp"){s.preventDefault(),st(d,document.activeElement,-1);return}if(s.key==="Home"){s.preventDefault(),ct(d,"first");return}if(s.key==="End"){s.preventDefault(),ct(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 Wu(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 l=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),a?.focus();return}if(c.key==="Enter"||c.key===" "){let s=document.activeElement,d=i();s instanceof HTMLElement&&d.includes(s)&&(c.preventDefault(),s.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,n,o]);}function Xu(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function zv(e){return te(editor.tableChromeIconPaths(e))}function Qu(){return Ye.createContext(null)}function Et(e){let t=Ye.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function is(e,t,n){let o=Qu();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:u,enabled:m,disabledReason:g,draft:p,apply:f}=Ra(e),[b,h]=Ye.useState(false),P=Ye.useRef(null),x=Ye.useRef(null);rs(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(a,{}),jsxRuntime.jsx(i,{})]});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 a({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,disabledReason:g,triggerRef:p}=Et(o),f=Y(),b=X(e),h=f(b?.labelKey??n),{shared:P,reasonNode:x}=ka({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:Xu(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]})}a.docxToolbarPart=true;function i({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,triggerRef:g}=Et(o),p=Y(),f=Ye.useRef(null);if($u(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:a,Content:i,Ctx:o}}var qn=is("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function Ju({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Et(qn.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===i.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:()=>{a(false),r(c.value);}},u=o??zv(c.icon);return t?jsxRuntime.jsx(W,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function ep(e){let{children:t}=e;return jsxRuntime.jsx(qn.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(Ju,{value:n.value},n.value))})})}function Vv(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qn.Trigger,{}),jsxRuntime.jsx(ep,{})]});return jsxRuntime.jsx(qn.Root,{...e,children:n})}var Wn=Object.assign(Vv,{docxSlot:"table.borderTarget",Trigger:qn.Trigger,Content:ep,Item:Ju}),Kn=is("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function tp({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Et(Kn.Ctx),l=Y(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value===i.spec.style,d={type:"button",role:"menuitemradio","aria-checked":s,...s?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(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 op(e){let{children:t}=e;return jsxRuntime.jsx(Kn.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(tp,{value:n.value},n.value))})}function $v(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kn.Trigger,{}),jsxRuntime.jsx(op,{})]});return jsxRuntime.jsx(Kn.Root,{...e,children:t})}var Un=Object.assign($v,{docxSlot:"table.borderStyle",Trigger:Kn.Trigger,Content:op,Item:tp}),zn=is("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function np({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Et(zn.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===i.spec.size,u={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{a(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 rp(e){let{children:t}=e;return jsxRuntime.jsx(zn.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(np,{value:String(n.size)},n.size))})}function Wv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(zn.Trigger,{}),jsxRuntime.jsx(rp,{})]});return jsxRuntime.jsx(zn.Root,{...e,children:t})}var Gn=Object.assign(Wv,{docxSlot:"table.borderWidth",Trigger:zn.Trigger,Content:rp,Item:np});function ap(e,t,n){let o=n?.defaultHex??"FF0000",r=Qu();function a({hidden:d,asChild:u,className:m,children:g}){let{visible:p,enabled:f,disabledReason:b,draft:h,apply:P}=Ra(e),[x,C]=Ye.useState(false),[v,y]=Ye.useState(o),T=Ye.useRef(null),M=Ye.useRef(null);rs(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(i,{}),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 i({asChild:d,className:u,children:m}){let{enabled:g,disabledReason:p,apply:f,draft:b,lastHex:h}=Et(r),P=Y(),x=X(e),C=P(x?.labelKey??t),{shared:v,reasonNode:y}=ka({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]})}i.docxToolbarPart=true;function l({asChild:d,className:u,children:m}){let{open:g,setOpen:p,enabled:f,disabledReason:b,triggerRef:h}=Et(r),P=Y(),x=X(e),C=P(x?.labelKey??t),{shared:v,reasonNode:y}=ka({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:Xu(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}=Et(r),y=Y(),T=Ye.useRef(null);if(Wu(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),Ia(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(Ol,{apply:F=>{f(false),v?.(F),h({kind:"hex",value:F}),Ia(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}=Et(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}),Ia(x.current);}};return g?jsxRuntime.jsx(W,{...T,children:f}):jsxRuntime.jsx("button",{...T,children:f})}return {Root:a,Main:i,Trigger:l,Content:c,Item:s,Ctx:r}}var Vn=ap("table.borderColor","table.borderColor",{defaultHex:"000000"});function Uv(e){return jsxRuntime.jsx(Vn.Content,{...e,clearFill:false})}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.borderColor",Trigger:Vn.Trigger,Content:Uv,Item:Gv,Main:Vn.Main}),$n=ap("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function Yv(e){return jsxRuntime.jsx($n.Content,{...e,clearFill:true})}function Xv(e){return jsxRuntime.jsx($n.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function Qv(e){return jsxRuntime.jsx($n.Root,{...e})}var Yn=Object.assign(Qv,{docxSlot:"table.cellFill",Trigger:$n.Trigger,Content:Yv,Item:Xv,Main:$n.Main});function ip({overrides:e=new Map}){return Vu()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qo,{}),[Wn,jn,Un,Gn,Yn].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 lp(){let e=Y(),{draft:t}=Ra("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var up=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],pp={"zoom.level":Ll,"styles.style":Xl,"font.family":Wl,"font.size":Nl,"text.color":Zl,"text.highlight":Bl,"text.link":Rl,"list.lineSpacing":Fl,"review.editingMode":ia,"file.save":Il,...Au,"table.borderTarget":Wn,"table.borderColor":jn,"table.borderStyle":Un,"table.borderWidth":Gn,"table.cellFill":Yn,"image.insert":hn,"image.properties":Bo,"image.wrap":_n,"image.altText":Dn},cp=new Map;function ty(e){let t=cp.get(e);return t||(t=n=>jsxRuntime.jsx(Qt,{slot:e,...n}),cp.set(e,t)),t}function oy(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:xa}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:pp[o]??ty(o)}})})}var ny=e=>e.image;function ry(e){return e==="alignment"||e in pp}function cs(e){let t=Ao(e,cs);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 ls(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(ls);let t=cs(e);return t!=null&&up.includes(t)?true:Ye.isValidElement(e)?Ye.Children.toArray(e.props.children).some(ls):false}function ay(e,t){return t?true:Ye.Children.toArray(e).some(ls)}function iy(e){let t=je(),{className:n,t:o,onSave:r,preset:a=true,overflow:i=true,children:l}=e,c=Ye.useMemo(()=>({t:o,onSave:r}),[o,r]),s=Kr(o),d=B(ny),u=Ye.useMemo(()=>oy(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=>!fl.has(x)),[u]),p=Ye.useMemo(()=>Ed(g),[g]),f=a&&i,{attach:b,overflow:h}=Hd(f,g,p),P;if(!a)P=l;else {let x=Ye.Children.toArray(l),C=new Map,v=new Map,y=[];for(let D of x){let F=cs(D);F&&m.has(F)?C.set(F,D):F&&up.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=sy(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(qo,{},`separator-${D.id}`)),E+=1;let F=fl.has(D.id);M.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...F?{[In]:""}:{[Rn]: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(ip,{overrides:v}),y.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[In]:"",children:y}):null,w.length>0?jsxRuntime.jsx(Bd,{sections:w}):null]});}return jsxRuntime.jsx(Xt.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:ay(l,a)?jsxRuntime.jsx(ts,{children:P}):P})})}function ly(e){return e?!!e.props.hidden:false}function sy(e,t,n,o,r){let a=t.get(e.slot);return ly(a)?null:a||ry(e.slot)?jsxRuntime.jsx(Od,{label:cy(n,e,o),children:r(e)}):jsxRuntime.jsx(Zd,{slot:e.slot})}function cy(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Qn=Object.assign(iy,{Button:Qt,Action:Kl,Separator:qo,Undo:jd,Redo:Yd,Bold:Xd,Italic:Qd,Underline:Jd,Strike:eu,Link:Rl,ClearFormatting:tu,Superscript:ou,Subscript:nu,Alignment:xa,AlignLeft:ru,AlignCenter:au,AlignRight:iu,AlignJustify:lu,LineSpacing:Fl,BulletList:su,NumberedList:cu,Outdent:du,Indent:uu,ImageInsert:hn,ImageProperties:Bo,ImageWrap:_n,ImageAltText:Dn,TableInsert:pu,TableBorderTarget:Wn,TableBorderColor:jn,TableBorderStyle:Un,TableBorderWidth:Gn,TableCellFill:Yn,Comments:mu,FontFamily:Wl,FontSize:Nl,FontColor:Zl,Highlight:Bl,Zoom:Ll,StylePicker:Xl,EditingMode:ia,Save:Il,ContentControlShowAll:Ca,ContentControlFormFill:Pa,ContentControlInspector:wa,ContentControlRemove:Ea});var my=e=>e.pageSetup??null,fy=e=>e.editable;function ao(){let e=A(),t=B(my),n=B(fy),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 us=[{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}],xp=1440,gy=e=>Math.round(e/xp*100)/100,by=e=>Math.round(e*xp);function hy(e,t){let n=Math.min(e,t),o=Math.max(e,t);return us.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var vy={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},yy={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},xy={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},Ty={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},bp={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},_a={display:"flex",alignItems:"center",gap:12},Da={width:80,fontSize:13,color:"var(--doc-text-muted)"},Na={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Sy={fontSize:11,color:"var(--doc-text-muted)",width:16},Cy={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},hp={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},vp=12240,yp=15840,Ft=1440;function Jn({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:a,apply:i}=ao(),[l,c]=Ye.useState(vp),[s,d]=Ye.useState(yp),[u,m]=Ye.useState("portrait"),[g,p]=Ye.useState(Ft),[f,b]=Ye.useState(Ft),[h,P]=Ye.useState(Ft),[x,C]=Ye.useState(Ft),[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??vp),d(r?.pageHeightTwips??yp),m(r?.orientation??"portrait"),p(r?.marginsTwips.top??Ft),b(r?.marginsTwips.bottom??Ft),P(r?.marginsTwips.left??Ft),C(r?.marginsTwips.right??Ft),y("document"),M.current=r===null?"loading":"yes");},[e,r]),Ye.useEffect(()=>{e&&T.current?.focus();},[e]);let w=Ye.useCallback(k=>{let L=us[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(()=>{i({pageWidthTwips:l,pageHeightTwips:s,orientation:u,marginTopTwips:g,marginRightTwips:x,marginBottomTwips:f,marginLeftTwips:h,scope:v})&&t();},[i,l,s,u,g,x,f,h,v,t]);if(!e)return null;let F=hy(l,s),H=(k,L,R)=>jsxRuntime.jsxs("div",{style:_a,children:[jsxRuntime.jsx("label",{style:Da,children:o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("input",{type:"number",style:Na,min:0,max:22,step:.1,value:gy(L),onChange:I=>R(Math.max(0,by(Number(I.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("span",{style:Sy,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:vy,onClick:t,onKeyDown:k=>{k.key==="Escape"&&t(),k.key==="Enter"&&D();},children:jsxRuntime.jsxs("div",{ref:T,tabIndex:-1,style:yy,onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:xy,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:Ty,children:[jsxRuntime.jsx("div",{style:bp,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:_a,children:[jsxRuntime.jsx("label",{style:Da,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:Na,value:F,onChange:k=>w(Number(k.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[us.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:_a,children:[jsxRuntime.jsx("label",{style:Da,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:Na,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:{...bp,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:_a,children:[jsxRuntime.jsx("label",{style:Da,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:Na,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:Cy,children:[jsxRuntime.jsx("button",{type:"button",style:hp,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...hp,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:a?1:.5},disabled:!a,onClick:D,children:o("common.apply")})]})]})})}var er=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(er)}function _e(){let{t:e}=Je(),{t}=_();return n=>e?.(n)??t(n)}var wy=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,My=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Tp=new TextEncoder;function Ry(e,t){if(Tp.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let a=Tp.encode(r).length;if(n+a>t)break;n+=a,o+=r;}return o}function Sp(e){let t=Ry((e??"").replace(/\.docx$/i,"").replace(My," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||wy.test(t)?"document.docx":`${t}.docx`}function Cp(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 Iy="https://github.com/eigenpal/docx-editor/issues/new";function ky(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Pp(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??ky()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
|
|
2
|
-
`),a=new URLSearchParams({title:"[Bug] ",body:r});return `${Iy}?${a.toString()}`}function tr(e){typeof window>"u"||window.open(Pp(e),"_blank","noopener,noreferrer");}var ps=6,wp=6;function Ne(e){let{icon:t,shortcut:n,disabled:o,title:r,active:a,selected:i,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:a===void 0?"menuitem":i===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${s?` ${s}`:""}`,tabIndex:-1,...l?{"data-slot":l}:{},...a?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...a!==void 0?{"aria-checked":a}:{},...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 nr({label:e,labelKey:t,className:n,hidden:o,children:r}){let a=_e();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 wt({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:a,isActive:i,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:i}:{},...f?{selected:true}:{},onSelect:()=>{a(),s(null);},...o?{className:o}:{},children:m})}wt.docxMenuRow=true;function Mp(e,t,n,o){return Object.assign(({className:a,hidden:i})=>{let l=Je(),c=_e(),s=o(l);if(i)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);},...a?{className:a}:{},children:u})},{docxSlot:e})}var fs=Mp("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),gs=Mp("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function Fy({className:e,hidden:t}){let n=A(),o=Je(),r=_e(),a=editor.chromeProbeForSlot("file.pageSetup"),i=n&&a?n.can(a):null,l=i?.ok===true,c=i&&!i.ok?i.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 bs=Object.assign(Fy,{docxSlot:"file.pageSetup"});function Ay({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=Vr(),a=Je(),i=_e();if(t)return null;let l=X("image.insert"),c=i(l?.labelKey??"toolbar.image");return jsxRuntime.jsx(Ne,{slot:"image.insert",icon:te(l?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),a.setOpenMenu(null);},...e?{className:e}:{},children:c})}var Oy=Object.assign(Ay,{docxSlot:"image.insert"}),or=8;function lo({labelKey:e,paths:t,className:n,children:o}){let r=_e(),[a,i]=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(!a){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-or;m({left:x?Math.max(or,b.left-h):Math.min(b.right,f.innerWidth-h-or),top:Math.max(or,Math.min(b.top-4,f.innerHeight-P-or))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onKeyDown:g=>{g.key==="ArrowRight"&&document.activeElement===l.current?(g.preventDefault(),i(true),queueMicrotask(()=>{c.current&&ct(ro(c.current),"first");})):(g.key==="ArrowLeft"||g.key==="Escape")&&a&&(g.preventDefault(),g.stopPropagation(),i(false),l.current?.focus());},onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||i(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?s: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: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=ro(p);g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),st(f,document.activeElement,1)):g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),st(f,document.activeElement,-1));},children:o}):null]})}function Ha({slot:e="table.insert",className:t}){let n=A(),{isEnabled:o}=ne(e),{setOpenMenu:r}=Je(),a=_e(),[i,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(wp,Math.max(1,f.rows+(p.rows??0))),cols:Math.min(ps,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<=wp;p+=1){let f=[];for(let b=1;b<=ps;b+=1){let h=!!i&&p<=i.rows&&b<=i.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":a("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:ps});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:i?`${i.cols} \xD7 ${i.rows}`:""})]})}function Zy({entry:e}){let{isEnabled:t}=ne(e.slot),n=X(e.slot);return t?jsxRuntime.jsx(lo,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(Ha,{slot:e.slot})}):jsxRuntime.jsx(wt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function so({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function rr({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(so,{}):e.kind==="submenu"?jsxRuntime.jsx(lo,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(rr,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(fs,{}):e.slot==="file.save"?jsxRuntime.jsx(gs,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(bs,{}):e.slot==="image.insert"?jsxRuntime.jsx(Oy,{}):e.picker==="tableGrid"?jsxRuntime.jsx(Zy,{entry:e}):jsxRuntime.jsx(wt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function Rp(e){if(!Ye.isValidElement(e))return null;let t=Ao(e,Rp);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 By(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function qy(e,t,n){return sa({entries:e??[],children:t,preset:n,keyOfEntry:By,keyOfChild:Rp,renderEntry:o=>jsxRuntime.jsx(rr,{entry:o})})}function $o({id:e,labelKey:t,label:n,icon:o,className:r,hidden:a,preset:i=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(a)return null;let x=n??u(t??h?.labelKey??e),C=qy(h?.entries,l,i),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,ct(ro(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=ro(T),w=document.activeElement;y.key==="ArrowDown"?(y.preventDefault(),st(M,w,1)):y.key==="ArrowUp"?(y.preventDefault(),st(M,w,-1)):y.key==="Home"?(y.preventDefault(),ct(M,"first")):y.key==="End"?(y.preventDefault(),ct(M,"last")):y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),v()):y.key==="Tab"&&s(null);},children:C}):null]})}function hs(e){return Object.assign(n=>jsxRuntime.jsx($o,{id:e,...n}),{docxMenu:e})}var vs=hs("file"),ys=hs("format"),xs=hs("insert");function Ky({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:a}=Je(),i=_e();if(t||a===false)return null;let l=n??r??tr;return jsxRuntime.jsx(Ne,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:i("toolbar.reportIssue")})}var Fa=Object.assign(Ky,{docxSlot:"help.reportIssue"});function zy({children:e,...t}){let{reportIssue:n}=Je();return e===void 0&&n===false?null:jsxRuntime.jsxs($o,{id:"help",...t,children:[jsxRuntime.jsx(Fa,{}),e]})}var Ts=Object.assign(zy,{docxMenu:"help"});var Wy={file:vs,format:ys,insert:xs,help:Ts},Uy=new Set(editor.CHROME_MENUS.map(e=>e.id));function Hp(e){if(!Ye.isValidElement(e))return null;if(e.type===Ye.Fragment){let o=Ye.Children.toArray(e.props.children).map(Hp).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===$o){let n=e.props.id;if(typeof n=="string"&&Uy.has(n))return n}return null}function Gy(e){let t=je(),{className:n,t:o,fileName:r,onOpen:a,onOpenFile:i,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=>Cp(z,Sp(r??h??void 0))).catch(z=>{console.error("[docx-editor] save failed",z);});},[g,r,h]),F=Ye.useCallback(()=>y(true),[]),H=g?a??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=Ko(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=Hp(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=Wy[V.id];return jsxRuntime.jsx(Re,{},V.id)}),Z]});}return jsxRuntime.jsxs(er.Provider,{value:R,children:[jsxRuntime.jsx("div",{ref:z=>{if(T.current=z,z&&x===null){let Z=os(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=os(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),i?.(Z),Z.arrayBuffer().then(V=>g.load(new Uint8Array(V))).catch(V=>{console.error("[docx-editor] could not open the file",V);}));}}),jsxRuntime.jsx(Jn,{open:v,onClose:()=>y(false)})]})}var ir=Object.assign(Gy,{Menu:$o,File:vs,Format:ys,Insert:xs,Help:Ts,Item:wt,Row:Ne,Group:nr,Separator:so,Submenu:lo,TableGrid:Ha,Entry:rr,Open:fs,Save:gs,PageSetup:bs,ReportIssue:Fa});var Jy=12240,Op=1440,qp=1440,Kp=567,co=20,Cs=6,ex=co+Cs+2,tx="var(--doc-text-muted)",ox="var(--doc-text-subtle)",Zp="var(--doc-shadow-subtle)",nx="var(--doc-primary)",rx="var(--doc-primary-hover)",ax="var(--doc-text-subtle)",sr=5,lr=7,ix={left:0,right:0,firstLine:0};function Bp(e,t){return t==="inch"?(e/qp).toFixed(2)+'"':(e/Kp).toFixed(1)+" cm"}function lx(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function uo({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:a,showIndentHandles:i=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??Jy,D=e?.marginsTwips.left??Op,F=e?.marginsTwips.right??Op,H=e?.gutterTwips??0,k={pageWidth:E,leftMargin:D,rightMargin:F},L=l??ix,R=xe(E)*t,I=xe(D)*t,z=xe(F)*t,Z=Ye.useCallback(q=>{let Ee=w.current?.getBoundingClientRect();return Ee?ta((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 mn=E-F-H-720,_o=Math.round(Math.max(0,Math.min(ce,mn)));y(_o),o?.(_o);}else {let mn=E-ce,_o=E-D-H-720,Zr=Math.round(Math.max(0,Math.min(mn,_o)));y(Zr),r?.(Zr);}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"?a?.():d?.(),P(null),y(null),M(null);},[a,d]),Re=Ye.useCallback((q,Ee,Ue)=>{let ce=editor.handlePosition(q,L,k),Ge=editor.dragIndent(q,ce+Ee*lx(u,Ue),L,k,{unit:u,precise:true});s?.(Ge),d?.();},[L,k,u,s,d]),se=mx(E,t,u),Se=i&&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:Bp(Ue,u),pageWidthTwips:E});return jsxRuntime.jsxs("div",{ref:w,className:`docx-horizontal-ruler ${m}`,style:{position:"relative",width:qe(R),height:ex,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:co,backgroundColor:Zp,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:co,backgroundColor:Zp,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:co,pointerEvents:"none"},children:se.map((q,Ee)=>jsxRuntime.jsx(sx,{tick:q},Ee))}),p?.map(q=>jsxRuntime.jsx(px,{tabMark:q,positionPx:xe(q.position)*t,onDoubleClick:()=>f?.(q.position)},q.position)),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ss,{direction:"down",anchor:"top",...G("firstLine","ruler.firstLineIndent",L.firstLine)}),jsxRuntime.jsx(Ss,{direction:"up",anchor:"strip",...G("hanging","ruler.hangingIndent",L.left)}),jsxRuntime.jsx(cx,{...G("left","ruler.leftIndent",L.left)}),jsxRuntime.jsx(Ss,{direction:"up",anchor:"strip",...G("right","ruler.rightIndent",L.right)})]}),h&&v!==null&&T!==null&&jsxRuntime.jsx(dx,{value:Bp(v,u),positionPx:T})]})}function sx({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:ox}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:tx,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function zp(e){return e.editable?e.isDragging||e.isHovered?rx:nx:ax}function Vp(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 $p(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 Ss({direction:e,anchor:t,...n}){let o=zp(n),r=t==="top"?{top:0,height:lr+1}:{top:co-lr,height:lr};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Vp(n,sr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...$p(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${sr}px solid transparent`,borderRight:`${sr}px solid transparent`,...e==="down"?{top:0,borderTop:`${lr}px solid ${o}`}:{bottom:0,borderBottom:`${lr}px solid ${o}`},transition:"border-color 0.1s"}})})}function cx(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Vp(e,sr*2,{top:co+1,height:Cs}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...$p(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:sr*2-2,height:Cs,backgroundColor:zp(e),borderRadius:1,transition:"background-color 0.1s"}})})}function dx({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 ux={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function px({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(t-5),top:co-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:ux[e.alignment]||"L"})}function mx(e,t,n){let o=[];if(n==="inch"){let r=qp/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=xe(l)*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=Kp/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=xe(l)*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 bx=15840,Gp=1440,hx=1440,vx=567,Wo=20,yx="var(--doc-text-muted)",xx="var(--doc-text-subtle)",Tx="var(--doc-primary)",Sx="var(--doc-primary)",Cx="var(--doc-primary-hover)";function cr({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:a,unit:i="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??bx,b=e?.marginsTwips.top??Gp,h=e?.marginsTwips.bottom??Gp,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=ta(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&&a?.(),u(null);},[d,a]);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=Ex(f,t,i),w={position:"relative",width:Wo,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(Px,{tick:E},D))}),jsxRuntime.jsx(jp,{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(jp,{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 Px({tick:e}){let t={position:"absolute",top:qe(e.position),right:0,height:1,width:e.width,backgroundColor:xx},n={position:"absolute",top:qe(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:yx,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 jp({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:a,onMouseLeave:i,onMouseDown:l}){let{t:c}=_(),s=o?Cx:r?Sx:Tx,d={position:"absolute",top:qe(t-5),right:0,width:Wo,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:a,onMouseLeave:i,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 Ex(e,t,n){let o=[];if(n==="inch"){let r=hx/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=xe(l)*t;if(i%8===0){let s=i/8;o.push({position:c,width:10,label:s>0?String(s):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=vx/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=xe(l)*t;if(i%10===0){let s=i/10;o.push({position:c,width:10,label:s>0?String(s):void 0});}else i%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var po=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var Rx=e=>e.formatting?.indent??null,Ix=e=>e.editable;function ws(){let e=A(),t=B(Rx),n=B(Ix),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 em=e=>e.zoom;function tm(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function om(){let{apply:e}=ao(),[t,n]=Ye.useState({}),o=Ye.useRef({}),r=Ye.useCallback(i=>l=>{o.current={...o.current,[i]:Math.round(l)},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 Jp(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function _x(){let e=A(),{indent:t,isEnabled:n,apply:o}=ws(),[r,a]=Ye.useState(null),i=Ye.useRef(null),l=Ye.useRef(null),c=Ye.useCallback(u=>{l.current===null&&(l.current=Jp(e)),i.current=u,a(u);},[e]),s=Ye.useCallback(()=>{let u=i.current,m=l.current;i.current=null,l.current=null,a(null),u&&(m!==null&&m!==Jp(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 Dx(){let e=Ct(),[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 Ka(e){let t=B(po),{pageSetup:n,isEnabled:o}=ao(),r=B(em),{pending:a,preview:i,commit:l}=om(),c=_x(),s=oo(),d=Fo(),u=Dx();return t?null:jsxRuntime.jsx("div",{className:"docx-ruler-frame",style:{paddingInlineStart:s+d.inlineStart,paddingRight:d.inlineEnd},children:jsxRuntime.jsx(uo,{pageSetup:tm(n,a),zoom:r,editable:o,onLeftMarginChange:i("left"),onRightMarginChange:i("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 za(e){let t=B(po),{pageSetup:n,isEnabled:o}=ao(),r=B(em),{pending:a,preview:i,commit:l}=om(),c=oo(),s=Fo(),d=gd();return t||d!==null&&d>0&&n&&xe(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(cr,{pageSetup:tm(n,a),zoom:r,editable:o,onTopMarginChange:i("top"),onBottomMarginChange:i("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 Lx(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 Hx(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 Fx(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 Ax(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 Ox(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 Zx(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 Bx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function qx(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 Kx(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 zx(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 Vx(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 $x(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 Wx(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 Ux(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function Gx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function jx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function Yx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function ks(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 Xx(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 Qx(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 Jx(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 eT(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 tT(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 oT(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 nT(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 rT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function aT(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 iT(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 lT(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 sT(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 cT(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 nm(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function dT(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 uT(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 pT(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 mT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function fT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function gT(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 bT(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 hT(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 vT(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 yT(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 xT(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 TT(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 ST(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 CT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function PT(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 ET(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 wT(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 MT(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 RT(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 IT(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 kT(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 _T(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 DT(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 NT(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 LT(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 HT(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 FT(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 AT(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 OT(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 ZT(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 BT(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 qT(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 KT(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 zT(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 VT(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 $T(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 WT(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 UT(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 GT(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 jT(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 YT(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 XT(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 QT(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 JT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function eS(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 tS(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 oS(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 nS(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 rS(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 aS(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 iS(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 lS(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 sS(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 cS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function dS(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 uS(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 pS(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 mS(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 fS(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 gS(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 bS(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 hS(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 vS(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 yS(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 xS(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 TS(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 SS(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 CS(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 PS={undo:Lx,redo:Hx,print:Fx,file_download:Ax,file_upload:Ox,format_bold:Zx,format_italic:Bx,format_underlined:qx,strikethrough_s:Kx,superscript:zx,subscript:Vx,link:$x,format_clear:Wx,format_align_left:Ux,format_align_center:Gx,format_align_right:jx,format_align_justify:Yx,format_line_spacing:ks,format_list_bulleted:Xx,format_list_numbered:Qx,format_indent_increase:Jx,format_indent_decrease:eT,format_color_text:tT,ink_highlighter:oT,format_color_reset:nT,arrow_drop_down:rT,table:aT,table_chart:iT,grid_on:lT,table_rows:sT,view_column:cT,border_all:nm,select_all:nm,border_outer:dT,border_inner:uT,border_clear:pT,add:mT,remove:fT,delete:gT,delete_sweep:bT,call_merge:hT,call_split:vT,drag_indicator:yT,image:xT,format_image_left:TT,format_image_right:ST,horizontal_rule:CT,flip_to_back:PT,flip_to_front:ET,open_with:wT,tune:MT,rotate_right:RT,rotate_left:IT,swap_horiz:kT,swap_vert:_T,shapes:DT,format_paint:NT,expand_more:LT,expand_less:HT,border_top:FT,border_bottom:AT,border_left:OT,border_right:ZT,border_horizontal:BT,border_vertical:qT,padding:KT,text_rotation_none:zT,wrap_text:VT,height:$T,fit_width:WT,settings:UT,border_color:GT,format_color_fill:jT,vertical_align_top:YT,vertical_align_center:XT,vertical_align_bottom:QT,line_weight:JT,keyboard_arrow_up:eS,keyboard_arrow_down:tS,keyboard_arrow_left:oS,keyboard_arrow_right:nS,more_vert:rS,page_break:aS,branding_watermark:iS,arrow_back:lS,search:sS,toc:cS,done_all:dS,check_circle:uS,chat_bubble_outline:pS,chat_bubble_check:mS,check:fS,close:gS,add_comment:bS,comment:hS,edit_note:vS,rate_review:yS,visibility:xS,format_textdirection_l_to_r:TS,format_textdirection_r_to_l:SS,"agent-sparkle":CS};function K({name:e,size:t=20,className:n="",style:o}){let r=PS[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 dr=12,_s=240,am=16,IS=24,kS=dr+_s+am,Uo=12,_S=36,DS=Uo+_S+am,ur=Ye__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:a=0,leftOffset:i=dr}){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:i-a,bottom:0,width:_s,paddingTop:IS,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${i+_s}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 HS=e=>e,FS=Object.freeze([]),AS=()=>{};function Ds(e){let t=A(),n=B(HS),o=Ye.useMemo(()=>t&&!n.isLoading?t.getOutline():FS,[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 po(n)?null:jsxRuntime.jsx(ur,{headings:o,onHeadingClick:r,onClose:e.onClose??AS,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Ns=Ye.createContext(null);function Zt(e){let t=Ye.useContext(Ns);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Go=280,Va=32,im=16;function fo(e=280){return 32+e+16}function $a({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,inlineStartReservation:r=0,docked:a=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 i=(e-o-t)/2,l=i>=n?0:!a&&n<=2*i?2*(n-i):n;return Math.ceil(Math.max(0,l-r))}var zS=Object.freeze([]),VS=e=>e;function Wa(){let e=A(),t=B(VS),[n,o]=Ye.useState(null),r=Ye.useMemo(()=>e&&!t.isLoading?e.getOutline():zS,[e,t]),a=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]),i=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:a,selectedBlockId:n,goTo:i,isEmpty:r.length===0}}var Fs=150,As=2e3,Hs=Object.freeze([]),US=e=>e;function Ua(){let e=A(),t=B(US),[n,o]=Ye.useState(""),[r,a]=Ye.useState(""),[i,l]=Ye.useState(false),[c,s]=Ye.useState(false),[d,u]=Ye.useState(Hs),[m,g]=Ye.useState(-1);Ye.useEffect(()=>{if(n===r)return;let y=setTimeout(()=>a(n),Fs);return ()=>clearTimeout(y)},[n,r]);let p=Ye.useMemo(()=>({matchCase:i,wholeWord:c}),[i,c]);Ye.useEffect(()=>{if(!e||r.length===0){u(Hs),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(""),a(""),u(Hs),g(-1);},[]);return {query:n,setQuery:C,matchCase:i,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=As,activeIndex:m,goTo:b,next:P,previous:x,clear:v,isPending:n!==r}}var JS=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)}},eC=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ga(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,a]=Ye.useState(t),[i,l]=Ye.useState(n),c=e.open??r,s=e.tab??i,{onOpenChange:d,onTabChange:u}=e,m=e.open!==void 0,g=e.tab!==void 0,p=Ye.useCallback(I=>{m||a(I),d?.(I);},[m,d]),f=Ye.useCallback(()=>p(!c),[c,p]),b=Ye.useCallback(I=>{g||l(I),u?.(I);},[g,u]),h=to(),P=Ct(),x=Ye.useContext(at),{pageSetup:C,zoom:v,reviewPaneOpen:y,fitting:T}=B(JS,eC),[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:$a({viewportWidth:M,pageWidthPx:xe(L)*v,reservation:fo(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?fo(o):0),()=>h.setReservation(0)},[h,c,o]),{open:c,setOpen:p,toggle:f,tab:s,setTab:b,paneWidth:o,shift:R}}var mr=["headings","find"],ht=(...e)=>e.filter(Boolean).join(" ");function fr({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(gr,{}),jsxRuntime.jsx(br,{})]})})}function gr({className:e,style:t,children:n}){let{pane:o,t:r}=Zt("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 br({className:e,style:t,children:n}){let{t:o}=Zt("Title");return jsxRuntime.jsx("h2",{className:ht("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function hr({className:e,style:t,children:n}){let{pane:o,t:r}=Zt("Tabs"),a=Ye.useCallback(i=>{let l=i.key==="ArrowRight"?1:i.key==="ArrowLeft"?-1:0;if(l===0)return;i.preventDefault();let c=mr.indexOf(o.tab);o.setTab(mr[(c+l+mr.length)%mr.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??mr.map(i=>jsxRuntime.jsx(vr,{value:i},i))})}function vr({value:e,className:t,style:n,children:o}){let{pane:r,t:a}=Zt("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 sm({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:l=>t(l.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 yr({className:e,style:t}){let{pane:n,outline:o,t:r}=Zt("Headings"),[a,i]=Ye.useState(""),l=B(po),c=Ye.useMemo(()=>{let d=a.trim().toLowerCase();return d.length===0?o.items:o.items.filter(u=>u.heading.text.toLowerCase().includes(d))},[o.items,a]),s=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:s,children:[jsxRuntime.jsx(sm,{value:a,onChange:i,onClear:()=>i(""),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: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}-${u}`))})]})}function rC({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 xr({className:e,style:t}){let{pane:n,search:o,t:r}=Zt("Find"),a=n.tab!=="find",i=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: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(sm,{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"):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(rC,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function Tr({className:e,style:t,children:n}){let{pane:o,t:r}=Zt("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 Bs(e){let t=je(),{t:n,toggle:o=true,className:r,style:a,children:i,...l}=e,c=Ga(l),s=Wa(),d=Ua(),{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(Ns.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":`${fo(g)}px`,...a},children:[o!==false&&!c.open&&jsxRuntime.jsx(Tr,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":m.t("navigation.ariaLabel"),inert:!c.open,children:i??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fr,{}),jsxRuntime.jsx(hr,{}),jsxRuntime.jsx(yr,{}),jsxRuntime.jsx(xr,{})]})})]})})}var ja=Object.assign(Bs,{Header:fr,Close:gr,Title:br,Tabs:hr,Tab:vr,Headings:yr,Find:xr,Toggle:Tr});var uC=600,pC=e=>e.page.total,Ya=Ye.createContext(null);function Xa({className:e,style:t}){let n=je(),o=A(),r=Ct(),a=B(pC),{t:i}=_(),l=Ye.useContext(Ya),[c,s]=Ye.useState(1),[d,u]=Ye.useState(false);if(Ye.useEffect(()=>{if(u(false),!o||!r||a<=1)return;s(o.getCurrentPage("viewport"));let g=null,p=()=>{s(o.getCurrentPage("viewport")),u(true),g&&clearTimeout(g),g=setTimeout(()=>u(false),uC);};return r.addEventListener("scroll",p,{passive:true}),()=>{r.removeEventListener("scroll",p),g&&clearTimeout(g);}},[o,a,r]),a<=1)return null;let m=l?l("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:m})}var gC=[],bC=e=>e.fontSubstitutions??gC;function Qa({className:e,style:t,t:n}){let o=B(bC),{t:r}=_(),a=n??r,[i,l]=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:()=>l(c),children:a("common.dismiss")})]})}var Ve={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function qs(e){return Math.round(e/1440*100)/100}function pm(e){return Math.round(e*1440)}function yC(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 Ks(){let e=A(),t=Ye.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return B(t,yC)}function Ja(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 Sr(e,t){let[n,o]=Ye.useState(null),r=Ye.useCallback(l=>o(l),[]),[a,i]=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){i({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?Ja(c,b.left,C):{left:b.left,top:C},y=v.left,T=v.top,M=x?c.scrollLeft+8:8;i({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:a}}function PC(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 EC=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Cr(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 wC(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=A(),[a,i]=Ye.useState(false),l=Ye.useRef(null),[c,s]=Ye.useState(""),[d,u]=Ye.useState("");Ye.useEffect(()=>{a&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(s(String(qs(t.headerDistanceTwips))),u(String(qs(t.footerDistanceTwips)))));},[a,t.headerDistanceTwips,t.footerDistanceTwips]),Ye.useEffect(()=>{if(!a)return;let T=M=>{l.current?.contains(M.target)||i(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[a]);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=Cr(m),P=Cr(g),x=Cr(p),C=Cr(f),v=Cr(b),y=(T,M)=>{if(!r)return;let w=Number.parseFloat(M);Number.isFinite(w)&&r.exec({type:"setHeaderFooterOptions",[T]:pm(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":a,"aria-haspopup":"menu",onClick:()=>i(T=>!T),onMouseDown:n,children:o("headerFooter.options")}),a?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[EC.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),i(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"}),i(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function ei({className:e}){let{t}=_(),n=Ks(),o=Ye.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=Sr(o,"story-label"),a=O;if(!n?.editing)return null;let i=PC(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(wC,{state:n,onMouseDown:a})]})}function ho(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var ti=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"})}),NC="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",LC="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",HC="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",FC="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 AC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=vt(),i=Ye.useRef(null),{state:l,close:c}=a;Ye.useEffect(()=>{if(l.mode==="closed")return;let f=h=>{h.key==="Escape"&&(h.preventDefault(),c());},b=h=>{let P=i.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=i.current;if(!f||!b){d(null);return}let h=b.offsetParent;if(!h){d(null);return}let{left:P,top:x}=Ja(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(OC,{children:o}):o;if(n)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let p={ref:i,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:ho,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 OC({children:e}){let{state:t}=vt(),n=Ye.useMemo(()=>ZC(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(js,{})),o("Error",jsxRuntime.jsx(Xs,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Ys,{})),o("Cancel",jsxRuntime.jsx(Qs,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&xn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx($s,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Ws,{})),r?o("Edit",jsxRuntime.jsx(Us,{})):null,r?o("Unlink",jsxRuntime.jsx(Gs,{})):null]}),n.__extra]})}function ZC(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(Tn)??BC}var BC={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 $s({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:a}=vt(),{t:i}=_();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=i(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:ho,...l?{}:{onClick:()=>a(),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,ti(FC)]})}$s.docxHyperLinkPart="Url";function Ws({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:a,copy:i}=vt(),{t:l}=_();if(n||!a.link?.href)return null;let c=a.copied?l("editor.linkCopied"):l("hyperlinkPopup.copyLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...a.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:ho,onClick:()=>{i();}};return t?jsxRuntime.jsx(W,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:r??o??ti(NC)})}Ws.docxHyperLinkPart="Copy";function Us({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:a}=vt(),{t:i}=_();if(n)return null;let l=i("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":l,title:l,onMouseDown:ho,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??ti(LC)})}Us.docxHyperLinkPart="Edit";function Gs({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:a}=vt(),{t:i}=_();if(n)return null;let l=i("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":l,title:l,onMouseDown:ho,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??ti(HC)})}Gs.docxHyperLinkPart="Unlink";function js({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:a,close:i}=vt(),{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(),a();return}m.key==="Escape"&&(m.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: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})]})}js.docxHyperLinkPart="Fields";function Ys({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:a}=vt(),{t:i}=_();if(n)return null;let l=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:ho,onClick:()=>a()};return t?jsxRuntime.jsx(W,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??l})}function Xs({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")})}Xs.docxHyperLinkPart="Error";Ys.docxHyperLinkPart="Apply";function Qs({className:e,asChild:t,hidden:n,children:o}){let{close:r}=vt(),{t:a}=_();if(n)return null;let i=a("hyperlinkPopup.cancel"),l={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:ho,onClick:()=>r()};return t?jsxRuntime.jsx(W,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:o??i})}Qs.docxHyperLinkPart="Cancel";var oi=Object.assign(AC,{Url:$s,Copy:Ws,Edit:Us,Unlink:Gs,Fields:js,Error:Xs,Apply:Ys,Cancel:Qs});function qC(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 Js(){let e=A(),t=Ye.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=B(t,qC);return n?.kind==="note"?n:null}function vm(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 ym(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&&vm(e.documentAuthored,t.documentAuthored)&&vm(e.sectionAuthored,t.sectionAuthored)}function KC(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&ym(e.footnote,t.footnote)&&ym(e.endnote,t.endnote)}function ec(){let e=A(),t=Ye.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return B(t,KC)}var zC=/^(footnote|endnote):(-?\d{1,10})$/;function Tm(e){let t=zC.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function VC(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function oc(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 $C(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 ni({className:e}){let{t}=_(),n=A(),o=Js(),[r,a]=Ye.useState(null),[i,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=Sr(u,"story-label"),g=Ye.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,a(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(VC())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(()=>{a({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=i?Tm(i.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=oc(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),C=oc(h??{type:"convertNote",fromKind:"footnote",noteId:0}),v=oc(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?Tm(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($C,{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,i&&f?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:!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(WC,{onClose:()=>s(false),onApply:w=>{p(w),s(false);}}):null]}):null}function WC(e){let{t}=_(),n=A(),o=ec(),[r,a]=Ye.useState("document"),[i,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=>a(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:i,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:i,numRestart:c,position:d},endnote:{numFmt:m,numRestart:p,position:b}};n.can(C).ok&&e.onApply(C);},children:t("common.apply")})]})]})})}var ri=Ye.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function vo(){return Ye.useContext(ri)}function Pm(){return Ye.useContext(ri).target}var Em=["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"],wm=["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"],Mm=["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"],Im=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],km=["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"],_m=["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 ai(e,t,n){return Object.assign(({icon:r,labelKey:a,shortcutKey:i,className:l,hidden:c})=>{let s=A(),{close:d}=vo(),u=_e(),{isEnabled:m,disabledReason:g}=ne(t);return c?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),shortcut:u(i??n.shortcutKey),disabled:!m,...g?{title:g}:{},onSelect:()=>{s?.exec(t),d(true);},...l?{className:l}:{},children:u(a??n.labelKey)})},{docxRow:e})}var Er=ai("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:Em}),wr=ai("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:wm}),Mr=ai("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Rm}),Rr=ai("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:_m});function Qo({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let a=A(),{close:i,clipboardRefusal:l,reportClipboardRefusal:c}=vo(),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(Mm),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!u||g,...l??m?{title:l??m??""}:{},onSelect:()=>{(async()=>{try{let p=await navigator.clipboard.readText();p&&a?.exec({type:"paste",text:p});}catch(p){c(p instanceof Error?p.message:"the clipboard is not readable");}finally{i(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.paste")})}Qo.docxRow="edit.paste";function yo(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:l,destructive:c})=>{let{close:s}=vo(),d=_e(),u=ii(),{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":""}${i?` ${i}`:""}`,onSelect:()=>{p()&&s(true);},children:d(a??n.labelKey)})},{docxRow:e})}var Jo=yo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),en=yo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),tn=yo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),on=yo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),nn=yo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),rn=yo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),an=yo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),jC=[{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 xo({hidden:e}){let{close:t}=vo(),n=_e(),o=ii(),r=ne({type:"setTableCellVerticalAlignment",alignment:"top"}),a=ne({type:"setTableCellVerticalAlignment",alignment:"center"}),i=ne({type:"setTableCellVerticalAlignment",alignment:"bottom"}),l=[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:jC.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)})})]})}xo.docxRow="table.cellVerticalAlignment";function Nm(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:l})=>{let c=A(),{close:s,tocId:d}=vo(),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);},...i?{className:i}:{},children:u(a??n.labelKey)})},{docxRow:e})}var ln=Nm("toc.refresh","entire",{labelKey:"toc.refresh",paths:Im}),sn=Nm("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:km});function ii(){return B(Ye.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function li({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:a,onSelect:i,className:l}){let{close:c}=vo();return jsxRuntime.jsx(Ne,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...a!==void 0?{active:a}:{},onSelect:()=>{i?.(),c(true);},...l?{className:l}:{},children:e})}var di=8,JC=e=>e.editingMode==="viewing";function eP(){let e=A(),t=Ye.useContext(at),n=Je(),o=_e(),r=e?.can({type:"toggleReviewPane"}),a=B(JC),i=!r?.ok||a||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ne,{icon:te(l?.paths),slot:"review.comments",disabled:i,title:r&&!r.ok?r.reason:a?o("editingMode.viewingHint"):void 0,onSelect:()=>{t?.requestCommentDraft()&&n.setOpenMenu(null);},children:o("comments.addComment")})}var tP=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(Er,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(wr,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Qo,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(Mr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(Rr,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(wt,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(eP,{})}];function oP(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Jo.docxRow,render:()=>jsxRuntime.jsx(Jo,{})},{kind:"row",id:en.docxRow,render:()=>jsxRuntime.jsx(en,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:tn.docxRow,render:()=>jsxRuntime.jsx(tn,{})},{kind:"row",id:on.docxRow,render:()=>jsxRuntime.jsx(on,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:nn.docxRow,render:()=>jsxRuntime.jsx(nn,{})},{kind:"row",id:rn.docxRow,render:()=>jsxRuntime.jsx(rn,{})},{kind:"row",id:an.docxRow,render:()=>jsxRuntime.jsx(an,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:xo.docxRow,render:()=>jsxRuntime.jsx(xo,{})}]}function nP(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:ln.docxRow,render:()=>jsxRuntime.jsx(ln,{})},{kind:"row",id:sn.docxRow,render:()=>jsxRuntime.jsx(sn,{})}]}function rP(e,t=false){return [...tP,...e?oP():[],...t?nP():[]]}function Om(e){if(!Ye.isValidElement(e))return null;let t=Ao(e,Om);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 Fm(e){if(!Ye.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function aP(e){return e?.closest(".docx-editor__scroll-container")??null}function kr({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:a}){let i=je(),l=A(),{t:c}=_(),s=ii(),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(()=>rP(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=aP(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-di,I=window.innerHeight-L-di,z=Math.max(di,m.x>R?m.x-k:m.x),Z=Math.max(di,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(er.Provider,{value:M,children:jsxRuntime.jsx(ri.Provider,{value:D,children:jsxRuntime.jsxs("div",{ref:u,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 k=u.current;if(!k)return;let L=ro(k);H.key==="ArrowDown"?(H.preventDefault(),st(L,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),st(L,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),ct(L,"first")):H.key==="End"&&(H.preventDefault(),ct(L,"last"));},children:[Ye.Children.toArray(a).filter(Fm),sa({entries:P,children:Ye.Children.toArray(a).filter(H=>!Fm(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:Om,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(so,{}):H.render()})]})})}):null})}var ac=Object.assign(kr,{Cut:Er,Copy:wr,Paste:Qo,Delete:Mr,SelectAll:Rr,InsertRowAbove:Jo,InsertRowBelow:en,InsertColumnLeft:tn,InsertColumnRight:on,DeleteTableRow:nn,DeleteTableColumn:rn,DeleteTable:an,CellVerticalAlignment:xo,RefreshToc:ln,RefreshTocPageNumbers:sn,Item:li,Slot:wt,Row:Ne,Group:nr,Separator:so,Submenu:lo});function ic(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"})}),cP="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",dP="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",uP={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},pP={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},mP={color:"var(--doc-text-muted)",flexShrink:0},fP={textAlign:"right",wordBreak:"break-word"},gP={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},bP={display:"flex",gap:8,marginTop:4},qm={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 hP(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 vP(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 cn({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:pP,"data-testid":n,children:[jsxRuntime.jsx("span",{style:mP,children:e}),jsxRuntime.jsx("span",{style:fP,children:t})]})}function yP({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=ft(),i=Ye.useRef(null),l=Ye.useId(),{t:c}=_(),{control:s,inspectorOpen:d,closeInspector:u}=a;if(Ye.useEffect(()=>{if(!d)return;let f=h=>{h.key==="Escape"&&(h.preventDefault(),u());},b=h=>{let P=i.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(Km,{}),jsxRuntime.jsx(zm,{}),jsxRuntime.jsx("div",{style:bP,children:jsxRuntime.jsx(Vm,{})}),o]}):o,g={ref:i,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:uP,onMouseDown:f=>{ic(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 Km({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=ft(),{t:a}=_();if(n)return null;let i={style:gP,className:e??void 0,"data-testid":"content-control-inspector-header"},l=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:{...qm,padding:4,border:"none",background:"transparent"},onMouseDown:ic,onClick:()=>r(),children:Bm(cP)})]});return t?jsxRuntime.jsx(W,{...i,children:l}):jsxRuntime.jsx("div",{...i,children:l})}function zm({className:e,asChild:t,hidden:n,children:o}){let{control:r}=ft(),{t:a}=_();if(n||!r)return null;let i=a("contentControl.inspectorPanel.empty"),l=a("contentControl.inspectorPanel.yes"),c=a("contentControl.inspectorPanel.no"),s=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(cn,{label:a("contentControl.inspectorPanel.alias"),value:r.alias??i,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(cn,{label:a("contentControl.inspectorPanel.tag"),value:r.tag??i,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(cn,{label:a("contentControl.inspectorPanel.type"),value:a(hP(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(cn,{label:a("contentControl.inspectorPanel.lock"),value:a(vP(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(cn,{label:a("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(cn,{label:a("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: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:s}):jsxRuntime.jsx("div",{...d,children:s})}function Vm({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:l,closeInspector:c}=ft(),{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:!a,...a?{}:{"data-disabled":""},"aria-label":d,title:i??d,style:qm,onMouseDown:ic,onClick:()=>{l().ok&&c();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??Bm(dP),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(W,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}var ui=Object.assign(yP,{Header:Km,Fields:zm,Remove:Vm});var CP={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},PP={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},EP={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},wP={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},MP={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},RP={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)"},IP={padding:"8px 12px"},kP={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},_P={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},DP={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function NP({forwardedRef:e}){let t=A(),n=Ye.useRef(null);return n.current=t,yd({ref:e,editorRef:n}),null}var LP=Ye.forwardRef(function(t,n){let{document:o,fonts:r,className:a,t:i,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(Nc);Ye.useEffect(()=>{if(m==="system")return Hc(k)},[m]);let L=Lc(m,H),{t:R}=_(),I=Ye.useCallback((j,Re)=>i?i(j,Re):R(j,Re),[i,R]),z=jsxRuntime.jsxs(ra,{className:l?L?"dark":void 0:a,style:l?PP:void 0,children:[l?jsxRuntime.jsx(ei,{}):null,l?jsxRuntime.jsx(ni,{}):null,jsxRuntime.jsx(jr,{}),jsxRuntime.jsx(oi,{hidden:M===false}),w===false?null:jsxRuntime.jsx(kr,{t:I,...typeof w=="object"?w:{}}),jsxRuntime.jsx(ui,{}),F&&l?jsxRuntime.jsx("div",{style:MP,"aria-hidden":"true",children:jsxRuntime.jsx(za,{})}):null,t.children]}),Z=l?jsxRuntime.jsxs("div",{className:`docx-editor${L?" dark":""}${a?` ${a}`:""}`,style:CP,children:[jsxRuntime.jsxs("div",{style:RP,children:[jsxRuntime.jsxs("div",{style:kP,children:[d?.(),jsxRuntime.jsxs("div",{style:_P,children:[s?jsxRuntime.jsx("input",{"aria-label":I("titleBar.documentNameAriaLabel"),value:c??"",placeholder:I("titleBar.untitled"),onChange:j=>s(j.target.value),style:DP}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??I("titleBar.untitled")}),E!==false?jsxRuntime.jsx(ir,{t:I,...c!==void 0?{fileName:c}:{},...y?{onOpen:y}:{},...T?{onSave:T}:{},...typeof E=="object"?E:{}}):null]}),u?.()]}),jsxRuntime.jsx("div",{style:IP,children:jsxRuntime.jsx(Qn,{t:I})})]}),F?jsxRuntime.jsx("div",{style:wP,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(Ka,{})}):null,jsxRuntime.jsx(Qa,{t:I}),jsxRuntime.jsxs("div",{style:EP,children:[D?jsxRuntime.jsx(ja,{t:I}):null,z,jsxRuntime.jsx(Ya.Provider,{value:I,children:jsxRuntime.jsx(Xa,{})}),jsxRuntime.jsx(Xr,{overlay:true})]})]}):z,V=Ye.useCallback(j=>I(j),[I]);return jsxRuntime.jsxs(En,{...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(NP,{forwardedRef:n}),jsxRuntime.jsx(no.Provider,{value:l,children:Z})]})}),HP=Ye.forwardRef(function(t,n){return jsxRuntime.jsx(Do,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(LP,{...t,ref:n})})}),FP=Object.assign(HP,{Root:En,Viewport:ra,Content:jr,Toolbar:Qn,Menu:ir,Loading:Xr,ColorByChangeType:ji,AuthorStyle:Yi,HorizontalRuler:Ka,VerticalRuler:za,DocumentOutline:Ds,Navigation:ja,PageSetupDialog:Jn,PageNumber:Xa,FontNotice:Qa,HeaderFooterChrome:ei,NotesChrome:ni,HyperLink:oi,ContextMenu:ac,ContentControl:ui});function ZP(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function BP(e){return typeof e=="function"?e():e}function qP(e,t={}){let[n,o]=Ye.useState(void 0),[r,a]=Ye.useState(void 0),[i,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 BP(g);p&&a(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=ZP(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:i,isLoading:c||!d}}function $P(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(s=>s!==void 0);if(i.length===0)return;let{epoch:l,...c}=editor.composeFontConfiguration(i[0],...i.slice(1));return c},[])}var Gm=[],GP=()=>{};function jP(){let e=A(),t=Ye.useCallback(n=>{if(!e)return GP;let o=Bi(n),r=e.on("change",o),a=e.on("selectionChange",o);return ()=>{r(),a();}},[e]);return Ye.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Gm,()=>Gm)}function QP(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function JP(){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=QP(e),a=t.current;return (r===null?a===null:a!==null&&e1(a,r))?a:(t.current=r,r)},[e]);return Ye.useSyncExternalStore(n,o,()=>null)}function e1(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function lc({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:a,documentFontFamily:i,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",...i?{fontFamily:i}:{}},className:a?`docx-paginated-surface ${a}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Nr=Ye.createContext(null);function Ym(){let e=Ye.useContext(Nr);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function c1(e){return "type"in e&&e.type==="separator"}var Jm={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"},d1={...Jm,background:"var(--doc-bg-hover)"},ef={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"},u1={...ef,opacity:.4,cursor:"default"},p1={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},m1={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},f1={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 Lr({label:e,items:t,disabled:n,showChevron:o=false}){let[r,a]=Ye.useState(false),[i,l]=Ye.useState(null),c=Ye.useRef(null),s=Ye.useRef(null),[d,u]=Ye.useState({top:0,left:0}),m=Ye.useCallback(()=>{a(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&&a(!r),onMouseDown:p=>p.preventDefault(),disabled:n,style:r?d1:Jm,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(c1(p))return jsxRuntime.jsx("div",{style:p1},`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=i===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?u1:ef,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:m1,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:f1,onMouseDown:x=>x.preventDefault(),children:b.submenuContent(m)})]},b.label)})})]})}var dc=18,b1=2,of={width:dc,height:dc,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},h1={...of,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},v1={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function nf({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=Ye.useState(0),[a,i]=Ye.useState(0),l=Ye.useCallback(()=>{o>0&&a>0&&e(o,a);},[o,a,e]),c=[];for(let d=1;d<=t;d++)for(let u=1;u<=n;u++){let m=d<=o&&u<=a;c.push(jsxRuntime.jsx("div",{style:m?h1:of,onMouseEnter:()=>{r(d),i(u);},onClick:l,role:"gridcell","aria-selected":m},`${d}-${u}`));}let s=o>0&&a>0?`${a} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:b1,gridTemplateColumns:`repeat(${n}, ${dc}px)`},onMouseLeave:()=>{r(0),i(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:v1,children:s})]})}function S1({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 C1(){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 fi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function P1(e){return e.replace(/\.docx$/i,"")}function pc({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),a=n??r("titleBar.untitled"),i=P1(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:i,onChange:l=>{let c=l.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 gi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function bi(){let{t:e}=_(),t=Ym(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:a,onSave:i,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||a||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[v&&jsxRuntime.jsx(Lr,{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)&&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(Lr,{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(Lr,{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(nf,{onInsert:(T,M)=>{x(T,M),y();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:y=>jsxRuntime.jsx(S1,{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(Lr,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>tr()}]})]})}function mc({children:e}){let t=null,n=null,o=[],r=[];Ye.Children.forEach(e,i=>{Ye.isValidElement(i)&&(i.type===fi?t=i:i.type===gi?n=i:i.type===bi?r.push(i):o.push(i));});let a=Ye.useCallback(i=>{let l=i.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.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(C1,{})}),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 hi={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},R1={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:""},rf={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 I1(e,t){let n=rf[t]??rf[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:hi[n]??"000000"}function af(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 fc(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${af(e.value)??n}`;let o=Object.entries(t?.colorScheme??hi).map(([a,i])=>({slot:a,hex:String(i)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:I1(t,e.slot)}`}function Rt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?af(e.value):fc(e,t).slice(1)}function lf(e){if(!e||e==="none")return "";let t=R1[e];return t?`#${t}`:""}var k1=[{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"}],_1=[{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 sf(e){let t=e??hi;return _1.map(n=>k1.map(o=>{let r=t[o.slot]??hi[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 L1=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(L1({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,a]=Ye__namespace.useState(false),[i,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});}a(true);},o);},[o,n]),u=Ye__namespace.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),a(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:i.x,top:i.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var Kt=pe__namespace.Root,zt=pe__namespace.Group,vi=pe__namespace.Value;function Vt({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(Z1,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function $t({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 So({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(B1,{className:"h-4 w-4"})})})]})}function Co({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Separator,{className:J("-mx-1 my-1 h-px bg-muted",e),...t})}function Z1({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 B1({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 gc(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 q1=[{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 uf({value:e,onChange:t,fonts:n=q1,documentFonts:o,disabled:r=false,className:a,placeholder:i="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()||gc(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:i,[e,u,i]),g=Ye__namespace.useCallback(f=>{let b=u.find(h=>h.name===f);b&&t?.(gc(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(Kt,{value:m,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(Vt,{className:J("h-8 text-sm",a),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":s("font.selectAriaLabel"),children:jsxRuntime.jsx(vi,{placeholder:i,children:m})}),jsxRuntime.jsxs($t,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(zt,{children:[jsxRuntime.jsx(So,{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(Co,{})]}),p["sans-serif"].length>0&&jsxRuntime.jsxs(zt,{children:[jsxRuntime.jsx(So,{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(Co,{}),jsxRuntime.jsxs(zt,{children:[jsxRuntime.jsx(So,{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(Co,{}),jsxRuntime.jsxs(zt,{children:[jsxRuntime.jsx(So,{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(Co,{}),jsxRuntime.jsx(zt,{children:p.other.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))})]})]})]})}function bc(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function $1(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 s=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),u=$1(s.bottom+4,s.right-d.width,d.width,d.height);i(u);}else i({top:s.bottom+4,left:s.left});}):i({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:a.top,left:a.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:l}}var G1=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],j1=1,Y1=400;function ff(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function gf(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 bf({value:e,onChange:t,sizes:n=G1,disabled:o=false,className:r,placeholder:a="11",minSize:i=j1,maxSize:l=Y1}){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(a,10)||11),v=e!==void 0?e.toString():a,y=Ye.useCallback(k=>{if(k.preventDefault(),o)return;let L=gf(C,n,i);t?.(L);},[C,n,i,o,t]),T=Ye.useCallback(k=>{if(k.preventDefault(),o)return;let L=ff(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>=i&&k<=l){let L=Math.round(k*2)/2;t?.(L);}},[u,i,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=ff(C,n,l);m(L.toString()),t?.(L);}else if(k.key==="ArrowDown"){k.preventDefault();let L=gf(C,n,i);m(L.toString()),t?.(L);}},[E,C,n,l,i,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<=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: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 J1=[{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"}],xi=18,eE=2,tE={position:"relative",display:"inline-block"},oE={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)"},nE={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},yc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},xc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},yf={display:"grid",gap:`${eE}px`},Ti={width:`${xi}px`,height:`${xi}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},xf={...Ti,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},Tf={...Ti,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},rE={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)"},aE={display:"flex",alignItems:"center",gap:"6px"},iE={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},lE={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},hf={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},sE={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},cE={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)"},dE={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 Tc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=lf(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return fc(e,n)}function vf(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 Sf(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():Rt(e,n))===t.toUpperCase():false}function uE({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,a]=Ye.useState(null);return jsxRuntime.jsx("div",{style:{...yf,gridTemplateColumns:`repeat(10, ${xi}px)`},children:e.flatMap((i,l)=>i.map((c,s)=>{let d=`${l}-${s}`,u=r===d,m=Sf(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...m?Tf:u?xf:Ti,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":m,onClick:()=>o(c),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>a(d),onMouseLeave:()=>a(null)},d)}))})}function pE({selectedColor:e,theme:t,onSelect:n}){let[o,r]=Ye.useState(null),{t:a}=_();return jsxRuntime.jsx("div",{style:{...yf,gridTemplateColumns:`repeat(10, ${xi}px)`},children:J1.map((i,l)=>{let c=o===l,s=Sf(e,i.hex,t),d=a(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?Tf:c?xf:Ti,backgroundColor:`#${i.hex}`},title:d,"aria-label":d,"aria-selected":s,onClick:()=>n(i.hex),onMouseDown:u=>u.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},i.hex)})})}function wo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:a,style:i,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=Tc(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(()=>sf(H),[H]),L=Ye.useMemo(()=>Tc(t,e,o),[t,e,o]),R=Ye.useMemo(()=>Tc(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={...oE,...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 ${a||""}`,style:{...tE,...i},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...sE,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...cE,...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:{...hf,backgroundColor:R==="transparent"?"#fff":R,outline:R==="transparent"||vf(R)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...dE,...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:{...hf,backgroundColor:L==="transparent"?"#fff":L,outline:L==="transparent"||vf(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,...nE},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:rE,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:xc}),jsxRuntime.jsx("div",{style:yc,children:M("colorPicker.themeColors")}),jsxRuntime.jsx(uE,{matrix:k,selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:xc}),jsxRuntime.jsx("div",{style:yc,children:M("colorPicker.standardColors")}),jsxRuntime.jsx(pE,{selectedColor:t,theme:o,onSelect:Z}),jsxRuntime.jsx("div",{style:xc}),jsxRuntime.jsx("div",{style:yc,children:M("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:aE,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:iE,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:{...lE,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 Fr=20,Sc=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:Fr}),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:Fr}),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:Fr}),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:Fr}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function Ef({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,a]=Ye.useState(false),i=Ye.useCallback(()=>a(false),[]),{containerRef:l,dropdownRef:c,dropdownStyle:s,handleMouseDown:d}=$e({isOpen:r,onClose:i}),u=Ye.useCallback(h=>{n||t?.(h),a(false);},[n,t]),m=Sc.find(h=>h.value===e)||Sc[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&&a(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:Fr}),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:Sc.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 Si(){return {type:"none",level:0,isInList:false}}var hE={display:"inline-flex",alignItems:"center",gap:"4px"},wf={display:"inline-flex",alignItems:"center",gap:"4px"},wi={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)"},vE={...wi,backgroundColor:"var(--doc-bg-hover)"},yE={...wi,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},xE={...wi,cursor:"default",opacity:.38},TE={width:"28px",height:"28px",padding:"2px"},SE={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Ci=20;function Pi({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,style:i}){let[l,c]=Ye.useState(false),s={...t?xE:e?yE:l?vE:wi,...i},d=u=>{u.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${a||""}`,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 Mf({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:a=false,className:i,style:l,showIndentButtons:c=true,compact:s=false,hasIndent:d=false}){let{t:u}=_(),m=Ye.useCallback(()=>s?{...TE}:{},[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 ${i||""}`,style:{...hE,...l},role:"group","aria-label":u("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:wf,role:"group","aria-label":u("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Pi,{active:g,disabled:a,title:u("lists.bulletList"),onClick:t,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:Ci})}),jsxRuntime.jsx(Pi,{active:p,disabled:a,title:u("lists.numberedList"),onClick:n,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:Ci})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:SE,role:"separator"}),jsxRuntime.jsxs("div",{style:wf,role:"group","aria-label":u("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Pi,{active:false,disabled:a||!b,title:u("lists.decreaseIndent"),onClick:r,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:Ci})}),jsxRuntime.jsx(Pi,{active:false,disabled:a,title:u("lists.increaseIndent"),onClick:o,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:Ci})})]})]})]})}var PE=[{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 If({value:e,onChange:t,options:n=PE,disabled:o=false,className:r}){let{t:a}=_(),i=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?a(s.labelKey):s.label;return jsxRuntime.jsxs(Kt,{value:i.twipsValue.toString(),onValueChange:l,disabled:o,children:[jsxRuntime.jsx(Vt,{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(ks,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs($t,{children:[n.map(s=>jsxRuntime.jsx(tt,{value:s.twipsValue.toString(),children:c(s)},s.twipsValue)),jsxRuntime.jsx(Co,{}),jsxRuntime.jsx(zt,{children:jsxRuntime.jsx(So,{children:a("lineSpacing.blockSpacingRules")})})]})]})}var EE={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},wE=new Set(["Title","Heading1","Heading2","Heading3"]),ME={Subtitle:"666666"},RE="#4a6c8c";function kf(e){let t=EE[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??wE.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??ME[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=RE),o}function _f(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 Df=[{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 Nf({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:a=120}){let{t:i}=_(),l=Ye__namespace.useMemo(()=>{let g=_f(n);return g.length===0?Df:g.map(p=>({...p,type:"paragraph",nameKey:Df.find(f=>f.styleId===p.styleId)?.nameKey}))},[n]),c=Ye__namespace.useCallback(g=>{t?.(g);},[t]),s=g=>g.nameKey?i(g.nameKey):g.name,d=e||"Normal",u=l.find(g=>g.styleId===d),m=u?s(u):d;return jsxRuntime.jsxs(Kt,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(Vt,{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:m})}),jsxRuntime.jsx($t,{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:kf(g),children:s(g)})},g.styleId))})]})}var kE=[{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 Hf({value:e=1,onChange:t,levels:n=kE,disabled:o=false,className:r,compact:a=false}){let{t:i}=_(),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=a?"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":i("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(Kt,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(Vt,{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:l}),children:jsxRuntime.jsx(vi,{placeholder:"100%",children:l})}),jsxRuntime.jsx($t,{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":i("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var DE=[{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 Of({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=Ye.useState(false),a=Ye.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=$e({isOpen:o,onClose:a}),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:i,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:DE.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 Zf({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 l=i.kind==="auto"?"000000":Rt(i,n);l&&e({type:"borderColor",color:l});},[e,n]);return jsxRuntime.jsx(wo,{mode:"border",value:o,onChange:a,theme:n,disabled:t,title:r("table.borderColor")})}var FE=[{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 qf({onAction:e,disabled:t=false}){let[n,o]=Ye.useState(false),{t:r}=_(),a=Ye.useCallback(()=>o(false),[]),{containerRef:i,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=$e({isOpen:n,onClose:a}),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:i,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:FE.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 zf({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(wo,{mode:"highlight",value:o,onChange:a,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var OE={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"},Io={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Wf={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Uf({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,a]=Ye.useState(false),[i,l]=Ye.useState(null),c=Ye.useCallback(()=>a(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),a(false);},[e]),f=(h,P,x,C,v)=>{let y=t||v?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...OE,backgroundColor:i===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&&a(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:Io,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:Io,role:"separator"}),f("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Io,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:Io,role:"separator"}),jsxRuntime.jsx("div",{style:Wf,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:Io,role:"separator"}),jsxRuntime.jsx("div",{style:Wf,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:Io,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:Io,role:"separator"}),f("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var BE=20;function Ii({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:a=false,ariaLabel:i,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=>{a||r(P),d(false);},[a,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",a&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!a&&d(P=>!P),disabled:a,"aria-label":i??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:BE}),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&&!a&&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 qE=[{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 KE(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function jf({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=qE.map(l=>({...l,label:o(l.labelKey)})),a=KE(e),i=r.find(l=>l.value===a)||r[0];return jsxRuntime.jsx(Ii,{options:r,activeValue:a,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var VE=[{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 Yf({onTransform:e,disabled:t=false}){let{t:n}=_(),o=VE.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(Ii,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var pt=18;function ot({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,ariaLabel:i}){let l=i?.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",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":l?`toolbar-${l}`:void 0,children:r});return n?jsxRuntime.jsx(et,{content:n,children:s}):s}function mt({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 jE(e){let t=Ye__namespace.default.useContext(Nr);return t?{...t,...YE(e)}:e}function YE(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function wc(e){let{t}=_(),n=jE(e),{currentFormatting:o={},onFormat:r,onUndo:a,onRedo:i,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&&a&&a();},[s,l,a]),Pe=Ye.useCallback(()=>{!s&&c&&i&&i();},[s,c,i]),G=Ye.useCallback(de=>{!s&&r&&r({type:"fontFamily",value:de});},[s,r]),q=Ye__namespace.default.useMemo(()=>bc(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]),mn=Ye.useCallback(()=>{!s&&r&&r("bulletList");},[s,r]),_o=Ye.useCallback(()=>{!s&&r&&r("numberedList");},[s,r]),Zr=Ye.useCallback(()=>{!s&&r&&r("indent");},[s,r]),i0=Ye.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),l0=Ye.useCallback(de=>{!s&&r&&(r({type:"lineSpacing",value:de}),requestAnimationFrame(()=>k?.()));},[s,r,k]),s0=Ye.useCallback(de=>{!s&&r&&r({type:"applyStyle",value:de});},[s,r]),fn=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 gn=ue.target,Ic=g?.current,u0=Re.current,p0=Ic?.contains(gn),m0=u0?.contains(gn);if(!p0&&!m0)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 c0=Ye.useCallback(de=>{let ue=de.target;ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.tagName==="OPTION"||de.preventDefault();},[]),d0=Ye.useCallback(de=>{let ue=de.target,gn=document.activeElement;ue.tagName==="SELECT"||ue.tagName==="OPTION"||gn?.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:c0,onMouseUp:j?void 0:d0,children:[jsxRuntime.jsxs(mt,{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:pt})}),jsxRuntime.jsx(ot,{onClick:Pe,disabled:s||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:pt})})]}),D&&jsxRuntime.jsx(mt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(Hf,{value:F,onChange:H,disabled:s,compact:true})}),M&&jsxRuntime.jsx(mt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(Nf,{value:o.styleId||"Normal",onChange:s0,styles:w,theme:E,disabled:s,width:120})}),(f||P)&&jsxRuntime.jsxs(mt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(uf,{value:o.fontFamily||"Arial",onChange:G,fonts:q,documentFonts:h,disabled:s,width:60,placeholder:"Arial"}),P&&jsxRuntime.jsx(bf,{value:o.fontSize!==void 0?ll(o.fontSize):11,onChange:Ee,disabled:s,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(mt,{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:pt})}),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:pt})}),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:pt})}),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:pt})}),x&&jsxRuntime.jsx(wo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:Ue,theme:E,disabled:s,title:t("formattingBar.fontColor")}),C&&jsxRuntime.jsx(wo,{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:pt})})]}),jsxRuntime.jsxs(mt,{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:pt})}),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:pt})})]}),v&&jsxRuntime.jsx(mt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(Ef,{value:o.alignment||"left",onChange:Ge,disabled:s})}),(y||T)&&jsxRuntime.jsxs(mt,{label:t("formattingBar.groups.listFormatting"),children:[y&&jsxRuntime.jsx(Mf,{listState:o.listState||Si(),onBulletList:mn,onNumberedList:_o,onIndent:Zr,onOutdent:i0,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),T&&jsxRuntime.jsx(If,{value:o.lineSpacing,onChange:l0,disabled:s})]}),L&&R&&jsxRuntime.jsxs(mt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(jf,{imageContext:L,onChange:R,disabled:s}),I&&jsxRuntime.jsx(Yf,{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:pt})})]}),Z?.isInTable&&V&&jsxRuntime.jsxs(mt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(Of,{onAction:fn,disabled:s}),jsxRuntime.jsx(Zf,{onAction:fn,disabled:s,theme:E,value:Rt(Z?.cellBorderColor,E)}),jsxRuntime.jsx(qf,{onAction:fn,disabled:s}),jsxRuntime.jsx(zf,{onAction:fn,disabled:s,theme:E,value:Z?.cellBackgroundColor}),jsxRuntime.jsx(Uf,{onAction:fn,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:pt})}),p]})}function XE({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(Nr.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=XE;We.TitleBar=mc;We.Logo=fi;We.DocumentName=pc;We.MenuBar=bi;We.TitleBarRight=gi;We.Toolbar=wc;var e2=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"]]),t2=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function o2({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:a,onSave:i,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"?t2(D):Rt(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=e2.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&&i?.(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(uo,{pageSetup:M,zoom:T})}):null,jsxRuntime.jsx(lc,{ref:p,source:e,...m?{documentFontFamily:m}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:v,...a?{onError:a}:{}})]})]})}var _i=class{constructor(t){rt(this,"listeners",new Set);rt(this,"snapshot");rt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t);}));rt(this,"getSnapshot",()=>this.snapshot);this.snapshot=t;}setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var Di=class extends _i{constructor(){super({notifications:[]});rt(this,"notifications",[]);rt(this,"idCounter",0);rt(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 l=setTimeout(()=>{this.timers.delete(l),this.dismiss(a);},5e3);this.timers.add(l);}return a}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var s2=Ye.createContext(null);function t0({children:e}){let t=Ye.useMemo(()=>new Di,[]),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]),a=Ye.useCallback((s,d)=>{t.showInfo(s,d);},[t]),i=Ye.useCallback(s=>{t.dismiss(s);},[t]),l=Ye.useCallback(()=>{t.clearAll();},[t]),c=Ye.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:a,dismissNotification:i,clearNotifications:l}),[n.notifications,o,r,a,i,l]);return jsxRuntime.jsxs(s2.Provider,{value:c,children:[e,jsxRuntime.jsx(c2,{notifications:n.notifications,onDismiss:i})]})}function c2({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(d2,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function d2({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=Ye.useState(false),i=(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: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"},s={color:i.icon,flexShrink:0},d={flex:1,minWidth:0},u={color:i.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:i.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.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:`
|
|
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: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
|
|
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
|
|
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]})})]}),D.totalPages>1&&jsxRuntime.jsx(
|
|
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;
|